rodlift.flow¶
rodlift.flow ¶
Multiphase gas-liquid flow in pipes.
:class:FlowState describes the local flow conditions; each correlation turns it into
a :class:GradientResult (friction, elevation and acceleration components of the
pressure loss per unit length, plus liquid holdup and flow regime).
Examples:
>>> from rodlift.flow import FlowState, pressure_gradient
>>> state = FlowState(vsl=1.0, vsg=2.0, rho_l=850.0, rho_g=60.0, mu_l=2e-3,
... mu_g=1.5e-5, sigma=0.025, diameter=0.0762, pressure=8e6)
>>> g = pressure_gradient(state, method="beggs_brill")
>>> round(g.total) # Pa/m
4622
FlowRegime ¶
FlowState
dataclass
¶
FlowState(
vsl: float,
vsg: float,
rho_l: float,
rho_g: float,
mu_l: float,
mu_g: float,
sigma: float,
diameter: float,
roughness: float = 0.0,
inclination: float = math.pi / 2,
pressure: float = 101325.0,
temperature: float = math.nan,
vso: float | None = None,
vsw: float | None = None,
gas_sg: float = math.nan,
z: float = math.nan,
gas_liquid_ratio: float = math.nan,
liquid_sg_standard: float = math.nan,
upstream: FlowState | None = None,
downstream: FlowState | None = None,
segment_length: float = math.nan,
)
Gas-liquid flow conditions at one point (or segment mid-point) of a pipe. SI units.
Attributes:
| Name | Type | Description |
|---|---|---|
vsl, vsg |
Superficial liquid and gas velocities, m/s. |
|
rho_l, rho_g |
In-situ liquid and gas densities, kg/m³. |
|
mu_l, mu_g |
Liquid and gas viscosities, Pa·s. |
|
sigma |
float
|
Gas-liquid surface tension, N/m. |
diameter |
float
|
Pipe inside diameter, m. |
roughness |
float
|
Absolute pipe roughness, m. |
inclination |
float
|
Angle from horizontal in the flow direction, rad (+π/2 = vertical upward flow, −π/2 = vertical downward flow). |
pressure |
float
|
Absolute pressure, Pa. |
temperature |
float
|
Temperature, K (needed only by a few correlations). |
vso, vsw |
Superficial oil and water velocities, m/s. Default: all liquid is oil. |
|
gas_sg |
float
|
Free-gas specific gravity (air = 1), for correlations that use the gas law. |
z |
float
|
Gas compressibility factor, for correlations that use the gas law. |
gas_liquid_ratio |
float
|
Producing gas-liquid ratio at standard conditions, m³/m³ (correlations based on the total mass per stock-tank barrel). |
liquid_sg_standard |
float
|
Specific gravity of the stock-tank liquid (oil/water mix, water = 1), for the same correlations. |
upstream, downstream |
States at the two ends of the segment, used by correlations that compute the acceleration term from the change in kinetic energy across a segment. |
|
segment_length |
float
|
Length of that segment, m. |
GradientResult
dataclass
¶
GradientResult(
friction: float,
elevation: float,
acceleration: float,
holdup: float,
regime: FlowRegime = FlowRegime.UNKNOWN,
)
Pressure gradient and holdup returned by a flow correlation.
Attributes:
| Name | Type | Description |
|---|---|---|
friction, elevation, acceleration |
Components of the pressure loss per unit length in the flow direction, Pa/m. |
|
holdup |
float
|
In-situ (slip) liquid volume fraction. |
regime |
FlowRegime
|
Flow regime identified by the correlation. |
available_correlations ¶
available_correlations() -> list[str]
Names of the correlations implemented in this version.
get_correlation ¶
get_correlation(name: str) -> CorrelationFunction
Return the correlation function registered under name.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name is unknown. |
NotImplementedError
|
If the correlation is registered but not yet available in this version. |
single_phase_gradient ¶
single_phase_gradient(state: FlowState) -> GradientResult
Pressure gradient when only one phase flows.
The phase is liquid when the no-slip holdup is at least 0.9, gas otherwise. Friction
uses :func:rodlift.flow.friction.moody_friction_factor. For gas, the acceleration
term is included through the kinetic-energy group E_k = ρ v² / (g_c p).
pressure_gradient ¶
pressure_gradient(
state: FlowState, method: str = "beggs_brill"
) -> GradientResult
Pressure gradient with the named correlation.
When the no-slip liquid holdup is at most 0.001 or at least 0.999, the flow is
treated as single phase (:func:single_phase_gradient) regardless of method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
FlowState
|
Local flow conditions. |
required |
method
|
str
|
Correlation name; see :func: |
'beggs_brill'
|