Loading...
Searching...
No Matches
DeadOilPvt.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 2 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_DEAD_OIL_PVT_HPP
#define OPM_DEAD_OIL_PVT_HPP
#include <opm/material/common/Tabulated1DFunction.hpp>
#include <cstddef>
#include <vector>
namespace Opm {
#if HAVE_ECL_INPUT
class EclipseState;
class Schedule;
#endif
template <class Scalar>
class DeadOilPvt
{
public:
using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
#if HAVE_ECL_INPUT
void initFromState(const EclipseState& eclState, const Schedule&);
#endif // HAVE_ECL_INPUT
void setNumRegions(std::size_t numRegions);
void setVapPars(const Scalar, const Scalar)
{
}
void setReferenceDensities(unsigned regionIdx,
Scalar rhoRefOil,
Scalar /*rhoRefGas*/,
Scalar /*rhoRefWater*/)
{
oilReferenceDensity_[regionIdx] = rhoRefOil;
}
void setInverseOilFormationVolumeFactor(unsigned regionIdx,
const TabulatedOneDFunction& invBo)
{ inverseOilB_[regionIdx] = invBo; }
void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction& muo)
{ oilMu_[regionIdx] = muo; }
void initEnd();
unsigned numRegions() const
{ return inverseOilBMu_.size(); }
template <class Evaluation>
Evaluation internalEnergy(unsigned,
const Evaluation&,
const Evaluation&,
const Evaluation&) const
{
throw std::runtime_error("Requested the enthalpy of oil but the thermal "
"option is not enabled");
}
Scalar hVap(unsigned) const
{
throw std::runtime_error("Requested the hvap of oil but the thermal "
"option is not enabled");
}
template <class Evaluation>
Evaluation viscosity(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*Rs*/) const
{ return saturatedViscosity(regionIdx, temperature, pressure); }
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure) const
{
const Evaluation& invBo = inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true);
const Evaluation& invMuoBo = inverseOilBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
return invBo / invMuoBo;
}
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure,
const Evaluation& /*Rs*/) const
{ return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
template <class FluidState, class LhsEval = typename FluidState::Scalar>
std::pair<LhsEval, LhsEval>
inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
{
const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::oilPhaseIdx));
const auto segIdx = this->inverseOilB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
const auto& invBo = this->inverseOilB_[regionIdx].eval(p, SegmentIndex{segIdx});
const auto& invMuoBo = this->inverseOilBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
return { invBo, invBo / invMuoBo };
}
template <class Evaluation>
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure) const
{ return inverseOilB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
template <class Evaluation>
Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is dead oil! */ }
template <class Evaluation>
Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*oilSaturation*/,
const Evaluation& /*maxOilSaturation*/) const
{ return 0.0; /* this is dead oil! */ }
template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*Rs*/) const
{ return 0.0; /* this is dead oil, so there isn't any meaningful saturation pressure! */ }
template <class Evaluation>
Evaluation saturatedGasMassFraction(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is dead oil! */ }
template <class Evaluation>
Evaluation saturatedGasMoleFraction(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is dead oil! */ }
template <class Evaluation>
Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
unsigned /*compIdx*/) const
{
throw std::runtime_error("Not implemented: The PVT model does not provide "
"a diffusionCoefficient()");
}
Scalar oilReferenceDensity(unsigned regionIdx) const
{ return oilReferenceDensity_[regionIdx]; }
const std::vector<TabulatedOneDFunction>& inverseOilB() const
{ return inverseOilB_; }
const std::vector<TabulatedOneDFunction>& oilMu() const
{ return oilMu_; }
const std::vector<TabulatedOneDFunction>& inverseOilBMu() const
{ return inverseOilBMu_; }
private:
std::vector<Scalar> oilReferenceDensity_{};
std::vector<TabulatedOneDFunction> inverseOilB_{};
std::vector<TabulatedOneDFunction> oilMu_{};
std::vector<TabulatedOneDFunction> inverseOilBMu_{};
};
} // namespace Opm
#endif
Tabulated1DFunction.hpp
Implements a linearly interpolated scalar function that depends on one variable.
Opm::DeadOilPvt
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition DeadOilPvt.hpp:48
Opm::DeadOilPvt::setOilViscosity
void setOilViscosity(unsigned regionIdx, const TabulatedOneDFunction &muo)
Initialize the viscosity of the oil phase.
Definition DeadOilPvt.hpp:95
Opm::DeadOilPvt::saturatedGasDissolutionFactor
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition DeadOilPvt.hpp:190
Opm::DeadOilPvt::inverseFormationVolumeFactorAndViscosity
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition DeadOilPvt.hpp:166
Opm::DeadOilPvt::setInverseOilFormationVolumeFactor
void setInverseOilFormationVolumeFactor(unsigned regionIdx, const TabulatedOneDFunction &invBo)
Initialize the function for the oil formation volume factor.
Definition DeadOilPvt.hpp:86
Opm::DeadOilPvt::viscosity
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition DeadOilPvt.hpp:131
Opm::DeadOilPvt::setReferenceDensities
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DeadOilPvt.hpp:68
Opm::DeadOilPvt::initEnd
void initEnd()
Finish initializing the oil phase PVT properties.
Definition DeadOilPvt.cpp:92
Opm::DeadOilPvt::saturatedViscosity
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of gas saturated oil given a pressure.
Definition DeadOilPvt.hpp:141
Opm::DeadOilPvt::internalEnergy
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of oil given a set of parameters.
Definition DeadOilPvt.hpp:113
Opm::DeadOilPvt::saturatedInverseFormationVolumeFactor
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of saturated oil.
Definition DeadOilPvt.hpp:181
Opm::DeadOilPvt::saturationPressure
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the oil phase [Pa] depending on its mass fraction of the gas compo...
Definition DeadOilPvt.hpp:213
Opm::DeadOilPvt::inverseFormationVolumeFactor
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition DeadOilPvt.hpp:155
Opm::DeadOilPvt::numRegions
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition DeadOilPvt.hpp:106
Opm::DeadOilPvt::saturatedGasDissolutionFactor
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition DeadOilPvt.hpp:199
Opm::EclipseState
Definition EclipseState.hpp:62
Opm::Schedule
Definition Schedule.hpp:101
Opm::Tabulated1DFunction
Implements a linearly interpolated scalar function that depends on one variable.
Definition Tabulated1DFunction.hpp:51
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Opm::SegmentIndex
Definition Tabulated1DFunction.hpp:41