27#ifndef OPM_OIL_PVT_MULTIPLEXER_HPP
28#define OPM_OIL_PVT_MULTIPLEXER_HPP
44#define OPM_OIL_PVT_MULTIPLEXER_CALL(codeToCall, ...) \
45 switch (approach_) { \
46 case OilPvtApproach::ConstantCompressibilityOil: { \
47 auto& pvtImpl = getRealPvt<OilPvtApproach::ConstantCompressibilityOil>(); \
51 case OilPvtApproach::DeadOil: { \
52 auto& pvtImpl = getRealPvt<OilPvtApproach::DeadOil>(); \
56 case OilPvtApproach::LiveOil: { \
57 auto& pvtImpl = getRealPvt<OilPvtApproach::LiveOil>(); \
61 case OilPvtApproach::ThermalOil: { \
62 auto& pvtImpl = getRealPvt<OilPvtApproach::ThermalOil>(); \
66 case OilPvtApproach::BrineCo2: { \
67 auto& pvtImpl = getRealPvt<OilPvtApproach::BrineCo2>(); \
71 case OilPvtApproach::BrineH2: { \
72 auto& pvtImpl = getRealPvt<OilPvtApproach::BrineH2>(); \
77 case OilPvtApproach::NoOil: \
78 throw std::logic_error("Not implemented: Oil PVT of this deck!"); \
81enum class OilPvtApproach {
85 ConstantCompressibilityOil,
103template <
class Scalar,
bool enableThermal = true>
108 : approach_(OilPvtApproach::NoOil)
109 , realOilPvt_(
nullptr)
115 , realOilPvt_(realOilPvt)
125 bool mixingEnergy()
const
127 return approach_ == OilPvtApproach::ThermalOil;
146 void setVapPars(
const Scalar par1,
const Scalar par2);
156 template <
class Evaluation>
158 const Evaluation& temperature,
159 const Evaluation& pressure,
160 const Evaluation& Rs)
const
161 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.internalEnergy(regionIdx, temperature, pressure, Rs)); }
163 Scalar hVap(
unsigned regionIdx)
const
164 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.hVap(regionIdx)); }
168 template <
class Evaluation>
170 const Evaluation& temperature,
171 const Evaluation& pressure,
172 const Evaluation& Rs)
const
173 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rs)); }
178 template <
class Evaluation>
180 const Evaluation& temperature,
181 const Evaluation& pressure)
const
182 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure)); }
187 template <
class Evaluation>
189 const Evaluation& temperature,
190 const Evaluation& pressure,
191 const Evaluation& Rs)
const
192 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rs)); }
197 template <
class Evaluation>
199 const Evaluation& temperature,
200 const Evaluation& pressure)
const
201 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure)); }
206 template <
class Evaluation>
208 const Evaluation& temperature,
209 const Evaluation& pressure)
const
210 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure)); }
215 template <
class Evaluation>
217 const Evaluation& temperature,
218 const Evaluation& pressure,
219 const Evaluation& oilSaturation,
220 const Evaluation& maxOilSaturation)
const
221 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation)); }
230 template <
class Evaluation>
232 const Evaluation& temperature,
233 const Evaluation& Rs)
const
234 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rs)); }
239 template <
class Evaluation>
241 const Evaluation& pressure,
242 unsigned compIdx)
const
244 OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.diffusionCoefficient(temperature, pressure, compIdx));
247 void setApproach(OilPvtApproach appr);
255 {
return approach_; }
258 template <OilPvtApproach approachV>
259 typename std::enable_if<approachV == OilPvtApproach::LiveOil, LiveOilPvt<Scalar> >::type& getRealPvt()
265 template <OilPvtApproach approachV>
266 typename std::enable_if<approachV == OilPvtApproach::LiveOil, const LiveOilPvt<Scalar> >::type& getRealPvt()
const
269 return *
static_cast<LiveOilPvt<Scalar>*
>(realOilPvt_);
272 template <OilPvtApproach approachV>
273 typename std::enable_if<approachV == OilPvtApproach::DeadOil, DeadOilPvt<Scalar> >::type& getRealPvt()
276 return *
static_cast<DeadOilPvt<Scalar>*
>(realOilPvt_);
279 template <OilPvtApproach approachV>
280 typename std::enable_if<approachV == OilPvtApproach::DeadOil, const DeadOilPvt<Scalar> >::type& getRealPvt()
const
283 return *
static_cast<DeadOilPvt<Scalar>*
>(realOilPvt_);
286 template <OilPvtApproach approachV>
287 typename std::enable_if<approachV == OilPvtApproach::ConstantCompressibilityOil, ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
290 return *
static_cast<ConstantCompressibilityOilPvt<Scalar>*
>(realOilPvt_);
293 template <OilPvtApproach approachV>
294 typename std::enable_if<approachV == OilPvtApproach::ConstantCompressibilityOil, const ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
const
297 return *
static_cast<ConstantCompressibilityOilPvt<Scalar>*
>(realOilPvt_);
300 template <OilPvtApproach approachV>
301 typename std::enable_if<approachV == OilPvtApproach::ThermalOil, OilPvtThermal<Scalar> >::type& getRealPvt()
304 return *
static_cast<OilPvtThermal<Scalar>*
>(realOilPvt_);
307 template <OilPvtApproach approachV>
308 typename std::enable_if<approachV == OilPvtApproach::ThermalOil, const OilPvtThermal<Scalar> >::type& getRealPvt()
const
311 return *
static_cast<const OilPvtThermal<Scalar>*
>(realOilPvt_);
314 template <OilPvtApproach approachV>
315 typename std::enable_if<approachV == OilPvtApproach::BrineCo2, BrineCo2Pvt<Scalar> >::type& getRealPvt()
318 return *
static_cast<BrineCo2Pvt<Scalar>*
>(realOilPvt_);
321 template <OilPvtApproach approachV>
322 typename std::enable_if<approachV == OilPvtApproach::BrineCo2, const BrineCo2Pvt<Scalar> >::type& getRealPvt()
const
325 return *
static_cast<const BrineCo2Pvt<Scalar>*
>(realOilPvt_);
328 const void* realOilPvt()
const {
return realOilPvt_; }
330 template <OilPvtApproach approachV>
331 typename std::enable_if<approachV == OilPvtApproach::BrineH2, BrineH2Pvt<Scalar> >::type& getRealPvt()
334 return *
static_cast<BrineH2Pvt<Scalar>*
>(realOilPvt_);
337 template <OilPvtApproach approachV>
338 typename std::enable_if<approachV == OilPvtApproach::BrineH2, const BrineH2Pvt<Scalar> >::type& getRealPvt()
const
341 return *
static_cast<const BrineH2Pvt<Scalar>*
>(realOilPvt_);
344 OilPvtMultiplexer<Scalar,enableThermal>&
345 operator=(
const OilPvtMultiplexer<Scalar,enableThermal>& data);
348 OilPvtApproach approach_{OilPvtApproach::NoOil};
349 void* realOilPvt_{
nullptr};
This class represents the Pressure-Volume-Temperature relations of the liquid phase for a CO2-Brine s...
This class represents the Pressure-Volume-Temperature relations of the liquid phase for a H2-Brine sy...
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 phase without dissolved ga...
This class represents the Pressure-Volume-Temperature relations of the oil phas with dissolved gas.
This class implements temperature dependence of the PVT properties of oil.
Definition EclipseState.hpp:63
This class represents the Pressure-Volume-Temperature relations of the oil phas with dissolved gas.
Definition LiveOilPvt.hpp:51
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition OilPvtMultiplexer.hpp:105
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition OilPvtMultiplexer.cpp:102
Evaluation internalEnergy(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rs) const
Returns the specific enthalpy [J/kg] oil given a set of parameters.
Definition OilPvtMultiplexer.hpp:157
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:188
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:179
OilPvtApproach approach() const
Returns the concrete approach for calculating the PVT relations.
Definition OilPvtMultiplexer.hpp:254
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition OilPvtMultiplexer.hpp:198
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:207
Scalar oilReferenceDensity(unsigned regionIdx) const
Return the reference density which are considered by this PVT-object.
Definition OilPvtMultiplexer.cpp:116
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:169
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:231
Evaluation saturatedGasDissolutionFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &oilSaturation, const Evaluation &maxOilSaturation) const
Returns the gas dissolution factor [m^3/m^3] of saturated oil.
Definition OilPvtMultiplexer.hpp:216
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 OilPvtMultiplexer.hpp:240
Definition Schedule.hpp:101
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30