Incompressible velocity evolution
Advection transports momentum, viscosity diffuses velocity gradients, the nozzle and brush supply force, and pressure enforces incompressibility.
Fluid dynamics · a manipulable numerical field
A two-dimensional incompressible velocity field is extruded into luminous depth inside a transparent flow chamber. Tune viscosity, dye diffusion, pressure iterations, and vorticity enhancement to compare entrainment and the wake behind a cylinder; arm the fluid brush to inject dye and momentum by dragging through the test section.
Physics tutorial
BackgroundA real-time fluid canvas stores velocity and dye on a fixed grid. Each time step transports the fields, diffuses small-scale structure, then solves for pressure and removes the compressible component.
Why it mattersSeparating the solver stages turns swirling motion into more than an effect: divergence can be measured before and after pressure projection, exposing the exchange between stability and numerical dissipation.
Start with the essentials
Advection transports momentum, viscosity diffuses velocity gradients, the nozzle and brush supply force, and pressure enforces incompressibility.
Trace backward from each grid point and interpolate the old field. The step is robust, but repeated interpolation smooths detail.
The Poisson equation finds the gradient component to remove; more complete iteration usually leaves less residual divergence.
Typical misconceptionIf the algorithm never blows up, every small vortex must be preserved correctly.
Better mental modelSemi-Lagrangian advection remains stable at large time steps but introduces interpolation dissipation. Vorticity enhancement restores visual detail, not the true scales that were lost.
Typical misconceptionBecause particles occupy depth, the solver must resolve three-dimensional turbulence.
Better mental modelEvery particle samples the same two-dimensional velocity section. Depth makes structure easier to inspect but cannot create three-dimensional vortex stretching.
Choose Cylinder wake and let the dye pass the obstacle.
What to observe: The jet slows and splits upstream of the cylinder, leaving a low-speed wake and alternating rotational structure downstream.Enable Divergence diagnostic, then raise pressure iterations while comparing the two norms.
What to observe: The post-projection divergence norm drops sharply; with too few iterations the residual is easier to see on the field sheet.Arm the fluid brush, drag sideways through the wake, then disable it to orbit the chamber.
What to observe: Local dye and velocity change together; the new disturbance is advected, diffused, and projected again.