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/)
-   -   A way to update groovyBC variables during the solution (http://www.cfd-online.com/Forums/openfoam-solving/112433-way-update-groovybc-variables-during-solution.html)

immortality January 28, 2013 17:38

A way to update groovyBC variables during the solution
 
hi
I was searching for the cause of not changing the results when I change groovyBC variables for all two days and nights!
I had run till a important time that a change in BC occurs but it need to change a variable for better simulation.i was changing related variables but nothing seem to change! I simplified it and deleted everything but surprisingly it was not fixed.
at last i found that it should be run from starting so that groovyBC can update its variables.
then i search for a way to update groovyBC variables and expressions after stopping the solution during a run.is such thing available?or i have to start from zero folder again and again?
thanks.

immortality January 29, 2013 05:20

is any help available?is it possible by any of groovyBC or pyFOAM utilities?does such thing exist?

gschaider January 29, 2013 14:54

Quote:

Originally Posted by immortality (Post 404636)
hi
I was searching for the cause of not changing the results when I change groovyBC variables for all two days and nights!
I had run till a important time that a change in BC occurs but it need to change a variable for better simulation.i was changing related variables but nothing seem to change! I simplified it and deleted everything but surprisingly it was not fixed.
at last i found that it should be run from starting so that groovyBC can update its variables.
then i search for a way to update groovyBC variables and expressions after stopping the solution during a run.is such thing available?or i have to start from zero folder again and again?
thanks.

I assume you're talking about the variables of groovyBC? These are evaluated at every timstep anew. For additional tests you can add these two settings to the groovyBC:

Code:

debugCommonDriver true;
debug true;

The first setting produces loads of output to the terminal. The second one should write the values of the variables into the outputfiles (but I haven't used that in a long time)

immortality January 31, 2013 14:57

I forgot to put ; after valueExpression so far.but no error has shown.what may be the cause?
I add these expressions in all groovyBC boundary conditions and get a run?
thanks.

gschaider January 31, 2013 16:27

Quote:

Originally Posted by immortality (Post 405366)
I forgot to put ; after valueExpression so far.but no error has shown.what may be the cause?
I add these expressions in all groovyBC boundary conditions and get a run?
thanks.

OpenFOAM doesn't complain about the missing ; as it found the expected string. The next parameters until another ; are ignored because OF believes that they are part of valueExpression

immortality February 1, 2013 06:04

thanks.
Should i add two expressions you told me to every groovyBC conditions?
I have the problem yet.i have run untill an important time(that moving shock faces to wall and reflects) before it happens i want to change a variable relating to time of opening of the wall(to find a proper value) but no change occurs unless i delete all time step folders and start from begining.is it a true situaion?
You mean groovyBC should read 0 folder in each time step again?
Thank you.

gschaider February 1, 2013 09:52

Quote:

Originally Posted by immortality (Post 405472)
thanks.
Should i add two expressions you told me to every groovyBC conditions?

No! Only the one you have problems with. They produce a lot of output and are only necessary if you can't spot the problem by looking at it

Quote:

Originally Posted by immortality (Post 405472)
I have the problem yet.i have run untill an important time(that moving shock faces to wall and reflects) before it happens i want to change a variable relating to time of opening of the wall(to find a proper value) but no change occurs unless i delete all time step folders and start from begining.is it a true situaion?
You mean groovyBC should read 0 folder in each time step again?
Thank you.

OpenFOAM only reads the fields once (according to startFrom/startTime) and then works with whatever is in memory. If you restart from t=100 then changes you made in t=0 are irrelevant (if that is what you mean)

If you have problems with implementing dynamic boundary conditions first test them on a tiny "toy-case" that is similar to the real case

immortality February 1, 2013 10:17

thanks.yes I mean that you say.then changing groovyBC variables has no effect on the problem when we are at 100th time step.does it?
I have examined groovyBC by replayTransientBC.the trend seems ok.
but something takes place that i think must not be related to groovyBC,the BC is updated after 2 or 3 time steps.is it because time steps are lower than reaching the new condition(wall) to next cell?then i should decrease the size of cells more,shouldn't i?

immortality February 3, 2013 06:29

1)I found this expression when I used replayTransientBC in my groovyBC's:
Code:

evaluateDuringConstruction 0;
can it be the answer of problem if i change it to 1?(then it updates during run and reads from 0 folder that groovyBC's have specified?)

immortality February 3, 2013 06:35

2)after applying replayTransientBC my p in 0 folder look like this.is it ok?or i should set values for refValue and refGradient and valueFraction?
Code:

right
    {
        type            groovyBC;
        refValue        uniform 0;
        refGradient    uniform 0;
        valueFraction  uniform 1;
        value          uniform 1.02338e+06;
        valueExpression "p0_2*pow(par2,-3.5)";
        gradientExpression "0";
        fractionExpression "(t1<time()&&time()<t1+c1)||(t2<time()&&time()<t2+c1)||(t3<time()&&time()<t3+c1)||(t4<time()&&time()<t4+c1)||(t5<time()&&time()<t5+c1)||(t6<time()&&time()<t6+c1)||(t7<time()&&time()<t7+c1)||(t8<time()&&time()<t8+c1)||(t9<time()&&time()<t9+c1)||(t10<time()&&time()<t10+c1)||(t11<time()&&time()<t11+c1)?1:0";
        evaluateDuringConstruction 0;
        variables     
43
(
"ymax=max(pos().y);"
"ymin=min(pos().y);"
"r=0.02325;"
"rpm=32151;"
"omega=rpm*pi/30;"
"v_r=r*omega;"
"w_cell=.004;"
"n=1;"
"w_w0=n*w_cell;"
"w_w1=(115.63-46)*r*pi/180;"
"w_w2=(180-159.28)*r*pi/180;"
"w_w3=(21.6-0)*r*pi/180;"
"w_w4=(83-61.6)*r*pi/180;"
"w_w5=(180-128)*r*pi/180;"
"w_p1=(160.28-116.63)*r*pi/180;"
"w_p2=(71.1-21.6)*r*pi/180;"
"w_p3=(46-0)*r*pi/180;"
"w_p4=(129-84)*r*pi/180;"
"c1=w_p2/v_r;"
"c2=(w_p2+w_w4)/v_r;"
"c3=(w_p2+w_w4+w_p4)/v_r;"
"c4=(w_p2+w_w4+w_p4+w_w5+w_w3)/v_r;"
"t1=(w_w0+w_w3-pos().y)/v_r;"
"t2=t1+c4;"
"t3=t1+2*c4;"
"t4=t1+3*c4;"
"t5=t1+4*c4;"
"t6=t1+5*c4;"
"t7=t1+6*c4;"
"t8=t1+7*c4;"
"t9=t1+8*c4;"
"t10=t1+9*c4;"
"t11=t1+10*c4;"
"p0_1=303975;"
"T0_1=440;"
"p0_3=932190;"
"T0_3=1248;"
"p0_2=1023382.5;"
"T0_4=973;"
"gamma=1.4;"
"R=287.14;"
"par1=1-(gamma-1)*magSqr(internalField(U))/(2*gamma*R*T0_1);"
"par2=1+(gamma-1)/2*magSqr(internalField(U))/(gamma*R*internalField(T));"
)
;
        timelines      (
);
        lookuptables    (
);
    }

3)what does valueFraction means when i have set fractionExpession?whats its usage?
thanks.

immortality February 4, 2013 01:56

any answer is thanked and appreciated.


All times are GMT -4. The time now is 09:25.