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

is it possible and correct to set a logical condition in variables of groovyBC?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 17, 2013, 20:21
Default is it possible and correct to set a logical condition in variables of groovyBC?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
like "a=t1<=time()<t1+deltaT;"
And then use a in expressions?
immortality is offline   Reply With Quote

Old   March 18, 2013, 07:49
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,735
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
like "a=t1<=time()<t1+deltaT;"
And then use a in expressions?
Not sure. There might be a bug there in groovyBC. But your expression won't work anyway.

a) deltaT is a function (write deltaT())
b) checking ranges like this won't work you've got to split it into two comparisons "t1<=time() && time()<(t1+deltaT())". What you're doing only works in C++ itself and there it wouldn't give the result you're expecting: first you compare t1 and time() which is either true or false. C++ interprets these as either 1 or 0 and compares these numbers with t1+deltaT()
__________________
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



All times are GMT -4. The time now is 11:55.