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

[swak4Foam] GroovyBC

Register Blogs Community New Posts Updated Threads Search

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

Reply
 
LinkBack Thread Tools Search this Thread 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: 15
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: 4,225
Rep Power: 51
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: 15
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, 08: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: 15
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, 19:19
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
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, 08: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: 15
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: 16
Rep Power: 15
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: 4,225
Rep Power: 51
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


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 08:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 07:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 04:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 08:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 09:49


All times are GMT -4. The time now is 10:28.