Visualizations
020 / 500

020 · Fluids

Gas Giant Weather

Real 2D fluid dynamics paints turbulent belts, festoons and oval storms on a gas giant.

The clouds of a gas giant are a 2D flow on a band that wraps all the way around the planet. Alternating zonal jets are maintained by relaxing the zonal-mean potential vorticity toward a jet profile; they shed billows and festoons, small storms bubble up and merge into long-lived ovals, and a finite deformation radius keeps those vortices compact. One great brick-red oval is held alive by a gentle forcing in its core and drifts with the wind at its latitude, while the free flow around it winds the belts into spiral arms. The beta effect, the planet's curvature felt as a gradient in the Coriolis force, is applied exactly as a phase rotation of every Fourier and sine mode at its Rossby wave frequency, and the stream function comes from an FFT plus tridiagonal solve. Cream and rust cloud dye rides a grid three times finer and is wrapped onto a lit, slowly turning sphere through a precomputed pixel to latitude and longitude table, while a small moon crosses the disk with its shadow.

Try it. Drag across the planet to stir the clouds and click to spawn a storm. A new storm spins with the local shear, so it survives and can merge with its neighbors; press S to spawn storms that spin against the shear and watch the jets tear them apart. R resets the weather.

  • Equivalent-barotropic quasi-geostrophic flow
  • Spectral Rossby wave propagator
  • FFT plus tridiagonal Poisson solve
  • MacCormack dye advection
  • Sphere mapping lookup table

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a gas giant weather simulation with JavaScript and the HTML canvas element: real 2D fluid dynamics that paints cream and rust cloud belts, swirling festoons and oval storms. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Use a grid of about 256 x 64 cells that is periodic left to right (around the planet) with walls at the top and bottom.
- Define alternating zonal jets, for example u(y) = U cos(2 pi * 3.5 * y), and store the flow as vorticity w (start from the jets' vorticity -du/dy plus a little noise).
- Each step: get velocity from a stream function psi (u = dpsi/dy, v = -dpsi/dx), advect w with semi-Lagrangian advection, nudge each row's average vorticity back toward the jet profile so the jets persist, and solve lap(psi) = -w with Jacobi or Gauss-Seidel iterations warm-started from the last frame.
- Advect a cloud dye that starts as horizontal belts with some noise, and draw it through a cream-to-rust palette into ImageData scaled up with drawImage. Show it as a flat map first.

Once that works, make it beautiful:
- Sprinkle small random vortices that merge into bigger ones, and seed a few large oval storms spinning with the local shear so they last.
- Add the beta effect (w -= dt * beta * v) for Rossby waves; keep the time step small or treat it spectrally, since explicit beta can blow up.
- Shade the dye with a little relief from its gradient, then wrap the map onto a lit, slowly rotating sphere using a precomputed table from screen pixels to latitude and longitude, against a starfield.
- Let dragging stir the clouds and clicking spawn a storm.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as an exact FFT Poisson solver, a finite deformation radius for more compact storms, or a moon casting its shadow on the clouds.
PreviousFlood DioramaA dam fails above a miniature town and a muddy flood spreads through the valley. NextNeural NetworkA tiny neural network learns to classify points, live, in your browser.

Related visualizations

  • Kelvin-Helmholtz BillowsFluids A sunset sky where sliding air layers roll a cloud deck into breaking-wave billows.
  • Convection CellsFluids Water heated from below boils into mushroom plumes and rolling convection cells.
  • Planet ForgeAstronomy A dusty disk grows rocky worlds, ice giants and gas giants by N-body accretion.
  • PlanetAstronomy A procedurally generated world with oceans, clouds and a glowing atmosphere.
  • Rayleigh-Taylor FingersFluids Heavy ink collapses into mushroom fingers in a glass tank you can turn upside down.
  • Ink in WaterFluids A real fluid solver swirls colored dye like ink in water.
  • HurricaneSimulation A satellite loop of a hurricane, driven by a vortex you can steer over a warm ocean.
  • Volumetric CloudsNature Raymarched cumulus with silver linings, light shafts and drifting shadows.
  • BonfireFluids A campfire whose flames are a fluid simulation colored by blackbody physics.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs