CD_BARATI_HIGH
Overview
Calculate drag coefficient of a sphere using the Barati high-Re correlation (valid to Re=1E6).
Excel Usage
=CD_BARATI_HIGH(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_BARATI_HIGH(200)
Expected output:
| Result |
|---|
| 0.7731 |
Example 2: Reynolds number of 10000
Inputs:
| Re |
|---|
| 10000 |
Excel formula:
=CD_BARATI_HIGH(10000)
Expected output:
| Result |
|---|
| 0.4109 |
Example 3: Reynolds number of 100000
Inputs:
| Re |
|---|
| 100000 |
Excel formula:
=CD_BARATI_HIGH(100000)
Expected output:
| Result |
|---|
| 0.467 |
Example 4: High Reynolds number (500000)
Inputs:
| Re |
|---|
| 500000 |
Excel formula:
=CD_BARATI_HIGH(500000)
Expected output:
| Result |
|---|
| 0.0924 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.drag import Barati_high as fluids_Barati_high
def cd_barati_high(Re):
"""
Calculate drag coefficient of a sphere using the Barati high-Re correlation (valid to Re=1E6).
See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.Barati_high
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_Barati_high(Re=Re)
if result != result: # NaN check
return "Calculation resulted in NaN."
return float(result)
except Exception as e:
return f"Error: {str(e)}"