3.3.0
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
27#include <cmath>
28#include <iostream>
29
30#include <dune/common/math.hh>
31
37
38namespace Dumux {
39namespace Components {
40
52template <class Scalar, class CO2Tables>
53class CO2
54: public Components::Base<Scalar, CO2<Scalar, CO2Tables> >
55, public Components::Liquid<Scalar, CO2<Scalar, CO2Tables> >
56, public Components::Gas<Scalar, CO2<Scalar, CO2Tables> >
57{
58 static const Scalar R;
59
60 static bool warningThrown;
61
62public:
66 static std::string name()
67 { return "CO2"; }
68
72 static constexpr Scalar molarMass()
73 { return 44e-3; /* [kg/mol] */ }
74
79 { return 273.15 + 30.95; /* [K] */ }
80
85 { return 73.8e5; /* [Pa] */ }
86
91 { return 273.15 - 56.35; /* [K] */ }
92
97 { return 5.11e5; /* [N/m^2] */ }
98
103 { return CO2Tables::tabulatedEnthalpy.minPress(); /* [Pa] */ }
104
109 { return CO2Tables::tabulatedEnthalpy.maxPress(); /* [Pa] */ }
110
115 { return CO2Tables::tabulatedEnthalpy.minTemp(); /* [K] */ }
116
121 { return CO2Tables::tabulatedEnthalpy.maxTemp(); /* [K] */ }
122
126 static constexpr bool gasIsIdeal()
127 { return false; }
128
138 {
139 static const Scalar a[4] =
140 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
141 static const Scalar t[4] =
142 { 1.0, 1.5, 2.0, 4.0 };
143
144 // this is on page 1524 of the reference
145 Scalar exponent = 0;
146 Scalar Tred = T/criticalTemperature();
147
148 using std::pow;
149 for (int i = 0; i < 4; ++i)
150 exponent += a[i]*pow(1 - Tred, t[i]);
151 exponent *= 1.0/Tred;
152
153 using std::exp;
154 return exp(exponent)*criticalPressure();
155 }
156
164 {
165 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
166 {
167 Dune::dwarn << "Subcritical values: Be aware to use "
168 <<"Tables with sufficient resolution!"<< std::endl;
169 warningThrown=true;
170 }
171 return
172 CO2Tables::tabulatedEnthalpy.at(temperature, pressure);
173 }
174
182 {
183 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
184 {
185 Dune::dwarn << "Subcritical values: Be aware to use "
186 <<"Tables with sufficient resolution!"<< std::endl;
187 warningThrown=true;
188 }
189
191 }
192
200 {
203
204 return h - (pressure / rho);
205 }
206
214 {
217
218 return h - (pressure / rho);
219 }
220
227 {
228 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
229 {
230 Dune::dwarn << "Subcritical values: Be aware to use "
231 <<"Tables with sufficient resolution!"<< std::endl;
232 warningThrown=true;
233 }
234 return CO2Tables::tabulatedDensity.at(temperature, pressure);
235 }
236
246
253 {
254 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
255 {
256 Dune::dwarn << "Subcritical values: Be aware to use "
257 <<"Tables with sufficient resolution!"<< std::endl;
258 warningThrown=true;
259 }
260 return CO2Tables::tabulatedDensity.at(temperature, pressure);
261 }
262
272
280 {
281 DUNE_THROW(NumericalProblem, "CO2::gasPressure()");
282 }
283
292 {
293 DUNE_THROW(NumericalProblem, "CO2::liquidPressure()");
294 }
295
305 {
306 //temperature difference :
307 Scalar dT = 1.; // 1K temperature increment
308 Scalar temperature2 = temperature+dT;
309
310 // enthalpy difference
312 Scalar hnew = liquidEnthalpy(temperature2, pressure);
313 Scalar dh = hold-hnew;
314
315 //specific heat capacity
316 return dh/dT ;
317 }
318
319
328 {
329 static const double a0 = 0.235156;
330 static const double a1 = -0.491266;
331 static const double a2 = 5.211155E-2;
332 static const double a3 = 5.347906E-2;
333 static const double a4 = -1.537102E-2;
334
335 static const double d11 = 0.4071119E-2;
336 static const double d21 = 0.7198037E-4;
337 static const double d64 = 0.2411697E-16;
338 static const double d81 = 0.2971072E-22;
339 static const double d82 = -0.1627888E-22;
340
341 static const double ESP = 251.196;
342
343 double mu0, SigmaStar, TStar;
344 double dmu, rho;
345 double visco_CO2;
346
347 if(temperature < 275.) // regularisation
348 {
349 temperature = 275;
350 Dune::dgrave << "Temperature below 275K in viscosity function:"
351 << "Regularizing tempereature to 275K. " << std::endl;
352 }
353
354
355 TStar = temperature/ESP;
356
357 /* mu0: viscosity in zero-density limit */
358 using std::exp;
359 using std::log;
360 using std::sqrt;
361 SigmaStar = exp(a0 + a1*log(TStar)
362 + a2*log(TStar)*log(TStar)
363 + a3*log(TStar)*log(TStar)*log(TStar)
364 + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) );
365 mu0 = 1.00697*sqrt(temperature) / SigmaStar;
366
367 /* dmu : excess viscosity at elevated density */
368 rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */
369
370 using Dune::power;
371 dmu = d11*rho + d21*rho*rho + d64*power(rho,6)/(TStar*TStar*TStar)
372 + d81*power(rho,8) + d82*power(rho,8)/TStar;
373
374 visco_CO2 = (mu0 + dmu)/1.0E6; /* conversion to [Pa s] */
375
376 return visco_CO2;
377 }
378
385 {
386 // no difference for supercritical CO2
388 }
389
400 {
401 return 0.087;
402 }
403};
404
405template <class Scalar, class CO2Tables>
406const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;
407
408template <class Scalar, class CO2Tables>
409bool CO2<Scalar, CO2Tables>::warningThrown = false;
410
411} // end namespace Components
412
413} // end namespace Dumux
414
415#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:57
static Scalar maxTabulatedTemperature()
Returns the maximal tabulated temperature of the used table.
Definition: co2.hh:120
static Scalar minTabulatedPressure()
Returns the minimal tabulated pressure of the used table.
Definition: co2.hh:102
static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of CO2 .
Definition: co2.hh:198
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of CO2.
Definition: co2.hh:399
static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid CO2 .
Definition: co2.hh:180
static Scalar vaporPressure(Scalar T)
The vapor pressure in of pure CO2 at a given temperature.
Definition: co2.hh:137
static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid CO2 .
Definition: co2.hh:212
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:72
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: co2.hh:279
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 gas in at a given pressure and temperature.
Definition: co2.hh:244
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:226
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: co2.hh:126
static Scalar minTabulatedTemperature()
Returns the minimal tabulated temperature of the used table.
Definition: co2.hh:114
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure CO2 at a given pressure and temperature .
Definition: co2.hh:252
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:78
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: co2.hh:291
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure CO2.
Definition: co2.hh:384
static std::string name()
A human readable name for the CO2.
Definition: co2.hh:66
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:327
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:84
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 in at a given pressure and temperature.
Definition: co2.hh:270
static Scalar tripleTemperature()
Returns the temperature at CO2's triple point.
Definition: co2.hh:90
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:304
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous CO2 .
Definition: co2.hh:162
static Scalar maxTabulatedPressure()
Returns the maximal tabulated pressure of the used table.
Definition: co2.hh:108
static Scalar triplePressure()
Returns the pressure at CO2's triple point.
Definition: co2.hh:96
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,...