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/)
-   -   how can extend character limitation of expressions in groovyBC? (http://www.cfd-online.com/Forums/openfoam-solving/113436-how-can-extend-character-limitation-expressions-groovybc.html)

immortality February 19, 2013 16:22

how can extend character limitation of expressions in groovyBC?
 
I have a long expression for condition on time but it exceeds from groovyBC limitation in 0.2.0 version.how to extend this limit or solve this problem?
Code:

--> FOAM FATAL IO ERROR:
string "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()..."
is too long (max. 1024 characters)

file: /home/ehsan/Desktop/Thesis_Pimple/WR_Pimple/0/U at line 125.

From function ISstream::read(string&)
in file db/IOstreams/Sstreams/ISstream.C at line 531.

FOAM exiting


gschaider February 19, 2013 17:11

Quote:

Originally Posted by immortality (Post 408814)
I have a long expression for condition on time but it exceeds from groovyBC limitation in 0.2.0 version.how to extend this limit or solve this problem?
Code:

--> FOAM FATAL IO ERROR:
string "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()..."
is too long (max. 1024 characters)

file: /home/ehsan/Desktop/Thesis_Pimple/WR_Pimple/0/U at line 125.

From function ISstream::read(string&)
in file db/IOstreams/Sstreams/ISstream.C at line 531.

FOAM exiting


I've never seen that one. Congratulations. Seems like you found a hardcoded limit in OpenFOAM.

Either
- look for the limit somewhere in $FOAM_SRC/OpenFOAM, increase it and recompile OpenFOAM
- split your expression into something more manageable with variables

Second solution is recommended

immortality February 20, 2013 00:13

really? I was thinking you are one of providers of OF but you had not know about that? ;)
I found it and am going to compile.because my expression is a set of conditions.how do you think i can reduce conditions?can they be defined in variables?it shows an error on not knowing them when i define logical conditions in variable list as i propound in other thread.

gschaider February 20, 2013 12:42

Quote:

Originally Posted by immortality (Post 408884)
really? I was thinking you are one of providers of OF but you had not know about that? ;)

I only provide swak4Foam but have nothing to do with the OF-core

Quote:

Originally Posted by immortality (Post 408884)
I found it and am going to compile.because my expression is a set of conditions.how do you think i can reduce conditions?can they be defined in variables?it shows an error on not knowing them when i define logical conditions in variable list as i propound in other thread.

Either put "branches" in variables or (if the points in time at which something is happening are fixed and between those there are linear transitions) investigate the use of timelines/lookuptables

immortality February 20, 2013 12:56

a brief expression as instance is as below.how can it be set in variables?(you mean thw conditions or expressions by "branches"?)(my conditions are verbose not expressions)
Code:

valueExpression "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()<=t1+c4)||(t2+c1<=time()&&time()<=t2+c2)||(t2+c3<=time()&&time()<=t2+c4)||(t3+c1<=time()&&time()<=t3+c2)||(t3+c3<=time()&&time()<=t3+c4)||(t4+c1<=time()&&time()<=t4+c2)||(t4+c3<=time()&&time()<=t4+c4)||(t5+c1<=time()&&time()<=t5+c2)||(t5+c3<=time()&&time()<=t5+c4)||(t6+c1<=time()&&time()<=t6+c2)||(t6+c3<=time()&&time()<=t6+c4)||(t7+c1<=time()&&time()<=t7+c2)||(t7+c3<=time()&&time()<=t7+c4)||(t8+c1<=time()&&time()<=t8+c2)||(t8+c3<=time()&&time()<=t8+c4)||(t9+c1<=time()&&time()<=t9+c2)||(t9+c3<=time()&&time()<=t9+c4)||(t10+c1<=time()&&time()<=t10+c2)||(t10+c3<=time()&&time()<=t10+c4)||(t11+c1<=time()&&time()<=t11+c2)||(t11+c3<=time()&&time()<=t11+c4))?vector(0,v_r,0):mag(internalField(U).x)*normal()";
unfortunately the values change at certain times from value to gradient not from value to another value therefor i cant use timeLines if i undersatand its usage correctly.what can do simply without compiling?

CloarcSaoP November 3, 2015 12:19

Hello,

I am bringing out from the shadows this old post because I am facing the same problem.
In fact, I increased the length of string into /opt/openfoam240/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C file to impose a time-dependent (and x- y-dependent) inlet BC using groovyBC.
However, I did not manage to re-compile OpenFOAM by running ./Allwmake in the /opt/openfoam240/ directory.
With the superuser privileges, I have the following error:
Error: Current directory is not $WM_PROJECT_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.

What do I have to do to take into account the changes made in ISstream.C file?

Regards.


All times are GMT -4. The time now is 21:37.