CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

GroovyBC

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By gschaider
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   March 23, 2011, 14:36
Question GroovyBC
  #1
Member
 
longamon's Avatar
 
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 6
longamon is on a distinguished road
Hi

I'm trying to use groovybc to specify an inflow condition, however i'm kinda stuck with it. my c++ knowledge is very limited.

the velocity profile i'm trying to implement is

U=min(y,kln(y)+B) , 0 , 0

where k and B are constants, y is the y coordinate of the point. Velocity is only streamwise, the other 2 components at the inlet are 0.

I can create yp=y and kln=k*log(yp)+B, however I don't how to choose the minimum of these two.

I'm using OF 1.7

thanks for any help
longamon is offline   Reply With Quote

Old   March 23, 2011, 16:44
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by longamon View Post
Hi

I'm trying to use groovybc to specify an inflow condition, however i'm kinda stuck with it. my c++ knowledge is very limited.

the velocity profile i'm trying to implement is

U=min(y,kln(y)+B) , 0 , 0

where k and B are constants, y is the y coordinate of the point. Velocity is only streamwise, the other 2 components at the inlet are 0.

I can create yp=y and kln=k*log(yp)+B, however I don't how to choose the minimum of these two.

I'm using OF 1.7

thanks for any help
The min-function in groovyBC takes the minimum of a field and therefore only takes one argument.

The minimum of two fields a and b can be taken with the ?:-notation: (a < b ? a : b)
longamon likes this.
gschaider is offline   Reply With Quote

Old   March 24, 2011, 08:13
Talking thanks
  #3
Member
 
longamon's Avatar
 
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 6
longamon is on a distinguished road

thanks gschaider, that worked like a charm. kudos on the groovyBC app, great tool.
longamon is offline   Reply With Quote

Old   August 10, 2011, 07:08
Default Groovy BC
  #4
Member
 
longamon's Avatar
 
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 6
longamon is on a distinguished road
Hi, its me again. Upgraded to OF 2.0 and installed swak4foam, however the notations has changed a bit. This is the entry for the boundary "Entrada"

Code:
   Entrada
      {
        type            groovyBC;
	valueExpression "vector(ret*nu*v/1.5,0,0);";
        variables       "ret{Entrada}=590;nu{Entrada}=0.000138217;y1{Entrada}=pos().y;ymax{Entrada}=max(y1);y2{Entrada}=ymax-pos().y;yi{Entrada}=(y1<y2?y1:y2);yp{Entrada}=ret*yi/1.5;klny=2.5*log(yp+0.000001)+5;v{Entrada}=(yp<klny?yp:klny);";
        value           uniform (1 0 0);
      }
and it throws this error:

Code:
--> FOAM FATAL ERROR: 
 Parser Error at "1.5-6" :"field y1 not existing or of wrong type"
"max(y1)"
"     ^^"
Appreciate your help

David
longamon is offline   Reply With Quote

Old   August 10, 2011, 18:19
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by longamon View Post
Hi, its me again. Upgraded to OF 2.0 and installed swak4foam, however the notations has changed a bit. This is the entry for the boundary "Entrada"

Code:
   Entrada
      {
        type            groovyBC;
	valueExpression "vector(ret*nu*v/1.5,0,0);";
        variables       "ret{Entrada}=590;nu{Entrada}=0.000138217;y1{Entrada}=pos().y;ymax{Entrada}=max(y1);y2{Entrada}=ymax-pos().y;yi{Entrada}=(y1<y2?y1:y2);yp{Entrada}=ret*yi/1.5;klny=2.5*log(yp+0.000001)+5;v{Entrada}=(yp<klny?yp:klny);";
        value           uniform (1 0 0);
      }
and it throws this error:

Code:
--> FOAM FATAL ERROR: 
 Parser Error at "1.5-6" :"field y1 not existing or of wrong type"
"max(y1)"
"     ^^"
Appreciate your help

David
Hmm. At first: You're working on the patch Entrada anyway, so there's no need to write the variables like this "ret{Entrada}=590" ("ret=590" is sufficient).

In my opinion this should not be the cause of your problem, but could you try it anyway? BTW: Using the external-variables syntax might lead to strange results if used on the "same" patch as external variables always get only one value (which is used for all faces).
longamon likes this.
gschaider is offline   Reply With Quote

Old   August 11, 2011, 07:23
Default
  #6
Member
 
longamon's Avatar
 
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 6
longamon is on a distinguished road
That was it, y1{Entrada}=pos().y was supposed to be a vector and it wasn't

thanks
longamon is offline   Reply With Quote

Old   November 22, 2011, 21:58
Default Elegance Help
  #7
New Member
 
Join Date: Mar 2011
Posts: 10
Rep Power: 6
RygeltheXVI is on a distinguished road
Hail all,
My c++ skill is quite low. Much like the original post I wish to compare to vector fields and get the minimum.
Basically I want:
U=(min(1,pos()z),0,0)

I was wondering how I would go about generating a field of uniform values 1. At the moment my work around is to use field2=(pos().z/pos().z). And seeing as this produces the result I want I'm not exactly complaining as much as I wish to know the 'correct' way to do it in the future.

And so i use:
variables "d=pos().z/pos().z;e=pos().z;profile=(e < d ? e : d)*vector(1,0,0);";
valueExpression "profile";

Its probably something really obvious or implied that I'm not aware of,
Striving for elegance, and Cheers
RygeltheXVI is offline   Reply With Quote

Old   November 23, 2011, 14:45
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by RygeltheXVI View Post
Hail all,
My c++ skill is quite low. Much like the original post I wish to compare to vector fields and get the minimum.
Basically I want:
U=(min(1,pos()z),0,0)

I was wondering how I would go about generating a field of uniform values 1. At the moment my work around is to use field2=(pos().z/pos().z). And seeing as this produces the result I want I'm not exactly complaining as much as I wish to know the 'correct' way to do it in the future.

And so i use:
variables "d=pos().z/pos().z;e=pos().z;profile=(e < d ? e : d)*vector(1,0,0);";
valueExpression "profile";

Its probably something really obvious or implied that I'm not aware of,
Striving for elegance, and Cheers
Since the release that has the date 2011-07-26 (check the README) there is a binary min/max in the parser. So basically

vector(min(pos().z,1),0,0)

should work
gschaider is offline   Reply With Quote

Reply

Tags
groovybc, inlet profile

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
groovyBC and funkySetFields married and got a kid named swak4Foam gschaider OpenFOAM 164 January 13, 2015 03:52
installer et compiler nouvelle librairie: groovyBC FLOAT OpenFOAM 2 March 22, 2011 04:20
Wall heat transfer using groovyBC (XiFoam solver) usergk OpenFOAM 7 February 4, 2011 14:36
Non-normal inflow with groovyBC bjr OpenFOAM 9 January 17, 2011 11:35
groovyBC tamsilian OpenFOAM Programming & Development 1 May 27, 2010 03:15


All times are GMT -4. The time now is 11:43.