Coupled Ocean Model
The Ocean module wraps the entire velocity-and-tracer pipeline. It is the high-level entry point for time-stepping a Pelagos simulation.
OceanModel holds:
- the shared
ImmersedBoundaryGrid(the single source of grid geometry), - the Oceananigans
HydrostaticFreeSurfaceModelthat owns $T$ and $S$ and the prescribed velocityFields, - the pre-assembled sparse barotropic streamfunction solver, and
- the pressure
Field{Center, Center, Center}.
step_ocean! advances the model one timestep using the pipeline:
compute_pressure!— hydrostatic $p$ from $T,S$.solve_baroclinic!— frictional-geostrophic $u, v$ on the C-grid.- Barotropic correction — solve ψ at T-points, average to corners, derive divergence-free face transports, replace the FG depth-mean with the ψ-derived barotropic flow.
diagnose_w!— vertical velocity from the rigid-lid continuity constraint.Oceananigans.time_step!— advance $T$ and $S$.
The corner-ψ correction makes $w_{\text{top}}$ discretely zero to machine precision, so over one year of integration $T$ and $S$ drift only at the diffusive rate (no spurious source/sink from a non-zero rigid-lid residual).
Pelagos.Ocean.OceanModel — Type
OceanModelHolds all state for one timestep of the coupled velocity + tracer ocean model.
Fields:
grid: shared ImmersedBoundaryGrid (the single source of grid geometry)tracer_model: Oceananigans HydrostaticFreeSurfaceModel (owns T, S and their prescribed velocity fields u, v, w)bar_solver: pre-assembled sparse barotropic streamfunction solverp: hydrostatic pressure field (Center, Center, Center), bar
Pelagos.Ocean.build_ocean_model — Method
build_ocean_model(restart_dir; T_restore, S_restore, tau_T, tau_S)Build an OceanModel initialised from a CLIMBER-X restart directory. The grid is constructed from the restart file; initial T and S are loaded into the Oceananigans tracer fields via set!.
Pelagos.Ocean.step_ocean! — Method
step_ocean!(model, tau_x, tau_y, dt)Advance the ocean model by one timestep dt seconds.
tau_x, tau_y are (Nx, Ny) matrices of wind stress in N m⁻² on T-points.