Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
/*
|
|
|
|
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPM_INITSTATEEQUIL_HEADER_INCLUDED
|
|
|
|
#define OPM_INITSTATEEQUIL_HEADER_INCLUDED
|
|
|
|
|
|
|
|
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
|
|
|
#include <opm/core/props/BlackoilPhases.hpp>
|
|
|
|
#include <opm/core/utility/linearInterpolation.hpp>
|
|
|
|
#include <opm/core/utility/Units.hpp>
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <cassert>
|
2014-01-17 13:07:51 -06:00
|
|
|
#include <utility>
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
#include <vector>
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Facilities for an ECLIPSE-style equilibration-based
|
|
|
|
* initialisation scheme (keyword 'EQUIL').
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
struct UnstructuredGrid;
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Types and routines that collectively implement a basic
|
|
|
|
* ECLIPSE-style equilibration-based initialisation scheme.
|
|
|
|
*
|
|
|
|
* This namespace is intentionally nested to avoid name clashes
|
|
|
|
* with other parts of OPM.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
namespace equil {
|
|
|
|
template <class Props>
|
|
|
|
class DensityCalculator;
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Facility for calculating phase densities based on the
|
|
|
|
* BlackoilPropertiesInterface.
|
|
|
|
*
|
|
|
|
* Implements the crucial <CODE>operator()(p,svol)</CODE>
|
|
|
|
* function that is expected by class EquilReg.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
template <>
|
|
|
|
class DensityCalculator< BlackoilPropertiesInterface > {
|
|
|
|
public:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* \param[in] props Implementation of the
|
|
|
|
* BlackoilPropertiesInterface.
|
|
|
|
*
|
|
|
|
* \param[in] c Single cell used as a representative cell
|
|
|
|
* in a PVT region.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
DensityCalculator(const BlackoilPropertiesInterface& props,
|
|
|
|
const int c)
|
|
|
|
: props_(props)
|
|
|
|
, c_(1, c)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Compute phase densities of all phases at phase point
|
|
|
|
* given by (pressure, surface volume) tuple.
|
|
|
|
*
|
|
|
|
* \param[in] p Fluid pressure.
|
|
|
|
*
|
|
|
|
* \param[in] z Surface volumes of all phases.
|
|
|
|
*
|
|
|
|
* \return Phase densities at phase point.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
std::vector<double>
|
|
|
|
operator()(const double p,
|
|
|
|
const std::vector<double>& z) const
|
|
|
|
{
|
|
|
|
const int np = props_.numPhases();
|
|
|
|
std::vector<double> A(np * np, 0);
|
|
|
|
|
|
|
|
assert (z.size() == std::vector<double>::size_type(np));
|
|
|
|
|
|
|
|
double* dAdp = 0;
|
|
|
|
props_.matrix(1, &p, &z[0], &c_[0], &A[0], dAdp);
|
|
|
|
|
|
|
|
std::vector<double> rho(np, 0.0);
|
|
|
|
props_.density(1, &A[0], &rho[0]);
|
|
|
|
|
|
|
|
return rho;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const BlackoilPropertiesInterface& props_;
|
|
|
|
const std::vector<int> c_;
|
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Types and routines relating to phase mixing in
|
|
|
|
* equilibration calculations.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
namespace miscibility {
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Type that implements "no phase mixing" policy.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
struct NoMixing {
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Function call.
|
|
|
|
*
|
|
|
|
* \param[in] depth Depth at which to calculate RS
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* \param[in] press Pressure at which to calculate RS
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* \return Dissolved gas-oil ratio (RS) at depth @c
|
|
|
|
* depth and pressure @c press. In "no mixing
|
|
|
|
* policy", this is identically zero.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double
|
|
|
|
operator()(const double /* depth */,
|
|
|
|
const double /* press */) const
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Type that implements "dissolved gas-oil ratio"
|
|
|
|
* tabulated as a function of depth policy. Data
|
|
|
|
* typically taken from keyword 'RSVD'.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
class RsVD {
|
|
|
|
public:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* \param[in] depth Depth nodes.
|
|
|
|
* \param[in] rs Dissolved gas-oil ratio at @c depth.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
RsVD(const std::vector<double>& depth,
|
|
|
|
const std::vector<double>& rs)
|
|
|
|
: depth_(depth)
|
|
|
|
, rs_(rs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Function call.
|
|
|
|
*
|
|
|
|
* \param[in] depth Depth at which to calculate RS
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* \param[in] press Pressure at which to calculate RS
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* \return Dissolved gas-oil ratio (RS) at depth @c
|
|
|
|
* depth and pressure @c press.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double
|
|
|
|
operator()(const double depth,
|
|
|
|
const double /* press */) const
|
|
|
|
{
|
|
|
|
return linearInterpolation(depth_, rs_, depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-01-19 18:25:33 -06:00
|
|
|
std::vector<double> depth_; /**< Depth nodes */
|
|
|
|
std::vector<double> rs_; /**< Dissolved gas-oil ratio */
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
};
|
|
|
|
} // namespace miscibility
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Forward and reverse mappings between cells and
|
|
|
|
* regions/partitions (e.g., the ECLIPSE-style 'SATNUM',
|
|
|
|
* 'PVTNUM', or 'EQUILNUM' arrays).
|
|
|
|
*
|
|
|
|
* \tparam Region Type of a forward region mapping. Expected
|
|
|
|
* to provide indexed access through
|
|
|
|
* operator[]() as well as inner types
|
|
|
|
* 'value_type', 'size_type', and
|
|
|
|
* 'const_iterator'.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
template < class Region = std::vector<int> >
|
|
|
|
class RegionMapping {
|
|
|
|
public:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* \param[in] reg Forward region mapping, restricted to
|
|
|
|
* active cells only.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
explicit
|
|
|
|
RegionMapping(const Region& reg)
|
|
|
|
: reg_(reg)
|
|
|
|
{
|
|
|
|
rev_.init(reg_);
|
|
|
|
}
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Type of forward (cell-to-region) mapping result.
|
|
|
|
* Expected to be an integer.
|
|
|
|
*/
|
|
|
|
typedef typename Region::value_type RegionId;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of reverse (region-to-cell) mapping (element)
|
|
|
|
* result.
|
|
|
|
*/
|
|
|
|
typedef typename Region::size_type CellId;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of reverse region-to-cell range bounds and
|
|
|
|
* iterators.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
typedef typename std::vector<CellId>::const_iterator CellIter;
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Range of cells. Result from reverse (region-to-cell)
|
|
|
|
* mapping.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
class CellRange {
|
|
|
|
public:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* \param[in] b Beginning of range.
|
|
|
|
* \param[in] e One past end of range.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
CellRange(const CellIter b,
|
|
|
|
const CellIter e)
|
|
|
|
: b_(b), e_(e)
|
|
|
|
{}
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Read-only iterator on cell ranges.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
typedef CellIter const_iterator;
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Beginning of cell range.
|
|
|
|
*/
|
|
|
|
const_iterator begin() const { return b_; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* One past end of cell range.
|
|
|
|
*/
|
|
|
|
const_iterator end() const { return e_; }
|
2014-01-17 13:07:51 -06:00
|
|
|
|
|
|
|
private:
|
2014-01-19 18:25:33 -06:00
|
|
|
const_iterator b_;
|
|
|
|
const_iterator e_;
|
2014-01-17 13:07:51 -06:00
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Number of declared regions in cell-to-region mapping.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
RegionId
|
|
|
|
numRegions() const { return RegionId(rev_.p.size()) - 1; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Compute region number of given active cell.
|
|
|
|
*
|
|
|
|
* \param[in] c Active cell
|
|
|
|
* \return Region to which @c c belongs.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
RegionId
|
|
|
|
region(const CellId c) const { return reg_[c]; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Extract active cells in particular region.
|
|
|
|
*
|
|
|
|
* \param[in] r Region number
|
|
|
|
* \returns Range of active cells in region @c r.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
CellRange
|
|
|
|
cells(const RegionId r) const {
|
|
|
|
const RegionId i = r - rev_.low;
|
|
|
|
return CellRange(rev_.c.begin() + rev_.p[i + 0],
|
|
|
|
rev_.c.begin() + rev_.p[i + 1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Copy of forward region mapping (cell-to-region).
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
Region reg_;
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Reverse mapping (region-to-cell).
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
struct {
|
|
|
|
typedef typename std::vector<CellId>::size_type Pos;
|
2014-01-19 18:25:33 -06:00
|
|
|
std::vector<Pos> p; /**< Region start pointers */
|
|
|
|
std::vector<CellId> c; /**< Region cells */
|
|
|
|
RegionId low; /**< Smallest region number */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute reverse mapping. Standard linear insertion
|
|
|
|
* sort algorithm.
|
|
|
|
*/
|
2014-01-17 13:07:51 -06:00
|
|
|
void
|
|
|
|
init(const Region& reg)
|
|
|
|
{
|
|
|
|
typedef typename Region::const_iterator CI;
|
|
|
|
const std::pair<CI,CI>
|
|
|
|
m = std::minmax_element(reg.begin(), reg.end());
|
|
|
|
|
|
|
|
low = *m.first;
|
|
|
|
|
|
|
|
const typename Region::size_type
|
|
|
|
n = *m.second - low + 1;
|
|
|
|
|
|
|
|
p.resize(n + 1); std::fill(p.begin(), p.end(), Pos(0));
|
|
|
|
for (CellId i = 0, nc = reg.size(); i < nc; ++i) {
|
|
|
|
p[ reg[i] - low + 1 ] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (typename std::vector<Pos>::size_type
|
|
|
|
i = 1, sz = p.size(); i < sz; ++i) {
|
|
|
|
p[0] += p[i];
|
|
|
|
p[i] = p[0] - p[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (p[0] ==
|
|
|
|
static_cast<typename Region::size_type>(reg.size()));
|
|
|
|
|
|
|
|
c.resize(reg.size());
|
|
|
|
for (CellId i = 0, nc = reg.size(); i < nc; ++i) {
|
|
|
|
c[ p[ reg[i] - low + 1 ] ++ ] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
p[0] = 0;
|
|
|
|
}
|
2014-01-19 18:25:33 -06:00
|
|
|
} rev_; /**< Reverse mapping instance */
|
2014-01-17 13:07:51 -06:00
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Equilibration record.
|
|
|
|
*
|
|
|
|
* Layout and contents inspired by first six items of
|
|
|
|
* ECLIPSE's 'EQUIL' records. This is the minimum amount of
|
|
|
|
* input data needed to define phase pressures in an
|
|
|
|
* equilibration region.
|
|
|
|
*
|
|
|
|
* Data consists of three pairs of depth and pressure values:
|
|
|
|
* 1. main
|
|
|
|
* - @c depth Main datum depth.
|
|
|
|
* - @c press Pressure at datum depth.
|
|
|
|
*
|
|
|
|
* 2. woc
|
|
|
|
* - @c depth Depth of water-oil contact
|
|
|
|
* - @c press water-oil capillary pressure at water-oil contact.
|
|
|
|
* Capillary pressure defined as "P_oil - P_water".
|
|
|
|
*
|
|
|
|
* 3. goc
|
|
|
|
* - @c depth Depth of gas-oil contact
|
|
|
|
* - @c press Gas-oil capillary pressure at gas-oil contact.
|
|
|
|
* Capillary pressure defined as "P_gas - P_oil".
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
struct EquilRecord {
|
|
|
|
struct {
|
|
|
|
double depth;
|
|
|
|
double press;
|
|
|
|
} main, woc, goc;
|
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Aggregate information base of an equilibration region.
|
|
|
|
*
|
|
|
|
* Provides inquiry methods for retrieving depths of contacs
|
|
|
|
* and pressure values as well as a means of calculating fluid
|
|
|
|
* densities, dissolved gas-oil ratio and vapourised oil-gas
|
|
|
|
* ratios.
|
|
|
|
*
|
|
|
|
* \tparam DensCalc Type that provides access to a phase
|
|
|
|
* density calculation facility. Must implement an operator()
|
|
|
|
* declared as
|
|
|
|
* <CODE>
|
|
|
|
* std::vector<double>
|
|
|
|
* operator()(const double press,
|
|
|
|
* const std::vector<double>& svol )
|
|
|
|
* </CODE>
|
|
|
|
* that calculates the phase densities of all phases in @c
|
|
|
|
* svol at fluid pressure @c press.
|
|
|
|
*
|
|
|
|
* \tparam RS Type that provides access to a calculator for
|
|
|
|
* (initial) dissolved gas-oil ratios as a function of depth
|
|
|
|
* and (oil) pressure. Must implement an operator() declared
|
|
|
|
* as
|
|
|
|
* <CODE>
|
|
|
|
* double
|
|
|
|
* operator()(const double depth,
|
|
|
|
* const double press)
|
|
|
|
* </CODE>
|
|
|
|
* that calculates the dissolved gas-oil ratio at depth @c
|
|
|
|
* depth and (oil) pressure @c press.
|
|
|
|
*
|
|
|
|
* \tparam RV Type that provides access to a calculator for
|
|
|
|
* (initial) vapourised oil-gas ratios as a function of depth
|
|
|
|
* and (gas) pressure. Must implement an operator() declared
|
|
|
|
* as
|
|
|
|
* <CODE>
|
|
|
|
* double
|
|
|
|
* operator()(const double depth,
|
|
|
|
* const double press)
|
|
|
|
* </CODE>
|
|
|
|
* that calculates the vapourised oil-gas ratio at depth @c
|
|
|
|
* depth and (gas) pressure @c press.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
template <class DensCalc,
|
|
|
|
class RS = miscibility::NoMixing,
|
|
|
|
class RV = miscibility::NoMixing>
|
|
|
|
class EquilReg {
|
|
|
|
public:
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* \param[in] rec Equilibration data of current region.
|
|
|
|
* \param[in] density Density calculator of current region.
|
|
|
|
* \param[in] rs Calculator of dissolved gas-oil ratio.
|
|
|
|
* \param[in] rv Calculator of vapourised oil-gas ratio.
|
|
|
|
* \param[in] pu Summary of current active phases.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
EquilReg(const EquilRecord& rec,
|
|
|
|
const DensCalc& density,
|
|
|
|
const RS& rs,
|
|
|
|
const RV& rv,
|
|
|
|
const PhaseUsage& pu)
|
|
|
|
: rec_ (rec)
|
|
|
|
, density_(density)
|
|
|
|
, rs_ (rs)
|
|
|
|
, rv_ (rv)
|
|
|
|
, pu_ (pu)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Type of density calculator.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
typedef DensCalc CalcDensity;
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Type of dissolved gas-oil ratio calculator.
|
|
|
|
*/
|
|
|
|
typedef RS CalcDissolution;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of vapourised oil-gas ratio calculator.
|
|
|
|
*/
|
|
|
|
typedef RV CalcEvaporation;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Datum depth in current region
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double datum() const { return this->rec_.main.depth; }
|
2014-01-19 18:25:33 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pressure at datum depth in current region.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double pressure() const { return this->rec_.main.press; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Depth of water-oil contact.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double zwoc() const { return this->rec_.woc .depth; }
|
2014-01-19 18:25:33 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* water-oil capillary pressure at water-oil contact.
|
|
|
|
*
|
|
|
|
* \return P_o - P_w at WOC.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double pcow_woc() const { return this->rec_.woc .press; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Depth of gas-oil contact.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double zgoc() const { return this->rec_.goc .depth; }
|
2014-01-19 18:25:33 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gas-oil capillary pressure at gas-oil contact.
|
|
|
|
*
|
|
|
|
* \return P_g - P_o at GOC.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
double pcgo_goc() const { return this->rec_.goc .press; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Retrieve phase density calculator of current region.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const CalcDensity&
|
|
|
|
densityCalculator() const { return this->density_; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Retrieve dissolved gas-oil ratio calculator of current
|
|
|
|
* region.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const CalcDissolution&
|
|
|
|
dissolutionCalculator() const { return this->rs_; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Retrieve vapourised oil-gas ratio calculator of current
|
|
|
|
* region.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const CalcEvaporation&
|
|
|
|
evaporationCalculator() const { return this->rv_; }
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Retrieve active fluid phase summary.
|
|
|
|
*/
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const PhaseUsage&
|
|
|
|
phaseUsage() const { return this->pu_; }
|
|
|
|
|
|
|
|
private:
|
2014-01-19 18:25:33 -06:00
|
|
|
EquilRecord rec_; /**< Equilibration data */
|
|
|
|
DensCalc density_; /**< Density calculator */
|
|
|
|
RS rs_; /**< RS calculator */
|
|
|
|
RV rv_; /**< RV calculator */
|
|
|
|
PhaseUsage pu_; /**< Active phase summary */
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
};
|
|
|
|
|
2014-01-19 18:25:33 -06:00
|
|
|
/**
|
|
|
|
* Compute initial phase pressures by means of equilibration.
|
|
|
|
*
|
|
|
|
* This function uses the information contained in an
|
|
|
|
* equilibration record (i.e., depths and pressurs) as well as
|
|
|
|
* a density calculator and related data to vertically
|
|
|
|
* integrate the phase pressure ODE
|
|
|
|
* \f[
|
|
|
|
* \frac{\mathrm{d}p_{\alpha}}{\mathrm{d}z} =
|
|
|
|
* \rho_{\alpha}(z,p_{\alpha})\cdot g
|
|
|
|
* \f]
|
|
|
|
* in which \f$\rho_{\alpha}$ denotes the fluid density of
|
|
|
|
* fluid phase \f$\alpha\f$, \f$p_{\alpha}\f$ is the
|
|
|
|
* corresponding phase pressure, \f$z\f$ is the depth and
|
|
|
|
* \f$g\f$ is the acceleration due to gravity (assumed
|
|
|
|
* directed downwords, in the positive \f$z\f$ direction).
|
|
|
|
*
|
|
|
|
* \tparam Region Type of an equilibration region information
|
|
|
|
* base. Typically an instance of the EquilReg
|
|
|
|
* class template.
|
|
|
|
*
|
|
|
|
* \tparam CellRange Type of cell range that demarcates the
|
|
|
|
* cells pertaining to the current
|
2014-01-20 03:33:42 -06:00
|
|
|
* equilibration region. Must implement
|
|
|
|
* methods begin() and end() to bound the range
|
|
|
|
* as well as provide an inner type,
|
|
|
|
* const_iterator, to traverse the range.
|
2014-01-19 18:25:33 -06:00
|
|
|
*
|
|
|
|
* \param[in] G Grid.
|
|
|
|
* \param[in] reg Current equilibration region.
|
|
|
|
* \param[in] cells Range that spans the cells of the current
|
|
|
|
* equilibration region.
|
|
|
|
* \param[in] grav Acceleration of gravity.
|
|
|
|
*
|
|
|
|
* \return Phase pressures, one vector for each active phase,
|
|
|
|
* of pressure values in each cell in the current
|
|
|
|
* equilibration region.
|
|
|
|
*/
|
2014-01-17 10:43:27 -06:00
|
|
|
template <class Region, class CellRange>
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
std::vector< std::vector<double> >
|
|
|
|
phasePressures(const UnstructuredGrid& G,
|
|
|
|
const Region& reg,
|
2014-01-17 10:43:27 -06:00
|
|
|
const CellRange& cells,
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const double grav = unit::gravity);
|
|
|
|
} // namespace equil
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#include <opm/core/simulator/initStateEquil_impl.hpp>
|
|
|
|
|
|
|
|
#endif // OPM_INITSTATEEQUIL_HEADER_INCLUDED
|