ad-props: PVT, fluid models and other properties for the AD-solvers

Functionality related to property calculations for the ad-core framework. Specifically, the module implements a variety of test fluids and functions that are used to create fluids from external datasets.

Props

Contents

AD-PROPS

Files
initSimpleADIFluid - Make a structure representing a fluid with up to three phases (water,
initSimpleADIFluid(varargin)

Make a structure representing a fluid with up to three phases (water, oil, gas) and their properties (relative permeabilities, densities, viscosities). Relative permeabilities are modeled as monomial functions of saturation. Densities are assumed constant, so the returned formation volume factors are constant equal to 1, unless compressibility factors are given as optional arguments.

Synopsis:

fluid = initSimpleADIFluid()
fluid = initSimpleADIFluid('pn1', 'pv1')
Keyword Arguments:
 
  • phases – A string containing up to three of the letters W, O, G, representing water, oil and gas respectively. The values of this input argument determines the interpretation of the other input arguments. For instance, the default is WOG, which will lead to the ‘rho’ input argument … ‘rho’, [1000, 700, 100]*kilogram/meter^3) to be interpreted as a water phase with density of 1000kg/m^3, the oil phase having a density 700 kg/m^3 and gas having a density of 100. However, if the input argument was … ‘rho’, [300, 500]) and ‘phases’ was ‘GO’, it would be interpreted as a gas-oil system with gas density of 300kg/m^3 and oil density of 500 kg/m^3. See the examples and the end of the documentation for more information.

  • mu – vector of viscosity values for phases present. For a three-phase model, this will be [muW, muO, muG]. Default is [1 1 1].

  • rho – vector of surface density values for phases present. For a three-phase model, this will be [rhoWS, rhoOS, rhoGS]. Default is [1 1 1].

  • n – vector of the degrees of the monomials describing relative permeability for each phase. Default is [1 1 1] (linear relative permeabilities for each phase). If the model is a three-phase model, oil-water and oil-gas relative permeability curves will also be added.

  • b – Inverse formation volume factors. The reservoir density of a phase is defined as rho_reservoir = rho_surf * b. The inverse formation volume factor, denoted small b, is the reciprocal of the large B often seen in literature, B = 1/b.

  • c – Compressibility factor. If specified for each phase, it will result in b-factors on the form

    b(p) = b_ref * exp((p-pRef)*c),
    

    where b_ref is the b-factor specified as keyword argument (see above) and pRef is specified as a seperate keyword (default: 0)

  • cR – Rock compressibility. If given, the fluid will contain a rock pore volume multiplier that gives a linear increase in pore volume with pressure, multiplied with cR:

    pv = pv_ref * (1 + (p-pRef)*cR)
    

    where pv_ref is the pore volume specified by the grid and rock models

  • smin – Minimal (connate) saturations for each phase. If > 0, these will scale rel-perms such that krX=0 for s <= smin(X) and krX = 1 for s >= 1 - sum(smin) + smin(X)

  • pRef – Reference pressure used in conjunction with rock and fluid compressibility factors c and cr, i.e:

    b(p) = b_ref * exp((p-p_ref)*c)
    pv = pv_ref * (1 + (p-pRef)*cR)
    

    Default value is pRef = 0

Returns:

fluid – struct containing the following functions (where X = ‘W’ [water], ‘O’ [oil] and ‘G’ [gas]):

  • krW, krO, krG - Relative permeability functions
  • rhoXS - density of X at surface conditions
  • bX(p) - inverse formation volume factor
  • muX(p) - viscosity functions (constant)
  • krX(s) - rel.perm for X
  • krOW, krOG - (If 3ph - oil-water and oil-gas rel.perm)

Example:

