A tank of water
Water, air, honey and blood all move according to the same two rules, written down by
Claude-Louis Navier (1822) and George Gabriel Stokes (1845). They are Newton's
force = mass × acceleration, applied to every tiny parcel of a fluid.
What the equations say
-
Momentum. A parcel of water speeds up or turns because of pressure
pushing on it, gravity pulling on it, and viscosity dragging it toward the speed of its
neighbors. It also carries its own velocity along with it, which is what makes flow
swirl and curl.
-
Incompressibility. Water can't be squeezed. Whatever flows into any
small region must flow out again. Pressure is exactly the force needed to keep that
true.
Moving the tank
The simulation runs inside the tank, so the tank never moves as far as the water is
concerned. Instead, moving it shows up as extra forces. Tilting it turns gravity toward
another wall. Sliding it pushes the water back against the trailing wall, the way coffee
sloshes when you start walking. Turning it adds the forces you feel on a roundabout:
the push outward (centrifugal) and the sideways drift of anything moving (Coriolis).
The glowing light in the sky is a second source of gravity. It swings from far left to
far right and back every two and a half seconds, pulling the water after it, so the
water sloshes from wall to wall. Sway turns it on and off.
How this simulation works
The water is about ten thousand particles that carry their own velocity, as in film
effects (the FLIP method). Each step, their velocities are copied onto a
20 × 20 × 20 grid, the grid's pressure is solved so no cell gains or loses water, and the
correction is copied back. Each particle is painted as a brush stroke, deep blue when
slow and white foam when fast, and the tilt-shift blur makes it look like a model.
Controls
- ← → ↑ ↓ slide the tank. Hold to keep sliding.
- Shift + arrows tilt it. Q and E spin it.
- Level brings it back upright; the scroll wheel zooms.