bluebonnet.flow.flowproperties ============================== .. py:module:: bluebonnet.flow.flowproperties .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: bluebonnet.flow.flowproperties.FlowPropertiesOnePhase Classes ------- .. autoapisummary:: bluebonnet.flow.flowproperties.FlowProperties bluebonnet.flow.flowproperties.FlowPropertiesSimple bluebonnet.flow.flowproperties.FlowPropertiesTwoPhase bluebonnet.flow.flowproperties.FlowPropertiesMultiPhase bluebonnet.flow.flowproperties.RelPermParams Functions --------- .. autoapisummary:: bluebonnet.flow.flowproperties.rescale_pseudopressure bluebonnet.flow.flowproperties.alpha_multiphase bluebonnet.flow.flowproperties.lambda_combined_func bluebonnet.flow.flowproperties.compressibility_combined_func bluebonnet.flow.flowproperties.pseudopressure_threephase bluebonnet.flow.flowproperties.relative_permeabilities bluebonnet.flow.flowproperties.relative_permeabilities_twophase Module Contents --------------- .. py:class:: FlowProperties(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float) Flow properties for the system. This is used to translate from scaled pseudopressure to diffusivity and to capture the effect of expansion .. attribute:: 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 :math:`\mu` * `z-factor`: compressibility factor, :math:`Z = p/\rho R T` * `m-scaled`: pseudopressure scaled by initial pseudopressure :type: Mapping .. attribute:: m_i pseudopressure that corresponds to initial reservoir pressure :type: float .. attribute:: m_scaled_func calculates scaled pseudopressure from pressure :type: function .. attribute:: alpha_func calculated hydraulic diffusivity from scaled pseudopressure :type: function .. py:attribute:: m_scaled_func .. py:attribute:: m_i .. py:attribute:: alpha .. py:attribute:: pvt_props .. py:method:: __repr__() Representation. .. py:data:: FlowPropertiesOnePhase Alias for :code:`FlowProperties` .. py:class:: FlowPropertiesSimple(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float) Bases: :py:obj:`FlowProperties` Flow properties where only viscosity and compressibility vary with pressure. .. py:attribute:: m_scaled_func .. py:attribute:: m_i .. py:attribute:: alpha .. py:attribute:: pvt_props .. py:class:: FlowPropertiesTwoPhase(pvt_props: collections.abc.Mapping[str, numpy.ndarray], p_i: float) Bases: :py:obj:`FlowProperties` Flow properties for the system. This is used to translate from scaled pseudopressure to diffusivity and to capture the effect of expansion .. rubric:: 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 .. py:method:: from_table(pvt_props: collections.abc.Mapping, kr_props: collections.abc.Mapping, reference_densities: dict, phi: float, Sw: float, p_i: float) :classmethod: Create FlowProperties from tables. Using fluid properties from a PVT table and a relative permeability table, builds an interpolator for alpha from pseudopressure :param df_pvt: 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 :type df_pvt: Mapping :param df_kr: table of relative permeabilities columns: So, Sg, Sw, kro, krg, krw :type df_kr: Mapping :param reference_densities: density at STP for oil, gas, and water rho_o0: oil, rho_g0: gas, rho_w0: water :type reference_densities: dictionary of strings pointing to floats :param phi: formation porosity (varies from 0 to 1) :type phi: float :param Sw: water saturation (assumes Sw below or equal to Swirr) :type Sw: float :param fvf_scale: formation volume factor scale for recovery factor :type fvf_scale: float .. py:function:: rescale_pseudopressure(df_pvt: collections.abc.Mapping[str, numpy.ndarray], p_frac: float, p_i: float) -> collections.abc.Mapping[str, numpy.ndarray] Rescale pseudopressure to be 1 at p_i and 0 at p_frac. :param df_pvt: table of PVT properties, including at least "pressure" and "pseudopressure" :type df_pvt: Mapping[str,ndarray] :param p_frac: pressure at the frac face :type p_frac: float :param p_i: initial reservoir pressure :type p_i: float :returns: **df_pvt** -- new table of PVT properties :rtype: Mapping[str,ndarray] .. py:function:: alpha_multiphase(pressure: numpy.ndarray, So: numpy.ndarray, phi: float, Sw: float, pvt: dict, kr: dict) -> numpy.ndarray Calculate hydraulic diffusivity for a multiphase (two or three phase) system. :param pressure: absolute pressure for the cells :type pressure: ndarray :param So: Oil saturation for the cells :type So: ndarray :param phi: porosity (assumed constant), in range from 0 to 1 :type phi: float :param Sw: Water saturation (assumed constant) :type Sw: float :param pvt: 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) :type pvt: dict :param kr: relative permeability for x-phases (o, g, w) `krx`: relative permeability (function of So) :type kr: dict :returns: **alpha_t** -- total hydraulic diffusivity :rtype: ndarray .. py:function:: lambda_combined_func(pressure: numpy.ndarray, So: numpy.ndarray, pvt: dict, kr: dict) -> numpy.ndarray Calculate mobility for three phase system. :param pressure: absolute pressure for the cells :type pressure: ndarray :param So: Oil saturation for the cells :type So: ndarray :param pvt: 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) :type pvt: dict :param kr: relative permeability for x-phases (o, g, w) `krx`: relative permeability (function of So) :type kr: dict :returns: **lambda_t** -- mobility for the cells :rtype: ndarray .. py:function:: compressibility_combined_func(pressure: numpy.ndarray, So: numpy.ndarray, phi: float, Sw: float | numpy.ndarray, pvt: dict) -> numpy.ndarray Calculate three-phase compressibility. :param pressure: absolute pressure for the cells :type pressure: ndarray :param So: Oil saturation for the cells :type So: ndarray :param pvt: 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) :type pvt: dict :param kr: relative permeability for x-phases (o, g, w) `krx`: relative permeability (function of So) :type kr: dict :returns: **cp** -- Total fluid compressibility for the cells :rtype: ndarray .. py:function:: pseudopressure_threephase(pressure: numpy.ndarray, So: numpy.ndarray, pvt: dict, kr: dict) -> numpy.ndarray Calculate pseudopressure over pressure for three-phase fluid. :param pressure: absolute pressure for the cells :type pressure: ndarray :param So: Oil saturation for the cells :type So: ndarray :param pvt: 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) :type pvt: dict :param kr: relative permeability for x-phases (o, g, w) `krx`: relative permeability (function of So) :type kr: dict :returns: **pseudopressure** :rtype: ndarray .. py:class:: FlowPropertiesMultiPhase(df: collections.abc.Mapping[str, numpy.ndarray]) Bases: :py:obj:`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 :param df: 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 :type df: Mapping :param fvf_scale: includes Bo,Bg,Bw at initial conditions divided by FVF at the frac face :type fvf_scale: dict .. py:attribute:: df .. py:attribute:: alpha .. py:class:: RelPermParams Bases: :py:obj:`tuple` .. py:attribute:: n_o .. py:attribute:: n_w .. py:attribute:: n_g .. py:attribute:: S_or .. py:attribute:: S_wc .. py:attribute:: S_gc .. py:attribute:: k_ro_max .. py:attribute:: k_rw_max .. py:attribute:: k_rg_max .. py:function:: relative_permeabilities(saturations: numpy.ndarray, params: RelPermParams) -> numpy.ndarray Brooks-Corey power-law relative permeability. .. math :: 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) :param saturations: records include So, Sg, Sw :type saturations: ndarray, specifically a record array :param params: Includes Corey exponents, residual saturations, and max relative permeabilities :type params: RelPermParams :returns: **k_rel** -- records include k_o, k_w, k_g (aka oil, water, gas) :rtype: numpy record array .. rubric:: 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 .. py:function:: relative_permeabilities_twophase(params: RelPermParams, Sw: float = 0.1) -> pandas.DataFrame Make two-phase relative permeability curves from Brooks-Corey. :param params: Includes Corey exponents, residual saturations, and max relative permeabilities :type params: RelPermParams :returns: **df_kr** -- k_rx for saturations. Includes the columns "So","Sw","Sg","kro","krw","krg" :rtype: pd.DataFrame .. rubric:: 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)