27 #ifndef OPM_OIL_PVT_THERMAL_HPP
28 #define OPM_OIL_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 OilPvtMultiplexer;
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(
"THERMEX1");
83 enableThermalViscosity_ = deck.hasKeyword(
"VISCREF");
85 unsigned numRegions = isothermalPvt_->
numRegions();
89 if (deck.hasKeyword(
"VISCREF")) {
90 const auto& oilvisctTables = tables.getOilvisctTables();
91 const auto& viscrefKeyword = deck.getKeyword(
"VISCREF");
93 assert(oilvisctTables.size() == numRegions);
94 assert(viscrefKeyword.size() == numRegions);
96 for (
unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
97 const auto& TCol = oilvisctTables[regionIdx].getColumn(
"Temperature").vectorCopy();
98 const auto& muCol = oilvisctTables[regionIdx].getColumn(
"Viscosity").vectorCopy();
99 oilvisctCurves_[regionIdx].setXYContainers(TCol, muCol);
101 const auto& viscrefRecord = viscrefKeyword.getRecord(regionIdx);
102 viscrefPress_[regionIdx] = viscrefRecord.getItem(
"REFERENCE_PRESSURE").getSIDouble(0);
103 viscrefRs_[regionIdx] = viscrefRecord.getItem(
"REFERENCE_RS").getSIDouble(0);
108 Scalar Tref = 273.15 + 20;
111 viscRef_[regionIdx] =
114 viscrefPress_[regionIdx],
115 viscrefRs_[regionIdx]);
122 if (deck.hasKeyword(
"THERMEX1")) {
123 int oilCompIdx = deck.getKeyword(
"OCOMPIDX").getRecord(0).getItem(
"OIL_COMPONENT_INDEX").get<
int >(0) - 1;
126 refTemp_ = deck.getKeyword(
"TREF").getRecord(0).getItem(
"TEMPERATURE").getSIDouble(oilCompIdx);
127 refPress_ = deck.getKeyword(
"PREF").getRecord(0).getItem(
"PRESSURE").getSIDouble(oilCompIdx);
128 refC_ = deck.getKeyword(
"CREF").getRecord(0).getItem(
"COMPRESSIBILITY").getSIDouble(oilCompIdx);
129 thermex1_ = deck.getKeyword(
"THERMEX1").getRecord(0).getItem(
"EXPANSION_COEFF").getSIDouble(oilCompIdx);
132 #endif // HAVE_OPM_PARSER
139 oilvisctCurves_.resize(numRegions);
140 viscrefPress_.resize(numRegions);
141 viscrefRs_.resize(numRegions);
142 viscRef_.resize(numRegions);
155 {
return enableThermalDensity_; }
161 {
return enableThermalViscosity_; }
163 size_t numRegions()
const
164 {
return viscrefRs_.size(); }
169 template <
class Evaluation>
171 const Evaluation& temperature,
172 const Evaluation& pressure,
173 const Evaluation& Rs)
const
175 const auto& isothermalMu = isothermalPvt_->
viscosity(regionIdx, temperature, pressure, Rs);
180 const auto& muOilvisct = oilvisctCurves_[regionIdx].eval(temperature);
181 return muOilvisct/viscRef_[regionIdx]*isothermalMu;
187 template <
class Evaluation>
189 const Evaluation& temperature,
190 const Evaluation& pressure)
const
192 const auto& isothermalMu = isothermalPvt_->
saturatedViscosity(regionIdx, temperature, pressure);
197 const auto& muOilvisct = oilvisctCurves_[regionIdx].eval(temperature);
198 return muOilvisct/viscRef_[regionIdx]*isothermalMu;
205 template <
class Evaluation>
207 const Evaluation& temperature,
208 const Evaluation& pressure,
209 const Evaluation& Rs)
const
221 const auto& alpha = 1.0/(1 + thermex1_*(temperature - refTemp_));
228 template <
class Evaluation>
230 const Evaluation& temperature,
231 const Evaluation& pressure)
const
243 const auto& alpha = 1.0/(1 + thermex1_*(temperature - refTemp_));
254 template <
class Evaluation>
256 const Evaluation& temperature,
257 const Evaluation& pressure)
const
267 template <
class Evaluation>
269 const Evaluation& temperature,
270 const Evaluation& pressure,
271 const Evaluation& oilSaturation,
272 Scalar maxOilSaturation)
const
282 template <
class Evaluation>
284 const Evaluation& temperature,
285 const Evaluation& pressure)
const
289 IsothermalPvt* isothermalPvt_;
293 std::vector<TabulatedOneDFunction> oilvisctCurves_;
294 std::vector<Scalar> viscrefPress_;
295 std::vector<Scalar> viscrefRs_;
296 std::vector<Scalar> viscRef_;
306 bool enableThermalDensity_;
307 bool enableThermalViscosity_;
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rs) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: OilPvtThermal.hpp:170
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition: OilPvtMultiplexer.hpp:188
Evaluation saturatedGasDissolutionFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &oilSaturation, Scalar maxOilSaturation) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition: OilPvtThermal.hpp:268
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of gas-saturated oil phase.
Definition: OilPvtThermal.hpp:229
Evaluation saturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &Rs) const
Returns the saturation pressure [Pa] of oil given the mass fraction of the gas component in the oil p...
Definition: OilPvtMultiplexer.hpp:221
bool enableThermalDensity() const
Returns true iff the density of the oil phase is temperature dependent.
Definition: OilPvtThermal.hpp:154
Evaluation saturatedGasDissolutionFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition: OilPvtThermal.hpp:255
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rs) const
Returns the formation volume factor [-] of the fluid phase.
Definition: OilPvtMultiplexer.hpp:178
Evaluation saturatedGasDissolutionFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the gas dissolution factor [m^3/m^3] of saturated oil.
Definition: OilPvtMultiplexer.hpp:197
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: OilPvtThermal.hpp:188
Class implementing cubic splines.
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: OilPvtMultiplexer.hpp:169
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: OilPvtMultiplexer.hpp:152
Evaluation saturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the saturation pressure of the oil phase [Pa].
Definition: OilPvtThermal.hpp:283
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rs) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: OilPvtMultiplexer.hpp:159
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rs) const
Returns the formation volume factor [-] of the fluid phase.
Definition: OilPvtThermal.hpp:206
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition: OilPvtMultiplexer.hpp:75
Implements a linearly interpolated scalar function that depends on one variable.
A central place for various physical constants occuring in some equations.
bool enableThermalViscosity() const
Returns true iff the viscosity of the oil phase is temperature dependent.
Definition: OilPvtThermal.hpp:160
void setNumRegions(size_t numRegions)
Set the number of PVT-regions considered by this object.
Definition: OilPvtThermal.hpp:137
This class implements temperature dependence of the PVT properties of oil.
Definition: OilPvtThermal.hpp:55
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
void initEnd()
Finish initializing the thermal part of the oil phase PVT properties.
Definition: OilPvtThermal.hpp:148