27#ifndef OPM_OIL_PVT_MULTIPLEXER_HPP
28#define OPM_OIL_PVT_MULTIPLEXER_HPP
43#define OPM_OIL_PVT_MULTIPLEXER_CALL(codeToCall) \
44 switch (approach_) { \
45 case OilPvtApproach::ConstantCompressibilityOil: { \
46 auto& pvtImpl = getRealPvt<OilPvtApproach::ConstantCompressibilityOil>(); \
50 case OilPvtApproach::DeadOil: { \
51 auto& pvtImpl = getRealPvt<OilPvtApproach::DeadOil>(); \
55 case OilPvtApproach::LiveOil: { \
56 auto& pvtImpl = getRealPvt<OilPvtApproach::LiveOil>(); \
60 case OilPvtApproach::ThermalOil: { \
61 auto& pvtImpl = getRealPvt<OilPvtApproach::ThermalOil>(); \
65 case OilPvtApproach::BrineCo2: { \
66 auto& pvtImpl = getRealPvt<OilPvtApproach::BrineCo2>(); \
70 case OilPvtApproach::NoOil: \
71 throw std::logic_error("Not implemented: Oil PVT of this deck!"); \
74enum class OilPvtApproach {
78 ConstantCompressibilityOil,
95template <
class Scalar,
bool enableThermal = true>
101 approach_ = OilPvtApproach::NoOil;
102 realOilPvt_ =
nullptr;
107 , realOilPvt_(realOilPvt)
118 case OilPvtApproach::LiveOil: {
119 delete &getRealPvt<OilPvtApproach::LiveOil>();
122 case OilPvtApproach::DeadOil: {
123 delete &getRealPvt<OilPvtApproach::DeadOil>();
126 case OilPvtApproach::ConstantCompressibilityOil: {
127 delete &getRealPvt<OilPvtApproach::ConstantCompressibilityOil>();
130 case OilPvtApproach::ThermalOil: {
131 delete &getRealPvt<OilPvtApproach::ThermalOil>();
134 case OilPvtApproach::BrineCo2: {
135 delete &getRealPvt<OilPvtApproach::BrineCo2>();
139 case OilPvtApproach::NoOil:
155 { OPM_OIL_PVT_MULTIPLEXER_CALL(pvtImpl.initEnd()); }
161 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.numRegions());
return 1; }
167 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.oilReferenceDensity(regionIdx));
return 700.; }
172 template <
class Evaluation>
174 const Evaluation& temperature,
175 const Evaluation& pressure,
176 const Evaluation& Rs)
const
177 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.internalEnergy(regionIdx, temperature, pressure, Rs));
return 0; }
182 template <
class Evaluation>
184 const Evaluation& temperature,
185 const Evaluation& pressure,
186 const Evaluation& Rs)
const
187 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.viscosity(regionIdx, temperature, pressure, Rs));
return 0; }
192 template <
class Evaluation>
194 const Evaluation& temperature,
195 const Evaluation& pressure)
const
196 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedViscosity(regionIdx, temperature, pressure));
return 0; }
201 template <
class Evaluation>
203 const Evaluation& temperature,
204 const Evaluation& pressure,
205 const Evaluation& Rs)
const
206 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rs));
return 0; }
211 template <
class Evaluation>
213 const Evaluation& temperature,
214 const Evaluation& pressure)
const
215 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure));
return 0; }
220 template <
class Evaluation>
222 const Evaluation& temperature,
223 const Evaluation& pressure)
const
224 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure));
return 0; }
229 template <
class Evaluation>
231 const Evaluation& temperature,
232 const Evaluation& pressure,
233 const Evaluation& oilSaturation,
234 const Evaluation& maxOilSaturation)
const
235 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturatedGasDissolutionFactor(regionIdx, temperature, pressure, oilSaturation, maxOilSaturation));
return 0; }
244 template <
class Evaluation>
246 const Evaluation& temperature,
247 const Evaluation& Rs)
const
248 { OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.saturationPressure(regionIdx, temperature, Rs));
return 0; }
253 template <
class Evaluation>
255 const Evaluation& pressure,
256 unsigned compIdx)
const
258 OPM_OIL_PVT_MULTIPLEXER_CALL(
return pvtImpl.diffusionCoefficient(temperature, pressure, compIdx));
return 0;
261 void setApproach(OilPvtApproach appr)
264 case OilPvtApproach::LiveOil:
268 case OilPvtApproach::DeadOil:
272 case OilPvtApproach::ConstantCompressibilityOil:
276 case OilPvtApproach::ThermalOil:
280 case OilPvtApproach::BrineCo2:
284 case OilPvtApproach::NoOil:
285 throw std::logic_error(
"Not implemented: Oil PVT of this deck!");
297 {
return approach_; }
300 template <OilPvtApproach approachV>
301 typename std::enable_if<approachV == OilPvtApproach::LiveOil, LiveOilPvt<Scalar> >::type& getRealPvt()
307 template <OilPvtApproach approachV>
308 typename std::enable_if<approachV == OilPvtApproach::LiveOil, const LiveOilPvt<Scalar> >::type& getRealPvt()
const
311 return *
static_cast<LiveOilPvt<Scalar>*
>(realOilPvt_);
314 template <OilPvtApproach approachV>
315 typename std::enable_if<approachV == OilPvtApproach::DeadOil, DeadOilPvt<Scalar> >::type& getRealPvt()
318 return *
static_cast<DeadOilPvt<Scalar>*
>(realOilPvt_);
321 template <OilPvtApproach approachV>
322 typename std::enable_if<approachV == OilPvtApproach::DeadOil, const DeadOilPvt<Scalar> >::type& getRealPvt()
const
325 return *
static_cast<DeadOilPvt<Scalar>*
>(realOilPvt_);
328 template <OilPvtApproach approachV>
329 typename std::enable_if<approachV == OilPvtApproach::ConstantCompressibilityOil, ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
332 return *
static_cast<ConstantCompressibilityOilPvt<Scalar>*
>(realOilPvt_);
335 template <OilPvtApproach approachV>
336 typename std::enable_if<approachV == OilPvtApproach::ConstantCompressibilityOil, const ConstantCompressibilityOilPvt<Scalar> >::type& getRealPvt()
const
339 return *
static_cast<ConstantCompressibilityOilPvt<Scalar>*
>(realOilPvt_);
342 template <OilPvtApproach approachV>
343 typename std::enable_if<approachV == OilPvtApproach::ThermalOil, OilPvtThermal<Scalar> >::type& getRealPvt()
346 return *
static_cast<OilPvtThermal<Scalar>*
>(realOilPvt_);
349 template <OilPvtApproach approachV>
350 typename std::enable_if<approachV == OilPvtApproach::ThermalOil, const OilPvtThermal<Scalar> >::type& getRealPvt()
const
353 return *
static_cast<const OilPvtThermal<Scalar>*
>(realOilPvt_);
356 template <OilPvtApproach approachV>
357 typename std::enable_if<approachV == OilPvtApproach::BrineCo2, BrineCo2Pvt<Scalar> >::type& getRealPvt()
360 return *
static_cast<BrineCo2Pvt<Scalar>*
>(realOilPvt_);
363 template <OilPvtApproach approachV>
364 typename std::enable_if<approachV == OilPvtApproach::BrineCo2, const BrineCo2Pvt<Scalar> >::type& getRealPvt()
const
367 return *
static_cast<const BrineCo2Pvt<Scalar>*
>(realOilPvt_);
370 const void* realOilPvt()
const {
return realOilPvt_; }
372 OilPvtMultiplexer<Scalar,enableThermal>& operator=(
const OilPvtMultiplexer<Scalar,enableThermal>& data)
374 approach_ = data.approach_;
376 case OilPvtApproach::ConstantCompressibilityOil:
377 realOilPvt_ =
new ConstantCompressibilityOilPvt<Scalar>(*
static_cast<const ConstantCompressibilityOilPvt<Scalar>*
>(data.realOilPvt_));
379 case OilPvtApproach::DeadOil:
380 realOilPvt_ =
new DeadOilPvt<Scalar>(*
static_cast<const DeadOilPvt<Scalar>*
>(data.realOilPvt_));
382 case OilPvtApproach::LiveOil:
383 realOilPvt_ =
new LiveOilPvt<Scalar>(*
static_cast<const LiveOilPvt<Scalar>*
>(data.realOilPvt_));
385 case OilPvtApproach::ThermalOil:
386 realOilPvt_ =
new OilPvtThermal<Scalar>(*
static_cast<const OilPvtThermal<Scalar>*
>(data.realOilPvt_));
388 case OilPvtApproach::BrineCo2:
389 realOilPvt_ =
new BrineCo2Pvt<Scalar>(*
static_cast<const BrineCo2Pvt<Scalar>*
>(data.realOilPvt_));
399 OilPvtApproach approach_;
This class represents the Pressure-Volume-Temperature relations of the liquid phase for a CO2-Brine s...
Definition: BrineCo2Pvt.hpp:57
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition: ConstantCompressibilityOilPvt.hpp:46
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition: DeadOilPvt.hpp:45
Definition: EclipseState.hpp:55
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:97
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: OilPvtMultiplexer.hpp:160
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:173
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:202
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:193
OilPvtApproach approach() const
Returns the concrete approach for calculating the PVT relations.
Definition: OilPvtMultiplexer.hpp:296
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition: OilPvtMultiplexer.hpp:212
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:221
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:183
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:245
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:230
const Scalar oilReferenceDensity(unsigned regionIdx) const
Return the reference density which are considered by this PVT-object.
Definition: OilPvtMultiplexer.hpp:166
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:254
This class implements temperature dependence of the PVT properties of oil.
Definition: OilPvtThermal.hpp:50
Definition: Schedule.hpp:130
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30