Tsunami Project Lab
Loading...
Searching...
No Matches
tsunami_lab Namespace Reference

Namespaces

namespace  io
 
namespace  patches
 
namespace  setups
 
namespace  solvers
 

Typedefs

typedef std::size_t t_idx
 integral type for cell-ids, pointer arithmetic, etc.
 
typedef float t_real
 floating point type
 

Variables

t_real constexpr g = 9.80665
 gravity constant (9.80665 m/s^2)
 
t_real constexpr gSqrt = 3.131557121
 square root of gravity
 

Detailed Description

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

Constants / typedefs used throughout the code.

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

IO-routines for writing a snapshot as Comma Separated Values (CSV).

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

IO-routines for reading/writing simulation data as netCDF files (assignment 5: large data input/output).

Output side: the constructor creates one COARDS-conforming netCDF file, defines the (time, y, x) dimension layout with time as the unlimited record dimension, writes the coordinate variables and the (time-independent) bathymetry once. Each call to writeTimeStep() appends one record (height, momentum_x, momentum_y at the requested simulation time). The destructor closes the file.

Input side (added in 5.2): reads the (x, y, z) variables of an external netCDF file (e.g. GEBCO bathymetry, earthquake displacement) and exposes the values as a flat array plus a nearest-neighbor lookup.

Ghost cells are not written: callers pass the interior origin and a row stride; the writer copies the interior nx * ny cells into a contiguous slab for each record.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Time-series sampling at user-specified observation points (assignment 4.2).

A station has a name and a world-space (x, y) coordinate. The Stations class parses an XML config (one config per simulation), pins each station to its containing cell, and writes one CSV file per station as the simulation advances. All stations share a common time-based output frequency in seconds.

See Stations-Guide.md in the project root for the XML schema and CLI usage.

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

Base class of the wave propagation patches.

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

One-dimensional wave propagation patch.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Two-dimensional wave propagation patch (assignment 4.1).

Implements the unsplit donor-cell method (LeVeque, FVM 2002, ch. 21 — multidimensional systems, donor-cell upwind without transverse correction) for the 2d shallow water equations. In a single update step the cell Q_{i,j}^n receives contributions from all four surrounding edges:

Q_{i,j}^{n+1} = Q_{i,j}^n

  • (Δt/Δx) (A^+ ΔQ_{i-1/2,j} + A^- ΔQ_{i+1/2,j})
  • (Δt/Δy) (B^+ ΔQ_{i,j-1/2} + B^- ΔQ_{i,j+1/2}).

Each edge re-uses the 1d f-wave Riemann solver T:

  • x-edges feed (h, hu, b) → updates h and hu
  • y-edges feed (h, hv, b) → updates h and hv (The tangential momentum component is not touched by the 1d solver.)

Memory layout (row-major): total cells = (m_nx + 2) * (m_ny + 2) stride = m_nx + 2 (= y-direction stride; x is stride-1) ghost rows/columns occupy i ∈ {0, m_nx+1}, j ∈ {0, m_ny+1} interior cell (ix, iy) ∈ [0, m_nx-1] × [0, m_ny-1] sits at memory index (ix+1) + (iy+1)*stride.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Two-dimensional artificial tsunami setup (assignment 5.2 task 1).

The setup mimics the structure of an earthquake-driven displacement scenario without reading any external data: bathymetry is a flat pool at b_in = -100 m and a hard-coded displacement d(x, y) is applied within a 1 km x 1 km square centred on the domain.

Displacement (relative to the centre x_c, y_c): x' = x - x_c, y' = y - y_c d(x, y) = 5 * f(x') * g(y') for |x'| <= 500 and |y'| <= 500 d(x, y) = 0 otherwise f(x') = sin( (x'/500 + 1) * pi ) g(y') = -(y'/500)^2 + 1

Initial values (with delta = 20 m, matching the 1d tsunami setup): h = max(-b_in, delta) = 100 m everywhere (b_in = -100 < 0) hu = hv = 0 b = min(b_in, -delta) + d = -100 + d

The course spec uses the domain [-5000, +5000]^2 with the centre at the origin; main.cpp instantiates this setup on the equivalent [0, 10000]^2 domain with the centre at (5000, 5000).

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Restart setup driven by a netCDF checkpoint (assignment 7.1 task 2).

Loads a checkpoint file written by io::NetCdf::writeCheckpoint and exposes its (single, latest) state through the standard Setup interface so main.cpp can initialise the wave-propagation patch from it exactly like any other setup. The four fields are sampled with nearest-neighbor lookup on the recovered cell-centre grid.

