Ana içerik geç

Ocean Dynamics

Wave mechanics, thermohaline circulation, Coriolis gyres, coastal storm surge — a planetary-scale fluid solver that still runs at 1.287 Hz in the browser.

  • Live appzeq.dev/apps/ocean-dynamics/
  • Sourceapp/artifacts/api-server/public/apps/ocean-dynamics/ (1,335 lines)
  • Operators — KO42 · NM28 (angular momentum) · shallow-water operator · Coriolis
  • Error budget — ≤ 0.1% for linear gravity-wave dispersion at kh ≪ 1

What it solves

A shallow-water solver with Coriolis forcing, configurable bathymetry, and optional thermohaline density coupling. Three modes:

  • Wave — linear and weakly-nonlinear surface gravity waves; tsunami propagation over a bathymetry map
  • Circulation — wind-driven gyres, Ekman transport, western-intensification
  • Thermohaline — temperature and salinity advection coupled back into density via a linearised equation of state

Renders at 60 Hz; the physics solve converges once per Zeqond on a 256 × 256 grid in most browsers.


The math

Shallow-water momentum ∂v/∂t + (v·∇)v + f ẑ × v = −g ∇η − (τ_b/ρh)
Continuity (shallow) ∂η/∂t + ∇·(h v) = 0
Coriolis parameter f = 2 Ω sin(lat)
Gravity-wave dispersion ω² = g k tanh(k h)
Angular momentum (NM28) L = r × p (Coriolis is the sphere-frame remainder)
Thermohaline density ρ = ρ₀ [1 − α_T (T − T₀) + β_S (S − S₀)]

Operator picks

StepDecision
1. PrimeKO42 on
2. LimitKO42 + NM28 + shallow-water = 3 operators
3. ScalePlanetary (Rossby Ro ≪ 1), but local (kh < 1) for waves
4. Precision≤ 0.1% on dispersion
5. CompileMaster Equation: C_KO42 + C_NM28 + C_SW
6. ExecuteZ encodes bathymetry, wind stress, Ω, thermohaline switches
7. VerifyCheck ω = √(g k tanh(kh)) at 5 wavelengths; RMS ≤ 0.1%

Runnable worked example — tsunami over a 4 km shelf

Classical linear wave speed at h = 4000 m: c = √(g h) ≈ 198.09 m/s.

curl -s -X POST https://api.zeq.dev/api/playground/compute \
-H "Content-Type: application/json" \
-H "x-demo-key: $DEMO_KEY" \
-d '{
"operators": ["KO42","NM28","shallow_water"],
"params": {
"depth_m": 4000,
"wavelength_km": 200,
"latitude_deg": 35,
"bathymetry": "flat"
}
}' | jq

Expected:

{
"result": {
"wave_speed_mps": 198.0734,
"error_vs_linear_pct": 0.0081,
"period_min": 16.82,
"operators_used": ["KO42","NM28","shallow_water"]
}
}

Error 0.0081% on wave speed. Switching bathymetry to "real_pacific" gives regionally-varying c along a transect.


Extend it

  1. Non-hydrostatic waves — drop the kh ≪ 1 assumption; add vertical acceleration and watch short-wave dispersion bend
  2. Wave-current interaction — feed the circulation-mode flow back into the wave phase; get refraction over the Gulf Stream
  3. Storm surge — force the model with a wind-stress map from a real hurricane track; verify against NOAA tide-gauge records

Seeds

  • Rogue waves — couple NM30 (nonlinear Schrödinger) into the wave equation; watch amplitude solitons form at kh ≈ 1.36
  • Deep-ocean heat transport — calibrate ocean-dynamics against ARGO float data and publish the residual field
  • Analogue event horizons — Hawking-style acoustic horizons form where outflow equals c = √gh; visualise where the horizon sits

Papers

Middleware active. Kernel on the 1.287 Hz HulyaPulse. Awaiting next Zeqond.