simpleh2o.hh 13.1 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
 *   the Free Software Foundation, either version 3 of the License, or       *
9
 *   (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
 * \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 <cmath>

32
33
34
#include <dumux/material/components/base.hh>
#include <dumux/material/components/liquid.hh>
#include <dumux/material/components/gas.hh>
35

36
namespace Dumux::Components {
37

38
/*!
39
 * \ingroup Components
Timo Koch's avatar
Timo Koch committed
40
 * \brief A simple version of pure water
41
42
 *
 * \tparam Scalar The type used for scalar values
43
44
 */
template <class Scalar>
45
46
47
48
class SimpleH2O
: public Components::Base<Scalar, SimpleH2O<Scalar> >
, public Components::Liquid<Scalar, SimpleH2O<Scalar> >
, public Components::Gas<Scalar, SimpleH2O<Scalar> >
49
{
50
    using IdealGas = Dumux::IdealGas<Scalar>;
51

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

public:
    /*!
     * \brief A human readable name for the water.
     */
58
    static std::string name()
59
    { return "SimpleH2O"; }
60
61

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

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

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

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

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

    /*!
Felix Bode's avatar
Felix Bode committed
92
     * \brief The vapor pressure in \f$\mathrm{[Pa]}\f$ of pure water
93
94
     *        at a given temperature.
     *
Felix Bode's avatar
Felix Bode committed
95
     *\param T temperature of component in \f$\mathrm{[K]}\f$
96
     *
97
98
99
100
     * See:
     *
     * IAPWS: "Revised Release on the IAPWS Industrial Formulation
     * 1997 for the Thermodynamic Properties of Water and Steam",
101
     * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997
102
103
104
105
106
107
108
109
     */
    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

Timo Koch's avatar
Timo Koch committed
110
        constexpr Scalar n[10] = {
111
112
113
            0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
            0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
            -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
114
115
116
            0.65017534844798e3
        };

Timo Koch's avatar
Timo Koch committed
117
        const Scalar sigma = T + n[8]/(T - n[9]);
118

Timo Koch's avatar
Timo Koch committed
119
120
121
        const Scalar A = (sigma + n[0])*sigma + n[1];
        const Scalar B = (n[2]*sigma + n[3])*sigma + n[4];
        const Scalar C = (n[5]*sigma + n[6])*sigma + n[7];
122

123
        using std::sqrt;
Timo Koch's avatar
Timo Koch committed
124
        const Scalar term = Scalar(2.0)*C/(sqrt(B*B - Scalar(4.0)*A*C) - B);
125

Timo Koch's avatar
Timo Koch committed
126
        return Scalar(1e6)*term*term*term*term;
127
128
129
    }

    /*!
Felix Bode's avatar
Felix Bode committed
130
     * \brief Specific enthalpy of water steam \f$\mathrm{[J/kg]}\f$.
131
     *
Felix Bode's avatar
Felix Bode committed
132
133
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
134
135
136
     */
    static const Scalar gasEnthalpy(Scalar temperature,
                                    Scalar pressure)
137
138
    {
        static const Scalar tRef = getParam<Scalar>("SimpleH2O.ReferenceTemperature", 293.15);
139
        return gasHeatCapacity(temperature, pressure)*(temperature - tRef);
140
    }
141
142

    /*!
Felix Bode's avatar
Felix Bode committed
143
     * \brief Specific enthalpy of liquid water \f$\mathrm{[J/kg]}\f$.
144
     *
Felix Bode's avatar
Felix Bode committed
145
146
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
147
148
149
150
     */
    static const Scalar liquidEnthalpy(Scalar temperature,
                                       Scalar pressure)
    {
151
        static const Scalar tRef = getParam<Scalar>("SimpleH2O.ReferenceTemperature", 293.15);
152
153
        return liquidHeatCapacity(temperature, pressure)*(temperature - tRef)
                + pressure/liquidDensity(temperature, pressure);
154
155
156
    }

    /*!
Felix Bode's avatar
Felix Bode committed
157
     * \brief Specific internal energy of steam \f$\mathrm{[J/kg]}\f$.
158
     *
159
160
161
162
     *        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
163
     *        Exploiting the Ideal Gas assumption (\f$pv = R_{\textnormal{specific}} T\f$)gives: \f$u = h - R / M T \f$.
164
     *
Andreas Lauser's avatar
Andreas Lauser committed
165
     *        The universal gas constant can only be used in the case of molar formulations.
Felix Bode's avatar
Felix Bode committed
166
167
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
168
169
170
171
172
173
     */
    static const Scalar gasInternalEnergy(Scalar temperature,
                                          Scalar pressure)
    {
        return
            gasEnthalpy(temperature, pressure) -
174
            1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
175
176
177
178
            IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
    }

    /*!
Felix Bode's avatar
Felix Bode committed
179
     * \brief Specific internal energy of liquid water \f$\mathrm{[J/kg]}\f$.
180
     *
Felix Bode's avatar
Felix Bode committed
181
182
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
183
184
185
186
187
188
189
     */
    static const Scalar liquidInternalEnergy(Scalar temperature,
                                             Scalar pressure)
    { return
            liquidEnthalpy(temperature, pressure) -
            pressure/liquidDensity(temperature, pressure); }

190
    /*!
191
     * \brief Returns true if the gas phase is assumed to be compressible
192
     */
193
    static constexpr bool gasIsCompressible()
194
    { return true; }
195
196

    /*!
197
     * \brief Returns true if the liquid phase is assumed to be compressible
198
     */
199
    static constexpr bool liquidIsCompressible()
200
    { return false; }
201

202
203
204
205
206
207
208
209
210
211
212
213
    /*!
     * \brief Returns true if the gas phase viscostiy is constant
     */
    static constexpr bool gasViscosityIsConstant()
    { return true; }

    /*!
     * \brief Returns true if the liquid phase viscostiy is constant
     */
    static constexpr bool liquidViscosityIsConstant()
    { return true; }

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

226
227
228
229
230
231
232
233
234
235
    /*!
     *  \brief The molar density of steam 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 IdealGas::molarDensity(temperature, pressure); }

236
    /*!
237
     * \brief Returns true if the gas phase is assumed to be ideal
238
     */
239
    static constexpr bool gasIsIdeal()
240
241
    { return true; }

242
    /*!
Felix Bode's avatar
Felix Bode committed
243
     * \brief The pressure of steam in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
244
     *
Felix Bode's avatar
Felix Bode committed
245
246
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
247
248
249
250
251
252
253
254
     */
    static Scalar gasPressure(Scalar temperature, Scalar density)
    {
        // Assume an ideal gas
        return IdealGas::pressure(temperature, density/molarMass());
    }

    /*!
Felix Bode's avatar
Felix Bode committed
255
     * \brief The density of pure water at a given pressure and temperature \f$\mathrm{[kg/m^3]}\f$.
256
     *
Felix Bode's avatar
Felix Bode committed
257
258
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
259
260
261
     */
    static Scalar liquidDensity(Scalar temperature, Scalar pressure)
    {
Philipp Nuske's avatar
Philipp Nuske committed
262
        return 1000.;
263
264
    }

265
266
267
268
269
270
271
272
273
274
    /*!
     * \brief The molar density of pure water 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(); }

275
    /*!
Felix Bode's avatar
Felix Bode committed
276
     * \brief The pressure of water in \f$\mathrm{[Pa]}\f$ at a given density and temperature.
277
     *
Felix Bode's avatar
Felix Bode committed
278
279
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param density density of component in \f$\mathrm{[kg/m^3]}\f$
280
281
282
283
284
285
286
287
     */
    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
288
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of steam.
289
     *
Felix Bode's avatar
Felix Bode committed
290
291
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
292
     * \param regularize defines, if the functions is regularized or not, set to true by default
293
294
295
296
     */
    static Scalar gasViscosity(Scalar temperature, Scalar pressure, bool regularize=true)
    {
        return 1e-05;
Philipp Nuske's avatar
Philipp Nuske committed
297
    }
298
299

    /*!
Felix Bode's avatar
Felix Bode committed
300
     * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure water.
301
     *
Felix Bode's avatar
Felix Bode committed
302
303
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
304
305
306
307
     */
    static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
    {
        return 1e-03;
Philipp Nuske's avatar
Philipp Nuske committed
308
309
310
    }

    /*!
311
     * \brief Specific isobaric heat capacity of the component \f$\mathrm{[J/(kg*K)]}\f$ as a liquid.
312
313
     * source: http://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page
     * @ T= 281.15K (8°C) , p=0.1MPa)
314
315
     * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
     * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
Philipp Nuske's avatar
Philipp Nuske committed
316
317
318
     */
    static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
    {
319
        return 4180.0;
Philipp Nuske's avatar
Philipp Nuske committed
320
    }
321

322
    /*!
323
     * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of water.
324
325
     *        source: http://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page
     *        @ T= 372.76K (99.6°C) , p=0.1MPa)
326
327
     * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
     * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
328
329
330
     */
    static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
    {
331
       return 0.679;
332
    }
333

334
    /*!
335
     * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of steam.
336
337
     *        source: http://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page
     *        @ T= 372.76K (99.6°C) , p=0.1MPa)
338
339
     * \param temperature absolute temperature in \f$\mathrm{[K]}\f$
     * \param pressure of the phase in \f$\mathrm{[Pa]}\f$
340
341
342
     */
    static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
    {
343
       return 0.025;
344
    }
345

346
347
348
349
350
351
352
353
354
355
356
    /*!
     * \brief Specific isobaric heat capacity of water steam \f$\mathrm{[J/(kg*K)}\f$.
     *        source: http://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page
     *        @ T= 372.76K (99.6°C) , p=0.1MPa)
     * \param temperature temperature of component in \f$\mathrm{[K]}\f$
     * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
     */
    static Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
    {
        return 2.08e3;
    }
357

358
359
};

Bernd Flemisch's avatar
Bernd Flemisch committed
360
361
362
template <class Scalar>
struct IsAqueous<SimpleH2O<Scalar>> : public std::true_type {};

363
template <class Scalar>
364
const Scalar Components::SimpleH2O<Scalar>::R = Constants<Scalar>::R / 18e-3;
365

366
} // end namespace Dumux::Components
367
368

#endif