Expand description
§tpt-sci-ocean
Ocean circulation modelling for the tpt-science pillar, built on
tpt_sci_cfd_core. It provides:
- A 2-D shallow-water model (
ShallowWater) — the primitive prototype for large-scale circulation: free-surface heighthplus depth-averaged velocitiesu,v, with gravity and Coriolisf. See theexamples/tour (cargo run --example shallow_water -p tpt-sci-ocean). - A 3-D z-level ocean core (
Ocean3D) — a stack ofnzlayers with hydrostatic pressure from a linear equation of state, prognostic temperature/salinity tracers, constant-coefficient vertical mixing, and an optional non-hydrostatic pressure-correction (3-D Poisson projection solved with conjugate gradients on a structured grid). Seecargo run --example ocean3d -p tpt-sci-ocean. - A data assimilation module (
nudge,EnsembleKalmanFilter,Var3D) — nudging plus a stochastic EnKF and a 3D-Var-lite analysis.
This crate is reduced-order relative to a full 3-D primitive-equation ocean GCM, but closes out the hydrostatic, non-hydrostatic, and assimilation scope items.
§Example
use tpt_sci_ocean::ShallowWater;
// 64×64 basin, gravity g = 9.81, Coriolis f = 1e-4.
let mut sw = ShallowWater::new(64, 64, 1.0, 1.0, 9.81, 1e-4, 0.001);
// Perturb the free surface; it should evolve without blowing up.
sw.perturb_center(1.0);
for _ in 0..10 {
sw.step(0.001);
}
assert!(sw.max_speed().is_finite());Structs§
- Enkf
Result - Result of an
EnsembleKalmanFilter::analyzestep. - Ensemble
Kalman Filter - A stochastic ensemble Kalman filter (EnKF).
- Observation
- A single sparse observation: a measured
valueat flatindex, with an optionalweight(default 1) scaling how strongly it nudges the state. - Ocean3D
- A 3-D z-level ocean model on a uniform tensor-product grid.
- Shallow
Water - A 2-D shallow-water ocean model on a uniform grid.
- Var3D
- A 3D-Var-lite analysis with a diagonal background-error covariance.
Enums§
- Ocean
Error - Errors raised by the ocean model.
Functions§
- nudge
- Relax
statetoward the observations: for eachObservation,state[index] ⟵ state[index] + coeff·dt·weight·(value − state[index]).