6initial_conditions =
"""
7 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
11 constexpr double InitialWaterHeightDam = 0.9;
13 const double m1 = 1.0 - 0.10 * std::sqrt((x(0) - 15.0) * (x(0) - 15.0) + (x(1) - 22.5) * (x(1) - 22.5));
14 const double m2 = 1.0 - 0.10 * std::sqrt((x(0) - 15.0) * (x(0) - 15.0) + (x(1) - 7.50) * (x(1) - 7.50));
15 const double m3 = 1.0 - 0.28 * std::sqrt((x(0) - 28.0) * (x(0) - 28.0) + (x(1) - 15.0) * (x(1) - 15.0));
17 Q[Shortcuts::h] = x[0] <= 5.0 ? InitialWaterHeightDam : 0.0;
18 Q[Shortcuts::z] = std::max({0.0, m1, m2, m3});
21boundary_conditions =
"""
22 Qoutside[Shortcuts::h] = Qinside[Shortcuts::h];
23 Qoutside[Shortcuts::hu] = 0.0;
24 Qoutside[Shortcuts::hv] = 0.0;
25 Qoutside[Shortcuts::z] = Qinside[Shortcuts::z];
28refinement_criterion =
"""
29 auto result = ::exahype2::RefinementCommand::Keep;
31 const double m1 = 1.0 - 0.10 * std::sqrt((x(0) - 15.0) * (x(0) - 15.0) + (x(1) - 22.5) * (x(1) - 22.5));
32 const double m2 = 1.0 - 0.10 * std::sqrt((x(0) - 15.0) * (x(0) - 15.0) + (x(1) - 7.50) * (x(1) - 7.50));
33 const double m3 = 1.0 - 0.28 * std::sqrt((x(0) - 28.0) * (x(0) - 28.0) + (x(1) - 15.0) * (x(1) - 15.0));
35 if (m1 > 0.0 or m2 > 0.0 or m3 > 0.0) {
36 result = ::exahype2::RefinementCommand::Refine;
42parser = exahype2.ArgumentParser()
45 degrees_of_freedom=16,
48args = parser.parse_args()
51 "g": [9.81,
"double"],
52 "hThreshold": [1e-3,
"double"],
56max_h = 1.1 * min(size) / (3.0**args.min_depth)
57min_h = max_h * 3.0 ** (-args.amr_levels)
59fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
61 patch_size=args.degrees_of_freedom,
62 unknowns={
"h": 1,
"hu": 1,
"hv": 1},
63 auxiliary_variables={
"z": 1},
66 time_step_relaxation=0.5,
69fv_solver.set_implementation(
70 initial_conditions=initial_conditions,
71 boundary_conditions=boundary_conditions,
72 refinement_criterion=refinement_criterion,
73 riemann_solver=
"return augmentedStateRiemannSolver<double, Shortcuts>(QL, QR, x, h, t, dt, normal, FL, FR);",
76fv_solver.add_user_solver_includes(
78#include "../AugmentedStateRiemannSolver.h"
82project = exahype2.Project(
83 namespace=[
"applications",
"exahype2",
"ShallowWater"],
84 project_name=
"ThreeMoundsChannel",
88project.add_solver(fv_solver)
90if args.number_of_snapshots <= 0:
91 time_in_between_plots = 0.0
93 time_in_between_plots = args.end_time / args.number_of_snapshots
94 project.set_output_path(args.output)
96project.set_global_simulation_parameters(
100 min_end_time=args.end_time,
101 max_end_time=args.end_time,
102 first_plot_time_stamp=0.0,
103 time_in_between_plots=time_in_between_plots,
105 args.periodic_boundary_conditions_x,
106 args.periodic_boundary_conditions_y,
110project.set_load_balancer(
111 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees})"
113project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
114project = project.generate_Peano4_project(verbose=
False)
115for const_name, const_info
in constants.items():
116 const_val, const_type = const_info
117 project.constants.export_constexpr_with_type(const_name, str(const_val), const_type)
118project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)