simpleh2o.hh 9.91 KB
Newer Older
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
/*****************************************************************************
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
9
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
10
 *                                                                           *
11
12
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
14
15
16
17
 *   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/>.   *
18
19
20
 *****************************************************************************/
/*!
 * \file
21
 * \ingroup Components
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 * \brief A much simpler (and thus potentially less buggy) version of
 *        pure water.
 */
#ifndef DUMUX_SIMPLE_H2O_HH
#define DUMUX_SIMPLE_H2O_HH

#include <dumux/material/idealgas.hh>

#include "component.hh"

#include <cmath>

namespace Dumux
{
/*!
37
38
 * \ingroup Components
 *
39
40
 * \brief A much simpler (and thus potentially less buggy) version of
 *        pure water.
41
42
 *
 * \tparam Scalar The type used for scalar values
43
44
45
46
47
48
 */
template <class Scalar>
class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
{
    typedef Dumux::IdealGas<Scalar> IdealGas;

49
    static const Scalar R;  // specific gas constant of water
50
51
52
53
54
55
56
57
58

public:
    /*!
     * \brief A human readable name for the water.
     */
    static const char *name()
    { return "H2O"; }

    /*!
Felix Bode's avatar
Felix Bode committed
59
     * \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of water.
60
61
62
63
64
     */
    static Scalar molarMass()
    { return 18e-3; }

    /*!
Felix Bode's avatar
Felix Bode committed
65
     * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of water.
66
67
68
69
70
     */
    static Scalar criticalTemperature()
    { return 647.096; /* [K] */ }

    /*!
Felix Bode's avatar
Felix Bode committed
71
     * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of water.
72
73
74
75
76
     */
    static Scalar criticalPressure()
    { return 22.064e6; /* [N/m^2] */ }

    /*!
Felix Bode's avatar
Felix Bode committed
77
     * \brief Returns the temperature \f$\mathrm{[K]}\f$ at water's triple point.
78
79
80
81
82
     */
    static Scalar tripleTemperature()
    { return 273.16; /* [K] */ }

    /*!
Felix Bode's avatar
Felix Bode committed
83
     * \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at water's triple point.
84
85
86
87
88
     */
    static Scalar triplePressure()
    { return 611.657; /* [N/m^2] */ }

    /*!
Felix Bode's avatar
Felix Bode committed
89
     * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure water
90
91
     *        at a given temperature.
     *
Felix Bode's avatar
Felix Bode committed
92
     *\param T temperature of component in \f$\mathrm{[K]}\f$
93
     *
94
95
96
97
98
99
100
101
102
103
104
105
106
107
     * See:
     *
     * IAPWS: "Revised Release on the IAPWS Industrial Formulation
     * 1997 for the Thermodynamic Properties of Water and Steam",
     * http://www.iapws.org/relguide/IF97-Rev.pdf
     */
    static Scalar vaporPressure(Scalar T)
    {
        if (T > criticalTemperature())
            return criticalPressure();
        if (T < tripleTemperature())
            return 0; // water is solid: We don't take sublimation into account

        static const Scalar n[10] = {
108
109
110
            0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
            0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
            -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
            0.65017534844798e3
        };

        Scalar sigma = T + n[8]/(T - n[9]);

        Scalar A = (sigma + n[0])*sigma + n[1];
        Scalar B = (n[2]*sigma + n[3])*sigma + n[4];
        Scalar C = (n[5]*sigma + n[6])*sigma + n[7];

        Scalar tmp = Scalar(2.0)*C/(std::sqrt(B*B - Scalar(4.0)*A*C) - B);
        tmp *= tmp;
        tmp *= tmp;

        return Scalar(1e6)*tmp;
    }

    /*!
Felix Bode's avatar
Felix Bode committed
128
     * \brief Specific enthalpy of water steam \f$\mathrm{[J/kg]}\f$.
129
     *
Felix Bode's avatar
Felix Bode committed
130
131
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
132
133
134
135
136
137
     */
    static const Scalar gasEnthalpy(Scalar temperature,
                                    Scalar pressure)
    { return 1976*(temperature - 293.15) + 2.45e6; }

    /*!
Felix Bode's avatar
Felix Bode committed
138
     * \brief Specific enthalpy of liquid water \f$\mathrm{[J/kg]}\f$.
139
     *
Felix Bode's avatar
Felix Bode committed
140
141
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
142
143
144
145
146
147
148
149
     */
    static const Scalar liquidEnthalpy(Scalar temperature,
                                       Scalar pressure)
    {
        return 4180*(temperature - 293.15);
    }

