HAALAND
Computes Darcy friction factor with the Haaland explicit approximation from Reynolds number and relative roughness. This correlation is widely used because it avoids an iterative Colebrook solve while still providing good engineering accuracy over its published range.
The approximation is:
f_d = \left[-1.8\log_{10}\left(\left(\frac{\epsilon/D}{3.7}\right)^{1.11} + \frac{6.9}{Re}\right)\right]^{-2}
It is best suited to turbulent flow in straight pipes.
Excel Usage
=HAALAND(Re, eD)
Re(float, required): Reynolds number, [-]eD(float, required): Relative roughness, [-]
Returns (float): Darcy friction factor from the Haaland approximation [-]
Example 1: Smooth pipe with small relative roughness
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.0001 |
Excel formula:
=HAALAND(100000, 0.0001)
Expected output:
0.0182651
Example 2: Rough pipe with higher relative roughness
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.01 |
Excel formula:
=HAALAND(100000, 0.01)
Expected output:
0.0385385
Example 3: Lower Reynolds number in valid range
Inputs:
| Re | eD |
|---|---|
| 5000 | 0.001 |
Excel formula:
=HAALAND(5000, 0.001)
Expected output:
0.0386201
Example 4: Upper Reynolds number in valid range
Inputs:
| Re | eD |
|---|---|
| 10000000 | 0.00001 |
Excel formula:
=HAALAND(10000000, 0.00001)
Expected output:
0.00895798
Python Code
Show Code
from fluids.friction import Haaland as fluids_haaland
def haaland(Re, eD):
"""
Calculate Darcy friction factor using the Haaland (1983) approximation.
See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.Haaland
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 Haaland approximation [-]
"""
try:
Re = float(Re)
eD = float(eD)
if Re <= 0:
return "Error: Re must be positive."
if eD < 0:
return "Error: eD must be non-negative."
result = fluids_haaland(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)}"