Hub

Fluid Sim

Two jets
60 fps
Tool
Ink colour: Rainbow
Start with

How to play

  1. Drag through the tank to stir. Use two or three fingers for two or three streams.
  2. Pick Wall and draw a wall. Stir again and watch the fluid flow round it.
  3. Try Wind + ball and watch swirls peel off behind the ball.
Do thisPhoneKeyboard
StirStir tool, drag (more fingers = more streams)1, then arrows (on the tank)
Drop a blob of inkStir tool, tapSpace (on the tank)
Draw a wallWall tool, drag2, Space pen down, arrows draw
Rub out a wallEraser tool, drag3, Space pen down, arrows rub
Next ink colourColour buttonsC
Velocity arrows / pressure viewThe two togglesV / H
Pause / PlayPause buttonP
Clear ink / Clear allButtonsI / X

What's happening?

  • The tank is a grid of tiny boxes. Each box knows how fast the fluid in it is moving, and how much ink it holds.
  • Advection: everything is carried along by the flow, even the flow itself. That's why a push keeps going after you let go.
  • Pressure: water can't be squashed. Push it one way and it has to get out of the way somewhere else. Every step, the sim finds the pressure that makes each box have exactly as much flowing in as out. In the pressure view, pink is high (squeezed) and blue is low.
  • Viscosity: how thick the fluid is. Thick fluids like honey smear every swirl out.
  • Swirl (vorticity): finds the spinning bits and spins them a little harder, so small curls don't blur away.
  • Together these are the Navier-Stokes equations: the same maths behind weather forecasts, aircraft design and the smoke in films.

Try this: load Wind + ball. Do the swirls behind the ball peel off one side, then the other? Now turn viscosity up to honey. What happens to them?