Skip to content

Double Gyre Case

The Double Gyre case (problem_id = 4) is the primary benchmark configuration in NeuralPOM, simulating wind-driven ocean circulation in a closed rectangular basin. It is the main case used for training the CorrectorNet and evaluating hybrid AI-physics performance.

Physical Configuration

Domain

ParameterValueDescription
Domain size~1000 km x 1000 kmMid-latitude rectangular basin
Coarse gridim=90, jm=82Grid used for training (downsampled)
Fine gridim=354, jm=322High-resolution reference simulation
Vertical levelskb=21Sigma-coordinate layers
Depth2000 m (uniform)Flat-bottom basin
Latitude~30°NMid-latitude beta-plane

The basin is fully enclosed by lateral walls on all four sides. The grid uses an Arakawa-C staggered arrangement with velocity components defined on cell faces and scalar quantities at cell centers.

Wind Forcing

The wind stress τ drives a double-gyre pattern through its curl. The zonal wind stress is prescribed as:

τx(y)=τ0cos(2πyyminymaxymin)

where τ0 is the wind stress amplitude (typically 0.1 N/m2). The resulting wind stress curl produces a subpolar gyre (cyclonic) in the northern half of the basin and a subtropical gyre (anticyclonic) in the southern half.

Stratification

The initial temperature and salinity profiles are prescribed analytically as functions of depth. Temperature decreases with depth following:

T(z)=Tsurf+(TbotTsurf)ez/hT1eH/hT1

where hT is the thermocline scale depth. A similar exponential structure applies to salinity, producing stable stratification with N2>0 everywhere.

Coriolis Parameter

The beta-plane approximation is used:

f(y)=f0+β(yy0)

with f07.29×105 s1 and β2.0×1011 m1s1, corresponding to a latitude of approximately 30N.

Key Dynamics

The double gyre configuration produces a rich set of physical phenomena:

  • Western boundary currents: Intense, narrow currents along the western boundary where the subpolar and subtropical gyres converge, analogous to the Gulf Stream / Kuroshio. The inertial boundary layer width scales as δI(U/β)1/2.

  • Inertial recirculation: Strong recirculation cells east of the western boundary current separation point, driven by nonlinear advection.

  • Rossby waves: Long baroclinic Rossby waves propagate westward from the eastern boundary, setting the basin-scale adjustment time scale TRL/(βRd2) where Rd is the first baroclinic Rossby radius of deformation.

  • Gyre exchange: Inter-gyre exchange of mass, heat, and tracers across the zero wind-stress-curl line, often mediated by eddy fluxes.

  • Mesoscale eddies: At sufficiently high resolution (ΔxRd), the flow becomes eddying with rich variability in the separated jet and recirculation regions.

Simulation Parameters

Typical integration parameters for the NeuralPOM double gyre:

ParameterValueDescription
External time step dte5.0 sBarotropic (external) mode step
Split ratio isplit30Internal steps per baroclinic step
Internal time step dti150.0 sBaroclinic step = dte * isplit
Total duration20 years (7300 days)Spin-up and ensemble generation
Reference output interval20 min (first 4 h/day)High-frequency segments
Checkpoint interval1 dayDaily restart files

The time step satisfies the CFL condition for barotropic gravity waves:

Δte<mini,j(ΔxgHi,j)

Expected Flow Features

After spin-up (typically 5--10 years of integration), the double gyre exhibits:

  1. A strong, narrow western boundary current with maximum speeds O(1 m/s) near the surface.

  2. A separated eastward jet at the inter-gyre boundary with meandering and eddy formation.

  3. A Sverdrup interior flow in approximate balance:

    βv=1ρ0×τ
  4. Quasi-steady gyre circulation with total transport on the order of 30--50 Sv (1 Sv = 106 m3/s).

Diagnostic Outputs

During simulation, the following diagnostics are available:

  • Instantaneous fields: u, v, T, S at all vertical levels
  • Depth-averaged velocity: ua, va (barotropic mode)
  • Free-surface elevation: el (instantaneous), et (time-filtered)
  • Turbulence quantities: q2 (twice TKE), q2l (TKE × length scale), km (vertical eddy viscosity), kh (vertical eddy diffusivity)
  • Transport terms: utf, vtf (advective fluxes)
  • Surface fluxes: wind stress, heat flux (if enabled)

Ensemble Data Generation

For training data, NeuralPOM runs an ensemble of 8 double gyre simulations, each perturbed with small-amplitude initial noise (σ104 on u, v) to create diverse training samples while sharing the same large-scale statistics:

bash
# Generate 8-member ensemble, 20 years each
NEURALPOM_NUM_MEMBERS=8 \
NEURALPOM_TOTAL_DAYS=$((20 * 365)) \
NEURALPOM_GENERATION_CORE=implicit \
python scripts/data_generation/generate_double_gyre_ensemble.py

The ensemble members are distributed across 8 GPUs using PyTorch CUDA multiprocessing. Each member saves daily checkpoints and high-frequency reference data (12 segments at 20-minute intervals during the first 4 hours of each day).

Usage

Running a Single Simulation

python
from neuralpom.cases.catalog import get_case_settings
from neuralpom.cores.implicit import ImplicitPOM2KCore

settings = get_case_settings("double_gyre")
core = ImplicitPOM2KCore(im=settings.im, jm=settings.jm)
core.iproblem = settings.problem_id
core.run_initialization()

# Run 365 days with daily checkpointing
for day in range(365):
    core.time0 = core.time
    core.iend = int(24 * 3600 / core.dti)
    core.run_time_loop()
    core.save_checkpoint(f"checkpoint_Day{day:04d}.npz")

Loading Pre-Generated Data

python
from neuralpom.data.dataset import POMCheckpointDataset

ds = POMCheckpointDataset(
    mode='train',
    target_seg_idx=3,    # Load 4 reference segments per sample
    start_day=100,
    end_day=720
)

inputs, targets = ds[0]
print(f"u shape: {inputs['u'].shape}")     # (jm, im, kb) or similar
print(f"Target u shape: {targets['u'].shape}")  # (T, jm, im, kb)

Core Variants

The double gyre case is available for both core variants:

python
# Explicit core -- leapfrog time stepping, shorter time steps
from neuralpom.cases.explicit.double_gyre import CASE_SETTINGS
from neuralpom.cores.explicit import ExplicitPOM2KCore

# Implicit core -- CG/PCG barotropic solver, longer time steps
from neuralpom.cases.implicit.double_gyre import CASE_SETTINGS
from neuralpom.cores.implicit import ImplicitPOM2KCore

Both variants share the same problem_id = 4 and produce physically equivalent solutions, though the implicit core allows larger time steps due to its unconditionally stable barotropic treatment.

Released under the MIT License.