6from PDE
import max_eigenvalue, flux
8initial_conditions =
"""
9 Q[Shortcuts::rho] = 1.0;
10 Q[Shortcuts::rhoU + 0] = 0.0;
11 Q[Shortcuts::rhoU + 1] = 0.0;
13 Q[Shortcuts::rhoE] = ((sqrt(pow(0.5 - x(0), 2) + pow(0.5 - x(1), 2)) < 0.2) ? (1.0) : (1.01));
15 Q[Shortcuts::rhoU + 2] = 0.0;
16 Q[Shortcuts::rhoE] = ((sqrt(pow(0.5 - x(0), 2) + pow(0.5 - x(1), 2) + pow(0.5 - x(2), 2)) < 0.2) ? (1.0) : (1.01));
20boundary_conditions =
"""
21 // Reflective boundary conditions
22 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
23 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
24 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
26 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
28 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
31refinement_criterion =
"""
32 auto result = ::exahype2::RefinementCommand::Keep;
34 tarch::la::Vector<DIMENSIONS, double> circleCentre(0.5);
36 if (tarch::la::equals(t, 0.0)) {
37 if (tarch::la::norm2(x - circleCentre) < 0.1) {
38 result = ::exahype2::RefinementCommand::Refine;
45parser = exahype2.ArgumentParser(
"ExaHyPE 2 - Finite Volumes Testing Script")
48 degrees_of_freedom=16,
50args = parser.parse_args()
53max_h = 1.1 * min(size) / (3.0**args.min_depth)
54min_h = max_h * 3.0 ** (-args.amr_levels)
56fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
58 patch_size=args.degrees_of_freedom,
59 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
60 auxiliary_variables=0,
63 time_step_relaxation=0.5,
64 use_enclave_tasking=args.enclave_tasking,
65 number_of_enclave_tasks=args.ntasks,
68fv_solver.set_implementation(
69 initial_conditions=initial_conditions,
70 boundary_conditions=boundary_conditions,
71 refinement_criterion=refinement_criterion,
72 max_eigenvalue=max_eigenvalue,
76project = exahype2.Project(
77 namespace=[
"tests",
"exahype2",
"fv"],
78 project_name=
"PointExplosion",
82project.add_solver(fv_solver)
84if args.number_of_snapshots <= 0:
85 time_in_between_plots = 0.0
87 time_in_between_plots = args.end_time / args.number_of_snapshots
88 project.set_output_path(args.output)
90project.set_global_simulation_parameters(
91 dimensions=args.dimensions,
92 size=size[0 : args.dimensions],
93 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
94 min_end_time=args.end_time,
95 max_end_time=args.end_time,
96 first_plot_time_stamp=0.0,
97 time_in_between_plots=time_in_between_plots,
99 args.periodic_boundary_conditions_x,
100 args.periodic_boundary_conditions_y,
101 args.periodic_boundary_conditions_z,
105project.set_load_balancer(
106 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees})"
108project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
109project = project.generate_Peano4_project(verbose=
False)
110project.output.makefile.set_target_device(args.target_device)
111project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
112project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)