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

Where two layers of fluid slide past each other, the boundary between them cannot stay flat. Any ripple is pushed further out by the faster flow on its crest, and within a few periods the interface curls into a row of rolling vortices. Hermann von Helmholtz (1868) and Lord Kelvin (1871) worked out this instability; it shapes the billow clouds at the top of an inversion, the edges of jets, the bands of Jupiter, and the mixing at the bottom of the sea.

What you see

Vorticity, the local spin of the fluid, in a square box of 200 by 200 cells whose edges wrap around: red and blue mark spin of opposite sense. The middle half of the box moves to the right at speed U, the outer half to the left, so there are two shear layers, a quarter of the box from the top and from the bottom, of opposite spin. (A single layer would leave a second, hidden jump where the box wraps.) A small sine ripple seeds both layers.

The ripples grow, steepen and roll up into a chain of vortices on each layer. Later, neighboring vortices orbit each other and merge, so the vortices grow in size and drop in number: the energy moves to larger scales, as it does in two-dimensional turbulence.

Equation

The lattice Boltzmann method evolves populations fi moving along the nine directions of a square lattice, which relax toward a local equilibrium:

fi(𝐱+𝐜i,t+1)=fi(𝐱,t)−1τ(fi−fieq).

Their moments obey the Navier-Stokes equations with viscosity ν=(τ−12)/3. Each shear layer is a tanh profile of thickness δ=4 cells,

u(y)=Utanh⁡(y−y0δ).

Michalke (1964) found that such a layer is unstable for wavenumbers kδ<1 and grows fastest at kδ≈0.44, at the rate σ≈0.19U/δ. On this box one to four waves are all unstable (kδ from 0.13 to 0.50), and three or four grow fastest. Viscosity thickens the layer as δ2+4νt, which slows the growth and stabilizes short waves. The readout gives the layer’s Reynolds number 2Uδ/ν. A frame is 20 lattice steps.

Presets

Two waves: U=0.1, τ=0.515 (Reynolds number 160). Two vortices roll up on each layer within about 2 seconds and keep circling.

Fast roll-up: U=0.14, τ=0.51, three waves. The rolls form within a second; after about 5 seconds they have merged into one large vortex per layer.

Viscous layer: τ=0.6, seven times the viscosity of the default, one wave. The layer thickens as fast as the ripple grows: one broad, slow roll per layer after about 5 seconds.

Four waves that pair: four vortices form within a second; after about 5 seconds they have paired into two.

Parameters

Layer speed U: each half moves at ±U, so the jump across a layer is 2U; 0.04 to 0.15 in lattice units (below 0.3 the fluid behaves as incompressible). Applies on Reset.

Relaxation time τ: sets the viscosity, 0.51 to 0.6. Applies live.

Waves: periods of the seed ripple along each layer, 1 to 4. Applies on Reset.

Display: vorticity, speed or pressure, with a choice of color map; streamlines can be drawn on top.