WASHES · REFERENCE GALLERY · ADVECTION

Stable Fluids

Jos Stam. SIGGRAPH '99, pp. 121–128. The scheme that fixed the cross artifact in Washes v0.67–v0.69.

The same cross of pigment is carried by the same velocity field on both canvases below — a constant diagonal drift on a wrapping domain, scaled so the maximum CFL number equals Δt exactly. The only difference is the advection scheme. The left canvas uses donor-cell explicit upwind, which is stable only while CFL ≤ 1. The right uses Stam's semi-Lagrangian backtracing, which traces each cell backward along the flow and interpolates — unconditionally stable at any timestep.

Push Δt past the tick at 1.00 and watch the left side: oscillations appear, pigment concentration goes negative (rendered magenta, the "negative pigment" streaks from the original bug), and the field disintegrates. The right side never breaks. It only blurs — semi-Lagrangian's known cost.

CFL = 1
0.60 MAX CFL 0.60
step 0 · min pigment 0.00
Donor-cell explicit upwind — conditionally stable, CFL ≤ 1 (Courant, Friedrichs & Lewy 1928)
Semi-Lagrangian (Stam 1999) — unconditionally stable, increasingly diffusive

Try this

1. Run at Δt = 0.95 for a while. Stable — just diffusive. Then nudge to 1.10. The growth rate near the threshold is gentle, which is exactly why the original artifact survived eleven versions of root-causing.

2. Pause and use single steps right at Δt = 1.05 to watch the first oscillations form on the cross's trailing edges, where the upwind difference looks furthest backward.

3. Set Δt = 2.00. The left field is noise within seconds; the right is a soft, blurred cross forever. Stability is not accuracy — semi-Lagrangian buys robustness with smearing, which Bridson's MacCormack chapter addresses.