bluebonnet.flow.flowproperties

Flow properties for reservoir fluids.

Pressure (or pseudo-pressure) changes affect all sorts of things. This module includes structures for storing these pressure-dependent properties in order to aid the reservoir simulators in the reservoir module.

Attributes

FlowPropertiesOnePhase

Alias for FlowProperties

Classes

FlowProperties

Flow properties for the system.

FlowPropertiesSimple

Flow properties where only viscosity and compressibility vary with pressure.

FlowPropertiesTwoPhase

Flow properties for the system.

FlowPropertiesMultiPhase

Flow properties for a multiphase system.

RelPermParams

Functions

rescale_pseudopressure(→ collections.abc.Mapping[str, ...)

Rescale pseudopressure to be 1 at p_i and 0 at p_frac.

alpha_multiphase(→ numpy.ndarray)

Calculate hydraulic diffusivity for a multiphase (two or three phase) system.

lambda_combined_func(→ numpy.ndarray)

Calculate mobility for three phase system.

compressibility_combined_func(→ numpy.ndarray)

Calculate three-phase compressibility.

pseudopressure_threephase(→ numpy.ndarray)

Calculate pseudopressure over pressure for three-phase fluid.

relative_permeabilities(→ numpy.ndarray)

Brooks-Corey power-law relative permeability.

relative_permeabilities_twophase(→ pandas.DataFrame)

Make two-phase relative permeability curves from Brooks-Corey.

Module Contents

class bluebonnet.flow.flowproperties.FlowProperties(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float)[source]

Flow properties for the system.

This is used to translate from scaled pseudopressure to diffusivity and to capture the effect of expansion

pvt_props

has accessors for pseudopressure, alpha, compressibility, viscosity, z-factor

  • pseudopressure: pseudopressure in psi^2/centipoise

  • pressure: pore pressure

  • alpha: hydraulic diffusivity

  • compressibility: total compressibility

  • viscosity: dynamic viscosity \(\mu\)

  • z-factor: compressibility factor, \(Z = p/\rho R T\)

  • m-scaled: pseudopressure scaled by initial pseudopressure

Type:

Mapping

m_i

pseudopressure that corresponds to initial reservoir pressure

Type:

float

m_scaled_func

calculates scaled pseudopressure from pressure

Type:

function

alpha_func

calculated hydraulic diffusivity from scaled pseudopressure

Type:

function

m_scaled_func
m_i
alpha
pvt_props
__repr__()[source]

Representation.

bluebonnet.flow.flowproperties.FlowPropertiesOnePhase

Alias for FlowProperties

class bluebonnet.flow.flowproperties.FlowPropertiesSimple(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float)[source]

Bases: FlowProperties

Flow properties where only viscosity and compressibility vary with pressure.

m_scaled_func
m_i
alpha
pvt_props
class bluebonnet.flow.flowproperties.FlowPropertiesTwoPhase(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float)[source]

Bases: FlowProperties

Flow properties for the system.

This is used to translate from scaled pseudopressure to diffusivity and to capture the effect of expansion

References

Ruiz Maraggi, L.M., Lake, L.W. and Walsh, M.P., 2020. “A Two-Phase Non-Linear One- Dimensional Flow Model for Reserves Estimation in Tight Oil and Gas Condensate Reservoirs Using Scaling Principles.” In SPE Latin American and Caribbean Petroleum Engineering Conference. OnePetro. https://doi.org/10.2118/199032-MS

classmethod from_table(pvt_props: collections.abc.Mapping, kr_props: collections.abc.Mapping, reference_densities: dict, phi: float, Sw: float, p_i: float)[source]

Create FlowProperties from tables.

Using fluid properties from a PVT table and a relative permeability table, builds an interpolator for alpha from pseudopressure

Parameters:
  • df_pvt (Mapping) –

    table of PVT properties by pressure with co-varying So

    columns: pseudopressure, pressure, Bo, Bg, Bw, Rs, Rv, mu_o, mu_g, mu_w, So

  • df_kr (Mapping) –

    table of relative permeabilities

    columns: So, Sg, Sw, kro, krg, krw

  • reference_densities (dictionary of strings pointing to floats) – density at STP for oil, gas, and water rho_o0: oil, rho_g0: gas, rho_w0: water

  • phi (float) – formation porosity (varies from 0 to 1)

  • Sw (float) – water saturation (assumes Sw below or equal to Swirr)

  • fvf_scale (float) – formation volume factor scale for recovery factor

bluebonnet.flow.flowproperties.rescale_pseudopressure(df_pvt: collections.abc.Mapping[str, numpy.ndarray], p_frac: float, p_i: float) collections.abc.Mapping[str, numpy.ndarray][source]

Rescale pseudopressure to be 1 at p_i and 0 at p_frac.

Parameters:
  • df_pvt (Mapping[str,ndarray]) – table of PVT properties, including at least “pressure” and “pseudopressure”

  • p_frac (float) – pressure at the frac face

  • p_i (float) – initial reservoir pressure

Returns:

df_pvt – new table of PVT properties

Return type:

Mapping[str,ndarray]

bluebonnet.flow.flowproperties.alpha_multiphase(pressure: numpy.ndarray, So: numpy.ndarray, phi: float, Sw: float, pvt: dict, kr: dict) numpy.ndarray[source]

Calculate hydraulic diffusivity for a multiphase (two or three phase) system.

Parameters:
  • pressure (ndarray) – absolute pressure for the cells

  • So (ndarray) – Oil saturation for the cells

  • phi (float) – porosity (assumed constant), in range from 0 to 1

  • Sw (float) – Water saturation (assumed constant)

  • pvt (dict) –

    PVT properties including

    • rho_x0: density at reference pressure

    • mu_x: viscosity (function of pressure)

    • Bx: formation volume factor (function of pressure) for the x-components o (oil), g (gas), w (water)

    • Rv, Rs: dissolved and free gas (functions of pressure)

  • kr (dict) –

    relative permeability for x-phases (o, g, w)

    krx: relative permeability (function of So)

Returns:

alpha_t – total hydraulic diffusivity

Return type:

ndarray

bluebonnet.flow.flowproperties.lambda_combined_func(pressure: numpy.ndarray, So: numpy.ndarray, pvt: dict, kr: dict) numpy.ndarray[source]

Calculate mobility for three phase system.

Parameters:
  • pressure (ndarray) – absolute pressure for the cells

  • So (ndarray) – Oil saturation for the cells

  • pvt (dict) –

    PVT properties including

    • rho_x0: density at reference pressure

    • mu_x: viscosity (function of pressure)

    • Bx: formation volume factor (function of pressure) for the x-components o (oil), g (gas), w (water)

    • Rv, Rs: dissolved and free gas (functions of pressure)

  • kr (dict) –

    relative permeability for x-phases (o, g, w)

    krx: relative permeability (function of So)

Returns:

lambda_t – mobility for the cells

Return type:

ndarray

bluebonnet.flow.flowproperties.compressibility_combined_func(pressure: numpy.ndarray, So: numpy.ndarray, phi: float, Sw: float | numpy.ndarray, pvt: dict) numpy.ndarray[source]

Calculate three-phase compressibility.

Parameters:
  • pressure (ndarray) – absolute pressure for the cells

  • So (ndarray) – Oil saturation for the cells

  • pvt (dict) –

    PVT properties including

    • rho_x0: density at reference pressure

    • mu_x: viscosity (function of pressure)

    • Bx: formation volume factor (function of pressure) for the x-components o (oil), g (gas), w (water)

    • Rv, Rs: dissolved and free gas (functions of pressure)

  • kr (dict) –

    relative permeability for x-phases (o, g, w)

    krx: relative permeability (function of So)

Returns:

cp – Total fluid compressibility for the cells

Return type:

ndarray

bluebonnet.flow.flowproperties.pseudopressure_threephase(pressure: numpy.ndarray, So: numpy.ndarray, pvt: dict, kr: dict) numpy.ndarray[source]

Calculate pseudopressure over pressure for three-phase fluid.

Parameters:
  • pressure (ndarray) – absolute pressure for the cells

  • So (ndarray) – Oil saturation for the cells

  • pvt (dict) –

    PVT properties including

    • rho_x0: density at reference pressure

    • mu_x: viscosity (function of pressure)

    • Bx: formation volume factor (function of pressure) for the x-components o (oil), g (gas), w (water)

    • Rv, Rs: dissolved and free gas (functions of pressure)

  • kr (dict) –

    relative permeability for x-phases (o, g, w)

    krx: relative permeability (function of So)

Returns:

pseudopressure

Return type:

ndarray

class bluebonnet.flow.flowproperties.FlowPropertiesMultiPhase(df: collections.abc.Mapping[str, numpy.ndarray])[source]

Bases: FlowProperties

Flow properties for a multiphase system.

This is used to translate from scaled pseudopressure and saturations to diffusivity and to capture the effect of expansion

Parameters:
  • df (Mapping) –

    has columns for pseudopressure, alpha, So, Sg, Sw

    • pseudopressure: pseudopressure scaled from 0 for frac face, 1 for initial reservoir conditions

    • alpha: hydraulic diffusivity (needn’t be scaled)

    • So: oil saturation

    • Sg: gas saturation

    • Sw: water saturation

  • fvf_scale (dict) – includes Bo,Bg,Bw at initial conditions divided by FVF at the frac face

df
alpha
class bluebonnet.flow.flowproperties.RelPermParams

Bases: tuple

n_o
n_w
n_g
S_or
S_wc
S_gc
k_ro_max
k_rw_max
k_rg_max
bluebonnet.flow.flowproperties.relative_permeabilities(saturations: numpy.ndarray, params: RelPermParams) numpy.ndarray[source]

Brooks-Corey power-law relative permeability.

\[\begin{split}k_{ro} = k_{ro,max}\left(\frac{S_o - S_{or}}{1-S_{or}-S_{wr}-S_{gr}}\right) \\ k_{rw} = k_{rw,max}\left(\frac{S_w - S_{wr}}{1-S_{or}-S_{wr}-S_{gr}}\right) \\ k_{rg} = k_{rg,max}\left(\frac{S_g - S_{gr}}{1-S_{or}-S_{wr}-S_{gr}}\right)\end{split}\]
Parameters:
  • saturations (ndarray, specifically a record array) – records include So, Sg, Sw

  • params (RelPermParams) – Includes Corey exponents, residual saturations, and max relative permeabilities

Returns:

k_rel – records include k_o, k_w, k_g (aka oil, water, gas)

Return type:

numpy record array

References

Brooks, R.H. and Corey, A.T. 1964. Hydraulic Properties of Porous Media. Hydrology Papers, No. 3, Colorado State U., Fort Collins, Colorado.

https://petrowiki.spe.org/Relative_permeability_models

bluebonnet.flow.flowproperties.relative_permeabilities_twophase(params: RelPermParams, Sw: float = 0.1) pandas.DataFrame[source]

Make two-phase relative permeability curves from Brooks-Corey.

Parameters:

params (RelPermParams) – Includes Corey exponents, residual saturations, and max relative permeabilities

Returns:

df_kr – k_rx for saturations. Includes the columns “So”,”Sw”,”Sg”,”kro”,”krw”,”krg”

Return type:

pd.DataFrame

Examples

>>> relperm_params = RelPermParams(
        n_o=1, n_g=1, n_w=1, S_or=0, S_gc=0, S_wc=0.1, k_ro_max=1, k_rw_max=1, k_rg_max=1
    )
>>> relative_permeabilities_twophase(relperm_params, 0.1)