Peano
Loading...
Searching...
No Matches
11_tsunami Namespace Reference

Functions

 build_and_run (directory, init=InitPointWisely, with_logo=False, first_unknown="h", flux=Flux, max_eigenvalue=MaxEigenvalue, nonconservative_product=None)
 Generate, compile and run the tutorial setup within directory.
 
 plot_snapshots (directory, prefix, label="water height h", with_early=False)
 First unknown at the start, half way through and at the end.
 
 plot_sea_floor (directory, prefix)
 Sea floor b, which does not change over time.
 

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 
 PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))
 
str Flux
 
str MaxEigenvalue
 
str InitPointWisely
 
str InitPointWiselyWithLogo
 
str FluxEta
 
str MaxEigenvalueEta
 
str NonconservativeProductEta
 
str InitPointWiselyEta
 
 Bathymetry = os.path.join(Here, "..", "bathymetry")
 
str PatchFile = "solution-SWE.peano-patch-file"
 
 parser
 
 default
 
 help
 
 args = parser.parse_args()
 
 work_directory = args.work_directory or tempfile.mkdtemp(prefix="11_tsunami-")
 
 flat = os.path.join(work_directory, "flat")
 
 bathymetry = os.path.join(work_directory, "bathymetry")
 
 with_logo
 
 ncp = os.path.join(work_directory, "ncp")
 
 first_unknown
 
 flux
 
 max_eigenvalue
 
 nonconservative_product
 
 label
 
 with_early
 

Function Documentation

◆ build_and_run()

11_tsunami.build_and_run (   directory,
  init = InitPointWisely,
  with_logo = False,
  first_unknown = "h",
  flux = Flux,
  max_eigenvalue = MaxEigenvalue,
  nonconservative_product = None 
)

Generate, compile and run the tutorial setup within directory.

with_logo adds the depth map DurhamLogo from Bathymetry to the build. first_unknown is the name of the first unknown, i.e. h or eta.

Definition at line 120 of file 11_tsunami.py.

◆ plot_sea_floor()

11_tsunami.plot_sea_floor (   directory,
  prefix 
)

Sea floor b, which does not change over time.

Definition at line 220 of file 11_tsunami.py.

References tarch.plotter.api.notebook.plot_snapshot().

Here is the call graph for this function:

◆ plot_snapshots()

11_tsunami.plot_snapshots (   directory,
  prefix,
  label = "water height h",
  with_early = False 
)

First unknown at the start, half way through and at the end.

with_early adds the snapshot at a quarter of the simulated time.

Definition at line 190 of file 11_tsunami.py.

References tarch.plotter.api.notebook.plot_snapshot(), and tarch.plotter.api.notebook.read_snapshots().

Here is the call graph for this function:

Variable Documentation

◆ args

11_tsunami.args = parser.parse_args()

Definition at line 239 of file 11_tsunami.py.

◆ Bathymetry

11_tsunami.Bathymetry = os.path.join(Here, "..", "bathymetry")

Definition at line 115 of file 11_tsunami.py.

◆ bathymetry

11_tsunami.bathymetry = os.path.join(work_directory, "bathymetry")

Definition at line 247 of file 11_tsunami.py.

◆ default

11_tsunami.default

Definition at line 236 of file 11_tsunami.py.

◆ first_unknown

11_tsunami.first_unknown

Definition at line 257 of file 11_tsunami.py.

◆ flat

11_tsunami.flat = os.path.join(work_directory, "flat")

Definition at line 243 of file 11_tsunami.py.

◆ Flux

str 11_tsunami.Flux
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::h];
4 const double un = Q[Variables::hu + normal] / h;
5 F[Variables::h] = Q[Variables::hu + normal];
6 F[Variables::hu] = Q[Variables::hu] * un;
7 F[Variables::hv] = Q[Variables::hv] * un;
8 F[Variables::hu + normal] += 0.5 * g * h * h;
9"""

Definition at line 43 of file 11_tsunami.py.

◆ flux

11_tsunami.flux

Definition at line 258 of file 11_tsunami.py.

◆ FluxEta

str 11_tsunami.FluxEta
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::eta] - Q[Variables::b];
4 const double un = Q[Variables::hu + normal] / h;
5 F[Variables::eta] = Q[Variables::hu + normal];
6 F[Variables::hu] = Q[Variables::hu] * un;
7 F[Variables::hv] = Q[Variables::hv] * un;
8 F[Variables::hu + normal] += 0.5 * g * h * h;
9"""

Definition at line 78 of file 11_tsunami.py.

◆ help

11_tsunami.help

Definition at line 237 of file 11_tsunami.py.

◆ Here

