Skip to content

wellcast.pvt

pvt

Empirical PVT correlations for black oil and natural gas.

All functions use oilfield units: pressure in psia, temperature in degF, solution gas-oil ratio in scf/STB, gas specific gravity relative to air and oil gravity in degrees API. Inputs may be scalars or arrays; scalar inputs return a float.

Each correlation was fitted to a finite laboratory data set. Inputs outside the published range are still evaluated, but a wellcast._validation.RangeWarning is issued.

Notes

Oil specific gravity and API gravity are related by \(\gamma_o = 141.5 / (131.5 + \mathrm{API})\).

RangeWarning

Bases: UserWarning

An input lies outside the range a correlation was developed for.

api_to_specific_gravity

api_to_specific_gravity(api: ArrayLike) -> FloatOrArray

Convert API gravity to oil specific gravity (water = 1).

Parameters:

Name Type Description Default
api array_like

Oil gravity in degrees API.

required

Returns:

Type Description
float or ndarray

Specific gravity at 60 degF.

Notes

\(\gamma_o = 141.5 / (131.5 + \mathrm{API})\).

Examples:

>>> round(api_to_specific_gravity(10.0), 4)
1.0

specific_gravity_to_api

specific_gravity_to_api(specific_gravity: ArrayLike) -> FloatOrArray

Convert oil specific gravity (water = 1) to API gravity.

Parameters:

Name Type Description Default
specific_gravity array_like

Oil specific gravity at 60 degF.

required

Returns:

Type Description
float or ndarray

Gravity in degrees API.

Examples:

>>> round(specific_gravity_to_api(0.85), 2)
34.97

bubble_point_standing

bubble_point_standing(rs: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike) -> FloatOrArray

Bubble-point pressure from Standing's correlation.

Parameters:

Name Type Description Default
rs array_like

Solution gas-oil ratio at the bubble point, scf/STB.

required
gas_gravity array_like

Gas specific gravity (air = 1).

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Reservoir temperature, degF.

required

Returns:

Type Description
float or ndarray

Bubble-point pressure, psia.

Raises:

Type Description
DataValidationError

If rs or gas_gravity is not positive.

Warns:

Type Description
RangeWarning

Outside 100-258 degF, 20-1425 scf/STB, 16.5-63.8 API or gas gravity 0.59-0.95.

Notes
\[ p_b = 18.2 \left[ (R_s / \gamma_g)^{0.83} \, 10^{a} - 1.4 \right], \quad a = 0.00091\,T - 0.0125\,\mathrm{API} \]

Standing, M. B. (1947), "A pressure-volume-temperature correlation for mixtures of California oils and gases", Drilling and Production Practice, API, 275-287.

Examples:

>>> round(bubble_point_standing(751.0, 0.851, 47.1, 250.0), 1)
2181.3

solution_gor_standing

solution_gor_standing(pressure: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike, bubble_point: ArrayLike | None = None) -> FloatOrArray

Solution gas-oil ratio from Standing's correlation.

Parameters:

Name Type Description Default
pressure array_like

Pressure, psia.

required
gas_gravity array_like

Gas specific gravity (air = 1).

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required
bubble_point array_like

Bubble-point pressure, psia. Above it the oil is undersaturated and Rs stays at its bubble-point value. If omitted, the oil is assumed saturated at every pressure.

None

Returns:

Type Description
float or ndarray

Solution gas-oil ratio, scf/STB.

Raises:

Type Description
DataValidationError

If pressure or gas_gravity is not positive.

Notes

Inverse of bubble_point_standing:

\[ R_s = \gamma_g \left[ \left(\frac{p}{18.2} + 1.4\right) 10^{x} \right]^{1.2048}, \quad x = 0.0125\,\mathrm{API} - 0.00091\,T \]

Standing (1947), see bubble_point_standing.

Examples:

>>> round(solution_gor_standing(2181.3, 0.851, 47.1, 250.0), 0)
751.0

oil_fvf_standing

oil_fvf_standing(rs: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike) -> FloatOrArray

Saturated oil formation volume factor from Standing's correlation.

Parameters:

Name Type Description Default
rs array_like

Solution gas-oil ratio, scf/STB.

required
gas_gravity array_like

Gas specific gravity (air = 1).

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required

Returns:

Type Description
float or ndarray

Oil formation volume factor, bbl/STB, at or below the bubble point.

Raises:

Type Description
DataValidationError

If rs is negative or gas_gravity is not positive.

Notes
\[ B_o = 0.9759 + 0.000120 \left[ R_s \sqrt{\gamma_g / \gamma_o} + 1.25\,T \right]^{1.2} \]

Standing (1947), see bubble_point_standing.

Examples:

>>> round(oil_fvf_standing(751.0, 0.851, 47.1, 250.0), 4)
1.5062

solution_gor_vasquez_beggs

