22 parser = argparse.ArgumentParser(
23 description=
"ExaHyPE 2 - Euler Application Script"
36 help=
"Number of space dimensions.",
43 help=
"Time step size for fixed time-stepping.",
47 "--time-step-relaxation",
50 help=
"Time step relaxation safety factor for adaptive time-stepping.",
57 help=
"Specify size of domain in meters as [x, y] as string (e.g. [10, 10], [7e6, 4e6]).",
63 help=
"Specify offset of domain in meters as [x, y] as string (e.g. [-10, -10], [-7e6, -4e6]).",
71 help=
"Use stateless PDE terms for GPU offloading (requires a GPU enabled Peano build and an enclave solver).",
79 help=
"Output path for project solution output. The project will create a new folder at the given path. Default is 'solution'.",
84 "--periodic-boundary-conditions-x",
86 help=
"Use periodic boundary conditions in the x-axis.",
90 "--periodic-boundary-conditions-y",
92 help=
"Use periodic boundary conditions in the y-axis.",
96 "--periodic-boundary-conditions-z",
98 help=
"Use periodic boundary conditions in the z-axis.",
104 choices=peano4.output.CompileModes,
105 default=peano4.output.CompileModes[0],
106 help=
"|".join(peano4.output.CompileModes),
114 help=
"End time of the simulation.",
118 "--number-of-snapshots",
121 help=
"Number of snapshots (plots).",
128 help=
"Number of finite volumes per axis (dimension) per patch.",
134 help=
"Order of time discretisation for Runge-Kutta scheme.",
140 help=
"Order of space discretisation for Discontinuous Galerkin.",
148 help=
"Determines maximum size of a single cell on each axis.",
155 help=
"Number of AMR grid levels on top of max. size of a cell.",
163 help=
"The storage scheme to use."
166 available_load_balancing_strategies = [
169 "SpreadOutHierarchically",
170 "SpreadOutOnceGridStagnates",
171 "RecursiveBipartition",
172 "SplitOversizedTree",
173 "cascade::SpreadOut_RecursiveBipartition",
174 "cascade::SpreadOut_SplitOversizedTree",
178 "--load-balancing-strategy",
179 choices=available_load_balancing_strategies,
180 default=
"SpreadOutOnceGridStagnates",
181 help=
"|".join(available_load_balancing_strategies),
185 "--load-balancing-quality",
188 help=
"The quality of the load balancing.",
194 help=
"Number of trees (partitions) per rank after initial decomposition.",
200 help=
"Number of threads per rank.",
207 help=
"Number of enclave tasks to fuse into one meta task.",
214 help=
"MPI timeout in seconds.",
220 help=
"Enable a floating-point exception handler.",
226 help=
"Do not compile the code after generation.",
232 help=
"Peano directory",
240 "unknowns": {
"rho": 1,
"u": 1,
"v": 1,
"w": 1,
"e": 1}
241 if args.dimensions == 3
242 else {
"rho": 1,
"u": 1,
"v": 1,
"e": 1},
243 "auxiliary_variables": 0,
247 solver_params.update(
249 "pde_terms_without_state":
True,
253 if "Fixed" in args.solver:
254 solver_params.update(
256 "normalised_time_step_size": args.time_step_size,
259 elif "Adaptive" in args.solver:
260 solver_params.update(
262 "time_step_relaxation": args.time_step_relaxation,
266 max_h = (1.1 * min(args.width[0:args.dimensions]) / (3.0**args.min_depth))
267 min_h = max_h * 3.0 ** (-args.amr_levels)
269 if "FV" in args.solver:
270 solver_params.update(
272 "patch_size": args.patch_size,
273 "max_volume_h": max_h,
274 "min_volume_h": min_h,
277 implementation_params = {
278 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
279 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
280 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
281 "flux":
"applications::exahype2::euler::flux(Q, faceCentre, volumeH, t, dt, normal, F);",
282 "eigenvalues":
"return applications::exahype2::euler::maxEigenvalue(Q, faceCentre, volumeH, t, dt, normal);",
284 elif "RKDG" in args.solver:
285 solver_params.update(
287 "rk_order": args.rk_order,
293 implementation_params = {
294 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
295 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
296 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
297 "flux":
"applications::exahype2::euler::flux(Q, x, h, t, dt, normal, F);",
298 "eigenvalues":
"return applications::exahype2::euler::maxEigenvalue(Q, x, h, t, dt, normal);",
300 elif "ADERDG" in args.solver:
301 solver_params.update(
303 "order": args.dg_order,
308 implementation_params = {
309 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
310 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
311 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
312 "flux":
"applications::exahype2::euler::flux(Q, x, h, t, dt, normal, F);",
313 "eigenvalues":
"return applications::exahype2::euler::maxEigenvalue(Q, x, h, t, dt, normal);",
317 solver.plot_description =
", ".join(solver_params[
"unknowns"].keys()) +
", "
318 if solver_params[
"auxiliary_variables"] != 0:
319 solver.plot_description +=
", ".join(solver_params[
"auxiliary_variables"].keys())
320 solver.set_implementation(**implementation_params)
323 if "ADERDG" in args.solver:
324 solver.add_kernel_optimisations(is_linear =
False, polynomials=exahype2.solvers.aderdg.Polynomials.Gauss_Lobatto)
330 namespace=[
"applications",
"exahype2",
"euler"],
331 project_name=
"Euler",
333 executable=f
"Euler.{args.build_mode}",
336 project.add_solver(solver)
338 if args.number_of_snapshots <= 0:
339 time_in_between_plots = 0.0
341 time_in_between_plots = args.end_time / args.number_of_snapshots
342 project.set_output_path(args.output)
344 project.set_global_simulation_parameters(
345 dimensions=args.dimensions,
346 size=args.width[0:args.dimensions],
347 offset=args.offset[0:args.dimensions],
348 min_end_time=args.end_time,
349 max_end_time=args.end_time,
350 first_plot_time_stamp=0.0,
351 time_in_between_plots=time_in_between_plots,
353 args.periodic_boundary_conditions_x,
354 args.periodic_boundary_conditions_y,
355 args.periodic_boundary_conditions_z,
359 if args.load_balancing_strategy !=
"None":
360 strategy = f
"toolbox::loadbalancing::strategies::{args.load_balancing_strategy}"
361 assume_periodic_boundary_conditions = any([
362 args.periodic_boundary_conditions_x,
363 args.periodic_boundary_conditions_y,
364 args.periodic_boundary_conditions_z,
367 f
"new ::exahype2::LoadBalancingConfiguration("
368 f
"{args.load_balancing_quality},"
370 f
"{'true' if assume_periodic_boundary_conditions else 'false'},"
374 project.set_load_balancing(strategy, configuration)
376 project.set_number_of_threads(args.threads)
378 project.set_multicore_orchestration(
379 "tarch::multicore::orchestration::Hardcoded::createFuseAll(%s, true, true, 0)"
380 % str(args.fuse_tasks)
382 project.additional_includes.append(
"tarch/multicore/orchestration/Hardcoded.h")
384 project.set_timeout(args.timeout)
386 project.set_Peano4_installation(args.peano_dir, mode=peano4.output.string_to_mode(args.build_mode))
387 project = project.generate_Peano4_project(verbose=
True)
390 project.set_fenv_handler(
"FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW")