Choosing a time step in transient OpenFOAM simulations

Archive Artist 2024-08-12 8 min read

Introduction

The most common advice given to new OpenFOAM users is "keep your Courant number below 1." That is a good starting point, but it is not the whole story. In practice, the acceptable time step depends on the solver, the turbulence model, the mesh quality, the physics you are trying to resolve, and how much wall-clock time you can afford.

Courant number is not enough

The Courant number estimates how far a fluid parcel travels across a cell in one time step. For explicit schemes it is a stability limit. For the implicit schemes used in most OpenFOAM solvers, it is more of an accuracy guide. A simulation can remain stable at Co >> 1 and still produce wrong physics.

Other constraints include:

  • Turbulence time scales. LES and DES resolve eddies that require much smaller steps than RANS.
  • Interface tracking. VoF and multiphase solvers often need Co < 0.5 at the interface.
  • Moving meshes. The mesh motion itself can impose a step limit independent of the flow.
  • Acoustic or combustion phenomena. These introduce their own characteristic frequencies.

Decision tree

Start with the physics, then refine by cost:

  1. Identify the smallest relevant time scale in the problem.
  2. Choose a solver that matches that scale (implicit vs. semi-implicit vs. PISO loops).
  3. Set an initial Δt so that the maximum Courant number is roughly 1 in the region of interest.
  4. Run a short case and check whether the solution changes when Δt is halved.
  5. If the results are time-step-independent, you have a defensible choice.

Practical rules

For steady-state-in-transient runs, a larger step may be acceptable because you are only marching to a steady solution. For true unsteady physics, prefer a step small enough that phase and amplitude of oscillating quantities do not change with further refinement.

Example

Courant number versus time step for the example case. Demo image.
Figure 1: Maximum Courant number and wall-clock time as a function of time step for the cylinder case at Re = 200.
foam
deltaT          0.005;
adjustTimeStep  yes;
maxCo           1.0;
maxDeltaT       0.01;

References

[1] OpenFOAM User Guide, "Numerical methods," Version v2312.
[2] Ferziger, J. H. & Perić, M. (2002). Computational Methods for Fluid Dynamics, 3rd ed.