Governing Equations
This page describes the fundamental equations solved by NeuralPOM, a neural differentiable implementation of the Princeton Ocean Model (POM). The model solves the three-dimensional primitive equations under the Boussinesq and hydrostatic approximations on a terrain-following sigma vertical coordinate system.
Boussinesq Approximation
The Boussinesq approximation simplifies the Navier-Stokes equations by assuming that density variations are small relative to the background density
The reference density
Primitive Equations on a Rotating Sphere
Horizontal Momentum Equations
The momentum balance on a rotating Earth (on an
where:
| Symbol | Description |
|---|---|
| Horizontal velocity components in the | |
| Coriolis parameter; | |
| Reference density (1000 kg/m | |
| Pressure | |
| Vertical eddy viscosity (from Mellor-Yamada 2.5 closure) | |
| Horizontal mixing terms (Smagorinsky or constant Laplacian diffusion) | |
| Three-dimensional advection operator: |
In the code, these equations are implemented in advu and advv (momentum.py), where the terms are assembled as:
uf = advx + vert_div + coriolis + press_grad + drhoxThe time discretization uses a leapfrog scheme:
uf[s_i, s_j, k_range] = (term_old - 2.0 * dti2 * uf[s_i, s_j, k_range]) / (denom + 1e-20)where term_old represents dti2 is denom is
Hydrostatic Approximation
In ocean circulation, the vertical scale of motion (
This yields the vertical distribution of pressure by integration from the surface:
The pressure gradient is decomposed into barotropic (surface slope) and baroclinic (density) components:
In the code, the baroclinic pressure gradient is computed in baropg() through vertical integration of density gradients with sigma-coordinate correction terms.
Continuity Equation
The continuity equation under the Boussinesq approximation reduces to volume conservation:
After sigma-coordinate transformation (see below), this becomes the equation for the free surface elevation
Temperature and Salinity Conservation
The scalar transport equations for potential temperature
where:
| Symbol | Description |
|---|---|
| Potential temperature | |
| Salinity (psu) | |
| Vertical eddy diffusivity (from turbulence closure) | |
| Horizontal mixing terms |
These are solved using a conservative flux-form centered-difference scheme (advt1) or the Smolarkiewicz iterative upstream scheme (advt2) to suppress numerical diffusion. Vertical diffusion is solved implicitly via a Thomas algorithm in proft().
Equation of State
NeuralPOM implements the Mellor (1991) seawater equation of state. The density is computed as a function of potential temperature, salinity, and pressure:
The computation in dens() follows the polynomial form:
# Atmospheric pressure contribution
rhor = -0.157406 + 6.793952e-2 * tr - 9.095290e-3 * tr^2
+ 1.001685e-4 * tr^3 - 1.120083e-6 * tr^4 + 6.536332e-9 * tr^5
# Salinity contribution
rhor += (0.824493 - 4.0899e-3 * tr + 7.6438e-5 * tr^2
- 8.2467e-7 * tr^3 + 5.3875e-9 * tr^4) * sr
# Salinity^1.5 terms
rhor += (-5.72466e-3 + 1.0227e-4 * tr - 1.6546e-6 * tr^2) * |sr|^{1.5}
# Salinity^2 terms
rhor += 4.8314e-4 * sr^2The pressure correction uses the speed of sound
The final density anomaly is output as
self.rho[:, :, k_sl] = (rhor / self.rhoref) * _b(self.fsm)Sigma-Coordinate Transformation
The vertical coordinate is transformed from the physical vertical coordinate
where:
| Symbol | Description |
|---|---|
| Physical vertical coordinate (positive upward, | |
| Free surface elevation | |
| Resting water depth | |
| Sigma coordinate ( |
This transformation maps the variable ocean domain to a fixed computational domain, simplifying the implementation of surface and bottom boundary conditions. The sigma levels are defined through the z and zz arrays:
# z(k): vertical position of sigma level k
# zz(k): vertical spacing between sigma levels (for finite differences)The transformation introduces metric correction terms in the baroclinic pressure gradient computation to avoid the "sigma coordinate pressure gradient error" over steep topography.
Vertical Boundary Conditions
Surface Boundary Conditions
Momentum (wind stress):
where wusurf and wvsurf.
Tracers (surface heat and freshwater flux):
Turbulence (boundary conditions for
Surface boundary condition for TKE is proportional to the friction velocity
Bottom Boundary Conditions
Momentum (bottom friction):
where cbc), and profu/profv computes:
mag_vel = safe_sqrt(u_sq + v_avg_sq)
tps_local[s_i_in, s_j_in] = cbc_avg * mag_vel
wubot[s_i_in, s_j_in] = -tps_local[s_i_in, s_j_in] * uf_bot_sliceTurbulence:
Bottom boundary condition for
Numerical Framework
Spatial Discretization
NeuralPOM uses the Arakawa C-grid on a curvilinear orthogonal horizontal grid:
and velocity components are staggered with respect to the tracer/scalar grid aruandarvare area factors atand points dt(the metric factor) representsat tracer points dx,dyare grid spacing arrays
Temporal Discretization
The model uses a leapfrog time integration scheme with an Asselin time filter to suppress the computational mode. The baroclinic and barotropic modes are split, with the barotropic time step typically much smaller (see Barotropic-Baroclinic Mode Splitting).
Python Implementation
The governing equations are implemented as PyTorch tensor operations in the following modules:
| Module | File | Contents |
|---|---|---|
MomentumMixin | momentum.py | advu, advv, profu, profv, dens, baropg |
BaroclinicMixin | baroclinic.py | advct (horizontal momentum advection) |
TracersMixin | tracers.py | advt1, advt2, proft, smol_adif |
All tensor operations are fully differentiable, enabling gradient-based optimization and neural network coupling.
