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 canvas stores velocity and dye on a fixed grid. Each step alternates velocity diffusion, advection, and pressure projection before transporting dye. The two physical cell spacings are used separately; slow playback does not change the time units of the readouts.
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 stored velocity potential absorbs the time-step and density factors; it is not pressure in Pascals. Rectangular-grid relaxation uses different horizontal and vertical weights. A finite-iteration projection does not guarantee zero divergence.
The live value is recalculated from the current velocity. The last before/after pair is a historical snapshot, marked stale after painting or parameter edits. A zero-field reduction ratio is undefined, not a claimed improvement.
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.Pause, arm the brush, and paint a disturbance. Enable Divergence diagnostic and click Project only. Change the iteration count, then project again.
What to observe: The before value matches the live residual before the click; the after value matches the new live residual. Time and dye do not advance. More iterations usually reduce residual, but do not prove exact incompressibility.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.Conceptual inspiration: FluidMotion. Original simulations and graphics; the model limits are described above.