8parser = argparse.ArgumentParser(
9 description=
"ExaHyPE 2 - Testing Script for Various Finite Volumes Solvers"
19 default=
"FVRusanovGlobalAdaptive",
20 choices=available_solvers.keys(),
21 help=
"|".join(available_solvers.keys()),
28 help=
"Number of space dimensions.",
33 choices=peano4.output.CompileModes,
34 default=peano4.output.CompileModes[0],
35 help=
"|".join(peano4.output.CompileModes),
42 help=
"End time of the simulation.",
46 "--number-of-snapshots",
49 help=
"Number of snapshots (plots).",
56 help=
"Number of finite volumes per axis (dimension) per patch.",
63 help=
"Determines maximum size of a single cell on each axis.",
70 help=
"Number of AMR grid levels on top of max. size of a cell.",
77 help=
"The storage scheme to use."
79available_load_balancing_strategies = [
82 "SpreadOutHierarchically",
83 "SpreadOutOnceGridStagnates",
84 "RecursiveBipartition",
86 "cascade::SpreadOut_RecursiveBipartition",
87 "cascade::SpreadOut_SplitOversizedTree",
91 "--load-balancing-strategy",
92 choices=available_load_balancing_strategies,
93 default=
"SpreadOutOnceGridStagnates",
94 help=
"|".join(available_load_balancing_strategies),
98 "--load-balancing-quality",
101 help=
"The quality of the load balancing.",
107 help=
"Number of trees (partitions) per rank after initial decomposition.",
113 help=
"Number of threads per rank.",
120 help=
"Fuse enclave tasks on the CPU (requires an enclave solver).",
127 help=
"Fuse enclave tasks on the GPU (requires an enclave solver).",
134 help=
"MPI timeout in seconds.",
140 help=
"Enable a floating-point exception handler.",
144 "--periodic-boundary-conditions-x",
147 help=
"Use periodic boundary conditions in the x-axis.",
151 "--periodic-boundary-conditions-y",
154 help=
"Use periodic boundary conditions in the y-axis.",
158 "--periodic-boundary-conditions-z",
161 help=
"Use periodic boundary conditions in the z-axis.",
168 help=
"Output path for project solutions output. The project will create a new folder at the given path. Default is 'solutions'.",
171args = parser.parse_args()
173initial_conditions =
"""
174 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
175 Q[i] = std::sin(volumeCentre(0) * tarch::la::PI) * std::sin(volumeCentre(1) * tarch::la::PI)
177 * std::sin(volumeCentre(2) * tarch::la::PI)
183boundary_conditions =
"""
184 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
185 Qoutside[i] = Qinside[i];
189refinement_criterion =
"""
190 auto result = ::exahype2::RefinementCommand::Keep;
192 if (volumeCentre(0) > 0.5) {
193 result = ::exahype2::RefinementCommand::Refine;
195 result = ::exahype2::RefinementCommand::Erase;
201max_h = 1.1 / 3.0**args.min_depth
202min_h = max_h * 3.0**(-args.amr_levels)
204fv_solver = available_solvers[args.solver](
207 unknowns={
"v": args.dimensions},
208 auxiliary_variables=0,
211 time_step_relaxation=0.5,
212 pde_terms_without_state=
True,
213 initial_conditions=initial_conditions,
214 boundary_conditions=boundary_conditions,
215 refinement_criterion=refinement_criterion,
217 for (int i = 0; i < NumberOfUnknowns; i++) {
220 F[normal] = Q[normal];
222 eigenvalues=
"maxEigenvalue[0] = 1.0;",
224fv_solver.plot_description =
", ".join({
"v": args.dimensions}.keys())
228 namespace=[
"tests",
"exahype2",
"fv"],
229 project_name=args.solver,
231 executable=args.solver,
233project.add_solver(fv_solver)
235if args.number_of_snapshots <= 0:
236 time_in_between_plots = 0.0
238 time_in_between_plots = args.end_time / args.number_of_snapshots
239 project.set_output_path(args.output)
241project.set_global_simulation_parameters(
242 dimensions=args.dimensions,
243 size=[1.0, 1.0, 1.0][0:args.dimensions],
244 offset=[0.0, 0.0, 0.0][0:args.dimensions],
245 min_end_time=args.end_time,
246 max_end_time=args.end_time,
247 first_plot_time_stamp=0.0,
248 time_in_between_plots=time_in_between_plots,
250 args.periodic_boundary_conditions_x,
251 args.periodic_boundary_conditions_y,
252 args.periodic_boundary_conditions_z,
256if args.load_balancing_strategy !=
"None":
257 strategy = f
"toolbox::loadbalancing::strategies::{args.load_balancing_strategy}"
258 assume_periodic_boundary_conditions = any([
259 args.periodic_boundary_conditions_x,
260 args.periodic_boundary_conditions_y,
261 args.periodic_boundary_conditions_z,
264 f
"new ::exahype2::LoadBalancingConfiguration("
265 f
"{args.load_balancing_quality},"
267 f
"{'true' if assume_periodic_boundary_conditions else 'false'},"
271 project.set_load_balancing(strategy, configuration)
273project.set_number_of_threads(args.threads)
274project.set_timeout(args.timeout)
275project.set_Peano4_installation(
"../../../", mode=peano4.output.string_to_mode(args.build_mode))
276project = project.generate_Peano4_project(verbose=
True)
278 project.set_fenv_handler(
"FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW")
280project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)