9 sys.path.insert(0, os.path.abspath(
".."))
10 from PDE
import max_eigenvalue, flux
12 initial_conditions =
"""
14 * With plain DG, Rusanov, and without an additional limiter, we cannot solve
15 * discontinuous initial conditions. At the moment, most of the scenarios
16 * are physically meaningless. The only setup that should work
17 * out-of-the-box is the Gaussian, as it is infinitely smooth. Having said
18 * this, the Gaussian still can run into problems if it is too steep: If the
19 * polynomial order and mesh resolution are too low, the Gaussian continues
20 * to look like a discontinuous initial condition and thus introduces
21 * problems. Therefore, we scale its diameter with the maximum cell width. In
22 * a real setup, we should also take the polynomial order into account.
25 // Manual offset to make the wave originate slightly to the left of the center
26 // --- helps to detect if wave is moving to the left or right.
28 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.3};
30 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.18, 0.3, 0.6};
33 const double peakDeviation = MaxAdmissibleCellH;
34 const double distance = tarch::la::norm2(x - circleCentre);
35 const double exponent = -(distance * distance) / 2.0 / peakDeviation / peakDeviation;
37 Q[Shortcuts::rho] = 0.1;
38 Q[Shortcuts::rhoU + 0] = 0.0;
39 Q[Shortcuts::rhoU + 1] = 0.0;
41 Q[Shortcuts::rhoU + 2] = 0.0;
43 Q[Shortcuts::rhoE] = 1.0 + std::exp(exponent);
46 boundary_conditions =
"""
47 // Reflective boundary conditions
48 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
49 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
50 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
52 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
54 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
57 refinement_criterion =
"""
58 auto result = ::exahype2::RefinementCommand::Keep;
61 tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.5, 0.5};
63 tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.5};
66 if (tarch::la::equals(t, 0.0)) {
67 if (tarch::la::norm2(x - circleCentre) < 0.1) {
68 result = ::exahype2::RefinementCommand::Refine;
75 parser = exahype2.ArgumentParser(
76 "ExaHyPE 2 Euler Gaussian Explosion Argument Parser"
80 degrees_of_freedom=16,
82 args = parser.parse_args()
84 size = [1.0, 1.0, 1.0]
85 max_h = 1.1 *
min(size) / (3.0**args.min_depth)
86 min_h = max_h * 3.0 ** (-args.amr_levels)
88 riemann_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
90 patch_size=args.degrees_of_freedom,
91 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
92 auxiliary_variables=0,
95 time_step_relaxation=args.time_step_relaxation,
96 use_enclave_tasking=args.enclave_tasking,
97 number_of_enclave_tasks=args.ntasks,
100 riemann_solver.set_implementation(
101 initial_conditions=initial_conditions,
102 boundary_conditions=boundary_conditions,
103 refinement_criterion=refinement_criterion,
104 max_eigenvalue=max_eigenvalue,
108 riemann_solver.set_plotter(args.plotter)
110 project = exahype2.Project(
111 namespace=[
"applications",
"exahype2",
"euler"],
112 project_name=
"GaussianExplosion",
116 project.add_solver(riemann_solver)
118 if args.number_of_snapshots <= 0:
119 time_in_between_plots = 0.0
121 time_in_between_plots = args.end_time / args.number_of_snapshots
122 project.set_output_path(args.output)
124 project.set_global_simulation_parameters(
125 dimensions=args.dimensions,
126 size=size[0 : args.dimensions],
127 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
128 min_end_time=args.end_time,
129 max_end_time=args.end_time,
130 first_plot_time_stamp=0.0,
131 time_in_between_plots=time_in_between_plots,
133 args.periodic_boundary_conditions_x,
134 args.periodic_boundary_conditions_y,
135 args.periodic_boundary_conditions_z,
139 project.set_load_balancer(
140 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees}, {args.trees})"
142 project.set_Peano4_installation(
143 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
145 project = project.generate_Peano4_project(verbose=
False)
146 project.set_fenv_handler(args.fpe)
147 project.output.makefile.set_target_device(args.target_device)
148 project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
149 project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)
static double min(double const x, double const y)