6initial_conditions =
"""
8 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
12 // landslide model params for granular material
13 double initCenterX = 4.0;
14 double initCenterY = 30;
15 double initRadius = 3.5;
16 double initHeight = 8.0;
18 const tarch::la::Vector<DIMENSIONS, double>& granularMaterialCenter = {initCenterX, initCenterY};
19 const bool nearCentre = tarch::la::norm2(x - granularMaterialCenter) < initRadius;
20 Q[Shortcuts::lsh] = (nearCentre ? initHeight : 0.0); // Granular material height (h)
22 // swe equation initial conditions
23 Q[Shortcuts::hu] = 0.0;
24 Q[Shortcuts::hv] = 0.0;
26 if (x[0] >= 19.5) { // made a smoother transition zone - some water movement at the start
27 Q[Shortcuts::h] = 4.0;
28 } else if (x[0] >= 17.5) {
29 Q[Shortcuts::h] = 4.0 * (x[0] - 17.5) / 2.0;
31 Q[Shortcuts::h] = 0.0;
34 Q[Shortcuts::z] = std::max(20.0 - x[0], 1.0);
37boundary_conditions =
"""
38 Qoutside[Shortcuts::h] = Qinside[Shortcuts::h];
39 Qoutside[Shortcuts::hu] = -Qinside[Shortcuts::hu];
40 Qoutside[Shortcuts::hv] = -Qinside[Shortcuts::hv];
41 Qoutside[Shortcuts::z] = Qinside[Shortcuts::z];
43 Qoutside[Shortcuts::lsh] = 0.;
44 Qoutside[Shortcuts::lshu] = 0.;
45 Qoutside[Shortcuts::lshv] = 0.;
48project = exahype2.Project(
49 namespace=[
"applications",
"exahype2",
"landslide"],
50 project_name=
"FVLandslideTsunami",
55project.set_output_path(
"solutions")
57parser = exahype2.ArgumentParser()
62args = parser.parse_args()
66dg_order = args.degrees_of_freedom - 1
67max_h = 1.1 * min(size) / (3.0**args.min_depth)
68min_h = max_h * 3.0 ** (-args.amr_levels)
71 "g": [9.81,
"double"],
72 "phi": [25.0,
"double"],
73 "invXi": [1.0 / 200.0,
"double"],
74 "hThreshold": [1e-1,
"double"],
77 math.tan(math.pi / 180.0 * constants[
"phi"][0]),
82unknowns = {
"h": 1,
"hu": 1,
"hv": 1,
"lsh": 1,
"lshu": 1,
"lshv": 1}
83auxiliary_variables = {
"z": 1}
85my_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
89 patch_size=dg_order * 2 + 1,
91 auxiliary_variables=auxiliary_variables,
92 time_step_relaxation=0.45,
95my_solver.set_implementation(
97 ShallowWater::flux<double, Shortcuts, NumberOfUnknowns>(
101 landslide::flux<double, Shortcuts>(
105 ShallowWater::nonconservativeProduct<double, Shortcuts, NumberOfUnknowns>(
106 Q, deltaQ, x, h, t, dt, normal, BTimesDeltaQ
108 landslide::nonconservativeProduct<double, Shortcuts>(
109 Q, deltaQ, x, h, t, dt, normal, BTimesDeltaQ
113 landslide::maxEigenvalue<double, Shortcuts>(
114 Q, x, h, t, dt, normal
116 ShallowWater::maxEigenvalue<double, Shortcuts>(
117 Q, x, h, t, dt, normal
120 boundary_conditions=boundary_conditions,
121 initial_conditions=initial_conditions,
122 diffusive_source_term=
"""
123landslide::diffusiveSourceTerm<double, Shortcuts, NumberOfUnknowns, NumberOfAuxiliaryVariables>(
124 Q, deltaQ, x, h, t, dt, S
127return landslide::rusanovRiemannSolverFV<double, Shortcuts, NumberOfUnknowns, NumberOfAuxiliaryVariables>(
128 QL, QR, x, h, t, dt, normal, FL, FR
131my_solver.add_user_solver_includes(
133#include "../RusanovRiemannSolver.h"
137project.add_solver(my_solver)
139if args.number_of_snapshots <= 0:
140 time_in_between_plots = 0.0
142 time_in_between_plots = args.end_time / args.number_of_snapshots
143 project.set_output_path(args.output)
145project.set_global_simulation_parameters(
146 dimensions=dimensions,
149 min_end_time=args.end_time,
150 max_end_time=args.end_time,
151 first_plot_time_stamp=0.0,
152 time_in_between_plots=time_in_between_plots,
153 periodic_BC=[
False,
False],
156project.set_load_balancer(
157 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees})"
159project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
160project = project.generate_Peano4_project(verbose=
False)
161for const_name, const_info
in constants.items():
162 const_val, const_type = const_info
163 project.constants.export_constexpr_with_type(const_name, str(const_val), const_type)
164project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)