9sys.path.insert(0, os.path.abspath(
".."))
10from PDE
import max_eigenvalue, flux
12initial_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));
24boundary_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];
35refinement_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;
53parser = exahype2.ArgumentParser(
"ExaHyPE 2 Euler Point Explosion Argument Parser")
56 degrees_of_freedom=16,
58args = parser.parse_args()
61max_h = 1.1 * min(size) / (3.0**args.min_depth)
62min_h = max_h * 3.0 ** (-args.amr_levels)
64riemann_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
66 patch_size=args.degrees_of_freedom,
67 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
68 auxiliary_variables=0,
71 time_step_relaxation=0.5,
72 use_enclave_tasking=args.enclave_tasking,
73 number_of_enclave_tasks=args.ntasks,
76riemann_solver.set_implementation(
77 initial_conditions=initial_conditions,
78 boundary_conditions=boundary_conditions,
79 refinement_criterion=refinement_criterion,
80 max_eigenvalue=max_eigenvalue,
84riemann_solver.set_plotter(args.plotter)
86project = exahype2.Project(
87 namespace=[
"applications",
"exahype2",
"euler"],
88 project_name=
"PointExplosion",
92project.add_solver(riemann_solver)
94if args.number_of_snapshots <= 0:
95 time_in_between_plots = 0.0
97 time_in_between_plots = args.end_time / args.number_of_snapshots
98 project.set_output_path(args.output)
100project.set_global_simulation_parameters(
101 dimensions=args.dimensions,
102 size=size[0 : args.dimensions],
103 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
104 min_end_time=args.end_time,
105 max_end_time=args.end_time,
106 first_plot_time_stamp=0.0,
107 time_in_between_plots=time_in_between_plots,
109 args.periodic_boundary_conditions_x,
110 args.periodic_boundary_conditions_y,
111 args.periodic_boundary_conditions_z,
115project.set_load_balancer(
116 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees}, {args.trees})"
118project.set_Peano4_installation(
119 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
121project = project.generate_Peano4_project(verbose=
False)
122project.set_fenv_handler(args.fpe)
123project.output.makefile.set_target_device(args.target_device)
124project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
125project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)