27 #ifndef OPM_GAS_PVT_THERMAL_HPP
28 #define OPM_GAS_PVT_THERMAL_HPP
38 #include <opm/parser/eclipse/Deck/Deck.hpp>
39 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
40 #include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
41 #include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
45 template <
class Scalar,
bool enableThermal>
46 class GasPvtMultiplexer;
54 template <
class Scalar>
62 {
delete isothermalPvt_; }
68 void initFromDeck(
const Deck& deck,
69 const EclipseState& eclState)
75 isothermalPvt_->initFromDeck(deck, eclState);
80 const auto& tables = eclState.getTableManager();
82 enableThermalDensity_ = deck.hasKeyword(
"TREF");
83 enableThermalViscosity_ = deck.hasKeyword(
"GASVISCT");
85 unsigned numRegions = isothermalPvt_->
numRegions();
89 if (enableThermalViscosity_) {
90 const auto& gasvisctTables = tables.getGasvisctTables();
91 int gasCompIdx = deck.getKeyword(
"GCOMPIDX").getRecord(0).getItem(
"GAS_COMPONENT_INDEX").get<
int >(0) - 1;
92 std::string gasvisctColumnName =
"Viscosity"+std::to_string(static_cast<long long>(gasCompIdx));
94 for (
unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
95 const auto& T = gasvisctTables[regionIdx].getColumn(
"Temperature").vectorCopy();
96 const auto& mu = gasvisctTables[regionIdx].getColumn(gasvisctColumnName).vectorCopy();
97 gasvisctCurves_[regionIdx].setXYContainers(T, mu);
104 if (enableThermalDensity_) {
105 refTemp_ = deck.getKeyword(
"TREF").getRecord(0).getItem(
"TEMPERATURE").getSIDouble(0);
108 #endif // HAVE_OPM_PARSER
114 { gasvisctCurves_.resize(numRegions); }
122 size_t numRegions()
const
123 {
return gasvisctCurves_.size(); }
129 {
return enableThermalDensity_; }
135 {
return enableThermalViscosity_; }
140 template <
class Evaluation>
142 const Evaluation& temperature,
143 const Evaluation& pressure,
144 const Evaluation& Rv)
const
147 return isothermalPvt_->
viscosity(regionIdx, temperature, pressure, Rv);
150 const auto& muGasvisct = gasvisctCurves_[regionIdx].eval(temperature);
157 template <
class Evaluation>
159 const Evaluation& temperature,
160 const Evaluation& pressure)
const
166 const auto& muGasvisct = gasvisctCurves_[regionIdx].eval(temperature);
173 template <
class Evaluation>
175 const Evaluation& temperature,
176 const Evaluation& pressure,
177 const Evaluation& Rv)
const
188 return b*temperature/refTemp_;
194 template <
class Evaluation>
196 const Evaluation& temperature,
197 const Evaluation& pressure)
const
208 return b*temperature/refTemp_;
218 template <
class Evaluation>
220 const Evaluation& temperature,
221 const Evaluation& pressure)
const
231 template <
class Evaluation>
233 const Evaluation& temperature,
234 const Evaluation& pressure,
235 const Evaluation& oilSaturation,
236 Scalar maxOilSaturation)
const
246 template <
class Evaluation>
248 const Evaluation& temperature,
249 const Evaluation& pressure)
const
253 IsothermalPvt* isothermalPvt_;
257 std::vector<TabulatedOneDFunction> gasvisctCurves_;
264 bool enableThermalDensity_;
265 bool enableThermalViscosity_;
Evaluation saturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the saturation pressure of the gas phase [Pa].
Definition: GasPvtThermal.hpp:247
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv) const
Returns the formation volume factor [-] of the fluid phase.
Definition: GasPvtThermal.hpp:174
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of the oil-saturated gas phase given a set of parameters...
Definition: GasPvtThermal.hpp:158
bool enableThermalDensity() const
Returns true iff the density of the gas phase is temperature dependent.
Definition: GasPvtThermal.hpp:128
void setNumRegions(size_t numRegions)
Set the number of PVT-regions considered by this object.
Definition: GasPvtThermal.hpp:113
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition: GasPvtMultiplexer.hpp:75
Class implementing cubic splines.
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil saturated gas given a set of parameters.
Definition: GasPvtMultiplexer.hpp:201
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: GasPvtMultiplexer.hpp:165
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the oil vaporization factor [m^3/m^3] of oil saturated gas.
Definition: GasPvtMultiplexer.hpp:210
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the oil vaporization factor [m^3/m^3] of the gas phase.
Definition: GasPvtThermal.hpp:219
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil-saturated gas.
Definition: GasPvtThermal.hpp:195
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of oil saturated gas given a set of parameters.
Definition: GasPvtMultiplexer.hpp:182
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &oilSaturation, Scalar maxOilSaturation) const
Returns the oil vaporization factor [m^3/m^3] of the gas phase.
Definition: GasPvtThermal.hpp:232
Implements a linearly interpolated scalar function that depends on one variable.
A central place for various physical constants occuring in some equations.
This class implements temperature dependence of the PVT properties of gas.
Definition: GasPvtThermal.hpp:55
bool enableThermalViscosity() const
Returns true iff the viscosity of the gas phase is temperature dependent.
Definition: GasPvtThermal.hpp:134
This file provides a wrapper around the "final" C++-2011 statement.
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:47
Evaluation saturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &Rv) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition: GasPvtMultiplexer.hpp:233
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: GasPvtThermal.hpp:141
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv) const
Returns the formation volume factor [-] of the fluid phase.
Definition: GasPvtMultiplexer.hpp:191
void initEnd()
Finish initializing the thermal part of the gas phase PVT properties.
Definition: GasPvtThermal.hpp:119
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: GasPvtMultiplexer.hpp:172