SWAMEE_JAIN

Computes Darcy friction factor with the Swamee-Jain explicit equation using Reynolds number and relative roughness for turbulent pipe flow. This correlation is a common alternative to iterative Colebrook calculations when a closed-form engineering approximation is preferred.

The implemented expression is:

\frac{1}{\sqrt{f_d}} = -4\log_{10}\left[\left(\frac{6.97}{Re}\right)^{0.9} + \frac{\epsilon}{3.7D}\right]

It is intended for turbulent straight-pipe applications within the published validity range of the correlation.

Excel Usage

=SWAMEE_JAIN(Re, eD)
  • Re (float, required): Reynolds number, [-]
  • eD (float, required): Relative roughness (roughness/diameter), [-]

Returns (float): Darcy friction factor from the Swamee-Jain equation [-]

Example 1: Smooth pipe with low Reynolds number

Inputs:

Re eD
10000 0.000001

Excel formula:

=SWAMEE_JAIN(10000, 0.000001)

Expected output:

0.0309738

Example 2: Smooth pipe with high Reynolds number

Inputs:

Re eD
100000 0.0001

Excel formula:

=SWAMEE_JAIN(100000, 0.0001)

Expected output:

0.0184524

Example 3: Rough pipe

Inputs:

Re eD
50000 0.01

Excel formula:

=SWAMEE_JAIN(50000, 0.01)

Expected output:

0.0394639

Example 4: Very rough pipe at upper eD limit

Inputs:

Re eD
1000000 0.05

Excel formula:

=SWAMEE_JAIN(1000000, 0.05)

Expected output:

0.0716069

Python Code

Show Code
from fluids.friction import Swamee_Jain_1976 as fluids_swamee_jain

def swamee_jain(Re, eD):
    """
    Calculate Darcy friction factor using the Swamee-Jain (1976) equation.

    See: https://fluids.readthedocs.io/fluids.friction.html#fluids.friction.Swamee_Jain_1976

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

    Args:
        Re (float): Reynolds number, [-]
        eD (float): Relative roughness (roughness/diameter), [-]

    Returns:
        float: Darcy friction factor from the Swamee-Jain equation [-]
    """
    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_swamee_jain(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)}"

Online Calculator

Reynolds number, [-]
Relative roughness (roughness/diameter), [-]