§ 3.3 Module 3 — Head Loss: Friction
The friction factor is not a number you compute. It is the number that makes an equation balance — and it will tell you, if you ask, how nearly it balanced.
By the end of this lesson
§3.2 left you reading f off a chart. The chart is a picture of an equation, the equation carries f on both sides of the equals sign, and no rearrangement frees it. That one fact generates everything here: an iteration to solve it, explicit fits to dodge the iteration, folklore about how good the fits are, and a choice of which to use. The choice turns out to be nearly the least consequential decision you will make about the pipe — but you cannot know that until the alternatives are measured in metres.
The equation behind the Moody chart is Colebrook-White:
1/√f = −2 · log₁₀( (ε/D)/3.7 + 2.51/(Re·√f) )
↑ ↑
rough-wall term smooth-wall term
(no Re in it) (no roughness in it)
Colebrook-White. Everything is dimensionless: f is the Darcy friction factor, Re the Reynolds number, ε/D the relative roughness.
f is on both sides, and that is not an algebraic accident to be tidied away. The equation is a deliberate sum of two limits, each of which is explicit on its own. Delete the roughness term — set ε/D to zero — and what remains rearranges to 1/√f = 2·log10(Re√f) − 0.79935: Prandtl's smooth-pipe law, published with the constant −0.8. Colebrook's 2.51 is 100.4 = 2.51189 rounded, shifting that constant by 0.08% and f by under 0.03% — 0.022% at Re = 4×103, easing to 0.010% by 108. That is the whole disagreement between the two. Now delete the smooth-wall term instead, letting Re run to infinity: 1/√f = 2·log10(D/ε) + 1.1364, the von Kármán–Nikuradse fully-rough law, published with +1.14 (matching which exactly would need 3.7154 in place of 3.7). Both ends are closed forms. The implicitness lives only in the transition between them.
Which end you are near is settled by which of the two terms is larger, and that is the same question as "which region of the Moody chart am I in". The rough-wall term is a constant — no Re appears in it. The smooth-wall term falls away roughly as 1/Re. For a 250 mm main at ε = 0.26 mm the rough term is fixed at 2.81×10−4; the two are equal at Re = 5.8×104, and by Re = 6.3×105 the smooth term has fallen to a tenth of it and f is within 2.4% of its plateau. That crossover is the knee of the chart.
Substitute x = 1/√f and it becomes an ordinary root find: g(x) = x + 2·log10((ε/D)/3.7 + 2.51x/Re) = 0, with f = 1/x². Two schemes are in common use, and they are not equally good.
Successive substitution. Guess f, evaluate Colebrook's right-hand side, take that as the new f, repeat. It converges, because the right-hand side is very insensitive to f — but slowly. From a blind f₀ = 0.02 on the pipe below the residual runs 3.6×10−3, 8.4×10−5, 2.0×10−6, 4.6×10−8, 1.1×10−9: about 1.6 decimal digits a pass. Swept over Re from 4×103 to 109 and ε/D from 10−6 to 2×10−2, the worst case needs 13 passes to reach 10−9.
Newton on x. Step x ← x − g(x)/g′(x), with g′(x) = 1 + 2(2.51/Re) / (ln10 · ((ε/D)/3.7 + 2.51x/Re)). This works absurdly well, for a reason worth knowing: written in x, the residual is almost exactly a straight line. On the pipe below its slope is 1.0235 and its curvature, as a central second difference over a whole unit of x, is −6.3×10−4. Newton on a straight line lands on the root in one step. Over the same grid, seeded from the explicit fit of §3.3.3, the worst case is two steps.
Q = 0.060 m³/s D = 0.250 m L = 600 m ε = 0.26 mm t = 15 °C
A = πD²/4 = 0.049087 m²
v = Q/A = 1.2223 m/s
ν (15 °C) = 1.1370×10⁻⁶ m²/s
Re = vD/ν = 2.688×10⁵ — firmly turbulent
ε/D = 0.26/250 = 1.04×10⁻³
seed (Swamee-Jain) f = 0.021016 x = 6.89799 g = −2.51×10⁻²
step 1 f = 0.0208675 x = 6.92253 g = −1.91×10⁻⁷
step 2 f = 0.0208675 x = 6.92253 g = 0 (to double precision)
v²/2g = 0.076175 m
hf = f · (L/D) · v²/2g = 0.0208675 × 2400 × 0.076175 = 3.815 m
The worked case this lesson keeps returning to. 60 L/s in 250 mm unlined ductile iron, 600 m, water at 15 °C. Computed with src/core/hydraulics.js.
Notice what the middle block reports. Not "converged" but a residual: the number you get by putting the answer back into the equation and seeing how badly it fails to balance. That is the only honest evidence you solved anything, and it costs one line. Report it beside f.
The failure this prevents
Two ways to produce a friction factor that is wrong and looks exactly like one that is right. The first is a loop with a fixed pass count and no convergence test at all, which returns an unremarkable-looking 0.0209 whether it converged or not. The second is subtler and more common: testing |Δf| between passes instead of |g|. A crawling iteration produces small steps precisely because it is crawling, so a step-size test declares success at the moment the method is performing worst. Both read identically to a correct answer on the page, which is why they survive review. A residual does not: it is either tiny or it is not.
Sand grains, commercial pipe, and a chart drawn to avoid arithmetic
In 1933 Johann Nikuradse, in Göttingen, published Strömungsgesetze in rauhen Rohren as VDI-Forschungsheft 361 — pipes artificially roughened with graded sand grains, glued on so the roughness height was known. His data gave clean smooth-wall and fully-rough laws and, between them, a transition with a characteristic dip. Real pipe does not do that, because commercial roughness is not uniform: the tallest grains reach out of the viscous sublayer long before the average ones do, so the transition is gradual.
Cyril Frank Colebrook and Cedric Masey White, at Imperial College London, measured that difference on non-uniformly roughened pipes: Experiments with fluid friction in roughened pipes, Proceedings of the Royal Society A, volume 161, 1937. Two years later Colebrook alone proposed the formula that carries both names, in Turbulent flow in pipes, with particular reference to the transition region between the smooth and rough pipe laws, Journal of the Institution of Civil Engineers, volume 11, 1939 — and was explicit that it was an interpolation between the two limits, not a derivation.
Because it could not be solved at a desk, Lewis Ferry Moody plotted it: Friction factors for pipe flow, Transactions of the ASME, volume 66, 1944, credited by Moody to Colebrook's equation. Four decades on the constraint had moved from the desk to the computer, where a chart is awkward and an iteration is inconvenient inside a loop, and the explicit fits arrived: Prabhata K. Swamee and Akalank K. Jain, Explicit equations for pipe-flow problems, Journal of the Hydraulics Division of the ASCE, volume 102, 1976; and S. E. Haaland, Simple and explicit formulas for the friction factor in turbulent pipe flow, Journal of Fluids Engineering, volume 105, 1983. Each artefact answered the cost of arithmetic in its own decade. A Newton step now costs nothing measurable; the artefacts remain in use, and so does the folklore around them.
Colebrook-White is implicit and needs iteration; Swamee-Jain is the explicit
approximation everyone actually uses. The usual claim is "within 1%", which is
true in the region that matters and false at the edges. Measured across the error
surface, as a fraction of the Colebrook root: for Re ≥ 10⁵ and
relative roughness from 10⁻⁵ to 10⁻² — the whole municipal design range — the
worst disagreement is 0.81% in friction factor, at
Re = 10⁵, ε/D = 0.005. Extend down to Re = 5×10³, just
above the laminar transition, and the worst case grows to 2.83%,
at the double corner of low Re and very rough pipe.
The denominator matters and is worth stating: divide the same disagreement by the approximation instead of by the root and you get 2.75%, not 2.83%. Error is measured against what is true, not against the thing being tested. This course's own verifier had it the wrong way round until an author computing the figure independently disagreed with it by exactly that much.
A 3% error in f is a 3% error in hf, which is usually far inside the uncertainty of your C-factor or roughness estimate. The reason to know the number is not to correct for it, it is to know that the approximation is not where your error is coming from.
Use Swamee-Jain for design and stop apologising for it. If you are near the laminar transition — thick sludge, chemical feed lines, very low flow — iterate Colebrook properly, because you are also near the point where the whole turbulent-flow framework stops applying.
Swamee-Jain replaces the iteration with one evaluation:
f = 0.25 / [ log₁₀( (ε/D)/3.7 + 5.74/Re^0.9 ) ]²
↑ ↑
unchanged from 2.51/(Re·√f) with the
Colebrook f folded into an exponent
Swamee-Jain (1976). Compare it term by term with Colebrook above.
The rough-wall term is Colebrook's, untouched, which is why the two agree exactly in the fully-rough limit. The whole approximation — and the whole error — is in the second term: the f inside 2.51/(Re√f) is absorbed into the exponent 0.9. Swamee and Jain fitted that exponent and coefficient over a stated window, and the window is part of the formula, not a footnote: 5×103 ≤ Re ≤ 108 and 10−6 ≤ ε/D ≤ 10−2. That is the window as it is usually quoted, and the provenance is worth stating plainly: it reaches you through textbooks and software documentation rather than off the 1976 page, and secondary accounts do not all state the rough end identically. The bound is load-bearing in everything below, so name the statement of it you relied on — and then measure the deviation where you actually are, which is the only figure that settles anything.
The roughness bound is the one that catches people, because ε/D depends on diameter and small pipes are rough pipes. The §3.2 roughness table, resolved against a 250 mm main:
| Wall | ε, mm | ε/D at 250 mm | Inside the fit's window? |
|---|---|---|---|
| PVC / HDPE | 0.0015 | 6.0×10−6 | yes, near the lower bound |
| steel, new | 0.045 | 1.8×10−4 | yes |
| ductile iron, cement lined | 0.10 | 4.0×10−4 | yes |
| ductile iron, unlined | 0.26 | 1.04×10−3 | yes |
| cast iron, aged | 1.50 | 6.0×10−3 | yes, but near the upper bound |
| concrete, rough | 3.00 | 1.2×10−2 | no — just past the ε/D bound |
Swamee-Jain is not the only explicit fit in service. Haaland's 1983 form is at least as common in software, and comparing them is more useful than picking a favourite: measured against the iterated root over the same window, Haaland's worst deviation is 1.42%, at Re = 8.3×104 with ε/D = 2.5×10−4 — worse than Swamee-Jain mid-range, and far better at the rough corner where Swamee-Jain is at its worst (0.09% against 2.83%). Neither dominates. State which fit you used and what its error is where you used it, rather than being loyal to one.
Interactive 3D instrument
Two roads to f — solve the implicit equation, or accept the fit
A 3D instrument you drive yourself, one variable at a time. It needs JavaScript and WebGL, so it is not shown in this static copy of the page.
Define the error as (ffit − froot) / froot — signed, so the direction stays visible. Swept densely, the surface has a clear shape: the fit is at its best at high Reynolds number and degrades toward low Re and high roughness, which is to say toward the corners of its own window.
That last point kills a convenient argument. "The explicit fit is conservative, so any error is on the safe side" is true on iron and false on plastic: near ε/D = 10−6 the fit under-predicts f, and so under-predicts head loss, by about half a per cent. Small, but not conservative — and a claim of conservatism that fails in one region is worth less than no claim.
It is worth asking where the bad corner physically is. Two litres per second in a 250 mm rough concrete main gives Re = 9.0×103 and ε/D = 1.2×10−2, and the fit is 2.25% off — but the velocity there is 0.041 m/s, fifteen times below the 0.6 m/s self-cleansing floor of §1.3. That is not a design condition; it is a main that has stopped working. In normal service the corner is reachable only in small bore: a 50 mm sample or chemical-feed line at 0.5 L/s runs at Re = 1.1×104, and on an aged cast iron wall its ε/D is 3×10−2 — three times the roughness bound, where the quoted error covers nothing and the only figure you have is the one you measure. Measured: the fit reads high by 1.80% there. Past a fit's window the answer is not "invalid", it is unquantified until you sweep it yourself.
So do not quote "Swamee-Jain is within 1% of Colebrook" as a general fact, which is how it is usually passed on. It is true where force mains live and false at the corner, and the gap between those two claims is the gap between a number you measured and one you inherited.
Per cents on f are not decisions. Metres are. Because f enters Darcy-Weisbach linearly, a 0.71% error in f is a 0.71% error in head loss: on the worked pipe the choice of method is worth 3.842 m against 3.815 m, 27 mm. On a station with 20 m of static lift the total dynamic head is 23.8 m, of which 27 mm is 0.11% — at 60 L/s, 16 W of water power out of 14.0 kW. Now price the other assumptions in the same units.
| Choice | Head loss range, m | Spread, m | Times the method gap |
|---|---|---|---|
| Iterate Colebrook to 10−7 or to 10−12 | 3.815 – 3.815 | 0.000 | 0× |
| Colebrook root vs Swamee-Jain fit | 3.815 – 3.842 | 0.027 | 1× |
| Water at 25 °C vs 5 °C | 3.777 – 3.872 | 0.096 | 3.5× |
| ε = 0.10 mm vs 0.26 mm (one material, as-built band) | 3.252 – 3.815 | 0.563 | 21× |
| ε = 0.10 mm vs 1.50 mm (lined new vs aged cast iron) | 3.252 – 5.929 | 2.677 | 98× |
The bottom row is the design decision; the second row is not. Choosing ε moves this answer by 2.677 m — 82%, or 1.57 kW of water power — roughly a hundred times what choosing between an exact root and a good fit moves it. Temperature is worth three times the method choice, and Darcy-Weisbach carries it free through ν in the Reynolds number. Given that ranking, the answer to "which method" is almost embarrassingly relaxed:
One habit carries all of this: in the calculation, write the ε you assumed, the temperature you assumed, and the residual you achieved. Two are judgements and the third is a fact, and keeping them visibly separate is how you avoid this subject's characteristic artefact — a friction factor reported to six figures from a roughness known to one.
What this lesson has not accounted for: not one fitting. Every number above is straight pipe, and inside a station the elbows, valves and header routinely lose more head than the pipe does — Module 4. Nor is ε a constant; it moves over the design life (§3.5), which is why the 98× row is a range and not a number. Hazen-Williams, still the water-industry default and carrying its own unit trap, is §3.4. And the pump remains what it has been since Module 1: a black box supplying whatever head the system demands. Module 6 asks whether one exists that will.
Check your understanding
Check your understanding
3 auto-graded questions with an explanation for every wrong answer. Requires JavaScript. (m3-l3-q1)
Lab 3.3
Solve Colebrook, and prove you solved it
Write two functions. Together they are the friction calculation you will actually reuse at work. solveColebrook(re, relRough, maxSteps = 40) returns an object: f — the Darcy friction factor, dimensionless. Assume turbulent flow (Re ≥ 4000); you do not have to handle the laminar branch. residual — the imbalance of the Colebrook equation at your answer, defined exactly as 1/√f + 2·log10((ε/D)/3.7 + 2.51/(Re·√f)) . If you have solved it, this is essentially zero — and that is precisely why a test taken at a converged answer cannot tell an honest residual from a hard-coded 0 : at the root both are noise in the last bits. So one test stops you short of the root with maxSteps and checks the number you report against the equation at the f you returned. Use the constant 2.51 exactly , as Colebrook published it and as the starter shows — the nearby 2.5119 = 10 0.4 solves a very slightly different equation, and your residual would then be reported against an equation you did not solve. steps — how many iterations you actually took, and maxSteps is the ceiling on them. Called as solveColebrook(re, relRough, 1) you take exactly one iteration and report the f and the residual you have after that one step , converged or not. Uncapped, the tests only check the count is between 1 and 40, so Newton and successive substitution both pass. frictionLossM(qM3s, dM, lengthM, roughnessM) returns the Darcy-Weisbach friction head loss in metres, using solveColebrook . Water at 15 °C: win.NU_15 is the kinematic viscosity in m²/s and win.G is standard gravity. Two hints worth more than the code. First, Math.log10 is base ten, which is what Colebrook uses — Math.log is natural and will be wrong by a factor of 2.303. Second, iterate on x = 1/√f rather than on f: the residual is almost a straight line in x, so Newton converges in two steps from any sane start. Graded in the browser against 8 assertions; the editor and harness require JavaScript.
Solve the equation, report the residual, and then spend your remaining doubt on the roughness — which is where all of it belongs.