Beyond the Setup interface the class exposes the scalar restart metadata (simulation time, time-step counter, constant dt) and the recovered geometry (cell size, interior extents) so the caller can continue the time loop where the interrupted run left off.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Two-dimensional circular dam break setup (assignment 4.1).

Initial condition (with the dam centred at (m_centerX, m_centerY)): [h, hu, hv]^T = [m_heightInside, 0, 0]^T if r < m_damRadius [h, hu, hv]^T = [m_heightOutside, 0, 0]^T otherwise with r = sqrt((x - m_centerX)^2 + (y - m_centerY)^2).

Bathymetry is identically zero (flat bottom). The course spec uses the domain [-50, 50]^2 with the dam at the origin, hIn = 10, hOut = 5, radius = 10; main.cpp instantiates this setup on the equivalent 100 x 100 m domain with the centre at (50, 50).

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Two-dimensional circular dam break with a submarine Gaussian bump (assignment 4.1, "2D Bathymetry Support" — extension of the plain circular dam break).

Initial condition matches the plain circular dam break in surface elevation η = h + b: η(x, y) = m_heightInside if r_dam < m_damRadius = m_heightOutside otherwise

Bathymetry is a Gaussian bump centred OBSTACLE_OFFSET_X / _Y away from the dam centre: b(x, y) = OBSTACLE_PEAK · exp(-r_obs² / (2 σ²))

Water height is then h = η - b, which keeps the surface flat outside the dam (lake-at-rest) regardless of the bump. The peak stays well below m_heightOutside so no cell becomes dry.

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

One-dimensional dam break problem.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the Rare-Rare Scenario in 1d

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the reservoir-village scenario

Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

Simulation setup.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the Shock-Shock scenario in 1d.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the supercritical flow scenario.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the subcritical flow scenario.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Declaration of the 1-dimensional tsunami event.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Two-dimensional tsunami event setup driven by netCDF input (assignment 5.2 task 3).

Loads two netCDF files at construction:

  • i_bathyPath: background bathymetry b_in(x, y), expected to cover the entire simulation domain.
  • i_displPath: earthquake displacement d(x, y); typically smaller than the simulation domain, treated as zero outside the file's bounding box.

Initial values follow the spec (5.2), with delta = 20 m matching the wet/dry tolerance used by TsunamiEvent1d: h = max(-b_in, delta) if b_in < 0, else 0 hu = hv = 0 b = min(b_in, -delta) + d if b_in < 0 b = max(b_in, delta) + d else

Sampling outside the file extents uses nearest-neighbor clamping for the bathymetry (per spec the simulation domain matches the bathy grid) and a strict zero outside the displacement bbox.

Coordinate convention: the setup operates in 0-based simulation coordinates [0, domainLengthX] x [0, domainLengthY] (consistent with the other setups in the codebase). The bathy file may live in any frame (e.g. centred on the origin); on construction the setup auto-detects the file's lower-left corner and shifts every query by it before sampling. domainLengthX/Y() expose the corresponding extents so main.cpp can compute the cell width.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

F-wave Riemann solver for the one-dimensional shallow water equations.

Unlike the Roe solver, the f-wave solver decomposes the jump in fluxes (Δf = f(q_r) - f(q_l)) rather than the jump in quantities. The resulting waves Z_p = α_p · r_p are used directly as net-updates without additional scaling by the wave speeds.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Unit tests for the f-wave Riemann solver.

Tests cover:

  1. Eigenvalue computation for given input states.
  2. Eigencoefficient computation (flux jump decomposition).
  3. Steady-state: zero net-updates when q_l == q_r.
  4. Dam-break scenario with symmetric setup (hu = 0).
  5. Supersonic problems where one net-update is zero.
Author
Alexander Breuer (alex.breuer AT uni-jena.de)

DESCRIPTION

Roe Riemann solver for the one-dimensional shallow water equations.

Author
Moritz Arnhold, Moritz Martin

DESCRIPTION

Base class for generic usage of solvers

Typedef Documentation

◆ t_idx

typedef std::size_t tsunami_lab::t_idx

integral type for cell-ids, pointer arithmetic, etc.

◆ t_real

typedef float tsunami_lab::t_real

floating point type

Variable Documentation

◆ g

t_real constexpr tsunami_lab::g = 9.80665
constexpr

gravity constant (9.80665 m/s^2)

◆ gSqrt

t_real constexpr tsunami_lab::gSqrt = 3.131557121
constexpr

square root of gravity