LiveOilPvt.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_LIVE_OIL_PVT_HPP
26 #define OPM_LIVE_OIL_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 template <class Scalar>
41 class GasPvtMultiplexer;
42 
47 template <class Scalar>
49 {
51 
55  typedef std::vector<std::pair<Scalar, Scalar> > SamplingPoints;
56 
57 public:
58 #if HAVE_OPM_PARSER
59 
62  void initFromDeck(DeckConstPtr deck, EclipseStateConstPtr eclState)
63  {
64  const auto& pvtoTables = eclState->getTableManager()->getPvtoTables();
65  DeckKeywordConstPtr densityKeyword = deck->getKeyword("DENSITY");
66 
67  assert(pvtoTables.size() == densityKeyword->size());
68 
69  size_t numRegions = pvtoTables.size();
70  setNumRegions(numRegions);
71 
72  for (unsigned regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
73  Scalar rhoRefO = densityKeyword->getRecord(regionIdx)->getItem("OIL")->getSIDouble(0);
74  Scalar rhoRefG = densityKeyword->getRecord(regionIdx)->getItem("GAS")->getSIDouble(0);
75  Scalar rhoRefW = densityKeyword->getRecord(regionIdx)->getItem("WATER")->getSIDouble(0);
76 
77  setReferenceDensities(regionIdx, rhoRefO, rhoRefG, rhoRefW);
78 
79  // determine the molar masses of the components
80  Scalar p = 1.01325e5; // surface pressure, [Pa]
81  Scalar T = 273.15 + 15.56; // surface temperature, [K]
82  Scalar MO = 175e-3; // [kg/mol]
83  Scalar MG = Opm::Constants<Scalar>::R*T*rhoRefG / p; // [kg/mol], consequence of the ideal gas law
84  Scalar MW = 18.0e-3; // [kg/mol]
85  // TODO (?): the molar mass of the components can possibly specified
86  // explicitly in the deck.
87  setMolarMasses(regionIdx, MO, MG, MW);
88 
89  const auto& pvtoTable = pvtoTables[regionIdx];
90 
91  const auto saturatedTable = pvtoTable.getOuterTable();
92  assert(saturatedTable->numRows() > 1);
93 
94  auto& oilMu = oilMuTable_[regionIdx];
95  auto& invOilB = inverseOilBTable_[regionIdx];
96  auto& gasDissolutionFac = gasDissolutionFactorTable_[regionIdx];
97 
98  gasDissolutionFac.setXYArrays(saturatedTable->numRows(),
99  saturatedTable->getPressureColumn(),
100  saturatedTable->getGasSolubilityColumn());
101 
102  // extract the table for the gas dissolution and the oil formation volume factors
103  for (unsigned outerIdx = 0; outerIdx < saturatedTable->numRows(); ++ outerIdx) {
104  Scalar Rs = saturatedTable->getGasSolubilityColumn()[outerIdx];
105 
106  invOilB.appendXPos(Rs);
107  oilMu.appendXPos(Rs);
108 
109  assert(invOilB.numX() == outerIdx + 1);
110  assert(oilMu.numX() == outerIdx + 1);
111 
112  const auto underSaturatedTable = pvtoTable.getInnerTable(outerIdx);
113  size_t numRows = underSaturatedTable->numRows();
114  for (unsigned innerIdx = 0; innerIdx < numRows; ++ innerIdx) {
115  Scalar po = underSaturatedTable->getPressureColumn()[innerIdx];
116  Scalar Bo = underSaturatedTable->getOilFormationFactorColumn()[innerIdx];
117  Scalar muo = underSaturatedTable->getOilViscosityColumn()[innerIdx];
118 
119  invOilB.appendSamplePoint(outerIdx, po, 1.0/Bo);
120  oilMu.appendSamplePoint(outerIdx, po, muo);
121  }
122  }
123 
124  // make sure to have at least two sample points per mole fraction
125  for (unsigned xIdx = 0; xIdx < invOilB.numX(); ++xIdx) {
126  // a single sample point is definitely needed
127  assert(invOilB.numY(xIdx) > 0);
128 
129  // everything is fine if the current table has two or more sampling points
130  // for a given mole fraction
131  if (invOilB.numY(xIdx) > 1)
132  continue;
133 
134  // find the master table which will be used as a template to extend the
135  // current line. We define master table as the first table which has values
136  // for undersaturated oil...
137  size_t masterTableIdx = xIdx + 1;
138  for (; masterTableIdx < pvtoTable.getOuterTable()->numRows(); ++masterTableIdx)
139  {
140  if (pvtoTable.getInnerTable(masterTableIdx)->numRows() > 1)
141  break;
142  }
143 
144  if (masterTableIdx >= pvtoTable.getOuterTable()->numRows())
145  OPM_THROW(std::runtime_error,
146  "PVTO tables are invalid: The last table must exhibit at least one "
147  "entry for undersaturated oil!");
148 
149  // extend the current table using the master table. this is done by assuming
150  // that the current table exhibits the same ratios of the oil formation
151  // volume factors and viscosities for identical pressure rations as in the
152  // master table.
153  const auto masterTable = pvtoTable.getInnerTable(masterTableIdx);
154  const auto curTable = pvtoTable.getInnerTable(xIdx);
155  for (unsigned newRowIdx = 1; newRowIdx < masterTable->numRows(); ++ newRowIdx) {
156  Scalar alphaPo =
157  masterTable->getPressureColumn()[newRowIdx]
158  / masterTable->getPressureColumn()[0];
159 
160  Scalar alphaBo =
161  masterTable->getOilFormationFactorColumn()[newRowIdx]
162  / masterTable->getOilFormationFactorColumn()[0];
163 
164  Scalar alphaMuo =
165  masterTable->getOilViscosityColumn()[newRowIdx]
166  / masterTable->getOilViscosityColumn()[0];
167 
168  Scalar newPo = curTable->getPressureColumn()[0]*alphaPo;
169  Scalar newBo = curTable->getOilFormationFactorColumn()[0]*alphaBo;
170  Scalar newMuo = curTable->getOilViscosityColumn()[0]*alphaMuo;
171 
172  invOilB.appendSamplePoint(xIdx, newPo, 1.0/newBo);
173  oilMu.appendSamplePoint(xIdx, newPo, newMuo);
174  }
175  }
176  }
177  }
178 #endif // HAVE_OPM_PARSER
179 
180  void setNumRegions(size_t numRegions)
181  {
182  oilMolarMass_.resize(numRegions);
183  gasMolarMass_.resize(numRegions);
184  oilReferenceDensity_.resize(numRegions);
185  gasReferenceDensity_.resize(numRegions);
186  inverseOilBTable_.resize(numRegions);
187  inverseOilBMuTable_.resize(numRegions);
188  oilMuTable_.resize(numRegions);
189  gasDissolutionFactorTable_.resize(numRegions);
190  saturationPressureSpline_.resize(numRegions);
191  }
192 
196  void setReferenceDensities(unsigned regionIdx,
197  Scalar rhoRefOil,
198  Scalar rhoRefGas,
199  Scalar /*rhoRefWater*/)
200  {
201  oilReferenceDensity_[regionIdx] = rhoRefOil;
202  gasReferenceDensity_[regionIdx] = rhoRefGas;
203  }
204 
208  void setMolarMasses(unsigned regionIdx,
209  Scalar MOil,
210  Scalar MGas,
211  Scalar /*MWater*/)
212  {
213  oilMolarMass_[regionIdx] = MOil;
214  gasMolarMass_[regionIdx] = MGas;
215  }
216 
217 
223  void setSaturatedOilGasDissolutionFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
224  { gasDissolutionFactorTable_[regionIdx].setContainerOfTuples(samplePoints); }
225 
235  void setSaturatedOilFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
236  {
237  auto& invOilB = inverseOilBTable_[regionIdx];
238 
239  auto &RsTable = gasDissolutionFactorTable_[regionIdx];
240 
241  Scalar T = 273.15 + 15.56; // [K]
242 
243  Scalar RsMin = 0.0;
244  Scalar RsMax = RsTable.eval(gasDissolutionFactorTable_[regionIdx].xMax(), /*extrapolate=*/true);
245 
246  Scalar poMin = samplePoints.front().first;
247  Scalar poMax = samplePoints.back().first;
248 
249  size_t nRs = 20;
250  size_t nP = samplePoints.size()*2;
251 
252  Scalar rhogRef = gasReferenceDensity_[regionIdx];
253  Scalar rhooRef = oilReferenceDensity_[regionIdx];
254 
255  Spline oilFormationVolumeFactorSpline;
256  oilFormationVolumeFactorSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic);
257 
258  updateSaturationPressureSpline_(regionIdx);
259 
260  // calculate a table of estimated densities depending on pressure and gas mass
261  // fraction
262  for (size_t RsIdx = 0; RsIdx < nRs; ++RsIdx) {
263  Scalar Rs = RsMin + (RsMax - RsMin)*RsIdx/nRs;
264  Scalar XoG = Rs/(rhooRef/rhogRef + Rs);
265 
266  invOilB.appendXPos(Rs);
267 
268  for (size_t pIdx = 0; pIdx < nP; ++pIdx) {
269  Scalar po = poMin + (poMax - poMin)*pIdx/nP;
270 
271  Scalar poSat = oilSaturationPressure(regionIdx, T, XoG);
272  Scalar BoSat = oilFormationVolumeFactorSpline.eval(poSat, /*extrapolate=*/true);
273  Scalar drhoo_dp = (1.1200 - 1.1189)/((5000 - 4000)*6894.76);
274  Scalar rhoo = oilReferenceDensity_[regionIdx]/BoSat*(1 + drhoo_dp*(po - poSat));
275 
276  Scalar Bo = oilReferenceDensity_[regionIdx]/rhoo;
277 
278  invOilB.appendSamplePoint(RsIdx, po, 1.0/Bo);
279  }
280  }
281  }
282 
295  void setInverseOilFormationVolumeFactor(unsigned regionIdx, const TabulatedTwoDFunction& invBo)
296  { inverseOilBTable_[regionIdx] = invBo; }
297 
303  void setOilViscosity(unsigned regionIdx, const TabulatedTwoDFunction& muo)
304  { oilMuTable_[regionIdx] = muo; }
305 
313  void setSaturatedOilViscosity(unsigned regionIdx, const SamplingPoints &samplePoints )
314  {
315  auto& gasDissolutionFac = gasDissolutionFactorTable_[regionIdx];
316 
317  Scalar RsMin = 0.0;
318  Scalar RsMax = gasDissolutionFac.eval(gasDissolutionFactorTable_[regionIdx].xMax(), /*extrapolate=*/true);
319 
320  Scalar poMin = samplePoints.front().first;
321  Scalar poMax = samplePoints.back().first;
322 
323  size_t nRs = 20;
324  size_t nP = samplePoints.size()*2;
325 
326  Spline muoSpline;
327  muoSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic);
328 
329  // calculate a table of estimated densities depending on pressure and gas mass
330  // fraction
331  for (size_t RsIdx = 0; RsIdx < nRs; ++RsIdx) {
332  Scalar Rs = RsMin + (RsMax - RsMin)*RsIdx/nRs;
333 
334  oilMuTable_[regionIdx].appendXPos(Rs);
335 
336  for (size_t pIdx = 0; pIdx < nP; ++pIdx) {
337  Scalar po = poMin + (poMax - poMin)*pIdx/nP;
338  Scalar muo = muoSpline.eval(po, /*extrapolate=*/true);
339 
340  oilMuTable_[regionIdx].appendSamplePoint(RsIdx, po, muo);
341  }
342  }
343  }
344 
348  void initEnd(const GasPvtMultiplexer *gasPvt)
349  {
350  gasPvt_ = gasPvt;
351 
352  // calculate the final 2D functions which are used for interpolation.
353  size_t numRegions = oilMuTable_.size();
354  for (unsigned regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
355  // calculate the table which stores the inverse of the product of the oil
356  // formation volume factor and the oil viscosity
357  const auto& oilMu = oilMuTable_[regionIdx];
358  const auto& invOilB = inverseOilBTable_[regionIdx];
359  assert(oilMu.numX() == invOilB.numX());
360 
361  auto& invOilBMu = inverseOilBMuTable_[regionIdx];
362 
363  for (unsigned rsIdx = 0; rsIdx < oilMu.numX(); ++rsIdx) {
364  invOilBMu.appendXPos(oilMu.xAt(rsIdx));
365 
366  assert(oilMu.numY(rsIdx) == invOilB.numY(rsIdx));
367 
368  size_t numPressures = oilMu.numY(rsIdx);
369  for (unsigned pIdx = 0; pIdx < numPressures; ++pIdx)
370  invOilBMu.appendSamplePoint(rsIdx,
371  oilMu.yAt(rsIdx, pIdx),
372  invOilB.valueAt(rsIdx, pIdx)*
373  1/oilMu.valueAt(rsIdx, pIdx));
374  }
375 
376  updateSaturationPressureSpline_(regionIdx);
377  }
378  }
379 
383  template <class Evaluation>
384  Evaluation viscosity(unsigned regionIdx,
385  const Evaluation& /*temperature*/,
386  const Evaluation& pressure,
387  const Evaluation& XoG) const
388  {
389  const Evaluation& Rs =
390  XoG/(1 - XoG)*(oilReferenceDensity_[regionIdx]/gasReferenceDensity_[regionIdx]);
391 
392  // ATTENTION: Rs is the first axis!
393  const Evaluation& invBo = inverseOilBTable_[regionIdx].eval(Rs, pressure, /*extrapolate=*/true);
394  const Evaluation& invMuoBo = inverseOilBMuTable_[regionIdx].eval(Rs, pressure, /*extrapolate=*/true);
395 
396  return invBo/invMuoBo;
397  }
398 
402  template <class Evaluation>
403  Evaluation density(unsigned regionIdx,
404  const Evaluation& temperature,
405  const Evaluation& pressure,
406  const Evaluation& XoG) const
407  {
408  Scalar rhooRef = oilReferenceDensity_[regionIdx];
409  Scalar rhogRef = gasReferenceDensity_[regionIdx];
410  Valgrind::CheckDefined(rhooRef);
411  Valgrind::CheckDefined(rhogRef);
412 
413  const Evaluation& Bo = formationVolumeFactor(regionIdx, temperature, pressure, XoG);
415 
416  Evaluation rhoo = rhooRef/Bo;
417 
418  // the oil formation volume factor just represents the partial density of the oil
419  // component in the oil phase. to get the total density of the phase, we have to
420  // add the partial density of the gas component.
421  const Evaluation Rs = XoG/(1 - XoG) * rhooRef/rhogRef;
422  rhoo += rhogRef*Rs/Bo;
423 
424  return rhoo;
425  }
426 
430  template <class Evaluation>
431  Evaluation formationVolumeFactor(unsigned regionIdx,
432  const Evaluation& /*temperature*/,
433  const Evaluation& pressure,
434  const Evaluation& XoG) const
435  {
436  const Evaluation& Rs =
437  XoG/(1-XoG)*(oilReferenceDensity_[regionIdx]/gasReferenceDensity_[regionIdx]);
440 
441  // ATTENTION: Rs is represented by the _first_ axis!
442  return 1.0 / inverseOilBTable_[regionIdx].eval(Rs, pressure, /*extrapolate=*/true);
443  }
444 
449  template <class Evaluation>
450  Evaluation fugacityCoefficientOil(unsigned /*regionIdx*/,
451  const Evaluation& /*temperature*/,
452  const Evaluation& pressure) const
453  {
454  // set the oil component fugacity coefficient in oil phase
455  // arbitrarily. we use some pseudo-realistic value for the vapor
456  // pressure to ease physical interpretation of the results
457  return 20e3/pressure;
458  }
459 
460  template <class Evaluation>
461  Evaluation fugacityCoefficientWater(unsigned regionIdx,
462  const Evaluation& temperature,
463  const Evaluation& pressure) const
464  {
465  // assume that the affinity of the water component to the
466  // oil phase is one million times smaller than that of the
467  // oil component
468  return 1e8*fugacityCoefficientOil(regionIdx, temperature, pressure);
469  }
470 
471 
472  template <class Evaluation>
473  Evaluation fugacityCoefficientGas(unsigned regionIdx,
474  const Evaluation& temperature,
475  const Evaluation& pressure) const
476  {
478  // the fugacity coefficient of the gas component:
479  //
480  // first, retrieve the mole fraction of gas a saturated oil
481  // would exhibit at the given pressure
482  const Evaluation& x_oGSat = saturatedOilGasMoleFraction(regionIdx, temperature, pressure);
483 
484  // then, scale the gas component's gas phase fugacity
485  // coefficient, so that the oil phase ends up at the right
486  // composition if we were doing a flash experiment
487  const Evaluation& phi_gG = gasPvt_->fugacityCoefficientGas(regionIdx, temperature, pressure);
488 
489  return phi_gG / x_oGSat;
490  }
491 
495  template <class Evaluation>
496  Evaluation gasDissolutionFactor(unsigned regionIdx,
497  const Evaluation& /*temperature*/,
498  const Evaluation& pressure) const
499  { return gasDissolutionFactorTable_[regionIdx].eval(pressure, /*extrapolate=*/true); }
500 
507  template <class Evaluation>
508  Evaluation oilSaturationPressure(unsigned regionIdx,
509  const Evaluation& temperature,
510  const Evaluation& XoG) const
511  {
512  typedef Opm::MathToolbox<Evaluation> Toolbox;
513 
514  // use the saturation pressure spline to get a pretty good initial value
515  Evaluation pSat = saturationPressureSpline_[regionIdx].eval(XoG, /*extrapolate=*/true);
516  Evaluation eps = pSat*1e-11;
517 
518  // Newton method to do the remaining work. If the initial
519  // value is good, this should only take two to three
520  // iterations...
521  for (int i = 0; i < 20; ++i) {
522  const Evaluation& f = saturatedOilGasMassFraction(regionIdx, temperature, pSat) - XoG;
523  const Evaluation& fPrime = ((saturatedOilGasMassFraction(regionIdx, temperature, pSat + eps) - XoG) - f)/eps;
524 
525  const Evaluation& delta = f/fPrime;
526  pSat -= delta;
527 
528  Scalar absDelta = std::abs(Toolbox::value(delta));
529  if (absDelta < Toolbox::value(pSat) * 1e-10 || absDelta < 1e-4)
530  return pSat;
531  }
532 
533  OPM_THROW(NumericalProblem, "Could find the oil saturation pressure for X_o^G = " << XoG);
534  }
535 
536  template <class Evaluation>
537  Evaluation saturatedOilGasMassFraction(unsigned regionIdx,
538  const Evaluation& temperature,
539  const Evaluation& pressure) const
540  {
541  Scalar rho_gRef = gasReferenceDensity_[regionIdx];
542  Scalar rho_oRef = oilReferenceDensity_[regionIdx];
543 
544  // calculate the mass of the gas component [kg/m^3] in the oil phase. This is
545  // equivalent to the gas dissolution factor [m^3/m^3] at current pressure times
546  // the gas density [kg/m^3] at standard pressure
547  const Evaluation& rho_oG = gasDissolutionFactor(regionIdx, temperature, pressure) * rho_gRef;
548 
549  // we now have the total density of saturated oil and the partial density of the
550  // gas component within it. The gas mass fraction is the ratio of these two.
551  return rho_oG/(rho_oRef + rho_oG);
552  }
553 
554  template <class Evaluation>
555  Evaluation saturatedOilGasMoleFraction(unsigned regionIdx,
556  const Evaluation& temperature,
557  const Evaluation& pressure) const
558  {
559  // calculate the mass fractions of gas and oil
560  const Evaluation& XoG = saturatedOilGasMassFraction(regionIdx, temperature, pressure);
561 
562  // which can be converted to mole fractions, given the
563  // components' molar masses
564  Scalar MG = gasMolarMass_[regionIdx];
565  Scalar MO = oilMolarMass_[regionIdx];
566 
567  Evaluation avgMolarMass = MO/(1 + XoG*(MO/MG - 1));
568  return XoG*avgMolarMass/MG;
569  }
570 
571 private:
572  void updateSaturationPressureSpline_(unsigned regionIdx)
573  {
574  auto& gasDissolutionFac = gasDissolutionFactorTable_[regionIdx];
575 
576  // create the spline representing saturation pressure
577  // depending of the mass fraction in gas
578  size_t n = gasDissolutionFac.numSamples()*5;
579  Scalar delta = (gasDissolutionFac.xMax() - gasDissolutionFac.xMin())/(n + 1);
580 
581  SamplingPoints pSatSamplePoints;
582  Scalar XoG = 0;
583  for (size_t i=0; i <= n; ++ i) {
584  Scalar pSat = gasDissolutionFac.xMin() + i*delta;
585  XoG = saturatedOilGasMassFraction(regionIdx,
586  /*temperature=*/Scalar(1e100),
587  pSat);
588 
589  std::pair<Scalar, Scalar> val(XoG, pSat);
590  pSatSamplePoints.push_back(val);
591  }
592  saturationPressureSpline_[regionIdx].setContainerOfTuples(pSatSamplePoints,
593  /*type=*/Spline::Monotonic);
594  }
595 
596  const GasPvtMultiplexer *gasPvt_;
597 
598  std::vector<Scalar> gasMolarMass_;
599  std::vector<Scalar> oilMolarMass_;
600  std::vector<Scalar> gasReferenceDensity_;
601  std::vector<Scalar> oilReferenceDensity_;
602  std::vector<TabulatedTwoDFunction> inverseOilBTable_;
603  std::vector<TabulatedTwoDFunction> oilMuTable_;
604  std::vector<TabulatedTwoDFunction> inverseOilBMuTable_;
605  std::vector<TabulatedOneDFunction> gasDissolutionFactorTable_;
606  std::vector<Spline> saturationPressureSpline_;
607 };
608 
609 } // namespace Opm
610 
611 #endif
Definition: Spline.hpp:104
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
Implements a scalar function that depends on two variables and which is sampled uniformly in the X di...
Definition: MathToolbox.hpp:39
This class represents the Pressure-Volume-Temperature relations of the oil phas with dissolved gas...
Definition: LiveOilPvt.hpp:48
Definition: Air_Mesitylene.hpp:31
void setSaturatedOilViscosity(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the phase viscosity for gas saturated oil.
Definition: LiveOilPvt.hpp:313
Evaluation fugacityCoefficientGas(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: LiveOilPvt.hpp:473
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: LiveOilPvt.hpp:196
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 fugacityCoefficientGas(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the fugacity coefficient [Pa] of the gas component in the gas phase given a set of parameters...
Definition: GasPvtMultiplexer.hpp:175
void setOilViscosity(unsigned regionIdx, const TabulatedTwoDFunction &muo)
Initialize the viscosity of the oil phase.
Definition: LiveOilPvt.hpp:303
Evaluation formationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &XoG) const
Returns the formation volume factor [-] of the fluid phase.
Definition: LiveOilPvt.hpp:431
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition: ConstantCompressibilityOilPvt.hpp:39
Evaluation fugacityCoefficientOil(unsigned, const Evaluation &, const Evaluation &pressure) const
Returns the fugacity coefficient [Pa] of a component in the fluid phase given a set of parameters...
Definition: LiveOilPvt.hpp:450
Class implementing cubic splines.
Evaluation saturatedOilGasMassFraction(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: LiveOilPvt.hpp:537
void setMolarMasses(unsigned regionIdx, Scalar MOil, Scalar MGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: LiveOilPvt.hpp:208
Implements a linearly interpolated scalar function that depends on one variable.
Evaluation density(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &XoG) const
Returns the density [kg/m^3] of the fluid phase given a set of parameters.
Definition: LiveOilPvt.hpp:403
Evaluation fugacityCoefficientWater(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: LiveOilPvt.hpp:461
A central place for various physical constants occuring in some equations.
void setSaturatedOilGasDissolutionFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the gas dissolution factor .
Definition: LiveOilPvt.hpp:223
This file provides a wrapper around the "final" C++-2011 statement.
void initEnd(const GasPvtMultiplexer *gasPvt)
Finish initializing the oil phase PVT properties.
Definition: LiveOilPvt.hpp:348
void setSaturatedOilFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the oil formation volume factor.
Definition: LiveOilPvt.hpp:235
Evaluation< Scalar, VarSetTag, numVars > abs(const Evaluation< Scalar, VarSetTag, numVars > &)
Definition: Math.hpp:41
Class implementing cubic splines.
Definition: Spline.hpp:89
Evaluation oilSaturationPressure(unsigned regionIdx, const Evaluation &temperature, const Evaluation &XoG) const
Returns the saturation pressure of the oil phase [Pa] depending on its mass fraction of the gas compo...
Definition: LiveOilPvt.hpp:508
Scalar eval(Scalar x, bool extrapolate=false) const
Evaluate the spline at a given position.
Definition: Spline.hpp:809
void setNumRegions(size_t numRegions)
Definition: LiveOilPvt.hpp:180
Evaluation gasDissolutionFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition: LiveOilPvt.hpp:496
void setInverseOilFormationVolumeFactor(unsigned regionIdx, const TabulatedTwoDFunction &invBo)
Initialize the spline for the oil formation volume factor.
Definition: LiveOilPvt.hpp:295
Implements a scalar function that depends on two variables and which is sampled uniformly in the X di...
Definition: UniformXTabulated2DFunction.hpp:53
Evaluation saturatedOilGasMoleFraction(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Definition: LiveOilPvt.hpp:555
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:44
Evaluation viscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &XoG) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: LiveOilPvt.hpp:384
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39