§ 3.3  Module 3 — Head Loss: Friction

Colebrook, Swamee-Jain, and Choosing f

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

  • Solve Colebrook-White iteratively and check the residual
  • State the validity range of the explicit approximation and its error there
  • Choose a method appropriate to the accuracy the design needs

§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.

3.3.1The friction factor is a root, not a formula

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.

10⁴ 10⁵ 10⁶ 10⁷ 10⁸ Reynolds number 10⁻³ 10⁻⁴ 10⁻⁵ 10⁻⁶ value of the term rough-wall term (ε/D)/3.7 = 2.81×10⁻⁴ — flat, no Re smooth-wall term 2.51/(Re√f) terms equal, Re = 5.8×10⁴ — the knee Re = 6.3×10⁵: smooth term is 10% of rough → f within 2.4% of plateau this lesson's 60 L/s case, Re = 2.7×10⁵
Figure 3.3.1 — The two terms inside Colebrook's logarithm, for a 250 mm main at ε = 0.26 mm (ε/D = 1.04×10⁻³). The rough-wall term is flat because it has no Reynolds number in it. Where the falling smooth-wall term crosses it, at Re = 5.8×10⁴, is the knee of the Moody chart; where it has fallen to a tenth, at Re = 6.3×10⁵, f is within 2.4% of the fully-rough plateau and Reynolds number has effectively stopped mattering.

3.3.2Solving it, and the residual that proves you did

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.

Swamee-Jain is within 1.2% of Colebrook where you design, and 3% where you should notquirk

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.

What to do

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.

3.3.3The explicit fit, and the window it was fitted in

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:

Relative roughness for a 250 mm main against Swamee-Jain's ε/D ≤ 10−2 bound. ε values from src/core/hydraulics.js.
Wallε, mmε/D at 250 mmInside the fit's window?
PVC / HDPE0.00156.0×10−6yes, near the lower bound
steel, new0.0451.8×10−4yes
ductile iron, cement lined0.104.0×10−4yes
ductile iron, unlined0.261.04×10−3yes
cast iron, aged1.506.0×10−3yes, but near the upper bound
concrete, rough3.001.2×10−2no — 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.

3.3.4The error surface, measured

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.

  • Across the municipal design range — Re ≥ 105, ε/D from 10−5 to 10−2 — the worst deviation is +0.91%, at Re = 105 with ε/D = 2.3×10−3. Under one per cent everywhere a force main operates.
  • Across the full stated validity — Re from 5×103 to 108, ε/D from 10−6 to 10−2 — the worst is +2.83%, at Re = 5×103 with ε/D = 10−2: both bounds biting simultaneously.
  • The error is not one-signed. On a 250 mm main at 60 L/s the fit reads high by 0.58% on cement-lined ductile iron, 0.71% on unlined, 0.42% on aged cast iron — but low by 0.58% on PVC or HDPE, where ε/D is 6.0×10−6.

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.

3.3.5Choosing a method for the accuracy the design needs

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.

What each choice is worth on one pipe: 60 L/s, 250 mm, 600 m, straight pipe only. Computed with headLossDarcy.
ChoiceHead loss range, mSpread, mTimes the method gap
Iterate Colebrook to 10−7 or to 10−123.815 – 3.8150.000
Colebrook root vs Swamee-Jain fit3.815 – 3.8420.027
Water at 25 °C vs 5 °C3.777 – 3.8720.0963.5×
ε = 0.10 mm vs 0.26 mm (one material, as-built band)3.252 – 3.8150.56321×
ε = 0.10 mm vs 1.50 mm (lined new vs aged cast iron)3.252 – 5.9292.67798×

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:

  1. Design calculations and checks: iterate Colebrook and report the residual. It is two Newton steps. There is no case for approximating something that costs two lines of arithmetic, and the residual is free evidence.
  2. Inside a loop — a system curve evaluated at 200 flows, a network solve, an optimiser — the explicit fit is fine, provided you write down the window you actually swept. Re ≥ 105 with 10−5 ≤ ε/D ≤ 10−2 buys you under 1%; carry the lower bound down to the fit's own ε/D = 10−6 and the worst case becomes 1.14%, at Re = 9.5×107. Two different sentences, and only the one you swept is yours to quote — but ask §3.3.4's question of that corner before you worry about it: ε/D = 10−6 on new plastic means a 1.5 m main, and Re = 9.5×107 in a 1.5 m main is 72 m/s. Swept across every PVC duty point a station actually runs — 0.6 to 3 m/s, 50 to 2000 mm — the worst is 0.68%. State the window, then check whether its bad corner is anywhere you can stand.
  3. By hand, or checking someone else's number: the Moody chart, two significant figures. More precision than the roughness deserves, and it catches order-of-magnitude errors faster than anything else.
  4. Fully rough, past the knee of Figure 3.3.1: the closed form 1/√f = 2·log10(D/ε) + 1.1364, which is Colebrook's own fully-rough limit, 2log10(3.7). No iteration and no window — Reynolds number has dropped out of the physics, not been approximated away. The additive constant has not: Nikuradse's published +1.14 is the sand-grain fit of the history note above, and it puts f about 0.1% below every other number in this lesson. Pick one and say which.
  5. Below Re 4000: none of the above. Laminar flow is f = 64/Re exactly, from Hagen-Poiseuille. Between 2000 and 4000 nothing is predictable and the honest output is a range, as §3.1 argued. Both explicit fits are silent there and will still return a number if you ask.

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.