9 sys.path.insert(0, os.path.abspath(
".."))
10 from PDE
import max_eigenvalue, flux
12 initial_conditions =
"""
13 Q[Shortcuts::rho] = 0.1;
14 Q[Shortcuts::rhoU + 0] = 0.0;
15 Q[Shortcuts::rhoU + 1] = 0.0;
17 Q[Shortcuts::rhoU + 2] = 0.0;
19 Q[Shortcuts::rhoE] = ((x(0) < 0.5) ? (1.01) : (1.0));
22 boundary_conditions =
"""
23 // Reflective boundary conditions
24 Qoutside[Shortcuts::rho] = Qinside[Shortcuts::rho];
25 Qoutside[Shortcuts::rhoU + 0] = -Qinside[Shortcuts::rhoU + 0];
26 Qoutside[Shortcuts::rhoU + 1] = -Qinside[Shortcuts::rhoU + 1];
28 Qoutside[Shortcuts::rhoU + 2] = -Qinside[Shortcuts::rhoU + 2];
30 Qoutside[Shortcuts::rhoE] = Qinside[Shortcuts::rhoE];
33 refinement_criterion =
"""
34 auto result = ::exahype2::RefinementCommand::Keep;
36 if (tarch::la::equals(t, 0.0)) {
38 result = ::exahype2::RefinementCommand::Refine;
40 result = ::exahype2::RefinementCommand::Erase;
47 parser = exahype2.ArgumentParser(
"ExaHyPE 2 Euler Breaking Dam Argument Parser")
50 degrees_of_freedom=16,
52 args = parser.parse_args()
54 size = [1.0, 1.0, 1.0]
55 max_h = 1.1 *
min(size) / (3.0**args.min_depth)
56 min_h = max_h * 3.0 ** (-args.amr_levels)
58 riemann_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
60 patch_size=args.degrees_of_freedom,
61 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
62 auxiliary_variables=0,
65 time_step_relaxation=args.time_step_relaxation,
66 use_enclave_tasking=args.enclave_tasking,
67 number_of_enclave_tasks=args.ntasks,
70 riemann_solver.set_implementation(
71 initial_conditions=initial_conditions,
72 boundary_conditions=boundary_conditions,
73 refinement_criterion=refinement_criterion,
74 max_eigenvalue=max_eigenvalue,
78 riemann_solver.set_plotter(args.plotter)
80 project = exahype2.Project(
81 namespace=[
"applications",
"exahype2",
"euler"],
82 project_name=
"BreakingDam",
86 project.add_solver(riemann_solver)
88 if args.number_of_snapshots <= 0:
89 time_in_between_plots = 0.0
91 time_in_between_plots = args.end_time / args.number_of_snapshots
92 project.set_output_path(args.output)
94 project.set_global_simulation_parameters(
95 dimensions=args.dimensions,
96 size=size[0 : args.dimensions],
97 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
98 min_end_time=args.end_time,
99 max_end_time=args.end_time,
100 first_plot_time_stamp=0.0,
101 time_in_between_plots=time_in_between_plots,
103 args.periodic_boundary_conditions_x,
104 args.periodic_boundary_conditions_y,
105 args.periodic_boundary_conditions_z,
109 project.set_load_balancer(
110 f
"new ::exahype2::LoadBalancingConfiguration({args.load_balancing_quality}, 1, {args.trees}, {args.trees})"
112 project.set_Peano4_installation(
113 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
115 project = project.generate_Peano4_project(verbose=
False)
116 project.set_fenv_handler(args.fpe)
117 project.output.makefile.set_target_device(args.target_device)
118 project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
119 project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)
static double min(double const x, double const y)