CLAMOND

Overview

The CLAMOND function calculates the Darcy friction factor f for internal flow in a circular pipe given a Reynolds number Re and a relative roughness eD = \epsilon/D. This friction factor is commonly used with the Darcy–Weisbach relation to estimate pressure drop (or head loss) due to wall shear in pipe networks and process piping.

For turbulent flow, f is often defined implicitly by the Colebrook equation (also called the Colebrook–White relation), which blends hydraulically smooth and fully rough behavior and underpins the classic Moody chart. In one common form:

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

Because f appears on both sides, many spreadsheets use approximations or iterative solvers. This implementation delegates to the Clamond algorithm in the open-source fluids library, which is designed to resolve the Colebrook relation efficiently while retaining near machine-precision accuracy in typical engineering ranges; see the Fluids friction-factor documentation and the original reference by Didier Clamond (doi:10.1021/ie801626g, author PDF).

In practice, once f is known, the straight-pipe frictional pressure drop can be estimated as:

\Delta P = f\,\frac{L}{D}\,\frac{\rho v^2}{2}

where L is pipe length, D is diameter, \rho is density, and v is average velocity. The optional fast mode trades accuracy for speed by reducing the amount of iteration performed.

This example function is provided as-is without any representation of accuracy.

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, [-], or error message (str) if input is invalid.

Examples

Example 1: Standard turbulent flow case

Inputs:

Re eD
100000 0.0001

Excel formula:

=CLAMOND(100000, 0.0001)

Expected output:

0.0185

Example 2: Smooth pipe (very low roughness)

Inputs:

Re eD
100000 0.000001

Excel formula:

=CLAMOND(100000, 0.000001)

Expected output:

0.018

Example 3: Rough pipe (higher roughness)

Inputs:

Re eD
100000 0.01

Excel formula:

=CLAMOND(100000, 0.01)

Expected output:

0.0385

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.0185

Example 5: High Reynolds number flow

Inputs:

Re eD
1000000 0.0001

Excel formula:

=CLAMOND(1000000, 0.0001)

Expected output:

0.0134

Python Code

import micropip
await micropip.install(["fluids"])
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, [-], or error message (str) if input is invalid.
    """
    # Validate and convert Re
    try:
        Re = float(Re)
    except (ValueError, TypeError):
        return "Error: Re must be a number."

    # Validate and convert eD
    try:
        eD = float(eD)
    except (ValueError, TypeError):
        return "Error: eD must be a number."

    # Validate and convert fast
    try:
        fast = bool(fast)
    except (ValueError, TypeError):
        return "Error: fast must be a boolean."

    # Validation: Re must be positive
    if Re <= 0:
        return "Error: Reynolds number must be positive."

    # Validation: eD must be non-negative
    if eD < 0:
        return "Error: Relative roughness must be non-negative."

    try:
        result = fluids_clamond(Re=Re, eD=eD, fast=fast)

        # Handle NaN and infinity values
        if result != result:  # NaN check
            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 clamond: {str(e)}"

Online Calculator