Peano
Loading...
Searching...
No Matches
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
3import peano4
4import exahype2
5
6import scenarios
7
8available_precisions = {
9 "bf16", "fp16", "fp32", "fp64"
10}
11
12available_scenarios = {
13 "AcousticPlanarWaves": scenarios.AcousticPlanarWaves(dimensions=2),
14 "AdvectionLinear": scenarios.AdvectionLinear(),
15 "ElasticPlanarWaves": scenarios.ElasticPlanarWaves(dimensions=2),
16 "EulerGaussianBell": scenarios.EulerGaussianBell(),
17 "EulerIsentropicVortex": scenarios.EulerIsentropicVortex(),
18 "SWERadialDamBreak": scenarios.SWERadialDamBreak(),
19 "SWERestingLake": scenarios.SWERestingLake(),
20}
21
22parser = exahype2.ArgumentParser("ExaHyPE 2 - ADER-DG Testing Script")
23parser.add_argument("-pr", "--precision", default="fp64", help="|".join(available_precisions))
24parser.add_argument("-s", "--scenario", default=None, help="|".join(available_scenarios.keys()))
25parser.set_defaults(
26 min_depth=3,
27 degrees_of_freedom=4,
28)
29args = parser.parse_args()
30
31if 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
45else:
46 scenario = available_scenarios[args.scenario]
47
48order = args.degrees_of_freedom - 1
49max_h = 1.1 * scenario._domain_size / (3.0**args.min_depth)
50min_h = max_h * 3.0 ** (-args.amr_levels)
51
52polynomials = exahype2.solvers.aderdg.Polynomials.Gauss_Legendre
53
54project = exahype2.Project(
55 namespace=["tests", "exahype2", "aderdg"],
56 project_name=scenario.__class__.__name__,
57 directory=".",
58 executable="ADERDG",
59)
60
61solver = 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
71solver.add_kernel_optimisations(
72 polynomials=polynomials,
73 is_linear=scenario._equation.is_linear,
74 precision=args.precision
75)
76
77solver.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
86solver.set_plotter(args.plotter)
87
88if 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
95project.add_solver(solver)
96project.set_output_path("solutions")
97scenario.set_global_simulation_parameters(project)
98project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
99project.set_Peano4_installation("../../../", mode=peano4.output.string_to_mode(args.build_mode))
100project = project.generate_Peano4_project(verbose=False)
101project.set_fenv_handler(args.fpe)
102project.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.