CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Change deltaT using codeStream (https://www.cfd-online.com/Forums/openfoam-solving/109596-change-deltat-using-codestream.html)

whatsoever November 21, 2012 09:12

Change deltaT using codeStream
 
Dear Foamers,

I am a new guy to OF(v2.1.1), now I am running the tutorials and checking the user guides.

One thing I got stuck is change deltaT using codeStream. My code is as follows:

application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 10;
deltaT #codeStream
{
code
#{
const scalar time = this->db().time().value();
const scalar interT = 1;
const scalar deltaT1 = 0.01;
const scalar deltaT2 = 0.1;
if(time<=interT)
{
os << deltaT1;
}
else
{
os << deltaT2;
}
#};
}
writeControl runTime;
writeInterval 1;

However, there is no this pointer in the constant files. I also try to use runTime.value(), which does not work either. So my question is how to get the current runtime value in "constant" file? Can anyone help me and fix this error?


Many thx in advance


FreshFoamer
21-11-2012

ilyavichev April 30, 2013 02:53

Hi All,

this question is still actual!

How to get the current runtime value in "constant" file?


All times are GMT -4. The time now is 05:39.