version 3.11-dev
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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-FileCopyrightText: 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/stdstreams.hh>
19#include <dune/common/math.hh>
20
22
27
28namespace Dumux::Components {
29
41template <class Scalar, class CO2Tables>
42class CO2
43: public Components::Base<Scalar, CO2<Scalar, CO2Tables> >
44, public Components::Liquid<Scalar, CO2<Scalar, CO2Tables> >
45, public Components::Gas<Scalar, CO2<Scalar, CO2Tables> >
46{
47 static const Scalar R;
48
49 static bool warningThrown;
50
51public:
55 static std::string name()
56 { return "CO2"; }
57
61 static constexpr Scalar molarMass()
62 { return 44e-3; /* [kg/mol] */ }
63
68 { return 273.15 + 30.95; /* [K] */ }
69
74 { return 73.8e5; /* [Pa] */ }
75
80 { return 273.15 - 56.35; /* [K] */ }
81
86 { return 5.11e5; /* [N/m^2] */ }
87
92 { return CO2Tables::tabulatedEnthalpy.minPress(); /* [Pa] */ }
93
98 { return CO2Tables::tabulatedEnthalpy.maxPress(); /* [Pa] */ }
99
104 { return CO2Tables::tabulatedEnthalpy.minTemp(); /* [K] */ }
105
110 { return CO2Tables::tabulatedEnthalpy.maxTemp(); /* [K] */ }
111
115 static constexpr bool gasIsIdeal()
116 { return false; }
117
127 {
128 static const Scalar a[4] =
129 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
130 static const Scalar t[4] =
131 { 1.0, 1.5, 2.0, 4.0 };
132
133 // this is on page 1524 of the reference
134 Scalar exponent = 0;
135 Scalar Tred = T/criticalTemperature();
136
137 using std::pow;
138 for (int i = 0; i < 4; ++i)
139 exponent += a[i]*pow(1 - Tred, t[i]);
140 exponent *= 1.0/Tred;
141
142 using std::exp;
143 return exp(exponent)*criticalPressure();
144 }
145
153 {
154 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
155 {
156 Dune::dwarn << "Subcritical values: Be aware to use "
157 <<"Tables with sufficient resolution!"<< std::endl;
158 warningThrown=true;
159 }
160 return
161 CO2Tables::tabulatedEnthalpy.at(temperature, pressure);
162 }
163
171 {
172 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
173 {
174 Dune::dwarn << "Subcritical values: Be aware to use "
175 <<"Tables with sufficient resolution!"<< std::endl;
176 warningThrown=true;
177 }
178
180 }
181
189 {
192
193 return h - (pressure / rho);
194 }
195
203 {
206
207 return h - (pressure / rho);
208 }
209
216 {
217 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
218 {
219 Dune::dwarn << "Subcritical values: Be aware to use "
220 <<"Tables with sufficient resolution!"<< std::endl;
221 warningThrown=true;
222 }
223 return CO2Tables::tabulatedDensity.at(temperature, pressure);
224 }
225
235
242 {
243 if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
244 {
245 Dune::dwarn << "Subcritical values: Be aware to use "
246 <<"Tables with sufficient resolution!"<< std::endl;
247 warningThrown=true;
248 }
249 return CO2Tables::tabulatedDensity.at(temperature, pressure);
250 }
251
261
269 {
270 DUNE_THROW(NumericalProblem, "CO2::gasPressure()");
271 }
272
281 {
282 DUNE_THROW(NumericalProblem, "CO2::liquidPressure()");
283 }
284
294 {
295 //temperature difference :
296 Scalar dT = 1.; // 1K temperature increment
297 Scalar temperature2 = temperature+dT;
298
299 // enthalpy difference
301 Scalar hnew = liquidEnthalpy(temperature2, pressure);
302 Scalar dh = hold-hnew;
303
304 //specific heat capacity
305 return dh/dT ;
306 }
307
308
317 {
318 static const double a0 = 0.235156;
319 static const double a1 = -0.491266;
320 static const double a2 = 5.211155E-2;
321 static const double a3 = 5.347906E-2;
322 static const double a4 = -1.537102E-2;
323
324 static const double d11 = 0.4071119E-2;
325 static const double d21 = 0.7198037E-4;
326 static const double d64 = 0.2411697E-16;
327 static const double d81 = 0.2971072E-22;
328 static const double d82 = -0.1627888E-22;
329
330 static const double ESP = 251.196;
331
332 double mu0, SigmaStar, TStar;
333 double dmu, rho;
334 double visco_CO2;
335
336 if(temperature < 275.) // regularisation
337 {
338 temperature = 275;
339 Dune::dgrave << "Temperature below 275K in viscosity function:"
340 << "Regularizing temperature to 275K. " << std::endl;
341 }
342
343
344 TStar = temperature/ESP;
345
346 /* mu0: viscosity in zero-density limit */
347 using std::exp;
348 using std::log;
349 using std::sqrt;
350 SigmaStar = exp(a0 + a1*log(TStar)
351 + a2*log(TStar)*log(TStar)
352 + a3*log(TStar)*log(TStar)*log(TStar)
353 + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) );
354 mu0 = 1.00697*sqrt(temperature) / SigmaStar;
355
356 /* dmu : excess viscosity at elevated density */
357 rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */
358
359 using Dune::power;
360 dmu = d11*rho + d21*rho*rho + d64*power(rho,6)/(TStar*TStar*TStar)
361 + d81*power(rho,8) + d82*power(rho,8)/TStar;
362
363 visco_CO2 = (mu0 + dmu)/1.0E6; /* conversion to [Pa s] */
364
365 return visco_CO2;
366 }
367
374 {
375 // no difference for supercritical CO2
377 }
378
389 {
390 return 0.087;
391 }
392};
393
394template <class Scalar, class CO2Tables>
395const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;
396
397template <class Scalar, class CO2Tables>
398bool CO2<Scalar, CO2Tables>::warningThrown = false;
399
400} // end namespace Dumux::Components
401
402#endif
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:46
Scalar Scalar
export the scalar type used by the component
Definition: components/base.hh:50
A class for the CO2 fluid properties.
Definition: co2.hh:46
static Scalar maxTabulatedTemperature()
Returns the maximal tabulated temperature of the used table.
Definition: co2.hh:109
static Scalar minTabulatedPressure()
Returns the minimal tabulated pressure of the used table.
Definition: co2.hh:91
static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of CO2 .
Definition: co2.hh:187
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of CO2.
Definition: co2.hh:388
static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid CO2 .
Definition: co2.hh:169
static Scalar vaporPressure(Scalar T)
The vapor pressure in of pure CO2 at a given temperature.
Definition: co2.hh:126
static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid CO2 .
Definition: co2.hh:201
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:61
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: co2.hh:268
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 gas in at a given pressure and temperature.
Definition: co2.hh:233
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:215
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: co2.hh:115
static Scalar minTabulatedTemperature()
Returns the minimal tabulated temperature of the used table.
Definition: co2.hh:103
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure CO2 at a given pressure and temperature .
Definition: co2.hh:241
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:67
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of liquid water in at a given density and temperature.
Definition: co2.hh:280
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure CO2.
Definition: co2.hh:373
static std::string name()
A human readable name for the CO2.
Definition: co2.hh:55
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:316
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:73
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 in at a given pressure and temperature.
Definition: co2.hh:259
static Scalar tripleTemperature()
Returns the temperature at CO2's triple point.
Definition: co2.hh:79
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:293
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous CO2 .
Definition: co2.hh:151
static Scalar maxTabulatedPressure()
Returns the maximal tabulated pressure of the used table.
Definition: co2.hh:97
static Scalar triplePressure()
Returns the pressure at CO2's triple point.
Definition: co2.hh:85
Interface for components that have a gas state.
Definition: gas.hh:28
Interface for components that have a liquid state.
Definition: liquid.hh:28
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.
Definition: air.hh:22
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