solution_gor_vasquez_beggs(pressure: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike, *, separator_pressure: float = 114.7, separator_temperature: float = 60.0) -> FloatOrArray

Solution gas-oil ratio from the Vasquez-Beggs correlation.

Parameters:

Name Type Description Default
pressure array_like

Pressure at or below the bubble point, psia.

required
gas_gravity array_like

Gas specific gravity (air = 1) at separator conditions.

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required
separator_pressure float

Separator pressure, psia. Default 114.7 (100 psig).

114.7
separator_temperature float

Separator temperature, degF. Default 60.

60.0

Returns:

Type Description
float or ndarray

Solution gas-oil ratio, scf/STB.

Raises:

Type Description
DataValidationError

If pressure or gas_gravity is not positive.

Notes
\[ R_s = C_1 \gamma_{gs} p^{C_2} \exp\!\left(\frac{C_3\,\mathrm{API}}{T + 460}\right) \]

with \((C_1, C_2, C_3) = (0.0362, 1.0937, 25.7240)\) for API <= 30 and \((0.0178, 1.1870, 23.931)\) above, and the separator-corrected gravity \(\gamma_{gs} = \gamma_g [1 + 5.912\times10^{-5}\,\mathrm{API}\, T_{sep} \log_{10}(p_{sep}/114.7)]\).

Vasquez, M. and Beggs, H. D. (1980), "Correlations for fluid physical property prediction", JPT 32(6), 968-970, SPE-6719-PA.

Examples:

>>> round(solution_gor_vasquez_beggs(2000.0, 0.75, 35.0, 200.0), 1)
393.5

bubble_point_vasquez_beggs

bubble_point_vasquez_beggs(rs: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike, *, separator_pressure: float = 114.7, separator_temperature: float = 60.0) -> FloatOrArray

Bubble-point pressure from the Vasquez-Beggs correlation.

Parameters:

Name Type Description Default
rs array_like

Solution gas-oil ratio at the bubble point, scf/STB.

required
gas_gravity array_like

Gas specific gravity (air = 1) at separator conditions.

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required
separator_pressure float

Separator pressure, psia. Default 114.7.

114.7
separator_temperature float

Separator temperature, degF. Default 60.

60.0

Returns:

Type Description
float or ndarray

Bubble-point pressure, psia.

Raises:

Type Description
DataValidationError

If rs or gas_gravity is not positive.

Notes

Algebraic inverse of solution_gor_vasquez_beggs:

\[ p_b = \left[\frac{R_s}{C_1 \gamma_{gs}} \exp\!\left(-\frac{C_3\,\mathrm{API}}{T + 460}\right)\right]^{1/C_2} \]

Examples:

>>> round(bubble_point_vasquez_beggs(393.5, 0.75, 35.0, 200.0), 0)
2000.0

oil_fvf_vasquez_beggs

oil_fvf_vasquez_beggs(rs: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike, *, separator_pressure: float = 114.7, separator_temperature: float = 60.0) -> FloatOrArray

Saturated oil formation volume factor from Vasquez-Beggs.

Parameters:

Name Type Description Default
rs array_like

Solution gas-oil ratio, scf/STB.

required
gas_gravity array_like

Gas specific gravity (air = 1) at separator conditions.

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required
separator_pressure float

Separator pressure, psia. Default 114.7.

114.7
separator_temperature float

Separator temperature, degF. Default 60.

60.0

Returns:

Type Description
float or ndarray

Oil formation volume factor, bbl/STB.

Raises:

Type Description
DataValidationError

If gas_gravity is not positive.

Notes
\[ B_o = 1 + C_1 R_s + (T - 60) \frac{\mathrm{API}}{\gamma_{gs}} (C_2 + C_3 R_s) \]

with \((C_1, C_2, C_3) = (4.677\times10^{-4}, 1.751\times10^{-5}, -1.811\times10^{-8})\) for API <= 30 and \((4.670\times10^{-4}, 1.100\times10^{-5}, 1.337\times10^{-9})\) above. Vasquez and Beggs (1980).

Examples:

>>> round(oil_fvf_vasquez_beggs(393.5, 0.75, 35.0, 200.0), 4)
1.2591

oil_fvf_undersaturated

oil_fvf_undersaturated(pressure: ArrayLike, bubble_point: ArrayLike, bo_bubble: ArrayLike, rs_bubble: ArrayLike, gas_gravity: ArrayLike, api: ArrayLike, temperature: ArrayLike) -> FloatOrArray

Oil formation volume factor above the bubble point.

Uses the Vasquez-Beggs isothermal compressibility, integrated from the bubble point to pressure. At or below the bubble point the value at the bubble point is returned.

Parameters:

Name Type Description Default
pressure array_like

Pressure, psia.

required
bubble_point array_like

Bubble-point pressure, psia.

