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

groovy bc, conditioned valueExpression.

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 16, 2015, 04:48
Default groovy bc, conditioned valueExpression.
  #1
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 48
Rep Power: 3
nwpukaka is on a distinguished road
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
nwpukaka is offline   Reply With Quote

Old   March 16, 2015, 09:47
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 294
Rep Power: 9
jherb is on a distinguished road
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.
jherb is offline   Reply With Quote

Old   March 16, 2015, 18:30
Default
  #3
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 48
Rep Power: 3
nwpukaka is on a distinguished road
Quote:
Originally Posted by jherb View Post
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
nwpukaka is offline   Reply With Quote

Reply

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
Engine-pressure BC and velocity field (groovy) Tobi OpenFOAM Pre-Processing 1 July 23, 2014 10:39
groovy BC imani OpenFOAM 1 April 13, 2014 07:43
groovy BC Ahmed Khattab OpenFOAM 4 November 7, 2013 08:51
groovyBC: using gradientExpression instead of valueExpression gregdB OpenFOAM 15 September 20, 2013 08:03
Setting BC for a passive scalar (groovy vs fvOptions) Tobi OpenFOAM Pre-Processing 0 May 23, 2013 14:53


All times are GMT -4. The time now is 05:18.