co2.hh 14.3 KB
Newer Older
Bernd Flemisch's avatar
Bernd Flemisch committed
1
2
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
3
/*****************************************************************************
Bernd Flemisch's avatar
Bernd Flemisch committed
4
 *   See the file COPYING for full copying permissions.                      *
5
6
7
8
9
10
11
12
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
Bernd Flemisch's avatar
Bernd Flemisch committed
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
14
15
16
17
18
19
20
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
Thomas Fetzer's avatar
Thomas Fetzer committed
21
 * \ingroup Components
22
23
24
25
26
27
28
29
30
31
32
 * \brief A class for the CO2 fluid properties
 */
#ifndef DUMUX_CO2_HH
#define DUMUX_CO2_HH

#include <dumux/common/exceptions.hh>
#include <dumux/material/constants.hh>

#include <cmath>
#include <iostream>

33
34
35
#include <dumux/material/components/base.hh>
#include <dumux/material/components/liquid.hh>
#include <dumux/material/components/gas.hh>
36
37
38
39

namespace Dumux {
namespace Components {

40
/*!
Thomas Fetzer's avatar
Thomas Fetzer committed
41
 * \ingroup Components
42
43
44
45
46
 * \brief A class for the CO2 fluid properties
 *
 * Under reservoir conditions, CO2 is typically in supercritical state. These
 * properties can be provided in tabulated form, which is necessary for this
 * component implementation. The template is passed through the fluidsystem
47
48
 * brineco2fluidsystem.hh.
 * Depending on the used tabulation, the fluidsystem can also be used for gaseous CO2
49
 */
Timo Koch's avatar
Timo Koch committed
50

51
template <class Scalar, class CO2Tables>
52
53
54
55
class CO2
: public Components::Base<Scalar, CO2<Scalar, CO2Tables> >
, public Components::Liquid<Scalar, CO2<Scalar, CO2Tables> >
, public Components::Gas<Scalar, CO2<Scalar, CO2Tables> >
56
{
57
    static const Scalar R;
58

59
60
61
62
63
64
    static bool warningThrown;

public:
    /*!
     * \brief A human readable name for the CO2.
     */
65
    static std::string name()
66
67
68
    { return "CO2"; }

    /*!
69
     * \brief The mass in \f$\mathrm{[kg/mol]}\f$ of one mole of CO2.
70
     */
71
    static constexpr Scalar molarMass()
72
    { return 44e-3; /* [kg/mol] */ }
73
74

    /*!
75
     * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of CO2
76
77
78
79
80
     */
    static Scalar criticalTemperature()
    { return 273.15 + 30.95; /* [K] */ }

    /*!
81
     * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of CO2
82
83
     */
    static Scalar criticalPressure()
84
    { return 73.8e5; /* [Pa] */ }
85
86

    /*!
87
     * \brief Returns the temperature \f$\mathrm{[K]}\f$ at CO2's triple point.
88
89
90
91
92
     */
    static Scalar tripleTemperature()
    { return 273.15 - 56.35; /* [K] */ }

    /*!
93
     * \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at CO2's triple point.
94
95
96
97
98
     */
    static Scalar triplePressure()
    { return 5.11e5; /* [N/m^2] */ }

    /*!
99
     * \brief Returns the minimal tabulated pressure \f$\mathrm{[Pa]}\f$ of the used table
100
101
     */
    static Scalar minTabulatedPressure()
102
    { return CO2Tables::tabulatedEnthalpy.minPress(); /* [Pa] */ }
103
104

    /*!
105
     * \brief Returns the maximal tabulated pressure \f$\mathrm{[Pa]}\f$ of the used table
106
107
     */
    static Scalar maxTabulatedPressure()
108
    { return CO2Tables::tabulatedEnthalpy.maxPress(); /* [Pa] */ }
109
110

    /*!
111
     * \brief Returns the minimal tabulated temperature \f$\mathrm{[K]}\f$ of the used table
112
113
     */
    static Scalar minTabulatedTemperature()
114
    { return CO2Tables::tabulatedEnthalpy.minTemp(); /* [K] */ }
115
116

    /*!
117
     * \brief Returns the maximal tabulated temperature \f$\mathrm{[K]}\f$ of the used table
118
119
     */
    static Scalar maxTabulatedTemperature()
120
    { return CO2Tables::tabulatedEnthalpy.maxTemp(); /* [K] */ }
121
122

    /*!
123
     * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure CO2
124
     *        at a given temperature.
125
     * \param T the temperature \f$\mathrm{[K]}\f$
126
127
     * See:
     *
128
     * R. Span and W. Wagner (1996, pp. 1509-1596) \cite span1996
129
130
     */
    static Scalar vaporPressure(Scalar T)
131
132
    {
        static const Scalar a[4] =
133
            { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
134
        static const Scalar t[4] =
135
136
137
138
139
            { 1.0, 1.5, 2.0, 4.0 };

        // this is on page 1524 of the reference
        Scalar exponent = 0;
        Scalar Tred = T/criticalTemperature();
140
141

        using std::pow;
142
        for (int i = 0; i < 4; ++i)
143
            exponent += a[i]*pow(1 - Tred, t[i]);
144
        exponent *= 1.0/Tred;
145

146
147
        using std::exp;
        return exp(exponent)*criticalPressure();
148
149
150
    }

    /*!
151
     * \brief Specific enthalpy of gaseous CO2 \f$\mathrm{[J/kg]}\f$.
152
153
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
154
155
156
157
     */
    static Scalar gasEnthalpy(Scalar temperature,
                              Scalar pressure)
    {
158
        if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
159
160
161
162
163
164
165
166
167
168
        {
            Dune::dwarn << "Subcritical values: Be aware to use "
                        <<"Tables with sufficient resolution!"<< std::endl;
            warningThrown=true;
        }
        return
            CO2Tables::tabulatedEnthalpy.at(temperature, pressure);
    }

    /*!
169
     * \brief Specific enthalpy of liquid CO2 \f$\mathrm{[J/kg]}\f$.
170
171
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
172
173
174
175
     */
    static Scalar liquidEnthalpy(Scalar temperature,
                                 Scalar pressure)
    {
176
        if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
177
178
179
180
181
182
183
184
185
186
        {
            Dune::dwarn << "Subcritical values: Be aware to use "
                        <<"Tables with sufficient resolution!"<< std::endl;
            warningThrown=true;
        }

        return gasEnthalpy(temperature, pressure);
    }

    /*!
187
     * \brief Specific internal energy of CO2 \f$\mathrm{[J/kg]}\f$.
188
189
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
190
191
192
193
194
195
196
197
198
199
200
     */
    static Scalar gasInternalEnergy(Scalar temperature,
                                    Scalar pressure)
    {
        Scalar h = gasEnthalpy(temperature, pressure);
        Scalar rho = gasDensity(temperature, pressure);

        return h - (pressure / rho);
    }

    /*!
201
     * \brief Specific internal energy of liquid CO2 \f$\mathrm{[J/kg]}\f$.
202
203
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
204
205
206
207
208
209
210
211
212
213
214
     */
    static Scalar liquidInternalEnergy(Scalar temperature,
                                       Scalar pressure)
    {
        Scalar h = liquidEnthalpy(temperature, pressure);
        Scalar rho = liquidDensity(temperature, pressure);

        return h - (pressure / rho);
    }

    /*!
215
     * \brief The density of CO2 at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
216
217
218
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
     */
219
220
    static Scalar gasDensity(Scalar temperature, Scalar pressure)
    {
221
        if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
222
223
224
225
226
227
228
229
        {
            Dune::dwarn << "Subcritical values: Be aware to use "
                        <<"Tables with sufficient resolution!"<< std::endl;
            warningThrown=true;
        }
        return CO2Tables::tabulatedDensity.at(temperature, pressure);
    }

230
231
232
233
234
235
236
237
238
239
    /*!
     *  \brief The molar density of CO2 gas in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
     *
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
     *
     */
    static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
    { return gasDensity(temperature, pressure)/molarMass(); }

240
    /*!
241
     * \brief The density of pure CO2 at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
242
243
     * \param temperature the temperature \f$\mathrm{[K]}\f$
     * \param pressure the pressure \f$\mathrm{[Pa]}\f$
244
245
246
     */
    static Scalar liquidDensity(Scalar temperature, Scalar pressure)
    {
247
        if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown)
248
249
250
251
252
253
        {
            Dune::dwarn << "Subcritical values: Be aware to use "
                        <<"Tables with sufficient resolution!"<< std::endl;
            warningThrown=true;
        }
        return CO2Tables::tabulatedDensity.at(temperature, pressure);
254
    }
255
256
257
258
259
260
261
262
263
264
265

    /*!
     * \brief The molar density of CO2 in \f$\mathrm{[mol/m^3]}\f$ at a given pressure and temperature.
     *
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
     *
     */
    static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
    { return liquidDensity(temperature, pressure)/molarMass(); }

266
267
268
269
    /*!
     * \brief The pressure of steam in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
     *
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
270
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
     */
    static Scalar gasPressure(Scalar temperature, Scalar density)
    {
        DUNE_THROW(NumericalProblem, "CO2::gasPressure()");
    }

    /*!
     * \brief The pressure of liquid water in \f$\mathrm{[Pa]}\f$ at a given density and
     *        temperature.
     *
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
     */
    static Scalar liquidPressure(Scalar temperature, Scalar density)
    {
        DUNE_THROW(NumericalProblem, "CO2::liquidPressure()");
    }

289
    /*!
290
     * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a liquid.
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
     * USE WITH CAUTION! Exploits enthalpy function with artificial increment
     * of the temperature!
     * Equation with which the specific heat capacity is calculated : \f$ c_p = \frac{dh}{dT}\f$
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
     */
    static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
    {
        //temperature difference :
        Scalar dT = 1.; // 1K temperature increment
        Scalar temperature2 = temperature+dT;

        // enthalpy difference
        Scalar hold = liquidEnthalpy(temperature, pressure);
        Scalar hnew = liquidEnthalpy(temperature2, pressure);
        Scalar dh = hold-hnew;

        //specific heat capacity
        return dh/dT ;
    }

312
313

    /*!
314
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of CO2.
315
     * Equations given in: - Vesovic et al., 1990
Bernd Flemisch's avatar
Bernd Flemisch committed
316
     *                     - Fenhour et al., 1998
317
318
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
     */
    static Scalar gasViscosity(Scalar temperature, Scalar pressure)
    {
        static const double a0 = 0.235156;
        static const double a1 = -0.491266;
        static const double a2 = 5.211155E-2;
        static const double a3 = 5.347906E-2;
        static const double a4 = -1.537102E-2;

        static const double d11 = 0.4071119E-2;
        static const double d21 = 0.7198037E-4;
        static const double d64 = 0.2411697E-16;
        static const double d81 = 0.2971072E-22;
        static const double d82 = -0.1627888E-22;

        static const double ESP = 251.196;

        double mu0, SigmaStar, TStar;
        double dmu, rho;
        double visco_CO2;

        if(temperature < 275.) // regularisation
        {
            temperature = 275;
            Dune::dgrave << "Temperature below 275K in viscosity function:"
                    << "Regularizing tempereature to 275K. " << std::endl;
        }


        TStar = temperature/ESP;

        /* mu0: viscosity in zero-density limit */
351
352
353
        using std::exp;
        using std::log;
        using std::sqrt;
354
355
356
357
358
359
360
361
362
        SigmaStar = exp(a0 + a1*log(TStar)
                        + a2*log(TStar)*log(TStar)
                        + a3*log(TStar)*log(TStar)*log(TStar)
                        + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) );
        mu0 = 1.00697*sqrt(temperature) / SigmaStar;

        /* dmu : excess viscosity at elevated density */
        rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */

363
        using std::pow;
364
365
366
367
368
369
        dmu = d11*rho + d21*rho*rho + d64*pow(rho,6)/(TStar*TStar*TStar)
            + d81*pow(rho,8) + d82*pow(rho,8)/TStar;

        visco_CO2 = (mu0 + dmu)/1.0E6;   /* conversion to [Pa s] */

        return visco_CO2;
370
    }
371
372

    /*!
373
374
375
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure CO2.
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
376
377
378
379
     */
    static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
    {
        // no difference for supercritical CO2
380
        return gasViscosity(temperature, pressure);
381
    }
382
383
384
385
386
387
388
389
390
391
392
393
394
395

    /*!
     * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of CO2.
     *
     * Thermal conductivity of CO2 at T=20°C, see:
     * http://www.engineeringtoolbox.com/carbon-dioxide-d_1000.html
     *
     * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
     * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
     */
    static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
    {
        return 0.087;
    }
396
397
};

398
399
400
template <class Scalar, class CO2Tables>
const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;

401
402
403
template <class Scalar, class CO2Tables>
bool CO2<Scalar, CO2Tables>::warningThrown = false;

404
405
406
} // end namespace Components

} // end namespace Dumux
407
408

#endif