Chapter 3
Pressure
Fill a bathtub and, with your hand under the water, push the water once with your palm. The water in front of your hand does not pile up. It slips aside and around behind your hand, and water a hand’s width away moves too. In chapter 2’s fake fluid, water would have piled up in front of your hand. In real water, pressure stops that from happening. Where water would crowd together, the pressure rises and pushes it apart; where water would thin out, the pressure falls and draws water in. This chapter shows how pressure removes divergence, and what follows from it. The term highlighted in the equation bar is the pressure.
Pressure removes divergence
Think back to the engine at the end of chapter 2. At every step it first adds the forces and carries the flow along. The provisional velocity that comes out usually has a divergence that is not zero. The pressure projection adds the push of the pressure to it and removes the divergence. The experiment below shows one projection, slowly. The provisional velocity is what is left right after one push of the water to the right, made with the projection off. On the divergence layer, the front, where the water crowds in, is sky blue (negative divergence), and the back, where it spreads out, is orange (positive divergence).
Side note
This experiment runs one stage of the engine, the projection. Every other term is off, so the water does not move between sweeps. The grid is 240×135 on every device. The engine usually solves for the pressure with multigrid; the Jacobi sweeps of this experiment are a display mode, there to show the process. In a browser without WebGPU, a recorded video plays instead, and the video cannot change the sweeps or the solver.
The sweeps of this experiment are Jacobi sweeps: each one corrects the pressure of every cell at once. Each cell looks only at the pressures of its four neighbours and at its own divergence, and sets the pressure that would remove that divergence. But a cell’s new pressure changes its pressure difference with its neighbours, so water moves in or out of them. The leftover divergence spreads to the neighbours and fades as it spreads, and where leftovers of opposite sign meet, they cancel. The plots at the top right read the divergence and the pressure at one point in front of the push. With every sweep the divergence comes closer to zero and the pressure builds up. Switch to the pressure layer: the pressure is high in front (orange), where the water crowded in, and low behind (sky blue), where it spread out. Move Sweeps one step at a time to watch the sweeps one by one.
These sweeps are slow: each one carries the news only as far as the next cell, and the news fades as it goes. After 300 sweeps the largest divergence on the stage is still about a third of what it was, and after 2000 about 1/25 of it. Switch Solver to Multigrid, and the same projection is solved the way the engine usually solves it. Sweeps does nothing while Multigrid is chosen. Multigrid also sweeps on coarse copies of the grid, half as fine and half again, and so sends the news far in one go. One step (two V-cycles) leaves less than 1/150 of the divergence. The pressure then does not stay around the push: it reaches the walls of the tank on both sides, high over the right half and low over the left. In a closed tank full of water, the water as a whole cannot shift to one side, so as much water as was pushed has to flow back above and below the push. With Jacobi sweeps, the pressure across the whole tank takes tens of thousands of sweeps to settle.
Side note
A pressure solved with a finite number of sweeps leaves a little divergence; so does the engine’s usual step (chapter 2’s side note). In this experiment the largest is 0.026 right after the push, 0.0084 after 300 Jacobi sweeps, 0.0010 after 2000, and 0.00016 after one multigrid step ( is the size of a cell). These numbers were measured on the author’s computer; on another graphics device the last digits may differ a little.
Now write the projection as an equation. It subtracts the gradient of the pressure from the provisional velocity, where is the time of one step and the constant density:
The new velocity must have no divergence. Take the divergence of both sides, and you get the equation the pressure must satisfy:
Read the signs. Where the water crowds in, , so is negative too: the pressure is a peak, higher than its neighbours. The push of the pressure points down the gradient, from high pressure to low, so the peak pushes the water outward. Where the water spreads out, the pressure is a hollow instead and draws in the water around it. In the equation of motion, this push is the pressure term:
The experiment’s Jacobi sweeps solve the pressure equation cell by cell. The new pressure of the cell , of side , comes from the last pressures of its four neighbours. A cell next to a wall leaves out the neighbour beyond the wall and divides by the number of neighbours left instead of 4 (by 3 beside one wall, by 2 in a corner).
Side note
In this book’s model, the pressure adjusts everywhere at once, because the density is taken to be constant. That is the same as taking the speed of sound to be infinite. In real water, a change of pressure travels at the speed of sound, about 1500 m/s: very fast, but not infinite. When you shut a tap suddenly and the pipe bangs, the water hammer comes from that finite speed.
A pressure difference starts the flow
Removing divergence and pushing water are one job: a difference in pressure is a force, and it can start water that was at rest. The experiment below is a pipe whose two ends join. Water that leaves through the right end comes back in through the left, like a ring of pipe laid out flat. The water starts at rest. A pump sits in one band of the pipe, and it pushes only the water in its band.
Side note
The pump gives the same kind of push as stirring the water in chapter 0 (the force ), evenly over the full height of the band, at every step. The walls above and below are slip walls, and there is no viscosity. There are 16 384 particles on every device.
The moment the pump starts, all the water in the pipe moves together: water far from the pump starts at the same time. Just in front of the band the pressure is high (orange), and just behind it the pressure is low (sky blue). From the front of the band, around the ring to its back, the pressure falls evenly along the pipe. That pressure difference pushes the water outside the band. On the water inside the band, the pressure pushes backward instead, so the whole pipe shares the pump’s push, and the water speeds up equally everywhere. The plots at the top right show the speed at a point far from the pump and the pressure just in front of the band. The water in the pipe has the same speed everywhere, so outside the band the equation of motion says that the water speeds up as much as the pressure falls along the pipe:
Switch the pump off, and the pressure difference is gone. The water flows on all the same: the pipe has no friction (no viscosity), so nothing slows it. A pressure difference sets not the speed of the water but how fast the speed changes, its acceleration. When the pump pushes the other way, the pressure turns over, high behind the band and low in front. The water slows down everywhere in the pipe at once, and pushed back as hard and as long as it was pushed forward, it stops.
Bernoulli: what the pressure’s work adds up to
Go back to chapter 2’s narrowing channel. The water sped up in the throat. To speed up it needs a push, and now we know what pushes it: a difference in pressure. The pressure in the wide part is higher than in the throat, and the difference pushes the water forward as it enters the throat. Past the throat, where the channel widens, the pressure rises again and slows the water down.
This accounting can be written as an equation. Suppose the flow does not change in time (steady), has no viscosity and has constant density. As a parcel of water moves along one streamline from high pressure to low, the pressure difference does work on it, and its kinetic energy grows by that work. Per unit volume:
So along one streamline the following value is the same everywhere, where is a constant for that streamline:
This is Bernoulli’s equation. It is not a new law: it is the way pressure pushes water (the equation of motion), integrated along one streamline under these conditions. The experiment below puts five pressure gauges on chapter 2’s channel. Each gauge applies the equation to the mean speed of its section and reads the pressure. The sky-blue column is , the outline on top of it is , and with both added, every gauge reaches the same dashed line.
Side note
As in chapter 2, formulas draw this channel’s flow; it solves no equation of motion, so it has no pressure field in two dimensions. The gauges read a one-dimensional Bernoulli equation, with one mean speed for each section. In this channel a section’s mean speed equals the speed along the middle streamline, so this is Bernoulli’s equation along the middle streamline. Only differences of pressure mean anything: the height at which the columns stand comes from setting to 0.11. So every gauge reaching the same dashed line is the result of using the equation, not something this experiment checks on its own. A throat column that almost touches the floor is not a vacuum. The numbers below are the model’s own, without units.
The column is lowest in the throat and comes back to its first height past the throat. With Squeeze at 2, the pressure in the throat is 0.033 below that at the leftmost gauge (chapter 2’s section 1). Turn Squeeze up to 3, and the throat’s speed grows from 0.30 to 0.45, 1.5 times as fast, while the pressure difference grows to 0.089, 2.7 times as large. The difference is , a difference of squares, so it grows faster than the speed: the throat’s alone grows by times, and taking away the leftmost gauge’s share steepens that to 2.7. In a straight channel the speed is the same everywhere, and so are all the columns.
Bernoulli’s equation is often remembered as “faster means lower pressure” and nothing more. But it holds only when all four conditions do: steady, inviscid, incompressible, along one streamline. When one fails, the equation fails. This chapter’s experiments already hold an example. Look at the pipe while the pump runs: the water flows equally fast everywhere in it, yet the pressure falls along it. The same speed with different pressures means that is not the same along the pipe. The flow is not steady: the water is speeding up, and the pressure difference goes into that acceleration. Switch the pump off, let the water flow steadily, and the pressure becomes the same all along the pipe, as Bernoulli’s equation says. Chapter 4 brings another example. Send water steadily through a long pipe of constant width, and in real water the pressure falls along the pipe. The speed is the same everywhere, so by Bernoulli’s equation the pressure should be too; but viscosity holds the water back at the walls, and that always takes a pressure difference. Viscosity is also why, in a real venturi tube, the pressure past the throat does not come all the way back.
In one sentence
Pressure is the force that adjusts everywhere at once so that water of constant density neither crowds together nor thins out, pushing it from high pressure to low; Bernoulli’s equation is the special form this takes along one streamline of a steady, inviscid flow.
Something to think about
Go back to chapter 2’s gorge. A wide river speeds up from 1 m/s to 2 m/s as it enters a gorge. What pushes the water to go faster, and is the pressure in the gorge higher or lower than in the wide river?
Show answer
A difference in pressure pushes it. The pressure in the gorge is lower than in the wide river, and the difference pushes the water into the gorge. In a river, this pressure difference shows as the height of the surface: the surface dips a little as the water enters the gorge. Leaving friction out, Bernoulli’s equation estimates how much, with a term for potential energy added because the height changes. Each kilogram of water gains J of kinetic energy and must give up as much potential energy, so the surface drops by about 15 cm.
Something to think about
A long horizontal pipe is full of water, and a piston at one end suddenly starts to push. The far end is open. When does the water there start to move? Answer for this book’s model and for real water.
Show answer
In this book’s model, at the same moment: with constant density, the pressure adjusts everywhere at once. In real water, a change of pressure travels at the speed of sound, about 1500 m/s, so in a pipe 15 m long the water at the far end starts to move about a hundredth of a second later. To a person, that is as good as the same moment.