% Create an incompressible three-phase fluid with properties:
% water: rhoS = 1000kg/m^3, mu = 1.0cP
% oil:   rhoS =  700kg/m^3, mu = 5.0cP
% gas :  rhoS =  200kg/m^3, mu = 0.1cP
% And linear relative permeabilities
fluid = initSimpleADIFluid('phases', 'WOG', ...
                           'mu',      [1, 5, 0.1]*centi*poise,...
                           'rho'     [1000, 700, 200]*kilogram/meter^3)

% Create a two-phase, oil-water fluid where the oil phase is weakly
% compressible and quadratic relative permeabilities for both phases:
% water: rhoS = 1000kg/m^3, mu = 1.0cP, incompressible
% oil:   rhoS =  650kg/m^3, mu = 8.0cP, b(p)=exp((p-100*barsa)*1e-5/barsa)

fluid = initSimpleADIFluid('phases', 'OW', ...
                           'mu',      [8, 1]*centi*poise, ...
                           'rho',     [650, 1000]*kilogram/meter^3 , ...
                           'n',       [2, 2], ...
                           'pRef',    100*barsa, ...
                           'c',       [1e-5, 0]/barsa);
Contents

Files assignDENSITY - dens of size ntpvtx3 assignGRAVITY - Define Fluid Densites from API and Specific Fluid Gravity assignMISC - assignMSFN - assignOILVIST - Compute tables (static data) assignPLMIXPAR - assignPLYADS - assignPLYMAX - assignPLYROCK - assignPLYSHEAR - Polymer shear thinning/thickening assignPLYSHLOG - assignPLYVISC - assignPMISC - assignPVCDO - assignPVDG - assignPVDO - assignPVDS - assignPVTG - assignPVTO - assignPVTW - assignROCK - assignROCKTAB - assignRSCONSTT - assignRelPerm - assignRelPermScal - assignSDENSITY - dens of size ntpvtx3 assignSGFN - assignSGOF - assignSGWFN - Undocumented Utility Function assignSHRATE - assignSLGOF - assignSOF2 - assignSOF3 - assignSPECHEAT - Compute tables (static data) assignSPECROCK - Compute tables (static data) assignSSFN - assignSURFADS - assignSURFCAPD - assignSURFROCK - assignSURFST - assignSURFVISC - assignSWFN - assignSWOF - assignTLMIXPAR - assignVISCREF - dens of size ntpvtx3 assignWATERVIST - Compute tables (static data) initDeckADIFluid - Initialize AD-solver fluid from ECLIPSE-style input deck

assignDENSITY(f, density, reg)

dens of size ntpvtx3

assignGRAVITY(f, api, reg)

Define Fluid Densites from API and Specific Fluid Gravity

Synopsis:

fluid = assignGRAVITY(fluid, API, reg)
Parameters:
  • fluid – Partially formed ADI fluid object.
  • api – Fluid gravity data comprising oil API degrees, specific gravity of water relative to pure water, and specific gravity of gas relative to air.
  • reg – Region mapping structure.
Returns:

fluid – Partitally formed ADI fluid object, now with added fluid component mass density at surface conditions.

Note

The American Petroleum Institute defines the API gravity of oil as

API = (141.5 / SG) - 131.5

with ‘SG’ representing the specific gravity of oil relative to pure water, measured at standard/surface conditions; 1 atmosphere and 60 degrees Fahrenheit. API = 10 corresponds to an oil component whose mass density is equal to that of pure water at surface conditions.

See also

initDeckADIFluid.

assignOILVIST(f, table, reg)

Compute tables (static data)

assignPLYSHEAR(f, plyshear, reg)

Polymer shear thinning/thickening

assignSDENSITY(f, sdensity, reg)

dens of size ntpvtx3

assignSGWFN(f, sgfn, reg)

Undocumented Utility Function

assignSPECHEAT(f, specheat, reg)

Compute tables (static data)

assignSPECROCK(f, specheat, reg)

Compute tables (static data)

assignVISCREF(f, val, reg)

dens of size ntpvtx3

assignWATERVIST(f, table, reg)

Compute tables (static data)

