Peano
Loading...
Searching...
No Matches
45_coupling Namespace Reference

Functions

 build_and_run (directory)
 Generate, compile and run the coupled setup within directory.
 read_field (file_name, snapshot, unknown=0)
 One unknown of one snapshot as array field[y,x] over the whole domain.
 read_time_series (file_name, unknown=0)
 Time stamps and an array series[snapshot,y,x] of one unknown.
 arrival_times (times, series, threshold)
 First time at which the surface elevation exceeds the threshold.
 plot_initial_conditions (first_file, second_file, prefix)
 plot_arrival_difference (first_file, second_file, prefix, threshold=0.002)

Variables

 Here = os.path.dirname(os.path.abspath(__file__))
 PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))
str Flux
str MaxEigenvalue
str NonconservativeProduct
str InitialSeaFloor
str InitialWater
 Bathymetry = os.path.join(Here, "..", "bathymetry")
float CentreOfFirstTsunami = 0.0
float CentreOfSecondTsunami = 0.1
 parser
 default
 help
 args = parser.parse_args()
 work_directory = args.work_directory or tempfile.mkdtemp(prefix="45_coupling-")
 first_file = os.path.join(work_directory, "solution-TsunamiA.peano-patch-file")
 second_file = os.path.join(work_directory, "solution-TsunamiB.peano-patch-file")

Function Documentation

◆ arrival_times()

45_coupling.arrival_times ( times,
series,
threshold )

First time at which the surface elevation exceeds the threshold.

The time is interpolated linearly between the two snapshots which enclose the crossing. Volumes which the wave never reaches hold NaN.

Definition at line 173 of file 45_coupling.py.

Referenced by plot_arrival_difference().

Here is the caller graph for this function:

◆ build_and_run()

45_coupling.build_and_run ( directory)

Generate, compile and run the coupled setup within directory.

Definition at line 85 of file 45_coupling.py.

◆ plot_arrival_difference()

45_coupling.plot_arrival_difference ( first_file,
second_file,
prefix,
threshold = 0.002 )

Definition at line 205 of file 45_coupling.py.

References arrival_times(), and read_time_series().

Here is the call graph for this function:

◆ plot_initial_conditions()

45_coupling.plot_initial_conditions ( first_file,
second_file,
prefix )

Definition at line 192 of file 45_coupling.py.

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

Here is the call graph for this function:

◆ read_field()

45_coupling.read_field ( file_name,
snapshot,
unknown = 0 )

One unknown of one snapshot as array field[y,x] over the whole domain.

Definition at line 146 of file 45_coupling.py.

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

Referenced by read_time_series().

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

◆ read_time_series()

45_coupling.read_time_series ( file_name,
unknown = 0 )

Time stamps and an array series[snapshot,y,x] of one unknown.

Definition at line 165 of file 45_coupling.py.

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

Referenced by plot_arrival_difference().

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

Variable Documentation

◆ args

45_coupling.args = parser.parse_args()

Definition at line 238 of file 45_coupling.py.

◆ Bathymetry

45_coupling.Bathymetry = os.path.join(Here, "..", "bathymetry")

Definition at line 78 of file 45_coupling.py.

◆ CentreOfFirstTsunami

float 45_coupling.CentreOfFirstTsunami = 0.0

Definition at line 81 of file 45_coupling.py.

◆ CentreOfSecondTsunami

float 45_coupling.CentreOfSecondTsunami = 0.1

Definition at line 82 of file 45_coupling.py.

◆ default

45_coupling.default

Definition at line 235 of file 45_coupling.py.

◆ first_file

45_coupling.first_file = os.path.join(work_directory, "solution-TsunamiA.peano-patch-file")

Definition at line 243 of file 45_coupling.py.

◆ Flux

str 45_coupling.Flux
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::eta] - bathymetry[Bathymetry::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 39 of file 45_coupling.py.

◆ help

45_coupling.help

Definition at line 236 of file 45_coupling.py.

◆ Here

45_coupling.Here = os.path.dirname(os.path.abspath(__file__))

Definition at line 25 of file 45_coupling.py.

◆ InitialSeaFloor

str 45_coupling.InitialSeaFloor
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 bathymetry[Bathymetry::b] = DurhamLogo[row][column] == '1' ? -4.0 : -1.0;
5"""

Definition at line 65 of file 45_coupling.py.

◆ InitialWater

str 45_coupling.InitialWater
Initial value:
1= """
2 const double dx = x[0] - {centre};
3 Q[Variables::eta] = 0.1 * std::exp(-100.0 * (dx * dx + x[1] * x[1]));
4 Q[Variables::hu] = 0.0;
5 Q[Variables::hv] = 0.0;
6"""

Definition at line 71 of file 45_coupling.py.

◆ MaxEigenvalue

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

Definition at line 49 of file 45_coupling.py.

◆ NonconservativeProduct

str 45_coupling.NonconservativeProduct
Initial value:
1= """
2 constexpr double g = 9.81;
3 const double h = Q[Variables::eta] - bathymetry[Bathymetry::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 * deltaBathymetry[Bathymetry::b];
8"""

Definition at line 56 of file 45_coupling.py.

◆ parser

45_coupling.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Create the PNGs of the tutorial 45_coupling-sharing-auxiliary-variables.ipynb"
3 )

Definition at line 230 of file 45_coupling.py.

◆ PeanoRoot

45_coupling.PeanoRoot = os.path.abspath(os.path.join(Here, "..", "..", ".."))

Definition at line 26 of file 45_coupling.py.

◆ second_file

45_coupling.second_file = os.path.join(work_directory, "solution-TsunamiB.peano-patch-file")

Definition at line 244 of file 45_coupling.py.

◆ work_directory

45_coupling.work_directory = args.work_directory or tempfile.mkdtemp(prefix="45_coupling-")

Definition at line 240 of file 45_coupling.py.