11_tsunami.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 29 of file 11_tsunami.py.

◆ InitPointWisely

str 11_tsunami.InitPointWisely
Initial value:
1= """
2 Q[Variables::h] = 1.0 + 0.1 * std::exp(-100.0 * (x[0] * x[0] + x[1] * x[1]));
3 Q[Variables::hu] = 0.0;
4 Q[Variables::hv] = 0.0;
5 Q[Variables::b] = 0.0;
6"""

Definition at line 60 of file 11_tsunami.py.

◆ InitPointWiselyEta

str 11_tsunami.InitPointWiselyEta
Initial value:
1= """
2 const int column = std::clamp(static_cast<int>((x[0] + 1.0) / 2.0 * DurhamLogoSize), 0, DurhamLogoSize - 1);
3 const int row = std::clamp(static_cast<int>((1.0 - x[1]) / 2.0 * DurhamLogoSize), 0, DurhamLogoSize - 1);
4 const double depth = DurhamLogo[row][column] == '1' ? 4.0 : 1.0;
5
6 Q[Variables::eta] = 0.1 * std::exp(-100.0 * (x[0] * x[0] + x[1] * x[1]));
7 Q[Variables::hu] = 0.0;
8 Q[Variables::hv] = 0.0;
9 Q[Variables::b] = -depth;
10"""

Definition at line 104 of file 11_tsunami.py.

◆ InitPointWiselyWithLogo

11_tsunami.InitPointWiselyWithLogo
Initial value:
1= """
2 const int column = std::clamp(static_cast<int>((x[0] + 1.0) / 2.0 * DurhamLogoSize), 0, DurhamLogoSize - 1);
3 const int row = std::clamp(static_cast<int>((1.0 - x[1]) / 2.0 * DurhamLogoSize), 0, DurhamLogoSize - 1);
4 const double depth = DurhamLogo[row][column] == '1' ? 4.0 : 1.0;
5
6 Q[Variables::h] = depth + 0.1 * std::exp(-100.0 * (x[0] * x[0] + x[1] * x[1]));
7 Q[Variables::hu] = 0.0;
8 Q[Variables::hv] = 0.0;
9 Q[Variables::b] = -depth;
10"""

Definition at line 67 of file 11_tsunami.py.

◆ label

11_tsunami.label

Definition at line 263 of file 11_tsunami.py.

◆ max_eigenvalue

11_tsunami.max_eigenvalue

Definition at line 259 of file 11_tsunami.py.

◆ MaxEigenvalue

str 11_tsunami.MaxEigenvalue
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::h];
4 const double un = Q[Variables::hu + normal] / h;
5 lambdaMax[0] = std::abs(un) + std::sqrt(g * h);
6"""

Definition at line 53 of file 11_tsunami.py.

◆ MaxEigenvalueEta

str 11_tsunami.MaxEigenvalueEta
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::eta] - Q[Variables::b];
4 const double un = Q[Variables::hu + normal] / h;
5 lambdaMax[0] = std::abs(un) + std::sqrt(g * h);
6"""

Definition at line 88 of file 11_tsunami.py.

◆ ncp

11_tsunami.ncp = os.path.join(work_directory, "ncp")

Definition at line 252 of file 11_tsunami.py.

◆ nonconservative_product

11_tsunami.nonconservative_product

Definition at line 260 of file 11_tsunami.py.

◆ NonconservativeProductEta

str 11_tsunami.NonconservativeProductEta
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::eta] - Q[Variables::b];
4 BTimesDeltaQ[Variables::eta] = 0.0;
5 BTimesDeltaQ[Variables::hu] = 0.0;
6 BTimesDeltaQ[Variables::hv] = 0.0;
7 BTimesDeltaQ[Variables::hu + normal] = g * h * deltaQ[Variables::b];
8"""

Definition at line 95 of file 11_tsunami.py.

◆ parser

11_tsunami.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Create the PNGs of the tutorial 11_tsunami.ipynb"
3 )

Definition at line 231 of file 11_tsunami.py.

◆ PatchFile

str 11_tsunami.PatchFile = "solution-SWE.peano-patch-file"

Definition at line 117 of file 11_tsunami.py.

◆ PeanoRoot

11_tsunami.PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))

Definition at line 30 of file 11_tsunami.py.

◆ with_early

11_tsunami.with_early

Definition at line 263 of file 11_tsunami.py.

◆ with_logo

11_tsunami.with_logo

Definition at line 248 of file 11_tsunami.py.

◆ work_directory

11_tsunami.work_directory = args.work_directory or tempfile.mkdtemp(prefix="11_tsunami-")

Definition at line 241 of file 11_tsunami.py.