WetGasPvt.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) 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_WET_GAS_PVT_HPP
26 #define OPM_WET_GAS_PVT_HPP
27 
29 
34 
35 #if HAVE_OPM_PARSER
36 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
37 #endif
38 
39 namespace Opm {
40 
41 template <class Scalar>
42 class OilPvtMultiplexer;
43 
48 template <class Scalar>
49 class WetGasPvt
50 {
52 
56  typedef std::vector<std::pair<Scalar, Scalar> > SamplingPoints;
57 
58 public:
59 #if HAVE_OPM_PARSER
60 
65  void initFromDeck(DeckConstPtr deck, EclipseStateConstPtr eclState)
66  {
67  const auto& pvtgTables = eclState->getTableManager()->getPvtgTables();
68  DeckKeywordConstPtr densityKeyword = deck->getKeyword("DENSITY");
69 
70  assert(pvtgTables.size() == densityKeyword->size());
71 
72  size_t numRegions = pvtgTables.size();
73  setNumRegions(numRegions);
74 
75  for (unsigned regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
76  Scalar rhoRefO = densityKeyword->getRecord(regionIdx)->getItem("OIL")->getSIDouble(0);
77  Scalar rhoRefG = densityKeyword->getRecord(regionIdx)->getItem("GAS")->getSIDouble(0);
78  Scalar rhoRefW = densityKeyword->getRecord(regionIdx)->getItem("WATER")->getSIDouble(0);
79 
80  setReferenceDensities(regionIdx, rhoRefO, rhoRefG, rhoRefW);
81 
82  // determine the molar masses of the components
83  Scalar p = 1.01325e5; // surface pressure, [Pa]
84  Scalar T = 273.15 + 15.56; // surface temperature, [K]
85  Scalar MO = 175e-3; // [kg/mol]
86  Scalar MG = Opm::Constants<Scalar>::R*T*rhoRefG / p; // [kg/mol], consequence of the ideal gas law
87  Scalar MW = 18.0e-3; // [kg/mol]
88  // TODO (?): the molar mass of the components can possibly specified
89  // explicitly in the deck.
90  setMolarMasses(regionIdx, MO, MG, MW);
91 
92  const auto& pvtgTable = pvtgTables[regionIdx];
93 
94  const auto saturatedTable = pvtgTable.getOuterTable();
95  assert(saturatedTable->numRows() > 1);
96 
97  auto& gasMu = gasMu_[regionIdx];
98  auto& invGasB = inverseGasB_[regionIdx];
99  auto& oilVaporizationFac = oilVaporizationFactorTable_[regionIdx];
100 
101  oilVaporizationFac.setXYArrays(saturatedTable->numRows(),
102  saturatedTable->getPressureColumn(),
103  saturatedTable->getOilSolubilityColumn());
104 
105  // extract the table for the gas dissolution and the oil formation volume factors
106  for (size_t outerIdx = 0; outerIdx < saturatedTable->numRows(); ++ outerIdx) {
107  Scalar pg = saturatedTable->getPressureColumn()[outerIdx];
108 
109  invGasB.appendXPos(pg);
110  gasMu.appendXPos(pg);
111 
112  assert(invGasB.numX() == outerIdx + 1);
113  assert(gasMu.numX() == outerIdx + 1);
114 
115  const auto underSaturatedTable = pvtgTable.getInnerTable(outerIdx);
116  size_t numRows = underSaturatedTable->numRows();
117  for (size_t innerIdx = 0; innerIdx < numRows; ++ innerIdx) {
118  Scalar Rv = underSaturatedTable->getOilSolubilityColumn()[innerIdx];
119  Scalar Bg = underSaturatedTable->getGasFormationFactorColumn()[innerIdx];
120  Scalar mug = underSaturatedTable->getGasViscosityColumn()[innerIdx];
121 
122  invGasB.appendSamplePoint(outerIdx, Rv, 1.0/Bg);
123  gasMu.appendSamplePoint(outerIdx, Rv, mug);
124  }
125  }
126 
127  // make sure to have at least two sample points per mole fraction
128  for (size_t xIdx = 0; xIdx < invGasB.numX(); ++xIdx) {
129  // a single sample point is definitely needed
130  assert(invGasB.numY(xIdx) > 0);
131 
132  // everything is fine if the current table has two or more sampling points
133  // for a given mole fraction
134  if (invGasB.numY(xIdx) > 1)
135  continue;
136 
137  // find the master table which will be used as a template to extend the
138  // current line. We define master table as the first table which has values
139  // for undersaturated gas...
140  size_t masterTableIdx = xIdx + 1;
141  for (; masterTableIdx < pvtgTable.getOuterTable()->numRows(); ++masterTableIdx)
142  {
143  if (pvtgTable.getInnerTable(masterTableIdx)->numRows() > 1)
144  break;
145  }
146 
147  if (masterTableIdx >= pvtgTable.getOuterTable()->numRows())
148  OPM_THROW(std::runtime_error,
149  "PVTG tables are invalid: The last table must exhibit at least one "
150  "entry for undersaturated gas!");
151 
152  // extend the current table using the master table. this is done by assuming
153  // that the current table exhibits the same ratios of the gas formation
154  // volume factors and viscosities for identical pressure rations as in the
155  // master table.
156  const auto masterTable = pvtgTable.getInnerTable(masterTableIdx);
157  const auto curTable = pvtgTable.getInnerTable(xIdx);
158  for (size_t newRowIdx = 1; newRowIdx < masterTable->numRows(); ++ newRowIdx) {
159  Scalar alphaRv =
160  masterTable->getOilSolubilityColumn()[newRowIdx]
161  / masterTable->getOilSolubilityColumn()[0];
162 
163  Scalar alphaBg =
164  masterTable->getGasFormationFactorColumn()[newRowIdx]
165  / masterTable->getGasFormationFactorColumn()[0];
166 
167  Scalar alphaMug =
168  masterTable->getGasViscosityColumn()[newRowIdx]
169  / masterTable->getGasViscosityColumn()[0];
170 
171  Scalar newRv = curTable->getOilSolubilityColumn()[0]*alphaRv;
172  Scalar newBg = curTable->getGasFormationFactorColumn()[0]*alphaBg;
173  Scalar newMug = curTable->getGasViscosityColumn()[0]*alphaMug;
174 
175  invGasB.appendSamplePoint(xIdx, newRv, 1.0/newBg);
176  gasMu.appendSamplePoint(xIdx, newRv, newMug);
177  }
178  }
179  }
180  }
181 #endif // HAVE_OPM_PARSER
182 
183  void setNumRegions(size_t numRegions)
184  {
185  oilMolarMass_.resize(numRegions);
186  gasMolarMass_.resize(numRegions);
187  oilReferenceDensity_.resize(numRegions);
188  gasReferenceDensity_.resize(numRegions);
189  inverseGasB_.resize(numRegions);
190  inverseGasBMu_.resize(numRegions);
191  gasMu_.resize(numRegions);
192  oilVaporizationFactorTable_.resize(numRegions);
193  saturationPressureSpline_.resize(numRegions);
194  }
195 
199  void setReferenceDensities(unsigned regionIdx,
200  Scalar rhoRefOil,
201  Scalar rhoRefGas,
202  Scalar /*rhoRefWater*/)
203  {
204  oilReferenceDensity_[regionIdx] = rhoRefOil;
205  gasReferenceDensity_[regionIdx] = rhoRefGas;
206  }
207 
211  void setMolarMasses(unsigned regionIdx,
212  Scalar MOil,
213  Scalar MGas,
214  Scalar /*MWater*/)
215  {
216  oilMolarMass_[regionIdx] = MOil;
217  gasMolarMass_[regionIdx] = MGas;
218  }
219 
225  void setSaturatedGasOilVaporizationFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
226  { oilVaporizationFactorTable_[regionIdx].setContainerOfTuples(samplePoints); }
227 
237  void setSaturatedGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
238  {
239  auto& invGasB = inverseGasB_[regionIdx];
240 
241  auto &RvTable = oilVaporizationFactorTable_[regionIdx];
242 
243  Scalar T = 273.15 + 15.56; // [K]
244 
245  Scalar RvMin = 0.0;
246  Scalar RvMax = RvTable.eval(oilVaporizationFactorTable_[regionIdx].xMax(), /*extrapolate=*/true);
247 
248  Scalar poMin = samplePoints.front().first;
249  Scalar poMax = samplePoints.back().first;
250 
251  size_t nRv = 20;
252  size_t nP = samplePoints.size()*2;
253 
254  Scalar rhogRef = gasReferenceDensity_[regionIdx];
255  Scalar rhooRef = oilReferenceDensity_[regionIdx];
256 
257  Spline gasFormationVolumeFactorSpline;
258  gasFormationVolumeFactorSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic);
259 
260  updateSaturationPressureSpline_(regionIdx);
261 
262  // calculate a table of estimated densities depending on pressure and gas mass
263  // fraction. note that this assumes oil of constant compressibility. (having said
264  // that, if only the saturated gas densities are available, there's not much
265  // choice.)
266  for (size_t RvIdx = 0; RvIdx < nRv; ++RvIdx) {
267  Scalar Rv = RvMin + (RvMax - RvMin)*RvIdx/nRv;
268  Scalar XgO = Rv/(rhooRef/rhogRef + Rv);
269 
270  invGasB.appendXPos(Rv);
271 
272  for (size_t pIdx = 0; pIdx < nP; ++pIdx) {
273  Scalar pg = poMin + (poMax - poMin)*pIdx/nP;
274 
275  Scalar poSat = gasSaturationPressure(regionIdx, T, XgO);
276  Scalar BgSat = gasFormationVolumeFactorSpline.eval(poSat, /*extrapolate=*/true);
277  Scalar drhoo_dp = (1.1200 - 1.1189)/((5000 - 4000)*6894.76);
278  Scalar rhoo = rhooRef/BgSat*(1 + drhoo_dp*(pg - poSat));
279 
280  Scalar Bg = rhooRef/rhoo;
281 
282  invGasB.appendSamplePoint(RvIdx, pg, 1.0/Bg);
283  }
284  }
285  }
286 
299  void setInverseGasFormationVolumeFactor(unsigned regionIdx, const TabulatedTwoDFunction& invBg)
300  { inverseGasB_[regionIdx] = invBg; }
301 
307  void setGasViscosity(unsigned regionIdx, const TabulatedTwoDFunction& mug)
308  { gasMu_[regionIdx] = mug; }
309 
317  void setSaturatedGasViscosity(unsigned regionIdx, const SamplingPoints &samplePoints )
318  {
319  auto& oilVaporizationFac = oilVaporizationFactorTable_[regionIdx];
320 
321  Scalar RvMin = 0.0;
322  Scalar RvMax = oilVaporizationFac.eval(oilVaporizationFactorTable_[regionIdx].xMax(), /*extrapolate=*/true);
323 
324  Scalar poMin = samplePoints.front().first;
325  Scalar poMax = samplePoints.back().first;
326 
327  size_t nRv = 20;
328  size_t nP = samplePoints.size()*2;
329 
330  Spline mugSpline;
331  mugSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic);
332 
333  // calculate a table of estimated densities depending on pressure and gas mass
334  // fraction
335  for (size_t RvIdx = 0; RvIdx < nRv; ++RvIdx) {
336  Scalar Rv = RvMin + (RvMax - RvMin)*RvIdx/nRv;
337 
338  gasMu_[regionIdx].appendXPos(Rv);
339 
340  for (size_t pIdx = 0; pIdx < nP; ++pIdx) {
341  Scalar pg = poMin + (poMax - poMin)*pIdx/nP;
342  Scalar mug = mugSpline.eval(pg, /*extrapolate=*/true);
343 
344  gasMu_[regionIdx].appendSamplePoint(RvIdx, pg, mug);
345  }
346  }
347  }
348 
352  void initEnd(const OilPvtMultiplexer *oilPvt)
353  {
354  oilPvt_ = oilPvt;
355 
356  // calculate the final 2D functions which are used for interpolation.
357  size_t numRegions = gasMu_.size();
358  for (unsigned regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
359  // calculate the table which stores the inverse of the product of the gas
360  // formation volume factor and the gas viscosity
361  const auto& gasMu = gasMu_[regionIdx];
362  const auto& invGasB = inverseGasB_[regionIdx];
363  assert(gasMu.numX() == invGasB.numX());
364 
365  auto& invGasBMu = inverseGasBMu_[regionIdx];
366 
367  for (size_t pIdx = 0; pIdx < gasMu.numX(); ++pIdx) {
368  invGasBMu.appendXPos(gasMu.xAt(pIdx));
369 
370  assert(gasMu.numY(pIdx) == invGasB.numY(pIdx));
371 
372  size_t numPressures = gasMu.numY(pIdx);
373  for (size_t rvIdx = 0; rvIdx < numPressures; ++rvIdx)
374  invGasBMu.appendSamplePoint(pIdx,
375  gasMu.yAt(pIdx, rvIdx),
376  invGasB.valueAt(pIdx, rvIdx)*
377  1/gasMu.valueAt(pIdx, rvIdx));
378  }
379 
380  updateSaturationPressureSpline_(regionIdx);
381  }
382  }
383 
387  template <class Evaluation>
388  Evaluation viscosity(unsigned regionIdx,
389  const Evaluation& /*temperature*/,
390  const Evaluation& pressure,
391  const Evaluation& XgO) const
392  {
393  Scalar rhooRef = oilReferenceDensity_[regionIdx];
394  Scalar rhogRef = gasReferenceDensity_[regionIdx];
395  const Evaluation& Rv = XgO/(1 - XgO)*(rhogRef/rhooRef);
396 
397  const Evaluation& invBg = inverseGasB_[regionIdx].eval(pressure, Rv, /*extrapolate=*/true);
398  const Evaluation& invMugBg = inverseGasBMu_[regionIdx].eval(pressure, Rv, /*extrapolate=*/true);
399 
400  return invBg/invMugBg;
401  }
402 
406  template <class Evaluation>
407  Evaluation density(unsigned regionIdx,
408  const Evaluation& temperature,
409  const Evaluation& pressure,
410  const Evaluation& XgO) const
411  {
412  Scalar rhooRef = oilReferenceDensity_[regionIdx];
413  Scalar rhogRef = gasReferenceDensity_[regionIdx];
414 
415  const Evaluation& Bg = formationVolumeFactor(regionIdx, temperature, pressure, XgO);
416 
417  Evaluation rhog = rhogRef/Bg;
418 
419  // the oil formation volume factor just represents the partial density of the gas
420  // component in the gas phase. to get the total density of the phase, we have to
421  // add the partial density of the oil component.
422  const Evaluation& Rv = XgO/(1 - XgO)*(rhogRef/rhooRef);
423  rhog += (rhogRef*Rv)/Bg;
424 
425  return rhog;
426  }
427 
431  template <class Evaluation>
432  Evaluation formationVolumeFactor(unsigned regionIdx,
433  const Evaluation& /*temperature*/,
434  const Evaluation& pressure,
435  const Evaluation& XgO) const
436  {
437  Scalar rhooRef = oilReferenceDensity_[regionIdx];
438  Scalar rhogRef = gasReferenceDensity_[regionIdx];
439 
440  const Evaluation& Rv = XgO/(1-XgO)*(rhogRef/rhooRef);
441 
442  return 1.0 / inverseGasB_[regionIdx].eval(pressure, Rv, /*extrapolate=*/true);
443  }
444 
449  template <class Evaluation>
450  Evaluation fugacityCoefficientGas(unsigned /*regionIdx*/,
451  const Evaluation& /*temperature*/,
452  const Evaluation& /*pressure*/) const
453  {
454  // the fugacity coefficient of the gas component in the gas phase is assumed to
455  // be that of an ideal gas.
456  return 1.0;
457  }
458 
459  template <class Evaluation>
460  Evaluation fugacityCoefficientOil(unsigned regionIdx,
461  const Evaluation& temperature,
462  const Evaluation& pressure) const
463  {
464  // the fugacity coefficient of the oil component in the wet gas phase:
465  //
466  // first, retrieve the mole fraction of gas a saturated oil would exhibit at the
467  // given pressure
468  const Evaluation& x_gOSat = saturatedGasOilMoleFraction(regionIdx, temperature, pressure);
469 
470  // then, scale the oil component's gas phase fugacity coefficient, so that the
471  // gas phase ends up at the right composition if we were doing a flash experiment
472  const Evaluation& phi_oO = oilPvt_->fugacityCoefficientOil(regionIdx, temperature, pressure);
473 
474  return phi_oO / x_gOSat;
475  }
476 
477  template <class Evaluation>
478  Evaluation fugacityCoefficientWater(unsigned regionIdx,
479  const Evaluation& temperature,
480  const Evaluation& pressure) const
481  {
482  // assume that the affinity of the water component to the gas phase is much
483  // smaller than that of the gas component
484  return 1e8*fugacityCoefficientWater(regionIdx, temperature, pressure);
485  }
486 
490  template <class Evaluation>
491  Evaluation oilVaporizationFactor(unsigned regionIdx,
492  const Evaluation& /*temperature*/,
493  const Evaluation& pressure) const
494  { return oilVaporizationFactorTable_[regionIdx].eval(pressure, /*extrapolate=*/true); }
495 
502  template <class Evaluation>
503  Evaluation gasSaturationPressure(unsigned regionIdx,
504  const Evaluation& temperature,
505  const Evaluation& XgO) const
506  {
507  typedef Opm::MathToolbox<Evaluation> Toolbox;
508 
509  // use the saturation pressure spline to get a pretty good initial value
510  Evaluation pSat = saturationPressureSpline_[regionIdx].eval(XgO, /*extrapolate=*/true);
511  const Evaluation& eps = pSat*1e-11;
512 
513  // Newton method to do the remaining work. If the initial
514  // value is good, this should only take two to three
515  // iterations...
516  for (unsigned i = 0; i < 20; ++i) {
517  const Evaluation& f = saturatedGasOilMassFraction(regionIdx, temperature, pSat) - XgO;
518  const Evaluation& fPrime = ((saturatedGasOilMassFraction(regionIdx, temperature, pSat + eps) - XgO) - f)/eps;
519 
520  const Evaluation& delta = f/fPrime;
521  pSat -= delta;
522 
523  if (std::abs(Toolbox::value(delta)) < std::abs(Toolbox::value(pSat)) * 1e-10)
524  return pSat;
525  }
526 
527  OPM_THROW(NumericalProblem, "Could find the gas saturation pressure for X_g^O = " << XgO);
528  }
529 
530  template <class Evaluation>
531  Evaluation saturatedGasOilMassFraction(unsigned regionIdx,
532  const Evaluation& temperature,
533  const Evaluation& pressure) const
534  {
535  Scalar rho_gRef = gasReferenceDensity_[regionIdx];
536  Scalar rho_oRef = oilReferenceDensity_[regionIdx];
537 
538  // calculate the mass of the oil component [kg/m^3] in the gas phase. This is
539  // equivalent to the oil vaporization factor [m^3/m^3] at current pressure times
540  // the oil density [kg/m^3] at standard pressure
541  const Evaluation& Rv = oilVaporizationFactor(regionIdx, temperature, pressure);
542  const Evaluation& rho_gO = Rv * rho_oRef;
543 
544  // we now have the total density of saturated oil and the partial density of the
545  // oil component within it. The gas mass fraction is the ratio of these two.
546  return rho_gO/(rho_gRef + rho_gO);
547  }
548 
549  template <class Evaluation>
550  Evaluation saturatedGasOilMoleFraction(unsigned regionIdx,
551  const Evaluation& temperature,
552  const Evaluation& pressure) const
553  {
554  // calculate the mass fractions of gas and oil
555  const Evaluation& XgO = saturatedGasOilMassFraction(regionIdx, temperature, pressure);
556 
557  // which can be converted to mole fractions, given the
558  // components' molar masses
559  Scalar MG = gasMolarMass_[regionIdx];
560  Scalar MO = oilMolarMass_[regionIdx];
561 
562  const Evaluation& avgMolarMass = MO/(1 + (1 - XgO)*(MO/MG - 1));
563  return XgO*avgMolarMass/MO;
564  }
565 
566 private:
567  void updateSaturationPressureSpline_(unsigned regionIdx)
568  {
569  auto& oilVaporizationFac = oilVaporizationFactorTable_[regionIdx];
570 
571  // create the spline representing saturation pressure
572  // depending of the mass fraction in gas
573  size_t n = oilVaporizationFac.numSamples()*5;
574  Scalar delta = (oilVaporizationFac.xMax() - oilVaporizationFac.xMin())/(n + 1);
575 
576  SamplingPoints pSatSamplePoints;
577  Scalar XgO = 0;
578  for (size_t i = 0; i <= n; ++ i) {
579  Scalar pSat = oilVaporizationFac.xMin() + i*delta;
580  XgO = saturatedGasOilMassFraction(regionIdx, /*temperature=*/Scalar(1e100), pSat);
581 
582  std::pair<Scalar, Scalar> val(XgO, pSat);
583  pSatSamplePoints.push_back(val);
584  }
585  saturationPressureSpline_[regionIdx].setContainerOfTuples(pSatSamplePoints,
586  /*type=*/Spline::Monotonic);
587  }
588 
589  const OilPvtMultiplexer *oilPvt_;
590 
591  std::vector<Scalar> gasMolarMass_;
592  std::vector<Scalar> oilMolarMass_;
593  std::vector<Scalar> gasReferenceDensity_;
594  std::vector<Scalar> oilReferenceDensity_;
595  std::vector<TabulatedTwoDFunction> inverseGasB_;
596  std::vector<TabulatedTwoDFunction> gasMu_;
597  std::vector<TabulatedTwoDFunction> inverseGasBMu_;
598  std::vector<TabulatedOneDFunction> oilVaporizationFactorTable_;
599  std::vector<Spline> saturationPressureSpline_;
600 };
601 
602 } // namespace Opm
603 
604 #endif
Evaluation saturatedGasOilMassFraction(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: WetGasPvt.hpp:531
Evaluation oilVaporizationFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition: WetGasPvt.hpp:491
Evaluation formationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &XgO) const
Returns the formation volume factor [-] of the fluid phase.
Definition: WetGasPvt.hpp:432
Evaluation fugacityCoefficientGas(unsigned, const Evaluation &, const Evaluation &) const
Returns the fugacity coefficient [Pa] of a component in the fluid phase given a set of parameters...
Definition: WetGasPvt.hpp:450
Evaluation fugacityCoefficientOil(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the fugacity coefficient [-] of the oil component in the oil phase given a pressure and a tem...
Definition: OilPvtMultiplexer.hpp:166
void initEnd(const OilPvtMultiplexer *oilPvt)
Finish initializing the gas phase PVT properties.
Definition: WetGasPvt.hpp:352
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition: DryGasPvt.hpp:44
Definition: Spline.hpp:104
Implements a scalar function that depends on two variables and which is sampled uniformly in the X di...
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
void setSaturatedGasViscosity(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the phase viscosity for oil saturated gas.
Definition: WetGasPvt.hpp:317
Evaluation viscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &XgO) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: WetGasPvt.hpp:388
Evaluation fugacityCoefficientOil(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: WetGasPvt.hpp:460
void setContainerOfTuples(const XYContainer &points, Scalar m0, Scalar m1, bool sortInputs=false)
Set the sampling points and the boundary slopes of a full spline using a STL-compatible container of ...
Definition: Spline.hpp:474
Evaluation gasSaturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &XgO) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition: WetGasPvt.hpp:503
Evaluation fugacityCoefficientWater(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: WetGasPvt.hpp:478
Class implementing cubic splines.
void setSaturatedGasOilVaporizationFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the oil vaporization factor .
Definition: WetGasPvt.hpp:225
Implements a linearly interpolated scalar function that depends on one variable.
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: WetGasPvt.hpp:199
A central place for various physical constants occuring in some equations.
This class represents the Pressure-Volume-Temperature relations of the gas phas with vaporized oil...
Definition: WetGasPvt.hpp:49
This file provides a wrapper around the "final" C++-2011 statement.
void setInverseGasFormationVolumeFactor(unsigned regionIdx, const TabulatedTwoDFunction &invBg)
Initialize the function for the gas formation volume factor.
Definition: WetGasPvt.hpp:299
Evaluation< Scalar, VarSetTag, numVars > abs(const Evaluation< Scalar, VarSetTag, numVars > &)
Definition: Math.hpp:41
Class implementing cubic splines.
Definition: Spline.hpp:89
void setGasViscosity(unsigned regionIdx, const TabulatedTwoDFunction &mug)
Initialize the viscosity of the gas phase.
Definition: WetGasPvt.hpp:307
Evaluation saturatedGasOilMoleFraction(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: WetGasPvt.hpp:550
void setNumRegions(size_t numRegions)
Definition: WetGasPvt.hpp:183
void setMolarMasses(unsigned regionIdx, Scalar MOil, Scalar MGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: WetGasPvt.hpp:211
Scalar eval(Scalar x, bool extrapolate=false) const
Evaluate the spline at a given position.
Definition: Spline.hpp:809
Implements a scalar function that depends on two variables and which is sampled uniformly in the X di...
Definition: UniformXTabulated2DFunction.hpp:53
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:44
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39
Evaluation density(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &XgO) const
Returns the density [kg/m^3] of the fluid phase given a set of parameters.
Definition: WetGasPvt.hpp:407
void setSaturatedGasFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the gas formation volume factor.
Definition: WetGasPvt.hpp:237