Line |
Branch |
Exec |
Source |
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 |
|
|
// |
7 |
|
|
/*! |
8 |
|
|
* \file |
9 |
|
|
* \ingroup IAPWS |
10 |
|
|
* \brief Implements the equations for region 4 of the IAPWS '97 formulation. |
11 |
|
|
* |
12 |
|
|
* See: |
13 |
|
|
* |
14 |
|
|
* IAPWS: "Revised Release on the IAPWS Industrial Formulation |
15 |
|
|
* 1997 for the Thermodynamic Properties of Water and Steam", |
16 |
|
|
* http://www.iapws.org/relguide/IF97-Rev.pdf |
17 |
|
|
*/ |
18 |
|
|
#ifndef DUMUX_IAPWS_REGION4_HH |
19 |
|
|
#define DUMUX_IAPWS_REGION4_HH |
20 |
|
|
|
21 |
|
|
#include <cmath> |
22 |
|
|
#include <iostream> |
23 |
|
|
|
24 |
|
|
#include <dune/common/math.hh> |
25 |
|
|
|
26 |
|
|
namespace Dumux::IAPWS { |
27 |
|
|
|
28 |
|
|
/*! |
29 |
|
|
* \ingroup IAPWS |
30 |
|
|
* \brief Implements the equations for region 4 of the IAPWS '97 formulation. |
31 |
|
|
* \tparam Scalar The type used for scalar values |
32 |
|
|
* |
33 |
|
|
* See: |
34 |
|
|
* |
35 |
|
|
* IAPWS: "Revised Release on the IAPWS Industrial Formulation |
36 |
|
|
* 1997 for the Thermodynamic Properties of Water and Steam", |
37 |
|
|
* http://www.iapws.org/relguide/IF97-Rev.pdf |
38 |
|
|
*/ |
39 |
|
|
template <class Scalar> |
40 |
|
|
class Region4 |
41 |
|
|
{ |
42 |
|
|
public: |
43 |
|
|
/*! |
44 |
|
|
* \brief Returns the saturation pressure in \f$\mathrm{[Pa]}\f$ of pure water at a given |
45 |
|
|
* temperature. |
46 |
|
|
* |
47 |
|
|
*\param temperature temperature of component in \f$\mathrm{[K]}\f$ |
48 |
|
|
* |
49 |
|
|
* The saturation pressure is often also called vapor pressure. This formulation is valid |
50 |
|
|
* for a temperature range between 273.15 K and 647.096 K (critical temperature). |
51 |
|
|
*/ |
52 |
|
230553592 |
static Scalar saturationPressure(Scalar temperature) |
53 |
|
|
{ |
54 |
|
|
constexpr Scalar n[10] = { |
55 |
|
|
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2, |
56 |
|
|
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2, |
57 |
|
|
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849, |
58 |
|
|
0.65017534844798e3 |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
230553592 |
const Scalar sigma = temperature + n[8]/(temperature - n[9]); |
62 |
|
|
|
63 |
|
230553592 |
const Scalar A = (sigma + n[0])*sigma + n[1]; |
64 |
|
230553592 |
const Scalar B = (n[2]*sigma + n[3])*sigma + n[4]; |
65 |
|
230553592 |
const Scalar C = (n[5]*sigma + n[6])*sigma + n[7]; |
66 |
|
|
|
67 |
|
|
using std::sqrt; |
68 |
|
230553592 |
Scalar tmp = 2*C/(sqrt(B*B - 4*A*C) - B); |
69 |
|
230553592 |
tmp *= tmp; |
70 |
|
230553592 |
tmp *= tmp; |
71 |
|
|
|
72 |
|
230553592 |
return 1e6*tmp; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
/*! |
76 |
|
|
* \brief Returns the saturation temperature in \f$\mathrm{[K]}\f$ of pure water at a given |
77 |
|
|
* pressure. |
78 |
|
|
* |
79 |
|
|
*\param pressure pressure of component in \f$\mathrm{[Pa]}\f$ |
80 |
|
|
* |
81 |
|
|
* The saturation pressure is often also called vapor pressure. |
82 |
|
|
*/ |
83 |
|
101966 |
static Scalar vaporTemperature(Scalar pressure) |
84 |
|
|
{ |
85 |
|
|
constexpr Scalar n[10] = { |
86 |
|
|
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2, |
87 |
|
|
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2, |
88 |
|
|
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849, |
89 |
|
|
0.65017534844798e3 |
90 |
|
|
}; |
91 |
|
|
|
92 |
|
|
using std::pow; |
93 |
|
|
using Dune::power; |
94 |
|
101966 |
const Scalar beta = pow((pressure/1e6 /*from Pa to MPa*/), (1./4.)); |
95 |
|
101966 |
const Scalar beta2 = power(beta, 2); |
96 |
|
101966 |
const Scalar E = beta2 + n[2] * beta + n[5]; |
97 |
|
101966 |
const Scalar F = n[0]*beta2 + n[3]*beta + n[6]; |
98 |
|
101966 |
const Scalar G = n[1]*beta2 + n[4]*beta + n[7]; |
99 |
|
|
|
100 |
|
|
using std::sqrt; |
101 |
|
101966 |
const Scalar D = ( 2.*G)/(-F -sqrt(power(F,2) - 4.*E*G)); |
102 |
|
101966 |
return (n[9] + D - sqrt(power(n[9]+D , 2) - 4.* (n[8] + n[9]*D)) ) * 0.5; |
103 |
|
|
} |
104 |
|
|
}; |
105 |
|
|
|
106 |
|
|
} // end namespace Dumux::IAPWS |
107 |
|
|
|
108 |
|
|
#endif |
109 |
|
|
|