2013-05-22 03:56:14 -05:00
|
|
|
/*
|
|
|
|
Copyright 2013 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_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
|
|
|
|
#define OPM_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
|
|
|
|
|
|
|
|
#include <opm/autodiff/AutoDiffBlock.hpp>
|
|
|
|
#include <opm/core/props/BlackoilPhases.hpp>
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
|
|
|
/// This class is intended to present a fluid interface for
|
|
|
|
/// three-phase black-oil that is easy to use with the AD-using
|
|
|
|
/// simulators.
|
|
|
|
///
|
|
|
|
/// Most methods are available in two overloaded versions, one
|
|
|
|
/// taking a constant vector and returning the same, and one
|
|
|
|
/// taking an AD type and returning the same. Derivatives are not
|
|
|
|
/// returned separately by any method, only implicitly with the AD
|
|
|
|
/// version of the methods.
|
|
|
|
class BlackoilPropsAdInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Virtual destructor for inheritance.
|
|
|
|
virtual ~BlackoilPropsAdInterface();
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// Rock interface //
|
|
|
|
////////////////////////////
|
|
|
|
|
|
|
|
/// \return D, the number of spatial dimensions.
|
|
|
|
virtual int numDimensions() const = 0;
|
|
|
|
|
|
|
|
/// \return N, the number of cells.
|
|
|
|
virtual int numCells() const = 0;
|
|
|
|
|
|
|
|
/// \return Array of N porosity values.
|
|
|
|
virtual const double* porosity() const = 0;
|
|
|
|
|
|
|
|
/// \return Array of ND^2 permeability values.
|
|
|
|
/// The D^2 permeability values for a cell are organized as a matrix,
|
|
|
|
/// which is symmetric (so ordering does not matter).
|
|
|
|
virtual const double* permeability() const = 0;
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// Fluid interface //
|
|
|
|
////////////////////////////
|
|
|
|
|
2013-09-19 05:53:28 -05:00
|
|
|
typedef AutoDiffBlock<double> ADB;
|
2013-05-22 03:56:14 -05:00
|
|
|
typedef ADB::V V;
|
|
|
|
typedef ADB::M M;
|
|
|
|
typedef std::vector<int> Cells;
|
|
|
|
|
2013-05-23 11:26:25 -05:00
|
|
|
/// \return Number of active phases (also the number of components).
|
|
|
|
virtual int numPhases() const = 0;
|
|
|
|
|
|
|
|
/// \return Object describing the active phases.
|
|
|
|
virtual PhaseUsage phaseUsage() const = 0;
|
2013-05-22 03:56:14 -05:00
|
|
|
|
|
|
|
// ------ Canonical named indices for each phase ------
|
|
|
|
|
|
|
|
/// Canonical named indices for each phase.
|
2015-01-19 13:07:31 -06:00
|
|
|
enum PhaseIndex { Water = BlackoilPhases::Aqua, Oil = BlackoilPhases::Liquid,
|
|
|
|
Gas = BlackoilPhases::Vapour,
|
|
|
|
Aqua = BlackoilPhases::Aqua,
|
|
|
|
Liquid = BlackoilPhases::Liquid,
|
|
|
|
Vapour = BlackoilPhases::Vapour,
|
|
|
|
MaxNumPhases = BlackoilPhases::MaxNumPhases};
|
2013-05-22 03:56:14 -05:00
|
|
|
|
|
|
|
// ------ Density ------
|
|
|
|
|
|
|
|
/// Densities of stock components at surface conditions.
|
|
|
|
/// \return Array of 3 density values.
|
2014-05-06 08:01:08 -05:00
|
|
|
virtual const double* surfaceDensity(int regionIdx = 0) const = 0;
|
2013-05-22 03:56:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
// ------ Viscosity ------
|
|
|
|
|
|
|
|
/// Water viscosity.
|
|
|
|
/// \param[in] pw Array of n water pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n viscosity values.
|
|
|
|
virtual
|
|
|
|
ADB muWat(const ADB& pw,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2013-05-22 03:56:14 -05:00
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
|
|
|
/// Oil viscosity.
|
|
|
|
/// \param[in] po Array of n oil pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] rs Array of n gas solution factor values.
|
2013-12-04 05:08:46 -06:00
|
|
|
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n viscosity values.
|
|
|
|
virtual
|
|
|
|
ADB muOil(const ADB& po,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2013-05-22 03:56:14 -05:00
|
|
|
const ADB& rs,
|
2013-12-03 11:12:54 -06:00
|
|
|
const std::vector<PhasePresence>& cond,
|
2013-05-22 03:56:14 -05:00
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
|
|
|
/// Gas viscosity.
|
|
|
|
/// \param[in] pg Array of n gas pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2015-03-03 06:14:31 -06:00
|
|
|
/// \param[in] rv Array of n vapor oil/gas ratios.
|
|
|
|
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
|
2014-01-10 07:19:37 -06:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n viscosity values.
|
|
|
|
virtual
|
|
|
|
ADB muGas(const ADB& pg,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2014-01-10 07:19:37 -06:00
|
|
|
const ADB& rv,
|
|
|
|
const std::vector<PhasePresence>& cond,
|
|
|
|
const Cells& cells) const = 0;
|
2013-05-22 03:56:14 -05:00
|
|
|
|
|
|
|
// ------ Formation volume factor (b) ------
|
|
|
|
|
|
|
|
/// Water formation volume factor.
|
|
|
|
/// \param[in] pw Array of n water pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n formation volume factor values.
|
|
|
|
virtual
|
|
|
|
ADB bWat(const ADB& pw,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2013-05-22 03:56:14 -05:00
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
|
|
|
/// Oil formation volume factor.
|
|
|
|
/// \param[in] po Array of n oil pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] rs Array of n gas solution factor values.
|
2013-12-04 05:08:46 -06:00
|
|
|
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n formation volume factor values.
|
|
|
|
virtual
|
|
|
|
ADB bOil(const ADB& po,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2013-05-22 03:56:14 -05:00
|
|
|
const ADB& rs,
|
2013-12-03 11:12:54 -06:00
|
|
|
const std::vector<PhasePresence>& cond,
|
2013-05-22 03:56:14 -05:00
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
|
|
|
/// Gas formation volume factor.
|
|
|
|
/// \param[in] pg Array of n gas pressure values.
|
2014-11-20 05:31:50 -06:00
|
|
|
/// \param[in] T Array of n temperature values.
|
2015-03-03 07:33:19 -06:00
|
|
|
/// \param[in] rv Array of n vapor oil/gas ratios.
|
2013-12-13 10:01:43 -06:00
|
|
|
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n formation volume factor values.
|
|
|
|
virtual
|
|
|
|
ADB bGas(const ADB& pg,
|
2014-11-20 05:31:50 -06:00
|
|
|
const ADB& T,
|
2015-03-03 07:33:19 -06:00
|
|
|
const ADB& rv,
|
|
|
|
const std::vector<PhasePresence>& cond,
|
|
|
|
const Cells& cells) const = 0;
|
2013-12-13 10:01:43 -06:00
|
|
|
|
|
|
|
// ------ Rs bubble point curve ------
|
|
|
|
|
|
|
|
/// Bubble point curve for Rs as function of oil pressure.
|
|
|
|
/// \param[in] po Array of n oil pressure values.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n bubble point values for Rs.
|
|
|
|
virtual
|
|
|
|
ADB rsSat(const ADB& po,
|
|
|
|
const Cells& cells) const = 0;
|
2013-05-22 03:56:14 -05:00
|
|
|
|
2014-07-05 08:06:12 -05:00
|
|
|
/// Bubble point curve for Rs as function of oil pressure.
|
|
|
|
/// \param[in] po Array of n oil pressure values.
|
|
|
|
/// \param[in] so Array of n oil saturation values.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
|
|
|
/// \return Array of n bubble point values for Rs.
|
|
|
|
virtual
|
|
|
|
ADB rsSat(const ADB& po,
|
|
|
|
const ADB& so,
|
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
2015-03-05 11:47:04 -06:00
|
|
|
// ------ Rv condensation curve ------
|
2013-05-27 03:26:41 -05:00
|
|
|
|
2015-03-05 11:47:04 -06:00
|
|
|
/// Condensation curve for Rv as function of oil pressure.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] po Array of n oil pressure values.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
2015-03-05 11:47:04 -06:00
|
|
|
/// \return Array of n condensation point values for Rv.
|
2014-07-05 08:06:12 -05:00
|
|
|
virtual
|
|
|
|
ADB rvSat(const ADB& po,
|
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
2015-03-05 11:47:04 -06:00
|
|
|
/// Condensation curve for Rv as function of oil pressure.
|
2014-07-05 08:06:12 -05:00
|
|
|
/// \param[in] po Array of n oil pressure values.
|
|
|
|
/// \param[in] so Array of n oil saturation values.
|
2013-05-22 03:56:14 -05:00
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
|
2015-03-05 11:47:04 -06:00
|
|
|
/// \return Array of n condensation point values for Rv.
|
2013-05-22 03:56:14 -05:00
|
|
|
virtual
|
2013-12-13 10:01:43 -06:00
|
|
|
ADB rvSat(const ADB& po,
|
2014-07-05 08:06:12 -05:00
|
|
|
const ADB& so,
|
2013-05-22 03:56:14 -05:00
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
|
|
|
// ------ Relative permeability ------
|
|
|
|
|
|
|
|
/// Relative permeabilities for all phases.
|
|
|
|
/// \param[in] sw Array of n water saturation values.
|
|
|
|
/// \param[in] so Array of n oil saturation values.
|
|
|
|
/// \param[in] sg Array of n gas saturation values.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
|
|
|
|
/// \return An std::vector with 3 elements, each an array of n relperm values,
|
|
|
|
/// containing krw, kro, krg. Use PhaseIndex for indexing into the result.
|
|
|
|
virtual
|
|
|
|
std::vector<ADB> relperm(const ADB& sw,
|
|
|
|
const ADB& so,
|
|
|
|
const ADB& sg,
|
|
|
|
const Cells& cells) const = 0;
|
|
|
|
|
2013-11-26 06:51:10 -06:00
|
|
|
|
|
|
|
/// Capillary pressure for all phases.
|
|
|
|
/// \param[in] sw Array of n water saturation values.
|
|
|
|
/// \param[in] so Array of n oil saturation values.
|
|
|
|
/// \param[in] sg Array of n gas saturation values.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
|
|
|
|
/// \return An std::vector with 3 elements, each an array of n capillary pressure values,
|
|
|
|
/// containing the offsets for each p_g, p_o, p_w. The capillary pressure between
|
|
|
|
/// two arbitrary phases alpha and beta is then given as p_alpha - p_beta.
|
|
|
|
virtual
|
|
|
|
std::vector<ADB> capPress(const ADB& sw,
|
|
|
|
const ADB& so,
|
|
|
|
const ADB& sg,
|
|
|
|
const Cells& cells) const = 0;
|
2014-02-18 07:50:29 -06:00
|
|
|
|
|
|
|
/// Saturation update for hysteresis behavior.
|
|
|
|
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
|
|
|
|
virtual
|
|
|
|
void updateSatHyst(const std::vector<double>& saturation,
|
2014-03-04 06:09:23 -06:00
|
|
|
const std::vector<int>& cells) = 0;
|
2014-07-05 08:06:12 -05:00
|
|
|
|
|
|
|
/// Update for max oil saturation.
|
|
|
|
virtual
|
|
|
|
void updateSatOilMax(const std::vector<double>& saturation) = 0;
|
2013-05-22 03:56:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
|