|
[Sponsors] |
[swak4Foam] is it possible and correct to set a logical condition in variables of groovyBC? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 17, 2013, 19:21 |
is it possible and correct to set a logical condition in variables of groovyBC?
|
#1 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
like "a=t1<=time()<t1+deltaT;"
And then use a in expressions? |
|
March 18, 2013, 06:49 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
August 26, 2016, 03:44 |
|
#3 |
New Member
DavidTran
Join Date: Aug 2016
Posts: 10
Rep Power: 9 |
||
September 15, 2016, 03:00 |
|
#4 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22 |
Last edited by vasava; September 15, 2016 at 03:04. Reason: add |
|
September 15, 2016, 05:28 |
|
#5 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22 |
I wanted to have a boundary condition that follows a function up to a time and then use a constant value:
f(x) = F+101325; when t<0.0012 and f(x) = 101325; when t>0.0012 Here is what I used (and it worked): Code:
inlet { type groovyBC; value uniform 101325; variables ( "tPositive=0.0012;" "factor=(time()>tPositive) ? 0 : 1;" "inPress=SOME FUNCTION;" ); valueExpression "(inPress*factor)+101325";" } |
|
September 15, 2016, 14:56 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
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 |
||
|
|