3 Simple, hard-coded version of the self-similarity test of the MNRAS
4 paper. A more elegant implementation of the solver via a proper subclass
5 can be found in the actual application folder.
18ExaHyPE 2 Finite Volume version of the self-similarity tests of the MNRAS paper
20@author 2022 Han Zhang, Baojiu Li, Tobias Weinzierl
24parser = argparse.ArgumentParser(description=
'ExaHyPE 2 - Euler benchmarking script')
25parser.add_argument(
"-j",
"--parallel-builds", dest=
"j", type=int, default=-1, help=
"Parallel builds" )
26parser.add_argument(
"-pd",
"--peano-dir", dest=
"peanodir", default=
"../../../../", help=
"Peano4 directory" )
27parser.add_argument(
"-v",
"--verbose", dest=
"verbose", action=
"store_true", default=
False, help=
"Verbose")
28parser.add_argument(
"-m",
"--mode", dest=
"mode", choices=[
"release",
"stats",
"asserts"], required=
True, help=
"Pick build type" )
29parser.add_argument(
"-t",
"--type", dest=
"type", choices=[
"plot-0",
"plot-1",
"plot-2",
"plot-3",
"reg-0"], required=
True, help=
"Pick scenario" )
30parser.add_argument(
"--optimise-stateless", dest=
"optimise_stateless", action=
"store_true", default=
False, help=
"Optimise stateless/side-effect free cells (required for GPU offloading)")
31parser.add_argument(
"-s",
"--solver", dest=
"solver", choices=[
"dg1-rk1",
"dg2-rk2",
"dg3-rk3",
"dg4-rk4"], required=
True, help=
"Pick solver type" )
32args = parser.parse_args()
41solver_name =
"SelfSimilarInfall"
48number_of_unknowns = sum(unknowns.values())
50if args.type==
"plot-0":
54if args.type==
"plot-1":
55 baseline_max_h = 0.005
56 baseline_min_h = 0.005
58if args.type==
"plot-2":
62if args.type==
"plot-3":
64 baseline_min_h = 0.008
66elif args.type==
"reg-0":
67 baseline_max_h = 0.008
68 baseline_min_h = 0.008
78if "dg0-" in args.solver:
79 max_h = baseline_max_h
80 min_h = baseline_min_h
81if "dg1-" in args.solver:
82 max_h = baseline_max_h
83 min_h = baseline_min_h
84if "dg2-" in args.solver:
85 max_h = baseline_max_h * 3
86 min_h = baseline_min_h * 3
87elif "dg3-" in args.solver:
88 max_h = baseline_max_h * 4
89 min_h = baseline_min_h * 4
90elif "dg4-" in args.solver:
91 max_h = baseline_max_h * 5
92 min_h = baseline_min_h * 5
96auxiliary_variables = 0
99executable_name =
"benchmark-" + args.type
100if args.optimise_stateless:
101 executable_name = executable_name +
"-opt"
103 executable_name = executable_name +
"-no-opt"
106if args.mode!=
"release":
107 executable_name = executable_name +
"-" + args.mode
111space_order =
int(args.solver[2])
112time_order =
int(args.solver[6])
113executable_name = executable_name +
"-RK" + str(time_order) +
"DG" + str(space_order)
118 super(MyDGSolver,self).
__init__(name = solver_name +
"DG",
119 rk_order = time_order,
121 face_projections = exahype2.solvers.rkdg.FaceProjections.Solution,
122 unknowns = number_of_unknowns,
123 auxiliary_variables = auxiliary_variables,
126 time_step_relaxation = 0.1,
127 flux = exahype2.solvers.PDETerms.User_Defined_Implementation,
128 eigenvalues = exahype2.solvers.PDETerms.User_Defined_Implementation,
129 source_term = exahype2.solvers.PDETerms.User_Defined_Implementation,
130 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
131 pde_terms_without_state = args.optimise_stateless
135 (
"repositories::DataRepository::_CellDataAlphaPoissonMarkerStack.getForPush( repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top()",
"celldata::AlphaPoissonMarker",
"alpha")
139 self.
_current_time_step.generator.load_store_compute_flag =
"::peano4::grid::constructLoadStoreComputeFlag({},{},{})".format(
145 (alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AnotB or alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AdeterminesB)
151 (alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AnotB or alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AdeterminesB)
166patch_size = 2*space_order+1
169 patch_size = patch_size,
170 unknowns = number_of_unknowns,
171 auxiliary_variables = auxiliary_variables,
172 min_volume_h = min_h,
173 max_volume_h = max_h,
174 time_step_relaxation = 0.1,
175 flux = exahype2.solvers.PDETerms.User_Defined_Implementation,
176 eigenvalues = exahype2.solvers.PDETerms.User_Defined_Implementation,
177 source_term = exahype2.solvers.PDETerms.User_Defined_Implementation,
178 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
179 pde_terms_without_state = args.optimise_stateless
188fv_solver._action_set_postprocess_solution.guard =
"""
189repositories::{{SOLVER_INSTANCE}}.isLastGridSweepOfTimeStep()
191not repositories::{{SOLVER_INSTANCE}}.patchCanUseStatelessPDETerms(marker.x(), marker.h(), timeStamp, timeStepSize)
193fv_solver._action_set_postprocess_solution.add_postprocessing_kernel(
"""
194 repositories::{{SOLVER_INSTANCE}}.addDensity(volumeX,volumeH,value[0]);
204marker_solver.postprocess_updated_cell =
"""
205if ( not repositories::""" + fv_solver.get_name_of_global_instance() +
""".patchCanUseStatelessPDETerms(
208 // it would be nicer to use fineGridCellSelfSimilarInfallFVCellLabel here I guess
209 repositories::""" + fv_solver.get_name_of_global_instance() +
""".getMinTimeStamp(),
210 repositories::""" + fv_solver.get_name_of_global_instance() +
""".getMinTimeStepSize()
212 fineGridCell{{CELL_NAME}}.setValue(1.0);
213 fineGridCell{{CELL_NAME}}.setInvariant(true);
216 fineGridCell{{CELL_NAME}}.setInvariant(false);
225fv_solver.plot_description =
"rho,j_x,j_y,j_z,E,aux"
226dg_solver.plot_description =
"rho,j_x,j_y,j_z,E,aux"
227if "dyn" in args.type:
228 fv_solver.add_solver_constants(
"static constexpr bool DynamicAMR = true;" )
229 dg_solver.add_solver_constants(
"static constexpr bool DynamicAMR = true;" )
231 fv_solver.add_solver_constants(
"static constexpr bool DynamicAMR = false;" )
232 dg_solver.add_solver_constants(
"static constexpr bool DynamicAMR = false;" )
239project =
exahype2.Project( [
"benchmarks",
"exahype2",
"euler",
"sphericalaccretionupscaling"],
"benchmark",
".", executable=executable_name )
240project.add_solver( marker_solver )
241project.add_solver( dg_solver )
242project.add_solver( fv_solver )
250if args.mode==
"release":
251 build_mode = peano4.output.CompileMode.Release
252if args.mode==
"stats":
253 build_mode = peano4.output.CompileMode.Stats
254if args.mode==
"asserts":
255 build_mode = peano4.output.CompileMode.Asserts
257if "plot" in args.type:
258 plot_interval = end_time / 20.0
264project.set_global_simulation_parameters(
265 dimensions = dimensions,
266 offset = [-cube_size/2.0, -cube_size/2.0, -cube_size/2.0],
267 size = [ cube_size, cube_size, cube_size],
268 min_end_time = end_time,
269 max_end_time = end_time,
270 first_plot_time_stamp = 0.0,
271 time_in_between_plots = plot_interval,
272 periodic_BC = [
False,
False,
False]
276project.set_load_balancing(
"toolbox::loadbalancing::strategies::RecursiveBipartition",
"new ::exahype2::LoadBalancingConfiguration()" )
277project.set_Peano4_installation( args.peanodir, build_mode )
282peano4_project = project.generate_Peano4_project(args.verbose)
285peano4_project.output.makefile.add_cpp_file(
"../../../../applications/exahype2/euler/spherical-accretion/MassAccumulator.cpp" )
286peano4_project.output.makefile.add_cpp_file(
"../../../../applications/exahype2/euler/spherical-accretion/GravityModel.cpp" )
287peano4_project.output.makefile.add_header_search_path(
"../../../../applications/exahype2/euler" )
288peano4_project.generate()
290os.system(
"make clean" )
292 os.system(
"make -j{}".format(args.j) )
294 os.system(
"make -j" )
__init__(self)
Construct RKDG solver with adaptive global time step and enclave tasking.
The Gauss-Legendre Basis is by construction the only basis which yields diagonal mass matrices.
Run over solution volume by volume.
_provide_cell_data_to_compute_kernels_default_guard(self)
RKDG solver with global adaptive time step.