6parser = exahype2.ArgumentParser(
7 "ExaHyPE 2 - Finite Volumes Dynamic AMR Testing Script"
14 number_of_snapshots=0,
16args = parser.parse_args()
18max_patch_size = 1.1 * 2.0 / (3.0**args.min_depth)
19max_h = max_patch_size / args.degrees_of_freedom
20min_h = 0.9 * max_h * 3.0 ** (-args.amr_levels)
22initial_conditions =
"""
23 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
27 constexpr double radius = 0.1;
30 tarch::la::Vector<DIMENSIONS, double> centre = {0.75, 1.0, 1.0};
32 tarch::la::Vector<DIMENSIONS, double> centre = {0.75, 1.0};
35 if (tarch::la::norm2(x - centre) < radius) {
36 Q[Shortcuts::rho] = 1.0;
40boundary_conditions =
"""
41 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
42 Qoutside[i] = Qinside[i];
46refinement_criterion =
"""
47 constexpr double radius = 0.1;
50 const tarch::la::Vector<DIMENSIONS, double> centre = {0.75, 1.0, 1.0};
52 const tarch::la::Vector<DIMENSIONS, double> centre = {0.75, 1.0};
55 if (tarch::la::equals(t, 0.0)) {
56 return (tarch::la::smallerEquals(tarch::la::norm2(x - centre), radius))
57 ? ::exahype2::RefinementCommand::Refine
58 : ::exahype2::RefinementCommand::Keep;
61 const double rho = Q[Shortcuts::rho];
63 return (tarch::la::greaterEquals(rho, 0.5) and tarch::la::smallerEquals(rho, 1.0))
64 ? ::exahype2::RefinementCommand::Refine
65 : ::exahype2::RefinementCommand::Erase;
68fv_solver = exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep(
70 patch_size=args.degrees_of_freedom,
71 unknowns={
"rho": 1,
"rhoU": args.dimensions},
72 auxiliary_variables=0,
75 time_step_relaxation=0.5,
78fv_solver.set_implementation(
79 initial_conditions=initial_conditions,
80 boundary_conditions=boundary_conditions,
81 refinement_criterion=refinement_criterion,
83 for (int i = 0; i < NumberOfUnknowns; i++) {
86 F[normal] = Q[normal];
88 max_eigenvalue=
"return 1.0;",
91project = exahype2.Project(
92 namespace=[
"tests",
"exahype2",
"fv"],
97project.add_solver(fv_solver)
99if args.number_of_snapshots <= 0:
100 time_in_between_plots = 0.0
102 time_in_between_plots = args.end_time / args.number_of_snapshots
103 project.set_output_path(args.output)
105project.set_global_simulation_parameters(
106 dimensions=args.dimensions,
107 size=[2.0, 2.0, 2.0][0 : args.dimensions],
108 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
109 min_end_time=args.end_time,
110 max_end_time=args.end_time,
111 first_plot_time_stamp=0.0,
112 time_in_between_plots=time_in_between_plots,
120project.set_load_balancer(
"new ::exahype2::LoadBalancingConfiguration")
121project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
122project = project.generate_Peano4_project(verbose=
False)
123project.output.makefile.set_target_device(args.target_device)
124project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)