CD_HAIDER_LEV
Overview
Calculate drag coefficient of a sphere using the Haider-Levenspiel correlation.
Excel Usage
=CD_HAIDER_LEV(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 200
Inputs:
| Re |
|---|
| 200 |
Excel formula:
=CD_HAIDER_LEV(200)
Expected output:
| Result |
|---|
| 0.796 |
Example 2: Reynolds number of 1000
Inputs:
| Re |
|---|
| 1000 |
Excel formula:
=CD_HAIDER_LEV(1000)
Expected output:
| Result |
|---|
| 0.4535 |
Example 3: Reynolds number of 10000
Inputs:
| Re |
|---|
| 10000 |
Excel formula:
=CD_HAIDER_LEV(10000)
Expected output:
| Result |
|---|
| 0.4204 |
Example 4: Reynolds number of 100
Inputs:
| Re |
|---|
| 100 |
Excel formula:
=CD_HAIDER_LEV(100)
Expected output:
| Result |
|---|
| 1.0947 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.drag import Haider_Levenspiel as fluids_Haider_Levenspiel
def cd_haider_lev(Re):
"""
Calculate drag coefficient of a sphere using the Haider-Levenspiel correlation.
See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.Haider_Levenspiel
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.
"""
# Validate Reynolds number
try:
Re = float(Re)
except (ValueError, TypeError):
return "Error: Re must be a number."
if Re <= 0:
return "Error: Re must be positive."
try:
result = fluids_Haider_Levenspiel(Re=Re)
if result != result: # NaN check
return "Calculation resulted in NaN."
return float(result)
except Exception as e:
return f"Error: {str(e)}"