27 #ifndef OPM_OIL_PVT_MULTIPLEXER_HPP
28 #define OPM_OIL_PVT_MULTIPLEXER_HPP
36 #define OPM_OIL_PVT_MULTIPLEXER_CALL(codeToCall) \
37 switch (approach_) { \
38 case ConstantCompressibilityOilPvt: { \
39 auto& pvtImpl = getRealPvt<ConstantCompressibilityOilPvt>(); \
44 auto& pvtImpl = getRealPvt<DeadOilPvt>(); \
49 auto& pvtImpl = getRealPvt<LiveOilPvt>(); \
53 case ThermalOilPvt: { \
54 auto& pvtImpl = getRealPvt<ThermalOilPvt>(); \
59 OPM_THROW(std::logic_error, "Not implemented: Oil PVT of this deck!"); \
74 template <
class Scalar,
bool enableThermal = true>
97 delete &getRealPvt<LiveOilPvt>();
101 delete &getRealPvt<DeadOilPvt>();
105 delete &getRealPvt<ConstantCompressibilityOilPvt>();
108 case ThermalOilPvt: {
109 delete &getRealPvt<ThermalOilPvt>();
124 void initFromDeck(
const Deck& deck,
const EclipseState& eclState)
126 bool enableOil = deck.hasKeyword(
"OIL");
131 && (deck.hasKeyword(
"THERMEX1")
132 || deck.hasKeyword(
"VISCREF")))
133 setApproach(ThermalOilPvt);
134 else if (deck.hasKeyword(
"PVCDO"))
136 else if (deck.hasKeyword(
"PVDO"))
138 else if (deck.hasKeyword(
"PVTO"))
141 OPM_OIL_PVT_MULTIPLEXER_CALL(pvtImpl.initFromDeck(deck, eclState));
143 #endif // HAVE_OPM_PARSER
147 { OPM_OIL_PVT_MULTIPLEXER_CALL(pvtImpl.initEnd()); }
153 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.numRegions());
return 1; }
158 template <
class Evaluation>
160 const Evaluation& temperature,
161 const Evaluation& pressure,
162 const Evaluation& Rs)
const
163 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rs));
return 0; }
168 template <
class Evaluation>
170 const Evaluation& temperature,
171 const Evaluation& pressure)
const
172 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure));
return 0; }
177 template <
class Evaluation>
179 const Evaluation& temperature,
180 const Evaluation& pressure,
181 const Evaluation& Rs)
const
182 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rs));
return 0; }
187 template <
class Evaluation>
189 const Evaluation& temperature,
190 const Evaluation& pressure)
const
191 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure));
return 0; }
196 template <
class Evaluation>
198 const Evaluation& temperature,
199 const Evaluation& pressure)
const
200 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure));
return 0; }
205 template <
class Evaluation>
207 const Evaluation& temperature,
208 const Evaluation& pressure,
209 const Evaluation& oilSaturation,
210 Scalar maxOilSaturation)
const
211 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation));
return 0; }
220 template <
class Evaluation>
222 const Evaluation& temperature,
223 const Evaluation& Rs)
const
224 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rs));
return 0; }
226 void setApproach(OilPvtApproach appr)
246 OPM_THROW(std::logic_error,
"Not implemented: Oil PVT of this deck!");
258 {
return approach_; }
261 template <OilPvtApproach approachV>
262 typename std::enable_if<approachV == LiveOilPvt, Opm::LiveOilPvt<Scalar> >::type& getRealPvt()
268 template <OilPvtApproach approachV>
269 typename std::enable_if<approachV == LiveOilPvt, const Opm::LiveOilPvt<Scalar> >::type& getRealPvt()
const
275 template <OilPvtApproach approachV>
276 typename std::enable_if<approachV == DeadOilPvt, Opm::DeadOilPvt<Scalar> >::type& getRealPvt()
282 template <OilPvtApproach approachV>
283 typename std::enable_if<approachV == DeadOilPvt, const Opm::DeadOilPvt<Scalar> >::type& getRealPvt()
const
289 template <OilPvtApproach approachV>
290 typename std::enable_if<approachV == ConstantCompressibilityOilPvt, Opm::ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
296 template <OilPvtApproach approachV>
297 typename std::enable_if<approachV == ConstantCompressibilityOilPvt, const Opm::ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
const
303 template <OilPvtApproach approachV>
304 typename std::enable_if<approachV == ThermalOilPvt, Opm::OilPvtThermal<Scalar> >::type& getRealPvt()
310 template <OilPvtApproach approachV>
311 typename std::enable_if<approachV == ThermalOilPvt, const Opm::OilPvtThermal<Scalar> >::type& getRealPvt()
const
318 OilPvtApproach approach_;
322 #undef OPM_OIL_PVT_MULTIPLEXER_CALL
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition: DeadOilPvt.hpp:46
OilPvtApproach approach() const
Returns the concrete approach for calculating the PVT relations.
Definition: OilPvtMultiplexer.hpp:257
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition: OilPvtMultiplexer.hpp:188
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
This class represents the Pressure-Volume-Temperature relations of the oil phas with dissolved gas...
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition: ConstantCompressibilityOilPvt.hpp:49
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
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
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
This class implements temperature dependence of the PVT properties of oil.
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
This class represents the Pressure-Volume-Temperature relations of the oil phas with dissolved gas...
Definition: LiveOilPvt.hpp:49
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 saturated oil.
Definition: OilPvtMultiplexer.hpp:206
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
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition: OilPvtMultiplexer.hpp:75
This class implements temperature dependence of the PVT properties of oil.
Definition: OilPvtThermal.hpp:55