tpt-sci-ocean
2-D shallow-water / primitive-equation ocean circulation for the
tpt-science pillar, built on
tpt-sci-cfd-core (pravash was audited and
rejected: GPL-3.0-only, same as CFD).
Features
ShallowWater— 2-D shallow-water model: free-surface heighth+ depth-averagedu/von a uniform grid. Integrates the continuity and momentum equations with gravity and Coriolisf(new,perturb_center,step,max_speed).Ocean3D— 3-D z-level ocean core: a stack ofnzlayers with hydrostatic pressure from a linear equation of stateρ = ρ0 − α·(T − T0) + β·(S − S0), prognostic temperatureT/ salinityStracers, constant-coefficient vertical mixing, and a hydrostaticstep_3d. The vertical velocity is not prognosed in hydrostatic mode. (new,density,hydrostatic_pressure,mix_vertical,step_3d).Ocean3D::nonhydrostatic_correct/step_3d_nonhydrostatic— optional non-hydrostatic pressure-correction: after the hydrostatic step a 3-D pressure Poisson equation∇²φ = (∇·u*)/dtis solved withtpt-sci-grid::sparse::conjugate_gradienton the structured grid and the provisional velocity is projected to be divergence-free.- Data assimilation (
data_assim):nudgerelaxes a state toward sparse observations;EnsembleKalmanFilteris a stochastic EnKF;Var3Dis a 3D-Var-lite analysis with a background-error covariance. - Reuses
tpt-sci-cfd-core::CollocatedGridandtpt-sci-grid(with thesparsefeature) for discretization, so the same grid/convergence machinery carries over. OceanError— construction and linear-algebra errors for invalid model parameters.
This is a reduced-order circulation primitive — not a full 3-D primitive-equation ocean GCM.
Example
use ShallowWater;
// 64×64 basin, gravity g = 9.81, Coriolis f = 1e-4.
let mut sw = new;
// Perturb the free surface; it should evolve without blowing up.
sw.perturb_center;
for _ in 0..10
assert!;
The shallow_water example (cargo run --example shallow_water -p tpt-sci-ocean)
seeds a gravity-wave bump and steps the basin forward. The ocean3d example
(cargo run --example ocean3d -p tpt-sci-ocean) tours the 3-D core, the
non-hydrostatic projection, and the data-assimilation schemes.
Scope (v1)
2-D shallow-water circulation (geostrophic balance, gravity waves) plus a 3-D z-level hydrostatic ocean core (density stratification, tracer transport, vertical mixing), an optional non-hydrostatic pressure-correction projection, and a nudging / EnKF / 3D-Var data-assimilation module. A full 3-D primitive-equation ocean GCM with sigma/terrain-following coordinates and a complete assimilation system remains out of scope for v1.
License
Licensed under either of MIT or Apache-2.0 at your option.