The Continuity Equation: Derivation
Mass is neither created nor destroyed — written for a fluid, that single sentence becomes the continuity equation. These notes derive both the differential and the one-dimensional engineering forms.
Fluid Mechanics · Module 3 · Conservation Laws
1. Control-volume statement
Fix a small box dx·dy·dz in the flow. Mass flux through the pair of x-faces is (ρu) evaluated at x and at x+dx; their difference, per unit volume, is ∂(ρu)/∂x, and likewise in y and z. Whatever net mass flows out must come from a decrease of mass inside:
No assumptions beyond the continuum hypothesis — this holds for every fluid, compressible or not, viscous or not.
2. The incompressible form
If density is constant following the fluid (Dρ/Dt = 0), the equation collapses to the constraint used throughout this site:
Geometrically: the velocity field has zero divergence — fluid elements deform but never change volume. This is what closes the incompressible Navier–Stokes system: four unknowns (u, v, w, p), three momentum equations, and continuity as the fourth.
3. The one-dimensional engineering form
Integrate over a stream tube with inlet area A₁ and outlet A₂ in steady flow: mass in = mass out, so ρ₁A₁v₁ = ρ₂A₂v₂. For a liquid,
Halve the area and the velocity doubles — the reason a river races through a gorge and a syringe jets. Compute cases with the continuity velocity calculator.
Key takeaway
Continuity is not a force law; it is pure bookkeeping. It supplies the kinematic constraint that pressure then enforces dynamically.
4. Extended worked examples
Example 1 — pipe contraction. Water flows at v₁ = 2 m/s in a D₁ = 10 cm pipe that necks to D₂ = 5 cm. Areas scale as diameter squared, so A₁/A₂ = 4 and v₂ = 4 × 2 = 8 m/s. The flow rate is Q = A₁v₁ = π(0.05)²×2 = 1.571×10⁻² m³/s ≈ 15.7 L/s, identical on both sides — that constancy is the equation.
Example 2 — the circulatory paradox. The aorta (r ≈ 1.25 cm, A ≈ 4.9 cm²) carries blood at ~0.3 m/s. Capillaries are far narrower individually, yet blood there crawls at ~0.5 mm/s. No contradiction: there are billions of capillaries and their combined cross-section is ~0.25 m² — 500× the aorta's. Continuity uses the total area, and the slowdown is functional: exchange of oxygen needs time. The velocities recover in the veins as the total area contracts again.
Example 3 — filling a tank (unsteady form). A tank of base area 2 m² is fed 0.01 m³/s and drains 0.004 m³/s. Mass balance on the tank as control volume: d(ρV)/dt = ρ(Q_in − Q_out) → dh/dt = (0.01−0.004)/2 = 0.003 m/s = 3 mm/s of rising level. The differential equation of the notes is this bookkeeping shrunk to a point.
Example 4 — is this velocity field possible? Test u = 3x²y, v = −3xy² (2-D, incompressible). ∂u/∂x = 6xy; ∂v/∂y = −6xy; sum = 0 ✓ — a legitimate incompressible field. Now test u = x², v = y²: divergence = 2x + 2y ≠ 0 — impossible for constant density; no fluid can move that way without creating or destroying mass. Continuity is the admissions exam every proposed velocity field must pass.
5. Common misconceptions
"Narrower always means faster." True along a single conduit at fixed Q. False across parallel networks (Example 2) and false if Q itself changes (a partly closed valve reduces Q; velocity downstream may drop even where the pipe narrows).
"Continuity involves pressure." It contains no forces at all — it is pure mass bookkeeping. Pressure enters through the momentum equation; continuity merely constrains what velocity fields are allowed. In incompressible solvers, pressure's actual mathematical job is to be the Lagrange multiplier that enforces ∇·u = 0.
"∇·u = 0 means the fluid doesn't deform." It means volumes are preserved; shape can distort arbitrarily. A fluid element in shear flattens and stretches wildly at zero divergence.
"Incompressible means constant density everywhere." Strictly it means density is constant following each particle (Dρ/Dt = 0). Stratified oceans and atmospheres have ρ varying in space while each parcel keeps its own density — ∇·u = 0 still holds.
6. Where this shows up
Every nozzle, jet engine intake and rocket throat is a continuity calculation before it is anything else; in compressible form (ρAv = const) it produces the counterintuitive supersonic result that area must increase to accelerate flow past Mach 1 — the de Laval nozzle's diverging bell. HVAC engineers size ducts by it; river hydrologists gauge discharge by measuring area and mean velocity at a section; traffic engineers use the identical equation (cars conserved) to predict jam waves. In numerical fluid dynamics, enforcing discrete continuity is the central difficulty of incompressible solvers — the projection/pressure-Poisson methods that dominate CFD exist to satisfy this one equation.
7. Practice problems
P1. A garden hose (D = 19 mm) delivers 12 L/min. Exit nozzle D = 6 mm. Find both velocities. Solution: Q = 2×10⁻⁴ m³/s; A_hose = 2.84×10⁻⁴ m² → v = 0.71 m/s; A_noz = 2.83×10⁻⁵ → v = 7.1 m/s.
P2. Air enters a heater at 20 °C, 3 m/s through 0.2 m² and leaves at 60 °C through the same area. Exit velocity? (p ≈ const, ideal gas.) Solution: ρ ∝ 1/T; ρ₁v₁ = ρ₂v₂ → v₂ = v₁T₂/T₁ = 3 × 333/293 = 3.41 m/s — compressible continuity in its gentlest form.
P3. For 2-D incompressible flow with u = 4x + y, find the most general v. Solution: ∂v/∂y = −4 → v = −4y + g(x) for arbitrary g.
P4. A syringe barrel (D = 12 mm) is pressed at 5 mm/s; the needle bore is 0.4 mm. Jet speed? Solution: ratio (12/0.4)² = 900 → v = 4.5 m/s.
8. Going deeper
In two dimensions, ∇·u = 0 guarantees the existence of a stream function ψ(x, y) with u = ∂ψ/∂y, v = −∂ψ/∂x — continuity is then satisfied identically, one unknown replaces two, and level curves of ψ are the streamlines themselves. This is exactly the move that launches the Blasius and stretching-sheet reductions. The same structure generalises: axisymmetric flows have a Stokes stream function; magnetostatics has a vector potential because ∇·B = 0. Whenever physics hands you a divergence-free field, a potential is waiting behind it.
9. Historical context
Leonardo da Vinci wrote the one-dimensional version in his notebooks around 1500 — observing that where a river narrows it runs faster, in proportion — a century and a half before calculus existed to generalise it. The differential equation is Euler's, from his great 1757 memoirs founding fluid dynamics, and d'Alembert had a version for special cases shortly before. The equation's form — a time derivative of a density plus the divergence of a flux — turned out to be one of the most transferable templates in science: charge conservation in electromagnetism (Maxwell leaned on it to discover the displacement current), probability conservation in quantum mechanics, energy conservation in general relativity, car conservation in traffic models. Fluid mechanics wrote it first; everyone else photocopied.
10. Another way to see it: the divergence theorem route
The box-counting derivation of §2 has an elegant coordinate-free twin. Take any fixed region V with surface S. Mass inside changes only by flow through the boundary:
Apply the divergence theorem to the right side, pull the time derivative inside the fixed-volume integral, and gather:
Since V is arbitrary, the bracket must vanish pointwise — the continuity equation, with the localisation argument doing the honest work. This derivation shows exactly which assumptions matter (fields smooth enough for the divergence theorem; nothing else) and generalises instantly: any conserved stuff with density q and flux F obeys ∂q/∂t + ∇·F = 0. It also reveals what shock waves are mathematically: surfaces where smoothness fails and the integral form outlives the differential one — which is why computational gas dynamics is built on the integral (finite-volume) statement.
11. Frequently asked questions
Water is slightly compressible — why is ∇·u = 0 legitimate? Density changes matter when pressure variations approach the bulk modulus (2.2 GPa for water) or velocities approach sound speed (1 480 m/s). Ordinary hydraulics sits at 10⁻⁴ of both; the incompressible model errs in parts per ten thousand. Exceptions are named and dramatic: water hammer, cavitation collapse.
Air is very compressible — why do fans and cars use ∇·u = 0 anyway? Compressibility is activated by speed, not by squishiness alone: density variations scale like Ma². At 30 m/s, Ma ≈ 0.09 and Δρ/ρ ≈ 0.4% — negligible. The engineering rule "incompressible below Mach 0.3" is this estimate institutionalised.
Does continuity determine the flow? No — one scalar equation for three velocity components. It is a constraint; momentum (Navier–Stokes) supplies the dynamics. The pair is a differential-algebraic system, and pressure is the multiplier enforcing the constraint — why incompressible solvers all contain a pressure-Poisson step.
What happens at a free surface or a moving wall? Continuity holds in the fluid; boundaries contribute kinematic conditions (fluid velocity normal to a wall equals the wall's normal velocity). Filling a balloon does not violate ∇·u = 0 inside the air — the boundary moves.
12. Further practice
P5. An axisymmetric flow has radial velocity u_r = C/r (r > 0), u_θ = u_z = 0. Check continuity (cylindrical: (1/r)∂(ru_r)/∂r = 0). Solution: ru_r = C, derivative zero ✓ — a line source/sink flow; the 1/r decay is exactly what mass conservation demands from cylindrical spreading.
P6. Ventilation: a 6 m × 5 m × 3 m room must exchange its air 8 times per hour through a 0.3 m × 0.4 m duct. Duct velocity? Solution: Q = 90×8/3600 = 0.20 m³/s; v = 0.20/0.12 = 1.67 m/s — comfortably below noise-limit speeds; continuity as HVAC sizing.
P7. In a converging nozzle, air accelerates from 100 m/s (ρ = 1.10) at A₁ = 0.02 m² to ρ = 0.95 at A₂ = 0.012 m². Find v₂. Solution: ρ₁A₁v₁ = ρ₂A₂v₂ → v₂ = 1.10×0.02×100/(0.95×0.012) = 193 m/s — compressible continuity one step before full gas dynamics takes over.
13. Worked exam problem
Problem. A distribution manifold: water enters a D = 8 cm main at 3 m/s and splits equally into three D = 4 cm branches. (a) Total flow rate? (b) Velocity in each branch? (c) One branch is then valved shut; what happens to the other two if the supply holds Q constant?
Solution. (a) A_main = π(0.04)² = 5.03×10⁻³ m²; Q = 3×5.03×10⁻³ = 1.51×10⁻² m³/s ≈ 15.1 L/s. (b) Each branch carries Q/3 = 5.03×10⁻³ m³/s through A_b = π(0.02)² = 1.257×10⁻³ m²: v_b = 4.0 m/s — faster than the main despite carrying a third of the flow, because area fell by three-quarters. (c) Continuity redistributes: two branches now carry Q/2 = 7.54×10⁻³ each, v = 6.0 m/s — a 50% velocity jump with pressure-drop consequences (∝ v² in turbulent lines) that the momentum equation, not continuity, then prices. Mass bookkeeping first; dynamics second — the correct order of every pipe-network analysis.
14. Key takeaways
Continuity is conservation of mass localised: ∂ρ/∂t + ∇·(ρu) = 0 in general, ∇·u = 0 for incompressible flow, ρAv = const along a stream tube. It contains no forces — it is the constraint every legitimate velocity field must satisfy, the equation pressure exists to enforce in incompressible solvers, and the template (density plus divergence of flux) that all of physics reuses.
15. Where to go next
Pair it with momentum in Navier–Stokes; combine it with energy along a streamline in Bernoulli; and watch its 2-D stream function launch the similarity reductions. The continuity velocity calculator does area–velocity trades with live steps.