BlackOilFluidSystem.hpp
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  Copyright (C) 2011-2015 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_BLACK_OIL_FLUID_SYSTEM_HPP
26 #define OPM_BLACK_OIL_FLUID_SYSTEM_HPP
27 
31 
34 
37 #include <opm/common/Exceptions.hpp>
38 #include <opm/common/ErrorMacros.hpp>
39 
40 #include <memory>
41 #include <vector>
42 #include <array>
43 
44 namespace Opm {
45 namespace FluidSystems {
50 template <class Scalar>
51 class BlackOil : public BaseFluidSystem<Scalar, BlackOil<Scalar> >
52 {
56 
57 public:
60  {
61  public:
62  ParameterCache(int /*regionIdx*/=0)
63  { regionIdx_ = 0; }
64 
69  unsigned regionIndex() const
70  { return regionIdx_; }
71 
76  void setRegionIndex(unsigned val)
77  { regionIdx_ = val; }
78 
79  private:
80  unsigned regionIdx_;
81  };
82 
83  /****************************************
84  * Fluid phase parameters
85  ****************************************/
86 
88  static const int numPhases = 3;
89 
91  static const int waterPhaseIdx = 0;
93  static const int oilPhaseIdx = 1;
95  static const int gasPhaseIdx = 2;
96 
98  static const Scalar surfacePressure;
99 
101  static const Scalar surfaceTemperature;
102 
103 #if HAVE_OPM_PARSER
104 
107  static void initFromDeck(DeckConstPtr deck, EclipseStateConstPtr eclState)
108  {
109  auto densityKeyword = deck->getKeyword("DENSITY");
110  size_t numRegions = densityKeyword->size();
111  initBegin(numRegions);
112 
113  setEnableDissolvedGas(deck->hasKeyword("DISGAS"));
114  setEnableVaporizedOil(deck->hasKeyword("VAPOIL"));
115 
116  // set the reference densities of all PVT regions
117  for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
118  Opm::DeckRecordConstPtr densityRecord = densityKeyword->getRecord(regionIdx);
119  setReferenceDensities(densityRecord->getItem("OIL")->getSIDouble(0),
120  densityRecord->getItem("WATER")->getSIDouble(0),
121  densityRecord->getItem("GAS")->getSIDouble(0),
122  regionIdx);
123  }
124 
125  gasPvt_ = std::make_shared<GasPvt>();
126  gasPvt_->initFromDeck(deck, eclState);
127 
128  oilPvt_ = std::make_shared<OilPvt>();
129  oilPvt_->initFromDeck(deck, eclState);
130 
131  waterPvt_ = std::make_shared<WaterPvt>();
132  waterPvt_->initFromDeck(deck, eclState);
133 
134  gasPvt_->initEnd(oilPvt_.get());
135  oilPvt_->initEnd(gasPvt_.get());
136  waterPvt_->initEnd();
137 
138  initEnd();
139  }
140 #endif // HAVE_OPM_PARSER
141 
150  static void initBegin(size_t numPvtRegions)
151  {
152  enableDissolvedGas_ = true;
153  enableVaporizedOil_ = false;
154 
155  resizeArrays_(numPvtRegions);
156  }
157 
164  static void setEnableDissolvedGas(bool yesno)
165  { enableDissolvedGas_ = yesno; }
166 
173  static void setEnableVaporizedOil(bool yesno)
174  { enableVaporizedOil_ = yesno; }
175 
179  static void setGasPvt(std::shared_ptr<GasPvt> pvtObj)
180  { gasPvt_ = pvtObj; }
181 
185  static void setOilPvt(std::shared_ptr<OilPvt> pvtObj)
186  { oilPvt_ = pvtObj; }
187 
191  static void setWaterPvt(std::shared_ptr<WaterPvt> pvtObj)
192  { waterPvt_ = pvtObj; }
193 
201  static void setReferenceDensities(Scalar rhoOil,
202  Scalar rhoWater,
203  Scalar rhoGas,
204  unsigned regionIdx)
205  {
206  referenceDensity_[regionIdx][oilPhaseIdx] = rhoOil;
207  referenceDensity_[regionIdx][waterPhaseIdx] = rhoWater;
208  referenceDensity_[regionIdx][gasPhaseIdx] = rhoGas;
209  }
210 
214  static void initEnd()
215  {
216  // calculate the final 2D functions which are used for interpolation.
217  size_t numRegions = molarMass_.size();
218  for (unsigned regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
219  // calculate molar masses
220 
221  // water is simple: 18 g/mol
222  molarMass_[regionIdx][waterCompIdx] = 18e-3;
223 
224  // for gas, we take the density at standard conditions and assume it to be ideal
225  Scalar p = surfacePressure;
226  Scalar T = surfaceTemperature;
227  Scalar rho_g = referenceDensity_[/*regionIdx=*/0][gasPhaseIdx];
228  molarMass_[regionIdx][gasCompIdx] = Opm::Constants<Scalar>::R*T*rho_g / p;
229 
230  // finally, for oil phase, we take the molar mass from the
231  // spe9 paper
232  molarMass_[regionIdx][oilCompIdx] = 175e-3; // kg/mol
233  }
234  }
235 
237  static const char *phaseName(const unsigned phaseIdx)
238  {
239  static const char *name[] = { "water", "oil", "gas" };
240 
241  assert(0 <= phaseIdx && phaseIdx < numPhases + 1);
242  return name[phaseIdx];
243  }
244 
246  static bool isLiquid(const unsigned phaseIdx)
247  {
248  assert(0 <= phaseIdx && phaseIdx < numPhases);
249  return phaseIdx != gasPhaseIdx;
250  }
251 
252  /****************************************
253  * Component related parameters
254  ****************************************/
255 
257  static const int numComponents = 3;
258 
260  static const int oilCompIdx = 0;
262  static const int waterCompIdx = 1;
264  static const int gasCompIdx = 2;
265 
267  static const char *componentName(unsigned compIdx)
268  {
269  static const char *name[] = { "Oil", "Water", "Gas" };
270 
271  assert(0 <= compIdx && compIdx < numComponents);
272  return name[compIdx];
273  }
274 
276  static Scalar molarMass(unsigned compIdx, unsigned regionIdx = 0)
277  { return molarMass_[regionIdx][compIdx]; }
278 
280  static bool isIdealMixture(unsigned /*phaseIdx*/)
281  {
282  // fugacity coefficients are only pressure dependent -> we
283  // have an ideal mixture
284  return true;
285  }
286 
288  static bool isCompressible(unsigned /*phaseIdx*/)
289  { return true; /* all phases are compressible */ }
290 
292  static bool isIdealGas(unsigned /*phaseIdx*/)
293  { return false; }
294 
295  /****************************************
296  * thermodynamic relations
297  ****************************************/
299  template <class FluidState, class LhsEval = typename FluidState::Scalar>
300  static LhsEval density(const FluidState &fluidState,
301  ParameterCache &paramCache,
302  const unsigned phaseIdx)
303  {
304  assert(0 <= phaseIdx && phaseIdx <= numPhases);
305 
306  typedef typename FluidState::Scalar FsEval;
307  typedef Opm::MathToolbox<FsEval> FsToolbox;
308 
309  const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
310  const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
311  unsigned regionIdx = paramCache.regionIndex();
312 
313  switch (phaseIdx) {
314  case waterPhaseIdx: return waterDensity<LhsEval>(T, p, regionIdx);
315  case gasPhaseIdx: {
316  const auto& XgO = FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(gasPhaseIdx, oilCompIdx));
317  return gasDensity<LhsEval>(T, p, XgO, regionIdx);
318  }
319  case oilPhaseIdx: {
320  const auto& XoG = FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(oilPhaseIdx, gasCompIdx));
321  return oilDensity<LhsEval>(T, p, XoG, regionIdx);
322  }
323  }
324 
325  OPM_THROW(std::logic_error, "Unhandled phase index " << phaseIdx);
326  }
327 
329  template <class FluidState, class LhsEval = typename FluidState::Scalar>
330  static LhsEval fugacityCoefficient(const FluidState &fluidState,
331  const ParameterCache &paramCache,
332  unsigned phaseIdx,
333  unsigned compIdx)
334  {
335  assert(0 <= phaseIdx && phaseIdx <= numPhases);
336  assert(0 <= compIdx && compIdx <= numComponents);
337 
339 
340  const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
341  const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
342  unsigned regionIdx = paramCache.regionIndex();
343 
344  switch (phaseIdx) {
345  case waterPhaseIdx: return fugCoefficientInWater<LhsEval>(compIdx, T, p, regionIdx);
346  case gasPhaseIdx: return fugCoefficientInGas<LhsEval>(compIdx, T, p, regionIdx);
347  case oilPhaseIdx: return fugCoefficientInOil<LhsEval>(compIdx, T, p, regionIdx);
348  }
349 
350  OPM_THROW(std::logic_error, "Unhandled phase or component index");
351  }
352 
354  template <class FluidState, class LhsEval = typename FluidState::Scalar>
355  static LhsEval viscosity(const FluidState &fluidState,
356  const ParameterCache &paramCache,
357  unsigned phaseIdx)
358  {
359  assert(0 <= phaseIdx && phaseIdx <= numPhases);
360 
362 
363  const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
364  const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
365  unsigned regionIdx = paramCache.regionIndex();
366 
367  switch (phaseIdx) {
368  case oilPhaseIdx: {
369  const auto& XoG = FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(oilPhaseIdx, gasCompIdx));
370  return oilPvt_->viscosity(regionIdx, T, p, XoG);
371  }
372  case waterPhaseIdx:
373  return waterPvt_->viscosity(regionIdx, T, p);
374  case gasPhaseIdx: {
375  const auto& XgO = FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(gasPhaseIdx, oilCompIdx));
376  return gasPvt_->viscosity(regionIdx, T, p, XgO);
377  }
378  }
379 
380  OPM_THROW(std::logic_error, "Unhandled phase index " << phaseIdx);
381  }
382 
389  static bool enableDissolvedGas()
390  { return enableDissolvedGas_; }
391 
398  static bool enableVaporizedOil()
399  { return enableVaporizedOil_; }
400 
406  static Scalar referenceDensity(unsigned phaseIdx, unsigned regionIdx)
407  { return referenceDensity_[regionIdx][phaseIdx]; }
408 
414  template <class LhsEval>
415  static LhsEval saturatedOilFormationVolumeFactor(const LhsEval& temperature,
416  const LhsEval& pressure,
417  unsigned regionIdx)
418  {
419  Valgrind::CheckDefined(pressure);
420 
421  // calculate the mass fractions of gas and oil
422  const auto& XoG = saturatedOilGasMassFraction(temperature, pressure, regionIdx);
423 
424  return oilFormationVolumeFactor(temperature, pressure, XoG, regionIdx);
425  }
426 
430  template <class LhsEval>
431  static LhsEval waterFormationVolumeFactor(const LhsEval& temperature,
432  const LhsEval& pressure,
433  unsigned regionIdx)
434  { return waterPvt_->formationVolumeFactor(regionIdx, temperature, pressure); }
435 
441  template <class LhsEval>
442  static LhsEval gasDissolutionFactor(const LhsEval& temperature,
443  const LhsEval& pressure,
444  unsigned regionIdx)
445  { return oilPvt_->gasDissolutionFactor(regionIdx, temperature, pressure); }
446 
452  template <class LhsEval>
453  static LhsEval oilVaporizationFactor(const LhsEval& temperature,
454  const LhsEval& pressure,
455  unsigned regionIdx)
456  { return gasPvt_->oilVaporizationFactor(regionIdx, temperature, pressure); }
457 
464  template <class LhsEval>
465  static LhsEval fugCoefficientInWater(unsigned compIdx,
466  const LhsEval& temperature,
467  const LhsEval& pressure,
468  unsigned regionIdx)
469  {
470  switch (compIdx) {
471  case gasCompIdx:
472  return waterPvt_->fugacityCoefficientGas(regionIdx, temperature, pressure);
473 
474  case oilCompIdx:
475  return waterPvt_->fugacityCoefficientOil(regionIdx, temperature, pressure);
476 
477  case waterCompIdx:
478  return waterPvt_->fugacityCoefficientWater(regionIdx, temperature, pressure);
479 
480  default:
481  OPM_THROW(std::logic_error,
482  "Invalid component index " << compIdx);
483  }
484  }
485 
492  template <class LhsEval>
493  static LhsEval fugCoefficientInGas(unsigned compIdx,
494  const LhsEval& temperature,
495  const LhsEval& pressure,
496  unsigned regionIdx)
497  {
498  switch (compIdx) {
499  case gasCompIdx:
500  return gasPvt_->fugacityCoefficientGas(regionIdx, temperature, pressure);
501 
502  case oilCompIdx:
503  return gasPvt_->fugacityCoefficientOil(regionIdx, temperature, pressure);
504 
505  case waterCompIdx:
506  return gasPvt_->fugacityCoefficientWater(regionIdx, temperature, pressure);
507 
508  default:
509  OPM_THROW(std::logic_error,
510  "Invalid component index " << compIdx);
511  }
512  }
513 
520  template <class LhsEval>
521  static LhsEval fugCoefficientInOil(unsigned compIdx,
522  const LhsEval& temperature,
523  const LhsEval& pressure,
524  unsigned regionIdx)
525  {
526  switch (compIdx) {
527  case gasCompIdx:
528  return oilPvt_->fugacityCoefficientGas(regionIdx, temperature, pressure);
529 
530  case oilCompIdx:
531  return oilPvt_->fugacityCoefficientOil(regionIdx, temperature, pressure);
532 
533  case waterCompIdx:
534  return oilPvt_->fugacityCoefficientWater(regionIdx, temperature, pressure);
535 
536  default:
537  OPM_THROW(std::logic_error,
538  "Invalid component index " << compIdx);
539  }
540  }
541 
548  template <class LhsEval>
549  static LhsEval oilSaturationPressure(const LhsEval& temperature,
550  const LhsEval& XoG,
551  unsigned regionIdx)
552  { return oilPvt_->oilSaturationPressure(regionIdx, temperature, XoG); }
553 
557  template <class LhsEval>
558  static LhsEval saturatedOilGasMassFraction(const LhsEval& temperature,
559  const LhsEval& pressure,
560  unsigned regionIdx)
561  { return oilPvt_->saturatedOilGasMassFraction(regionIdx, temperature, pressure); }
562 
566  template <class LhsEval>
567  static LhsEval saturatedOilGasMoleFraction(const LhsEval& temperature,
568  const LhsEval& pressure,
569  unsigned regionIdx)
570  { return oilPvt_->saturatedOilGasMoleFraction(regionIdx, temperature, pressure); }
571 
575  template <class LhsEval>
576  static LhsEval saturatedGasOilMassFraction(const LhsEval& temperature,
577  const LhsEval& pressure,
578  unsigned regionIdx)
579  { return gasPvt_->saturatedGasOilMassFraction(regionIdx, temperature, pressure); }
580 
584  template <class LhsEval>
585  static LhsEval saturatedGasOilMoleFraction(const LhsEval& temperature,
586  const LhsEval& pressure,
587  unsigned regionIdx)
588  { return gasPvt_->saturatedGasOilMoleFraction(regionIdx, temperature, pressure); }
589 
594  template <class LhsEval>
595  static LhsEval oilFormationVolumeFactor(const LhsEval& temperature,
596  const LhsEval& pressure,
597  const LhsEval& XoG,
598  unsigned regionIdx)
599  { return oilPvt_->formationVolumeFactor(regionIdx, temperature, pressure, XoG); }
600 
604  template <class LhsEval>
605  static LhsEval oilDensity(const LhsEval& temperature,
606  const LhsEval& pressure,
607  const LhsEval& XoG,
608  unsigned regionIdx)
609  { return oilPvt_->density(regionIdx, temperature, pressure, XoG); }
610 
614  template <class LhsEval>
615  static LhsEval saturatedOilDensity(const LhsEval& temperature,
616  const LhsEval& pressure,
617  unsigned regionIdx)
618  {
619  // mass fraction of gas-saturated oil
620  const LhsEval& XoG = saturatedOilGasMassFraction(temperature, pressure, regionIdx);
621  return oilPvt_->density(regionIdx, temperature, pressure, XoG);
622  }
623 
627  template <class LhsEval>
628  static LhsEval gasFormationVolumeFactor(const LhsEval& temperature,
629  const LhsEval& pressure,
630  const LhsEval& XgO,
631  unsigned regionIdx)
632  { return gasPvt_->formationVolumeFactor(regionIdx, temperature, pressure, XgO); }
633 
637  template <class LhsEval>
638  static LhsEval gasDensity(const LhsEval& temperature,
639  const LhsEval& pressure,
640  const LhsEval& XgO,
641  unsigned regionIdx)
642  { return gasPvt_->density(regionIdx, temperature, pressure, XgO); }
643 
647  template <class LhsEval>
648  static LhsEval waterDensity(const LhsEval& temperature,
649  const LhsEval& pressure,
650  unsigned regionIdx)
651  { return waterPvt_->density(regionIdx, temperature, pressure); }
652 
653 private:
654  static void resizeArrays_(size_t numRegions)
655  {
656  molarMass_.resize(numRegions);
657  referenceDensity_.resize(numRegions);
658  }
659 
660  static std::shared_ptr<GasPvt> gasPvt_;
661  static std::shared_ptr<OilPvt> oilPvt_;
662  static std::shared_ptr<WaterPvt> waterPvt_;
663 
664  static bool enableDissolvedGas_;
665  static bool enableVaporizedOil_;
666 
667  // HACK for GCC 4.4: the array size has to be specified using the literal value '3'
668  // here, because GCC 4.4 seems to be unable to determine the number of phases from
669  // the BlackOil fluid system in the attribute declaration below...
670  static std::vector<std::array<Scalar, /*numPhases=*/3> > referenceDensity_;
671  static std::vector<std::array<Scalar, /*numComponents=*/3> > molarMass_;
672 };
673 
674 template <class Scalar>
675 const Scalar
676 BlackOil<Scalar>::surfaceTemperature = 273.15 + 15.56; // [K]
677 
678 template <class Scalar>
679 const Scalar
680 BlackOil<Scalar>::surfacePressure = 101325.0; // [Pa]
681 
682 template <class Scalar>
683 bool BlackOil<Scalar>::enableDissolvedGas_;
684 
685 template <class Scalar>
686 bool BlackOil<Scalar>::enableVaporizedOil_;
687 
688 template <class Scalar>
689 std::shared_ptr<OilPvtMultiplexer<Scalar> >
690 BlackOil<Scalar>::oilPvt_;
691 
692 template <class Scalar>
693 std::shared_ptr<Opm::GasPvtMultiplexer<Scalar> >
694 BlackOil<Scalar>::gasPvt_;
695 
696 template <class Scalar>
697 std::shared_ptr<WaterPvtMultiplexer<Scalar> >
698 BlackOil<Scalar>::waterPvt_;
699 
700 template <class Scalar>
701 std::vector<std::array<Scalar, 3> >
702 BlackOil<Scalar>::referenceDensity_;
703 
704 template <class Scalar>
705 std::vector<std::array<Scalar, 3> >
706 BlackOil<Scalar>::molarMass_;
707 }} // namespace Opm, FluidSystems
708 
709 #endif
void setRegionIndex(unsigned val)
Set the index of the region which should be used to determine the thermodynamic properties.
Definition: BlackOilFluidSystem.hpp:76
static const int waterPhaseIdx
Index of the water phase.
Definition: BlackOilFluidSystem.hpp:91
static bool isCompressible(unsigned)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: BlackOilFluidSystem.hpp:288
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition: DryGasPvt.hpp:44
static void initBegin(size_t numPvtRegions)
Begin the initialization of the black oil fluid system.
Definition: BlackOilFluidSystem.hpp:150
bool CheckDefined(const T &value OPM_UNUSED)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition: Valgrind.hpp:74
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
static LhsEval saturatedOilGasMoleFraction(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
The maximum mole fraction of the gas component in the oil phase.
Definition: BlackOilFluidSystem.hpp:567
static LhsEval fugCoefficientInWater(unsigned compIdx, const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the fugacity coefficient of a given component in the water phase.
Definition: BlackOilFluidSystem.hpp:465
The type of the fluid system's parameter cache.
Definition: BlackOilFluidSystem.hpp:59
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
static Scalar molarMass(unsigned compIdx, unsigned regionIdx=0)
Return the molar mass of a component in [kg/mol].
Definition: BlackOilFluidSystem.hpp:276
static const int oilPhaseIdx
Index of the oil phase.
Definition: BlackOilFluidSystem.hpp:93
static LhsEval fugacityCoefficient(const FluidState &fluidState, const ParameterCache &paramCache, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: BlackOilFluidSystem.hpp:330
static LhsEval gasDensity(const LhsEval &temperature, const LhsEval &pressure, const LhsEval &XgO, unsigned regionIdx)
Return the density of dry gas.
Definition: BlackOilFluidSystem.hpp:638
ParameterCache(int=0)
Definition: BlackOilFluidSystem.hpp:62
static bool isIdealGas(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: BlackOilFluidSystem.hpp:292
static LhsEval fugCoefficientInGas(unsigned compIdx, const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the fugacity coefficient of a given component in the gas phase.
Definition: BlackOilFluidSystem.hpp:493
A fluid system which uses the black-oil parameters to calculate termodynamically meaningful quantitie...
Definition: BlackOilFluidSystem.hpp:51
static void setWaterPvt(std::shared_ptr< WaterPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the water phase.
Definition: BlackOilFluidSystem.hpp:191
Some templates to wrap the valgrind client request macros.
static LhsEval fugCoefficientInOil(unsigned compIdx, const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the fugacity coefficient of a given component in the oil phase.
Definition: BlackOilFluidSystem.hpp:521
static void setGasPvt(std::shared_ptr< GasPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the gas phase.
Definition: BlackOilFluidSystem.hpp:179
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition: ConstantCompressibilityOilPvt.hpp:39
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
static LhsEval oilDensity(const LhsEval &temperature, const LhsEval &pressure, const LhsEval &XoG, unsigned regionIdx)
Return the density of (potentially) under-saturated oil.
Definition: BlackOilFluidSystem.hpp:605
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:36
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: BlackOilFluidSystem.hpp:280
static LhsEval gasDissolutionFactor(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the gas dissolution factor for a given pressure.
Definition: BlackOilFluidSystem.hpp:442
static const int numPhases
Number of fluid phases in the fluid system.
Definition: BlackOilFluidSystem.hpp:88
static bool isLiquid(const unsigned phaseIdx)
Return whether a phase is liquid.
Definition: BlackOilFluidSystem.hpp:246
static LhsEval density(const FluidState &fluidState, ParameterCache &paramCache, const unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: BlackOilFluidSystem.hpp:300
static LhsEval waterFormationVolumeFactor(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Return the formation volume factor of water.
Definition: BlackOilFluidSystem.hpp:431
static LhsEval saturatedOilGasMassFraction(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
The maximum mass fraction of the gas component in the oil phase.
Definition: BlackOilFluidSystem.hpp:558
static LhsEval gasFormationVolumeFactor(const LhsEval &temperature, const LhsEval &pressure, const LhsEval &XgO, unsigned regionIdx)
Return the formation volume factor of gas.
Definition: BlackOilFluidSystem.hpp:628
static LhsEval oilFormationVolumeFactor(const LhsEval &temperature, const LhsEval &pressure, const LhsEval &XoG, unsigned regionIdx)
Return the normalized formation volume factor of (potentially) under-saturated oil.
Definition: BlackOilFluidSystem.hpp:595
static bool enableDissolvedGas()
Returns whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition: BlackOilFluidSystem.hpp:389
A central place for various physical constants occuring in some equations.
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache &paramCache, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: BlackOilFluidSystem.hpp:355
static void setOilPvt(std::shared_ptr< OilPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the oil phase.
Definition: BlackOilFluidSystem.hpp:185
static const Scalar surfacePressure
The pressure at the surface.
Definition: BlackOilFluidSystem.hpp:98
static const int gasPhaseIdx
Index of the gas phase.
Definition: BlackOilFluidSystem.hpp:95
static void setReferenceDensities(Scalar rhoOil, Scalar rhoWater, Scalar rhoGas, unsigned regionIdx)
Initialize the values of the reference densities.
Definition: BlackOilFluidSystem.hpp:201
static LhsEval oilSaturationPressure(const LhsEval &temperature, const LhsEval &XoG, unsigned regionIdx)
Returns the saturation pressure of the oil phase [Pa] depending on its mass fraction of the gas compo...
Definition: BlackOilFluidSystem.hpp:549
static LhsEval saturatedGasOilMassFraction(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
The maximum mass fraction of the oil component in the gas phase.
Definition: BlackOilFluidSystem.hpp:576
static const int numComponents
Number of chemical species in the fluid system.
Definition: BlackOilFluidSystem.hpp:257
static const int oilCompIdx
Index of the oil component.
Definition: BlackOilFluidSystem.hpp:260
static LhsEval waterDensity(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Return the density of water.
Definition: BlackOilFluidSystem.hpp:648
static const int waterCompIdx
Index of the water component.
Definition: BlackOilFluidSystem.hpp:262
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
Definition: WaterPvtMultiplexer.hpp:47
static const char * phaseName(const unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: BlackOilFluidSystem.hpp:237
unsigned regionIndex() const
Return the index of the region which should be used to determine the thermodynamic properties...
Definition: BlackOilFluidSystem.hpp:69
static void setEnableVaporizedOil(bool yesno)
Specify whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition: BlackOilFluidSystem.hpp:173
static bool enableVaporizedOil()
Returns whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition: BlackOilFluidSystem.hpp:398
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: BlackOilFluidSystem.hpp:267
static LhsEval oilVaporizationFactor(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the oil vaporization factor for a given pressure.
Definition: BlackOilFluidSystem.hpp:453
static void initEnd()
Finish initializing the black oil fluid system.
Definition: BlackOilFluidSystem.hpp:214
static LhsEval saturatedOilDensity(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Return the density of gas-saturated oil.
Definition: BlackOilFluidSystem.hpp:615
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
static Scalar referenceDensity(unsigned phaseIdx, unsigned regionIdx)
Returns the density of a fluid phase at surface pressure [kg/m^3].
Definition: BlackOilFluidSystem.hpp:406
static const Scalar surfaceTemperature
The temperature at the surface.
Definition: BlackOilFluidSystem.hpp:101
static void setEnableDissolvedGas(bool yesno)
Specify whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition: BlackOilFluidSystem.hpp:164
static LhsEval saturatedGasOilMoleFraction(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
The maximum mole fraction of the oil component in the gas phase.
Definition: BlackOilFluidSystem.hpp:585
static const int gasCompIdx
Index of the gas component.
Definition: BlackOilFluidSystem.hpp:264
The base class for all fluid systems.
static LhsEval saturatedOilFormationVolumeFactor(const LhsEval &temperature, const LhsEval &pressure, unsigned regionIdx)
Returns the oil formation volume factor of saturated oil for a given pressure.
Definition: BlackOilFluidSystem.hpp:415
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...