    /*!
Felix Bode's avatar
Felix Bode committed
150
     * \brief Specific internal energy of steam \f$\mathrm{[J/kg]}\f$.
151
     *
152
153
154
155
     *        Definition of enthalpy: \f$h= u + pv = u + p / \rho\f$.
     *
     *        Rearranging for internal energy yields: \f$u = h - pv\f$.
     *
Andreas Lauser's avatar
Andreas Lauser committed
156
     *        Exploiting the Ideal Gas assumption (\f$pv = R_{\textnormal{specific}} T\f$)gives: \f$u = h - R / M T \f$.
157
     *
Andreas Lauser's avatar
Andreas Lauser committed
158
     *        The universal gas constant can only be used in the case of molar formulations.
Felix Bode's avatar
Felix Bode committed
159
160
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
161
162
163
164
165
166
     */
    static const Scalar gasInternalEnergy(Scalar temperature,
                                          Scalar pressure)
    {
        return
            gasEnthalpy(temperature, pressure) -
167
            1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
168
169
170
171
            IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
    }

    /*!
Felix Bode's avatar
Felix Bode committed
172
     * \brief Specific internal energy of liquid water \f$\mathrm{[J/kg]}\f$.
173
     *
Felix Bode's avatar
Felix Bode committed
174
175
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
176
177
178
179
180
181
182
     */
    static const Scalar liquidInternalEnergy(Scalar temperature,
                                             Scalar pressure)
    { return
            liquidEnthalpy(temperature, pressure) -
            pressure/liquidDensity(temperature, pressure); }

183
    /*!
184
     * \brief Returns true iff the gas phase is assumed to be compressible
185
     */
186
187
    static bool gasIsCompressible()
    { return true; }
188
189

    /*!
190
     * \brief Returns true iff the liquid phase is assumed to be compressible
191
     */
192
193
    static bool liquidIsCompressible()
    { return false; }
194

195
    /*!
Felix Bode's avatar
Felix Bode committed
196
     * \brief The density \f$\mathrm{[kg/m^3]}\f$ of steam at a given pressure and temperature.
197
     *
Felix Bode's avatar
Felix Bode committed
198
199
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
200
201
202
203
     */
    static Scalar gasDensity(Scalar temperature, Scalar pressure)
    {
        // Assume an ideal gas
204
        return molarMass()*IdealGas::molarDensity(temperature, pressure);
205
206
    }

207
208
209
210
211
212
    /*!
     * \brief Returns true iff the gas phase is assumed to be ideal
     */
    static bool gasIsIdeal()
    { return true; }

213
    /*!
Felix Bode's avatar
Felix Bode committed
214
     * \brief The pressure of steam in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
215
     *
Felix Bode's avatar
Felix Bode committed
216
217
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
218
219
220
221
222
223
224
225
     */
    static Scalar gasPressure(Scalar temperature, Scalar density)
    {
        // Assume an ideal gas
        return IdealGas::pressure(temperature, density/molarMass());
    }

    /*!
Felix Bode's avatar
Felix Bode committed
226
     * \brief The density of pure water at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
227
     *
Felix Bode's avatar
Felix Bode committed
228
229
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
230
231
232
     */
    static Scalar liquidDensity(Scalar temperature, Scalar pressure)
    {
Philipp Nuske's avatar
Philipp Nuske committed
233
        return 1000.;
234
235
    }

236
    /*!
Felix Bode's avatar
Felix Bode committed
237
     * \brief The pressure of water in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
238
     *
Felix Bode's avatar
Felix Bode committed
239
240
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
241
242
243
244
245
246
247
248
     */
    static Scalar liquidPressure(Scalar temperature, Scalar density)
    {
        DUNE_THROW(Dune::InvalidStateException,
                   "The liquid pressure is undefined for incompressible fluids");
    }

    /*!
Felix Bode's avatar
Felix Bode committed
249
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of steam.
250
     *
Felix Bode's avatar
Felix Bode committed
251
252
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
253
     * \param regularize defines, if the functions is regularized or not, set to true by default
254
255
256
257
     */
    static Scalar gasViscosity(Scalar temperature, Scalar pressure, bool regularize=true)
    {
        return 1e-05;
Philipp Nuske's avatar
Philipp Nuske committed
258
    }
259
260

    /*!
Felix Bode's avatar
Felix Bode committed
261
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure water.
262
     *
Felix Bode's avatar
Felix Bode committed
263
264
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
265
266
267
268
     */
    static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
    {
        return 1e-03;
Philipp Nuske's avatar
Philipp Nuske committed
269
270
271
    }

    /*!
272
     * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a liquid.
Philipp Nuske's avatar
Philipp Nuske committed
273
274
275
276
277
278
279
280
281
282
     *
     *        \param temperature temperature of component in \f$\mathrm{[K]}\f$
     *        \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
     *        source: http://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page
     *        @ T= 281.15 (8°C) , p=0.1MPa)
     */
    static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
    {
        return 4.2e3 ;
    }
283
284
};

285
286
287
template <class Scalar>
const Scalar SimpleH2O<Scalar>::R = Dumux::Constants<Scalar>::R / 18e-3;

288
} // end namespace
289
290

#endif