BEJAN
Overview
The BEJAN function calculates the Bejan number, a dimensionless quantity used in thermodynamics and heat transfer to characterize the ratio of pressure-drop-driven irreversibility to heat-transfer-driven irreversibility. Named after Adrian Bejan, this number appears in analyses of convective heat transfer and porous media flow.
This implementation uses the fluids library and supports two formulations. The length-based Bejan number (Be_L) relates the pressure drop across a characteristic length to thermal diffusion properties:
Be_L = \frac{\Delta P \cdot L^2}{\mu \cdot \alpha}
The permeability-based Bejan number (Be_p) is used for porous media applications, substituting permeability K for length:
Be_p = \frac{\Delta P \cdot K}{\mu \cdot \alpha}
where \Delta P is the pressure drop (Pa), L is the characteristic length (m), K is the permeability (m²), \mu is the dynamic viscosity (Pa·s), and \alpha is the thermal diffusivity (m²/s).
The Bejan number quantifies the relative importance of fluid friction irreversibility in heat transfer processes. Higher values indicate that pressure-drop effects dominate over thermal diffusion. This dimensionless group is useful for optimizing heat exchanger designs and analyzing convective flows in porous media. For further details, see the fluids documentation and the foundational reference: Awad, M. M., “The Science and the History of the Two Bejan Numbers,” International Journal of Heat and Mass Transfer 94 (2016): 101–103.
This example function is provided as-is without any representation of accuracy.
Excel Usage
=BEJAN(bejan_type, dP, L_or_K, mu, alpha)
bejan_type(str, required): Calculation type for Bejan number (length-based or permeability-based)dP(float, required): Pressure drop in Pascals (Pa)L_or_K(float, required): Characteristic length (m) for length-based or permeability (m²) for permeability-basedmu(float, required): Dynamic viscosity in Pa·salpha(float, required): Thermal diffusivity in m²/s
Returns (float): Bejan number (float), or error message string.
Examples
Example 1: Demo case 1
Inputs:
| bejan_type | dP | L_or_K | mu | alpha |
|---|---|---|---|---|
| length | 10000 | 1 | 0.001 | 0.000001 |
Excel formula:
=BEJAN("length", 10000, 1, 0.001, 0.000001)
Expected output:
10000000000000
Example 2: Demo case 2
Inputs:
| bejan_type | dP | L_or_K | mu | alpha |
|---|---|---|---|---|
| permeability | 10000 | 1 | 0.001 | 0.000001 |
Excel formula:
=BEJAN("permeability", 10000, 1, 0.001, 0.000001)
Expected output:
10000000000000
Example 3: Demo case 3
Inputs:
| bejan_type | dP | L_or_K | mu | alpha |
|---|---|---|---|---|
| length | 500 | 0.5 | 0.002 | 0.00001 |
Excel formula:
=BEJAN("length", 500, 0.5, 0.002, 0.00001)
Expected output:
6250000000
Example 4: Demo case 4
Inputs:
| bejan_type | dP | L_or_K | mu | alpha |
|---|---|---|---|---|
| permeability | 2000 | 0.05 | 0.005 | 0.00002 |
Excel formula:
=BEJAN("permeability", 2000, 0.05, 0.005, 0.00002)
Expected output:
1000000000
Python Code
import micropip
await micropip.install(["fluids"])
from fluids import core as fluids_core
def bejan(bejan_type, dP, L_or_K, mu, alpha):
"""
Compute the Bejan number (length-based or permeability-based).
See: https://fluids.readthedocs.io/fluids.core.html#dimensionless-numbers
This example function is provided as-is without any representation of accuracy.
Args:
bejan_type (str): Calculation type for Bejan number (length-based or permeability-based) Valid options: Length, Permeability.
dP (float): Pressure drop in Pascals (Pa)
L_or_K (float): Characteristic length (m) for length-based or permeability (m²) for permeability-based
mu (float): Dynamic viscosity in Pa·s
alpha (float): Thermal diffusivity in m²/s
Returns:
float: Bejan number (float), or error message string.
"""
# Validate bejan_type parameter
if not isinstance(bejan_type, str):
return "Error: bejan_type must be a string."
bejan_type_lower = bejan_type.lower()
if bejan_type_lower not in ["length", "permeability"]:
return "Error: bejan_type must be 'length' or 'permeability'."
# Validate and convert numeric parameters
try:
dP = float(dP)
L_or_K = float(L_or_K)
mu = float(mu)
alpha = float(alpha)
except (TypeError, ValueError):
return "Error: dP, L_or_K, mu, and alpha must be numeric."
# Check for physical validity
if mu <= 0:
return "Error: mu (dynamic viscosity) must be positive."
if alpha <= 0:
return "Error: alpha (thermal diffusivity) must be positive."
# Calculate Bejan number based on type
try:
if bejan_type_lower == "length":
return fluids_core.Bejan_L(dP, L_or_K, mu, alpha)
else: # permeability
return fluids_core.Bejan_p(dP, L_or_K, mu, alpha)
except (ZeroDivisionError, ValueError, TypeError) as e:
return f"Error: Failed to calculate Bejan number: {str(e)}"
except Exception as e:
return f"Error: {str(e)}"