9 offset=[-0.5, -0.5, -0.5]
13 periodic_BC = [
False,
False,
False]
50 if __name__ ==
"__main__":
51 parser = argparse.ArgumentParser(
52 description=
"ExaHyPE 2 - CCZ4 Finite Volume Benchmarking Script"
59 help=
"Determines maximum size of a single cell on each axis.",
66 help=
"Number of AMR grid levels on top of max. size of a cell.",
73 help=
"Number of finite volumes per axis (dimension) per patch.",
76 for k, v
in floatparams.items():
79 dest=
"CCZ4{}".format(k),
82 help=
"default: %(default)s",
84 for k, v
in intparams.items():
87 dest=
"CCZ4{}".format(k),
90 help=
"default: %(default)s",
93 args = parser.parse_args()
95 class CCZ4Solver(exahype2.solvers.fv.godunov.GlobalAdaptiveTimeStep):
97 self, name, patch_size, min_volume_h, max_volume_h, cfl, domain_r, KOSig
120 number_of_unknowns = sum(unknowns.values())
123 #include "../../../../applications/exahype2/ccz4/CCZ4Kernels.h"
127 patch_size=patch_size,
128 unknowns=number_of_unknowns,
129 auxiliary_variables=0,
130 min_volume_h=min_volume_h,
131 max_volume_h=max_volume_h,
132 time_step_relaxation=cfl,
138 self.set_implementation(
139 boundary_conditions=exahype2.solvers.PDETerms.User_Defined_Implementation,
140 refinement_criterion=exahype2.solvers.PDETerms.User_Defined_Implementation,
141 flux=exahype2.solvers.PDETerms.None_Implementation,
143 double gradQSerialised[NumberOfUnknowns * 3];
144 for (int i = 0; i < NumberOfUnknowns; i++) {
145 gradQSerialised[i + 0 * NumberOfUnknowns] = 0.0;
146 gradQSerialised[i + 1 * NumberOfUnknowns] = 0.0;
147 gradQSerialised[i + 2 * NumberOfUnknowns] = 0.0;
148 gradQSerialised[i + normal * NumberOfUnknowns] = deltaQ[i];
150 applications::exahype2::ccz4::ncp(
168 std::memset(S, 0, NumberOfUnknowns * sizeof(double));
169 applications::exahype2::ccz4::source(
189 const double np = 1.0;
190 #if defined(CCZ4EINSTEIN)
191 const double qmin = std::min({Q[0], Q[3], Q[5]});
192 const double alpha = std::max({1.0, Q[16]}) * std::max({1.0, pow(Q[54], 1.0 / np)}) / std::sqrt(qmin);
194 const double alpha = 1.0;
197 constexpr double sqrtwo = 1.4142135623730951;
198 // NOTE parameters are stored in abstract superclass
199 const double tempA = alpha * std::max({sqrtwo, CCZ4e, CCZ4ds, CCZ4GLMc / alpha, CCZ4GLMd / alpha});
200 const double tempB = Q[17 + normal]; // DOT_PRODUCT(Q(18:20),nv(:))
201 double tem = std::max({1.0, std::abs(-tempA - tempB), std::abs(tempA - tempB)});
209 for (int i = 0; i < {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}}; i++) {
210 applications::exahype2::ccz4::enforceCCZ4constraints(QOut + index);
211 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
215 project = exahype2.Project(
216 namespace=[
"benchmarks",
"exahype2",
"ccz4"],
217 project_name=
"GaugeWave",
219 executable=
"GaugeWaveFV",
222 max_h = (1.1 *
min(size) / (3.0**args.min_depth))
223 min_h = max_h * 3.0 ** (-args.amr_levels)
234 for k, v
in intparams.items():
235 intparams.update({k: eval(
"args.CCZ4{}".format(k))})
236 for k, v
in floatparams.items():
237 floatparams.update({k: eval(
"args.CCZ4{}".format(k))})
240 for k, v
in floatparams.items():
241 solverconstants +=
"static constexpr double {} = {};\n".format(
242 "CCZ4{}".format(k), v
244 for k, v
in intparams.items():
245 solverconstants +=
"static constexpr int {} = {};\n".format(
246 "CCZ4{}".format(k), v
248 my_solver.add_solver_constants(solverconstants)
249 my_solver.add_user_solver_includes(
251 #include "CCZ4Kernels.h"
256 project.add_solver(my_solver)
257 project.set_global_simulation_parameters(
261 min_end_time=end_time,
262 max_end_time=end_time,
263 first_plot_time_stamp=0.0,
264 time_in_between_plots=plot_interval,
265 periodic_BC=periodic_BC,
269 if plot_interval > 0.0:
270 project.set_output_path(
"solutions")
271 project.set_Peano4_installation(
"../../../..", peano4.output.CompileMode.Release)
272 project.set_load_balancer(
"new ::exahype2::LoadBalancingConfiguration")
273 peano4_project = project.generate_Peano4_project(verbose=
False)
274 peano4_project.output.makefile.add_header_search_path(
275 "../../../../applications/exahype2/ccz4/"
278 peano4_project.output.makefile.add_CXX_flag(
"-DCCZ4EINSTEIN")
280 peano4_project.output.makefile.add_cpp_file(
"CCZ4.cpp")
281 peano4_project.output.makefile.add_cpp_file(
282 "../../../../applications/exahype2/ccz4/CCZ4Kernels.cpp"
285 peano4_project.generate(throw_away_data_after_generation=
True)
286 peano4_project.build(make_clean_first=
True)
postprocess_updated_patch
def __init__(self, name, patch_size, min_volume_h, max_volume_h, cfl, domain_r, KOSig)
static double min(double const x, double const y)