version 0.6.0
Loading...
Searching...
No Matches
How to simulate with adaptative time steps

The following guidelines will help you setup adaptive time stepping.

Forewords

Transient flows (or thermal problems) may see their physical phenomena temporal propagation vary during a whole simulation. That is why one might want to adapt the time step depending on the various speeds of propagation, depending on the underlying physics. Indeed, using a constant very small time step would induce a lot of time iterations that could be avoided. On the contrary, using a constant large time step might skip some important flow variations and also induce instabilities in the numerical resolution (while Notus tries, as much as possible, to automatically prevent such cases to happen).

Models impacted

Dynamic time step adaptation concerns the following problems (it might be a mix of them) and the associated signal propagation dimensionless number:

  • advection (all equations involving velocity): Courant number: \( \mathrm{Co} = u \delta t / \delta x \) where \( u \) is the velocity;
  • diffusion (Navier-Stokes, energy, species transport, RANS models): Fourier number: \( \mathrm{Fo} = \mu \delta t / \delta x^2 \) where \( \mu \) is the diffusion coefficient;
  • compressibility: acoustic wave number: \( \mathrm{Ac} = c \delta t / \delta x \) where \( c \) is the acoustic wave celerity in the medium;
  • surface tension (with two-phase Navier-Stokes): \( \mathrm{ST} = ( u + c_\gamma ) \delta t / \delta x \) where \( c_\gamma \simeq \sqrt( \frac{\pi \gamma}{\rho} |\kappa| ) \) is the capillary wave celerity, \( \gamma \) the surface tension coefficient, \( \rho \) the local fluid density and \( \kappa \) the surface curvature.

NTS setup

Inside the numerical_parameters block (see test_cases/doc/numerical_parameters_block.nts file), the user can choose between time_step fixed DOUBLE_EXPRESSION; and time_step adaptative {...}.

Stability factors

When the latter is chosen, the user must supply a temporal_stability_factor value that will be set commonly to all underlying equations' terms (i.e. advection, diffusion, compressibility and surface tension). This factor, regarding the eulerian advection term, corresponds to the maximum Courant number. The general idea is, if one sets double Co = 0.5 ; temporal_stability_factor Co; in a flow only subjected to advection, then Notus will dynamically adapt the time step such that \( dt = \mathrm{Co} \, \delta x / u \) where \( \delta x \) is the spatial step and \( u \) is the velocity. Of course, this criterion is adapted for 2D and 3D flows. Example: in the most complex case of a compressible two-phase viscous flow with surface tension, all associated criterions are set to that given value. The smaller that factor value, the smaller the time step.

The user can override each model associated factor in order to focus more on one physical problem that the others by setting:

  • temporal_stability_factor DOUBLE_EXPRESSION;, i.e. the Courant number, (within the time_step adaptative block);
  • temporal_stability_factor diffusion DOUBLE_EXPRESSION;, i.e. the Fourier number, (within the blocks of all models involving diffusion);
  • temporal_stability_factor acoustic DOUBLE_EXPRESSION; (within the navier_stokes block);
  • temporal_stability_factor surface_tension DOUBLE_EXPRESSION; (within the navier_stokes block, if surface tension is activated).

The final time step will be computed by taking the minimum value of all involved equations.

By default, all involved equations are checked by this time step computation. The user can also chose to disable that for selected equations by using the command: enable temporal_stability_factor EQUATION false; where EQUATIONcan be advection | diffusion | acoustic | surface_tension, at the relative level in the NTS file.

 Example

Assume that one wants to activate all factors but the advection one (relative to the Courant number) in a compressible flow, as well as specify the diffusion factor. The associated NTS file could be something:

numerical_parameters {
time_step adaptative {
temporal_stability_factor COMMON_STABILITY_FACTOR;
first_step FIRST_TIME_STEP;
enable temporal_stability_factor advection false;
}
navier_stokes {
temporal_stability_factor diffusion DIFFUSION_FACTOR;
[...]

Time steps variations

In order to better control the time step variations, several options are available:

  • first_step DOUBLE_EXPRESSION; (mandatory) sets the first time step;
  • min_step DOUBLE_EXPRESSION; (optional) sets the minimum value that the time step can take;
  • max_step DOUBLE_EXPRESSION; (optional) sets the maximum value that the time step can take;
  • max_ratio DOUBLE_EXPRESSION; (optional) sets the maximum ratio between two consecutive time steps such that \( \Delta t^{n+1} / \Delta t^{n} \leq \textrm{max_ratio} \);
  • max_increment DOUBLE_EXPRESSION; (optional) sets the maximum increment between two consecutive time steps such that \( \Delta t^{n+1} - \Delta t^{n} \leq \textrm{max_increment} \);

As for spatial discretization, it is recommended to use a sufficiently small value for max_ratio in order to avoid introducing numerical instabilities and miss important phenomena that can arise between two steps. A typical value would be \( 1.2 \).

Explicit schemes sub time stepping

Explicit schemes suffer from numerical stability criteria for the time step. For example, the first order advection scheme is stable if and only if the Courant number is less than unity. Also, numerical errors increase with the time step value and one might want to reduce this impact. Hence, the code follows this stability criteria with builtin stability factors (see the code for more details). Within SBDF temporal schemes, when considering explicit schemes, advection and diffusion equations are integrated between \( t^{n} \) and \( t^{n+1} \). Potentially, when the stable time step \( \widehat{\Delta t} \) is smaller than \( \Delta t^{n+1} \), sub steps are used in order to decompose the integral:

\[ \int_{t^n}^{t^{n+1}} F dt = \int_{t^n}^{t^{n}+\widehat{\Delta t}} F dt + \int_{t^n+\widehat{\Delta t}}^{t^{n}+2 \widehat{\Delta t}} F dt + \ldots \]

When the code is doing so, i.e. when large time steps are used relative to the Courant/Fourier numbers restriction, a message is printed in Notus output.

The user can override the existing (in code) stability criteria for the advection explicit schemes. Within these, the option temporal_stability_factor DOUBLE_EXPRESSION; can be supplied to do so. For example:

advection_scheme explicit houc3 {
temporal_scheme nssp3_o2;
temporal_stability_factor 0.5;
}

will force the Courant number to be less or equal to 0.5.

Todo
Implement the same keyword for diffusion equation.