Education
Simulating Ocean Currents from One Equation
The Gulf Stream, Kuroshio Current, and Antarctic Circumpolar Current all emerge from a single equation. I built a GPU-accelerated simulator that lets you watch it happen in real time — and reshape the continents while it runs.
9 April 2026 · 7 min read

What is the AMOC?
The Atlantic Meridional Overturning Circulation — the AMOC — is one of the most important systems on Earth that most people have never heard of. It’s a vast conveyor belt of ocean currents that carries warm water from the tropics northward through the Atlantic. When that water reaches the North Atlantic, it cools, becomes denser, sinks to the deep ocean, and flows back south. This circulation is what gives Western Europe its mild climate — London sits at the same latitude as Calgary, but rarely sees -30°C winters.
The AMOC is weakening. As Greenland’s ice sheet melts, freshwater floods the North Atlantic and dilutes the salty water that needs to sink. A 2023 study in Nature Communications by Peter and Susanne Ditlevsen estimates the AMOC will collapse around 2057, with 95% confidence the tipping point falls between 2025 and 2095. A more recent paper in Science Advances found physics-based early warning signals confirming the system is on a tipping course. If it collapses, Europe gets dramatically colder, sea levels rise along the Atlantic coast, monsoon patterns shift, and agriculture across the Northern Hemisphere is disrupted.
I live in the Netherlands. This isn’t a distant abstraction for me — it’s the most important climate risk to the place I call home.
Climate simulations you can’t see
The problem with most climate science is that the simulations are invisible. Researchers run massive numerical models on supercomputers, producing terabytes of data that get distilled into charts and papers. The underlying physics is beautiful — the interplay of wind, rotation, and friction that produces every major ocean current — but you’d never know it from looking at a time series plot.
Reading that the Gulf Stream carries 30 sverdrups of warm water northward is abstract. Watching it form from nothing — watching the beta effect pull the flow to the western boundary, watching the boundary current intensify as you increase wind stress — makes the physics intuitive in a way that equations on a page never can.
Building it with Claude Code
In conversation with my friend Luke Barrington, director of Google Earth AI, we wanted to see what was possible in a short time with Claude Code. Could we take the barotropic vorticity equation — the single equation that governs large-scale ocean circulation — and make it run interactively in a browser?
The result is a real-time simulator on a 360×180 global grid, using WebGPU compute shaders for GPU acceleration. It evolved through four versions — from a flat map with a simple two-box model, to a Three.js globe, to real satellite data overlays, and finally to the full physics simulation running on the GPU.
One equation to rule them all
The governing equation looks intimidating at first:
dζ/dt + J(ψ,ζ) + βv = curl(τ)/ρH - rζ + A∇&sup4;ψBut each term has a clear physical meaning. Wind stress curl (curl(τ)/ρH) drives the circulation. The beta effect (βv) — the variation of the Coriolis parameter with latitude — explains why western boundary currents like the Gulf Stream are intense and narrow while eastern return flows are broad and gentle. Bottom friction (rζ) provides dissipation, and lateral viscosity (A∇&sup4;ψ) sets the boundary layer width.
Henry Stommel worked this out in 1948 with a paper that’s barely four pages long. Walter Munk refined the viscous formulation in 1950. Between them, they explained why every ocean basin on Earth has the same asymmetric pattern: a fast, narrow western boundary current and a slow, broad return flow.
I built an interactive equation explainer that breaks down each term with animations and physical intuition, so you don’t need a fluid dynamics background to understand what’s happening.
SimEarth for the ocean
The most fun feature is the paint palette. You can draw land or ocean directly on the map and watch the circulation reorganize in real time. Paint a land bridge across the Drake Passage and the Antarctic Circumpolar Current collapses. Open a seaway through Panama and water flows between the Atlantic and Pacific. Melt Greenland and watch the freshwater disrupt the overturning circulation.
These aren’t canned animations. The physics solver recalculates everything from scratch based on the new geometry. You’re running actual paleoclimate experiments — the same scenarios oceanographers study, just compressed from geological timescales into seconds.
Preset scenarios recreate key moments in Earth’s climate history:
- Open Drake Passage — the event ~34 million years ago that isolated Antarctica and triggered its glaciation
- Close Panama Seaway — the formation of the Isthmus of Panama ~3 million years ago that strengthened the Gulf Stream
- Melt Greenland — what happens when freshwater floods the North Atlantic
- Ice Age — expanded polar ice sheets and their effect on circulation
WebGPU makes it possible
The physics requires solving a Poisson equation at every timestep — a large linear system across 64,800 grid cells. On CPU, this is barely interactive. WebGPU compute shaders make it smooth. The entire pipeline — timestep integration, Jacobi iteration for the Poisson solver, temperature advection, boundary enforcement — runs on the GPU in parallel.
For browsers without WebGPU support, the simulator falls back to a CPU implementation. It’s slower but still functional. A badge in the corner tells you which backend you’re using.
Simulating the collapse
The simulator includes a temperature field with seasonal solar heating and buoyancy coupling. A freshwater forcing slider lets you simulate what happens when ice sheets melt and dilute the salty water that drives the AMOC.
Push the slider far enough and the AMOC collapses. The warm water that normally flows north from the tropics weakens, and the North Atlantic cools. You can watch it happen in real time — the same process that scientists warn could reshape the climate of the Northern Hemisphere within our lifetimes.
The code is all client-side — no server, no API calls. Just HTML, JavaScript, and WGSL shaders. You can try it now in any modern browser.