u(x,t)DuDt=∂u∂t+(u⋅∇)u=−∇pρ+ν∇2u+f,∇⋅u=0\vel{\mathbf{u}(\mathbf{x},t)}\qquad \mat{\frac{D\mathbf{u}}{Dt}} = \frac{\partial\mathbf{u}}{\partial t} + \adv{(\mathbf{u}\cdot\nabla)\mathbf{u}} = \prs{-\frac{\nabla p}{\rho}} + \vis{\nu\nabla^{2}\mathbf{u}} + \frc{\mathbf{f}},\qquad \cont{\nabla\cdot\mathbf{u} = 0}

Chapter 0

Introduction

You have probably stirred milk into a cup of coffee. The milk curls into swirls as it spreads, and when you pull the spoon out, the coffee keeps turning for a while before it slowly stops. Smoke rising from a candle, a river swirling behind a bridge pier, wind curling around the corner of a building: all of them follow the same rules. The equations that write those rules down are the Navier–Stokes equations.

This book does not ask you to swallow those equations whole. They are made of a few terms, and each term has one job. Most chapters take one term: first you see its job and try it with your own hands, and only then do you write it down. By the last chapter, the terms you have stacked up are a working fluid simulator.

Play first

The experiment comes before the explanation. The box below holds water with ink in it and one cylinder. The demo stirs the water a few times to show you around, and then it is your turn. Drag with the mouse, or swipe with a finger on a phone, to stir the water; you can drag the cylinder too. Raise the Viscosity ν slider under the window and the water turns thick like honey. The Dye, Particles and Speed buttons switch what the picture shows.

Side note

The lab computes on your graphics hardware through WebGPU. A browser without WebGPU shows a recording of the same experiment instead, and you cannot stir a recording.

A few things are worth noticing. In the demo, the stirred water meets the cylinder and rolls up into a pair of swirls. After you stop stirring, the water keeps moving for a while. The ink never moves on its own; it only rides with the water. With more viscosity, the same stroke curls thick and soft, and the swirls fade sooner, the small ones first. This book ties many of these effects to terms of the equations.

The equations behind the lab

At every moment, the lab solves the equations below to move the water you just stirred. They are the same as the ones on the bar at the top of the page.

DuDt=∂u∂t+(u⋅∇)u=−∇pρ+ν∇2u+f,∇⋅u=0\mat{\frac{D\mathbf{u}}{Dt}} = \frac{\partial \mathbf{u}}{\partial t} + \adv{(\mathbf{u}\cdot\nabla)\mathbf{u}} = \prs{-\frac{\nabla p}{\rho}} + \vis{\nu\nabla^2\mathbf{u}} + \frc{\mathbf{f}}, \qquad \cont{\nabla\cdot\mathbf{u} = 0}

You do not need to know every symbol yet. For now, remember one sentence for each term.

  • u\vel{\mathbf{u}} is the velocity of the flow. Picture an arrow attached to every point in space (chapter 1).
  • Du/Dt\mat{D\mathbf{u}/Dt} is the rate at which the velocity changes as you follow one particle of fluid: its acceleration. It is the rate of change seen at a fixed point, ∂u/∂t\partial\mathbf{u}/\partial t, plus the rate of change the particle meets as it moves, (u⋅∇)u\adv{(\mathbf{u}\cdot\nabla)\mathbf{u}} (chapters 1 and 5).
  • −∇p/ρ\prs{-\nabla p/\rho} is pressure. It pushes fluid from where the pressure is high to where it is low (chapter 3).
  • ν∇2u\vis{\nu\nabla^2\mathbf{u}} is viscosity. It evens out the velocity between neighbouring bits of fluid, so fluid that sticks to a wall slows down its neighbours (chapter 4).
  • f\frc{\mathbf{f}} is a force from outside. The hand that just stirred the water is this term (chapter 6).
  • ∇⋅u=0\cont{\nabla\cdot\mathbf{u} = 0} is conservation of mass. With the density ρ\rho of the water taken as constant, what flows into any small box must flow out, so the water never bunches up or leaves gaps (chapter 2).

The left side of the first equation is the acceleration of a particle of fluid, and the right side lists the forces, per unit mass, that push it. So the first equation is Newton’s second law, F=ma\mathbf{F} = m\mathbf{a}, written for every particle. The second equation goes with it: mass is never created or destroyed. The five chips at the top left of the experiment window are the terms switched on in this lab. In the chapters ahead, most experiments switch on only the terms they need and show you what those terms do.

Side note

The lab is qualitatively right; it is not precise engineering software (computational fluid dynamics, or CFD). It computes a two-dimensional flow on a grid of at most 480×270 cells, with fewer cells on a phone or a slow device. Moving the flow from cell to cell smears out small swirls faster than real water does. This is called numerical diffusion, and it is why the swirls slowly weaken even at zero viscosity. All values on screen are dimensionless numbers without units.

How to read this book

Chapters follow much the same order. First you see the effect, then you test it in an experiment, then you write it as an equation, and at the end the chapter comes down to one sentence. The bar at the top tells you where you are: it shows the terms you have learned in their own colour, underlines the chapter’s own term and dims the terms still to come. You have learned none yet, so in this chapter the bar shows every term at the same brightness, as a preview of the whole.

The buttons under each experiment window pause the demo or play it again from the start, and Next scene skips ahead. Touch a slider or the stage, and the demo stops so that you can take over.

In one sentence

This book shows you the finished fluid lab first, then teaches the terms of the equations that drive it, one chapter at a time, and brings you back to the lab.

Something to think about

Why does the water keep moving for a while after you stop stirring?

Show answer

Moving water tends to keep moving: that is inertia. In real water, what slows the motion down is viscosity, and a wall slows the water through viscosity too. Water has little viscosity, so the motion fades slowly, and a higher viscosity makes it fade sooner. This lab starts at zero viscosity; the swirls still weaken a little, and that is numerical diffusion. Chapter 4 covers viscosity, and chapter 5 covers how a flow carries its own momentum along.

Something to think about

Does the ink in the experiment window change the flow?

Show answer

No. In this lab the ink is only a marker that rides with the water. Very dilute real ink hardly changes a flow either. That is why the patterns ink draws let you see a flow.