CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   is it possible and correct to set a logical condition in variables of groovyBC? (http://www.cfd-online.com/Forums/openfoam-solving/114785-possible-correct-set-logical-condition-variables-groovybc.html)

immortality March 17, 2013 20:21

is it possible and correct to set a logical condition in variables of groovyBC?
 
like "a=t1<=time()<t1+deltaT;"
And then use a in expressions?

gschaider March 18, 2013 07:49

Quote:

Originally Posted by immortality (Post 414568)
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()


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