27#ifndef OPM_GAS_PVT_MULTIPLEXER_HPP
28#define OPM_GAS_PVT_MULTIPLEXER_HPP
45#define OPM_GAS_PVT_MULTIPLEXER_CALL(codeToCall) \
46 switch (gasPvtApproach_) { \
47 case GasPvtApproach::DryGas: { \
48 auto& pvtImpl = getRealPvt<GasPvtApproach::DryGas>(); \
52 case GasPvtApproach::DryHumidGas: { \
53 auto& pvtImpl = getRealPvt<GasPvtApproach::DryHumidGas>(); \
57 case GasPvtApproach::WetHumidGas: { \
58 auto& pvtImpl = getRealPvt<GasPvtApproach::WetHumidGas>(); \
62 case GasPvtApproach::WetGas: { \
63 auto& pvtImpl = getRealPvt<GasPvtApproach::WetGas>(); \
67 case GasPvtApproach::ThermalGas: { \
68 auto& pvtImpl = getRealPvt<GasPvtApproach::ThermalGas>(); \
72 case GasPvtApproach::Co2Gas: { \
73 auto& pvtImpl = getRealPvt<GasPvtApproach::Co2Gas>(); \
77 case GasPvtApproach::H2Gas: { \
78 auto& pvtImpl = getRealPvt<GasPvtApproach::H2Gas>(); \
82 case GasPvtApproach::NoGas: \
83 throw std::logic_error("Not implemented: Gas PVT of this deck!"); \
86enum class GasPvtApproach {
107template <
class Scalar,
bool enableThermal = true>
113 gasPvtApproach_ = GasPvtApproach::NoGas;
114 realGasPvt_ =
nullptr;
118 : gasPvtApproach_(approach)
119 , realGasPvt_(realGasPvt)
129 switch (gasPvtApproach_) {
130 case GasPvtApproach::DryGas: {
131 delete &getRealPvt<GasPvtApproach::DryGas>();
134 case GasPvtApproach::DryHumidGas: {
135 delete &getRealPvt<GasPvtApproach::DryHumidGas>();
138 case GasPvtApproach::WetHumidGas: {
139 delete &getRealPvt<GasPvtApproach::WetHumidGas>();
142 case GasPvtApproach::WetGas: {
143 delete &getRealPvt<GasPvtApproach::WetGas>();
146 case GasPvtApproach::ThermalGas: {
147 delete &getRealPvt<GasPvtApproach::ThermalGas>();
150 case GasPvtApproach::Co2Gas: {
151 delete &getRealPvt<GasPvtApproach::Co2Gas>();
154 case GasPvtApproach::H2Gas: {
155 delete &getRealPvt<GasPvtApproach::H2Gas>();
158 case GasPvtApproach::NoGas:
172 void setApproach(GasPvtApproach gasPvtAppr)
174 switch (gasPvtAppr) {
175 case GasPvtApproach::DryGas:
179 case GasPvtApproach::DryHumidGas:
183 case GasPvtApproach::WetHumidGas:
187 case GasPvtApproach::WetGas:
191 case GasPvtApproach::ThermalGas:
195 case GasPvtApproach::Co2Gas:
199 case GasPvtApproach::H2Gas:
203 case GasPvtApproach::NoGas:
204 throw std::logic_error(
"Not implemented: Gas PVT of this deck!");
207 gasPvtApproach_ = gasPvtAppr;
211 { OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.initEnd()); }
217 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.numRegions());
return 1; }
219 void setVapPars(
const Scalar par1,
const Scalar par2)
221 OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.setVapPars(par1, par2));
228 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.gasReferenceDensity(regionIdx));
return 2.; }
233 template <
class Evaluation>
235 const Evaluation& temperature,
236 const Evaluation& pressure,
237 const Evaluation& Rv,
238 const Evaluation& Rvw)
const
239 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.internalEnergy(regionIdx, temperature, pressure, Rv, Rvw));
return 0; }
244 template <
class Evaluation = Scalar>
246 const Evaluation& temperature,
247 const Evaluation& pressure,
248 const Evaluation& Rv,
249 const Evaluation& Rvw )
const
250 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rv, Rvw));
return 0; }
255 template <
class Evaluation = Scalar>
257 const Evaluation& temperature,
258 const Evaluation& pressure)
const
259 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure));
return 0; }
264 template <
class Evaluation = Scalar>
266 const Evaluation& temperature,
267 const Evaluation& pressure,
268 const Evaluation& Rv,
269 const Evaluation& Rvw)
const
270 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rv, Rvw));
return 0; }
275 template <
class Evaluation = Scalar>
277 const Evaluation& temperature,
278 const Evaluation& pressure)
const
279 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure));
return 0; }
284 template <
class Evaluation = Scalar>
286 const Evaluation& temperature,
287 const Evaluation& pressure)
const
288 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure));
return 0; }
293 template <
class Evaluation = Scalar>
295 const Evaluation& temperature,
296 const Evaluation& pressure,
297 const Evaluation& oilSaturation,
298 const Evaluation& maxOilSaturation)
const
299 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation));
return 0; }
304 template <
class Evaluation = Scalar>
306 const Evaluation& temperature,
307 const Evaluation& pressure)
const
308 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedWaterVaporizationFactor(regionIdx, temperature, pressure));
return 0; }
313 template <
class Evaluation = Scalar>
315 const Evaluation& temperature,
316 const Evaluation& pressure,
317 const Evaluation& saltConcentration)
const
318 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedWaterVaporizationFactor(regionIdx, temperature, pressure, saltConcentration));
return 0; }
326 template <
class Evaluation = Scalar>
328 const Evaluation& temperature,
329 const Evaluation& Rv)
const
330 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rv));
return 0; }
335 template <
class Evaluation>
337 const Evaluation& pressure,
338 unsigned compIdx)
const
340 OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.diffusionCoefficient(temperature, pressure, compIdx));
return 0;
349 {
return gasPvtApproach_; }
352 template <GasPvtApproach approachV>
353 typename std::enable_if<approachV == GasPvtApproach::DryGas, DryGasPvt<Scalar> >::type& getRealPvt()
359 template <GasPvtApproach approachV>
360 typename std::enable_if<approachV == GasPvtApproach::DryGas, const DryGasPvt<Scalar> >::type& getRealPvt()
const
363 return *
static_cast<const DryGasPvt<Scalar>*
>(realGasPvt_);
367 template <GasPvtApproach approachV>
368 typename std::enable_if<approachV == GasPvtApproach::DryHumidGas, DryHumidGasPvt<Scalar> >::type& getRealPvt()
371 return *
static_cast<DryHumidGasPvt<Scalar>*
>(realGasPvt_);
374 template <GasPvtApproach approachV>
375 typename std::enable_if<approachV == GasPvtApproach::DryHumidGas, const DryHumidGasPvt<Scalar> >::type& getRealPvt()
const
378 return *
static_cast<const DryHumidGasPvt<Scalar>*
>(realGasPvt_);
382 template <GasPvtApproach approachV>
383 typename std::enable_if<approachV == GasPvtApproach::WetHumidGas, WetHumidGasPvt<Scalar> >::type& getRealPvt()
386 return *
static_cast<WetHumidGasPvt<Scalar>*
>(realGasPvt_);
389 template <GasPvtApproach approachV>
390 typename std::enable_if<approachV == GasPvtApproach::WetHumidGas, const WetHumidGasPvt<Scalar> >::type& getRealPvt()
const
393 return *
static_cast<const WetHumidGasPvt<Scalar>*
>(realGasPvt_);
397 template <GasPvtApproach approachV>
398 typename std::enable_if<approachV == GasPvtApproach::WetGas, WetGasPvt<Scalar> >::type& getRealPvt()
401 return *
static_cast<WetGasPvt<Scalar>*
>(realGasPvt_);
404 template <GasPvtApproach approachV>
405 typename std::enable_if<approachV == GasPvtApproach::WetGas, const WetGasPvt<Scalar> >::type& getRealPvt()
const
408 return *
static_cast<const WetGasPvt<Scalar>*
>(realGasPvt_);
412 template <GasPvtApproach approachV>
413 typename std::enable_if<approachV == GasPvtApproach::ThermalGas, GasPvtThermal<Scalar> >::type& getRealPvt()
416 return *
static_cast<GasPvtThermal<Scalar>*
>(realGasPvt_);
418 template <GasPvtApproach approachV>
419 typename std::enable_if<approachV == GasPvtApproach::ThermalGas, const GasPvtThermal<Scalar> >::type& getRealPvt()
const
422 return *
static_cast<const GasPvtThermal<Scalar>*
>(realGasPvt_);
425 template <GasPvtApproach approachV>
426 typename std::enable_if<approachV == GasPvtApproach::Co2Gas, Co2GasPvt<Scalar> >::type& getRealPvt()
429 return *
static_cast<Co2GasPvt<Scalar>*
>(realGasPvt_);
432 template <GasPvtApproach approachV>
433 typename std::enable_if<approachV == GasPvtApproach::Co2Gas, const Co2GasPvt<Scalar> >::type& getRealPvt()
const
436 return *
static_cast<const Co2GasPvt<Scalar>*
>(realGasPvt_);
439 template <GasPvtApproach approachV>
440 typename std::enable_if<approachV == GasPvtApproach::H2Gas, H2GasPvt<Scalar> >::type& getRealPvt()
443 return *
static_cast<H2GasPvt<Scalar>*
>(realGasPvt_);
446 template <GasPvtApproach approachV>
447 typename std::enable_if<approachV == GasPvtApproach::H2Gas, const H2GasPvt<Scalar> >::type& getRealPvt()
const
450 return *
static_cast<const H2GasPvt<Scalar>*
>(realGasPvt_);
453 const void* realGasPvt()
const {
return realGasPvt_; }
455 GasPvtMultiplexer<Scalar,enableThermal>& operator=(
const GasPvtMultiplexer<Scalar,enableThermal>& data)
457 gasPvtApproach_ = data.gasPvtApproach_;
458 switch (gasPvtApproach_) {
459 case GasPvtApproach::DryGas:
460 realGasPvt_ =
new DryGasPvt<Scalar>(*
static_cast<const DryGasPvt<Scalar>*
>(data.realGasPvt_));
462 case GasPvtApproach::DryHumidGas:
463 realGasPvt_ =
new DryHumidGasPvt<Scalar>(*
static_cast<const DryHumidGasPvt<Scalar>*
>(data.realGasPvt_));
465 case GasPvtApproach::WetHumidGas:
466 realGasPvt_ =
new WetHumidGasPvt<Scalar>(*
static_cast<const WetHumidGasPvt<Scalar>*
>(data.realGasPvt_));
468 case GasPvtApproach::WetGas:
469 realGasPvt_ =
new WetGasPvt<Scalar>(*
static_cast<const WetGasPvt<Scalar>*
>(data.realGasPvt_));
471 case GasPvtApproach::ThermalGas:
472 realGasPvt_ =
new GasPvtThermal<Scalar>(*
static_cast<const GasPvtThermal<Scalar>*
>(data.realGasPvt_));
474 case GasPvtApproach::Co2Gas:
475 realGasPvt_ =
new Co2GasPvt<Scalar>(*
static_cast<const Co2GasPvt<Scalar>*
>(data.realGasPvt_));
477 case GasPvtApproach::H2Gas:
478 realGasPvt_ =
new H2GasPvt<Scalar>(*
static_cast<const H2GasPvt<Scalar>*
>(data.realGasPvt_));
488 GasPvtApproach gasPvtApproach_;
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
This class represents the Pressure-Volume-Temperature relations of the gas phase with vaporized water...
This class implements temperature dependence of the PVT properties of gas.
This class represents the Pressure-Volume-Temperature relations of the gas phase for H2.
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 with vaporized oil a...
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
Definition Co2GasPvt.hpp:54
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition DryGasPvt.hpp:49
This class represents the Pressure-Volume-Temperature relations of the gas phase with vaporized water...
Definition DryHumidGasPvt.hpp:52
Definition EclipseState.hpp:63
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition GasPvtMultiplexer.hpp:109
GasPvtApproach gasPvtApproach() const
Returns the concrete approach for calculating the PVT relations.
Definition GasPvtMultiplexer.hpp:348
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:276
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition GasPvtMultiplexer.hpp:216
Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the water vaporization factor [m^3/m^3] of water saturated gas.
Definition GasPvtMultiplexer.hpp:305
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv, const Evaluation &Rvw) const
Returns the formation volume factor [-] of the fluid phase.
Definition GasPvtMultiplexer.hpp:265
Evaluation internalEnergy(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv, const Evaluation &Rvw) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition GasPvtMultiplexer.hpp:234
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rv, const Evaluation &Rvw) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition GasPvtMultiplexer.hpp:245
Evaluation diffusionCoefficient(const Evaluation &temperature, const Evaluation &pressure, unsigned compIdx) const
Calculate the binary molecular diffusion coefficient for a component in a fluid phase [mol^2 * s / (k...
Definition GasPvtMultiplexer.hpp:336
Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltConcentration) const
Returns the water vaporization factor [m^3/m^3] of water saturated gas.
Definition GasPvtMultiplexer.hpp:314
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:285
const Scalar gasReferenceDensity(unsigned regionIdx)
Return the reference density which are considered by this PVT-object.
Definition GasPvtMultiplexer.hpp:227
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:327
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &oilSaturation, const Evaluation &maxOilSaturation) const
Returns the oil vaporization factor [m^3/m^3] of oil saturated gas.
Definition GasPvtMultiplexer.hpp:294
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:256
This class implements temperature dependence of the PVT properties of gas.
Definition GasPvtThermal.hpp:50
This class represents the Pressure-Volume-Temperature relations of the gas phase for H2.
Definition H2GasPvt.hpp:50
Definition Schedule.hpp:88
This class represents the Pressure-Volume-Temperature relations of the gas phas with vaporized oil.
Definition WetGasPvt.hpp:51
This class represents the Pressure-Volume-Temperature relations of the gas phase with vaporized oil a...
Definition WetHumidGasPvt.hpp:51
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30