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>(); \
83 case GasPvtApproach::NoGas: \
84 throw std::logic_error("Not implemented: Gas PVT of this deck!"); \
87enum class GasPvtApproach {
108template <
class Scalar,
bool enableThermal = true>
113 : gasPvtApproach_(GasPvtApproach::NoGas)
114 , realGasPvt_(
nullptr)
119 : gasPvtApproach_(approach)
120 , realGasPvt_(realGasPvt)
130 bool mixingEnergy()
const
132 return gasPvtApproach_ == GasPvtApproach::ThermalGas;
144 void setApproach(GasPvtApproach gasPvtAppr);
153 void setVapPars(
const Scalar par1,
const Scalar par2);
163 template <
class Evaluation>
165 const Evaluation& temperature,
166 const Evaluation& pressure,
167 const Evaluation& Rv,
168 const Evaluation& Rvw)
const
169 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.internalEnergy(regionIdx, temperature, pressure, Rv, Rvw)); }
171 Scalar hVap(
unsigned regionIdx)
const;
176 template <
class Evaluation = Scalar>
178 const Evaluation& temperature,
179 const Evaluation& pressure,
180 const Evaluation& Rv,
181 const Evaluation& Rvw )
const
182 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rv, Rvw)); }
187 template <
class Evaluation = Scalar>
189 const Evaluation& temperature,
190 const Evaluation& pressure)
const
191 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure)); }
196 template <
class Evaluation = Scalar>
198 const Evaluation& temperature,
199 const Evaluation& pressure,
200 const Evaluation& Rv,
201 const Evaluation& Rvw)
const
202 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rv, Rvw)); }
207 template <
class Evaluation = Scalar>
209 const Evaluation& temperature,
210 const Evaluation& pressure)
const
211 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure)); }
216 template <
class Evaluation = Scalar>
218 const Evaluation& temperature,
219 const Evaluation& pressure)
const
220 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure)); }
225 template <
class Evaluation = Scalar>
227 const Evaluation& temperature,
228 const Evaluation& pressure,
229 const Evaluation& oilSaturation,
230 const Evaluation& maxOilSaturation)
const
231 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedOilVaporizationFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation)); }
236 template <
class Evaluation = Scalar>
238 const Evaluation& temperature,
239 const Evaluation& pressure)
const
240 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedWaterVaporizationFactor(regionIdx, temperature, pressure)); }
245 template <
class Evaluation = Scalar>
247 const Evaluation& temperature,
248 const Evaluation& pressure,
249 const Evaluation& saltConcentration)
const
250 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedWaterVaporizationFactor(regionIdx, temperature, pressure, saltConcentration)); }
258 template <
class Evaluation = Scalar>
260 const Evaluation& temperature,
261 const Evaluation& Rv)
const
262 { OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rv)); }
267 template <
class Evaluation>
269 const Evaluation& pressure,
270 unsigned compIdx)
const
272 OPM_GAS_PVT_MULTIPLEXER_CALL(
return pvtImpl.diffusionCoefficient(temperature, pressure, compIdx));
281 {
return gasPvtApproach_; }
284 template <GasPvtApproach approachV>
285 typename std::enable_if<approachV == GasPvtApproach::DryGas, DryGasPvt<Scalar> >::type& getRealPvt()
291 template <GasPvtApproach approachV>
292 typename std::enable_if<approachV == GasPvtApproach::DryGas, const DryGasPvt<Scalar> >::type& getRealPvt()
const
295 return *
static_cast<const DryGasPvt<Scalar>*
>(realGasPvt_);
299 template <GasPvtApproach approachV>
300 typename std::enable_if<approachV == GasPvtApproach::DryHumidGas, DryHumidGasPvt<Scalar> >::type& getRealPvt()
303 return *
static_cast<DryHumidGasPvt<Scalar>*
>(realGasPvt_);
306 template <GasPvtApproach approachV>
307 typename std::enable_if<approachV == GasPvtApproach::DryHumidGas, const DryHumidGasPvt<Scalar> >::type& getRealPvt()
const
310 return *
static_cast<const DryHumidGasPvt<Scalar>*
>(realGasPvt_);
314 template <GasPvtApproach approachV>
315 typename std::enable_if<approachV == GasPvtApproach::WetHumidGas, WetHumidGasPvt<Scalar> >::type& getRealPvt()
318 return *
static_cast<WetHumidGasPvt<Scalar>*
>(realGasPvt_);
321 template <GasPvtApproach approachV>
322 typename std::enable_if<approachV == GasPvtApproach::WetHumidGas, const WetHumidGasPvt<Scalar> >::type& getRealPvt()
const
325 return *
static_cast<const WetHumidGasPvt<Scalar>*
>(realGasPvt_);
329 template <GasPvtApproach approachV>
330 typename std::enable_if<approachV == GasPvtApproach::WetGas, WetGasPvt<Scalar> >::type& getRealPvt()
333 return *
static_cast<WetGasPvt<Scalar>*
>(realGasPvt_);
336 template <GasPvtApproach approachV>
337 typename std::enable_if<approachV == GasPvtApproach::WetGas, const WetGasPvt<Scalar> >::type& getRealPvt()
const
340 return *
static_cast<const WetGasPvt<Scalar>*
>(realGasPvt_);
344 template <GasPvtApproach approachV>
345 typename std::enable_if<approachV == GasPvtApproach::ThermalGas, GasPvtThermal<Scalar> >::type& getRealPvt()
348 return *
static_cast<GasPvtThermal<Scalar>*
>(realGasPvt_);
350 template <GasPvtApproach approachV>
351 typename std::enable_if<approachV == GasPvtApproach::ThermalGas, const GasPvtThermal<Scalar> >::type& getRealPvt()
const
354 return *
static_cast<const GasPvtThermal<Scalar>*
>(realGasPvt_);
357 template <GasPvtApproach approachV>
358 typename std::enable_if<approachV == GasPvtApproach::Co2Gas, Co2GasPvt<Scalar> >::type& getRealPvt()
361 return *
static_cast<Co2GasPvt<Scalar>*
>(realGasPvt_);
364 template <GasPvtApproach approachV>
365 typename std::enable_if<approachV == GasPvtApproach::Co2Gas, const Co2GasPvt<Scalar> >::type& getRealPvt()
const
368 return *
static_cast<const Co2GasPvt<Scalar>*
>(realGasPvt_);
371 template <GasPvtApproach approachV>
372 typename std::enable_if<approachV == GasPvtApproach::H2Gas, H2GasPvt<Scalar> >::type& getRealPvt()
375 return *
static_cast<H2GasPvt<Scalar>*
>(realGasPvt_);
378 template <GasPvtApproach approachV>
379 typename std::enable_if<approachV == GasPvtApproach::H2Gas, const H2GasPvt<Scalar> >::type& getRealPvt()
const
382 return *
static_cast<const H2GasPvt<Scalar>*
>(realGasPvt_);
385 const void* realGasPvt()
const {
return realGasPvt_; }
387 GasPvtMultiplexer<Scalar,enableThermal>&
388 operator=(
const GasPvtMultiplexer<Scalar,enableThermal>& data);
391 GasPvtApproach gasPvtApproach_{GasPvtApproach::NoGas};
392 void* realGasPvt_{
nullptr};
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 without vaporized oi...
Definition DryGasPvt.hpp:50
Definition EclipseState.hpp:63
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition GasPvtMultiplexer.hpp:110
GasPvtApproach gasPvtApproach() const
Returns the concrete approach for calculating the PVT relations.
Definition GasPvtMultiplexer.hpp:280
Scalar gasReferenceDensity(unsigned regionIdx)
Return the reference density which are considered by this PVT-object.
Definition GasPvtMultiplexer.cpp:94
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:208
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition GasPvtMultiplexer.cpp:78
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:237
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:197
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:164
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:177
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:268
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:246
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:217
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:259
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:226
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:188
Definition Schedule.hpp:89
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30