opm-common
Co2GasPvt.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  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
27 #ifndef OPM_CO2_GAS_PVT_HPP
28 #define OPM_CO2_GAS_PVT_HPP
29 
30 #include <opm/common/utility/VectorWithDefaultAllocator.hpp>
31 
33 #include <opm/common/TimingMacros.hpp>
34 #include <opm/common/ErrorMacros.hpp>
35 #include <opm/common/utility/gpuDecorators.hpp>
37 
43 #include <opm/input/eclipse/EclipseState/Co2StoreConfig.hpp>
44 #include <opm/material/components/CO2Tables.hpp>
45 #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
46 #include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
47 
48 #include <cstddef>
49 #include <vector>
50 
51 namespace Opm {
52 
53 class EclipseState;
54 class Schedule;
55 class Co2StoreConfig;
56 
57 // forward declaration of the class so the function in the next namespace can be declared
58 template <class Scalar, template<class> class Storage>
59 class Co2GasPvt;
60 
61 #if HAVE_CUDA
62 // declaration of make_view in correct namespace so friend function can be declared in the class
63 namespace gpuistl {
64  template <class Scalar>
66  make_view(Co2GasPvt<Scalar, GpuVector>&);
67 } // namespace gpuistl
68 #endif // HAVE_CUDA
69 
73 template <class Scalar, template<class> class Storage = VectorWithDefaultAllocator>
74 class Co2GasPvt
75 {
76  using Params = Opm::CO2Tables<double, Storage>;
80  using ContainerT = Storage<Scalar>;
81  static constexpr bool extrapolate = true;
82 
83 public:
86 
87  Co2GasPvt() = default;
88 
89  explicit Co2GasPvt(const ContainerT& salinity,
90  int activityModel = 3,
91  int thermalMixingModel = 1,
92  Scalar T_ref = 288.71, //(273.15 + 15.56)
93  Scalar P_ref = 101325);
94 
95  Co2GasPvt(const Params& params,
96  const ContainerT& brineReferenceDensity,
97  const ContainerT& gasReferenceDensity,
98  const ContainerT& salinity,
99  bool enableEzrokhiDensity,
100  bool enableVaporization,
101  int activityModel,
102  Co2StoreConfig::GasMixingType gastype)
103  : brineReferenceDensity_(brineReferenceDensity)
104  , gasReferenceDensity_(gasReferenceDensity)
105  , salinity_(salinity)
106  , enableEzrokhiDensity_(enableEzrokhiDensity)
107  , enableVaporization_(enableVaporization)
108  , activityModel_(activityModel)
109  , gastype_(gastype)
110  , co2Tables(params)
111 {
112  assert(enableEzrokhiDensity == false && "Ezrokhi density not supported by GPUs");
113 }
114 
115  void initFromState(const EclipseState& eclState, const Schedule&);
116 
117  void setNumRegions(std::size_t numRegions);
118 
119  OPM_HOST_DEVICE void setVapPars(const Scalar, const Scalar)
120  {
121  }
122 
123 
124  OPM_HOST_DEVICE static constexpr bool isActive()
125  {
126  return true;
127  }
128 
132  OPM_HOST_DEVICE void setReferenceDensities(unsigned regionIdx,
133  Scalar rhoRefBrine,
134  Scalar rhoRefGas,
135  Scalar /*rhoRefWater*/);
136 
143  OPM_HOST_DEVICE void setEnableVaporizationWater(bool yesno)
144  { enableVaporization_ = yesno; }
145 
149  OPM_HOST_DEVICE void setActivityModelSalt(int activityModel);
150 
154  OPM_HOST_DEVICE void setThermalMixingModel(int thermalMixingModel);
155 
159  OPM_HOST_DEVICE void initEnd()
160  {
161  }
162 
166  OPM_HOST_DEVICE unsigned numRegions() const
167  { return gasReferenceDensity_.size(); }
168 
169  OPM_HOST_DEVICE Scalar hVap(unsigned ) const
170  { return 0.0; }
171 
175  template <class Evaluation>
176  OPM_HOST_DEVICE Evaluation internalEnergy(unsigned regionIdx,
177  const Evaluation& temperature,
178  const Evaluation& pressure,
179  const Evaluation& rv,
180  const Evaluation& rvw) const
181  {
182  OPM_TIMEBLOCK_LOCAL(internalEnergy, Subsystem::PvtProps);
183  if (gastype_ == Co2StoreConfig::GasMixingType::NONE) {
184  // use the gasInternalEnergy of CO2
185  return CO2::gasInternalEnergy(co2Tables, temperature, pressure, extrapolate);
186  }
187 
188  assert(gastype_ == Co2StoreConfig::GasMixingType::IDEAL);
189  // account for H2O in the gas phase
190  Evaluation result = 0;
191  // The CO2STORE option both works for GAS/WATER and GAS/OIL systems
192  // Either rv og rvw should be zero
193  assert(rv == 0.0 || rvw == 0.0);
194  const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
195  result += xBrine * H2O::gasInternalEnergy(temperature, pressure);
196  result += (1 - xBrine) * CO2::gasInternalEnergy(co2Tables, temperature, pressure, extrapolate);
197  return result;
198  }
199 
204  template <class Evaluation>
205  OPM_HOST_DEVICE Evaluation viscosity(unsigned regionIdx,
206  const Evaluation& temperature,
207  const Evaluation& pressure,
208  const Evaluation& /*Rv*/,
209  const Evaluation& /*Rvw*/) const
210  { return saturatedViscosity(regionIdx, temperature, pressure); }
211 
215  template <class Evaluation>
216  OPM_HOST_DEVICE Evaluation saturatedViscosity(unsigned /*regionIdx*/,
217  const Evaluation& temperature,
218  const Evaluation& pressure) const
219  {
220  OPM_TIMEBLOCK_LOCAL(saturatedViscosity, Subsystem::PvtProps);
221  // Neglects impact of vaporized water on the visosity
222  return CO2::gasViscosity(co2Tables, temperature, pressure, extrapolate);
223  }
224 
228  template <class Evaluation>
229  OPM_HOST_DEVICE Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
230  const Evaluation& temperature,
231  const Evaluation& pressure,
232  const Evaluation& rv,
233  const Evaluation& rvw) const
234  {
235  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
236  if (!enableVaporization_) {
237  return CO2::gasDensity(co2Tables, temperature, pressure, extrapolate) /
238  gasReferenceDensity_[regionIdx];
239  }
240 
241  // Use CO2 density for the gas phase.
242  const auto& rhoCo2 = CO2::gasDensity(co2Tables, temperature, pressure, extrapolate);
243  //const auto& rhoH2O = H2O::gasDensity(temperature, pressure);
244  //The CO2STORE option both works for GAS/WATER and GAS/OIL systems
245  //Either rv og rvw should be zero
246  //assert(rv == 0.0 || rvw == 0.0);
247  //const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
248  //const auto rho = 1.0/(xBrine/rhoH2O + (1.0 - xBrine)/rhoCo2);
249  return rhoCo2 / (gasReferenceDensity_[regionIdx] +
250  max(rvw,rv) * brineReferenceDensity_[regionIdx]);
251  }
252 
256  template <class FluidState, class LhsEval = typename FluidState::ValueType>
257  std::pair<LhsEval, LhsEval>
258  inverseFormationVolumeFactorAndViscosity(const FluidState& fluidState, unsigned regionIdx)
259  {
260  const LhsEval& T = decay<LhsEval>(fluidState.temperature(FluidState::gasPhaseIdx));
261  const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
262  const LhsEval& Rv = decay<LhsEval>(fluidState.Rv());
263  const LhsEval& Rvw = decay<LhsEval>(fluidState.Rvw());
264  return { this->inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw),
265  this->viscosity(regionIdx, T, p, Rv, Rvw) };
266  }
267 
271  template <class Evaluation>
272  OPM_HOST_DEVICE Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
273  const Evaluation& temperature,
274  const Evaluation& pressure) const
275  {
276  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
277  const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure,
278  Evaluation(salinity_[regionIdx]));
279  return inverseFormationVolumeFactor(regionIdx, temperature,
280  pressure, Evaluation(0.0), rvw);
281  }
282 
290  template <class Evaluation>
291  OPM_HOST_DEVICE Evaluation saturationPressure(unsigned /*regionIdx*/,
292  const Evaluation& /*temperature*/,
293  const Evaluation& /*Rvw*/) const
294  { return 0.0; /* not implemented */ }
295 
299  template <class Evaluation>
300  OPM_HOST_DEVICE Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx,
301  const Evaluation& temperature,
302  const Evaluation& pressure) const
303  { return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
304 
308  template <class Evaluation = Scalar>
309  OPM_HOST_DEVICE Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx,
310  const Evaluation& temperature,
311  const Evaluation& pressure,
312  const Evaluation& saltConcentration) const
313  {
314  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
315  const Evaluation salinity = salinityFromConcentration(temperature, pressure,
316  saltConcentration);
317  return rvwSat_(regionIdx, temperature, pressure, salinity);
318  }
319 
323  template <class Evaluation>
324  OPM_HOST_DEVICE Evaluation saturatedOilVaporizationFactor(unsigned regionIdx,
325  const Evaluation& temperature,
326  const Evaluation& pressure,
327  const Evaluation& /*oilSaturation*/,
328  const Evaluation& /*maxOilSaturation*/) const
329  { return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
330 
334  template <class Evaluation>
335  OPM_HOST_DEVICE Evaluation saturatedOilVaporizationFactor(unsigned regionIdx,
336  const Evaluation& temperature,
337  const Evaluation& pressure) const
338  { return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
339 
340  template <class Evaluation>
341  OPM_HOST_DEVICE Evaluation diffusionCoefficient(const Evaluation& temperature,
342  const Evaluation& pressure,
343  unsigned /*compIdx*/) const
344  {
345  return BinaryCoeffBrineCO2::gasDiffCoeff(co2Tables, temperature, pressure, extrapolate);
346  }
347 
348  OPM_HOST_DEVICE Scalar gasReferenceDensity(unsigned regionIdx) const
349  {
350  return gasReferenceDensity_[regionIdx];
351  }
352 
353  OPM_HOST_DEVICE Scalar oilReferenceDensity(unsigned regionIdx) const
354  { return brineReferenceDensity_[regionIdx]; }
355 
356  OPM_HOST_DEVICE Scalar waterReferenceDensity(unsigned regionIdx) const
357  { return brineReferenceDensity_[regionIdx]; }
358 
359  OPM_HOST_DEVICE Scalar salinity(unsigned regionIdx) const
360  { return salinity_[regionIdx]; }
361 
362  void setEzrokhiDenCoeff(const std::vector<EzrokhiTable>& denaqa);
363 
364  // new get functions that will be needed to move a cpu based Co2GasPvt object to the GPU
365  OPM_HOST_DEVICE const ContainerT& getBrineReferenceDensity() const
366  { return brineReferenceDensity_; }
367 
368  OPM_HOST_DEVICE const ContainerT& getGasReferenceDensity() const
369  { return gasReferenceDensity_; }
370 
371  OPM_HOST_DEVICE const ContainerT& getSalinity() const
372  { return salinity_; }
373 
374  OPM_HOST_DEVICE bool getEnableEzrokhiDensity() const
375  { return enableEzrokhiDensity_; }
376 
377  OPM_HOST_DEVICE bool getEnableVaporization() const
378  { return enableVaporization_; }
379 
380  OPM_HOST_DEVICE int getActivityModel() const
381  { return activityModel_; }
382 
383  OPM_HOST_DEVICE Co2StoreConfig::GasMixingType getGasType() const
384  { return gastype_; }
385 
386  OPM_HOST_DEVICE const Params& getParams() const
387  { return co2Tables; }
388 
389 private:
390  template <class LhsEval>
391  LhsEval ezrokhiExponent_(const LhsEval& temperature,
392  const ContainerT& ezrokhiCoeff) const
393  {
394  const LhsEval& tempC = temperature - 273.15;
395  return ezrokhiCoeff[0] + tempC * (ezrokhiCoeff[1] + ezrokhiCoeff[2] * tempC);
396  }
397 
398  template <class LhsEval>
399  OPM_HOST_DEVICE LhsEval rvwSat_(unsigned regionIdx,
400  const LhsEval& temperature,
401  const LhsEval& pressure,
402  const LhsEval& salinity) const
403  {
404  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
405  if (!enableVaporization_) {
406  return 0.0;
407  }
408 
409  // calulate the equilibrium composition for the given
410  // temperature and pressure.
411  LhsEval xgH2O;
412  LhsEval xlCO2;
414  temperature,
415  pressure,
416  salinity,
417  /*knownPhaseIdx=*/-1,
418  xlCO2,
419  xgH2O,
420  activityModel_,
421  extrapolate);
422 
423  // normalize the phase compositions
424  xgH2O = max(0.0, min(1.0, xgH2O));
425 
426  return convertXgWToRvw(convertxgWToXgW(xgH2O, salinity), regionIdx);
427  }
428 
433  template <class LhsEval>
434  OPM_HOST_DEVICE LhsEval convertXgWToRvw(const LhsEval& XgW, unsigned regionIdx) const
435  {
436  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
437  Scalar rho_wRef = brineReferenceDensity_[regionIdx];
438  Scalar rho_gRef = gasReferenceDensity_[regionIdx];
439 
440  return XgW / (1.0 - XgW) * (rho_gRef / rho_wRef);
441  }
442 
447  template <class LhsEval>
448  OPM_HOST_DEVICE LhsEval convertRvwToXgW_(const LhsEval& Rvw, unsigned regionIdx) const
449  {
450  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
451  Scalar rho_wRef = brineReferenceDensity_[regionIdx];
452  Scalar rho_gRef = gasReferenceDensity_[regionIdx];
453 
454  const LhsEval& rho_wG = Rvw * rho_wRef;
455  return rho_wG / (rho_gRef + rho_wG);
456  }
460  template <class LhsEval>
461  OPM_HOST_DEVICE LhsEval convertxgWToXgW(const LhsEval& xgW, const LhsEval& salinity) const
462  {
463  OPM_TIMEFUNCTION_LOCAL(Subsystem::PvtProps);
464  Scalar M_CO2 = CO2::molarMass();
465  LhsEval M_Brine = Brine::molarMass(salinity);
466 
467  return xgW * M_Brine / (xgW * (M_Brine - M_CO2) + M_CO2);
468  }
469 
470  #if HAVE_CUDA
471  template <class ScalarT>
472  friend Co2GasPvt<ScalarT, gpuistl::GpuView>
473  gpuistl::make_view(Co2GasPvt<ScalarT, gpuistl::GpuBuffer>&);
474  #endif // HAVE_CUDA
475 
476  template <class LhsEval>
477  OPM_HOST_DEVICE const LhsEval salinityFromConcentration(const LhsEval&T, const LhsEval& P,
478  const LhsEval& saltConcentration) const
479  { return saltConcentration/H2O::liquidDensity(T, P, true); }
480 
481  ContainerT brineReferenceDensity_{};
482  ContainerT gasReferenceDensity_{};
483  ContainerT salinity_{};
484  ContainerT ezrokhiDenNaClCoeff_{};
485  bool enableEzrokhiDensity_ = false;
486  bool enableVaporization_ = true;
487  int activityModel_{};
488  Co2StoreConfig::GasMixingType gastype_{};
489  Params co2Tables;
490 };
491 
492 } // namespace Opm
493 
494 #if HAVE_CUDA
495 namespace Opm::gpuistl {
496  template<class ScalarT>
497  Co2GasPvt<ScalarT, GpuBuffer>
498  copy_to_gpu(const Co2GasPvt<ScalarT>& cpuCo2)
499  {
500  return Co2GasPvt<ScalarT, GpuBuffer>(
501  copy_to_gpu(cpuCo2.getParams()),
502  GpuBuffer<ScalarT>(cpuCo2.getBrineReferenceDensity()),
503  GpuBuffer<ScalarT>(cpuCo2.getGasReferenceDensity()),
504  GpuBuffer<ScalarT>(cpuCo2.getSalinity()),
505  cpuCo2.getEnableEzrokhiDensity(),
506  cpuCo2.getEnableVaporization(),
507  cpuCo2.getActivityModel(),
508  cpuCo2.getGasType());
509  }
510 
511  template <class ScalarT>
512  Co2GasPvt<ScalarT, GpuView>
513  make_view(Co2GasPvt<ScalarT, GpuBuffer>& co2GasPvt)
514  {
515  using ContainedType = ScalarT;
516 
517  auto newBrineReferenceDensity = make_view<ContainedType>(co2GasPvt.brineReferenceDensity_);
518  auto newGasReferenceDensity = make_view<ContainedType>(co2GasPvt.gasReferenceDensity_);
519  auto newSalinity = make_view<ContainedType>(co2GasPvt.salinity_);
520 
521  return Co2GasPvt<ScalarT, GpuView>(
522  make_view(co2GasPvt.co2Tables),
523  newBrineReferenceDensity,
524  newGasReferenceDensity,
525  newSalinity,
526  co2GasPvt.getEnableEzrokhiDensity(),
527  co2GasPvt.getEnableVaporization(),
528  co2GasPvt.getActivityModel(),
529  co2GasPvt.getGasType());
530  }
531 } // namespace Opm::gpuistl
532 #endif // HAVE_CUDA
533 
534 #endif
static OPM_HOST_DEVICE Evaluation gasDiffCoeff(const CO2Params &params, const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Binary diffusion coefficent [m^2/s] of water in the CO2 phase.
Definition: Brine_CO2.hpp:65
Material properties of pure water .
Definition: H2O.hpp:64
static OPM_HOST_DEVICE Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition: CO2.hpp:73
static OPM_HOST_DEVICE Evaluation gasViscosity(const Params &params, Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition: CO2.hpp:249
OPM_HOST_DEVICE Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: Co2GasPvt.hpp:324
A class for the brine fluid properties.
Definition: BrineDynamic.hpp:48
A class for the CO2 fluid properties.
OPM_HOST_DEVICE void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: Co2GasPvt.cpp:122
static OPM_HOST_DEVICE Evaluation gasDensity(const Params &params, const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of CO2 at a given pressure and temperature [kg/m^3].
Definition: CO2.hpp:222
OPM_HOST_DEVICE void setThermalMixingModel(int thermalMixingModel)
Set thermal mixing model for co2 in brine.
Definition: Co2GasPvt.cpp:150
OPM_HOST_DEVICE Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition: Co2GasPvt.hpp:300
Definition: Schedule.hpp:100
OPM_HOST_DEVICE Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: Co2GasPvt.hpp:335
OPM_HOST_DEVICE unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: Co2GasPvt.hpp:166
static OPM_HOST_DEVICE Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
The density of pure water at a given pressure and temperature .
Definition: SimpleHuDuanH2O.hpp:316
PiecewiseLinearTwoPhaseMaterialParams< TraitsT, ViewType > make_view(PiecewiseLinearTwoPhaseMaterialParams< TraitsT, ContainerType > &params)
this function is intented to make a GPU friendly view of the PiecewiseLinearTwoPhaseMaterialParams ...
Definition: PiecewiseLinearTwoPhaseMaterialParams.hpp:312
A class for the brine fluid properties.
Definition: Brine.hpp:47
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Convience header to include the gpuistl headers if HAVE_CUDA is defined.
Binary coefficients for brine and CO2.
Definition: Brine_CO2.hpp:48
static OPM_HOST_DEVICE Evaluation gasInternalEnergy(const Params &params, const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition: CO2.hpp:195
OPM_HOST_DEVICE void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase...
Definition: Co2GasPvt.hpp:143
Definition: EclipseState.hpp:66
A class for the CO2 fluid properties.
Definition: CO2.hpp:57
OPM_HOST_DEVICE void setActivityModelSalt(int activityModel)
Set activity coefficient model for salt in solubility model.
Definition: Co2GasPvt.cpp:133
A simple version of pure water with density from Hu et al.
static OPM_HOST_DEVICE Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition: SimpleHuDuanH2O.hpp:228
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
A simple version of pure water with density from Hu et al.
Definition: SimpleHuDuanH2O.hpp:65
A class for the brine fluid properties.
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2...
Definition: Co2GasPvt.hpp:59
OPM_HOST_DEVICE Evaluation internalEnergy(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &rv, const Evaluation &rvw) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition: Co2GasPvt.hpp:176
static OPM_HOST_DEVICE void calculateMoleFractions(const CO2Params &params, const Evaluation &temperature, const Evaluation &pg, const Evaluation &salinity, const int knownPhaseIdx, Evaluation &xlCO2, Evaluation &ygH2O, const int &activityModel, bool extrapolate=false)
Returns the mol (!) fraction of CO2 in the liquid phase and the mol_ (!) fraction of H2O in the gas p...
Definition: Brine_CO2.hpp:113
PiecewiseLinearTwoPhaseMaterialParams< TraitsT, GPUContainerType > copy_to_gpu(const PiecewiseLinearTwoPhaseMaterialParams< TraitsT > &params)
Move a PiecewiseLinearTwoPhaseMaterialParams-object to the GPU.
Definition: PiecewiseLinearTwoPhaseMaterialParams.hpp:285
Definition: PiecewiseLinearTwoPhaseMaterialParams.hpp:47
OPM_HOST_DEVICE Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the brine com...
Definition: Co2GasPvt.hpp:291
Binary coefficients for brine and CO2.
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition: Co2GasPvt.hpp:258
OPM_HOST_DEVICE Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of water saturated gas at given pressure. ...
Definition: Co2GasPvt.hpp:272
OPM_HOST_DEVICE Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &rv, const Evaluation &rvw) const
Returns the formation volume factor [-] of the fluid phase.
Definition: Co2GasPvt.hpp:229
OPM_HOST_DEVICE Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltConcentration) const
Returns the water vaporization factor [m^3/m^3] of water phase.
Definition: Co2GasPvt.hpp:309
static Scalar molarMass()
The molar mass in of the component.
Definition: Component.hpp:93
OPM_HOST_DEVICE Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: Co2GasPvt.hpp:205
OPM_HOST_DEVICE Evaluation saturatedViscosity(unsigned, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of fluid phase at saturated conditions.
Definition: Co2GasPvt.hpp:216
OPM_HOST_DEVICE void initEnd()
Finish initializing the co2 phase PVT properties.
Definition: Co2GasPvt.hpp:159