Internal Flow & Pipe Losses | Fluid Mechanics with Python | Skill-Lync Resources

50% OFF - Ends Soon!

Lesson 7 of 13 35 min

Internal Flow & Pipe Losses

Every water supply network, oil pipeline, and HVAC duct loses energy to friction. Sizing the pump that pushes fluid through kilometres of pipe — or that fails to — comes down to one calculation: the head loss. Underestimate it and the flow never arrives; overestimate it and you waste energy and money.

This lesson covers laminar versus turbulent flow, the Darcy-Weisbach equation, the Colebrook and Swamee-Jain friction-factor formulas, minor losses, and series/parallel networks — all solved in Python.

Laminar vs Turbulent: The Reynolds Number

The character of pipe flow is set by the Reynolds number based on diameter:

Sponsored

Ranjith switched from IT to core automotive industry

His inspiring career transition story with video

See His Journey

$$Re = \frac{\rho V D}{\mu} = \frac{V D}{\nu}$$

RegimeReynolds numberBehaviour
Laminar$Re < 2300$smooth, orderly layers
Transitional$2300 < Re < 4000$intermittent, unpredictable
Turbulent$Re > 4000$chaotic mixing, eddies

Entrance Length

Flow needs distance to develop a steady velocity profile after entering a pipe. The hydrodynamic entrance length $L_e$:

$$\frac{L_e}{D} \approx 0.06\,Re \quad\text{(laminar)}, \qquad \frac{L_e}{D} \approx 4.4\,Re^{1/6} \quad\text{(turbulent)}$$

Sponsored

Srinithin now works at Xitadel as Design Engineer

Mechanical engineering graduate turned automotive designer

See His Journey

Turbulent flow develops far quicker — typically within 10–40 diameters.

Hagen-Poiseuille: Laminar Flow

For fully developed laminar flow, the velocity profile is parabolic and the pressure drop follows the Hagen-Poiseuille law:

$$Q = \frac{\pi D^4 \Delta p}{128\, \mu L}, \qquad V_{avg} = \frac{V_{max}}{2}$$

Sponsored

70% of India's auto industry trusts Skill-Lync

For training their engineers in CAD, CAE & simulation

Learn More

This is one of the few exact analytical results in fluid mechanics.

🎯 3,000+ Engineers Placed
Sponsored
Harshal Sukenkar

Harshal

Fiat Chrysler

Abhishek

Abhishek

TATA ELXSI

Srinithin

Srinithin

Xitadel

Ranjith

Ranjith

Core Automotive

Gaurav Jadhav

Gaurav

Automotive Company

Bino K Biju

Bino

Design Firm

Aseem Shrivastava

Aseem

EV Company

Puneet

Puneet

Automotive Company

Vishal Kumar

Vishal

EV Startup

Darcy-Weisbach Head Loss

The workhorse for all regimes is the Darcy-Weisbach equation:

$$h_f = f \,\frac{L}{D}\,\frac{V^2}{2g}$$

where $f$ is the Darcy friction factor. The pressure drop is $\Delta p = \rho g h_f$. Everything hinges on finding $f$.

Laminar Friction Factor

For laminar flow, $f$ comes directly from Hagen-Poiseuille:

$$f = \frac{64}{Re}$$

Turbulent: The Colebrook Equation

For turbulent flow, $f$ depends on both $Re$ and relative roughness $\varepsilon/D$ through the implicit Colebrook equation:

$$\frac{1}{\sqrt{f}} = -2\log_{10}\!\left(\frac{\varepsilon/D}{3.7} + \frac{2.51}{Re\,\sqrt{f}}\right)$$

Because $f$ appears on both sides, it must be solved iteratively — exactly what the Moody chart plots graphically.

MaterialRoughness $\varepsilon$ (mm)
Drawn tubing (copper)0.0015
Commercial steel0.045
Galvanized iron0.15
Cast iron0.26
Concrete0.3 – 3.0

Solving Colebrook in Python

import numpy as np
from scipy.optimize import brentq

def colebrook(Re, eps_D):
    """Darcy friction factor from the implicit Colebrook equation."""
    if Re < 2300:
        return 64.0 / Re
    def residual(f):
        return 1/np.sqrt(f) + 2*np.log10(eps_D/3.7 + 2.51/(Re*np.sqrt(f)))
    return brentq(residual, 1e-4, 0.1)

for Re, eps_D in [(3000, 0.0), (1e5, 0.0002), (1e6, 0.001), (1e7, 0.05)]:
    f = colebrook(Re, eps_D)
    print(f"Re = {Re:>9.0f}, eps/D = {eps_D:<7}: f = {f:.5f}")
Output:
Re =      3000, eps/D = 0.0    : f = 0.04331
Re =    100000, eps/D = 0.0002 : f = 0.01935
Re =   1000000, eps/D = 0.001  : f = 0.01971
Re =  10000000, eps/D = 0.05   : f = 0.07187

Swamee-Jain: An Explicit Formula

Iteration is overkill for quick work. The Swamee-Jain correlation gives $f$ directly within about 1% of Colebrook for $5\times10^3 < Re < 10^8$:

$$f = \frac{0.25}{\left[\log_{10}\!\left(\dfrac{\varepsilon/D}{3.7} + \dfrac{5.74}{Re^{0.9}}\right)\right]^2}$$

import numpy as np

def swamee_jain(Re, eps_D):
    return 0.25 / (np.log10(eps_D/3.7 + 5.74/Re**0.9))**2

for Re, eps_D in [(1e5, 0.0002), (1e6, 0.001), (1e7, 0.05)]:
    f_sj = swamee_jain(Re, eps_D)
    f_cb = colebrook(Re, eps_D)
    err  = 100*(f_sj - f_cb)/f_cb
    print(f"Re={Re:.0e}, eps/D={eps_D:<6}: SJ={f_sj:.5f}, "
          f"Colebrook={f_cb:.5f}, err={err:+.2f}%")
