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 to possible to change time step DeltaT during a calculation (http://www.cfd-online.com/Forums/openfoam-solving/59336-possible-change-time-step-deltat-during-calculation.html)

dbxmcf March 13, 2007 00:44

I am using icoFoam to calculat
 
I am using icoFoam to calculate a simple fluid, however I want to change the time step dynamically, e.g. first time step is: deltaT[1]=0.001, the next time step is deltaT[2]=0.003, the next is deltaT[3]=0.002, and so on.
i.e.
t0=0
t1=0+0.001=0.001
t2=0.001+0.003=0.004
t3=0.004+0.002=0.006

Maybe it is a wired problemhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif, but in my program it seems that I need such kind of dynamic timestep, is it possible to program it in OpenFOAM? I didn't find any function like runTime.setTimeStep(DeltaT)...the only function I found is adjustDeltaT() but it is protected and after I read through the source, I found it is not doing what I want.

Thanks a lot!

tehache March 13, 2007 03:32

I use scalar dt=runTime.de
 
I use

scalar dt=runTime.deltaT()

to get the actual timestep, and

runTime.setDeltaT(dt)

to set it to a new value, works.

Have fun ...

Thomas

kdarc November 1, 2007 18:59

Hi. the example above, is e
 
Hi.

the example above, is exactly what I'm trying to do and when I implement the code as shown above, NOTHING changes.

This makes me think that I also have to have some "include file" statements, or need to have some extra libraries mentioned in the "options" file.

Any advice?

thanks.

dbxmcf November 1, 2007 19:48

it should work using setDeltaT
 
it should work using setDeltaT(dt):

like this:

runTime.setTime(tStart,0);
runTime.setDeltaT(dt);
runTime.setEndTime(runTime.value()+runTime.deltaT( ).value());

philippose November 4, 2007 14:21

Hello, A Good day to you!
 
Hello,

A Good day to you!

Sorry I could not get into this post a little earlier... I saw the post, but was away, so could not react to it :-)!

Some time back, I had modified the icoFoam solver to include variable time step functionality as a question from another user on this forum.

Unfortunately, I am unable to find that post now... so... here is "icoFoamVarDt"... basically does exactly what you want..... it uses the built in capability in OpenFOAM to limit the Courant Number by adapting the time step size....

Hope this helps....

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif icoFoamVarDt.tar.gz

In order to activate this, you need to use the "adjustTimeStep yes" option, followed my "maxCo [maximum Co Number you want to limit to]" in the controlDict file.


Philippose


All times are GMT -4. The time now is 04:35.