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.
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.