Flows and fields

Mass has nowhere to go

Squeeze a stream of fluid and it speeds up, not because anything pushes it but because the same amount has to get through a smaller gap every second. Almost every result in the subject is that observation with more machinery attached.

Put a thumb over the end of a hose and the water comes out faster. Nothing pushed it harder — the tap did not change. The same water per second has to get through a smaller hole, so it goes through faster.

That is mass conservation, and almost everything else in this subject is that observation with machinery attached.

A streamtube narrows and the flow speeds upTwo neighbouring streamlines bound a tube that no fluid crosses. Where the tube pinches, the same mass has to pass through a smaller gap every second, so it must move faster — which is mass conservation with no equations in sight.0.871.330.85ideal flow — incompressible, so the tube's area sets the speed
Fig. 1 Two neighbouring streamlines bound a tube that no fluid crosses. Where the tube pinches, the flow inside it must speed up, and the numbers on the figure are measured from the solved field.

The streamtube

The useful construction is a streamtube: take a closed curve in the flow, follow the streamlines through every point of it, and the surface they sweep out is a tube.

Its defining property is that nothing crosses its wall. Velocity is tangent to a streamline by definition, so it is tangent to the tube’s surface, so no fluid passes through. It is a pipe with no pipe — a boundary made of the flow itself.

That makes the accounting trivial. Whatever mass enters one end must leave the other, because there is nowhere else for it to go.

ρ1A1U1=ρ2A2U2\rho_1 A_1 U_1 = \rho_2 A_2 U_2

Density times area times speed, the same at both ends. For a liquid, or for air below about a third of the speed of sound, the density is effectively constant and it cancels:

A1U1=A2U2A_1 U_1 = A_2 U_2

Narrow the tube and the speed goes up in exact proportion.

Why the tube narrows at all

A fair question: why does a streamtube narrow near a body if nothing is squeezing it?

Because the body is in the way. The flow that would have gone through the space the body occupies has to go somewhere, and it goes round — which crowds the streamlines near the body’s widest point and spreads them again downstream.

So the narrowing is not a cause of anything; it is a consequence of the body’s presence, and the speed-up is a consequence of the narrowing. The chain runs shape → streamtube geometry → speed → pressure, by Bernoulli, and it is worth keeping in that order.

Reversing it produces the constriction story about wings, which fails for the reason that there is no upper wall: near a wing the streamtube’s shape is what the solution has to determine, not something that can be assumed from the geometry.

The hose, done carefully

The hose is worth taking seriously rather than as a slogan, because the careful version reveals what the simple version assumes.

Covering half the outlet does not halve the flow rate. If it did, the water would emerge at the same speed through half the area, and nothing would have changed except the quantity.

What actually happens is that the flow rate falls somewhat and the speed rises a great deal. The supply is not a fixed flow rate but a fixed pressure upstream, and the system finds the flow rate at which the pressure drop through the restriction matches what is available.

So continuity alone does not settle the hose. It says that whatever the flow rate turns out to be, the speed at the outlet is that rate divided by the area — which is a relation between two unknowns rather than an answer.

Getting the answer needs the momentum equation as well, and that is the general pattern: continuity constrains, and dynamics decides. A great deal of confusion in elementary fluid mechanics comes from expecting continuity to do both jobs.

Where the speeding-up shows up

Three cases worth having in mind, because they are the same relation wearing different clothes.

Round a body. The streamtubes near the widest point are narrowed by the body’s presence and the flow there is fastest — twice the free-stream speed at the shoulders of a cylinder in ideal flow, which is a number continuity and symmetry give between them.

Through a nozzle. A deliberately narrowing duct, where the same relation is being used on purpose. Below the speed of sound, narrower means faster; above it, remarkably, the sign reverses and a supersonic nozzle must widen to accelerate.

Into a wake. Behind a bluff body the streamtubes have widened, so the flow there is slow — and the slow-moving deficit is the visible signature of the drag the body produced.

The third is worth noticing because it runs the relation backwards: instead of using the geometry to predict the speed, it uses the measured speed deficit to work out what the body did.

The differential form

The tube version is intuitive and the local version is what the equations use.

At a point, mass conservation says the net rate at which fluid leaves a small volume is zero:

u=0\nabla \cdot \mathbf{u} = 0

The divergence of the velocity is zero everywhere. That is the incompressible continuity equation, and it is a constraint on the velocity field with no time in it at all — it must hold at every instant, steady or not.

It is also the single most useful thing to check about a computed flow, and it is the first assertion this site runs on every field: if the divergence is not zero, the field is not a flow. Fluid is appearing or disappearing somewhere, and no amount of smooth streamlines will make it physical.

What the solver computed

lib/flow.js checks divergence on every field before any figure is drawn, by finite differences over a grid covering the domain.

