|
Peano
|
First-order vs. More...
Functions | |
| directory_of (scheme, formulation, cells) | |
| build (scheme, formulation, cells) | |
| Generate and build one solver on one grid in its own directory. | |
| run (scheme, formulation, cells) | |
| Run the executable built by build() and store its wall time. | |
| snapshot (scheme, formulation, cells, unknowns, snapshot_index=-1) | |
| Return the unknowns of one snapshot of one solver. | |
| gauge_wave_lapse (x, t) | |
| Analytical lapse, see exagrype.initialvalues.gaugeWave(). | |
| compare_one (scheme, cells, verbose) | |
| Compare FO and SO on one grid. | |
| compare_single (scheme, formulation, cells) | |
| Summarise one formulation on one grid against the analytical lapse. | |
| compare () | |
Variables | |
| parser = argparse.ArgumentParser(description="First-order vs. second-order CCZ4") | |
| choices | |
| default | |
| help | |
| type | |
| float | |
| arguments = parser.parse_args() | |
| schemes = arguments.schemes | |
| formulations = arguments.formulations | |
| build_mode = peano4.api.output.CompileMode.RELEASE | |
| verbosity = peano4.api.LoggerVerbosity.OFF | |
| grid_sizes = arguments.sizes | |
| end_time = arguments.end_time | |
| float | time_in_between_plots = end_time / 2.0 |
| int | patch_size = 9 |
First-order vs.
second-order reconstructed CCZ4: gauge wave benchmark
This is the gauge wave benchmark (Gauge wave) with the fourth-order Finite Differences (exahype2.api.rkfd4), but we instantiate two solvers in one setup: exagrype.api.FOCCZ4Solver, which evolves all 58 CCZ4 unknowns, and exagrype.api.FOSOCCZ4Solver, which evolves 25 of them and obtains the 33 first derivatives from the exagrype.api.FOSOReconstructionSolver next to it (both are hosted by an exagrype.api.FOSOSolver). Both solvers use the same Runge-Kutta scheme, the same lopsided advection and no dissipation. The two do not yield identical results: The first-order solver evolves the derivatives as unknowns, whereas the second-order solver re-computes them from the 25 unknowns in each Runge-Kutta stage. The script builds and runs the code, and then quantifies the difference of the 25 evolved unknowns of both solvers, and the deviation of both from the analytical solution of the gauge wave.
Two exahype2.api.rkfd4 solvers cannot live in one project yet, as both generate the solver-independent kernel rungekutta_linear_combination into the same file (page_exagrype_fo_so_project_plan). The script therefore builds and runs each solver on its own, in a directory of its own (run-FO and run-SO), and then compares the plot files.
The gauge wave is a pure gauge perturbation of flat spacetime, i.e. an analytical solution of the Einstein equations that 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. This script uses exagrype.api, i.e. the CCZ4 solvers of the new Python API. It requires a Peano build with
--enable-exahype --enable-blockstructured --enable-loadbalancing --enable-exagrype
and is run from this directory via
python3 fo_vs_so.py
The benchmark covers two numerical schemes:
Each of the two comes in the formulations FO (exagrype.api.FOCCZ4Solver) and SO (exagrype.api.FOSOCCZ4Solver). The grid has cells x cells x cells grid points (patch size 9 and 3^k patches per axis, i.e. cells is 27, 81, ... (Peano refines to at least three patches per axis)). The grid size is compiled into the executable, so each combination is built in a directory of its own (run-scheme-formulation-cells).
python3 fo_vs_so.py # same as --mode=run-and-compare python3 fo_vs_so.py --mode=build # generate and compile all combinations python3 fo_vs_so.py --mode=run # generate, compile and run all combinations python3 fo_vs_so.py --mode=run-and-compare # run, then print the table python3 fo_vs_so.py --mode=compare-only # re-print the table from existing runs
The script loops sequentially, within one Python process, over all schemes, grid sizes and formulations.
The option –build-mode=debug|release selects the build (default release; debug also enables the generator logging). –schemes (default RK4FD4,RK1FD4,FV), –formulations (default FO,SO; with just one, the comparison table lists the lapse error and wall time of that formulation only), –sizes (default 27,81), –end-time (default 0.1) and –cfl (CFL constant of the Finite Volume scheme, default 0.9) override the remaining settings.
| fo_vs_so.build | ( | scheme, | |
| formulation, | |||
| cells ) |
Generate and build one solver on one grid in its own directory.
| scheme | str RK4FD4, RK1FD4 or FV. |
| formulation | str FO or SO. |
| cells | int Grid points per axis. Has to be a multiple of the patch size. |
Definition at line 264 of file fo_vs_so.py.
References directory_of(), and exagrype.api.initialvalues.gauge_wave().
Referenced by compare().


