5Convergence test of the fourth-order Finite Differences with Runge-Kutta
7Generates and builds one executable of the entropy wave benchmark
8(@ref benchmarks_exahype2_euler_smooth_fd4) for one mesh width. Run the
9script once per mesh width, each time with a different output directory, and
10compare the outcomes with compute-errors.py.
20parser = argparse.ArgumentParser(
21 description=
"Euler entropy wave with exahype2.api.rkfd4 (fourth-order Finite Differences)"
26 help=
"Directory the code is generated and built in (default: .)",
32 help=
"Maximum grid cell size. 0.0075, 0.0025 and 0.00083 yield 27, 81 and 243 grid cells per axis (default: 0.0075)",
38 help=
"Order of the Runge-Kutta scheme, 1 to 4 (default: 4)",
41 "--end-time", type=float, default=0.05, help=
"Simulated time (default: 0.05)"
47 help=
"Fixed time step size. Without this argument, the time step size is adaptive",
53 help=
"CFL constant for adaptive time step sizes (default: 0.5)",
58 help=
"Use periodic boundary conditions instead of Dirichlet conditions with the exact solution",
61 "--dimensions", type=int, default=2, choices=[2, 3], help=
"Dimension (default: 2)"
66 choices=[
"release",
"debug"],
67 help=
"Peano build flavour to link against (default: release)",
72 os.path.dirname(os.path.abspath(__file__)),
"..",
"..",
"..",
".."
74 help=
"Configured and built Peano directory (default: the repository this script resides in)",
78 default=
"visualisation",
79 choices=[
"visualisation",
"text"],
80 help=
"Show the task graphs in a window or print them as text (default: visualisation)",
82args = parser.parse_args()
86 namespace=[
"benchmarks",
"exahype2",
"euler",
"smooth_convergence_test_fd4"],
87 project_name=
"smooth-convergence-test-fd4",
88 directory=args.output_directory,
89 executable=
"smooth-convergence-test-fd4",
93 "EulerFD4Smooth", {
"rho": 1,
"j": args.dimensions,
"E": 1}
95solver.add_user_solver_includes(
105 constexpr double gamma = 1.4;
106 const double irho = 1.0 / Q[0];
107 double kineticEnergy = 0.0;
108 for (int d=0; d<Dimensions; d++) {
109 kineticEnergy += 0.5 * irho * Q[1+d] * Q[1+d];
111 const double p = (gamma - 1.0) * (Q[Dimensions+1] - kineticEnergy);
116 implementation=PRESSURE
118 const double velocity = Q[1+normal] * irho;
120 for (int d=0; d<Dimensions; d++) {
121 F[1+d] = velocity * Q[1+d];
124 F[Dimensions+1] = velocity * (Q[Dimensions+1] + p);
130 implementation=PRESSURE
132 const double c = std::sqrt(gamma * p * irho);
133 const double u = Q[1+normal] * irho;
134 lambdaMax[0] = std::max(std::abs(u + c), std::abs(u - c));
144 constexpr double gamma = 1.4;
145 constexpr double p = 1.0;
146 constexpr double u = 1.0;
147 constexpr double domainLeft = -0.1;
148 constexpr double domainWidth = 0.2;
149 const double rho = 1.0 + 0.2 * std::sin(2.0 * M_PI * (x(0) - u * t - domainLeft) / domainWidth);
152 for (int d=1; d<Dimensions; d++) {
155 Q[Dimensions+1] = p / (gamma - 1.0) + 0.5 * rho * u * u;
159 implementation=
" constexpr double t = 0.0;\n" + EXACT_SOLUTION
164 exahype2.api.DirichletBoundaryConditions(implementation=EXACT_SOLUTION)
170 rk_order=args.rk_order,
171 time_step_size=args.time_step_size,
172 cfl_constant=args.cfl_constant,
175 solver, volume_size=args.volume_size
181 first_plot_time_stamp=0.0,
182 time_in_between_plots=args.end_time,
183 plotter_precision=14,
185project.add_solver(solver)
187project.set_global_simulation_parameters(
188 dimensions=args.dimensions,
189 offset=[-0.1] * args.dimensions,
190 size=[0.2] * args.dimensions,
191 min_end_time=args.end_time,
192 max_end_time=args.end_time,
193 periodic_BC=[args.periodic] * 3,
195project.set_load_balancing(
196 "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates",
197 "new ::exahype2::LoadBalancingConfiguration()",
200 peano4.api.taskgraph.compiler.CellTaskProducerConsumer.translate_with_fusion
203project.set_Peano4_installation(
205 peano4.api.output.CompileMode.RELEASE
206 if args.build_mode ==
"release"
207 else peano4.api.output.CompileMode.DEBUG,
209peano4_project = project.generate_Peano4_project(
210 verbosity=peano4.api.LoggerVerbosity.TEXT
211 if args.verbosity ==
"text"
212 else peano4.api.LoggerVerbosity.VISUALISATION
214peano4_project.generate()
215peano4_project.build(make_clean_first=
True)
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.
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....