Visualizations
356 / 500

356 · Simulation

Mountain Wave Clouds

Wind over a range rings into lee waves, and saucer clouds stack at the crests.

The flow is linear mountain wave theory, solved for real. The terrain is Fourier transformed, and for each wavenumber Scorer's equation is integrated from a radiating condition at 17 km down to the ground with complex RK4. Wind that strengthens with height lowers the Scorer parameter aloft, so some wavelengths get trapped and ring on downstream, and a touch of friction keeps them finite. A parcel lifted by the waves cools 9.8 K per km while its dew point falls only 1.8, so clouds condense wherever the lift beats the parcel's dew point depression: smooth lenses in thin moist layers, standing still while the air streams through them. A sailplane parks in the rising air upwind of a crest, as wave soaring pilots do.

Try it. Drag anywhere to pull the ground up into peaks or press it flat, and watch the waves re-solve. Use the sliders for wind speed, stability and humidity (the up and down arrow keys also change the wind, left and right the humidity), and press R to restore the range.

  • Scorer equation
  • FFT
  • Complex RK4 integration
  • Lifting condensation

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 side-view simulation of mountain wave (lenticular) clouds with JavaScript and the HTML canvas element. 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:
- Make a canvas that fills the window. The x axis is distance along the wind (about 60 km, wind blowing left to right) and the y axis is height (about 10 km). Draw a soft pastel sky gradient and a mountain shaped like a bell curve near the left.
- Model the air with the classic hydrostatic mountain wave: each streamline that starts at height z0 is lifted by eta(x, z0) = h0 * a * (a * cos(l * z0) - x * sin(l * z0)) / (x^2 + a^2), where h0 and a are the mountain's height and half width and l = N / U is the Scorer parameter (stability N about 0.01 per second, wind U about 15 m/s, so l is in radians per meter).
- Draw about 15 streamlines as thin white lines at z0 + eta, and animate small dots flowing along them.
- Give the air a few thin moist layers. A parcel lifted by eta cools about 8 K per km relative to its dew point, so it condenses when eta is bigger than its dew point depression divided by 8. Render that per pixel into a small offscreen canvas: wherever a pixel's air is condensed, paint soft white cloud.

Once that works, make it beautiful:
- Shade the clouds cream on the sunny side and pink-lavender underneath, and add a low sun with a glow.
- Add sliders for wind speed, stability and humidity, and let the pointer drag the mountain taller or wider.
- Color the moving dots blue while they rise and cool and peach while they sink and warm, and white inside a cloud.

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 trapped lee waves from an FFT and Scorer's equation with wind shear, rotor clouds near the ground, or a glider soaring in the wave.
PreviousVisual CryptographyTwo sheets of pure noise. Slide one over the other and a secret appears. NextPrism PuzzleSplit white light with rutile prisms to light colored targets. A search AI plays.

Related visualizations

  • Kelvin-Helmholtz BillowsFluids A sunset sky where sliding air layers roll a cloud deck into breaking-wave billows.
  • Volumetric CloudsNature Raymarched cumulus with silver linings, light shafts and drifting shadows.
  • Rogue WavesFluids A storm swell where walls of water rise from nowhere through nonlinear focusing.
  • Ocean3D Rolling waves at sunset, built from layered Gerstner waves.
  • HurricaneSimulation A satellite loop of a hurricane, driven by a vortex you can steer over a warm ocean.
  • Ship WakeFluids A boat carves the 19.47 degree Kelvin wake, which emerges from dispersion alone.
  • SolitonsFluids Solitary waves in a canal pass through each other unchanged, drawn as a Victorian plate.
  • Gas Giant WeatherFluids Real 2D fluid dynamics paints turbulent belts, festoons and oval storms on a gas giant.
  • Convection CellsFluids Water heated from below boils into mushroom plumes and rolling convection cells.

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

← More from Emergent Mind Labs