Peano
Loading...
Searching...
No Matches
rkdg.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 os
4import sys
5
6import peano4
7import exahype2
8
9sys.path.insert(0, os.path.abspath("../aderdg"))
10import scenarios
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 - RK-DG Testing Script")
23parser.add_argument("-s", "--scenario", default=None, help="|".join(available_scenarios.keys()))
24parser.set_defaults(
25 min_depth=3,
26 degrees_of_freedom=3,
27)
28args = parser.parse_args()
29
30if args.scenario is None:
31 while True:
32 try:
33 s = input(
34 "Which of the following scenarios would you like to test?\n"
35 + " - ".join(available_scenarios.keys())
36 + "\n"
37 )
38 scenario = available_scenarios[s]
39 except KeyError:
40 continue
41 else:
42 # User has specified a valid scenario
43 break
44else:
45 scenario = available_scenarios[args.scenario]
46
47order = args.degrees_of_freedom - 1
48max_h = 1.1 * scenario._domain_size / (3.0**args.min_depth)
49min_h = max_h * 3.0 ** (-args.amr_levels)
50
51project = exahype2.Project(
52 namespace=["tests", "exahype2", "rkdg"],
53 project_name=scenario.__class__.__name__,
54 directory=".",
55 executable="RKDG",
56)
57
58solver = exahype2.solvers.rkdg.rusanov.GlobalAdaptiveTimeStep(
59 name="RKRDGSolver",
60 rk_order = order,
61 polynomials = exahype2.solvers.GaussLegendreBasis(4),
62 min_cell_h=min_h,
63 max_cell_h=max_h,
64 time_step_relaxation=0.9,
65 unknowns=scenario._equation.num_unknowns,
66 auxiliary_variables=scenario._equation.num_auxiliary_variables,
67)
68
69solver.set_implementation(
70 initial_conditions=scenario.initial_conditions(),
71 boundary_conditions=scenario.boundary_conditions(),
72 eigenvalues=scenario._equation.eigenvalues(),
73 flux=scenario._equation.flux(),
74 ncp=scenario._equation.ncp()
75)
76
77solver.set_plotter(args.plotter)
78
79if scenario.analytical_solution() != exahype2.solvers.PDETerms.None_Implementation:
80 exahype2.solvers.rkdg.ErrorMeasurement(
81 solver,
82 error_measurement_implementation=scenario.analytical_solution(),
83 output_file_name="Error_" + scenario.__class__.__name__,
84 )
85
86project.add_solver(solver)
87project.set_output_path("solutions")
88scenario.set_global_simulation_parameters(project)
89project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
90project.set_Peano4_installation("../../../", mode=peano4.output.string_to_mode(args.build_mode))
91project = project.generate_Peano4_project(verbose=False)
92project.set_fenv_handler(args.fpe)
93project.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.
Resting lake scenario for the shallow water equations.