| fo_vs_so.compare | ( | ) |
Definition at line 529 of file fo_vs_so.py.
References build(), compare(), compare_one(), compare_single(), and run().
Referenced by compare().


| fo_vs_so.compare_one | ( | scheme, | |
| cells, | |||
| verbose ) |
Compare FO and SO on one grid.
Definition at line 451 of file fo_vs_so.py.
References directory_of(), float, gauge_wave_lapse(), and snapshot().
Referenced by compare().


| fo_vs_so.compare_single | ( | scheme, | |
| formulation, | |||
| cells ) |
Summarise one formulation on one grid against the analytical lapse.
Used if only one of FO and SO is built, i.e. there is nothing to compare it to.
Definition at line 500 of file fo_vs_so.py.
References directory_of(), float, gauge_wave_lapse(), and snapshot().
Referenced by compare().


| fo_vs_so.directory_of | ( | scheme, | |
| formulation, | |||
| cells ) |
Definition at line 260 of file fo_vs_so.py.
Referenced by build(), compare_one(), compare_single(), run(), and snapshot().

| fo_vs_so.gauge_wave_lapse | ( | x, | |
| t ) |
Analytical lapse, see exagrype.initialvalues.gaugeWave().
Definition at line 446 of file fo_vs_so.py.
Referenced by compare_one(), and compare_single().

| fo_vs_so.run | ( | scheme, | |
| formulation, | |||
| cells ) |
Run the executable built by build() and store its wall time.
| scheme | str RK4FD4, RK1FD4 or FV. |
| formulation | str FO or SO. |
| cells | int Grid points per axis. |
Definition at line 368 of file fo_vs_so.py.
References directory_of().
Referenced by compare().


| fo_vs_so.snapshot | ( | scheme, | |
| formulation, | |||
| cells, | |||
| unknowns, | |||
| snapshot_index = -1 ) |
Return the unknowns of one snapshot of one solver.
| scheme | str RK4FD4, RK1FD4 or FV. |
| formulation | str FO or SO. |
| cells | int Grid points per axis. |
| unknowns | int Number of unknowns per grid point in the plot file |
| snapshot_index | int Index of the snapshot, -1 is the last one. |
Definition at line 393 of file fo_vs_so.py.
References directory_of().
Referenced by compare_one(), and compare_single().


| fo_vs_so.arguments = parser.parse_args() |
Definition at line 238 of file fo_vs_so.py.
| fo_vs_so.build_mode = peano4.api.output.CompileMode.RELEASE |
Definition at line 249 of file fo_vs_so.py.
| fo_vs_so.choices |
Definition at line 199 of file fo_vs_so.py.
| fo_vs_so.default |
Definition at line 200 of file fo_vs_so.py.
| fo_vs_so.end_time = arguments.end_time |
Definition at line 255 of file fo_vs_so.py.
| fo_vs_so.float |
Definition at line 234 of file fo_vs_so.py.
Referenced by compare_one(), and compare_single().
| fo_vs_so.formulations = arguments.formulations |
Definition at line 240 of file fo_vs_so.py.
| fo_vs_so.grid_sizes = arguments.sizes |
Definition at line 254 of file fo_vs_so.py.
| fo_vs_so.help |
Definition at line 201 of file fo_vs_so.py.
| fo_vs_so.parser = argparse.ArgumentParser(description="First-order vs. second-order CCZ4") |
Definition at line 196 of file fo_vs_so.py.
| int fo_vs_so.patch_size = 9 |
Definition at line 257 of file fo_vs_so.py.
| fo_vs_so.schemes = arguments.schemes |
Definition at line 239 of file fo_vs_so.py.
Definition at line 256 of file fo_vs_so.py.
| fo_vs_so.type |
Definition at line 212 of file fo_vs_so.py.
| fo_vs_so.verbosity = peano4.api.LoggerVerbosity.OFF |
Definition at line 250 of file fo_vs_so.py.