initDeckADIFluid(deck, varargin)

Initialize AD-solver fluid from ECLIPSE-style input deck

Synopsis:

f = initDeckADIFluid(deck)
Parameters:

deck – Output structure from readEclipseDeck

Keyword Arguments:
 
  • G – Grid to be used for the fluid model. Only required for the situation when a deck has more than one region, and the intended simulation grid is different from the one defined by the deck (more specifically, the deck.GRID.ACTNUM field).

  • region_method – Method for defining regions. Either ‘deck’ (use exactly as prescribed in the input deck [DEFAULT] or ‘override’ which allows individual fields to be overwritten. Since the region support in MRST is abstracted away, this option should only be used if you are comfortable with the internal structure of getRegMap and interpReg.

  • regionOverride – Struct containing fields to be overwritten. Only used if ‘method’ equals ‘override’. The supported fields include PVTNUM, SATNUM, ROCKNUM, IMBNUM and SURFNUM. For each of these fields, if present, the value can be formatted in three different ways:

    • Single numerical value. Will be repeated for all grid cells.
    • The char ‘:’. Interpreted as using the first region for all cells. This is normally used when no regions are present.
    • A Nx1 array containing one region indicator per cell in the grid. The region indicator is a single number indicating which table is to be used for that cell.
  • singleRegion – Internal debug option. This region will be used for ALL fields and any other value than 1 or ‘:’ will usually result in exceptions being thrown.

Returns:

f – Fluid model suitable for several different MRST models.

See also

ThreePhaseBlackOilModel, TwoPhaseOilWaterModel, initEclipseDeck

Contents

SIMPLE

Files
coreyPhaseRelpermAD - Make function handle for AD style fluids tableByPressureLinearAD -
coreyPhaseRelpermAD(n, sr, kwm, sr_tot)

Make function handle for AD style fluids

n - exponent sr - residual saturation kwm - endpoint relperm sr_tot - sum of sr for all phases present

Utilities

Contents

UTILS

Files
dinterpReg - Interpolate table with multiple regions extendTab - getRegMap - Get region mapping from REGNUM array handleRegions - interp2DPVT - interp2DTable - interpPVT - Interpolate PVT-type curves interpReg - Interpolate data (with region support) interpRegPVT - Interpolate PVT-type curves with region support interpRegular2DTable -
dinterpReg(T, xi, reginx)

Interpolate table with multiple regions

getRegMap(val, REGNUM, REGINX, varargin)

Get region mapping from REGNUM array

Synopsis:

reginx = getRegMap(val, REGNUM, REGINX)
Parameters:
  • val – Lookup values that are to be used to evaluate region tables. Only used for dimension checking.
  • REGNUM – Array of region indicators per cell in the simulation grid.
  • REGINX – Override for output parameter. Only minimal checking is done in this case.
Keyword Arguments:
 

key – Parameter description

Returns:

reginx – Cell array of length equal to number of regions, where each entry corresponds to a list of cells belonging to that region.

Note

This is considered an internal function. The interface may change at any time, or the function may disappear into the void without warning.

See also

interpReg

interpPVT(T, xi, vi, flag)

Interpolate PVT-type curves

interpReg(T, xi, reginx)

Interpolate data (with region support)

Synopsis:

[yi, dyidxi] = interpReg(T, xi, reginx)
Parameters:
  • T – Interpolation table. Cell array of N tables for interpolation where N is the number of regions. Table should consist of a function f(x) in the format [x, f(x)] where x are points and f(x) is the function values, both in the format of column vectors.
  • xi – Query points where the function should be interpolated.
  • reginx – Cell array of length N, where each entry corresponds to a list of the cells present in a certain region. See getRegMap for details.
Returns:
  • yi – Function evaluated at given points, accounting for regions.
  • dyidxi – Slope at xi (only computed if requested).
interpRegPVT(T, xi, vi, flag, reginx)

Interpolate PVT-type curves with region support

Examples