|
Peano
|
This benchmark checks that the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2.api.rkfd4) converge with fourth order.
It uses the setup of the Finite Volume convergence tests (Convergence Tests (Euler Equations)): the Euler equations over \( [-0.1,0.1]^d \), where the density follows one period of a sine wave along x, while velocity \( u=1 \) (along x) and pressure \( p=1 \) are constant. The exact solution is the initial density profile advected with the velocity, i.e.
\( \rho(x,t) = 1 + 0.2 \sin \left( 2 \pi \frac{x - t + 0.1}{0.2} \right). \)
By default, the boundary conditions prescribe this exact solution outside of the domain. Pass –periodic for periodic boundary conditions instead.
Configure and build Peano with
and ensure that the Python environment variables are set:
The script smooth-convergence-test-fd4.py generates and builds the code for one mesh width. All PDE terms are passed to the solver as C++ snippets, so there is no user code to write. Build and run one executable per mesh width, each in a directory of its own:
The three volume sizes yield 27, 81 and 243 grid cells per axis, as each mesh cell hosts a patch of 9x9 grid cells. python3 smooth-convergence-test-fd4.py –help lists further options, such as the Runge-Kutta order, fixed time step sizes or three dimensions.
compute-errors.py compares the density of the last snapshot of each run with the exact solution, and prints the maximum and the root mean square error plus the convergence orders between subsequent runs. The plot files hold the patches' offsets with seven significant digits only. As this would dominate the errors on the finer meshes, the script snaps the offsets onto the regular mesh.
With the default settings, i.e. Runge-Kutta of order four, adaptive time step sizes with a CFL constant of 0.5, no dissipation, Dirichlet boundary conditions and the end time 0.05, we obtain in 2d:
| Grid cells per axis | Time steps | Max error of density | RMS error of density | Order (max) | Order (RMS) |
|---|---|---|---|---|---|
| 27 | 64 | 3.79e-05 | 2.09e-05 | ||
| 81 | 190 | 4.74e-07 | 2.58e-07 | 3.99 | 4.00 |
| 243 | 566 | 5.89e-09 | 3.17e-09 | 4.00 | 4.00 |
The errors decrease with the fourth power of the mesh width. As the time step size is proportional to the mesh width, this confirms the order of the Runge-Kutta scheme, too.