Peano
Loading...
Searching...
No Matches
12_higher-order-solvers Namespace Reference

Functions

 exact_density (x, t)
 Density of the entropy wave advected with u=1 over [-0.1,0.1].
 
 solver_name (rk_order)
 Name of the solver: EulerFV for rk_order None, EulerFD4 otherwise.
 
 patch_file (directory, rk_order)
 
 build_and_run (rk_order, volume_size, end_time, time_in_between_plots, directory, peano_root)
 Generate, compile and run one setup within directory.
 
 snap (offset, size)
 Snap a patch's offset and size onto the regular mesh over the domain.
 
 errors (directory, rk_order)
 Return a list of (time stamp, max error, rms error) of the density per snapshot.
 
 density_along_x_axis (directory, rk_order, snapshot)
 Return time stamp plus grid cell centres and densities along y=0.
 
 label (rk_order)
 
 plot_convergence (runs)
 Max error at t=ConvergenceEndTime over the grid cells per axis.
 
 plot_profile (runs)
 Density along y=0 after one period on the coarsest mesh.
 
 plot_instability (runs)
 Max error over time for the explicit Euler time stepping vs the others.
 
 directory (name)
 

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 
 PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))
 
str Flux
 
str MaxEigenvalue
 
str InitPointWisely
 
float DomainOffset = -0.1
 
float DomainWidth = 0.2
 
list VolumeSizes = [(0.0075, 27), (0.0025, 81), (0.00083, 243)]
 
float ConvergenceEndTime = 0.05
 
float PeriodEndTime = 0.2
 
dict RungeKuttaColours = {1: "C3", 2: "C1", 3: "C2", 4: "C0"}
 
 parser
 
 default
 
 help
 
 nargs
 
 choices
 
 args = parser.parse_args()
 
 work_directory
 
dict runs = {}
 
 d
 

Function Documentation

◆ build_and_run()

12_higher-order-solvers.build_and_run (   rk_order,
  volume_size,
  end_time,
  time_in_between_plots,
  directory,
  peano_root 
)

Generate, compile and run one setup within directory.

Parameters
rk_orderint or None None selects the Finite Volumes of the tutorial 10_euler, an integer the fourth-order Finite Differences with the Runge-Kutta scheme of this order.
peano_rootstr Configured and built Peano directory the executable links against.

Definition at line 123 of file 12_higher-order-solvers.py.

References solver_name().

Here is the call graph for this function:

◆ density_along_x_axis()

12_higher-order-solvers.density_along_x_axis (   directory,
  rk_order,
  snapshot 
)

Return time stamp plus grid cell centres and densities along y=0.

Definition at line 245 of file 12_higher-order-solvers.py.

References tarch.plotter.api.notebook.read_patches(), tarch.plotter.api.notebook.read_snapshots(), and snap().

Referenced by plot_instability(), and plot_profile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ directory()

12_higher-order-solvers.directory (   name)

Definition at line 443 of file 12_higher-order-solvers.py.

◆ errors()

12_higher-order-solvers.errors (   directory,
  rk_order 
)

Return a list of (time stamp, max error, rms error) of the density per snapshot.

Definition at line 217 of file 12_higher-order-solvers.py.

References exact_density(), tarch.plotter.api.notebook.read_patches(), tarch.plotter.api.notebook.read_snapshots(), and snap().

Referenced by plot_convergence(), and plot_instability().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exact_density()

12_higher-order-solvers.exact_density (   x,
  t 
)

Density of the entropy wave advected with u=1 over [-0.1,0.1].

Definition at line 105 of file 12_higher-order-solvers.py.

Referenced by errors(), plot_instability(), and plot_profile().

Here is the caller graph for this function:

◆ label()

12_higher-order-solvers.label (   rk_order)

Definition at line 263 of file 12_higher-order-solvers.py.

Referenced by plot_convergence(), plot_instability(), and plot_profile().

Here is the caller graph for this function:

◆ patch_file()

12_higher-order-solvers.patch_file (   directory,
  rk_order 
)

Definition at line 117 of file 12_higher-order-solvers.py.

References solver_name().

Here is the call graph for this function:

◆ plot_convergence()

12_higher-order-solvers.plot_convergence (   runs)

Max error at t=ConvergenceEndTime over the grid cells per axis.

Parameters
runsdict Maps rk_order (None for Finite Volumes) onto a list of (grid cells per axis, directory).

Definition at line 269 of file 12_higher-order-solvers.py.

References errors(), and label().

Here is the call graph for this function:

◆ plot_instability()

12_higher-order-solvers.plot_instability (   runs)

Max error over time for the explicit Euler time stepping vs the others.

Parameters
runslist List of (rk_order, directory) on the same mesh.

Definition at line 372 of file 12_higher-order-solvers.py.

References density_along_x_axis(), errors(), exact_density(), and label().

Here is the call graph for this function:

◆ plot_profile()

12_higher-order-solvers.plot_profile (   runs)

Density along y=0 after one period on the coarsest mesh.

Parameters
runslist List of (rk_order, directory).

Definition at line 334 of file 12_higher-order-solvers.py.

References density_along_x_axis(), exact_density(), and label().

Here is the call graph for this function:

◆ snap()

12_higher-order-solvers.snap (   offset,
  size 
)

Snap a patch's offset and size onto the regular mesh over the domain.

The patch files hold offsets and sizes with seven significant digits only. Below an error of roughly 1e-7, this would dominate the error.

