Upscaling relative permeability in capillary limit
Each cell in the grid is populated with phase-permeabilities for either oil or water, for automatically chosen capillary pressure points, using porosity and permeability from the corner-point file, and using relative permeability curves for each rock type supplied on the command line.
The upscaled phase permeability is compared with already upscaled single-phase permeability in order to produce a value for relative permeability. The code automatically finds out (using a heuristic algorithm) which capillary pressure values are necessary in order to produce a sufficiently (adjustable) smooth relative permeability curve as a function of (also upscaled) water saturation.
Boundary conditions can be either fixed, periodic or linear, providing diagonal, symmetric or full permeability matrices respectively. By default, fixed boundary conditions are used.
Gravity can be included by specifying a non-zero gravitational acceleration, e.g 9.8 (unit: m/s²). If gravitation is non-zero, the densities of oil and water become relevant and can be adjusted.
- without gravity : Capillary equilibrium, the capillary pressure, , is spatially invariant throughout the geometry
- with gravity : Capillary-gravitational equilibrium, the capillary pressure is spatially invariant in the horizontal direction and adjusted according to pressure changes due to gravity forces in the vertical direction
Oil-gas systems can also be modeled with this code, just replace water with gas, and leave oil as it is. Resulting curves should thus be interpreted as functions of gas saturation.
The program can currently only be run from a Linux command line.
$ upscale_relperm <option> <eclipsefile> rock1.txt rock2.txt rock3.txt ...
If only one rock-file is supplied, that file is used for all stone types defined in the model. If more than one, it corresponds to the SATNUM-values in the model.
Typing upscale_relperm will output a list of options.
|-bc||Which boundary conditions to use. Possible values are p (periodic), f (fixed) or l (linear)||f (fixed)|
|-points||Number of pressure points/saturation points to upscale for within the saturation endpoints. These will be uniformly distributed.||30|
|-upscaleBothPhases||Whether to upscale both phases or not||true|
|-relPermCurve||if upscaleBothPhases is false and input is isotropic, this specifies the column number in the rock-files to be upscaled. Typically 2 (default) for water and 3 for oil.||2|
|-jFunctionCurve||if upscaleBothPhases is false and input is isotropic,the column number in the stone-files that represent the Leverett J-function.||4|
|-gravity||gravitational acceleration, in m/s². Use 9.8 for standard gravity.||0|
|-fluids||which two-phase fluid system we are dealing with. Possible values are ow (oil/water-system) and go (gas/oil-system)||ow|
|-surfaceTension||Surface tension in dynes/cm to use in J-function/Pc conversion. Contact angle is not supported, and is effectively used. If you need another contact angle, incorporate it into the value for surface tension.||11|
|-waterDensity||density of water, in g/cm³. Only relevant for non-zero gravity. If fluids is set to go (gas/oil), this should be set to density of gas.||1.0|
|-oilDensity||density of oil, in g/cm³. Only relevant for non-zero gravity.||0.6|
|-output||filename for where to write upscaled values. If not supplied, output will only go to the terminal (standard out). If upscaleBothPhases is true, this will also be the basename for SWOF and SGOF files for use in Eclipse||none|
|-doEclipseCheck||Check that input curves includes critical saturation points, i.e. saturation points where relperms are 0. See critRelpermThresh.||true|
|-critRelpermThresh||If minimum relperm value is less than this value, it is set to 0. Only applicable if doEclipseCheck is true.||1e-6|
|-interpolate||If this option is used, the outputted values will be interpolated values using the supplied number of points (integer larger than 0). Monotone cubic interpolation is used, and will thus produce a smooth curve for a few number of saturation points, and the interpolated curve will be more correct to the true curve occuring in nature. Default value is not do to interpolation, suggested value for interpolation is 1000.||none|
(some more advanced options can be found in the source code)
Note: With gravity, the length unit, , in the model matters. In the code, this is assumed to be
The contribution to capillary pressure from gravity forces is given by where is the height of the cell relative to the models midpoint. Thus if the length unit in the grid file is not cm, this can be adjusted by a different value of g. Example:
Steps in the code
- Process command line options
- Read Eclipse file
- Read relperm- and J-function for each stone type
- Tesselate the grid (Sintef code)
- If gravity is included, compute gravity pressure contributions in each cell:
- Compute height of model by averaging z-values of top layer corners
- Calculate density difference between phases in SI-units
- Go through each cell and find the z-values of the eight corners of the cell. Set height of cell equal to average of z-values of the corners minus half of model height to get the cell height relative to model centre. Set pressure difference for the cell equal to density difference times gravity constant times cell height times factor 10^-7 to obtain bars (same as p_c)
- Find minimum and maximum capillary pressure from the J-functions in each cell
- Upscale water saturation as a function of capillary pressure
- Upscale single phase permeability
- Upscale phase permeability for capillary pressures that corresponds to a uniform saturation grid, and compute relative permeability.
- Find capillary pressure point to compute for
- Find saturation and phase permeability in each cell
- Upscale phase permeability for given capillary pressure
- Print output to screen and optionally to file
Input link when ready
Example rock files
The input rock files specify relative permeability and J-function/capillary pressure data for each rock type in the model. If the model (given in grdecl-file) has isotropic permeability (only PERMX keyword present in grid file), the rock files must be given on the isotropic permeability input format. If the grid file has anisotropic permeability (PERMX, PERMY and PERMZ present), the rock files must be given on the anisotropic permeability input format.
Isotropic permeability input
This format has four columns. In the oil/water case, these are water saturation, relative permeability of water, relative permeability of oil and J-function. In the gas/oil case these columns represent gas saturation, relative permeability of gas, relative permeability of oil and J-function.
-- Stone 1 -- Sw Krw Kro J-func 1.42000E-01 0.00000E+00 1.00000E+00 2.25999E+00 2.20750E-01 4.85459E-04 7.70612E-01 9.66057E-02 2.79250E-01 1.93652E-03 5.03619E-01 5.76122E-02 3.16950E-01 3.28976E-03 3.96987E-01 4.56517E-02 4.14850E-01 1.09648E-02 2.36036E-01 -1.23421E-02 5.17700E-01 2.32991E-02 1.07830E-01 -6.47660E-02 6.14150E-01 4.10007E-02 3.95006E-02 -8.96693E-02 6.84300E-01 8.71209E-02 1.62730E-02 -1.08905E-01 7.26100E-01 1.41398E-01 9.30808E-03 -1.19849E-01 8.15150E-01 4.40215E-01 1.91211E-03 -1.71342E-01 9.48000E-01 8.40000E-01 0.00000E+00 -1.42553E+00
Anisotropic permeaility input
The code supports anisotropic permeability, and detects this automatically if PERMY and PERMZ is present.
In this case, J-function scaling is meaningless, so the file format for input relative permeability curves necessarily changes.
Unit of Pc must be in Pascal.
# Pc (Pa) Sw Krwxx Krwyy Krwzz Kroxx Kroyy Krozz 2.571e+12 0.3211 8.510e-08 7.133e-08 8.632e-08 0.9986 0.9986 0.9986 1.297e+09 0.4496 0.001017 0.0001684 0.001101 0.4932 0.5238 0.4809 2.096e+08 0.5782 0.01272 0.004576 0.01337 0.09749 0.1002 0.09424 -4.082e+08 0.6853 0.05311 0.05610 0.05190 0.01239 0.003922 0.01303 -1.476e+09 0.7710 0.1382 0.1396 0.1330 0.002607 0.0003292 0.002809 -4.591e+09 0.8567 0.3123 0.3316 0.3048 0.0001882 4.986e-06 0.0002085 -4.319e+11 0.9424 0.5642 0.5522 0.5657 1.102e-12 6.606e-13 1.200e-12
The program outputs the data on the same format as the anisotropic input format. If the option "output" is specyfied, the output is written to this file.
Also, if upscaleBothPhases is true, output meant for use in Eclipse simulations are made. If the "output" option is "myoutputfile.txt", then the corresponding Eclipse file would be named "myoutputfile-x.SWOF" for x-direction relperm in the oil/water case. In the oil/water case, the columns in this file is
Sw Krwxx Kroxx Pc
where Pc (capillary pressure) is given in bars.
In a gas/oil system, one can specify "krowxswirr", "krowyswirr" and "krowzswirr" to include the following line on top of each of the the tables (each direction correspondingly)
0 0 "krow*swirr" 0
The Eclipse output for a run may look like this
-- This file is based on the results in -- myrun.txt -- for relperm in x-direction. -- Pressure values (Pc) given in bars. -- Sw Krwxx Krowxx Pc(bar) --SWOF 0.3100 0.000 0.9990 2.727e+07 0.4700 0.003321 0.5406 5.773e+06 0.6300 0.03033 0.03947 -1.889e+05 0.7900 0.2642 0.004677 -2.293e+06 0.9500 0.5900 0.000 -4.476e+06 /
Then, to combine relative permeability tables for several runs into one include file for Eclipse, one can do
cat rock1-x.SWOF rock2-x.SWOF rock3-x.SWOF > myEclipseCaseWith3RockTypes.SWOF
and then uncomment the first SWOF, i.e. replace the first occurance of "--SWOF" to "SWOF"
The upscaling code only handles a limited permeability contrast (ratio of highest phase-permeability value to lowest value). High contrast ratios lead to numerical instability. Thus, this contrast is limited to 1e7. Given the highest phase-permeability for each pressure point/saturation point, the lowest permissible phase-permeability is computed, and all cells are ensured to have at least this minimum phase-permeability. Additionally, there is a fixed lower limit on phase permeability as well, it is never allowed to be less than 1e-12, as a value of zero renders the problem singular (these values can be adjusted by command line options).