For the exact potential flow past a cylinder, the worst divergence anywhere is 3.3×1083.3 \times 10^{-8} — which is the finite-difference truncation error rather than a property of the field, since the analytic solution is divergence-free identically.

For the viscous solver, mass conservation is structural rather than checked: the velocity is computed as the curl of a streamfunction, and the divergence of a curl is zero by construction. That was a deliberate choice of formulation. A pressure-projection scheme would have needed the divergence driven to zero by iteration at every timestep, and would have spent the entire build doing it.

So on this site, mass conservation is either asserted numerically or made impossible to violate, and never assumed.

What incompressible actually assumes

The word is misleading. It does not mean the fluid cannot be compressed — air obviously can — but that in this flow it is not being compressed enough to matter.

The relevant comparison is between the flow speed and the speed at which pressure information travels, which is the speed of sound. If the flow is slow compared with that, pressure changes propagate away and even out before density can respond much.

The threshold in practice is around Mach 0.3, where density variations reach about five percent. Below it, treating density as constant is a good approximation; above it, density becomes a variable and the whole treatment changes.

Which means “incompressible” is not a property of the fluid at all. It is a property of the flow, and the same air is incompressible round a cyclist and very much not round a propeller tip.

Mach number: one number, four different flowsMach number is speed ÷ speed of sound. It is not a property of the fluid or of the shape but of the combination, and crossing a threshold changes the physics rather than the magnitude.incompressiblecompressible, subsonictransonicsupersonica cyclistdensity starts to matteran airliner cruisingshock waves everywhereMach numberspeed ÷ speed of soundMachthe ratio decides the regime, not the size or the speed alone
Fig. 2 Where the assumption holds. Below about a third of the speed of sound the density is effectively constant; above it, the continuity equation needs its full form back.

Compressible, and what changes

It is worth seeing what the full version looks like, because it makes clear what was thrown away.

702149\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{u}) = 0702149

Density can now change with time and can vary from place to place, and it travels with the flow. Set it constant and the first term vanishes, the density comes out of the divergence, and what is left is the incompressible statement.

The consequences of keeping it are not small. Density becomes an unknown, so an equation of state and an energy equation are needed to close the system — three equations become five. The equations change character from elliptic to hyperbolic as the flow goes supersonic, which means disturbances stop travelling upstream and shocks become possible.

So the constant-density shortcut is not a minor simplification. It removes half the machinery of gas dynamics, and it is available for the majority of flows anybody meets — which is a very good bargain and one worth knowing the price of.

The consequences that follow

Continuity on its own, with no dynamics at all, already settles a surprising amount.

A narrowing duct accelerates flow, which is the venturi, the carburettor and the nozzle.

Flow cannot simply stop in an incompressible fluid; it must go somewhere. This is why blocking part of a pipe accelerates the rest of it rather than reducing the total flow proportionally.

A source and a sink of equal strength produce a closed body shape, which is the basis of an entire family of ideal flow constructions.

Two-dimensional incompressible flow has a streamfunction. Because the divergence vanishes, the velocity can be written as the curl of a single scalar, and the whole two-component vector field reduces to one function. That is a large simplification and it is why the viscous solver here works in those variables.

Measuring drag by counting what is missing

The wake case is not just an illustration; it is a standard measurement technique, and it is the clearest demonstration that these conservation laws are worth something practically.

Draw a control volume round a body: a plane well upstream, a plane well downstream, and sides far enough out that nothing crosses them. Momentum in through the front, momentum out through the back, and the difference is the force on the body.

Upstream everything is moving at the free-stream speed. Downstream everything is too, except in the wake, where it is slower. So the momentum leaving is less than the momentum entering by exactly the deficit integrated across the wake — and that deficit is the drag.

The measurement is a probe traversed across the wake behind a body, recording the velocity profile. No force balance, no strain gauges, nothing touching the model. Just an accounting of what went in and what came out, and the difference is the answer.

That technique works because mass and momentum genuinely have nowhere to go, which is the whole content of this essay.

Flow past a cylinder at Re 100A real fluid past a circular cylinder. At low Reynolds number the flow closes up behind the body much as the ideal theory says; as it rises the flow separates and a region of reversed flow appears behind, which is where drag comes from.separatedrecirculation 1.16 Dviscous flow, solved on a coarse grid — the bubble is under-resolvedRe = 100
Fig. 3 The deficit itself. The slow region behind the body is the momentum the body took out of the flow, and integrating it across the wake gives the drag directly.
What the ideal theory predicts, and what happensThe same cylinder, the same free stream. On the left the exact inviscid solution, closing up behind the body and exerting no drag at all. On the right the real flow at the same conditions, separated, with a wake and therefore with drag.ideal flow — closes up, no dragreal flow at Re 100 — separatedleft: exact closed form · right: solved on a gridRe = 100
Fig. 4 And why the ideal flow has none. On the left every streamtube that narrowed has widened again by the same amount, the velocity profile downstream is identical to the one upstream, and the momentum accounting balances exactly — which is d’Alembert’s paradox in yet another form.

