3 import sys, os, argparse
4 import peano4, exahype2
6 sys.path.insert(0, os.path.abspath(
"../../../../tests/exahype2/aderdg"))
9 available_scenarios = {
18 parser = argparse.ArgumentParser(
19 description=
"ExaHyPE 2 - Finite Volumes Kernel Benchmarking Script"
25 choices=peano4.output.CompileModes,
26 default=peano4.output.CompileModes[0],
27 help=
"|".join(peano4.output.CompileModes),
35 help=
"Number of levels in the tree. Must be > 1.",
43 help=
"Number of finite volumes in a patch",
49 choices=available_scenarios.keys(),
50 default=
"SWERadialDamBreak",
51 help=
"Scenario that should be used as a base for the benchmarking",
58 help=
"Set if you want the simulation output",
61 args = parser.parse_args()
62 scenario = available_scenarios[args.scenario]
63 dimensions = scenario._dimensions
65 end_time = scenario._end_time
66 should_plot = args.plot
67 size = [scenario._domain_size, scenario._domain_size, scenario._domain_size]
68 offset = [scenario._offset, scenario._offset, scenario._offset]
72 if type(scenario._equation.num_unknowns)
is dict:
73 variable_names += list(scenario._equation.num_unknowns.keys())
74 if type(scenario._equation.num_auxiliary_variables)
is dict:
75 variable_names += list(scenario._equation.num_auxiliary_variables.keys())
77 plot_description =
", ".join(variable_names)
79 project = exahype2.Project(
80 namespace=[
"benchmarks",
"exahype2",
"kernelbenchmarks"],
81 project_name=
"KernelBenchmarks",
83 executable=
"KernelBenchmarks",
86 fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
88 patch_size=
int(args.patch_size),
89 unknowns=scenario._equation.num_unknowns,
90 auxiliary_variables=scenario._equation.num_auxiliary_variables,
91 min_volume_h=(1.1 *
min(size[0:dimensions]) / (3.0**depth)),
92 max_volume_h=(1.1 *
min(size[0:dimensions]) / (3.0**depth)),
93 time_step_relaxation=0.5,
94 use_enclave_tasking=
True,
97 fv_solver.set_implementation(
98 initial_conditions=scenario.initial_conditions(),
99 boundary_conditions=
"""
100 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
101 Qoutside[i] = Qinside[i];
104 flux=scenario._equation.flux(),
105 max_eigenvalue=scenario._equation.eigenvalues(),
108 project.add_solver(fv_solver)
110 project.set_global_simulation_parameters(
111 dimensions=dimensions,
112 size=size[0:dimensions],
113 offset=offset[0:dimensions],
114 min_end_time=scenario._end_time,
115 max_end_time=scenario._end_time,
116 first_plot_time_stamp=0.0,
117 time_in_between_plots=0.1,
118 periodic_BC=[
False] * dimensions,
121 project.set_Peano4_installation(
122 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
125 project.set_output_path(
"solutions")
127 project = project.generate_Peano4_project(verbose=
False)
129 project.constants.export_constexpr_with_type(
"GridLength",
str(3**depth),
"int")
130 project.constants.export_const_with_type(
132 f
'"{plot_description}"',
135 project.constants.export_constexpr_with_type(
136 "ShouldPlot",
"true" if should_plot
else "false",
"bool"
139 makefile = project.output.makefile
140 makefile.add_cpp_file(
"KernelBenchmarks-main.cpp")
141 makefile.add_h_file(
"DataRepository.h")
142 makefile.add_cpp_file(
"DataRepository.cpp")
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....
Very simple scenario in which the initial value of x is shifted in each spatial dimension.
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Classic radial dam break SWE equations, with constant initial water height but a bump in the bathymet...
Resting lake scenario for the shallow water equations.
static double min(double const x, double const y)