required
bo_bubble array_like

Formation volume factor at the bubble point, bbl/STB.

required
rs_bubble array_like

Solution gas-oil ratio at the bubble point, scf/STB.

required
gas_gravity array_like

Gas specific gravity (air = 1).

required
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required

Returns:

Type Description
float or ndarray

Oil formation volume factor, bbl/STB.

Raises:

Type Description
DataValidationError

If a pressure is not positive.

Notes

With \(c_o = A / p\) and \(A = 10^{-5}(-1433 + 5 R_{sb} + 17.2\,T - 1180\,\gamma_g + 12.61\,\mathrm{API})\):

\[ B_o = B_{ob} \exp\left[-A \ln(p / p_b)\right] \]

Vasquez and Beggs (1980).

Examples:

>>> bo = oil_fvf_undersaturated(4000.0, 2000.0, 1.26, 393.5, 0.75, 35.0, 200.0)
>>> round(bo, 4)
1.2295

dead_oil_viscosity_beggs_robinson

dead_oil_viscosity_beggs_robinson(api: ArrayLike, temperature: ArrayLike) -> FloatOrArray

Dead (gas-free) oil viscosity from Beggs and Robinson.

Parameters:

Name Type Description Default
api array_like

Oil gravity, degrees API.

required
temperature array_like

Temperature, degF.

required

Returns:

Type Description
float or ndarray

Dead oil viscosity, cP.

Raises:

Type Description
DataValidationError

If temperature is not positive.

Notes
\[ \mu_{od} = 10^{X} - 1, \quad X = 10^{3.0324 - 0.02023\,\mathrm{API}} \, T^{-1.163} \]

Beggs, H. D. and Robinson, J. R. (1975), "Estimating the viscosity of crude oil systems", JPT 27(9), 1140-1141, SPE-5434-PA. The correlation tends to overpredict below about 100 degF.

Examples:

>>> round(dead_oil_viscosity_beggs_robinson(35.0, 200.0), 3)
1.785

live_oil_viscosity_beggs_robinson

live_oil_viscosity_beggs_robinson(dead_viscosity: ArrayLike, rs: ArrayLike) -> FloatOrArray

Saturated (live) oil viscosity from Beggs and Robinson.

Parameters:

Name Type Description Default
dead_viscosity array_like

Dead oil viscosity at the same temperature, cP.

required
rs array_like

Solution gas-oil ratio, scf/STB.

required

Returns:

Type Description
float or ndarray

Live oil viscosity at or below the bubble point, cP.

Raises:

Type Description
DataValidationError

If dead_viscosity is not positive or rs is negative.

Notes
\[ \mu_o = A \mu_{od}^{B}, \quad A = 10.715 (R_s + 100)^{-0.515}, \quad B = 5.44 (R_s + 150)^{-0.338} \]

Beggs and Robinson (1975).

Examples:

>>> round(live_oil_viscosity_beggs_robinson(1.785, 393.5), 3)
0.639

undersaturated_oil_viscosity_vasquez_beggs

undersaturated_oil_viscosity_vasquez_beggs(pressure: ArrayLike, bubble_point: ArrayLike, saturated_viscosity: ArrayLike) -> FloatOrArray

Oil viscosity above the bubble point from Vasquez and Beggs.

Parameters:

Name Type Description Default
pressure array_like

Pressure, psia.

required
bubble_point array_like

Bubble-point pressure, psia.

required
saturated_viscosity array_like

Viscosity at the bubble point, cP.

required

Returns:

Type Description
float or ndarray

Oil viscosity, cP. Equals saturated_viscosity at or below the bubble point.

Raises:

Type Description
DataValidationError

If any input is not positive.

Notes
\[ \mu_o = \mu_{ob} (p / p_b)^{m}, \quad m = 2.6\,p^{1.187} \exp(-11.513 - 8.98\times10^{-5} p) \]

Vasquez and Beggs (1980).

Examples:

>>> round(undersaturated_oil_viscosity_vasquez_beggs(4000.0, 2000.0, 0.62), 3)
0.786

pseudo_critical_standing

pseudo_critical_standing(gas_gravity: ArrayLike) -> tuple[FloatOrArray, FloatOrArray]

Pseudo-critical temperature and pressure of a natural gas.

Parameters:

Name Type Description Default
gas_gravity array_like

Gas specific gravity (air = 1).

required

Returns:

Name Type Description
tpc float or ndarray

Pseudo-critical temperature, degR.

ppc float or ndarray

Pseudo-critical pressure, psia.

Raises:

Type Description
DataValidationError

If gas_gravity is not positive.

Notes

Standing's fit for natural gas systems (sweet, dry gas):

\[ T_{pc} = 168 + 325\gamma_g - 12.5\gamma_g^2, \quad p_{pc} = 677 + 15\gamma_g - 37.5\gamma_g^2 \]

