5Entropy wave benchmark of the Euler equations
7Generates and builds one executable of the entropy wave benchmark
8(@ref benchmarks_exahype2_euler_smooth_setup) for one numerical scheme and
9one mesh width. Run the script once per mesh width, each time with a
10different output directory, and compare the outcomes with compute-errors.py
11(or let convergence-study.py do all of this).
34parser = argparse.ArgumentParser(
35 description=
"ExaHyPE 2 smooth convergence test (Euler entropy wave)"
39 choices=list(CFL_CONSTANTS.keys()),
41 help=
"Numerical scheme: Finite Volumes with explicit Euler (fv), the same with "
42 "optimistic time stepping (fv-optimistic), or fourth-order Finite Differences with "
43 "Runge-Kutta of order 1 to 4 (rk1fd4, ..., rk4fd4) (default: rk4fd4)",
47 choices=[
"sequential",
"fusion",
"producer-consumer",
"producer-consumer-fusion"],
49 help=
"Task graph compiler (default: fusion)",
54 help=
"C++ compiler to build the generated code with, e.g. clang++, g++ or icpx "
55 "(default: the one Peano was configured with)",
62 help=
"Number of parallel make jobs used to build; 0 or less uses all available cores (default: all cores)",
69 help=
"Number of threads of the generated executable (default: all available cores)",
74 help=
"Directory the code is generated and built in (default: .)",
80 help=
"Maximum grid cell size. 0.0075, 0.0025 and 0.00083 yield 27, 81 and 243 grid cells per axis (default: 0.0075)",
83 "--patch-size", type=int, default=9, help=
"Grid cells per patch and axis (default: 9)"
86 "--end-time", type=float, default=0.05, help=
"Simulated time (default: 0.05)"
92 help=
"Time between plots (default: the end time, i.e. the initial and the final state)",
98 help=
"Fixed time step size (rkNfd4 only). Without this argument, the time step size is adaptive",
103 help=
"Use periodic boundary conditions instead of Dirichlet conditions with the exact solution",
106 "--dimensions", type=int, default=2, choices=[2, 3], help=
"Dimension (default: 2)"
112 choices=[
"release",
"debug"],
113 help=
"Peano build flavour to link against (default: release)",
117 default=os.path.join(
118 os.path.dirname(os.path.abspath(__file__)),
"..",
"..",
"..",
".."
120 help=
"Configured and built Peano directory (default: the repository this script resides in)",
125 choices=[
"visualisation",
"text"],
126 help=
"Show the task graphs in a window or print them as text (default: text for release, visualisation for debug)",
129 "--no-clean", action=
"store_true", help=
"Do not run make clean before building"
132 "--no-build", action=
"store_true", help=
"Only generate the code, do not build it"
134args = parser.parse_args()
136is_finite_volume = args.scheme
in [
"fv",
"fv-optimistic"]
137if args.time_step_size
is not None and is_finite_volume:
138 parser.error(
"--time-step-size is only supported by the rkNfd4 schemes")
139if args.verbosity
is None:
140 args.verbosity =
"text" if args.build_mode ==
"release" else "visualisation"
141plot_interval = args.plot_interval
if args.plot_interval
is not None else args.end_time
144task_graph_compiler = {
145 "sequential": compilers.Sequential.translate,
146 "fusion": compilers.FuseSteps.translate,
147 "producer-consumer": compilers.CellTaskProducerConsumer.translate_with_sequential,
148 "producer-consumer-fusion": compilers.CellTaskProducerConsumer.translate_with_fusion,
153 namespace=[
"benchmarks",
"exahype2",
"euler",
"smooth_convergence_test"],
154 project_name=
"smooth-convergence-test",
155 directory=args.output_directory,
156 executable=
"smooth-convergence-test",
160solver.add_user_solver_includes(
170 constexpr double gamma = 1.4;
171 const double irho = 1.0 / Q[0];
172 double kineticEnergy = 0.0;
173 for (int d=0; d<Dimensions; d++) {
174 kineticEnergy += 0.5 * irho * Q[1+d] * Q[1+d];
176 const double p = (gamma - 1.0) * (Q[Dimensions+1] - kineticEnergy);
181 implementation=PRESSURE
183 const double velocity = Q[1+normal] * irho;
185 for (int d=0; d<Dimensions; d++) {
186 F[1+d] = velocity * Q[1+d];
189 F[Dimensions+1] = velocity * (Q[Dimensions+1] + p);
195 implementation=PRESSURE
197 const double c = std::sqrt(gamma * p * irho);
198 const double u = Q[1+normal] * irho;
199 lambdaMax[0] = std::max(std::abs(u + c), std::abs(u - c));
209 constexpr double gamma = 1.4;
210 constexpr double p = 1.0;
211 constexpr double u = 1.0;
212 constexpr double domainLeft = -0.1;
213 constexpr double domainWidth = 0.2;
214 const double rho = 1.0 + 0.2 * std::sin(2.0 * M_PI * (x(0) - u * t - domainLeft) / domainWidth);
217 for (int d=1; d<Dimensions; d++) {
220 Q[Dimensions+1] = p / (gamma - 1.0) + 0.5 * rho * u * u;
224 implementation=
" constexpr double t = 0.0;\n" + EXACT_SOLUTION
229 exahype2.api.DirichletBoundaryConditions(implementation=EXACT_SOLUTION)
232cfl_constant = CFL_CONSTANTS[args.scheme]
239 solver, args.patch_size, cfl_constant=cfl_constant
242 solver, volume_size=args.volume_size
248 first_plot_time_stamp=0.0,
249 time_in_between_plots=plot_interval,
250 plotter_precision=14,
255 patch_size=args.patch_size,
256 rk_order=
int(args.scheme[2]),
257 time_step_size=args.time_step_size,
258 cfl_constant=cfl_constant,
261 solver, volume_size=args.volume_size
265 first_plot_time_stamp=0.0,
266 time_in_between_plots=plot_interval,
267 plotter_precision=14,
269project.add_solver(solver)
271project.set_global_simulation_parameters(
272 dimensions=args.dimensions,
273 offset=[-0.1] * args.dimensions,
274 size=[0.2] * args.dimensions,
275 min_end_time=args.end_time,
276 max_end_time=args.end_time,
277 periodic_BC=[args.periodic] * 3,
279project.set_load_balancing(
280 "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates",
281 "new ::exahype2::LoadBalancingConfiguration()",
283project.compiler = task_graph_compiler
284if args.threads
is not None:
285 project.set_number_of_threads(args.threads)
287project.set_Peano4_installation(
289 peano4.api.output.CompileMode.RELEASE
290 if args.build_mode ==
"release"
291 else peano4.api.output.CompileMode.DEBUG,
293peano4_project = project.generate_Peano4_project(
294 verbosity=peano4.api.LoggerVerbosity.TEXT
295 if args.verbosity ==
"text"
296 else peano4.api.LoggerVerbosity.VISUALISATION
298if args.cxx
is not None:
299 peano4_project.output.makefile.set_CXX_compiler(args.cxx)
300peano4_project.generate()
302 peano4_project.build(
303 make_clean_first=
not args.no_clean,
304 number_of_parallel_builds=args.build_jobs,
The conservative flux F(Q) of a hyperbolic PDE.
Point-wise initial condition: given the physical position of a single degree of freedom,...
The maximum absolute eigenvalue of the flux Jacobian in a given direction, i.e.
Abstract base class for all ExaHyPE 2 solvers.
Plotting counterpart to RusanovWithExplicitEuler: maps the patch data of a Finite Volume scheme with ...
Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-...
Finite Volumes with a Rusanov Riemann solver and optimistic explicit Euler time stepping,...
Setup phase counterpart to RusanovWithExplicitEuler: sets the initial condition for a Finite Volume s...
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...
Plotting counterpart of the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2....
Setup phase of the fourth-order Finite Differences with Runge-Kutta time stepping (exahype2....
Compilers are simple functions.