|
[Sponsors] |
March 23, 2011, 14:36 |
GroovyBC
|
#1 |
Member
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 15 |
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 |
|
March 23, 2011, 16:44 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The minimum of two fields a and b can be taken with the ?:-notation: (a < b ? a : b) |
||
March 24, 2011, 08:13 |
thanks
|
#3 |
Member
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 15 |
thanks gschaider, that worked like a charm. kudos on the groovyBC app, great tool. |
|
August 10, 2011, 08:08 |
Groovy BC
|
#4 |
Member
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 15 |
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); } Code:
--> FOAM FATAL ERROR: Parser Error at "1.5-6" :"field y1 not existing or of wrong type" "max(y1)" " ^^" David |
|
August 10, 2011, 19:19 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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). |
||
August 11, 2011, 08:23 |
|
#6 |
Member
David Aljure
Join Date: Mar 2011
Location: CTTC Universidad Politécnica de Catalunya. Spain
Posts: 38
Rep Power: 15 |
That was it, y1{Entrada}=pos().y was supposed to be a vector and it wasn't
thanks |
|
November 22, 2011, 21:58 |
Elegance Help
|
#7 |
New Member
Join Date: Mar 2011
Posts: 16
Rep Power: 15 |
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 |
|
November 23, 2011, 14:45 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
vector(min(pos().z,1),0,0) should work |
||
Tags |
groovybc, inlet profile |
|
|
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 |