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

Stir a thin layer of fluid and leave it alone. In three dimensions the eddies would break into ever smaller ones until viscosity eats them. In two dimensions the opposite happens: small eddies of the same sense of rotation find each other and merge, and the flow organizes itself into a few large, long-lived vortices. Kraichnan predicted this inverse energy cascade in 1967; soap films, the atmosphere of Jupiter and stratified oceans show it.

What you see

Vorticity, red for counterclockwise spin and blue for clockwise, in a box that wraps around on all four sides. The flow starts as random eddies of one size. Within a few turnover times the like-signed ones pair up and merge, while the fluid between them is drawn out into thin filaments. Those filaments carry the enstrophy (the squared vorticity) down to the grid scale, where viscosity removes it. The colors are scaled to the strongest 0.5% of the current field, so the picture stays visible as the flow decays.

Equation

The vorticity ω of an incompressible two-dimensional flow is carried along by the flow and diffuses:

∂ω∂t+𝐮⋅∇ω=ν∇2ω,𝐮=(∂ψ∂y,−∂ψ∂x),−∇2ψ=ω.

Without viscosity both the energy 12∫|𝐮|2 and the enstrophy 12∫ω2 are conserved. Holding both fixed forces energy toward large scales while enstrophy flows to small ones. With viscosity, enstrophy decays fast and energy barely at all.

Numerics

A 128 by 128 grid with the streamfunction and vorticity at the cell corners. Advection uses Arakawa’s Jacobian, which conserves energy and enstrophy exactly in space, so the only losses are viscosity and a small time-stepping error. Time advances with a three-stage Runge-Kutta scheme, and the Poisson equation for ψ is solved exactly with fast Fourier transforms. A Taylor-Green cell decays at the exact viscous rate to one part in a million, and without viscosity the energy changes by less than 10−4 over ten time units.

Presets

Merging eddies: about six eddies across the box merge into a handful of large vortices.

Many small eddies: more and smaller eddies, so more mergers before the flow reaches the box scale.

Few large eddies: the flow starts near the box scale, so a few vortices orbit each other and merge slowly.

Viscous decay: at Re = 150 viscosity wins before the eddies can merge, and the flow fades.

Parameters

Reynolds number Re: 100 to 2000, the inverse viscosity. Applies live. The grid resolves the thinnest filaments while Re times the eddy wavenumber stays below about 6000; beyond that they turn grainy at the grid scale.

Eddy wavenumber: the initial spectrum peaks at about this many eddies across the box. Applies on Reset.