Flow Meter
Overview
Flow measurement is fundamental to process control, custody transfer, and safety monitoring across industries from oil and gas to water treatment. While numerous technologies exist—including electromagnetic, ultrasonic, Coriolis, and turbine meters—differential pressure (DP) flow meters remain the most widely deployed in industrial applications due to their simplicity, robustness, standardization, and absence of moving parts.
Differential pressure flow meters operate on Bernoulli’s principle: a deliberate constriction in the flow path increases fluid velocity and creates a measurable pressure drop. Common DP meter types include orifice plates, venturi tubes, and flow nozzles, with orifice plates being the most prevalent due to their low cost and ease of installation. The fundamental relationship between flow rate Q and pressure drop \Delta P is:
Q = C_d A_t \sqrt{\frac{2 \Delta P}{\rho (1 - \beta^4)}}
where C_d is the discharge coefficient, A_t is the throat area, \rho is fluid density, and \beta is the beta ratio (throat diameter divided by pipe diameter). For compressible flows, an additional expansibility factor \varepsilon accounts for density changes across the meter.
These calculations are implemented using standard Python libraries including NumPy for numerical operations and fluids, a specialized library for fluid dynamics that provides ISO 5167-compliant correlations for discharge coefficients and pressure drop calculations.
Beta ratio (\beta = d/D) is a critical design parameter that affects meter sensitivity and permanent pressure loss. Typical values range from 0.2 to 0.75, with lower values providing higher differential pressure (better sensitivity) but greater non-recoverable pressure loss. The DIFF_PRESS_BETA tool helps engineers select the optimal beta ratio for their application, balancing measurement accuracy against energy costs.
Discharge coefficient (C_d) corrects the theoretical flow equation for real-world viscous, turbulent, and geometric effects. For orifice plates, the Reader-Harris-Gallagher correlation from ISO 5167 is the industry standard, accounting for Reynolds number, beta ratio, pipe diameter, and tap locations. The ORIFICE_DISCHARGE_C tool implements this correlation with uncertainty bands. For more general DP meters, DIFF_PRESS_C_EPS calculates both the discharge coefficient and expansibility factor.
Expansibility factor (\varepsilon) is essential for gas and steam applications where density changes significantly across the meter. It varies with pressure ratio, beta ratio, and isentropic exponent. The ORIFICE_EXPAND tool provides ISO-compliant calculations for compressible flows through orifice plates.
Pressure drop has two components: the differential pressure used for flow measurement (recoverable) and the permanent pressure loss (non-recoverable) due to turbulence and mixing downstream of the constriction. Non-recoverable pressure drop represents lost energy and operating cost. Tools like DIFF_PRESS_DP and ORIFICE_PRESS_DROP quantify this permanent loss for different meter geometries.
Flow rate calculation is the primary objective, converting measured differential pressure into mass or volumetric flow. The FLOW_METER_DISCH tool performs this calculation using measured upstream and downstream pressures along with meter geometry and fluid properties, providing the mass flow rate with appropriate corrections for real gas behavior and compressibility.
When designing a new DP meter installation, start with DIFF_PRESS_BETA to select an appropriate beta ratio, then use DIFF_PRESS_C_EPS or ORIFICE_DISCHARGE_C to determine the discharge coefficient. For operational calculations, use FLOW_METER_DISCH to convert field measurements into flow rates. Always evaluate permanent pressure loss using DIFF_PRESS_DP or ORIFICE_PRESS_DROP to understand the operating cost implications of your meter selection.
DIFF_PRESS_BETA
Calculate the beta ratio (diameter ratio) for a differential pressure flow meter.
Excel Usage
=DIFF_PRESS_BETA(D, D_two, beta_meter_type)
D(float, required): Upstream internal pipe diameter (m)D_two(float, required): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)beta_meter_type(str, optional, default: “ISO 5167 orifice”): Type of differential pressure flow meter
Returns (float): Differential pressure meter diameter ratio (beta) (-)
Example 1: Standard orifice beta ratio
Inputs:
| D | D_two | beta_meter_type |
|---|---|---|
| 0.1 | 0.05 | ISO 5167 orifice |
Excel formula:
=DIFF_PRESS_BETA(0.1, 0.05, "ISO 5167 orifice")
Expected output:
0.5
Example 2: Venturi tube beta ratio
Inputs:
| D | D_two | beta_meter_type |
|---|---|---|
| 0.2 | 0.12 | machined convergent venturi tube |
Excel formula:
=DIFF_PRESS_BETA(0.2, 0.12, "machined convergent venturi tube")
Expected output:
0.6
Example 3: Cone meter beta ratio (uses special formula)
Inputs:
| D | D_two | beta_meter_type |
|---|---|---|
| 0.2575 | 0.184 | cone meter |
Excel formula:
=DIFF_PRESS_BETA(0.2575, 0.184, "cone meter")
Expected output:
0.699571
Example 4: Wedge meter beta ratio (uses special formula)
Inputs:
| D | D_two | beta_meter_type |
|---|---|---|
| 0.2027 | 0.0608 | wedge meter |
Excel formula:
=DIFF_PRESS_BETA(0.2027, 0.0608, "wedge meter")
Expected output:
0.502253
Python Code
Show Code
from fluids.flow_meter import differential_pressure_meter_beta
def diff_press_beta(D, D_two, beta_meter_type='ISO 5167 orifice'):
"""
Calculate the beta ratio (diameter ratio) for a differential pressure flow meter.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.differential_pressure_meter_beta
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Upstream internal pipe diameter (m)
D_two (float): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)
beta_meter_type (str, optional): Type of differential pressure flow meter Valid options: ISO 5167 Orifice, Orifice, Conical Orifice, Eccentric Orifice, Segmental Orifice, Quarter Circle Orifice, Venturi Nozzle, ISA 1932 Nozzle, Long Radius Nozzle, Machined Convergent Venturi Tube, Rough Welded Convergent Venturi Tube, As Cast Convergent Venturi Tube, Cone Meter, Wedge Meter. Default is 'ISO 5167 orifice'.
Returns:
float: Differential pressure meter diameter ratio (beta) (-)
"""
try:
if D <= 0:
return "Error: D (upstream diameter) must be positive."
if D_two <= 0:
return "Error: D_two (meter diameter) must be positive."
result = differential_pressure_meter_beta(
D=D,
D2=D_two,
meter_type=beta_meter_type
)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
DIFF_PRESS_C_EPS
Calculate discharge coefficient and expansibility factor for differential pressure flow meters.
Excel Usage
=DIFF_PRESS_C_EPS(D, D_two, m, P_one, P_two, rho, mu, k, c_eps_meter_type)
D(float, required): Upstream internal pipe diameter (m)D_two(float, required): Orifice or meter characteristic diameter (m)m(float, required): Mass flow rate through the meter (kg/s)P_one(float, required): Static pressure upstream of meter at pressure tap (Pa)P_two(float, required): Static pressure downstream of meter at pressure tap (Pa)rho(float, required): Density of fluid at P1 (kg/m³)mu(float, required): Viscosity of fluid at P1 (Pa·s)k(float, required): Isentropic exponent of fluid (-)c_eps_meter_type(str, optional, default: “ISO 5167 orifice”): Type of differential pressure flow meter
Returns (list[list]): 2D list containing discharge coefficient and expansibility factor [[C, epsilon]]
Example 1: ISO 5167 orifice with air flow
Inputs:
| D | D_two | m | P_one | P_two | rho | mu | k | c_eps_meter_type |
|---|---|---|---|---|---|---|---|---|
| 0.07366 | 0.05 | 7.702338 | 200000 | 183000 | 999.1 | 0.0011 | 1.33 | ISO 5167 orifice |
Excel formula:
=DIFF_PRESS_C_EPS(0.07366, 0.05, 7.702338, 200000, 183000, 999.1, 0.0011, 1.33, "ISO 5167 orifice")
Expected output:
| Result | |
|---|---|
| 0.60977 | 0.971103 |
Example 2: Machined venturi tube
Inputs:
| D | D_two | m | P_one | P_two | rho | mu | k | c_eps_meter_type |
|---|---|---|---|---|---|---|---|---|
| 0.1 | 0.06 | 5 | 150000 | 140000 | 1000 | 0.001 | 1.4 | machined convergent venturi tube |
Excel formula:
=DIFF_PRESS_C_EPS(0.1, 0.06, 5, 150000, 140000, 1000, 0.001, 1.4, "machined convergent venturi tube")
Expected output:
| Result | |
|---|---|
| 0.995 | 0.956963 |
Example 3: V-cone meter
Inputs:
| D | D_two | m | P_one | P_two | rho | mu | k | c_eps_meter_type |
|---|---|---|---|---|---|---|---|---|
| 0.2 | 0.15 | 10 | 300000 | 280000 | 850 | 0.002 | 1.3 | cone meter |
Excel formula:
=DIFF_PRESS_C_EPS(0.2, 0.15, 10, 300000, 280000, 850, 0.002, 1.3, "cone meter")
Expected output:
| Result | |
|---|---|
| 0.82 | 0.959886 |
Example 4: Wedge flow meter
Inputs:
| D | D_two | m | P_one | P_two | rho | mu | k | c_eps_meter_type |
|---|---|---|---|---|---|---|---|---|
| 0.15 | 0.05 | 3 | 100000 | 95000 | 800 | 0.0015 | 1.35 | wedge meter |
Excel formula:
=DIFF_PRESS_C_EPS(0.15, 0.05, 3, 100000, 95000, 800, 0.0015, 1.35, "wedge meter")
Expected output:
| Result | |
|---|---|
| 0.721384 | 0.968564 |
Python Code
Show Code
from fluids.flow_meter import differential_pressure_meter_C_epsilon
def diff_press_c_eps(D, D_two, m, P_one, P_two, rho, mu, k, c_eps_meter_type='ISO 5167 orifice'):
"""
Calculate discharge coefficient and expansibility factor for differential pressure flow meters.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.differential_pressure_meter_C_epsilon
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Upstream internal pipe diameter (m)
D_two (float): Orifice or meter characteristic diameter (m)
m (float): Mass flow rate through the meter (kg/s)
P_one (float): Static pressure upstream of meter at pressure tap (Pa)
P_two (float): Static pressure downstream of meter at pressure tap (Pa)
rho (float): Density of fluid at P1 (kg/m³)
mu (float): Viscosity of fluid at P1 (Pa·s)
k (float): Isentropic exponent of fluid (-)
c_eps_meter_type (str, optional): Type of differential pressure flow meter Valid options: ISO 5167 Orifice, Orifice, Conical Orifice, Eccentric Orifice, Segmental Orifice, Quarter Circle Orifice, ISO 15377 Conical Orifice, ISO 15377 Eccentric Orifice, ISO 15377 Quarter-circle Orifice, Miller Orifice, Miller Conical Orifice, Miller Eccentric Orifice, Miller Segmental Orifice, Miller Quarter Circle Orifice, Hollingshead Orifice, Venturi Nozzle, ISA 1932 Nozzle, Long Radius Nozzle, Machined Convergent Venturi Tube, Rough Welded Convergent Venturi Tube, As Cast Convergent Venturi Tube, Hollingshead Venturi Smooth, Hollingshead Venturi Sharp, Cone Meter, Hollingshead V Cone, Wedge Meter, Hollingshead Wedge, Unspecified Meter. Default is 'ISO 5167 orifice'.
Returns:
list[list]: 2D list containing discharge coefficient and expansibility factor [[C, epsilon]]
"""
try:
result = differential_pressure_meter_C_epsilon(
D=D,
D2=D_two,
m=m,
P1=P_one,
P2=P_two,
rho=rho,
mu=mu,
k=k,
meter_type=c_eps_meter_type,
taps=None,
tap_position=None,
C_specified=None,
epsilon_specified=None
)
# Result is a tuple (C, epsilon) - return as 2D list
C, epsilon = result
return [[float(C), float(epsilon)]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
DIFF_PRESS_DP
Calculate non-recoverable pressure drop across a differential pressure flow meter.
Excel Usage
=DIFF_PRESS_DP(D, D_two, P_one, P_two, C, dp_meter_type)
D(float, required): Upstream internal pipe diameter (m)D_two(float, required): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)P_one(float, required): Static pressure upstream at pressure tap (Pa)P_two(float, required): Static pressure downstream at pressure tap (Pa)C(float, optional, default: 0.6): Coefficient of discharge (required for orifice plates and venturi nozzles) (-)dp_meter_type(str, optional, default: “ISO 5167 orifice”): Type of differential pressure flow meter
Returns (float): Non-recoverable pressure drop of the flow meter (Pa)
Example 1: As-cast venturi tube pressure drop
Inputs:
| D | D_two | P_one | P_two | dp_meter_type |
|---|---|---|---|---|
| 0.07366 | 0.05 | 200000 | 183000 | as cast convergent venturi tube |
Excel formula:
=DIFF_PRESS_DP(0.07366, 0.05, 200000, 183000, "as cast convergent venturi tube")
Expected output:
1788.57
Example 2: Cone meter pressure drop
Inputs:
| D | D_two | P_one | P_two | dp_meter_type |
|---|---|---|---|---|
| 0.25 | 0.18 | 1000000 | 950000 | cone meter |
Excel formula:
=DIFF_PRESS_DP(0.25, 0.18, 1000000, 950000, "cone meter")
Expected output:
26290
Example 3: Wedge meter pressure drop
Inputs:
| D | D_two | P_one | P_two | dp_meter_type |
|---|---|---|---|---|
| 0.2 | 0.14 | 1000000 | 950000 | wedge meter |
Excel formula:
=DIFF_PRESS_DP(0.2, 0.14, 1000000, 950000, "wedge meter")
Expected output:
20344.8
Example 4: Orifice with discharge coefficient
Inputs:
| D | D_two | P_one | P_two | C | dp_meter_type |
|---|---|---|---|---|---|
| 0.1 | 0.05 | 150000 | 145000 | 0.61 | ISO 5167 orifice |
Excel formula:
=DIFF_PRESS_DP(0.1, 0.05, 150000, 145000, 0.61, "ISO 5167 orifice")
Expected output:
3653.64
Python Code
Show Code
from fluids.flow_meter import differential_pressure_meter_dP
def diff_press_dp(D, D_two, P_one, P_two, C=0.6, dp_meter_type='ISO 5167 orifice'):
"""
Calculate non-recoverable pressure drop across a differential pressure flow meter.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.differential_pressure_meter_dP
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Upstream internal pipe diameter (m)
D_two (float): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)
P_one (float): Static pressure upstream at pressure tap (Pa)
P_two (float): Static pressure downstream at pressure tap (Pa)
C (float, optional): Coefficient of discharge (required for orifice plates and venturi nozzles) (-) Default is 0.6.
dp_meter_type (str, optional): Type of differential pressure flow meter Valid options: ISO 5167 Orifice, Orifice, Conical Orifice, Eccentric Orifice, Segmental Orifice, Quarter Circle Orifice, Venturi Nozzle, ISA 1932 Nozzle, Long Radius Nozzle, Machined Convergent Venturi Tube, Rough Welded Convergent Venturi Tube, As Cast Convergent Venturi Tube, Cone Meter, Wedge Meter. Default is 'ISO 5167 orifice'.
Returns:
float: Non-recoverable pressure drop of the flow meter (Pa)
"""
try:
if D <= 0:
return "Error: D (upstream diameter) must be positive."
if D_two <= 0:
return "Error: D_two (meter diameter) must be positive."
result = differential_pressure_meter_dP(
D=D,
D2=D_two,
P1=P_one,
P2=P_two,
C=C,
meter_type=dp_meter_type
)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
FLOW_METER_DISCH
Calculate mass flow rate through a differential pressure flow meter based on measured pressures and meter geometry.
Excel Usage
=FLOW_METER_DISCH(D, Do, P_one, P_two, rho, C, expansibility, disch_meter_type)
D(float, required): Upstream internal pipe diameter (m)Do(float, required): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)P_one(float, required): Static pressure upstream at pressure tap (Pa)P_two(float, required): Static pressure downstream at pressure tap (Pa)rho(float, required): Density of fluid at P1 (kg/m³)C(float, required): Coefficient of discharge of the meter (-)expansibility(float, optional, default: 1): Expansibility factor (1 for incompressible, <1 for compressible) (-)disch_meter_type(str, optional, default: “ISO 5167 orifice”): Type of differential pressure flow meter
Returns (float): Mass flow rate of fluid through the meter (kg/s)
Example 1: ISO 5167 orifice with air
Inputs:
| D | Do | P_one | P_two | rho | C | expansibility | disch_meter_type |
|---|---|---|---|---|---|---|---|
| 0.0739 | 0.0222 | 100000 | 99000 | 1.1646 | 0.5988 | 0.9975 | ISO 5167 orifice |
Excel formula:
=FLOW_METER_DISCH(0.0739, 0.0222, 100000, 99000, 1.1646, 0.5988, 0.9975, "ISO 5167 orifice")
Expected output:
0.0112039
Example 2: Machined venturi with water
Inputs:
| D | Do | P_one | P_two | rho | C | expansibility | disch_meter_type |
|---|---|---|---|---|---|---|---|
| 0.1 | 0.06 | 150000 | 145000 | 998 | 0.995 | 1 | machined convergent venturi tube |
Excel formula:
=FLOW_METER_DISCH(0.1, 0.06, 150000, 145000, 998, 0.995, 1, "machined convergent venturi tube")
Expected output:
9.52624
Example 3: Cone meter with oil
Inputs:
| D | Do | P_one | P_two | rho | C | disch_meter_type |
|---|---|---|---|---|---|---|
| 0.2 | 0.15 | 300000 | 290000 | 850 | 0.82 | cone meter |
Excel formula:
=FLOW_METER_DISCH(0.2, 0.15, 300000, 290000, 850, 0.82, "cone meter")
Expected output:
51.6774
Example 4: Wedge meter
Inputs:
| D | Do | P_one | P_two | rho | C | disch_meter_type |
|---|---|---|---|---|---|---|
| 0.15 | 0.05 | 100000 | 98000 | 800 | 0.73 | wedge meter |
Excel formula:
=FLOW_METER_DISCH(0.15, 0.05, 100000, 98000, 800, 0.73, "wedge meter")
Expected output:
7.03989
Python Code
Show Code
from fluids.flow_meter import flow_meter_discharge
def flow_meter_disch(D, Do, P_one, P_two, rho, C, expansibility=1, disch_meter_type='ISO 5167 orifice'):
"""
Calculate mass flow rate through a differential pressure flow meter based on measured pressures and meter geometry.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.flow_meter_discharge
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Upstream internal pipe diameter (m)
Do (float): Meter characteristic diameter - orifice hole, venturi throat, cone end, or wedge height (m)
P_one (float): Static pressure upstream at pressure tap (Pa)
P_two (float): Static pressure downstream at pressure tap (Pa)
rho (float): Density of fluid at P1 (kg/m³)
C (float): Coefficient of discharge of the meter (-)
expansibility (float, optional): Expansibility factor (1 for incompressible, <1 for compressible) (-) Default is 1.
disch_meter_type (str, optional): Type of differential pressure flow meter Valid options: ISO 5167 Orifice, Orifice, Conical Orifice, Eccentric Orifice, Segmental Orifice, Quarter Circle Orifice, Venturi Nozzle, ISA 1932 Nozzle, Long Radius Nozzle, Machined Convergent Venturi Tube, Rough Welded Convergent Venturi Tube, As Cast Convergent Venturi Tube, Cone Meter, Wedge Meter. Default is 'ISO 5167 orifice'.
Returns:
float: Mass flow rate of fluid through the meter (kg/s)
"""
try:
if D <= 0:
return "Error: D (upstream diameter) must be positive."
if Do <= 0:
return "Error: Do (meter diameter) must be positive."
result = flow_meter_discharge(
D=D,
Do=Do,
P1=P_one,
P2=P_two,
rho=rho,
C=C,
expansibility=expansibility,
meter_type=disch_meter_type
)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ORIFICE_DISCHARGE_C
Calculate the discharge coefficient for an orifice plate using the Reader-Harris-Gallagher correlation (ISO 5167 standard).
Excel Usage
=ORIFICE_DISCHARGE_C(pipe_diameter, orifice_diameter, density, viscosity, mass_flow_rate, orifice_taps)
pipe_diameter(float, required): Upstream internal pipe diameter (m)orifice_diameter(float, required): Diameter of orifice at flow conditions (m)density(float, required): Density of fluid (kg/m³)viscosity(float, required): Viscosity of fluid (Pa·s)mass_flow_rate(float, required): Mass flow rate of fluid through the orifice (kg/s)orifice_taps(str, optional, default: “corner”): Orientation of the pressure taps
Returns (float): Coefficient of discharge of the orifice plate, dimensionless [-]
Example 1: Standard orifice with flange taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.07391 | 0.0222 | 1.165 | 0.0000185 | 0.12 | flange |
Excel formula:
=ORIFICE_DISCHARGE_C(0.07391, 0.0222, 1.165, 0.0000185, 0.12, "flange")
Expected output:
0.599033
Example 2: Orifice with corner taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.07391 | 0.0222 | 1.165 | 0.0000185 | 0.12 | corner |
Excel formula:
=ORIFICE_DISCHARGE_C(0.07391, 0.0222, 1.165, 0.0000185, 0.12, "corner")
Expected output:
0.600037
Example 3: Orifice with D taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.1 | 0.05 | 998.2 | 0.001 | 5 | D |
Excel formula:
=ORIFICE_DISCHARGE_C(0.1, 0.05, 998.2, 0.001, 5, "D")
Expected output:
0.607351
Example 4: Orifice with D/2 taps
Inputs:
| pipe_diameter | orifice_diameter | density | viscosity | mass_flow_rate | orifice_taps |
|---|---|---|---|---|---|
| 0.1 | 0.05 | 998.2 | 0.001 | 5 | D/2 |
Excel formula:
=ORIFICE_DISCHARGE_C(0.1, 0.05, 998.2, 0.001, 5, "D/2")
Expected output:
0.607351
Python Code
Show Code
from fluids.flow_meter import C_Reader_Harris_Gallagher as fluids_c_reader_harris_gallagher
def orifice_discharge_c(pipe_diameter, orifice_diameter, density, viscosity, mass_flow_rate, orifice_taps='corner'):
"""
Calculate the discharge coefficient for an orifice plate using the Reader-Harris-Gallagher correlation (ISO 5167 standard).
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.C_Reader_Harris_Gallagher
This example function is provided as-is without any representation of accuracy.
Args:
pipe_diameter (float): Upstream internal pipe diameter (m)
orifice_diameter (float): Diameter of orifice at flow conditions (m)
density (float): Density of fluid (kg/m³)
viscosity (float): Viscosity of fluid (Pa·s)
mass_flow_rate (float): Mass flow rate of fluid through the orifice (kg/s)
orifice_taps (str, optional): Orientation of the pressure taps Valid options: Corner, Flange, D, D/2. Default is 'corner'.
Returns:
float: Coefficient of discharge of the orifice plate, dimensionless [-]
"""
try:
pipe_diameter = float(pipe_diameter)
orifice_diameter = float(orifice_diameter)
density = float(density)
viscosity = float(viscosity)
mass_flow_rate = float(mass_flow_rate)
if pipe_diameter <= 0:
return "Error: Pipe_diameter must be positive."
if orifice_diameter <= 0:
return "Error: Orifice_diameter must be positive."
if orifice_diameter >= pipe_diameter:
return "Error: Orifice_diameter must be less than pipe_diameter."
if density <= 0:
return "Error: Density must be positive."
if viscosity <= 0:
return "Error: Viscosity must be positive."
if mass_flow_rate <= 0:
return "Error: Mass_flow_rate must be positive."
result = fluids_c_reader_harris_gallagher(
D=pipe_diameter,
Do=orifice_diameter,
rho=density,
mu=viscosity,
m=mass_flow_rate,
taps=orifice_taps
)
return float(result)
except (TypeError, ValueError):
return "Error: All numeric parameters must be valid numbers."
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ORIFICE_EXPAND
Calculate the expansibility factor for an orifice plate based on geometry and pressure conditions.
Excel Usage
=ORIFICE_EXPAND(pipe_diameter, orifice_diameter, upstream_pressure, downstream_pressure, isentropic_exponent)
pipe_diameter(float, required): Upstream internal pipe diameter (m)orifice_diameter(float, required): Diameter of orifice at flow conditions (m)upstream_pressure(float, required): Static pressure upstream of orifice (Pa)downstream_pressure(float, required): Static pressure downstream of orifice (Pa)isentropic_exponent(float, required): Isentropic exponent of fluid (dimensionless)
Returns (float): Expansibility factor (1 for incompressible fluids, less than 1 for compressible fluids), dimensionless [-]
Example 1: Standard orifice with air flow
Inputs:
| pipe_diameter | orifice_diameter | upstream_pressure | downstream_pressure | isentropic_exponent |
|---|---|---|---|---|
| 0.0739 | 0.0222 | 100000 | 99000 | 1.4 |
Excel formula:
=ORIFICE_EXPAND(0.0739, 0.0222, 100000, 99000, 1.4)
Expected output:
0.997474
Example 2: High pressure drop case
Inputs:
| pipe_diameter | orifice_diameter | upstream_pressure | downstream_pressure | isentropic_exponent |
|---|---|---|---|---|
| 0.1 | 0.05 | 1000000 | 900000 | 1.3 |
Excel formula:
=ORIFICE_EXPAND(0.1, 0.05, 1000000, 900000, 1.3)
Expected output:
0.971147
Example 3: Low pressure drop case
Inputs:
| pipe_diameter | orifice_diameter | upstream_pressure | downstream_pressure | isentropic_exponent |
|---|---|---|---|---|
| 0.1 | 0.05 | 200000 | 199000 | 1.4 |
Excel formula:
=ORIFICE_EXPAND(0.1, 0.05, 200000, 199000, 1.4)
Expected output:
0.998675
Example 4: Nearly incompressible fluid
Inputs:
| pipe_diameter | orifice_diameter | upstream_pressure | downstream_pressure | isentropic_exponent |
|---|---|---|---|---|
| 0.1 | 0.05 | 200000 | 199500 | 1.4 |
Excel formula:
=ORIFICE_EXPAND(0.1, 0.05, 200000, 199500, 1.4)
Expected output:
0.999338
Python Code
Show Code
from fluids.flow_meter import orifice_expansibility as fluids_orifice_expansibility
def orifice_expand(pipe_diameter, orifice_diameter, upstream_pressure, downstream_pressure, isentropic_exponent):
"""
Calculate the expansibility factor for an orifice plate based on geometry and pressure conditions.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.orifice_expansibility
This example function is provided as-is without any representation of accuracy.
Args:
pipe_diameter (float): Upstream internal pipe diameter (m)
orifice_diameter (float): Diameter of orifice at flow conditions (m)
upstream_pressure (float): Static pressure upstream of orifice (Pa)
downstream_pressure (float): Static pressure downstream of orifice (Pa)
isentropic_exponent (float): Isentropic exponent of fluid (dimensionless)
Returns:
float: Expansibility factor (1 for incompressible fluids, less than 1 for compressible fluids), dimensionless [-]
"""
try:
pipe_diameter = float(pipe_diameter)
orifice_diameter = float(orifice_diameter)
upstream_pressure = float(upstream_pressure)
downstream_pressure = float(downstream_pressure)
isentropic_exponent = float(isentropic_exponent)
if pipe_diameter <= 0:
return "Error: Pipe_diameter must be positive."
if orifice_diameter <= 0:
return "Error: Orifice_diameter must be positive."
if orifice_diameter >= pipe_diameter:
return "Error: Orifice_diameter must be less than pipe_diameter."
if upstream_pressure <= 0:
return "Error: Upstream_pressure must be positive."
if downstream_pressure <= 0:
return "Error: Downstream_pressure must be positive."
if isentropic_exponent <= 0:
return "Error: Isentropic_exponent must be positive."
result = fluids_orifice_expansibility(
D=pipe_diameter,
Do=orifice_diameter,
P1=upstream_pressure,
P2=downstream_pressure,
k=isentropic_exponent
)
return float(result)
except (TypeError, ValueError):
return "Error: All parameters must be valid numbers."
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ORIFICE_PRESS_DROP
Calculate non-recoverable pressure drop across an orifice plate based on geometry and discharge coefficient.
Excel Usage
=ORIFICE_PRESS_DROP(D, Do, P_one, P_two, C)
D(float, required): Upstream internal pipe diameter (m)Do(float, required): Diameter of orifice at flow conditions (m)P_one(float, required): Static pressure upstream of orifice at pressure tap cross-section (Pa)P_two(float, required): Static pressure downstream of orifice at pressure tap cross-section (Pa)C(float, required): Coefficient of discharge of the orifice (-)
Returns (float): Non-recoverable pressure drop of the orifice plate (Pa)
Example 1: Standard orifice pressure drop
Inputs:
| D | Do | P_one | P_two | C |
|---|---|---|---|---|
| 0.07366 | 0.05 | 200000 | 183000 | 0.61512 |
Excel formula:
=ORIFICE_PRESS_DROP(0.07366, 0.05, 200000, 183000, 0.61512)
Expected output:
9069.47
Example 2: Large orifice high beta ratio
Inputs:
| D | Do | P_one | P_two | C |
|---|---|---|---|---|
| 0.1 | 0.075 | 150000 | 145000 | 0.65 |
Excel formula:
=ORIFICE_PRESS_DROP(0.1, 0.075, 150000, 145000, 0.65)
Expected output:
2120.29
Example 3: Small orifice low beta ratio
Inputs:
| D | Do | P_one | P_two | C |
|---|---|---|---|---|
| 0.1 | 0.03 | 200000 | 180000 | 0.6 |
Excel formula:
=ORIFICE_PRESS_DROP(0.1, 0.03, 200000, 180000, 0.6)
Expected output:
17945.6
Example 4: High discharge coefficient
Inputs:
| D | Do | P_one | P_two | C |
|---|---|---|---|---|
| 0.05 | 0.03 | 100000 | 95000 | 0.7 |
Excel formula:
=ORIFICE_PRESS_DROP(0.05, 0.03, 100000, 95000, 0.7)
Expected output:
2931.69
Python Code
Show Code
from fluids.flow_meter import dP_orifice
def orifice_press_drop(D, Do, P_one, P_two, C):
"""
Calculate non-recoverable pressure drop across an orifice plate based on geometry and discharge coefficient.
See: https://fluids.readthedocs.io/fluids.flow_meter.html#fluids.flow_meter.dP_orifice
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Upstream internal pipe diameter (m)
Do (float): Diameter of orifice at flow conditions (m)
P_one (float): Static pressure upstream of orifice at pressure tap cross-section (Pa)
P_two (float): Static pressure downstream of orifice at pressure tap cross-section (Pa)
C (float): Coefficient of discharge of the orifice (-)
Returns:
float: Non-recoverable pressure drop of the orifice plate (Pa)
"""
try:
if D <= 0:
return "Error: D (upstream diameter) must be positive."
if Do <= 0:
return "Error: Do (orifice diameter) must be positive."
if C <= 0:
return "Error: C (discharge coefficient) must be positive."
result = dP_orifice(
D=D,
Do=Do,
P1=P_one,
P2=P_two,
C=C
)
return float(result)
except Exception as e:
return f"Error: {str(e)}"Online Calculator