Oceananigans.jl icon indicating copy to clipboard operation
Oceananigans.jl copied to clipboard

Implementing AB2 for variable time-step size

Open simone-silvestri opened this issue 5 months ago • 14 comments

The Adams-Bashforth time stepper relies on an approximate time-integral to calculate the tendencies. This time integral, when using a constant time step, is simply approximated as

G^{n+1} = \left(\frac{3}{2} + \chi \right) G^n - \left( \frac{1}{2} +\chi \right) G^{n-1}

The $\chi$ term should be a small deviation from the time integral, added to reduce the noise generated by non-linear terms. I wanted to open a bit of a discussion about the details of

  1. the $\chi$ value
  2. the time integral when we use variable time stepping that is a feature we use quite often

By default, we use $\chi = 0.1$, which is quite large (20% of the smaller coefficient). This will introduce quite a bit of implicit dissipation in the model. Generally, there is a tradeoff between the stability obtained by a larger $\chi$ and the dissipation introduced by deviating from the AB2 behavior. I wondered if 0.1 is too high, especially when using diffusive methods. Did anyone experiment with lower $\chi$, and if yes, with what results?

Would it make sense to exclude $\chi$ from diffusive terms to limit the implicit dissipation of the time-stepping scheme?

Regarding the time integral for variable time-stepping, the correct form of the AB2 with variable step would have to include the time step at $n$ and the time step at $n-1$ to be correct. This might not make a huge impact, but if we want to save time averaged tendencies and the time step changes size every ten iterations or so, the error will compound and the time average will probably be off. Would it make sense to implement time-step dependent coefficients for the AB2 scheme?

The problem is that if the time step changes size, the tendency terms at $G^{n-1}$ do not cancel, which is what happens with constant time stepping.

c^{n+1} = c^{n} + \Delta t (1.5 G^{n} - 0.5 G^{n-1}) 
c^{n+2} = c^{n+1} + \Delta t (1.5 G^{n+1} - 0.5 G^{n})

In the above, between $c^{n+1}$ and $c^{n+2}$ we have added only one $G^{n}$ because the extra tendency we have added in $c^{n+1}$ is removed in the successive timestep. With variable time steps, this is not the case! Suppose the time-step changes between $n+1$ and $n+2$

c^{n+1} += \Delta t^n (1.5 G^{n} - 0.5 G^{n-1}) 
c^{n+2} += \Delta t^{n+1} (1.5 G^{n+1} - 0.5 G^{n})

we remain with a spurious $G^n (1.5\Delta t^{n} - 0.5 \Delta t^{n-1}) - G^n$.

Given this reference, the correct formualtion might be

G^{n+1} = \frac{1}{2} \left( \left( 2 + \frac{\Delta t^n}{\Delta t^{n - 1}} \right) G^n - \frac{\Delta t^n}{\Delta t^{n - 1}} G^{n-1} \right)

However, also in this form, successive tendencies do not cancel out.

simone-silvestri avatar Aug 27 '24 18:08 simone-silvestri