Definition at line 203 of file 12_higher-order-solvers.py.

Referenced by density_along_x_axis(), and errors().

Here is the caller graph for this function:

◆ solver_name()

12_higher-order-solvers.solver_name (   rk_order)

Name of the solver: EulerFV for rk_order None, EulerFD4 otherwise.

Definition at line 112 of file 12_higher-order-solvers.py.

Referenced by build_and_run(), and patch_file().

Here is the caller graph for this function:

Variable Documentation

◆ args

12_higher-order-solvers.args = parser.parse_args()

Definition at line 437 of file 12_higher-order-solvers.py.

◆ choices

12_higher-order-solvers.choices

Definition at line 434 of file 12_higher-order-solvers.py.

◆ ConvergenceEndTime

float 12_higher-order-solvers.ConvergenceEndTime = 0.05

Definition at line 98 of file 12_higher-order-solvers.py.

◆ d

12_higher-order-solvers.d
Initial value:
1= directory(
2 "convergence-{}-{}".format(
3 "fv" if rk_order is None else "rk{}".format(rk_order), cells
4 )
5 )

Definition at line 451 of file 12_higher-order-solvers.py.

◆ default

12_higher-order-solvers.default

Definition at line 422 of file 12_higher-order-solvers.py.

◆ DomainOffset

float 12_higher-order-solvers.DomainOffset = -0.1

Definition at line 91 of file 12_higher-order-solvers.py.

◆ DomainWidth

float 12_higher-order-solvers.DomainWidth = 0.2

Definition at line 92 of file 12_higher-order-solvers.py.

◆ Flux

str 12_higher-order-solvers.Flux
Initial value:
1= """
2 const double irho = 1.0 / Q[0];
3 constexpr double gamma = 1.4;
4 const double p = (gamma - 1.0) * (Q[3] - 0.5 * irho * (Q[1] * Q[1] + Q[2] * Q[2]));
5 switch (normal) {
6 case 0:
7 F[0] = Q[1];
8 F[1] = irho * Q[1] * Q[1] + p;
9 F[2] = irho * Q[1] * Q[2];
10 F[3] = irho * Q[1] * (Q[3] + p);
11 break;
12 case 1:
13 F[0] = Q[2];
14 F[1] = irho * Q[2] * Q[1];
15 F[2] = irho * Q[2] * Q[2] + p;
16 F[3] = irho * Q[2] * (Q[3] + p);
17 break;
18 }
19"""

Definition at line 51 of file 12_higher-order-solvers.py.

◆ help

12_higher-order-solvers.help

Definition at line 423 of file 12_higher-order-solvers.py.

◆ Here

12_higher-order-solvers.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 36 of file 12_higher-order-solvers.py.

◆ InitPointWisely

str 12_higher-order-solvers.InitPointWisely
Initial value:
1= """
2 constexpr double gamma = 1.4;
3 constexpr double p = 1.0;
4 constexpr double u = 1.0;
5 const double rho = 1.0 + 0.2 * std::sin(2.0 * M_PI * (x[0] + 0.1) / 0.2);
6 Q[0] = rho;
7 Q[1] = rho * u;
8 Q[2] = 0.0;
9 Q[3] = p / (gamma - 1) + 0.5 * rho * u * u;
10"""

Definition at line 80 of file 12_higher-order-solvers.py.

◆ MaxEigenvalue

str 12_higher-order-solvers.MaxEigenvalue
Initial value:
1= """
2 const double irho = 1.0 / Q[0];
3 constexpr double gamma = 1.4;
4 const double p = (gamma - 1.0) * (Q[3] - 0.5 * irho * (Q[1] * Q[1] + Q[2] * Q[2]));
5 const double c = std::sqrt(gamma * p * irho);
6 const double u = Q[1 + normal] * irho;
7 lambdaMax[0] = std::max(std::abs(u + c), std::abs(u - c));
8"""

Definition at line 71 of file 12_higher-order-solvers.py.

◆ nargs

12_higher-order-solvers.nargs

Definition at line 432 of file 12_higher-order-solvers.py.

◆ parser

12_higher-order-solvers.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Create the PNGs of the tutorial 12_higher-order-solvers.ipynb"
3 )

Definition at line 417 of file 12_higher-order-solvers.py.

◆ PeanoRoot

12_higher-order-solvers.PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))

Definition at line 37 of file 12_higher-order-solvers.py.

◆ PeriodEndTime

float 12_higher-order-solvers.PeriodEndTime = 0.2

Definition at line 99 of file 12_higher-order-solvers.py.

◆ RungeKuttaColours

dict 12_higher-order-solvers.RungeKuttaColours = {1: "C3", 2: "C1", 3: "C2", 4: "C0"}

Definition at line 102 of file 12_higher-order-solvers.py.

◆ runs

list 12_higher-order-solvers.runs = {}

Definition at line 447 of file 12_higher-order-solvers.py.

◆ VolumeSizes

list 12_higher-order-solvers.VolumeSizes = [(0.0075, 27), (0.0025, 81), (0.00083, 243)]

Definition at line 96 of file 12_higher-order-solvers.py.

◆ work_directory

12_higher-order-solvers.work_directory
Initial value:
1= args.work_directory or tempfile.mkdtemp(
2 prefix="12_higher-order-solvers-"
3 )

Definition at line 439 of file 12_higher-order-solvers.py.