CONFINEMENT
Calculates the Confinement number for two-phase flow, relating capillary and buoyancy effects relative to channel size.
Excel Usage
=CONFINEMENT(D, rhol, rhog, sigma, g)
D(float, required): Channel diameter (m)rhol(float, required): Density of liquid (kg/m³)rhog(float, required): Density of gas (kg/m³)sigma(float, required): Surface tension (N/m)g(float, optional, default: 9.80665): Acceleration due to gravity (m/s²)
Returns (float): Confinement number (float), or error message string.
Example 1: Microchannel case with strong confinement
Inputs:
| D | rhol | rhog | sigma | g |
|---|---|---|---|---|
| 0.001 | 1077 | 76.5 | 0.00427 | 9.80665 |
Excel formula:
=CONFINEMENT(0.001, 1077, 76.5, 0.00427, 9.80665)
Expected output:
0.659698
Example 2: Medium channel with moderate density contrast
Inputs:
| D | rhol | rhog | sigma | g |
|---|---|---|---|---|
| 0.002 | 900 | 1.2 | 0.03 | 9.80665 |
Excel formula:
=CONFINEMENT(0.002, 900, 1.2, 0.03, 9.80665)
Expected output:
0.922441
Example 3: Very small channel with strong capillary confinement
Inputs:
| D | rhol | rhog | sigma | g |
|---|---|---|---|---|
| 0.0005 | 1000 | 0.6 | 0.072 | 9.80665 |
Excel formula:
=CONFINEMENT(0.0005, 1000, 0.6, 0.072, 9.80665)
Expected output:
5.42084
Example 4: Large channel with weak confinement effects
Inputs:
| D | rhol | rhog | sigma | g |
|---|---|---|---|---|
| 0.01 | 800 | 1 | 0.002 | 9.80665 |
Excel formula:
=CONFINEMENT(0.01, 800, 1, 0.002, 9.80665)
Expected output:
0.0505221
Python Code
Show Code
from fluids.core import Confinement as fluids_confinement
def confinement(D, rhol, rhog, sigma, g=9.80665):
"""
Calculate the Confinement number (Co) for two-phase flow in a channel.
See: https://fluids.readthedocs.io/fluids.core.html
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Channel diameter (m)
rhol (float): Density of liquid (kg/m³)
rhog (float): Density of gas (kg/m³)
sigma (float): Surface tension (N/m)
g (float, optional): Acceleration due to gravity (m/s²) Default is 9.80665.
Returns:
float: Confinement number (float), or error message string.
"""
try:
D = float(D)
except (ValueError, TypeError):
return "Error: D must be a numeric value."
try:
rhol = float(rhol)
except (ValueError, TypeError):
return "Error: rhol must be a numeric value."
try:
rhog = float(rhog)
except (ValueError, TypeError):
return "Error: rhog must be a numeric value."
try:
sigma = float(sigma)
except (ValueError, TypeError):
return "Error: sigma must be a numeric value."
try:
g = float(g)
except (ValueError, TypeError):
return "Error: g must be a numeric value."
if D <= 0:
return "Error: D must be positive."
if rhol <= 0:
return "Error: rhol must be positive."
if rhog < 0:
return "Error: rhog must be non-negative."
if sigma <= 0:
return "Error: sigma must be positive."
if g <= 0:
return "Error: g must be positive."
if rhol <= rhog:
return "Error: rhol must be greater than rhog."
try:
result = fluids_confinement(D, rhol, rhog, sigma, g)
except Exception as e:
return f"Error: Failed to calculate Confinement number: {str(e)}"
return resultOnline Calculator
Channel diameter (m)
Density of liquid (kg/m³)
Density of gas (kg/m³)
Surface tension (N/m)
Acceleration due to gravity (m/s²)