My Project
CO2.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*/
28#ifndef OPM_CO2_HPP
29#define OPM_CO2_HPP
30
36
37#include <cmath>
38
39namespace Opm {
40
51template <class Scalar>
52class CO2 : public Component<Scalar, CO2<Scalar>>
53{
54 static constexpr Scalar R = Constants<Scalar>::R;
55 static const UniformTabulated2DFunction<double>& tabulatedEnthalpy;
56 static const UniformTabulated2DFunction<double>& tabulatedDensity;
57
58public:
59 static const Scalar brineSalinity;
60
64 static const char* name()
65 { return "CO2"; }
66
70 static Scalar molarMass()
71 { return 44e-3; }
72
76 static Scalar criticalTemperature()
77 { return 273.15 + 30.95; /* [K] */ }
78
82 static Scalar criticalPressure()
83 { return 73.8e5; /* [N/m^2] */ }
84
88 static Scalar tripleTemperature()
89 { return 273.15 - 56.35; /* [K] */ }
90
94 static Scalar triplePressure()
95 { return 5.11e5; /* [N/m^2] */ }
96
100// static Scalar minTabulatedPressure()
101// { return tabulatedEnthalpy.minPress(); /* [N/m^2] */ }
102
106// static Scalar maxTabulatedPressure()
107// { return tabulatedEnthalpy.maxPress(); /* [N/m^2] */ }
108
112// static Scalar minTabulatedTemperature()
113// { return tabulatedEnthalpy.minTemp(); /* [N/m^2] */ }
114
118// static Scalar maxTabulatedTemperature()
119// { return tabulatedEnthalpy.maxTemp(); /* [N/m^2] */ }
120
133 template <class Evaluation>
134 static Evaluation vaporPressure(const Evaluation& T)
135 {
136 static constexpr Scalar a[4] =
137 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
138 static constexpr Scalar t[4] =
139 { 1.0, 1.5, 2.0, 4.0 };
140
141 // this is on page 1524 of the reference
142 Evaluation exponent = 0;
143 Evaluation Tred = T/criticalTemperature();
144 for (int i = 0; i < 4; ++i)
145 exponent += a[i]*pow(1 - Tred, t[i]);
146 exponent *= 1.0/Tred;
147
148 return exp(exponent)*criticalPressure();
149 }
150
151
155 static bool gasIsCompressible()
156 { return true; }
157
161 static bool gasIsIdeal()
162 { return false; }
163
167 template <class Evaluation>
168 static Evaluation gasEnthalpy(const Evaluation& temperature,
169 const Evaluation& pressure,
170 bool extrapolate = false)
171 {
172 return tabulatedEnthalpy.eval(temperature, pressure, extrapolate);
173 }
174
178 template <class Evaluation>
179 static Evaluation gasInternalEnergy(const Evaluation& temperature,
180 const Evaluation& pressure,
181 bool extrapolate = false)
182 {
183 const Evaluation h = gasEnthalpy(temperature, pressure, extrapolate);
184 const Evaluation rho = gasDensity(temperature, pressure, extrapolate);
185
186 return h - (pressure / rho);
187 }
188
192 template <class Evaluation>
193 static Evaluation gasDensity(const Evaluation& temperature,
194 const Evaluation& pressure,
195 bool extrapolate = false)
196 {
197 return tabulatedDensity.eval(temperature, pressure, extrapolate);
198 }
199
206 template <class Evaluation>
207 static Evaluation gasViscosity(Evaluation temperature,
208 const Evaluation& pressure,
209 bool extrapolate = false)
210 {
211 constexpr Scalar a0 = 0.235156;
212 constexpr Scalar a1 = -0.491266;
213 constexpr Scalar a2 = 5.211155e-2;
214 constexpr Scalar a3 = 5.347906e-2;
215 constexpr Scalar a4 = -1.537102e-2;
216
217 constexpr Scalar d11 = 0.4071119e-2;
218 constexpr Scalar d21 = 0.7198037e-4;
219 constexpr Scalar d64 = 0.2411697e-16;
220 constexpr Scalar d81 = 0.2971072e-22;
221 constexpr Scalar d82 = -0.1627888e-22;
222
223 constexpr Scalar ESP = 251.196;
224
225 if(temperature < 275.) // regularization
226 temperature = 275.0;
227 Evaluation TStar = temperature/ESP;
228
229 // mu0: viscosity in zero-density limit
230 const Evaluation logTStar = log(TStar);
231 Evaluation SigmaStar = exp(a0 + logTStar*(a1 + logTStar*(a2 + logTStar*(a3 + logTStar*a4))));
232
233 Evaluation mu0 = 1.00697*sqrt(temperature) / SigmaStar;
234
235 const Evaluation rho = gasDensity(temperature, pressure, extrapolate); // CO2 mass density [kg/m^3]
236
237 // dmu : excess viscosity at elevated density
238 Evaluation dmu =
239 d11*rho
240 + d21*rho*rho
241 + d64*pow(rho, 6.0)/(TStar*TStar*TStar)
242 + d81*pow(rho, 8.0)
243 + d82*pow(rho, 8.0)/TStar;
244
245 return (mu0 + dmu)/1.0e6; // conversion to [Pa s]
246 }
247
258 template <class Evaluation>
259 static Evaluation gasHeatCapacity(const Evaluation& temperature, const Evaluation& pressure)
260 {
261 constexpr Scalar eps = 1e-6;
262
263 // use central differences here because one-sided methods do
264 // not come with a performance improvement. (central ones are
265 // more accurate, though...)
266 const Evaluation h1 = gasEnthalpy(temperature - eps, pressure);
267 const Evaluation h2 = gasEnthalpy(temperature + eps, pressure);
268
269 return (h2 - h1) / (2*eps) ;
270 }
271};
272
273} // namespace Opm
274
275#endif
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
A class for the CO2 fluid properties.
Definition: CO2.hpp:53
static Scalar criticalTemperature()
Returns the critical temperature [K] of CO2.
Definition: CO2.hpp:76
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: CO2.hpp:155
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition: CO2.hpp:259
static Scalar criticalPressure()
Returns the critical pressure [Pa] of CO2.
Definition: CO2.hpp:82
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition: CO2.hpp:207
static Evaluation vaporPressure(const Evaluation &T)
Returns the pressure [Pa] at CO2's triple point.
Definition: CO2.hpp:134
static Scalar triplePressure()
Returns the pressure [Pa] at CO2's triple point.
Definition: CO2.hpp:94
static Scalar tripleTemperature()
Returns the temperature [K]at CO2's triple point.
Definition: CO2.hpp:88
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific enthalpy of gaseous CO2 [J/kg].
Definition: CO2.hpp:168
static const char * name()
A human readable name for the CO2.
Definition: CO2.hpp:64
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: CO2.hpp:161
static Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition: CO2.hpp:70
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition: CO2.hpp:179
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:193
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:41
Evaluation eval(const Evaluation &x, const Evaluation &y, bool extrapolate) const
Evaluate the function at a given (x,y) position.
Definition: UniformTabulated2DFunction.hpp:195
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30