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/parser/eclipse/EclipseState/EclipseState.hpp>
41 #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
42 #include <opm/parser/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 #if HAVE_ECL_INPUT
75  void initFromState(const EclipseState& eclState, const Schedule&)
76  {
77  if( !eclState.getTableManager().getDensityTable().empty()) {
78  std::cerr << "WARNING: CO2STOR is enabled but DENSITY is in the deck. \n" <<
79  "The surface density is computed based on CO2-BRINE PVT at standard conditions (STCOND) and DENSITY is ignored " << std::endl;
80  }
81 
82  if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
83  std::cerr << "WARNING: CO2STOR is enabled but PVDG or PVTG is in the deck. \n" <<
84  "CO2 PVT properties are computed based on the Span-Wagner pvt model and PVDG/PVTG input is ignored. " << std::endl;
85  }
86 
87  // We only supported single pvt region for the co2-brine module
88  size_t numRegions = 1;
89  setNumRegions(numRegions);
90  size_t regionIdx = 0;
91  Scalar T_ref = eclState.getTableManager().stCond().temperature;
92  Scalar P_ref = eclState.getTableManager().stCond().pressure;
93  gasReferenceDensity_[regionIdx] = CO2::gasDensity(T_ref, P_ref, extrapolate);
94  initEnd();
95  }
96 #endif
97 
98  void setNumRegions(size_t numRegions)
99  {
100  gasReferenceDensity_.resize(numRegions);
101  }
102 
103 
107  void setReferenceDensities(unsigned regionIdx,
108  Scalar /*rhoRefOil*/,
109  Scalar rhoRefGas,
110  Scalar /*rhoRefWater*/)
111  {
112  gasReferenceDensity_[regionIdx] = rhoRefGas;
113  }
114 
118  void initEnd()
119  {
120 
121  }
122 
126  unsigned numRegions() const
127  { return gasReferenceDensity_.size(); }
128 
132  template <class Evaluation>
133  Evaluation internalEnergy(unsigned,
134  const Evaluation& temperature,
135  const Evaluation& pressure,
136  const Evaluation&) const
137  {
138  return CO2::gasInternalEnergy(temperature, pressure, extrapolate);
139  }
140 
144  template <class Evaluation>
145  Evaluation viscosity(unsigned regionIdx,
146  const Evaluation& temperature,
147  const Evaluation& pressure,
148  const Evaluation& /*Rv*/) const
149  { return saturatedViscosity(regionIdx, temperature, pressure); }
150 
154  template <class Evaluation>
155  Evaluation saturatedViscosity(unsigned /*regionIdx*/,
156  const Evaluation& temperature,
157  const Evaluation& pressure) const
158  {
159  return CO2::gasViscosity(temperature, pressure, extrapolate);
160  }
161 
165  template <class Evaluation>
166  Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
167  const Evaluation& temperature,
168  const Evaluation& pressure,
169  const Evaluation& /*Rv*/) const
170  { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
171 
175  template <class Evaluation>
176  Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
177  const Evaluation& temperature,
178  const Evaluation& pressure) const
179  {
180  return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
181  }
182 
189  template <class Evaluation>
190  Evaluation saturationPressure(unsigned /*regionIdx*/,
191  const Evaluation& /*temperature*/,
192  const Evaluation& /*Rv*/) const
193  { return 0.0; /* this is dry gas! */ }
194 
198  template <class Evaluation>
199  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
200  const Evaluation& /*temperature*/,
201  const Evaluation& /*pressure*/,
202  const Evaluation& /*oilSaturation*/,
203  const Evaluation& /*maxOilSaturation*/) const
204  { return 0.0; /* this is dry gas! */ }
205 
209  template <class Evaluation>
210  Evaluation saturatedOilVaporizationFactor(unsigned /*regionIdx*/,
211  const Evaluation& /*temperature*/,
212  const Evaluation& /*pressure*/) const
213  { return 0.0; /* this is dry gas! */ }
214 
215  template <class Evaluation>
216  Evaluation diffusionCoefficient(const Evaluation& temperature,
217  const Evaluation& pressure,
218  unsigned /*compIdx*/) const
219  {
220  return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure);
221  }
222 
223  const Scalar gasReferenceDensity(unsigned regionIdx) const
224  { return gasReferenceDensity_[regionIdx]; }
225 
226  bool operator==(const Co2GasPvt<Scalar>& data) const
227  {
228  return gasReferenceDensity_ == data.gasReferenceDensity_;
229  }
230 
231 private:
232  std::vector<Scalar> gasReferenceDensity_;
233 };
234 
235 } // namespace Opm
236 
237 #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)
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:176
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:145
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:155
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: Co2GasPvt.hpp:107
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: Co2GasPvt.hpp:118
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:190
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:133
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:166
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: Co2GasPvt.hpp:126
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:199
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:210
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