Adapting the time step

Example

The methods of temporal discretization have as a possible disadvantage hiding important variations of time dependent variables during time intervals shorter than the time step value. An example is presented in the figure below.

For this reason, a specific algorithm for the prediction and correction of the time step is established in Flux. The goal is to detect important time variations of variables and automatically adapt the current value Δtn of the time step.

Prediction correction algorithm

The algorithm for the prediction correction of the time step allows the automatic adaptation of the time step value during the solving process.

At each time step, Flux predicts the value of the variable starting from the results obtained in the previous two time steps (second order function) and it compares the predicted value with the effectively computed value. If the difference between these value is:

  • too small, then Flux increases the time step value. This allows avoiding the solving out of useless time steps.
  • too large, then Flux begins the computation again with a much smaller time step value. After five consecutive failures, Flux stops. In this case, you should re-launch the solving process with a better-adapted time step.