CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] groovy bc, conditioned valueExpression. (https://www.cfd-online.com/Forums/openfoam-community-contributions/150114-groovy-bc-conditioned-valueexpression.html)

nwpukaka March 16, 2015 03:48

groovy bc, conditioned valueExpression.
 
Dear OpenFOAMer,

I am currently using groovyBC to set my thermal boundary condition, the flow regime is determined based on Reynolds number Re, which is calculated in the "variables", and three different heat transfer coefficients ( hf0, hf1, hf2 ) corresponding to laminar, transition and turbulent are also calculated with "variables". The condition is something like

Code:

if ( Re< 2000 ) hf0;
else if ( Re > 4000 ) hf2;
else hf1;

However, I am not sure how to set the expression in valueExpression session.

Here is the example I found:

Code:

valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? 1 : 0";
It only has two conditions, but 3 conditions in my case, can anybody show me how to do that?

Cheers,
Kan

jherb March 16, 2015 08:47

You could try something like
Code:

valueExpression "Re <= 2000 ? hf0 : (Re <= 4000 ? hf1 : hf2)";
But you still need to find a way to calculate Re and hf1/2/3.

nwpukaka March 16, 2015 17:30

Quote:

Originally Posted by jherb (Post 536498)
You could try something like
Code:

valueExpression "Re <= 2000 ? hf0 : (Re <= 4000 ? hf1 : hf2)";
But you still need to find a way to calculate Re and hf1/2/3.

Thank you, Joachim, this really helps!

Cheers,
Kan


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