6from PDE
import max_eigenvalue, flux
8initial_conditions =
"""
9 Q[Shortcuts::rho] = 0.1;
10 Q[Shortcuts::rhoU + 0] = 0.0;
11 Q[Shortcuts::rhoU + 1] = 0.0;
13 Q[Shortcuts::rhoU + 2] = 0.0;
15 Q[Shortcuts::rhoE] = ((x(0) < 0.5) ? (1.01) : (1.0));
18boundary_conditions =
"""
19 // Reflective boundary conditions
20 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
21 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
22 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
24 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
26 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
29refinement_criterion =
"""
30 auto result = ::exahype2::RefinementCommand::Keep;
32 if (tarch::la::equals(t, 0.0)) {
34 result = ::exahype2::RefinementCommand::Refine;
36 result = ::exahype2::RefinementCommand::Keep;
43parser = exahype2.ArgumentParser(
"ExaHyPE 2 - Finite Volumes Testing Script")
46 degrees_of_freedom=16,
48args = parser.parse_args()
51max_h = 1.1 * min(size) / (3.0**args.min_depth)
52min_h = max_h * 3.0 ** (-args.amr_levels)
54fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
56 patch_size=args.degrees_of_freedom,
57 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
58 auxiliary_variables=0,
61 time_step_relaxation=0.5,
62 use_enclave_tasking=args.enclave_tasking,
63 number_of_enclave_tasks=args.ntasks,
66fv_solver.set_implementation(
67 initial_conditions=initial_conditions,
68 boundary_conditions=boundary_conditions,
69 refinement_criterion=refinement_criterion,
70 max_eigenvalue=max_eigenvalue,
74project = exahype2.Project(
75 namespace=[
"tests",
"exahype2",
"fv"],
76 project_name=
"BreakingDam",
80project.add_solver(fv_solver)
82if args.number_of_snapshots <= 0:
83 time_in_between_plots = 0.0
85 time_in_between_plots = args.end_time / args.number_of_snapshots
86 project.set_output_path(args.output)
88project.set_global_simulation_parameters(
89 dimensions=args.dimensions,
90 size=size[0 : args.dimensions],
91 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
92 min_end_time=args.end_time,
93 max_end_time=args.end_time,
94 first_plot_time_stamp=0.0,
95 time_in_between_plots=time_in_between_plots,
97 args.periodic_boundary_conditions_x,
98 args.periodic_boundary_conditions_y,
99 args.periodic_boundary_conditions_z,
103project.set_load_balancer(
104 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees})"
106project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
107project = project.generate_Peano4_project(verbose=
False)
108project.output.makefile.set_target_device(args.target_device)
109project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
110project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)