27 #ifndef OPM_GAS_PVT_MULTIPLEXER_HPP
28 #define OPM_GAS_PVT_MULTIPLEXER_HPP
35 #include <opm/parser/eclipse/Deck/Deck.hpp>
36 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
37 #include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
38 #include <opm/parser/eclipse/Deck/DeckRecord.hpp>
42 #define OPM_GAS_PVT_MULTIPLEXER_CALL(codeToCall) \
43 switch (gasPvtApproach_) { \
45 auto& pvtImpl = getRealPvt<DryGasPvt>(); \
50 auto& pvtImpl = getRealPvt<WetGasPvt>(); \
54 case ThermalGasPvt: { \
55 auto& pvtImpl = getRealPvt<ThermalGasPvt>(); \
60 OPM_THROW(std::logic_error, "Not implemented: Gas PVT of this deck!"); \
74 template <
class Scalar,
bool enableThermal = true>
89 gasPvtApproach_ = NoGasPvt;
94 switch (gasPvtApproach_) {
96 delete &getRealPvt<DryGasPvt>();
100 delete &getRealPvt<WetGasPvt>();
103 case ThermalGasPvt: {
104 delete &getRealPvt<ThermalGasPvt>();
118 void initFromDeck(
const Deck& deck,
const EclipseState& eclState)
120 bool enableGas = deck.hasKeyword(
"GAS");
125 && (deck.hasKeyword(
"TREF")
126 || deck.hasKeyword(
"GASVISCT")))
127 setApproach(ThermalGasPvt);
128 else if (deck.hasKeyword(
"PVTG"))
130 else if (deck.hasKeyword(
"PVDG"))
133 OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.initFromDeck(deck, eclState));
135 #endif // HAVE_OPM_PARSER
137 void setApproach(GasPvtApproach gasPvtAppr)
139 switch (gasPvtAppr) {
153 OPM_THROW(std::logic_error,
"Not implemented: Gas PVT of this deck!");
156 gasPvtApproach_ = gasPvtAppr;
160 { OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.initEnd()); }
166 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.numRegions());
return 1; }
171 template <
class Evaluation = Scalar>
173 const Evaluation& temperature,
174 const Evaluation& pressure,
175 const Evaluation& Rv)
const
176 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rv));
return 0; }
181 template <
class Evaluation = Scalar>
183 const Evaluation& temperature,
184 const Evaluation& pressure)
const
185 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure));
return 0; }
190 template <
class Evaluation = Scalar>
192 const Evaluation& temperature,
193 const Evaluation& pressure,
194 const Evaluation& Rv)
const
195 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rv));
return 0; }
200 template <
class Evaluation = Scalar>
202 const Evaluation& temperature,
203 const Evaluation& pressure)
const
204 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure));
return 0; }
209 template <
class Evaluation = Scalar>
211 const Evaluation& temperature,
212 const Evaluation& pressure)
const
213 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure));
return 0; }
218 template <
class Evaluation = Scalar>
220 const Evaluation& temperature,
221 const Evaluation& pressure,
222 const Evaluation& oilSaturation,
223 Scalar maxOilSaturation)
const
224 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation));
return 0; }
232 template <
class Evaluation = Scalar>
234 const Evaluation& temperature,
235 const Evaluation& Rv)
const
236 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rv));
return 0; }
244 {
return gasPvtApproach_; }
247 template <GasPvtApproach approachV>
248 typename std::enable_if<approachV == DryGasPvt, Opm::DryGasPvt<Scalar> >::type& getRealPvt()
254 template <GasPvtApproach approachV>
255 typename std::enable_if<approachV == DryGasPvt, const Opm::DryGasPvt<Scalar> >::type& getRealPvt()
const
262 template <GasPvtApproach approachV>
263 typename std::enable_if<approachV == WetGasPvt, Opm::WetGasPvt<Scalar> >::type& getRealPvt()
269 template <GasPvtApproach approachV>
270 typename std::enable_if<approachV == WetGasPvt, const Opm::WetGasPvt<Scalar> >::type& getRealPvt()
const
277 template <GasPvtApproach approachV>
278 typename std::enable_if<approachV == ThermalGasPvt, Opm::GasPvtThermal<Scalar> >::type& getRealPvt()
284 template <GasPvtApproach approachV>
285 typename std::enable_if<approachV == ThermalGasPvt, const Opm::GasPvtThermal<Scalar> >::type& getRealPvt()
const
292 GasPvtApproach gasPvtApproach_;
296 #undef OPM_GAS_PVT_MULTIPLEXER_CALL
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 oil saturated gas.
Definition: GasPvtMultiplexer.hpp:219
This class represents the Pressure-Volume-Temperature relations of the gas phas with vaporized oil...
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition: GasPvtMultiplexer.hpp:75
This class implements temperature dependence of the PVT properties of gas.
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
This class represents the Pressure-Volume-Temperature relations of the gas phas with vaporized oil...
Definition: WetGasPvt.hpp:47
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
GasPvtApproach gasPvtApproach() const
Returns the concrete approach for calculating the PVT relations.
Definition: GasPvtMultiplexer.hpp:243
This class implements temperature dependence of the PVT properties of gas.
Definition: GasPvtThermal.hpp:55
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition: DryGasPvt.hpp:51
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
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
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
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