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")
138 self.
_current_time_step.generator.load_store_compute_flag =
"::peano4::grid::constructLoadStoreComputeFlag({},{},{})".format(
144 (alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AnotB or alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AdeterminesB)
150 (alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AnotB or alpha.getMarker()==celldata::AlphaPoissonMarker::Marker::AdeterminesB)
165patch_size = 2*space_order+1
168 patch_size = patch_size,
169 unknowns = number_of_unknowns,
170 auxiliary_variables = auxiliary_variables,
171 min_volume_h = min_h,
172 max_volume_h = max_h,
173 time_step_relaxation = 0.1,
174 flux = exahype2.solvers.PDETerms.User_Defined_Implementation,
175 eigenvalues = exahype2.solvers.PDETerms.User_Defined_Implementation,
176 source_term = exahype2.solvers.PDETerms.User_Defined_Implementation,
177 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
178 pde_terms_without_state = args.optimise_stateless
187fv_solver._action_set_postprocess_solution.guard =
"""
188repositories::{{SOLVER_INSTANCE}}.isLastGridSweepOfTimeStep()
190not repositories::{{SOLVER_INSTANCE}}.patchCanUseStatelessPDETerms(marker.x(), marker.h(), timeStamp, timeStepSize)
192fv_solver._action_set_postprocess_solution.add_postprocessing_kernel(
"""
193 repositories::{{SOLVER_INSTANCE}}.addDensity(volumeX,volumeH,value[0]);
203marker_solver.postprocess_updated_cell =
"""
204if ( not repositories::""" + fv_solver.get_name_of_global_instance() +
""".patchCanUseStatelessPDETerms(
207 // it would be nicer to use fineGridCellSelfSimilarInfallFVCellLabel here I guess
208 repositories::""" + fv_solver.get_name_of_global_instance() +
""".getMinTimeStamp(),
209 repositories::""" + fv_solver.get_name_of_global_instance() +
""".getMinTimeStepSize()
211 fineGridCell{{CELL_NAME}}.setValue(1.0);
212 fineGridCell{{CELL_NAME}}.setInvariant(true);
215 fineGridCell{{CELL_NAME}}.setInvariant(false);
224fv_solver.plot_description =
"rho,j_x,j_y,j_z,E,aux"
225dg_solver.plot_description =
"rho,j_x,j_y,j_z,E,aux"
226if "dyn" in args.type:
227 fv_solver.add_solver_constants(
"static constexpr bool DynamicAMR = true;" )
228 dg_solver.add_solver_constants(
"static constexpr bool DynamicAMR = true;" )
230 fv_solver.add_solver_constants(
"static constexpr bool DynamicAMR = false;" )
231 dg_solver.add_solver_constants(
"static constexpr bool DynamicAMR = false;" )
238project =
exahype2.Project( [
"benchmarks",
"exahype2",
"euler",
"sphericalaccretionupscaling"],
"benchmark",
".", executable=executable_name )
239project.add_solver( marker_solver )
240project.add_solver( dg_solver )
241project.add_solver( fv_solver )
249if args.mode==
"release":
250 build_mode = peano4.output.CompileMode.Release
251if args.mode==
"stats":
252 build_mode = peano4.output.CompileMode.Stats
253if args.mode==
"asserts":
254 build_mode = peano4.output.CompileMode.Asserts
256if "plot" in args.type:
257 plot_interval = end_time / 20.0
263project.set_global_simulation_parameters(
264 dimensions = dimensions,
265 offset = [-cube_size/2.0, -cube_size/2.0, -cube_size/2.0],
266 size = [ cube_size, cube_size, cube_size],
267 min_end_time = end_time,
268 max_end_time = end_time,
269 first_plot_time_stamp = 0.0,
270 time_in_between_plots = plot_interval,
271 periodic_BC = [
False,
False,
False]
275project.set_load_balancing(
"toolbox::loadbalancing::strategies::RecursiveBipartition",
"new ::exahype2::LoadBalancingConfiguration()" )
276project.set_Peano4_installation( args.peanodir, build_mode )
281peano4_project = project.generate_Peano4_project(args.verbose)
284peano4_project.output.makefile.add_cpp_file(
"../../../../applications/exahype2/euler/spherical-accretion/MassAccumulator.cpp" )
285peano4_project.output.makefile.add_cpp_file(
"../../../../applications/exahype2/euler/spherical-accretion/GravityModel.cpp" )
286peano4_project.output.makefile.add_header_search_path(
"../../../../applications/exahype2/euler" )
287peano4_project.generate()
289os.system(
"make clean" )
291 os.system(
"make -j{}".format(args.j) )
293 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.