CD_STOKES

Overview

Calculate drag coefficient of a sphere using Stokes law (Cd = 24/Re).

Excel Usage

=CD_STOKES(Re)
  • Re (float, required): Particle Reynolds number [-]

Returns (float): Drag coefficient [-], or error message (str) if input is invalid.

Examples

Example 1: Reynolds number of 0.1

Inputs:

Re
0.1

Excel formula:

=CD_STOKES(0.1)

Expected output:

240

Example 2: Reynolds number of 0.01

Inputs:

Re
0.01

Excel formula:

=CD_STOKES(0.01)

Expected output:

2400

Example 3: Upper validity limit (Re = 0.3)

Inputs:

Re
0.3

Excel formula:

=CD_STOKES(0.3)

Expected output:

80

Example 4: Reynolds number of 1 (above valid range)

Inputs:

Re
1

Excel formula:

=CD_STOKES(1)

Expected output:

24

Python Code

from fluids.drag import Stokes as fluids_Stokes

def cd_stokes(Re):
    """
    Calculate drag coefficient of a sphere using Stokes law (Cd = 24/Re).

    See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.Stokes

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

    Args:
        Re (float): Particle Reynolds number [-]

    Returns:
        float: Drag coefficient [-], or error message (str) if input is invalid.
    """
    try:
      Re = float(Re)
      if Re <= 0:
        return "Error: Re must be positive."

      result = fluids_Stokes(Re=Re)
      if result != result:  # NaN check
        return "Error: Calculation resulted in NaN."
      return float(result)
    except (ValueError, TypeError):
      return "Error: Re must be a number."
    except Exception as e:
      return f"Error: {str(e)}"

Online Calculator