Peano
aderdg.py
Go to the documentation of this file.
1 # This file is part of the ExaHyPE2 project. For conditions of distribution and
2 # use, please see the copyright notice at www.peano-framework.org
3 import peano4
4 import exahype2
5 
6 import scenarios
7 
8 available_precisions = {
9  "bf16", "fp16", "fp32", "fp64"
10 }
11 
12 available_scenarios = {
13  "AcousticPlanarWaves": scenarios.AcousticPlanarWaves(dimensions=2),
14  "AdvectionLinear": scenarios.AdvectionLinear(),
15  "ElasticPlanarWaves": scenarios.ElasticPlanarWaves(dimensions=2),
16  "EulerGaussianBell": scenarios.EulerGaussianBell(),
17  "EulerIsotropicVortex": scenarios.EulerIsotropicVortex(),
18  "SWERadialDamBreak": scenarios.SWERadialDamBreak(),
19  "SWERestingLake": scenarios.SWERestingLake(),
20 }
21 
22 parser = exahype2.ArgumentParser("ExaHyPE 2 - ADER-DG Testing Script")
23 parser.add_argument("-pr", "--precision", default="fp64", help="|".join(available_precisions))
24 parser.add_argument("-s", "--scenario", default=None, help="|".join(available_scenarios.keys()))
25 parser.set_defaults(
26  min_depth=3,
27  degrees_of_freedom=4,
28 )
29 args = parser.parse_args()
30 
31 if args.scenario is None:
32  while True:
33  try:
34  s = input(
35  "Which of the following scenarios would you like to test?\n"
36  + " - ".join(available_scenarios.keys())
37  + "\n"
38  )
39  scenario = available_scenarios[s]
40  except KeyError:
41  continue
42  else:
43  # User has specified a valid scenario
44  break
45 else:
46  scenario = available_scenarios[args.scenario]
47 
48 order = args.degrees_of_freedom - 1
49 max_h = 1.1 * scenario._domain_size / (3.0**args.min_depth)
50 min_h = max_h * 3.0 ** (-args.amr_levels)
51 
52 polynomials = exahype2.solvers.aderdg.Polynomials.Gauss_Lobatto
53 
54 project = exahype2.Project(
55  namespace=["tests", "exahype2", "aderdg"],
56  project_name=scenario.__class__.__name__,
57  directory=".",
58  executable="ADERDG",
59 )
60 
61 solver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
62  name="ADERDGSolver",
63  order=order,
64  min_cell_h=min_h,
65  max_cell_h=max_h,
66  time_step_relaxation=0.9,
67  unknowns=scenario._equation.num_unknowns,
68  auxiliary_variables=scenario._equation.num_auxiliary_variables,
69 )
70 
71 solver.add_kernel_optimisations(
72  polynomials=polynomials,
73  is_linear=scenario._equation.is_linear,
74  precision=args.precision
75 )
76 
77 solver.set_implementation(
78  initial_conditions=scenario.initial_conditions(),
79  boundary_conditions=scenario.boundary_conditions(),
80  max_eigenvalue=scenario._equation.eigenvalues(),
81  flux=scenario._equation.flux(),
82  ncp=scenario._equation.ncp(),
83  riemann_solver=scenario._equation.riemann_solver(),
84 )
85 
86 solver.set_plotter(args.plotter)
87 
88 if scenario.analytical_solution() != exahype2.solvers.PDETerms.None_Implementation:
89  exahype2.solvers.aderdg.ErrorMeasurement(
90  solver,
91  error_measurement_implementation=scenario.analytical_solution(),
92  output_file_name="Error_" + scenario.__class__.__name__,
93  )
94 
95 project.add_solver(solver)
96 project.set_output_path("solutions")
97 scenario.set_global_simulation_parameters(project)
98 project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
99 project.set_Peano4_installation("../../../", mode=peano4.output.string_to_mode(args.build_mode))
100 project = project.generate_Peano4_project(verbose=False)
101 project.set_fenv_handler(args.fpe)
102 project.build(make_clean_first=True)
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....
Very simple scenario in which the initial value of x is shifted in each spatial dimension.
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Classic radial dam break SWE equations, with constant initial water height but a bump in the bathymet...
Resting lake scenario for the shallow water equations.