Loading...
Searching...
No Matches
EquilibrationHelpers.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_EQUILIBRATION_HELPERS_HPP
#define OPM_EQUILIBRATION_HELPERS_HPP
#include <opm/material/common/Tabulated1DFunction.hpp>
#include <opm/input/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <memory>
#include <vector>
/*
---- synopsis of EquilibrationHelpers.hpp ----
namespace Opm
{
namespace EQUIL {
namespace Miscibility {
class RsFunction;
class NoMixing;
template <class FluidSystem>
class RsVD;
template <class FluidSystem>
class RsSatAtContact;
}
class EquilReg;
template <class FluidSystem, class MaterialLawManager>
struct PcEq;
template <class FluidSystem, class MaterialLawManager>
double satFromPc(const MaterialLawManager& materialLawManager,
const int phase,
const int cell,
const double targetPc,
const bool increasing = false)
template <class FluidSystem, class MaterialLawManager>
double satFromSumOfPcs(const MaterialLawManager& materialLawManager,
const int phase1,
const int phase2,
const int cell,
const double targetPc)
} // namespace Equil
} // namespace Opm
---- end of synopsis of EquilibrationHelpers.hpp ----
*/
namespace Opm {
namespace EQUIL {
namespace Miscibility {
template<class Scalar>
class RsFunction
{
public:
virtual ~RsFunction() = default;
virtual Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar sat = 0.0) const = 0;
};
template<class Scalar>
class NoMixing : public RsFunction<Scalar>
{
public:
Scalar
operator()(const Scalar /* depth */,
const Scalar /* press */,
const Scalar /* temp */,
const Scalar /* sat */ = 0.0) const override
{
return 0.0;
}
};
template <class FluidSystem>
class RsVD : public RsFunction<typename FluidSystem::Scalar>
{
public:
using Scalar = typename FluidSystem::Scalar;
RsVD(const int pvtRegionIdx,
const std::vector<Scalar>& depth,
const std::vector<Scalar>& rs);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satGas = 0.0) const override;
private:
using RsVsDepthFunc = Tabulated1DFunction<Scalar>;
const int pvtRegionIdx_;
RsVsDepthFunc rsVsDepth_;
Scalar satRs(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class PBVD : public RsFunction<typename FluidSystem::Scalar>
{
public:
using Scalar = typename FluidSystem::Scalar;
PBVD(const int pvtRegionIdx,
const std::vector<Scalar>& depth,
const std::vector<Scalar>& pbub);
Scalar operator()(const Scalar depth,
const Scalar cellPress,
const Scalar temp,
const Scalar satGas = 0.0) const override;
private:
using PbubVsDepthFunc = Tabulated1DFunction<Scalar>;
const int pvtRegionIdx_;
PbubVsDepthFunc pbubVsDepth_;
Scalar satRs(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class PDVD : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
PDVD(const int pvtRegionIdx,
const std::vector<Scalar>& depth,
const std::vector<Scalar>& pdew);
Scalar operator()(const Scalar depth,
const Scalar cellPress,
const Scalar temp,
const Scalar satOil = 0.0) const override;
private:
using PdewVsDepthFunc = Tabulated1DFunction<Scalar>;
const int pvtRegionIdx_;
PdewVsDepthFunc pdewVsDepth_;
Scalar satRv(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class RvVD : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
RvVD(const int pvtRegionIdx,
const std::vector<Scalar>& depth,
const std::vector<Scalar>& rv);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satOil = 0.0) const override;
private:
using RvVsDepthFunc = Tabulated1DFunction<Scalar>;
const int pvtRegionIdx_;
RvVsDepthFunc rvVsDepth_;
Scalar satRv(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class RvwVD : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
RvwVD(const int pvtRegionIdx,
const std::vector<Scalar>& depth,
const std::vector<Scalar>& rvw);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satWat = 0.0) const override;
private:
using RvwVsDepthFunc = Tabulated1DFunction<Scalar>;
const int pvtRegionIdx_;
RvwVsDepthFunc rvwVsDepth_;
Scalar satRvw(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class RsSatAtContact : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
RsSatAtContact(const int pvtRegionIdx,
const Scalar pContact,
const Scalar T_contact);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satGas = 0.0) const override;
private:
const int pvtRegionIdx_;
Scalar rsSatContact_;
Scalar satRs(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class RvSatAtContact : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
RvSatAtContact(const int pvtRegionIdx,
const Scalar pContact,
const Scalar T_contact);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satOil = 0.0) const override;
private:
const int pvtRegionIdx_;
Scalar rvSatContact_;
Scalar satRv(const Scalar press, const Scalar temp) const;
};
template <class FluidSystem>
class RvwSatAtContact : public RsFunction<typename FluidSystem::Scalar>
{
using Scalar = typename FluidSystem::Scalar;
public:
RvwSatAtContact(const int pvtRegionIdx,
const Scalar pContact,
const Scalar T_contact);
Scalar operator()(const Scalar depth,
const Scalar press,
const Scalar temp,
const Scalar satWat = 0.0) const override;
private:
const int pvtRegionIdx_;
Scalar rvwSatContact_;
Scalar satRvw(const Scalar press, const Scalar temp) const;
};
} // namespace Miscibility
template<class Scalar>
class EquilReg
{
using TabulatedFunction = Tabulated1DFunction<Scalar>;
public:
EquilReg(const EquilRecord& rec,
std::shared_ptr<Miscibility::RsFunction<Scalar>> rs,
std::shared_ptr<Miscibility::RsFunction<Scalar>> rv,
std::shared_ptr<Miscibility::RsFunction<Scalar>> rvw,
const TabulatedFunction& tempVdTable,
const TabulatedFunction& saltVdTable,
const int pvtIdx);
using CalcDissolution = Miscibility::RsFunction<Scalar>;
using CalcEvaporation = Miscibility::RsFunction<Scalar>;
using CalcWaterEvaporation = Miscibility::RsFunction<Scalar>;
Scalar datum() const;
Scalar pressure() const;
Scalar zwoc() const;
Scalar pcowWoc() const;
Scalar zgoc() const;
Scalar pcgoGoc() const;
int equilibrationAccuracy() const;
const CalcDissolution& dissolutionCalculator() const;
const CalcEvaporation& evaporationCalculator() const;
const CalcWaterEvaporation& waterEvaporationCalculator() const;
const TabulatedFunction& saltVdTable() const;
const TabulatedFunction& tempVdTable() const;
int pvtIdx() const;
private:
EquilRecord rec_;
std::shared_ptr<Miscibility::RsFunction<Scalar>> rs_;
std::shared_ptr<Miscibility::RsFunction<Scalar>> rv_;
std::shared_ptr<Miscibility::RsFunction<Scalar>> rvw_;
const TabulatedFunction& tempVdTable_;
const TabulatedFunction& saltVdTable_;
const int pvtIdx_;
};
template <class FluidSystem, class MaterialLawManager>
struct PcEq
{
using Scalar = typename FluidSystem::Scalar;
PcEq(const MaterialLawManager& materialLawManager,
const int phase,
const int cell,
const Scalar targetPc);
Scalar operator()(Scalar s) const;
private:
const MaterialLawManager& materialLawManager_;
const int phase_;
const int cell_;
const Scalar targetPc_;
};
template <class FluidSystem, class MaterialLawManager>
typename FluidSystem::Scalar
minSaturations(const MaterialLawManager& materialLawManager,
const int phase, const int cell);
template <class FluidSystem, class MaterialLawManager>
typename FluidSystem::Scalar
maxSaturations(const MaterialLawManager& materialLawManager,
const int phase, const int cell);
template <class FluidSystem, class MaterialLawManager>
typename FluidSystem::Scalar
satFromPc(const MaterialLawManager& materialLawManager,
const int phase,
const int cell,
const typename FluidSystem::Scalar targetPc,
const bool increasing = false);
template <class FluidSystem, class MaterialLawManager>
struct PcEqSum
{
using Scalar = typename FluidSystem::Scalar;
PcEqSum(const MaterialLawManager& materialLawManager,
const int phase1,
const int phase2,
const int cell,
const Scalar targetPc);
Scalar operator()(Scalar s) const;
private:
const MaterialLawManager& materialLawManager_;
const int phase1_;
const int phase2_;
const int cell_;
const Scalar targetPc_;
};
template <class FluidSystem, class MaterialLawManager>
typename FluidSystem::Scalar
satFromSumOfPcs(const MaterialLawManager& materialLawManager,
const int phase1,
const int phase2,
const int cell,
const typename FluidSystem::Scalar targetPc);
template <class FluidSystem, class MaterialLawManager>
typename FluidSystem::Scalar
satFromDepth(const MaterialLawManager& materialLawManager,
const typename FluidSystem::Scalar cellDepth,
const typename FluidSystem::Scalar contactDepth,
const int phase,
const int cell,
const bool increasing = false);
template <class FluidSystem, class MaterialLawManager>
bool isConstPc(const MaterialLawManager& materialLawManager,
const int phase,
const int cell);
} // namespace Equil
} // namespace Opm
#endif // OPM_EQUILIBRATION_HELPERS_HPP
Opm::EQUIL::EquilReg::datum
Scalar datum() const
Datum depth in current region.
Definition EquilibrationHelpers_impl.hpp:373
Opm::EQUIL::EquilReg::pvtIdx
int pvtIdx() const
Retrieve pvtIdx of the region.
Definition EquilibrationHelpers_impl.hpp:450
Opm::EQUIL::EquilReg::CalcEvaporation
Miscibility::RsFunction< Scalar > CalcEvaporation
Type of vapourised oil-gas ratio calculator.
Definition EquilibrationHelpers.hpp:658
Opm::EQUIL::EquilReg::EquilReg
EquilReg(const EquilRecord &rec, std::shared_ptr< Miscibility::RsFunction< Scalar > > rs, std::shared_ptr< Miscibility::RsFunction< Scalar > > rv, std::shared_ptr< Miscibility::RsFunction< Scalar > > rvw, const TabulatedFunction &tempVdTable, const TabulatedFunction &saltVdTable, const int pvtIdx)
Constructor.
Definition EquilibrationHelpers_impl.hpp:355
Opm::EQUIL::EquilReg::pcgoGoc
Scalar pcgoGoc() const
Gas-oil capillary pressure at gas-oil contact.
Definition EquilibrationHelpers_impl.hpp:403
Opm::EQUIL::EquilReg::equilibrationAccuracy
int equilibrationAccuracy() const
Accuracy/strategy for initial fluid-in-place calculation.
Definition EquilibrationHelpers_impl.hpp:409
Opm::EQUIL::EquilReg::evaporationCalculator
const CalcEvaporation & evaporationCalculator() const
Retrieve vapourised oil-gas ratio calculator of current region.
Definition EquilibrationHelpers_impl.hpp:423
Opm::EQUIL::EquilReg::CalcWaterEvaporation
Miscibility::RsFunction< Scalar > CalcWaterEvaporation
Type of vapourised water-gas ratio calculator.
Definition EquilibrationHelpers.hpp:663
Opm::EQUIL::EquilReg::zgoc
Scalar zgoc() const
Depth of gas-oil contact.
Definition EquilibrationHelpers_impl.hpp:397
Opm::EQUIL::EquilReg::CalcDissolution
Miscibility::RsFunction< Scalar > CalcDissolution
Type of dissolved gas-oil ratio calculator.
Definition EquilibrationHelpers.hpp:653
Opm::EQUIL::EquilReg::pressure
Scalar pressure() const
Pressure at datum depth in current region.
Definition EquilibrationHelpers_impl.hpp:379
Opm::EQUIL::EquilReg::pcowWoc
Scalar pcowWoc() const
water-oil capillary pressure at water-oil contact.
Definition EquilibrationHelpers_impl.hpp:391
Opm::EQUIL::EquilReg::zwoc
Scalar zwoc() const
Depth of water-oil contact.
Definition EquilibrationHelpers_impl.hpp:385
Opm::EQUIL::EquilReg::dissolutionCalculator
const CalcDissolution & dissolutionCalculator() const
Retrieve dissolved gas-oil ratio calculator of current region.
Definition EquilibrationHelpers_impl.hpp:416
Opm::EQUIL::EquilReg::waterEvaporationCalculator
const CalcWaterEvaporation & waterEvaporationCalculator() const
Retrieve vapourised water-gas ratio calculator of current region.
Definition EquilibrationHelpers_impl.hpp:430
Opm::EQUIL::Miscibility::NoMixing
Type that implements "no phase mixing" policy.
Definition EquilibrationHelpers.hpp:135
Opm::EQUIL::Miscibility::NoMixing::operator()
Scalar operator()(const Scalar, const Scalar, const Scalar, const Scalar=0.0) const override
Function call.
Definition EquilibrationHelpers.hpp:145
Opm::EQUIL::Miscibility::PBVD::operator()
Scalar operator()(const Scalar depth, const Scalar cellPress, const Scalar temp, const Scalar satGas=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:107
Opm::EQUIL::Miscibility::PBVD::PBVD
PBVD(const int pvtRegionIdx, const std::vector< Scalar > &depth, const std::vector< Scalar > &pbub)
Constructor.
Definition EquilibrationHelpers_impl.hpp:96
Opm::EQUIL::Miscibility::PDVD::operator()
Scalar operator()(const Scalar depth, const Scalar cellPress, const Scalar temp, const Scalar satOil=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:144
Opm::EQUIL::Miscibility::PDVD::PDVD
PDVD(const int pvtRegionIdx, const std::vector< Scalar > &depth, const std::vector< Scalar > &pdew)
Constructor.
Definition EquilibrationHelpers_impl.hpp:133
Opm::EQUIL::Miscibility::RsFunction
Base class for phase mixing functions.
Definition EquilibrationHelpers.hpp:101
Opm::EQUIL::Miscibility::RsFunction::operator()
virtual Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar sat=0.0) const =0
Function call operator.
Opm::EQUIL::Miscibility::RsSatAtContact::RsSatAtContact
RsSatAtContact(const int pvtRegionIdx, const Scalar pContact, const Scalar T_contact)
Constructor.
Definition EquilibrationHelpers_impl.hpp:258
Opm::EQUIL::Miscibility::RsSatAtContact::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satGas=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:267
Opm::EQUIL::Miscibility::RsVD::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satGas=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:69
Opm::EQUIL::Miscibility::RsVD::RsVD
RsVD(const int pvtRegionIdx, const std::vector< Scalar > &depth, const std::vector< Scalar > &rs)
Constructor.
Definition EquilibrationHelpers_impl.hpp:58
Opm::EQUIL::Miscibility::RvSatAtContact::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satOil=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:299
Opm::EQUIL::Miscibility::RvSatAtContact::RvSatAtContact
RvSatAtContact(const int pvtRegionIdx, const Scalar pContact, const Scalar T_contact)
Constructor.
Definition EquilibrationHelpers_impl.hpp:290
Opm::EQUIL::Miscibility::RvVD::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satOil=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:181
Opm::EQUIL::Miscibility::RvVD::RvVD
RvVD(const int pvtRegionIdx, const std::vector< Scalar > &depth, const std::vector< Scalar > &rv)
Constructor.
Definition EquilibrationHelpers_impl.hpp:170
Opm::EQUIL::Miscibility::RvwSatAtContact::RvwSatAtContact
RvwSatAtContact(const int pvtRegionIdx, const Scalar pContact, const Scalar T_contact)
Constructor.
Definition EquilibrationHelpers_impl.hpp:322
Opm::EQUIL::Miscibility::RvwSatAtContact::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satWat=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:331
Opm::EQUIL::Miscibility::RvwVD::operator()
Scalar operator()(const Scalar depth, const Scalar press, const Scalar temp, const Scalar satWat=0.0) const override
Function call.
Definition EquilibrationHelpers_impl.hpp:224
Opm::EQUIL::Miscibility::RvwVD::RvwVD
RvwVD(const int pvtRegionIdx, const std::vector< Scalar > &depth, const std::vector< Scalar > &rvw)
Constructor.
Definition EquilibrationHelpers_impl.hpp:213
Opm::EQUIL::Miscibility
Types and routines relating to phase mixing in equilibration calculations.
Definition EquilibrationHelpers.hpp:94
Opm::EQUIL
Types and routines that collectively implement a basic ECLIPSE-style equilibration-based initialisati...
Definition EquilibrationHelpers.cpp:28
Opm::EQUIL::satFromDepth
FluidSystem::Scalar satFromDepth(const MaterialLawManager &materialLawManager, const typename FluidSystem::Scalar cellDepth, const typename FluidSystem::Scalar contactDepth, const int phase, const int cell, const bool increasing=false)
Compute saturation from depth. Used for constant capillary pressure function.
Definition EquilibrationHelpers_impl.hpp:650
Opm::EQUIL::satFromPc
FluidSystem::Scalar satFromPc(const MaterialLawManager &materialLawManager, const int phase, const int cell, const typename FluidSystem::Scalar targetPc, const bool increasing=false)
Compute saturation of some phase corresponding to a given capillary pressure.
Definition EquilibrationHelpers_impl.hpp:586
Opm::EQUIL::isConstPc
bool isConstPc(const MaterialLawManager &materialLawManager, const int phase, const int cell)
Return true if capillary pressure function is constant.
Definition EquilibrationHelpers_impl.hpp:670
Opm::EQUIL::satFromSumOfPcs
FluidSystem::Scalar satFromSumOfPcs(const MaterialLawManager &materialLawManager, const int phase1, const int phase2, const int cell, const typename FluidSystem::Scalar targetPc)
Compute saturation of some phase corresponding to a given capillary pressure, where the capillary pre...
Definition EquilibrationHelpers_impl.hpp:619
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43