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 argparse
4
5import peano4
6import exahype2
7
8import scenarios
9
10modes = {
11 "release": peano4.output.CompileMode.Release,
12 "trace": peano4.output.CompileMode.Trace,
13 "assert": peano4.output.CompileMode.Asserts,
14 "stats": peano4.output.CompileMode.Stats,
15 "debug": peano4.output.CompileMode.Debug,
16}
17
18available_scenarios = {
19 "AcousticPlanarWaves": scenarios.AcousticPlanarWaves(dimensions=2),
20 "AdvectionLinear": scenarios.AdvectionLinear(),
21 "ElasticPlanarWaves": scenarios.ElasticPlanarWaves(dimensions=2),
22 "EulerGaussianBell": scenarios.EulerGaussianBell(),
23 "EulerIsotropicVortex": scenarios.EulerIsotropicVortex(),
24 "SWERadialDamBreak": scenarios.SWERadialDamBreak(),
25 "SWERestingLake": scenarios.SWERestingLake(),
26}
27
28parser = argparse.ArgumentParser(description="ExaHyPE 2 - ADER-DG testing script")
29
30parser.add_argument(
31 "-md",
32 "--mesh-depth",
33 dest="md",
34 type=int,
35 default=3,
36 help="Depth of coarsest mesh level, i.e if 2 is specified there will be 9 cells per dimension",
37)
38parser.add_argument(
39 "-amr",
40 "--adaptive-levels",
41 dest="adaptivity_levels",
42 type=int,
43 default=0,
44 help="Number of AMR grid levels on top of hmax (0 by default)",
45)
46parser.add_argument("-o", "--order", dest="order", type=int, default=3, help="DG Order")
47parser.add_argument(
48 "-p",
49 "--p",
50 dest="polynomials",
51 type=int,
52 default=1,
53 help="Polynomial type, 0 is Gauss-Legendre, 1 is Gauss-Lobatto",
54)
55parser.add_argument(
56 "-m", "--mode", dest="mode", default="release", help="|".join(modes.keys())
57)
58parser.add_argument(
59 "-s",
60 "--scenario",
61 dest="s",
62 default=None,
63 help="|".join(available_scenarios.keys()),
64)
65
66args = parser.parse_args()
67
68if args.s is None:
69 while True:
70 try:
71 s = input(
72 "Which of the following scenarios would you like to try out?\n"
73 + " - ".join(available_scenarios.keys())
74 + "\n"
75 )
76 scenario = available_scenarios[s]
77 except KeyError:
78 continue
79 else:
80 # User has specified a valid scenario
81 break
82else:
83 scenario = available_scenarios[args.s]
84
85order = args.order
86max_h = 1.1 * scenario._domain_size / (3.0**args.md)
87min_h = max_h * 3.0 ** (-args.adaptivity_levels)
88
89polynomials = (
90 exahype2.solvers.aderdg.Polynomials.Gauss_Legendre
91 if args.polynomials == 0
92 else exahype2.solvers.aderdg.Polynomials.Gauss_Lobatto
93)
94
96 ["tests", "exahype2", "aderdg"],
97 ".",
98 executable=scenario.__class__.__name__,
99)
100
102 name=scenario.__class__.__name__,
103 order=order,
104 min_cell_h=min_h,
105 max_cell_h=max_h,
106 time_step_relaxation=0.9,
107 unknowns=scenario._equation.num_unknowns,
108 auxiliary_variables=scenario._equation.num_auxiliary_variables,
109 initial_conditions=scenario.initial_conditions(),
110 boundary_conditions=scenario.boundary_conditions(),
111 eigenvalues=scenario._equation.eigenvalues(),
112 flux=scenario._equation.flux(),
113 ncp=scenario._equation.ncp(),
114)
115
116solver.add_kernel_optimisations(
117 polynomials=polynomials, is_linear=scenario._equation.is_linear
118)
119
120if scenario.analytical_solution() != exahype2.solvers.PDETerms.None_Implementation:
122 solver,
123 error_measurement_implementation=scenario.analytical_solution(),
124 output_file_name="Error_" + scenario.__class__.__name__,
125 )
126
127project.add_solver(solver)
128
129project.set_output_path("solutions")
130
131scenario.set_global_simulation_parameters(project)
132
133project.set_load_balancing(
134 "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates",
135 "new ::exahype2::LoadBalancingConfiguration(0.98)",
136)
137project.set_Peano4_installation("../../../", modes[args.mode])
138project = project.generate_Peano4_project("False")
139project.set_fenv_handler("FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW")
140
141project.build(make_clean_first=True)
142
143print(args)
144print(solver)
145print(project)
ExaHyPE 2 project.
Definition Project.py:14
Very simple scenario in which the initial value of x is shifted in each spatial dimension.
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.