Output:
Re=1e+05, eps/D=0.0002: SJ=0.01941, Colebrook=0.01935, err=+0.31%
Re=1e+06, eps/D=0.001 : SJ=0.01978, Colebrook=0.01971, err=+0.36%
Re=1e+07, eps/D=0.05  : SJ=0.07191, Colebrook=0.07187, err=+0.06%

Reproducing the Moody Chart

The Moody chart plots $f$ versus $Re$ for a family of $\varepsilon/D$ curves. We can regenerate it from the equations above.

import numpy as np
import matplotlib.pyplot as plt

Re = np.logspace(np.log10(2300), 8, 400)
roughnesses = [0.0, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2]

plt.figure(figsize=(10, 6))
# Laminar line
Re_lam = np.linspace(600, 2300, 50)
plt.loglog(Re_lam, 64/Re_lam, 'k--', lw=2, label='Laminar 64/Re')

for eps_D in roughnesses:
    f = np.array([swamee_jain(r, eps_D) for r in Re])
    plt.loglog(Re, f, lw=1.5, label=f'eps/D = {eps_D:g}')

plt.xlabel('Reynolds number, Re')
plt.ylabel('Darcy friction factor, f')
plt.title('Moody Chart (reproduced)')
plt.grid(True, which='both', alpha=0.3)
plt.legend(fontsize=8)
plt.show()

The laminar line drops as $64/Re$; the turbulent curves flatten to constant values (the fully rough regime) at high $Re$, where $f$ no longer depends on viscosity.

Minor Losses

Fittings, bends, valves, and entrances each add a loss proportional to velocity head:

$$h_m = K \,\frac{V^2}{2g}$$

FittingLoss coefficient $K$
Sharp entrance0.5
Well-rounded entrance0.04
Exit (to reservoir)1.0
90 elbow (regular)0.9
90 elbow (long radius)0.6
Gate valve (open)0.15
Globe valve (open)10
Tee (line flow)0.4

Total head loss is the sum of friction (major) and fitting (minor) losses: $h_L = h_f + \sum h_m$.

Series and Parallel Pipes

  • Series: same flow rate, head losses add. $Q = Q_1 = Q_2$, $\;h_L = h_{L1} + h_{L2}$.
  • Parallel: same head loss across each branch, flows add. $h_{L1} = h_{L2}$, $\;Q = Q_1 + Q_2$.

Complete Pipe Calculation: Pump Head

Let's size the pump for a real pipeline raising water through an elevation with friction and fittings.

import numpy as np

# Given
rho, mu, g = 1000.0, 1.0e-3, 9.81
D   = 0.10            # pipe diameter (m)
L   = 250.0          # pipe length (m)
eps = 0.045e-3       # commercial steel roughness (m)
Q   = 0.012          # flow rate (m^3/s)
dz  = 18.0           # static lift (m)
K_fittings = 0.5 + 4*0.9 + 0.15 + 1.0   # entrance + 4 elbows + valve + exit

A  = np.pi/4 * D**2
V  = Q / A
Re = rho*V*D/mu
f  = swamee_jain(Re, eps/D)

hf = f * (L/D) * V**2/(2*g)            # major loss
hm = K_fittings * V**2/(2*g)           # minor loss
H_pump = dz + hf + hm                  # required pump head

P_hydraulic = rho*g*Q*H_pump
P_shaft     = P_hydraulic / 0.75       # 75% pump efficiency

print(f"Velocity      = {V:.2f} m/s")
print(f"Reynolds      = {Re:.3e}  (turbulent)")
print(f"Friction f    = {f:.4f}")
print(f"Major loss hf = {hf:.2f} m")
print(f"Minor loss hm = {hm:.2f} m")
print(f"Pump head     = {H_pump:.2f} m")
print(f"Shaft power   = {P_shaft/1e3:.2f} kW")
Output:
Velocity      = 1.53 m/s
Reynolds      = 1.528e+05  (turbulent)
Friction f    = 0.0204
Major loss hf = 6.07 m
Minor loss hm = 0.55 m
Pump head     = 24.62 m
Shaft power   = 4.83 kW

The static lift is 18 m, but friction and fittings push the required pump head to nearly 25 m — friction is over a third of the job.

Common Pitfalls

  • Using $f = 64/Re$ in turbulent flow. The laminar formula only holds below $Re \approx 2300$.
  • Confusing Darcy and Fanning friction factors. $f_{Darcy} = 4 f_{Fanning}$; the $64/Re$ form is Darcy.
  • Dropping minor losses in short pipes with many fittings — they can dominate.
  • Wrong roughness units. $\varepsilon$ and $D$ must be in the same units before forming $\varepsilon/D$.
  • Forgetting elevation. Pump head must cover static lift plus total head loss, not just friction.

Key Takeaways

  • Reynolds number sets the regime: laminar below 2300, turbulent above 4000.
  • Darcy-Weisbach $h_f = f\frac{L}{D}\frac{V^2}{2g}$ governs friction loss in every regime.
  • Friction factor: $f = 64/Re$ laminar; Colebrook (implicit) or Swamee-Jain (explicit) for turbulent.
  • Minor losses $h_m = K\frac{V^2}{2g}$ add up across fittings; series flows add head, parallel flows share head.
  • Required pump head = static lift + major + minor losses, then divide by efficiency for shaft power.

Next, we leave the pipe wall and study the boundary layer that creates this friction in the first place.

3,000+ Engineers Placed in Top Companies
Career Growth

3,000+ Engineers Placed in Top Companies

Join the ranks of successful engineers at Bosch, Tata, L&T, and 500+ hiring partners.