Standing, M. B. (1977), Volumetric and Phase Behavior of Oil Field Hydrocarbon Systems, SPE.

Examples:

>>> tpc, ppc = pseudo_critical_standing(0.7)
>>> round(tpc, 2), round(ppc, 2)
(389.38, 669.12)

z_factor_hall_yarborough

z_factor_hall_yarborough(ppr: ArrayLike, tpr: ArrayLike, *, tol: float = 1e-12, max_iter: int = 100) -> FloatOrArray

Gas compressibility factor from the Hall-Yarborough equation of state.

Parameters:

Name Type Description Default
ppr array_like

Pseudo-reduced pressure.

required
tpr array_like

Pseudo-reduced temperature.

required
tol float

Convergence tolerance on the reduced density. Default 1e-12.

1e-12
max_iter int

Maximum Newton iterations. Default 100.

100

Returns:

Type Description
float or ndarray

Compressibility factor z.

Raises:

Type Description
DataValidationError

If ppr or tpr is not positive.

Warns:

Type Description
RangeWarning

Outside 1.0 <= Tpr <= 3.0 or Ppr > 24.

Notes

With \(t = 1/T_{pr}\), the reduced density \(y\) solves

\[ -A p_{pr} + \frac{y + y^2 + y^3 - y^4}{(1-y)^3} - B y^2 + C y^D = 0 \]

where \(A = 0.06125\,t\,e^{-1.2(1-t)^2}\), \(B = t(14.76 - 9.76t + 4.58t^2)\), \(C = t(90.7 - 242.2t + 42.4t^2)\) and \(D = 2.18 + 2.82t\). Then \(z = A p_{pr} / y\). Solved here by a damped Newton method.

Hall, K. R. and Yarborough, L. (1973), "A new equation of state for Z-factor calculations", Oil and Gas Journal 71(25), 82-92.

Examples:

>>> round(z_factor_hall_yarborough(1.5, 2.0), 4)
0.958

z_factor

z_factor(pressure: ArrayLike, temperature: ArrayLike, gas_gravity: ArrayLike) -> FloatOrArray

Gas compressibility factor from pressure, temperature and gravity.

Combines pseudo_critical_standing with z_factor_hall_yarborough.

Parameters:

Name Type Description Default
pressure array_like

Pressure, psia.

required
temperature array_like

Temperature, degF.

required
gas_gravity array_like

Gas specific gravity (air = 1).

required

Returns:

Type Description
float or ndarray

Compressibility factor z.

Raises:

Type Description
DataValidationError

If pressure or gas_gravity is not positive.

Examples:

>>> round(z_factor(2000.0, 180.0, 0.7), 3)
0.844

gas_fvf

gas_fvf(pressure: ArrayLike, temperature: ArrayLike, z: ArrayLike) -> FloatOrArray

Gas formation volume factor.

Parameters:

Name Type Description Default
pressure array_like

Pressure, psia.

required
temperature array_like

Temperature, degF.

required
z array_like

Gas compressibility factor.

required

Returns:

Type Description
float or ndarray

Gas formation volume factor, reservoir ft3 per scf. Divide by 5.615 for bbl/scf.

Raises:

Type Description
DataValidationError

If pressure or z is not positive.

Notes

From the real gas law between reservoir and standard conditions (14.7 psia, 60 degF):

\[ B_g = \frac{p_{sc}}{T_{sc}} \frac{z T}{p} = 0.02829 \frac{z T}{p} \]

with \(T\) in degR.

Examples:

>>> round(gas_fvf(2000.0, 180.0, 0.844), 6)
0.007636

black_oil_table

black_oil_table(pressure: ArrayLike, temperature: float, api: float, gas_gravity: float, rs_bubble: float) -> pd.DataFrame

Tabulate black-oil properties over a pressure range.

Below the bubble point Standing's Rs and Bo and the Beggs-Robinson live viscosity are used; above it Rs is constant and Bo and viscosity follow Vasquez-Beggs. Gas z and Bg are reported at every pressure.

Parameters:

Name Type Description Default
pressure array_like

Pressures, psia.

required
temperature float

Reservoir temperature, degF.

required
api float

Oil gravity, degrees API.

required
gas_gravity float

Gas specific gravity (air = 1).

required
rs_bubble float

Solution gas-oil ratio at the bubble point, scf/STB.

required

Returns:

Type Description
DataFrame

Columns pressure (psia), rs (scf/STB), bo (bbl/STB), mu_o (cP), z and bg (ft3/scf). The bubble point is stored in attrs["bubble_point"].

Examples:

>>> table = black_oil_table([1000.0, 3000.0], 200.0, 35.0, 0.75, 500.0)
>>> table[["pressure", "rs"]].round(0)
   pressure     rs
0    1000.0  196.0
1    3000.0  500.0