VON_KARMAN
Overview
The VON_KARMAN function calculates the Darcy friction factor for flow in rough pipes at the limiting case of infinite Reynolds number. This represents the fully rough turbulent flow regime where pipe roughness dominates the friction characteristics, and viscous effects become negligible.
The von Kármán equation, named after the Hungarian-American physicist and engineer Theodore von Kármán, is derived as the asymptotic limit of the Colebrook equation when Reynolds number approaches infinity. In this regime, the friction factor depends solely on the relative roughness (\varepsilon/D), the ratio of surface roughness height to pipe diameter.
The equation is expressed as:
\frac{1}{\sqrt{f_d}} = -2 \log_{10}\left(\frac{\varepsilon/D}{3.7}\right)
where f_d is the Darcy friction factor and \varepsilon/D is the relative roughness (dimensionless). The constant 3.7 originates from empirical pipe flow studies and represents the characteristic length scale for roughness effects.
This implementation uses the fluids library, an open-source Python package for fluid dynamics calculations. For more details, see the von_Karman documentation.
The von Kármán friction factor is typically applied as a “limiting” value in pipe flow analysis. When a pipe’s roughness is sufficiently high relative to its diameter, the friction factor curve on a Moody diagram becomes horizontal (independent of Reynolds number), and this equation provides that limiting friction factor. This is useful for preliminary pipe sizing calculations, pressure drop estimates in heavily corroded or rough industrial piping, and establishing upper bounds on friction losses.
This example function is provided as-is without any representation of accuracy.
Excel Usage
=VON_KARMAN(eD)
eD(float, required): Relative roughness, [-]
Returns (float): Darcy friction factor, [-], or error message (str) if input is invalid.
Examples
Example 1: Typical commercial pipe roughness
Inputs:
| eD |
|---|
| 0.0001 |
Excel formula:
=VON_KARMAN(0.0001)
Expected output:
0.012
Example 2: Moderate roughness pipe
Inputs:
| eD |
|---|
| 0.001 |
Excel formula:
=VON_KARMAN(0.001)
Expected output:
0.0196
Example 3: Very smooth pipe (small eD)
Inputs:
| eD |
|---|
| 0.00001 |
Excel formula:
=VON_KARMAN(0.00001)
Expected output:
0.0081
Example 4: Very rough pipe (large eD)
Inputs:
| eD |
|---|
| 0.05 |
Excel formula:
=VON_KARMAN(0.05)
Expected output:
0.0716
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.friction import von_Karman as fluids_von_karman
def von_karman(eD):
"""
Calculate Darcy friction factor for rough pipes at infinite Reynolds number from the von Karman equation.
See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.von_Karman
This example function is provided as-is without any representation of accuracy.
Args:
eD (float): Relative roughness, [-]
Returns:
float: Darcy friction factor, [-], or error message (str) if input is invalid.
"""
try:
eD = float(eD)
except (ValueError, TypeError):
return "Error: Could not convert eD to float."
if eD <= 0:
return "Error: eD must be positive."
try:
result = fluids_von_karman(eD=eD)
if result != result: # Check for NaN
return "nan"
if result == float("inf"):
return "inf"
if result == float("-inf"):
return "-inf"
return float(result)
except Exception as e:
return f"Error computing von_karman: {str(e)}"