3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
co2.hh
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program 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 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_CO2_HH
25#define DUMUX_CO2_HH
26
29
30#include <cmath>
31#include <iostream>
32
36
37namespace Dumux {
38namespace Components {
39
51template <class Scalar, class CO2Tables>
52class CO2
53: public Components::Base<Scalar, CO2<Scalar, CO2Tables> >
54, public Components::Liquid<Scalar, CO2<Scalar, CO2Tables> >
55, public Components::Gas<Scalar, CO2<Scalar, CO2Tables> >
56{
57 static const Scalar R;
58
59 static bool warningThrown;
60
61public:
65 static std::string name()
66 { return "CO2"; }
67
71 static constexpr Scalar molarMass()
72 { return 44e-3; /* [kg/mol] */ }
73
78 { return 273.15 + 30.95; /* [K] */ }
79
84 { return 73.8e5; /* [Pa] */ }
85
90 { return 273.15 - 56.35; /* [K] */ }
91
96 { return 5.11e5; /* [N/m^2] */ }
97
102 { return CO2Tables::tabulatedEnthalpy.minPress(); /* [Pa] */ }
103
108 { return CO2Tables::tabulatedEnthalpy.maxPress(); /* [Pa] */ }
109
114 { return CO2Tables::tabulatedEnthalpy.minTemp(); /* [K] */ }
115
120 { return CO2Tables::tabulatedEnthalpy.maxTemp(); /* [K] */ }
121
125 static constexpr bool gasIsIdeal()
126 { return false; }
127
137 {
138 static const Scalar a[4] =
139 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
140 static const Scalar t[4] =
141 { 1.0, 1.5, 2.0, 4.0 };
142
143 // this is on page 1524 of the reference
144 Scalar exponent = 0;
145 Scalar Tred = T/criticalTemperature();
146
147 using std::pow;
148 for (int i = 0; i < 4; ++i)
149 exponent += a[i]*pow(1 - Tred, t[i]);
150 exponent *= 1.0/Tred;
151
152 using std::exp;
153 return exp(exponent)*criticalPressure();
154 }
155
163 {
164 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
165 {
166 Dune::dwarn << "Subcritical values: Be aware to use "
167 <<"Tables with sufficient resolution!"<< std::endl;
168 warningThrown=true;
169 }
170 return
171 CO2Tables::tabulatedEnthalpy.at(temperature, pressure);
172 }
173
181 {
182 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
183 {
184 Dune::dwarn << "Subcritical values: Be aware to use "
185 <<"Tables with sufficient resolution!"<< std::endl;
186 warningThrown=true;
187 }
188
190 }
191
199 {
202
203 return h - (pressure / rho);
204 }
205
213 {
216
217 return h - (pressure / rho);
218 }
219
226 {
227 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
228 {
229 Dune::dwarn << "Subcritical values: Be aware to use "
230 <<"Tables with sufficient resolution!"<< std::endl;
231 warningThrown=true;
232 }
233 return CO2Tables::tabulatedDensity.at(temperature, pressure);
234 }
235
245
252 {
253 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
254 {
255 Dune::dwarn << "Subcritical values: Be aware to use "
256 <<"Tables with sufficient resolution!"<< std::endl;
257 warningThrown=true;
258 }
259 return CO2Tables::tabulatedDensity.at(temperature, pressure);
260 }
261
271
279 {
280 DUNE_THROW(NumericalProblem, "CO2::gasPressure()");
281 }
282
291 {
292 DUNE_THROW(NumericalProblem, "CO2::liquidPressure()");
293 }
294
304 {
305 //temperature difference :
306 Scalar dT = 1.; // 1K temperature increment
307 Scalar temperature2 = temperature+dT;
308
309 // enthalpy difference
311 Scalar hnew = liquidEnthalpy(temperature2, pressure);
312 Scalar dh = hold-hnew;
313
314 //specific heat capacity
315 return dh/dT ;
316 }
317
318
327 {
328 static const double a0 = 0.235156;
329 static const double a1 = -0.491266;
330 static const double a2 = 5.211155E-2;
331 static const double a3 = 5.347906E-2;
332 static const double a4 = -1.537102E-2;
333
334 static const double d11 = 0.4071119E-2;
335 static const double d21 = 0.7198037E-4;
336 static const double d64 = 0.2411697E-16;
337 static const double d81 = 0.2971072E-22;
338 static const double d82 = -0.1627888E-22;
339
340 static const double ESP = 251.196;
341
342 double mu0, SigmaStar, TStar;
343 double dmu, rho;
344 double visco_CO2;
345
346 if(temperature < 275.) // regularisation
347 {
348 temperature = 275;
349 Dune::dgrave << "Temperature below 275K in viscosity function:"
350 << "Regularizing tempereature to 275K. " << std::endl;
351 }
352
353
354 TStar = temperature/ESP;
355
356 /* mu0: viscosity in zero-density limit */
357 using std::exp;
358 using std::log;
359 using std::sqrt;
360 SigmaStar = exp(a0 + a1*log(TStar)
361 + a2*log(TStar)*log(TStar)
362 + a3*log(TStar)*log(TStar)*log(TStar)
363 + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) );
364 mu0 = 1.00697*sqrt(temperature) / SigmaStar;
365
366 /* dmu : excess viscosity at elevated density */
367 rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */
368
369 using std::pow;
370 dmu = d11*rho + d21*rho*rho + d64*pow(rho,6)/(TStar*TStar*TStar)
371 + d81*pow(rho,8) + d82*pow(rho,8)/TStar;
372
373 visco_CO2 = (mu0 + dmu)/1.0E6; /* conversion to [Pa s] */
374
375 return visco_CO2;
376 }
377
384 {
385 // no difference for supercritical CO2
387 }
388
399 {
400 return 0.087;
401 }
402};
403
404template <class Scalar, class CO2Tables>
405const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;
406
407template <class Scalar, class CO2Tables>
408bool CO2<Scalar, CO2Tables>::warningThrown = false;
409
410} // end namespace Components
411
412} // end namespace Dumux
413
414#endif
Some exceptions thrown in DuMux
Interface for components that have a gas state.
Interface for components that have a liquid state.
A central place for various physical constants occuring in some equations.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:39
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:59
Scalar Scalar
export the scalar type used by the component
Definition: components/base.hh:63
A class for the CO2 fluid properties.
Definition: co2.hh:56
static Scalar maxTabulatedTemperature()
Returns the maximal tabulated temperature of the used table.
Definition: co2.hh:119
static Scalar minTabulatedPressure()
Returns the minimal tabulated pressure of the used table.
Definition: co2.hh:101
static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of CO2 .
Definition: co2.hh:197
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of CO2.
Definition: co2.hh:398
static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid CO2 .
Definition: co2.hh:179
static Scalar vaporPressure(Scalar T)
The vapor pressure in of pure CO2 at a given temperature.
Definition: co2.hh:136
static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid CO2 .
Definition: co2.hh:211
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:71
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: co2.hh:278
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 gas in at a given pressure and temperature.
Definition: co2.hh:243
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:225
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: co2.hh:125
static Scalar minTabulatedTemperature()
Returns the minimal tabulated temperature of the used table.
Definition: co2.hh:113
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure CO2 at a given pressure and temperature .
Definition: co2.hh:251
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:77
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: co2.hh:290
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure CO2.
Definition: co2.hh:383
static std::string name()
A human readable name for the CO2.
Definition: co2.hh:65
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:326
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:83
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 in at a given pressure and temperature.
Definition: co2.hh:269
static Scalar tripleTemperature()
Returns the temperature at CO2's triple point.
Definition: co2.hh:89
static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the component as a liquid. USE WITH CAUTION! Exploits enthalpy fu...
Definition: co2.hh:303
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous CO2 .
Definition: co2.hh:161
static Scalar maxTabulatedPressure()
Returns the maximal tabulated pressure of the used table.
Definition: co2.hh:107
static Scalar triplePressure()
Returns the pressure at CO2's triple point.
Definition: co2.hh:95
Interface for components that have a gas state.
Definition: gas.hh:41
Interface for components that have a liquid state.
Definition: liquid.hh:41
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39
Base class for all components Components provide the thermodynamic relations for the liquid,...