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 
37 #include <opm/material/components/co2tables.inc>
38 
39 #if HAVE_ECL_INPUT
40 #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
41 #include <opm/input/eclipse/Schedule/Schedule.hpp>
42 #include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
43 #endif
44 
45 #include <vector>
46 
47 namespace Opm {
52 template <class Scalar>
53 class Co2GasPvt
54 {
55  typedef std::vector<std::pair<Scalar, Scalar> > SamplingPoints;
56  typedef ::Opm::CO2<Scalar, CO2Tables> CO2;
58  static const bool extrapolate = true;
59 
60 public:
62 
65 
66  explicit Co2GasPvt() = default;
67  Co2GasPvt(const std::vector<Scalar>& gasReferenceDensity)
68  : gasReferenceDensity_(gasReferenceDensity)
69  {
70  }
71 
72  Co2GasPvt(size_t numRegions,
73  Scalar T_ref = 288.71, //(273.15 + 15.56)
74  Scalar P_ref = 101325)
75  {
76  setNumRegions(numRegions);
77  for (size_t i = 0; i < numRegions; ++i) {
78  gasReferenceDensity_[i] = CO2::gasDensity(T_ref, P_ref, true);
79  }
80  }
81 #if HAVE_ECL_INPUT
85  void initFromState(const EclipseState& eclState, const Schedule&)
86  {
87  if( !eclState.getTableManager().getDensityTable().empty()) {
88  std::cerr << "WARNING: CO2STOR is enabled but DENSITY is in the deck. \n" <<
89  "The surface density is computed based on CO2-BRINE PVT at standard conditions (STCOND) and DENSITY is ignored " << std::endl;
90  }
91 
92  if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
93  std::cerr << "WARNING: CO2STOR is enabled but PVDG or PVTG is in the deck. \n" <<
94  "CO2 PVT properties are computed based on the Span-Wagner pvt model and PVDG/PVTG input is ignored. " << std::endl;
95  }
96 
97  // We only supported single pvt region for the co2-brine module
98  size_t numRegions = 1;
99  setNumRegions(numRegions);
100  size_t regionIdx = 0;
101  Scalar T_ref = eclState.getTableManager().stCond().temperature;
102  Scalar P_ref = eclState.getTableManager().stCond().pressure;
103  gasReferenceDensity_[regionIdx] = CO2::gasDensity(T_ref, P_ref, extrapolate);
104  initEnd();
105  }
106 #endif
107 
108  void setNumRegions(size_t numRegions)
109  {
110  gasReferenceDensity_.resize(numRegions);
111  }
112 
113 
117  void setReferenceDensities(unsigned regionIdx,
118  Scalar /*rhoRefOil*/,
119  Scalar rhoRefGas,
120  Scalar /*rhoRefWater*/)
121  {
122  gasReferenceDensity_[regionIdx] = rhoRefGas;
123  }
124 
128  void initEnd()
129  {
130 
131  }
132 
136  unsigned numRegions() const
137  { return gasReferenceDensity_.size(); }
138 
142  template <class Evaluation>
143  Evaluation internalEnergy(unsigned,
144  const Evaluation& temperature,
145  const Evaluation& pressure,
146  const Evaluation&) const
147  {
148  return CO2::gasInternalEnergy(temperature, pressure, extrapolate);
149  }
150 
154  template <class Evaluation>
155  Evaluation viscosity(unsigned regionIdx,
156  const Evaluation& temperature,
157  const Evaluation& pressure,
158  const Evaluation& /*Rv*/) const
159  { return saturatedViscosity(regionIdx, temperature, pressure); }
160 
164  template <class Evaluation>
165  Evaluation saturatedViscosity(unsigned /*regionIdx*/,
166  const Evaluation& temperature,
167  const Evaluation& pressure) const
168  {
169  return CO2::gasViscosity(temperature, pressure, extrapolate);
170  }
171 
175  template <class Evaluation>
176  Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
177  const Evaluation& temperature,
178  const Evaluation& pressure,
179  const Evaluation& /*Rv*/) const
180  { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
181 
185  template <class Evaluation>
186  Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
187  const Evaluation& temperature,
188  const Evaluation& pressure) const
189  {
190  return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
191  }
192 
199  template <class Evaluation>
200  Evaluation saturationPressure(unsigned /*regionIdx*/,
201  const Evaluation& /*temperature*/,
202  const Evaluation& /*Rv*/) const
203  { return 0.0; /* this is dry gas! */ }
204 
208  template <class Evaluation>
209  Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
210  const Evaluation& /*temperature*/,
211  const Evaluation& /*pressure*/) const
212  { return 0.0; /* this is non-humid gas! */ }
213 
217  template <class Evaluation>
218  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
219  const Evaluation& /*temperature*/,
220  const Evaluation& /*pressure*/,
221  const Evaluation& /*oilSaturation*/,
222  const Evaluation& /*maxOilSaturation*/) const
223  { return 0.0; /* this is dry gas! */ }
224 
228  template <class Evaluation>
229  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
230  const Evaluation& /*temperature*/,
231  const Evaluation& /*pressure*/) const
232  { return 0.0; /* this is dry gas! */ }
233 
234  template <class Evaluation>
235  Evaluation diffusionCoefficient(const Evaluation& temperature,
236  const Evaluation& pressure,
237  unsigned /*compIdx*/) const
238  {
239  return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure);
240  }
241 
242  const Scalar gasReferenceDensity(unsigned regionIdx) const
243  { return gasReferenceDensity_[regionIdx]; }
244 
245  bool operator==(const Co2GasPvt<Scalar>& data) const
246  {
247  return gasReferenceDensity_ == data.gasReferenceDensity_;
248  }
249 
250 private:
251  std::vector<Scalar> gasReferenceDensity_;
252 };
253 
254 } // namespace Opm
255 
256 #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 linearly interpolated scalar function that depends on one variable.
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:41
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:55
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:54
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:186
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition: Co2GasPvt.hpp:155
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:165
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: Co2GasPvt.hpp:117
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: Co2GasPvt.hpp:128
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:200
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:143
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition: Co2GasPvt.hpp:176
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: Co2GasPvt.hpp:136
Evaluation saturatedWaterVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition: Co2GasPvt.hpp:209
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:218
BinaryCoeff::Brine_CO2< Scalar, H2O, CO2 > BinaryCoeffBrineCO2
The binary coefficients for brine and CO2 used by this fluid system.
Definition: Co2GasPvt.hpp:64
Evaluation saturatedOilVaporizationFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition: Co2GasPvt.hpp:229
A simple version of pure water with density from Hu et al.
Definition: SimpleHuDuanH2O.hpp:70
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:47