HAGEN
Excel Usage
=HAGEN(Re, fd)
Re(float, required): Reynolds number [-]fd(float, required): Darcy friction factor [-]
Returns (float): Hagen number [-]
Examples
Example 1: VDI example with Re=2610, fd=1.935235
Inputs:
| Re | fd |
|---|---|
| 2610 | 1.935235 |
Excel formula:
=HAGEN(2610, 1.935235)
Expected output:
6591507.17175
Example 2: Laminar flow case
Inputs:
| Re | fd |
|---|---|
| 100 | 0.64 |
Excel formula:
=HAGEN(100, 0.64)
Expected output:
3200
Example 3: Turbulent flow case
Inputs:
| Re | fd |
|---|---|
| 10000 | 0.03164 |
Excel formula:
=HAGEN(10000, 0.03164)
Expected output:
1582000
Example 4: High friction factor case
Inputs:
| Re | fd |
|---|---|
| 5000 | 0.5 |
Excel formula:
=HAGEN(5000, 0.5)
Expected output:
6250000
Python Code
from fluids.core import Hagen as fluids_Hagen
def hagen(Re, fd):
"""
Calculate the Hagen number.
See: https://fluids.readthedocs.io/fluids.core.html#fluids.core.Hagen
This example function is provided as-is without any representation of accuracy.
Args:
Re (float): Reynolds number [-]
fd (float): Darcy friction factor [-]
Returns:
float: Hagen number [-]
"""
try:
Re = float(Re)
fd = float(fd)
if Re < 0:
return "Error: Reynolds number Re must be non-negative"
if fd < 0:
return "Error: Darcy friction factor fd must be non-negative"
result = fluids_Hagen(Re, fd)
return float(result)
except (TypeError, ValueError) as e:
return f"Error: Invalid input - {str(e)}"
except Exception as e:
return f"Error: {str(e)}"