I'm thinking of using the standard features for adaptive timestepping (found in finiteVolume library, an used in some standard solvers) in one of my own solvers.

These standard features are based on keeping a certain max Courant number. Is the Courant number the only sensible criterion?

If my transient solution is approching a steady state, the Courant number does not necessarily decrease (?), but with an implicit time scheme it should still be possible to increase the timestep dramatically, without much loss of accuracy. Or?

Thanks in advance for any comments,

Ola

elisabet

February 29, 2008 11:34

Hi Ola,
Time step criterion

Hi Ola,

Time step criterion is a key aspect, despite the fact that not always is deeply considered. If you are using an implicit time scheme you would not have stability problems, however, if you are interested in an accurate transient simulation, time step is crucial (your time step should allow you to observe main details of fluid evolution).
The criterion depends on the equation you are solving, that is, on the characteristic flow evolution (inertia, diffusion, Lorentz, etc.). The Courant number (CFL) is obtained from stability analysis considering only inertial effects. In general this criterion is enough. If you are using RANS models, your effective viscosity might be considerable, thus, the diffusive criterion should also be considered. If you have any other phenomenon included in your fluid, as for example, electromagnetics, it might also be necessary to consider it.

You might also take care on considering which is the maximum Courant number (or other criterion) you take. It depends on the numerical schemes you work with. To obtain a more detailed overview about it, I would suggest you to reed 'Joe D. Hoffman. Numerical Methods for Engineers and Scientists'.

Finally, when you are arriving at the steady state, you will see that, for a fixed Courant number the time step obtained is constant (due to no changes in fluid variables along the time).

Hope it helps!

Regards,

elisabet

olwi

March 8, 2008 13:19

Hi Elisabet,
Thanks for you

Hi Elisabet,

Thanks for your reply. You have a really good point in considering WHICH courant number to focus on, when there's many physical mechanisms in play. I'll look for Hoffman's book, too.

I have now implemented the OF features for adjustable time-stepping (used in some of the standard OF solvers), which adjusts the timestep to keep constant Courant number. Based on your suggestion, I computed a Courant number for the "fastest" of the physical mechanisms in my problem (transport of free electrons in this case). The time-step adjustment works really well.

I also implemented an inner iteration loop within the time step loop (see separate post), so I can make sure the non-linear coupling between the equations is properly converged in each time step. In that loop, I apply the OF under-relaxation features for one of the source terms. It works wonders...

I've varied my Courant number between 0.2 and 2. I see that it does not necessarily pay to have large Co and advance faster in time, because it just means I need to do more non-linear iterations in each time-step to stabilize the non-linear coupling...

Best regards,

Ola

elisabet

March 13, 2008 15:09

Hi Ola,
Does your simulatio

Hi Ola,

Does your simulation reach the steady state at the same time when using different Courant numbers?

elisabet

hellorishi

February 13, 2009 05:56

Hello,
I am not able to fig

Hello,

I am not able to figure out, how to use adaptive time stepping in my solver. I extended turbFoam solver from OF-1.5, with two scalar transport(say red water and blue water) to see the mixing of two inlet flows in a T-section.

Currently I using a time-step of 0.001 and getting max Co number of the order of ~0.001. If I increase the time-step to 0.01 or 0.005 the Co number increases drastically and solver aborts (in 3-4 time steps). Hence I was considering the use of adaptive time stepping scheme. However I could not find anything explaining this in UserGuide or ProgGuide or wiki. The closest I came with google is this thread...

There is one file in ../OpenFoam-1.5/src/finiteVolume/cfdtools/incompressible/CourantNo.H
I could not figure out much from that... Please shed some light on adaptive time stepping.

Thanks
Rishi

elisabet

February 13, 2009 09:32

Hi Rishi,
The procedure is

Hi Rishi,

The procedure is always the same. You need 3 include files: readTimeControls.H, CourantNo.H and setDeltaT.H. The latest two include files must be located inside your time loop in order to first evaluate the actual Courant and, from this result, define the new time step.

The include setInitialDeltaT.H is optional.

See for example icoDyMFoam (in .dep file you will find the location of the included files and read what they do)

Good luck!

elisabet

Jochem

August 3, 2010 08:52

Hi,

I also want to use an adaptive timestepping. I've read the discussion above and I've tried to do this but it doesn't work.

I am not sure where you have to change this. I've included the 3 files in OpenFoam-1.6x/applications/solvers/incompressible/simpleFoam/simpleFoam.C because I'm using the simpleFoam solver. After this i've included 2 files (CourantNo.H and setDeltaT.H) in the time loop.

Is this correct or do i have to include the files somewhere else?

Regards,

Jochem

Jochem

August 3, 2010 09:51

Hi,

I found out that you still have to do a command to "load" the "new" solver using the "wmake" command. When i do this i get the following error :