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; // Flow in x-direction
15 Q[Shortcuts::rhoU + 1] = 0.0; // No vertical velocity
17 Q[Shortcuts::rhoU + 2] = 0.0;
19 Q[Shortcuts::rhoE] = 1.0 / (GAMMA - 1.0) + 0.5 * (Q[Shortcuts::rhoU + 0] * Q[Shortcuts::rhoU + 0] + Q[Shortcuts::rhoU + 1] * Q[Shortcuts::rhoU + 1]) / Q[Shortcuts::rho];
22boundary_conditions =
"""
23 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
24 Qoutside[i] = Qinside[i];
27 // Inlet boundary condition (x[0] = 0.0)
28 if (tarch::la::smallerEquals(x[0], MaxAdmissibleCellH)) {
29 Qoutside[Shortcuts::rhoU + 0] = 1.0;
32 // Outlet boundary condition
33 if (tarch::la::greaterEquals(x[0], DomainSize[0] - MaxAdmissibleCellH)) {
34 Qoutside[Shortcuts::rhoU + 0] = Qinside[Shortcuts::rhoU + 0];
38refinement_criterion =
"""
39 auto result = ::exahype2::RefinementCommand::Keep;
43parser = exahype2.ArgumentParser(
"ExaHyPE 2 - Euler Channel Flow Argument Parser")
44parser.set_defaults(min_depth=6, degrees_of_freedom=16, end_time=2.0)
45args = parser.parse_args()
48max_h = 1.1 * min(size) / (3.0**args.min_depth)
49min_h = max_h * 3.0 ** (-args.amr_levels)
51riemann_solver = exahype2.solvers.fv.musclhancock.GlobalAdaptiveTimeStep(
53 patch_size=args.degrees_of_freedom,
54 unknowns={
"rho": 1,
"rhoU": args.dimensions,
"rhoE": 1},
55 auxiliary_variables=0,
58 time_step_relaxation=0.5,
59 use_enclave_tasking=args.enclave_tasking,
60 number_of_enclave_tasks=args.ntasks,
63riemann_solver.set_implementation(
64 initial_conditions=initial_conditions,
65 boundary_conditions=boundary_conditions,
66 refinement_criterion=refinement_criterion,
67 max_eigenvalue=max_eigenvalue,
69 limiter=exahype2.solvers.fv.musclhancock.Limiter.minmod,
72riemann_solver.set_plotter(args.plotter)
74project = exahype2.Project(
75 namespace=[
"applications",
"exahype2",
"euler"],
76 project_name=
"ChannelFlow",
80project.add_solver(riemann_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}, {args.trees})"
106project.set_Peano4_installation(
107 "../../../../", mode=peano4.output.string_to_mode(args.build_mode)
109project = project.generate_Peano4_project(verbose=
False)
110project.set_fenv_handler(args.fpe)
111project.output.makefile.set_target_device(args.target_device)
112project.output.makefile.add_CXX_flag(
"-DGAMMA=1.4")
113project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)