3Gauge wave benchmark for the ExaGRyPE Python API with an additional Euler fluid
5The gauge wave is a pure gauge perturbation of flat spacetime, i.e. an
6analytical solution of the Einstein equations that travels along the x-axis
7with speed one. It is periodic over the unit cube. This script evolves it with
8the first-order CCZ4 solver of exagrype.api (exagrype.api.FOCCZ4Solver),
9discretised with fourth-order Finite Differences and classic Runge-Kutta 4
12Next to CCZ4, the compound hosts a compressible Euler solver
13(exagrype.api.euler.Euler), discretised with Finite Volumes and explicit Euler time
14stepping (exahype2.api.fv.RusanovWithExplicitEuler). Both solvers are configured
15right here, and both run on the same mesh with periodic boundary
16conditions. They are hosted by exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling,
17which copies the fields of each solver into auxiliary variables of the other
18one at the begin of each time step (piecewise linear interpolation between the
19two resolutions), and which synchronises the time step sizes at the end.
21Each mesh cell hosts a patch of p x p x p grid cells for CCZ4 and a patch of
22(2p+1) x (2p+1) x (2p+1) volumes for Euler. With p=8, Euler has 17 x 17 x 17
23volumes per cell. The Euler volumes are hence a bit smaller than half the
24size of the CCZ4 grid cells.
26The script requires a Peano build with
28 --enable-exahype --enable-blockstructured --enable-loadbalancing --enable-exagrype
30and is run from this directory via
32 python3 gauge-wave-with-Euler.py --mode release
33 python3 gauge-wave-with-Euler.py --mode debug --cell-size 0.1111 --patch-size 8
45parser = argparse.ArgumentParser(description=
"ExaGRyPE gauge wave with Euler")
48 choices=[
"release",
"debug"],
50 help=
"Build mode of the generated code. Release uses a longer simulation "
51 "and text logging; debug a very short one with visualised logging.",
57 help=
"Edge length of one mesh cell (default: 1/3). The mesh is regular and "
58 "refined by factors of three from the root cell, i.e. the value is rounded "
65 help=
"Number of CCZ4 grid cells per mesh cell and axis (default: 8). "
66 "Euler hosts 2*patch-size+1 volumes per axis.",
68args = parser.parse_args()
70if args.patch_size < 1:
71 raise ValueError(
"The patch size has to be positive")
72if args.cell_size <= 0.0
or args.cell_size >= 1.0:
73 raise ValueError(
"The cell size has to be in (0,1)")
75if args.mode ==
"release":
76 build_mode = peano4.api.output.CompileMode.RELEASE
78 time_in_between_plots = 0.1
79 verbosity = peano4.api.LoggerVerbosity.TEXT
81 build_mode = peano4.api.output.CompileMode.DEBUG
83 time_in_between_plots = 0.01
84 verbosity = peano4.api.LoggerVerbosity.VISUALISATION
86ccz4_patch_size = args.patch_size
87euler_patch_size = 2 * args.patch_size + 1
93ccz4_volume_size = 1.01 * args.cell_size / ccz4_patch_size
94euler_volume_size = 1.01 * args.cell_size / euler_patch_size
98 namespace=[
"benchmarks",
"exagrype",
"gaugewavewitheuler"],
99 project_name=
"gauge-wave-with-Euler",
101 executable=
"gauge-wave-with-Euler",
113Kernel = exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.RightHandSideKernel
118 right_hand_side_kernel=Kernel.CentralDifferencesWithLopsidedAdvection,
119 advection_velocity=exagrype.api.FOCCZ4Solver.ADVECTION_VELOCITY,
120 advected_quantities=ccz4.advected_quantities(),
123 ccz4, volume_size=ccz4_volume_size
126 ccz4, first_plot_time_stamp=0.0, time_in_between_plots=time_in_between_plots
132 euler, volume_size=euler_volume_size
135 euler, first_plot_time_stamp=0.0, time_in_between_plots=time_in_between_plots
138project.add_solver(coupled)
140project.compiler = peano4.api.taskgraph.compiler.FuseSteps.translate
142project.set_global_simulation_parameters(
144 offset=[0.0, 0.0, 0.0],
145 size=[1.0, 1.0, 1.0],
146 min_end_time=end_time,
147 max_end_time=end_time,
148 periodic_BC=[
True,
True,
True],
151PeanoRoot = os.path.abspath(
152 os.path.join(os.path.dirname(os.path.abspath(__file__)),
"..",
"..",
"..")
154project.set_Peano4_installation(PeanoRoot, build_mode)
155peano4_project = project.generate_Peano4_project(verbosity=verbosity)
156peano4_project.generate()
157peano4_project.build(make_clean_first=
True)
First-order CCZ4 and an Euler fluid, coupled only at the begin and the end of each time step.
Plotting counterpart to RusanovWithExplicitEuler: maps the patch data of a Finite Volume scheme with ...
Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-...
Setup phase counterpart to RusanovWithExplicitEuler: sets the initial condition for a Finite Volume s...
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Plotting counterpart of the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2....
Setup phase of the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2....
exahype2.api.InitPointWisely gauge_wave()
Gauge wave along the x-axis,.
This file is part of the ExaGRyPE project.