My Project
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 
31 
36 #include <opm/material/components/co2tables.inc>
37 
38 #if HAVE_ECL_INPUT
39 #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
40 #include <opm/input/eclipse/Schedule/Schedule.hpp>
41 #include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
42 #endif
43 
44 #include <vector>
45 
46 namespace Opm {
51 template <class Scalar>
52 class Co2GasPvt
53 {
56  static constexpr bool extrapolate = true;
57 
58 public:
61 
62  explicit Co2GasPvt() = default;
63  Co2GasPvt(const std::vector<Scalar>& gasReferenceDensity)
64  : gasReferenceDensity_(gasReferenceDensity)
65  {
66  }
67 
68  Co2GasPvt(size_t numRegions,
69  Scalar T_ref = 288.71, //(273.15 + 15.56)
70  Scalar P_ref = 101325)
71  {
72  setNumRegions(numRegions);
73  for (size_t i = 0; i < numRegions; ++i) {
74  gasReferenceDensity_[i] = CO2::gasDensity(T_ref, P_ref, extrapolate);
75  }
76  }
77 #if HAVE_ECL_INPUT
81  void initFromState(const EclipseState& eclState, const Schedule&)
82  {
83  if( !eclState.getTableManager().getDensityTable().empty()) {
84  std::cerr << "WARNING: CO2STOR is enabled but DENSITY is in the deck. \n" <<
85  "The surface density is computed based on CO2-BRINE PVT at standard conditions (STCOND) and DENSITY is ignored " << std::endl;
86  }
87 
88  if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
89  std::cerr << "WARNING: CO2STOR is enabled but PVDG or PVTG is in the deck. \n" <<
90  "CO2 PVT properties are computed based on the Span-Wagner pvt model and PVDG/PVTG input is ignored. " << std::endl;
91  }
92 
93  // We only supported single pvt region for the co2-brine module
94  size_t numRegions = 1;
95  setNumRegions(numRegions);
96  size_t regionIdx = 0;
97  Scalar T_ref = eclState.getTableManager().stCond().temperature;
98  Scalar P_ref = eclState.getTableManager().stCond().pressure;
99  gasReferenceDensity_[regionIdx] = CO2::gasDensity(T_ref, P_ref, extrapolate);
100  initEnd();
101  }
102 #endif
103 
104  void setNumRegions(size_t numRegions)
105  {
106  gasReferenceDensity_.resize(numRegions);
107  }
108 
109 
113  void setReferenceDensities(unsigned regionIdx,
114  Scalar /*rhoRefOil*/,
115  Scalar rhoRefGas,
116  Scalar /*rhoRefWater*/)
117  {
118  gasReferenceDensity_[regionIdx] = rhoRefGas;
119  }
120 
124  void initEnd()
125  {
126 
127  }
128 
132  unsigned numRegions() const
133  { return gasReferenceDensity_.size(); }
134 
138  template <class Evaluation>
139  Evaluation internalEnergy(unsigned,
140  const Evaluation& temperature,
141  const Evaluation& pressure,
142  const Evaluation&) const
143  {
144  return CO2::gasInternalEnergy(temperature, pressure, extrapolate);
145  }
146 
150  template <class Evaluation>
151  Evaluation viscosity(unsigned regionIdx,
152  const Evaluation& temperature,
153  const Evaluation& pressure,
154  const Evaluation& /*Rv*/,
155  const Evaluation& /*Rvw*/) const
156  { return saturatedViscosity(regionIdx, temperature, pressure); }
157 
161  template <class Evaluation>
162  Evaluation saturatedViscosity(unsigned /*regionIdx*/,
163  const Evaluation& temperature,
164  const Evaluation& pressure) const
165  {
166  return CO2::gasViscosity(temperature, pressure, extrapolate);
167  }
168 
172  template <class Evaluation>
173  Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
174  const Evaluation& temperature,
175  const Evaluation& pressure,
176  const Evaluation& /*Rv*/,
177  const Evaluation& /*Rvw*/) const
178  { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
179 
183  template <class Evaluation>
184  Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
185  const Evaluation& temperature,
186  const Evaluation& pressure) const
187  {
188  return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
189  }
190 
197  template <class Evaluation>
198  Evaluation saturationPressure(unsigned /*regionIdx*/,
199  const Evaluation& /*temperature*/,
200  const Evaluation& /*Rv*/) const
201  { return 0.0; /* this is dry gas! */ }
202 
206  template <class Evaluation>
207  Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
208  const Evaluation& /*temperature*/,
209  const Evaluation& /*pressure*/) const
210  { return 0.0; /* this is non-humid gas! */ }
211 
215  template <class Evaluation>
216  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
217  const Evaluation& /*temperature*/,
218  const Evaluation& /*pressure*/,
219  const Evaluation& /*oilSaturation*/,
220  const Evaluation& /*maxOilSaturation*/) const
221  { return 0.0; /* this is dry gas! */ }
222 
226  template <class Evaluation>
227  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
228  const Evaluation& /*temperature*/,
229  const Evaluation& /*pressure*/) const
230  { return 0.0; /* this is dry gas! */ }
231 
232  template <class Evaluation>
233  Evaluation diffusionCoefficient(const Evaluation& temperature,
234  const Evaluation& pressure,
235  unsigned /*compIdx*/) const
236  {
237  return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure, extrapolate);
238  }
239 
240  const Scalar gasReferenceDensity(unsigned regionIdx) const
241  { return gasReferenceDensity_[regionIdx]; }
242 
243  bool operator==(const Co2GasPvt<Scalar>& data) const
244  {
245  return gasReferenceDensity_ == data.gasReferenceDensity_;
246  }
247 
248 private:
249  std::vector<Scalar> gasReferenceDensity_;
250 };
251 
252 } // namespace Opm
253 
254 #endif
Binary coefficients for brine and CO2.
A class for the CO2 fluid properties.
A central place for various physical constants occuring in some equations.
A simple version of pure water with density from Hu et al.
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Binary coefficients for brine and CO2.
Definition: Brine_CO2.hpp:42
static Evaluation gasDiffCoeff(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:56
A class for the CO2 fluid properties.
Definition: CO2.hpp:53
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition: CO2.hpp:203
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition: CO2.hpp:175
static Evaluation gasDensity(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:189
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
Definition: Co2GasPvt.hpp:53
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil saturated gas at given pressure.
Definition: Co2GasPvt.hpp:184
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition: Co2GasPvt.hpp:173
Evaluation saturatedViscosity(unsigned, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of oil saturated gas at given pressure.
Definition: Co2GasPvt.hpp:162
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: Co2GasPvt.hpp:113
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: Co2GasPvt.hpp:124
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition: Co2GasPvt.hpp:198
Evaluation internalEnergy(unsigned, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition: Co2GasPvt.hpp:139
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: Co2GasPvt.hpp:132
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition: Co2GasPvt.hpp:207
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:151
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: Co2GasPvt.hpp:216
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: Co2GasPvt.hpp:227
A simple version of pure water with density from Hu et al.
Definition: SimpleHuDuanH2O.hpp:70