An interactive ocean-world simulator with real fluid dynamics
Drag a moon. Sculpt the seabed. Watch the ocean respond.
Planetary Ocean Simulator is a browser-based simulator of a water-covered planet. The physics are real β rotating shallow water equations on a full sphere, tidal forcing from orbiting moons, topographic reflection β but the interface is a Google Earth-style globe with four sliders.
Move the moon closer and watch tidal bulges grow. Spin the planet faster and see zonal jets emerge from the Coriolis force. Raise a seamount and watch waves reflect. The anomaly detector highlights when the ocean enters an unusual state.
- π Full-sphere ocean β rotating shallow water equations on SΒ², no flat-plane approximations
- π Live tidal forcing β drag moon distance and mass, tides respond in real time
- π Coriolis dynamics β scale planetary rotation from 0.1Γ to 5Γ Earth, watch jets form
- β°οΈ Seabed sculpting β ridges and seamounts reflect waves via volume penalization
- π΄ Anomaly detection β three-layer DS module: z-score threshold, Isolation Forest, energy spike detector
- π Live analytics β kinetic + potential energy time series, anomaly count, rotation indicator
βββββββββββββββββββββββββββββββββββββββββββββββ
β Browser (React + CesiumJS + deck.gl) β
β Globe Β· Heatmap Β· Vectors Β· Controls β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β REST (JSON)
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β FastAPI backend β
β /state Β· /land Β· /scenarios Β· /anomaly β
β zarr reader Β· sklearn anomaly models β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β zarr files
ββββββββββββββββββββΌβββββββββββββββββββββββββββ
β Physics (Dedalus v3, Python) β
β Rotating SWE Β· Tidal forcing Β· Topography β
β Precomputed scenario library β
βββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology |
|---|---|
| Physics solver | Dedalus v3 β spectral SWE on SΒ² |
| Backend API | FastAPI + zarr + scikit-learn |
| 3D Globe | CesiumJS + deck.gl BitmapLayer |
| Frontend | React 18 + TypeScript + Vite |
| Anomaly detection | scikit-learn Isolation Forest + numpy |
| Data format | zarr (chunked arrays, O(1) timestep reads) |
| Deploy | Railway |
- Python 3.11+
- Node 20+
- Git
git clone https://github.com/youruser/planetary-ocean-simulator.git
cd planetary-ocean-simulatorcd backend
pip install -r requirements.txt
# Generate fake test data (no physics solver needed)
python scripts/generate_test_zarr.py
# Start API
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev
# Opens at http://localhost:5173curl "http://localhost:8000/scenarios"
curl "http://localhost:8000/state?scenario=scenario_test_moon384km_omega1x_temp15&t=0"planetary-ocean-simulator/
βββ CLAUDE.md # Full context for Claude Code (read this first)
βββ README.md # This file
βββ physics/ # Kirill's domain β Dedalus SWE solver
β βββ simulation.py
β βββ generate_scenarios.py
β βββ validate.py
βββ backend/ # Vlad's FastAPI
β βββ main.py
β βββ routers/
β βββ services/
β βββ data/ # zarr stores (gitignored)
β βββ models/ # sklearn models (gitignored)
βββ frontend/ # Vlad's React app
β βββ src/
β βββ components/
β βββ hooks/
β βββ utils/
βββ docker-compose.yml
The physics module outputs zarr stores consumed by the backend. Full schema documented in CLAUDE.md Β§ 4.
scenario_moon384km_omega1x_temp15/
eta.zarr # wave height (T, lat, lon) float32
u.zarr # zonal velocity (T, lat, lon) float32
v.zarr # meridional vel (T, lat, lon) float32
chi.zarr # land mask (lat, lon) float32
E_k.zarr # kinetic energy (T,) float32
E_p.zarr # potential energy (T,) float32
metadata.json
The core model is the rotating shallow water equations on a full sphere:
βu/βt + (uΒ·β)u + fΒ·kΜΓu = βgβΞ· + βU_tidal + F_drag + F_land
βΞ·/βt + βΒ·(Hu) = 0
f(Ο) = 2Ω·sin(Ο) β full sphere, not beta-plane
Solved spectrally with Dedalus v3 (SphereBasis, RK443 IMEX timestepper).
Topographic reflection via volume penalization (tanh land mask Ο).
Full physics specification: CLAUDE.md Β§ 3 and physics/spec_v2.pdf.
Three independent layers stacked into a composite signal:
| Layer | Method | What it catches |
|---|---|---|
| 1 | Rolling z-score per grid cell | Local point anomalies (Ξ· > 3Ο) |
| 2 | Isolation Forest on [Ξ·, u, v, speed] | Multivariate outliers |
| 3 | Energy spike ratio | System-level phase transitions |
Ocean cells only β land mask applied before flagging.
- Physics spec v2 (full sphere, corrected tidal force, volume penalization)
- Zarr data contract agreed
- FastAPI scaffold + fake zarr generator
- CesiumJS globe with heatmap (Phase 1)
- Timeline slider + 4-control panel (Phase 2)
- First real physics zarr from Kirill (Phase 2 end)
- Anomaly layers 1 + 3 live (Phase 3)
- Isolation Forest on real data (Phase 4)
- Deploy on Railway (Phase 4)
Full build plan: CLAUDE.md Β§ 14.
| Person | Role |
|---|---|
| Vlad | Frontend (React + CesiumJS), backend (FastAPI), data science (anomaly detection) |
| Kirill | Physics (Dedalus SWE solver), mathematics (tidal mechanics, Coriolis dynamics) |
Planetary Ocean Simulator (ΞάλαΟΟΞ±) β goddess of the sea in Greek mythology, and a moon of Neptune.
MIT