|
Peano
|
The gauge wave is a pure gauge perturbation of flat spacetime: an analytical solution of the Einstein equations which travels along the x-axis with speed one. It is periodic over the unit cube and hence a standard first test of any numerical relativity code. The solution is known exactly, so we can always tell what the numerical error is. If the wave shape or its amplitude changes over time, this is due to numerical effects, and the setup is convenient to assess and compare numerical schemes. The picture above shows the error of the lapse over the mesh size for five schemes. It is the outcome of the convergence study that doubles as the integration test of the numerical schemes (see below).
The script uses exagrype.api, i.e. the first-order CCZ4 solver exagrype.api.FOCCZ4Solver, and discretises it with
Peano has to be built with ExaHyPE and ExaGRyPE, i.e. with
The generated code is compiled with the compiler of your choice (we use the Intel compiler with its path in PATH), and the Python packages have to be on the Python path (export PYTHONPATH=$PYTHONPATH:../../../src).
The script has to be told what to do. It requires a build mode and a scheme:
Use --help to see all options. --mode release builds an optimised executable and runs until time 1.0; --mode debug builds with assertions and visualises the task graphs. --mesh-size is the edge length h of one grid cell. The default is 1/27, i.e. 3x3x3 mesh cells with patches of 9x9x9 grid cells. The mesh is regular and refined by factors of three, i.e. h is rounded to patch size over 3^k (the patch size can be set via --patch-size, but the root cell is refined at least once). --compiler switches between the task graph compilers (sequential, fusion which is the default, and the producer-consumer variants of both), --end-time, --threads and --directory do what they say.
The script generates the C++ code, the Makefile, and compiles the executable. Run the executable gauge-wave afterwards. To get rid of all the generated files, remove the directories celldata facedata globaldata observers tasks vertexdata repositories, the Abstract* files, the Makefile and all *.o files. You can recreate them any time by rerunning the Python script.
The script convergence-study.py builds and runs the benchmark for all schemes fv, rk1fd4, ..., rk4fd4 and for the volume sizes h=1/9, 1/27 and 1/81 (patch size 9; the coarsest mesh needs patches of size 3, as Peano refines the root cell at least once) until time t=0.1. It records the maximum error of the lapse along the line y=z=0.5 in the last snapshot against the exact solution
\[ \alpha (x,t) = \sqrt{1 - A \sin (2 \pi (x-t))}, \quad A=0.1, \]
estimates the convergence order p ~ log(e(3h)/e(h))/log(3), and exits with a non-zero status if the order between the two finest meshes of a scheme falls below a threshold. It is run via the skill exahype2:integration-test (see documentation/exahype2/integration-test/SKILL.md). Whenever you change a numerical scheme, the task graph, the kernels or the code generation, this is the test to rerun.
| scheme | h = 1/9 | h = 1/27 | order | h = 1/81 | order |
|---|---|---|---|---|---|
| fv | 1.58e-2 | 6.59e-3 | 0.79 | 2.34e-3 | 0.94 |
| rk1fd4 | 1.09e-3 | 3.37e-4 | 1.06 | 1.10e-4 | 1.02 |
| rk2fd4 | 1.46e-4 | 3.01e-6 | 3.53 | 2.39e-7 | 2.31 |
| rk3fd4 | 1.39e-4 | 2.70e-6 | 3.59 | 3.34e-8 | 4.00 |
| rk4fd4 | 1.39e-4 | 2.71e-6 | 3.58 | 3.39e-8 | 3.99 |
What we see:
The convergence study uses --plot-along-x-axis, which restricts the output to the patches along the line y=z=0.5 and writes them with ten digits. Without this option, the code writes the whole solution as Peano patch files every 0.1 time units. You can convert them into vtk and visualise them via Paraview: