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 = {"bf16", "fp16", "fp32", "fp64"}
9
10available_scenarios = {
11 "AdvectionLinear": scenarios.AdvectionLinear(),
12 "AcousticPlanarWaves": scenarios.AcousticPlanarWaves(dimensions=2),
13 "ElasticPlanarWaves": scenarios.ElasticPlanarWaves(dimensions=2),
14 "EulerGaussianBell": scenarios.EulerGaussianBell(),
15 "EulerIsentropicVortex": scenarios.EulerIsentropicVortex(),
16 "SWERadialDamBreak": scenarios.SWERadialDamBreak(),
17 "SWERestingLake": scenarios.SWERestingLake(),
18 "NavierStokesCosineBubble": scenarios.NavierStokesCosineBubble(),
19 "NavierStokesTwoBubbles": scenarios.NavierStokesTwoBubbles(),
20 "NavierStokesTaylorGreen": scenarios.NavierStokesTaylorGreenVortex(),
21 "NavierStokesABCFlow": scenarios.NavierStokesABCFlow(),
22}
23
24parser = exahype2.ArgumentParser("ExaHyPE 2 - ADER-DG Testing Script")
25parser.add_argument("-pr", "--precision", default="fp64", help="|".join(available_precisions))
26parser.add_argument("-s", "--scenario", default=None, help="|".join(available_scenarios.keys()))
27parser.set_defaults(
28 min_depth=3,
29 degrees_of_freedom=4,
30)
31args = parser.parse_args()
32
33if args.scenario is None:
34 while True:
35 try:
36 s = input(
37 "Which of the following scenarios would you like to test?\n"
38 + " - ".join(available_scenarios.keys())
39 + "\n"
40 )
41 scenario = available_scenarios[s]
42 except KeyError:
43 continue
44 else:
45 # User has specified a valid scenario
46 break
47else:
48 scenario = available_scenarios[args.scenario]
49
50order = args.degrees_of_freedom - 1
51max_h = 1.1 * scenario._domain_size / (3.0**args.min_depth)
52min_h = max_h * 3.0 ** (-args.amr_levels)
53
54polynomials = exahype2.solvers.aderdg.Polynomials.Gauss_Legendre
55
56project = exahype2.Project(
57 namespace=["tests", "exahype2", "aderdg"],
58 project_name=scenario.__class__.__name__,
59 directory=".",
60 executable="ExaHyPE",
61)
62
63solver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
64 name="ADERDGSolver",
65 order=order,
66 min_cell_h=min_h,
67 max_cell_h=max_h,
68 time_step_relaxation=0.9,
69 unknowns=scenario._equation.num_unknowns,
70 auxiliary_variables=scenario._equation.num_auxiliary_variables,
71)
72
73solver.add_kernel_optimisations(
74 polynomials=polynomials,
75 is_linear=scenario._equation.is_linear,
76 precision=args.precision
77)
78
79solver.set_implementation(
80 initial_conditions=scenario.initial_conditions(),
81 boundary_conditions=scenario.boundary_conditions(),
82 max_eigenvalue=scenario._equation.eigenvalues(),
83 flux=scenario._equation.flux(),
84 use_diffusive_flux=scenario._equation.use_diffusive_flux,
85 ncp=scenario._equation.ncp(),
86 source_term=scenario._equation.source(),
87 riemann_solver=scenario._equation.riemann_solver(),
88)
89
90if scenario.analytical_solution() != exahype2.solvers.PDETerms.None_Implementation:
91 exahype2.solvers.aderdg.ErrorMeasurement(
92 solver,
93 error_measurement_implementation=scenario.analytical_solution(),
94 output_file_name="Error_" + scenario.__class__.__name__,
95 )
96
97project.add_solver(solver)
98project.set_output_path("solutions")
99scenario.set_global_simulation_parameters(project)
100project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
101project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
102project = project.generate_Peano4_project(verbose=False)
103project.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.
Arnold-Beltrami-Childress flow, described e.g.
Here we simulate a homogeneous domain containing a single spherical bubble of higher temperature.
Here we simulate a homogeneous domain containing two bubbles, one of higher temperature beneath the o...
Originally described in doi.org/10.1098/rspa.1937.0036, the Taylor-Green Vortex is a scenario for the...
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.