Why this is the first thing to check

A closing observation about the ordering of the subject.

Mass conservation is the least glamorous of the conservation laws and the one worth applying first, because it is the cheapest and it is the one that most often fails silently. Momentum and energy are harder to check and are usually wrong in ways that show up eventually; a field with non-zero divergence is wrong immediately and invisibly.

It is also the only one that can be checked without knowing anything about the forces. Given a velocity field and nothing else — no pressures, no viscosity, no body — divergence is computable and decisive.

That combination of cheap, decisive and independent of everything else is why it heads the list of assertions in this site’s solver, and why every figure here has had it applied before anything was drawn.

Where the model stops

Constant density is an approximation with a stated range, and it is the flow’s property rather than the fluid’s.

Streamtubes are instantaneous objects. In unsteady flow the tube changes shape from moment to moment, so the convenient “pipe with no walls” picture is a statement about one instant — which is the same caution the three curves need.

Continuity gives no forces. It constrains the velocity field and says nothing about pressure until a momentum equation is brought in.

The figure’s numbers are from a coarse sampling of the solved field along two streamlines, and are quoted to two figures for that reason.

The check that catches wrong fields fastest

Divergence deserves its own note, because on this site it is the first line of defence and it is cheap.

Take any velocity field, real or invented. Sample it on a grid, estimate u/x+v/y\partial u/\partial x + \partial v/\partial y at each point by finite differences, and look at the largest value. If it is not close to zero, the field is not an incompressible flow — full stop, regardless of how it was produced or how convincing it looks.

The test costs nothing and it catches an entire class of error: a velocity field written down by hand, a solution with a sign wrong in one component, an interpolation that does not preserve the constraint, a field assembled from pieces that do not fit.

What it does not catch is anything about dynamics. A divergence-free field can still be entirely wrong — it can flow through walls, carry the wrong circulation, or satisfy no momentum equation whatsoever. Mass conservation is necessary and nowhere near sufficient, which is why this site runs a tangency check and a lift cross-check as well.

The general shape of that is worth carrying: each conservation law rules out a family of wrong answers, and no single one rules out enough.

The velocity field, arrows to scaleThe same flow drawn as arrows. Scaled to the local speed the picture is honest and crowded; drawn all the same length it is legible and hides the very variation the figure is about.length ∝ speedideal flow past a cylinderfastest 1.91U
Fig. 5 A field that passes the test. Every one of these arrows was computed from a solution whose divergence is zero to eight decimal places, which is a much stronger statement about the picture than its smoothness is.
Ideal flow past a cylinderA uniform stream past a circular cylinder in a fluid with no viscosity. The solution is exact and closed-form: streamlines part at a stagnation point, run round the surface and close up perfectly behind, and the pressure recovers to exactly what it was in front.ideal flow — inviscid, irrotational, steadyno circulation
Fig. 6 And what the constraint buys once it holds: with the velocity field pinned down, the pressure follows from it directly, and the whole field is determined.

Sources, sinks and bodies made of nothing

One consequence deserves singling out because it produces bodies where none were placed.

A source is a point from which fluid emerges in all directions; a sink is one into which it disappears. Neither exists physically, and both satisfy the incompressible equations everywhere except at the singular point itself.

Put a source and an equal sink a short distance apart in a uniform stream, and something remarkable happens: the streamline pattern contains a closed oval, and no fluid crosses it. Everything emitted by the source is swallowed by the sink, and everything else flows round the outside as though a solid body were there.

There is no body. There is an arrangement of singularities whose combined flow happens to have a closed dividing streamline, and the flow outside it is indistinguishable from flow past a solid oval of that shape.

Move the source and sink together, keeping their product constant, and the oval becomes a circle — which is the doublet the cylinder figures on this site are built from. Distribute sources and sinks along a line and almost any shape can be produced, which is the basis of an entire family of ideal-flow constructions.

Who worked it out, and when

Continuity in the streamtube form is old — Leonardo da Vinci wrote it down in the form “a river of uniform depth will have more rapid flow at the narrower section”, which is exactly right and was four centuries early.

The differential form belongs to Euler, in the 1750s, as part of the first general equations of fluid motion. Those equations were complete, correct, and unsolvable for almost anything of practical interest, which is a recurring theme: this subject has had the right equations for two hundred and fifty years and spent most of that time unable to do anything with them.

The ladder from here

Nearby: the streamfunction and what it buys; sources and sinks, and the bodies they generate; the material derivative; and the full compressible continuity equation.

Then across to Bernoulli, which is what happens when momentum is added to this, and to the Mach number, which decides whether the constant-density shortcut is available at all.