version 3.7
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_CO2_HH
13#define DUMUX_CO2_HH
14
15#include <cmath>
16#include <iostream>
17
18#include <dune/common/math.hh>
19
25
26namespace Dumux {
27namespace Components {
28
40template <class Scalar, class CO2Tables>
41class CO2
42: public Components::Base<Scalar, CO2<Scalar, CO2Tables> >
43, public Components::Liquid<Scalar, CO2<Scalar, CO2Tables> >
44, public Components::Gas<Scalar, CO2<Scalar, CO2Tables> >
45{
46 static const Scalar R;
47
48 static bool warningThrown;
49
50public:
54 static std::string name()
55 { return "CO2"; }
56
60 static constexpr Scalar molarMass()
61 { return 44e-3; /* [kg/mol] */ }
62
67 { return 273.15 + 30.95; /* [K] */ }
68
73 { return 73.8e5; /* [Pa] */ }
74
79 { return 273.15 - 56.35; /* [K] */ }
80
85 { return 5.11e5; /* [N/m^2] */ }
86
91 { return CO2Tables::tabulatedEnthalpy.minPress(); /* [Pa] */ }
92
97 { return CO2Tables::tabulatedEnthalpy.maxPress(); /* [Pa] */ }
98
103 { return CO2Tables::tabulatedEnthalpy.minTemp(); /* [K] */ }
104
109 { return CO2Tables::tabulatedEnthalpy.maxTemp(); /* [K] */ }
110
114 static constexpr bool gasIsIdeal()
115 { return false; }
116
126 {
127 static const Scalar a[4] =
128 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
129 static const Scalar t[4] =
130 { 1.0, 1.5, 2.0, 4.0 };
131
132 // this is on page 1524 of the reference
133 Scalar exponent = 0;
134 Scalar Tred = T/criticalTemperature();
135
136 using std::pow;
137 for (int i = 0; i < 4; ++i)
138 exponent += a[i]*pow(1 - Tred, t[i]);
139 exponent *= 1.0/Tred;
140
141 using std::exp;
142 return exp(exponent)*criticalPressure();
143 }
144
152 {
153 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
154 {
155 Dune::dwarn << "Subcritical values: Be aware to use "
156 <<"Tables with sufficient resolution!"<< std::endl;
157 warningThrown=true;
158 }
159 return
160 CO2Tables::tabulatedEnthalpy.at(temperature, pressure);
161 }
162
170 {
171 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
172 {
173 Dune::dwarn << "Subcritical values: Be aware to use "
174 <<"Tables with sufficient resolution!"<< std::endl;
175 warningThrown=true;
176 }
177
179 }
180
188 {
191
192 return h - (pressure / rho);
193 }
194
202 {
205
206 return h - (pressure / rho);
207 }
208
215 {
216 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
217 {
218 Dune::dwarn << "Subcritical values: Be aware to use "
219 <<"Tables with sufficient resolution!"<< std::endl;
220 warningThrown=true;
221 }
222 return CO2Tables::tabulatedDensity.at(temperature, pressure);
223 }
224
234
241 {
242 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
243 {
244 Dune::dwarn << "Subcritical values: Be aware to use "
245 <<"Tables with sufficient resolution!"<< std::endl;
246 warningThrown=true;
247 }
248 return CO2Tables::tabulatedDensity.at(temperature, pressure);
249 }
250
260
268 {
269 DUNE_THROW(NumericalProblem, "CO2::gasPressure()");
270 }
271
280 {
281 DUNE_THROW(NumericalProblem, "CO2::liquidPressure()");
282 }
283
293 {
294 //temperature difference :
295 Scalar dT = 1.; // 1K temperature increment
296 Scalar temperature2 = temperature+dT;
297
298 // enthalpy difference
300 Scalar hnew = liquidEnthalpy(temperature2, pressure);
301 Scalar dh = hold-hnew;
302
303 //specific heat capacity
304 return dh/dT ;
305 }
306
307
316 {
317 static const double a0 = 0.235156;
318 static const double a1 = -0.491266;
319 static const double a2 = 5.211155E-2;
320 static const double a3 = 5.347906E-2;
321 static const double a4 = -1.537102E-2;
322
323 static const double d11 = 0.4071119E-2;
324 static const double d21 = 0.7198037E-4;
325 static const double d64 = 0.2411697E-16;
326 static const double d81 = 0.2971072E-22;
327 static const double d82 = -0.1627888E-22;
328
329 static const double ESP = 251.196;
330
331 double mu0, SigmaStar, TStar;
332 double dmu, rho;
333 double visco_CO2;
334
335 if(temperature < 275.) // regularisation
336 {
337 temperature = 275;
338 Dune::dgrave << "Temperature below 275K in viscosity function:"
339 << "Regularizing temperature to 275K. " << std::endl;
340 }
341
342
343 TStar = temperature/ESP;
344
345 /* mu0: viscosity in zero-density limit */
346 using std::exp;
347 using std::log;
348 using std::sqrt;
349 SigmaStar = exp(a0 + a1*log(TStar)
350 + a2*log(TStar)*log(TStar)
351 + a3*log(TStar)*log(TStar)*log(TStar)
352 + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) );
353 mu0 = 1.00697*sqrt(temperature) / SigmaStar;
354
355 /* dmu : excess viscosity at elevated density */
356 rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */
357
358 using Dune::power;
359 dmu = d11*rho + d21*rho*rho + d64*power(rho,6)/(TStar*TStar*TStar)
360 + d81*power(rho,8) + d82*power(rho,8)/TStar;
361
362 visco_CO2 = (mu0 + dmu)/1.0E6; /* conversion to [Pa s] */
363
364 return visco_CO2;
365 }
366
373 {
374 // no difference for supercritical CO2
376 }
377
388 {
389 return 0.087;
390 }
391};
392
393template <class Scalar, class CO2Tables>
394const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;
395
396template <class Scalar, class CO2Tables>
397bool CO2<Scalar, CO2Tables>::warningThrown = false;
398
399} // end namespace Components
400
401} // end namespace Dumux
402
403#endif
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:47
Scalar Scalar
export the scalar type used by the component
Definition: components/base.hh:51
A class for the CO2 fluid properties.
Definition: co2.hh:45
static Scalar maxTabulatedTemperature()
Returns the maximal tabulated temperature of the used table.
Definition: co2.hh:108
static Scalar minTabulatedPressure()
Returns the minimal tabulated pressure of the used table.
Definition: co2.hh:90
static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of CO2 .
Definition: co2.hh:186
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of CO2.
Definition: co2.hh:387
static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid CO2 .
Definition: co2.hh:168
static Scalar vaporPressure(Scalar T)
The vapor pressure in of pure CO2 at a given temperature.
Definition: co2.hh:125
static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid CO2 .
Definition: co2.hh:200
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:60
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: co2.hh:267
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 gas in at a given pressure and temperature.
Definition: co2.hh:232
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:214
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: co2.hh:114
static Scalar minTabulatedTemperature()
Returns the minimal tabulated temperature of the used table.
Definition: co2.hh:102
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure CO2 at a given pressure and temperature .
Definition: co2.hh:240
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:66
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: co2.hh:279
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure CO2.
Definition: co2.hh:372
static std::string name()
A human readable name for the CO2.
Definition: co2.hh:54
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:315
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:72
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 in at a given pressure and temperature.
Definition: co2.hh:258
static Scalar tripleTemperature()
Returns the temperature at CO2's triple point.
Definition: co2.hh:78
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:292
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous CO2 .
Definition: co2.hh:150
static Scalar maxTabulatedPressure()
Returns the maximal tabulated pressure of the used table.
Definition: co2.hh:96
static Scalar triplePressure()
Returns the pressure at CO2's triple point.
Definition: co2.hh:84
Interface for components that have a gas state.
Definition: gas.hh:29
Interface for components that have a liquid state.
Definition: liquid.hh:29
A central place for various physical constants occurring in some equations.
Definition: constants.hh:27
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:27
Base class for all components Components provide the thermodynamic relations for the liquid,...
A central place for various physical constants occurring in some equations.
Some exceptions thrown in DuMux
Interface for components that have a gas state.
Interface for components that have a liquid state.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17