Skip to explorer

Flow Laboratory

Ribbons of pigment trace the motion of a simulated fluid. Stir it yourself, or watch two opposing gyres exchange their colours.

Three ways to move a fluid

Choose a forcing pattern. Every scene uses the same fluid solver; only the continuous driving forces and pigment sources change.

How the solver works

The fluid carries its own velocity and three passive pigment concentrations. Each fixed time step traces their paths backward through the velocity field. A pressure solve then removes the velocity field’s divergence, approximating an incompressible fluid inside a closed rectangular vessel with slip walls.

Switch to vorticity to see local rotation: the first pigment marks one turning direction and the second marks the other. Pigment brightness represents an artistic concentration mapping, not measured speed or temperature.

Accuracy and limits

A limited MacCormack correction preserves thin pigment filaments while suppressing numerical overshoots. Semi-Lagrangian velocity advection still smooths fine detail. Twenty-four pressure iterations approximate the projection; finite grid resolution leaves residual divergence. Drag, pigment fading and prescribed forces are creative controls. This two-dimensional, homogeneous flow has no free surface, buoyancy, density differences or calibrated physical units, and is not a model for engineering predictions.

The implementation was independently written around the methods described in Mark Harris’s GPU Gems chapter on fluid dynamics and Jos Stam’s Stable Fluids. All transport and pressure work runs on the GPU.