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

is it possible to write a simple program in groovyBC according to C++ language?

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

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   February 3, 2013, 06:42
Default is it possible to write a simple program in groovyBC according to C++ language?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 17
immortality is on a distinguished road
the condition?expression1:expression2 makes limitations for me.I need more freedom in conditions.are we limited to groovyBC syntax or exists a way to extend this to if-elseif-else conditions?i need to set several conditions for all fractionExpression,valueExpression and gradientExpression.
immortality is offline   Reply With Quote

Old   February 4, 2013, 01:44
Default
  #2
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 17
immortality is on a distinguished road
i need to be certain.any answer?
immortality is offline   Reply With Quote

Old   February 4, 2013, 05:13
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
the condition?expression1:expression2 makes limitations for me.I need more freedom in conditions.are we limited to groovyBC syntax or exists a way to extend this to if-elseif-else conditions?i need to set several conditions for all fractionExpression,valueExpression and gradientExpression.
You're not serious with that question, right? Of course you can do if-elseif-cascades:
Code:
 cond1 ? val1 : (cond2 ? val2 : val3)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 4, 2013, 05:26
Default
  #4
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 17
immortality is on a distinguished road
i said a simple example.my bc's are unfortunately much complicated.it should include sub or supersonic and inflow or outflow conditions at each patch.thanks.
immortality is offline   Reply With Quote

Old   February 4, 2013, 15:37
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
i said a simple example.
Where? Not in this thread

There is no simpler example
Quote:
Originally Posted by immortality View Post
my bc's are unfortunately much complicated.it should include sub or supersonic and inflow or outflow conditions at each patch.thanks.
Modularize the expressions to make them more readable with variables. A sketch (fill out the dots yourself):

Code:
variables (
  "isSupersonic= .....;"
  "isInflow= .....;"
  "superSonicInVal=....;"
  "subsonicInval=.....;"
);

valueExpression=isInflow ? ( isSuperSonic ? superSonicInVal : subsonicInval) : ...";
fractionExpression= isInflow ? ....";
That should make it readable and consistent.
immortality likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
Lid-Driven cavity flow with SIMPLE method luckyxu Main CFD Forum 6 November 9, 2011 08:17
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 00:52
Simple CFD program John Main CFD Forum 0 March 29, 2003 18:39
The computer language for CFD Ringo Main CFD Forum 50 October 8, 2002 11:14
How to write a simple program ?? kokey FLUENT 0 March 19, 2002 11:21


All times are GMT -4. The time now is 04:08.