Loading the engineShared by all simulations, so the next one opens instantly.
The physics

Put a heavy fluid on top of a light one and the flat interface between them cannot stay flat. Any ripple lets a little heavy fluid sink and a little light fluid rise, which releases potential energy and makes the ripple grow. Fingers of heavy fluid (spikes) fall, bubbles of light fluid rise, and their flanks roll up into mushroom caps. Lord Rayleigh described it in 1882 and G. I. Taylor in 1950. It mixes the layers of an exploding star, limits the compression of fusion capsules and shapes the crust of salt domes.

What you see

The heavy fluid (red) above the light fluid (dark blue) in a box twice as high as it is wide that wraps around at the sides. A small ripple of the interface grows exponentially at first, then turns into a falling spike and a rising bubble. Shear along the flanks of the spike drives a Kelvin-Helmholtz instability, which curls them into the mushroom shape; later the layers mix into a turbulent zone that spreads up and down.

Equation

With a density contrast small enough for the Boussinesq approximation, the concentration ϕ of the heavy fluid is carried by the flow and acts on it through buoyancy:

∂ω∂t+𝐮⋅∇ω=ν∇2ω−2Ag∂ϕ∂x,∂ϕ∂t+𝐮⋅∇ϕ=κ∇2ϕ,

with the Atwood number A=(ρh−ρl)/(ρh+ρl) and κ=ν. A sharp interface ripple with wavenumber k grows as eσt with σ=Agk; viscosity and a diffuse interface slow it, short waves most. Here the interface is a smooth step a few cells thick: while it is still small, a single wave across the box grows at 0.97 of the sharp-interface rate.

Numerics

A 128 by 256 grid, streamfunction and vorticity at the cell corners, the concentration at the cell centers. Vorticity is advected with Arakawa’s Jacobian and the concentration with a limited upwind flux that keeps it between 0 and 1 and conserves each fluid exactly. Time advances with a three-stage Runge-Kutta scheme, and the Poisson equation is solved exactly with a Fourier transform sideways and a tridiagonal solve between the walls.

Presets

Single mode: one wavelength across the box: one spike, one bubble, two mushroom caps.

Random ripples, mixing: a faint random ripple of many short waves. The fastest ones grow first, then the bubbles compete and merge into ever larger ones.

Four waves: four spikes side by side; at this wavelength they grow twice as fast.

Viscous fingers: high viscosity keeps the flanks smooth: the spikes fall as plain fingers without rolling up.

Parameters

Atwood number A: 0.02 to 0.5, the density contrast. Time scales as 1/A. Applies live.

Viscosity ν: 2⋅10−5 to 2⋅10−3, logarithmic. Applies live.

Waves: wavelengths of the initial ripple across the box. Applies on Reset.