Problem Description
DuMux implements a family of one-step multi-stage time integration schemes in Shu-Osher form [78] (see MultiStageMethod). Given the semi-discrete problem
\begin{align}\frac{\partial M(x,t)}{\partial t} - R(x,t) = 0, \end{align}
an \(m\)-stage scheme advances the solution from \(t^n\) to \(t^{n+1}=t^n+\Delta t^n\) via
\begin{align}\sum_{k=0}^{i}\Big[\alpha_{ik}\,M\big(x^{(k)}, t^n+d_k\Delta t^n\big) + \beta_{ik}\,\Delta t^n\, R\big(x^{(k)}, t^n+d_k\Delta t^n\big)\Big] = 0, \qquad i=1,\ldots,m, \end{align}
with \(x^{(0)}=x^n\) and \(x^{n+1}=x^{(m)}\). Restricting the inner sum to \(k\le i\) yields explicit schemes (if \(\beta_{ii}=0\)) or diagonally implicit (DIRK) schemes (if \(\beta_{ii}>0\)). The following schemes are implemented and verified here:
| Scheme | id | Stages \(m\) | Order \(p\) | Type |
|---|---|---|---|---|
| Explicit Euler | explicit_euler | 1 | 1 | explicit |
| Implicit Euler | implicit_euler | 1 | 1 | implicit, L-stable |
| Crank-Nicolson | crank_nicolson | 1 | 2 | implicit, A-stable |
| Heun (explicit RK2) | heun | 2 | 2 | explicit |
| DIRK2 (Alexander) | dirk2 | 2 | 2 | implicit, L-stable |
| Qin-Zhang | qin_zhang | 2 | 2 | implicit, A-stable, symplectic |
| Explicit RK3 | rk3 | 3 | 3 | explicit |
| DIRK3 (Alexander) | dirk3 | 3 | 3 | implicit, L-stable |
| Explicit RK4 | rk4 | 4 | 4 | explicit |
Crank-Nicolson is the theta scheme with \(\theta=0.5\), the two DIRK schemes are taken from Alexander (1977) [7], and the Qin-Zhang scheme is the two-stage second-order symplectic DIRK of Qin and Zhang (1992) [54]. Being symplectic, it conserves quadratic invariants exactly; this property is verified separately (see Benchmark: symplecticity below).
Two complementary, purely time-discrete verification tests are used (the spatial operator is trivial in both, so only the temporal error is measured):
Analytical Solution
Two scalar test equations are used.
For the single-step accuracy checks, \(\dot u = e^t,\ u(0)=0\) has the exact solution \(u(t) = e^t-1\).
For the convergence-sweep figure below, \(\dot u = -u + e^t,\ u(0)=0\) has the exact solution \(u(t) = \sinh(t)\). Unlike the first equation, its right-hand side depends on \(u\) (see the note in Results on why this matters).
For an explicit Runge-Kutta scheme of classical order \(p\) with \(p\) stages, the stability function is the truncated exponential
\begin{align}R(z) = \sum_{k=0}^{p}\frac{z^k}{k!}, \end{align}
i.e. the order- \(p\) Taylor polynomial of \(e^z\). Its boundary \(|R(z)|=1\) is a closed curve; the negative real-axis cutoff is the largest \(|\mathrm{Re}(z)|\) for which \(z<0\) lies on this boundary (the maximum stable step size for a decaying mode with eigenvalue \(\lambda=z/\Delta t<0\)).
For implicit schemes, A-stability requires \(|R(z)|\le 1\) for all \(\mathrm{Re}(z)\le 0\) (unconditional stability for decaying modes), and L-stability additionally requires \(R(z)\to 0\) as \(\mathrm{Re}(z)\to-\infty\) (strong damping of stiff modes).
Setup
The tests require neither a mesh nor a linear solver beyond a small dense system:
Benchmark: observed order of convergence
Each curve shows the absolute error \(|u_{\Delta t}(1) - u_{\text{exact}}(1)|\) versus \(\Delta t\) on a log-log scale for \(\dot u = -u + e^t,\ u(0)=0\) (exact solution \(u(t)=\sinh(t)\)); the triangles annotate reference slopes \(\mathcal{O}(\Delta t^p)\) for \(p=1,\ldots,4\) (rise \(p\) over run \(1\)). All schemes attain their expected asymptotic order, or better.
Note: for the simpler equation \(\dot u = e^t\) used in the single-step checks above, the right-hand side is independent of \(u\), so each scheme reduces to a quadrature rule for \(\int e^t\,dt\): Crank-Nicolson and Heun both reduce to the trapezoidal rule and are therefore identical, and the nodes and weights of the explicit RK3 scheme coincide with Simpson's rule (as do RK4's), so both converge with fourth order for that equation. The convergence-sweep equation \(\dot u=-u+e^t\) above avoids this degeneracy, since its right-hand side depends on \(u\).
Benchmark: Linear stability regions
| Scheme | negative real-axis cutoff |
|---|---|
| Explicit Euler | 2.0 |
| Heun (RK2) | 2.0 |
| Explicit RK3 | 2.5127 |
| Explicit RK4 | 2.7853 |
The comparison plot overlays the numerically traced boundary (solid line) with the analytical truncated-exponential boundary \(R(z)=\sum_{k=0}^p z^k/k!\) (crosses); the two coincide to within the Newton tolerance.
For the implicit schemes, implicit Euler, DIRK2, and DIRK3 are L-stable (the stable region extends unboundedly into the left half-plane, with \(R(z)\to0\)), while Crank-Nicolson and the symplectic Qin-Zhang scheme are A-stable but not L-stable ( \(|R(z)|\to1\) as \(\mathrm{Re}(z)\to-\infty\)). For Qin-Zhang the stability function is \(R(z)=\big((4+z)/(4-z)\big)^2\), so \(|R(iy)|=1\) on the imaginary axis: it introduces no artificial damping, which is the flip side of its symplecticity.
Benchmark: symplecticity
A Runge-Kutta method with weights \(b_i\) and coefficients \(a_{ij}\) is symplectic if and only if it satisfies the condition
\begin{align}b_i a_{ij} + b_j a_{ji} - b_i b_j = 0 \qquad \forall\, i,j, \end{align}
which is exactly the condition under which the method conserves every quadratic first integral exactly. test_timestepmethods_symplectic.cc verifies this condition algebraically for the Qin-Zhang tableau (extracted directly from its Shu-Osher coefficients) and then demonstrates its two consequences on the harmonic oscillator \(\dot q = p,\ \dot p = -q\) (a linear Hamiltonian system with quadratic energy \(H=(q^2+p^2)/2\)):
The left panel shows the phase-space trajectory of the symplectic Qin-Zhang scheme (a closed circle) against dissipative implicit Euler (spiralling inward); DIRK2 is omitted from this panel because it is so weakly dissipative that it is visually indistinguishable from the symplectic orbit at this resolution. The right panel shows the energy drift \(|E(t)/E_0-1|\) over time on a logarithmic axis, where that small dissipation becomes visible: Qin-Zhang stays at the machine-precision floor ( \(\sim 10^{-15}\)), whereas implicit Euler loses essentially all the energy and the same second-order DIRK2 drifts by \(\sim 10^{-4}\) — roughly eleven orders of magnitude more than the symplectic scheme, confirming that it is the symplecticity, not the order of accuracy, that conserves the energy.
Reproducing the figures
After building the test_timestepmethods, test_timestepmethods_stabilityregions and test_timestepmethods_symplectic executables, run:
This runs all three executables to (re-)generate the JSON data and produces the five figures above via plot_timestepmethods_convergence.py, plot_timestepmethods_stabilityregions.py and plot_timestepmethods_symplectic.py. If run from within <build-dir>/test/experimental/timestepping, the build directory argument can be omitted. Pass --copy-to-doc to additionally copy the figures into doc/doxygen/images/ (used to update the images shown on this page).