CLAMOND
Computes Darcy friction factor with the Clamond method, a very accurate explicit solution of the Colebrook equation that is recommended in the fluids library for general use. It uses Reynolds number and relative roughness, with an optional fast mode that trades some precision for speed.
The method solves the same rough-pipe relationship as the Colebrook equation,
\frac{1}{\sqrt{f_d}} = -2\log_{10}\left(\frac{\epsilon/D}{3.7} + \frac{2.51}{Re\sqrt{f_d}}\right)
but does so with an optimized explicit algorithm that is accurate to nearly machine precision over a very wide range of practical conditions.
Excel Usage
=CLAMOND(Re, eD, fast)
Re(float, required): Reynolds number, [-]eD(float, required): Relative roughness (roughness/diameter), [-]fast(bool, optional, default: false): If true, performs single iteration with roughly half the decimals of accuracy, [-]
Returns (float): Darcy friction factor from the Clamond solution [-]
Example 1: Standard turbulent flow case
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.0001 |
Excel formula:
=CLAMOND(100000, 0.0001)
Expected output:
0.0185139
Example 2: Smooth pipe (very low roughness)
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.000001 |
Excel formula:
=CLAMOND(100000, 0.000001)
Expected output:
0.0179952
Example 3: Rough pipe (higher roughness)
Inputs:
| Re | eD |
|---|---|
| 100000 | 0.01 |
Excel formula:
=CLAMOND(100000, 0.01)
Expected output:
0.0385035
Example 4: Fast mode with single iteration
Inputs:
| Re | eD | fast |
|---|---|---|
| 100000 | 0.0001 | true |
Excel formula:
=CLAMOND(100000, 0.0001, TRUE)
Expected output:
0.0185149
Example 5: High Reynolds number flow
Inputs:
| Re | eD |
|---|---|
| 1000000 | 0.0001 |
Excel formula:
=CLAMOND(1000000, 0.0001)
Expected output:
0.0134414
Python Code
Show Code
from fluids.friction import Clamond as fluids_clamond
def clamond(Re, eD, fast=False):
"""
Calculate Darcy friction factor using Clamond's high-precision solution accurate to nearly machine precision.
See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.Clamond
This example function is provided as-is without any representation of accuracy.
Args:
Re (float): Reynolds number, [-]
eD (float): Relative roughness (roughness/diameter), [-]
fast (bool, optional): If true, performs single iteration with roughly half the decimals of accuracy, [-] Default is False.
Returns:
float: Darcy friction factor from the Clamond solution [-]
"""
try:
Re = float(Re)
eD = float(eD)
fast = bool(fast)
if Re <= 0:
return "Error: Reynolds number must be positive."
if eD < 0:
return "Error: Relative roughness must be non-negative."
result = fluids_clamond(Re=Re, eD=eD, fast=fast)
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)}"