6parser = exahype2.ArgumentParser(
7 "ExaHyPE 2 - Finite Volumes Dynamic AMR Testing Script"
15args = parser.parse_args()
17max_patch_size = 1.1 * 10.0 / (3.0**args.min_depth)
18max_h = max_patch_size / args.degrees_of_freedom
19min_h = 0.9 * max_h * 3.0 ** (-args.amr_levels)
21initial_conditions =
"""
22 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
27boundary_conditions =
"""
28 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
29 Qoutside[i] = Qinside[i];
33refinement_criterion =
"""
34 auto result = ::exahype2::RefinementCommand::Keep;
37 tarch::la::Vector<DIMENSIONS, double> centre0 = {2.0, 5.0, 5.0};
38 tarch::la::Vector<DIMENSIONS, double> centre1 = {8.0, 5.0, 5.0};
39 constexpr double maxRadius = 7.5;
41 tarch::la::Vector<DIMENSIONS, double> centre0 = {2.0, 5.0};
42 tarch::la::Vector<DIMENSIONS, double> centre1 = {8.0, 5.0};
43 constexpr double maxRadius = 5.0;
46 constexpr double startRadius = MaxAdmissibleVolumeH;
47 constexpr double growthRate = 0.25; // radius = startRadius + growthRate*t
48 constexpr double bandWidth = 0.10;
50 const double frontRadius = std::min(maxRadius, startRadius + growthRate * t);
51 const double r0 = tarch::la::norm2(x - centre0);
52 const double r1 = tarch::la::norm2(x - centre1);
54 auto command0 = ::exahype2::RefinementCommand::Keep;
55 auto command1 = ::exahype2::RefinementCommand::Keep;
57 if (tarch::la::equals(t, 0.0)) {
58 if (r0 < startRadius) command0 = ::exahype2::RefinementCommand::Refine;
59 if (r1 < startRadius) command1 = ::exahype2::RefinementCommand::Refine;
61 const double innerEraseRadius = std::max(0.0, frontRadius - bandWidth);
63 if (r0 >= innerEraseRadius and r0 <= frontRadius) {
64 command0 = ::exahype2::RefinementCommand::Refine;
65 } else if (r0 < innerEraseRadius) {
66 command0 = ::exahype2::RefinementCommand::Erase;
69 if (r1 >= innerEraseRadius and r1 <= frontRadius) {
70 command1 = ::exahype2::RefinementCommand::Refine;
71 } else if (r1 < innerEraseRadius) {
72 command1 = ::exahype2::RefinementCommand::Erase;
76 if (command0 == ::exahype2::RefinementCommand::Refine or command1 == ::exahype2::RefinementCommand::Refine) {
77 result = ::exahype2::RefinementCommand::Refine;
78 } else if (command0 == ::exahype2::RefinementCommand::Erase or command1 == ::exahype2::RefinementCommand::Erase) {
79 result = ::exahype2::RefinementCommand::Erase;
81 result = ::exahype2::RefinementCommand::Keep;
87fv_solver = exahype2.solvers.fv.godunov.GlobalFixedTimeStep(
89 patch_size=args.degrees_of_freedom,
91 auxiliary_variables=0,
94 normalised_time_step_size=0.01,
97fv_solver.set_implementation(
98 initial_conditions=initial_conditions,
99 boundary_conditions=boundary_conditions,
100 refinement_criterion=refinement_criterion,
102 for (int i = 0; i < NumberOfUnknowns; i++) {
106 max_eigenvalue=
"return 1.0;",
109project = exahype2.Project(
110 namespace=[
"tests",
"exahype2",
"fv"],
113 executable=
"ExaHyPE",
115project.add_solver(fv_solver)
117if args.number_of_snapshots <= 0:
118 time_in_between_plots = 0.0
120 time_in_between_plots = args.end_time / args.number_of_snapshots
121 project.set_output_path(args.output)
123project.set_global_simulation_parameters(
124 dimensions=args.dimensions,
125 size=[10.0, 10.0, 10.0][0 : args.dimensions],
126 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
127 min_end_time=args.end_time,
128 max_end_time=args.end_time,
129 first_plot_time_stamp=0.0,
130 time_in_between_plots=time_in_between_plots,
138project.set_load_balancer(
"new ::exahype2::LoadBalancingConfiguration")
139project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
140project = project.generate_Peano4_project(verbose=
False)
141project.output.makefile.set_target_device(args.target_device)
142project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)