Loading...
Searching...
No Matches
DryGasPvt.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_DRY_GAS_PVT_HPP
#define OPM_DRY_GAS_PVT_HPP
#include <opm/material/Constants.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 DryGasPvt
{
using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
public:
using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
#if HAVE_ECL_INPUT
void initFromState(const EclipseState& eclState, const Schedule&);
#endif
void setNumRegions(std::size_t numRegions);
void setVapPars(const Scalar, const Scalar)
{
}
void setReferenceDensities(unsigned regionIdx,
Scalar /*rhoRefOil*/,
Scalar rhoRefGas,
Scalar /*rhoRefWater*/)
{
gasReferenceDensity_[regionIdx] = rhoRefGas;
}
void setMolarMasses(unsigned /*regionIdx*/,
Scalar /*MOil*/,
Scalar /*MGas*/,
Scalar /*MWater*/)
{ }
void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
{ gasMu_[regionIdx] = mug; }
void setGasFormationVolumeFactor(unsigned regionIdx,
const SamplingPoints& samplePoints);
void initEnd();
unsigned numRegions() const
{ return gasReferenceDensity_.size(); }
template <class Evaluation>
Evaluation internalEnergy(unsigned,
const Evaluation&,
const Evaluation&,
const Evaluation&,
const Evaluation&) const
{
throw std::runtime_error("Requested the enthalpy of gas 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& /*Rv*/,
const Evaluation& /*Rvw*/) const
{ return saturatedViscosity(regionIdx, temperature, pressure); }
template <class Evaluation>
Evaluation saturatedViscosity(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure) const
{
const Evaluation& invBg = inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true);
const Evaluation& invMugBg = inverseGasBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
return invBg / invMugBg;
}
template <class Evaluation>
Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& temperature,
const Evaluation& pressure,
const Evaluation& /*Rv*/,
const Evaluation& /*Rvw*/) const
{ return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
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::gasPhaseIdx));
const auto segIdx = this->inverseGasB_[regionIdx].findSegmentIndex(p, /*extrapolate=*/ true);
const auto& invBg = this->inverseGasB_[regionIdx].eval(p, SegmentIndex{segIdx});
const auto& invMugBg = this->inverseGasBMu_[regionIdx].eval(p, SegmentIndex{segIdx});
return { invBg, invBg / invMugBg };
}
template <class Evaluation>
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
const Evaluation& /*temperature*/,
const Evaluation& pressure) const
{ return inverseGasB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*Rv*/) const
{ return 0.0; /* this is dry gas! */ }
template <class Evaluation>
Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is non-humid gas! */ }
template <class Evaluation = Scalar>
Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*saltConcentration*/) const
{ return 0.0; }
template <class Evaluation>
Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*oilSaturation*/,
const Evaluation& /*maxOilSaturation*/) const
{ return 0.0; /* this is dry gas! */ }
template <class Evaluation>
Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is dry gas! */ }
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 gasReferenceDensity(unsigned regionIdx) const
{ return gasReferenceDensity_[regionIdx]; }
const std::vector<TabulatedOneDFunction>& inverseGasB() const
{ return inverseGasB_; }
const std::vector<TabulatedOneDFunction>& gasMu() const
{ return gasMu_; }
const std::vector<TabulatedOneDFunction>& inverseGasBMu() const
{ return inverseGasBMu_; }
private:
std::vector<Scalar> gasReferenceDensity_{};
std::vector<TabulatedOneDFunction> inverseGasB_{};
std::vector<TabulatedOneDFunction> gasMu_{};
std::vector<TabulatedOneDFunction> inverseGasBMu_{};
};
} // namespace Opm
#endif
Constants.hpp
Tabulated1DFunction.hpp
Implements a linearly interpolated scalar function that depends on one variable.
Opm::DryGasPvt
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition DryGasPvt.hpp:50
Opm::DryGasPvt::saturatedViscosity
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of oil saturated gas at given pressure.
Definition DryGasPvt.hpp:153
Opm::DryGasPvt::saturationPressure
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition DryGasPvt.hpp:205
Opm::DryGasPvt::internalEnergy
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition DryGasPvt.hpp:123
Opm::DryGasPvt::numRegions
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition DryGasPvt.hpp:116
Opm::DryGasPvt::setGasFormationVolumeFactor
void setGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of dry gas.
Definition DryGasPvt.cpp:103
Opm::DryGasPvt::inverseFormationVolumeFactor
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition DryGasPvt.hpp:167
Opm::DryGasPvt::saturatedWaterVaporizationFactor
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of water saturated gas.
Definition DryGasPvt.hpp:223
Opm::DryGasPvt::saturatedOilVaporizationFactor
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition DryGasPvt.hpp:244
Opm::DryGasPvt::viscosity
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition DryGasPvt.hpp:142
Opm::DryGasPvt::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 DryGasPvt.hpp:179
Opm::DryGasPvt::saturatedInverseFormationVolumeFactor
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil saturated gas at given pressure.
Definition DryGasPvt.hpp:192
Opm::DryGasPvt::initEnd
void initEnd()
Finish initializing the oil phase PVT properties.
Definition DryGasPvt.cpp:117
Opm::DryGasPvt::saturatedWaterVaporizationFactor
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition DryGasPvt.hpp:214
Opm::DryGasPvt::setMolarMasses
void setMolarMasses(unsigned, Scalar, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:85
Opm::DryGasPvt::setGasViscosity
void setGasViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the gas phase.
Definition DryGasPvt.hpp:96
Opm::DryGasPvt::setReferenceDensities
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition DryGasPvt.hpp:74
Opm::DryGasPvt::saturatedOilVaporizationFactor
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition DryGasPvt.hpp:233
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