24 parser = argparse.ArgumentParser(
25 description=
"ExaHyPE 2 - Euler Application Script"
38 help=
"Number of space dimensions.",
45 help=
"Time step size for fixed time-stepping.",
49 "--time-step-relaxation",
52 help=
"Time step relaxation safety factor for adaptive time-stepping.",
59 help=
"Specify size of domain in meters as [x, y] as string (e.g. [10, 10], [7e6, 4e6]).",
65 help=
"Specify offset of domain in meters as [x, y] as string (e.g. [-10, -10], [-7e6, -4e6]).",
73 help=
"Use stateless PDE terms for GPU offloading (requires a GPU enabled Peano build and an enclave solver).",
81 help=
"Output path for project solution output. The project will create a new folder at the given path. Default is 'solution'.",
86 "--periodic-boundary-conditions-x",
88 help=
"Use periodic boundary conditions in the x-axis.",
92 "--periodic-boundary-conditions-y",
94 help=
"Use periodic boundary conditions in the y-axis.",
98 "--periodic-boundary-conditions-z",
100 help=
"Use periodic boundary conditions in the z-axis.",
106 choices=peano4.output.CompileModes,
107 default=peano4.output.CompileModes[0],
108 help=
"|".join(peano4.output.CompileModes),
116 help=
"End time of the simulation.",
120 "--number-of-snapshots",
123 help=
"Number of snapshots (plots).",
130 help=
"Number of finite volumes per axis (dimension) per patch.",
136 help=
"Order of time discretisation for Runge-Kutta scheme.",
142 help=
"Order of space discretisation for Discontinuous Galerkin.",
150 help=
"Determines maximum size of a single cell on each axis.",
157 help=
"Number of AMR grid levels on top of max. size of a cell.",
165 help=
"The storage scheme to use."
168 available_load_balancing_strategies = [
171 "SpreadOutHierarchically",
172 "SpreadOutOnceGridStagnates",
173 "RecursiveBipartition",
174 "SplitOversizedTree",
175 "cascade::SpreadOut_RecursiveBipartition",
176 "cascade::SpreadOut_SplitOversizedTree",
180 "--load-balancing-strategy",
181 choices=available_load_balancing_strategies,
182 default=
"SpreadOutOnceGridStagnates",
183 help=
"|".join(available_load_balancing_strategies),
187 "--load-balancing-quality",
190 help=
"The quality of the load balancing.",
196 help=
"Number of trees (partitions) per rank after initial decomposition.",
202 help=
"Number of threads per rank.",
209 help=
"Number of enclave tasks to fuse into one meta task.",
216 help=
"MPI timeout in seconds.",
222 help=
"Enable a floating-point exception handler.",
228 help=
"Do not compile the code after generation.",
234 help=
"Peano directory",
242 "unknowns": {
"rho": 1,
"u": 1,
"v": 1,
"w": 1,
"e": 1}
243 if args.dimensions == 3
244 else {
"rho": 1,
"u": 1,
"v": 1,
"e": 1},
245 "auxiliary_variables": 0,
249 solver_params.update(
251 "pde_terms_without_state":
True,
255 if "Fixed" in args.solver:
256 solver_params.update(
258 "normalised_time_step_size": args.time_step_size,
261 elif "Adaptive" in args.solver:
262 solver_params.update(
264 "time_step_relaxation": args.time_step_relaxation,
268 max_h = (1.1 * min(args.width[0:args.dimensions]) / (3.0**args.min_depth))
269 min_h = max_h * 3.0 ** (-args.amr_levels)
271 if "FV" in args.solver:
272 solver_params.update(
274 "patch_size": args.patch_size,
275 "max_volume_h": max_h,
276 "min_volume_h": min_h,
279 implementation_params = {
280 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
281 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
282 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
283 "flux":
"applications::exahype2::euler::flux(Q, faceCentre, volumeH, t, dt, normal, F);",
284 "eigenvalues":
"applications::exahype2::euler::maxEigenvalue(Q, faceCentre, volumeH, t, dt, normal, maxEigenvalue);",
286 elif "RKDG" in args.solver:
287 solver_params.update(
289 "rk_order": args.rk_order,
295 implementation_params = {
296 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
297 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
298 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
299 "flux":
"applications::exahype2::euler::flux(Q, x, h, t, dt, normal, F);",
300 "eigenvalues":
"return applications::exahype2::euler::maxEigenvalue(Q, x, h, t, dt, normal);",
302 elif "ADERDG" in args.solver:
303 solver_params.update(
305 "order": args.dg_order,
310 implementation_params = {
311 "initial_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
312 "boundary_conditions": exahype2.solvers.PDETerms.User_Defined_Implementation,
313 "refinement_criterion": exahype2.solvers.PDETerms.User_Defined_Implementation,
314 "flux":
"applications::exahype2::euler::flux(Q, x, h, t, dt, normal, F);",
316 double lambda[NumberOfUnknowns] = {0.};
317 applications::exahype2::euler::maxEigenvalue(Q, x, h, t, dt, normal, lambda);
318 return *std::max_element(lambda, lambda+NumberOfUnknowns);
323 solver.plot_description =
", ".join(solver_params[
"unknowns"].keys()) +
", "
324 if solver_params[
"auxiliary_variables"] != 0:
325 solver.plot_description +=
", ".join(solver_params[
"auxiliary_variables"].keys())
326 solver.set_implementation(**implementation_params)
329 if "ADERDG" in args.solver:
330 solver.add_kernel_optimisations(is_linear =
False, polynomials=exahype2.solvers.aderdg.Polynomials.Gauss_Lobatto)
336 namespace=[
"applications",
"exahype2",
"euler"],
337 project_name=
"Euler",
339 executable=f
"Euler.{args.build_mode}",
342 project.add_solver(solver)
344 if args.number_of_snapshots <= 0:
345 time_in_between_plots = 0.0
347 time_in_between_plots = args.end_time / args.number_of_snapshots
348 project.set_output_path(args.output)
350 project.set_global_simulation_parameters(
351 dimensions=args.dimensions,
352 size=args.width[0:args.dimensions],
353 offset=args.offset[0:args.dimensions],
354 min_end_time=args.end_time,
355 max_end_time=args.end_time,
356 first_plot_time_stamp=0.0,
357 time_in_between_plots=time_in_between_plots,
359 args.periodic_boundary_conditions_x,
360 args.periodic_boundary_conditions_y,
361 args.periodic_boundary_conditions_z,
365 if args.load_balancing_strategy !=
"None":
366 strategy = f
"toolbox::loadbalancing::strategies::{args.load_balancing_strategy}"
367 assume_periodic_boundary_conditions = any([
368 args.periodic_boundary_conditions_x,
369 args.periodic_boundary_conditions_y,
370 args.periodic_boundary_conditions_z,
373 f
"new ::exahype2::LoadBalancingConfiguration("
374 f
"{args.load_balancing_quality},"
376 f
"{'true' if assume_periodic_boundary_conditions else 'false'},"
380 project.set_load_balancing(strategy, configuration)
382 project.set_number_of_threads(args.threads)
384 project.set_multicore_orchestration(
385 "tarch::multicore::orchestration::Hardcoded::createFuseAll(%s, 0)"
386 % str(args.fuse_tasks)
388 project.additional_includes.append(
"tarch/multicore/orchestration/Hardcoded.h")
390 project.set_timeout(args.timeout)
392 project.set_Peano4_installation(args.peano_dir, mode=peano4.output.string_to_mode(args.build_mode))
393 project = project.generate_Peano4_project(verbose=
True)
396 project.set_fenv_handler(
"FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW")