CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Changing deltaT of current time step (

olwi April 29, 2009 10:30

Changing deltaT of current time step

I would like to implement adaptive time stepping, based on the convergence properties of the problem. I have a loop over the equations WITHIN the time step, to resolve the non-linear coupling between equations. In case this non-linear coupling does not converge, I would like to abandon and reset to the old time, set a new smaller time step, and try again.

How do I reset to the previous successful time step, and start over?
- Should I use the setTime method of the Time class? If so, must I care about the value of timeIndex? (Seems I must set both time value and timeIndex)
- Could I define a new instance Time myOldTime(runTime) before time advance, and then set runTime=myOldTime to go back?

Anything else I must do? Will this mess up the time discretization in any way?

Thanks in advance,


psosnows April 30, 2009 04:55

hello Ola,

my advice for you would be to create a tmp time folder. After each successful time step the new data would overwrite the old tmp data. In the end, if you would need to "go back in time" you would simply need to read the tmp folder. One advantage would be safety in case of sudden hardware failure (loss of power, coffee flood etc.). The problem would be the time needed to write tmp. In case of huge mesh it would cost a lot.

Other idea is to create virtual tmp. For each varying filed (ex. U, T) you would create vTmpData field. After each successful time step you store the data in those Tmps. In this case if you want to "go back in time", you just put the tmps to main data fileds.

(In the end I would use the second idea to save hardware writing time ;) )

please let me know what do you think about it.


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