|
Peano
|
This benchmark checks that the numerical schemes of ExaHyPE 2 converge with their formal order.
It uses the Euler equations over \( [-0.1,0.1]^d \) ( \( d=2,3 \)), 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.
The script smooth-convergence-test.py supports the following numerical schemes (–scheme): Finite Volumes with a Rusanov solver and explicit Euler time stepping (fv, exahype2::api::fv::RusanovWithExplicitEuler), the same with optimistic time stepping (fv-optimistic), and fourth-order Finite Differences with Runge-Kutta time stepping of order one to four (rk1fd4, ..., rk4fd4, exahype2::api::rkfd4). The CFL constant is a property of the scheme and hard-coded per scheme in the script.
Configure and build Peano with
and ensure that the Python environment variables are set:
The script smooth-convergence-test.py generates and builds the code for one scheme and 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:
convergence-study.py does the same in one go and checks the order (it is part of the integration test, skill exahype2:integration-test):
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.py –help lists further options: the task graph compiler, the C++ compiler, the number of threads used to build (default: all cores) and to run, 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. rk4fd4 (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.82e-05 | 2.10e-05 | ||
| 81 | 190 | 4.77e-07 | 2.59e-07 | 3.99 | 4.00 |
| 243 | 566 | 5.89e-09 | 3.18e-09 | 4.00 | 4.01 |
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.