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

[swak4Foam] groovy bc, conditioned valueExpression.

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2015, 04:48
Default groovy bc, conditioned valueExpression.
  #1
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
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: 650
Rep Power: 21
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: 54
Rep Power: 12
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 Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] Engine-pressure BC and velocity field (groovy) Tobi OpenFOAM Community Contributions 3 October 15, 2018 15:09
[swak4Foam] groovy BC imani OpenFOAM Community Contributions 1 April 13, 2014 08:43
[swak4Foam] groovy BC Ahmed Khattab OpenFOAM Community Contributions 4 November 7, 2013 08:51
[swak4Foam] groovyBC: using gradientExpression instead of valueExpression gregdB OpenFOAM Community Contributions 15 September 20, 2013 09:03
[swak4Foam] Setting BC for a passive scalar (groovy vs fvOptions) Tobi OpenFOAM Community Contributions 0 May 23, 2013 15:53


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