6from PDE
import max_eigenvalue, flux
8initial_conditions =
"""
10 * With plain DG, Rusanov, and without an additional limiter, we cannot solve
11 * discontinuous initial conditions. At the moment, most of the scenarios
12 * are physically meaningless. The only setup that should work
13 * out-of-the-box is the Gaussian, as it is infinitely smooth. Having said
14 * this, the Gaussian still can run into problems if it is too steep: If the
15 * polynomial order and mesh resolution are too low, the Gaussian continues
16 * to look like a discontinuous initial condition and thus introduces
17 * problems. Therefore, we scale its diameter with the maximum cell width. In
18 * a real setup, we should also take the polynomial order into account.
21 // Manual offset to make the wave originate slightly to the left of the center
22 // --- helps to detect if wave is moving to the left or right.
24 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.3};
26 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.18, 0.3, 0.6};
29 const double peakDeviation = MaxAdmissibleCellH;
30 const double distance = tarch::la::norm2(x - circleCentre);
31 const double exponent = -(distance * distance) / 2.0 / peakDeviation / peakDeviation;
33 Q[Shortcuts::rho] = 0.1;
34 Q[Shortcuts::rhoU + 0] = 0.0;
35 Q[Shortcuts::rhoU + 1] = 0.0;
37 Q[Shortcuts::rhoU + 2] = 0.0;
39 Q[Shortcuts::rhoE] = 1.0 + std::exp(exponent);
42boundary_conditions =
"""
43 // Reflective boundary conditions
44 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
45 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
46 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
48 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
50 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
53refinement_criterion =
"""
54 auto result = ::exahype2::RefinementCommand::Keep;
57 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.3};
59 const tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.18, 0.3, 0.6};
62 if (tarch::la::equals(t, 0.0)) {
63 if (tarch::la::norm2(x - circleCentre) < 0.1) {
64 result = ::exahype2::RefinementCommand::Refine;
71parser = exahype2.ArgumentParser(
"ExaHyPE 2 - Finite Volumes Testing Script")
74 degrees_of_freedom=16,
76args = parser.parse_args()
79max_h = 1.1 * min(size) / (3.0**args.min_depth)
80min_h = max_h * 3.0 ** (-args.amr_levels)
82fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
84 patch_size=args.degrees_of_freedom,
85 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
86 auxiliary_variables=0,
89 time_step_relaxation=0.5,
90 use_enclave_tasking=args.enclave_tasking,
91 number_of_enclave_tasks=args.ntasks,
94fv_solver.set_implementation(
95 initial_conditions=initial_conditions,
96 boundary_conditions=boundary_conditions,
97 refinement_criterion=refinement_criterion,
98 max_eigenvalue=max_eigenvalue,
102project = exahype2.Project(
103 namespace=[
"tests",
"exahype2",
"fv"],
104 project_name=
"GaussianExplosion",
106 executable=
"ExaHyPE",
108project.add_solver(fv_solver)
110if args.number_of_snapshots <= 0:
111 time_in_between_plots = 0.0
113 time_in_between_plots = args.end_time / args.number_of_snapshots
114 project.set_output_path(args.output)
116project.set_global_simulation_parameters(
117 dimensions=args.dimensions,
118 size=size[0 : args.dimensions],
119 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
120 min_end_time=args.end_time,
121 max_end_time=args.end_time,
122 first_plot_time_stamp=0.0,
123 time_in_between_plots=time_in_between_plots,
125 args.periodic_boundary_conditions_x,
126 args.periodic_boundary_conditions_y,
127 args.periodic_boundary_conditions_z,
131project.set_load_balancer(
132 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees})"
134project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
135project = project.generate_Peano4_project(verbose=
False)
136project.output.makefile.set_target_device(args.target_device)
137project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
138project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)