9 sys.path.insert(0, os.path.abspath(
".."))
10 from PDE
import max_eigenvalue, flux
12 initial_conditions =
"""
13 Q[Shortcuts::rho] = 1.0;
14 Q[Shortcuts::rhoU + 0] = 0.0;
15 Q[Shortcuts::rhoU + 1] = 0.0;
17 Q[Shortcuts::rhoE] = ((std::sqrt(std::pow(0.5 - x(0), 2) + std::pow(0.5 - x(1), 2)) < 0.2) ? (1.0) : (1.01));
19 Q[Shortcuts::rhoU + 2] = 0.0;
20 Q[Shortcuts::rhoE] = ((std::sqrt(std::pow(0.5 - x(0), 2) + std::pow(0.5 - x(1), 2) + std::pow(0.5 - x(2), 2)) < 0.2) ? (1.0) : (1.01));
24 boundary_conditions =
"""
25 // Reflective boundary conditions
26 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
27 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
28 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
30 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
32 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
35 refinement_criterion =
"""
36 auto result = ::exahype2::RefinementCommand::Keep;
39 tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.5, 0.5};
41 tarch::la::Vector<DIMENSIONS, double> circleCentre = {0.5, 0.5};
44 if (tarch::la::equals(t, 0.0)) {
45 if (tarch::la::norm2(x - circleCentre) < 0.1) {
46 result = ::exahype2::RefinementCommand::Refine;
53 parser = exahype2.ArgumentParser(
54 "ExaHyPE 2 Euler Point Explosion Argument Parser"
58 degrees_of_freedom=16,
60 args = parser.parse_args()
62 size = [1.0, 1.0, 1.0]
63 max_h = 1.1 *
min(size) / (3.0**args.min_depth)
64 min_h = max_h * 3.0 ** (-args.amr_levels)
66 riemann_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
68 patch_size=args.degrees_of_freedom,
69 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
70 auxiliary_variables=0,
73 time_step_relaxation=args.time_step_relaxation,
74 use_enclave_tasking=args.enclave_tasking,
75 number_of_enclave_tasks=args.ntasks,
78 riemann_solver.set_implementation(
79 initial_conditions=initial_conditions,
80 boundary_conditions=boundary_conditions,
81 refinement_criterion=refinement_criterion,
82 max_eigenvalue=max_eigenvalue,
86 riemann_solver.set_plotter(args.plotter)
88 project = exahype2.Project(
89 namespace=[
"applications",
"exahype2",
"euler"],
90 project_name=
"PointExplosion",
94 project.add_solver(riemann_solver)
96 if args.number_of_snapshots <= 0:
97 time_in_between_plots = 0.0
99 time_in_between_plots = args.end_time / args.number_of_snapshots
100 project.set_output_path(args.output)
102 project.set_global_simulation_parameters(
103 dimensions=args.dimensions,
104 size=size[0 : args.dimensions],
105 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
106 min_end_time=args.end_time,
107 max_end_time=args.end_time,
108 first_plot_time_stamp=0.0,
109 time_in_between_plots=time_in_between_plots,
111 args.periodic_boundary_conditions_x,
112 args.periodic_boundary_conditions_y,
113 args.periodic_boundary_conditions_z,
117 project.set_load_balancer(
118 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees}, {args.trees})"
120 project.set_Peano4_installation(
121 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
123 project = project.generate_Peano4_project(verbose=
False)
124 project.set_fenv_handler(args.fpe)
125 project.output.makefile.set_target_device(args.target_device)
126 project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
127 project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)
static double min(double const x, double const y)