MOODY
Computes Darcy friction factor using the Moody (1947) explicit correlation from Reynolds number and relative roughness. This is a historical approximation for turbulent pipe flow that gives a direct algebraic estimate without iterating the Colebrook equation.
The form implemented is:
f_d = 1.375\times 10^{-3}\left[1 + \left(2\times10^4\frac{\epsilon}{D} + \frac{10^6}{Re}\right)^{1/3}\right]
It is intended for turbulent straight-pipe calculations within the usual published range of the approximation.
Excel Usage
=MOODY(Re, eD)
Re(float, required): Reynolds number, [-]eD(float, required): Relative roughness, [-]
Returns (float): Darcy friction factor from the Moody explicit correlation [-]
Example 1: Smooth pipe (eD=0) at high Reynolds number
Inputs:
| Re | eD |
|---|---|
| 100000 | 0 |
Excel formula:
=MOODY(100000, 0)
Expected output:
0.0173494
Example 2: Smooth pipe (eD=0) at lower Reynolds number
Inputs:
| Re | eD |
|---|---|
| 10000 | 0 |
Excel formula:
=MOODY(10000, 0)
Expected output:
0.0310287
Example 3: Rough pipe with typical relative roughness
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.0001 |
Excel formula:
=MOODY(100000, 0.0001)
Expected output:
0.0180919
Example 4: Pipe with higher relative roughness
Inputs:
| Re | eD |
|---|---|
| 50000 | 0.005 |
Excel formula:
=MOODY(50000, 0.005)
Expected output:
0.0326283
Python Code
Show Code
from fluids.friction import Moody as fluids_moody
def moody(Re, eD):
"""
Calculate Darcy friction factor using the Moody (1947) correlation.
See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.Moody
This example function is provided as-is without any representation of accuracy.
Args:
Re (float): Reynolds number, [-]
eD (float): Relative roughness, [-]
Returns:
float: Darcy friction factor from the Moody explicit correlation [-]
"""
try:
Re = float(Re)
eD = float(eD)
if Re <= 0:
return "Error: Reynolds number must be positive."
if eD < 0:
return "Error: Relative roughness must be non-negative."
result = fluids_moody(Re=Re, eD=eD)
if result != result:
return "Error: Result is NaN."
if result == float('inf') or result == float('-inf'):
return "Error: Result is not finite."
return float(result)
except Exception as e:
return f"Error: {str(e)}"