3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
common.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 * 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 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
30#ifndef DUMUX_IAPWS_COMMON_HH
31#define DUMUX_IAPWS_COMMON_HH
32
33#include <cmath>
34#include <iostream>
35
36#include <dune/common/math.hh>
37
39
40namespace Dumux::IAPWS {
41
55template <class Scalar>
56class Common
57{
58public:
60 static constexpr Scalar molarMass = 18.01518e-3;
61
63 static constexpr Scalar Rs = Constants<Scalar>::R / molarMass;
64
66 static constexpr Scalar criticalTemperature = 647.096;
67
69 static constexpr Scalar criticalPressure = 22.064e6;
70
72 static constexpr Scalar criticalMolarVolume = molarMass / 322.0;
73
75 static constexpr Scalar acentricFactor = 0.344;
76
78 static constexpr Scalar criticalDensity = 322;
79
81 static constexpr Scalar tripleTemperature = 273.16;
82
84 static constexpr Scalar triplePressure = 611.657;
85
100 static Scalar viscosity(Scalar temperature, Scalar rho)
101 {
102 const Scalar rhoBar = rho/322.0;
103 const Scalar TBar = temperature/criticalTemperature;
104
105 // muBar = muBar_1
106 constexpr Scalar Hij[6][7] = {
107 { 5.20094e-1, 2.22531e-1,-2.81378e-1, 1.61913e-1,-3.25372e-2, 0, 0 },
108 { 8.50895e-2, 9.99115e-1,-9.06851e-1, 2.57399e-1, 0, 0, 0 },
109 {-1.08374 , 1.88797 ,-7.72479e-1, 0, 0, 0, 0 },
110 {-2.89555e-1, 1.26613 ,-4.89837e-1, 0, 6.98452e-2, 0,-4.35673e-3 },
111 { 0, 0,-2.57040e-1, 0, 0, 8.72102e-3, 0 },
112 { 0, 1.20573e-1, 0, 0, 0, 0,-5.93264e-4 }
113 };
114
115 Scalar tmp, tmp2, tmp3 = 1;
116 Scalar muBar = 0;
117 for (int i = 0; i <= 5; ++i) {
118 tmp = 0;
119 tmp2 = 1;
120 for (int j = 0; j <= 6; ++j) {
121 tmp += Hij[i][j]*tmp2;
122 tmp2 *= (rhoBar - 1);
123 }
124 muBar += tmp3 * tmp;
125 tmp3 *= 1.0/TBar - 1;
126 }
127 using std::exp;
128 muBar *= rhoBar;
129 muBar = exp(muBar);
130
131 // muBar *= muBar_0
132 using std::sqrt;
133 muBar *= 100*sqrt(TBar);
134 constexpr Scalar H[4] = {
135 1.67752, 2.20462, 0.6366564, -0.241605
136 };
137
138 tmp = 0, tmp2 = 1;
139 for (int i = 0; i < 4; ++i) {
140 tmp += H[i]/tmp2;
141 tmp2 *= TBar;
142 }
143 muBar /= tmp;
144
145 return 1e-6*muBar;
146 }
147
161 static Scalar thermalConductivityIAPWS(const Scalar T, const Scalar rho)
162 {
163 constexpr Scalar thcond_tstar = 647.26 ;
164 constexpr Scalar thcond_rhostar = 317.7 ;
165 /*static constexpr Scalar thcond_kstar = 1.0 ;*/
166
167 constexpr Scalar thcond_b0 = -0.397070 ;
168 constexpr Scalar thcond_b1 = 0.400302 ;
169 constexpr Scalar thcond_b2 = 1.060000 ;
170 constexpr Scalar thcond_B1 = -0.171587 ;
171 constexpr Scalar thcond_B2 = 2.392190 ;
172
173 constexpr Scalar thcond_c1 = 0.642857 ;
174 constexpr Scalar thcond_c2 = -4.11717 ;
175 constexpr Scalar thcond_c3 = -6.17937 ;
176 constexpr Scalar thcond_c4 = 0.00308976 ;
177 constexpr Scalar thcond_c5 = 0.0822994 ;
178 constexpr Scalar thcond_c6 = 10.0932 ;
179
180 constexpr Scalar thcond_d1 = 0.0701309 ;
181 constexpr Scalar thcond_d2 = 0.0118520 ;
182 constexpr Scalar thcond_d3 = 0.00169937 ;
183 constexpr Scalar thcond_d4 = -1.0200 ;
184 constexpr unsigned int thcond_a_count = 4;
185 constexpr Scalar thcond_a[thcond_a_count] = {
186 0.0102811
187 ,0.0299621
188 ,0.0156146
189 ,-0.00422464
190 };
191
192 const Scalar Tbar = T / thcond_tstar;
193 const Scalar rhobar = rho / thcond_rhostar;
194
195 /* fast implementation... minimised calls to 'pow' routine... */
196 using std::sqrt;
197 const Scalar Troot = sqrt(Tbar);
198 Scalar Tpow = Troot;
199 Scalar lam = 0;
200
201 for(unsigned int k = 0; k < thcond_a_count; ++k) {
202 lam += thcond_a[k] * Tpow;
203 Tpow *= Tbar;
204 }
205
206 using std::exp;
207 lam += thcond_b0 + thcond_b1
208 * rhobar + thcond_b2
209 * exp(thcond_B1 * ((rhobar + thcond_B2)*(rhobar + thcond_B2)));
210
211 using std::abs;
212 using std::pow;
213 using Dune::power;
214 const Scalar DTbar = abs(Tbar - 1) + thcond_c4;
215 const Scalar DTbarpow = pow(DTbar, 3./5);
216 const Scalar Q = 2. + thcond_c5 / DTbarpow;
217 const Scalar S = (Tbar >= 1) ? 1. / DTbar : thcond_c6 / DTbarpow;
218
219 const Scalar rhobar18 = pow(rhobar, 1.8);
220 const Scalar rhobarQ = pow(rhobar, Q);
221
222 lam +=
223 (thcond_d1 / power(Tbar,10) + thcond_d2) * rhobar18 *
224 exp(thcond_c1 * (1 - rhobar * rhobar18))
225 + thcond_d3 * S * rhobarQ *
226 exp((Q/(1+Q))*(1 - rhobar*rhobarQ))
227 + thcond_d4 *
228 exp(thcond_c2 * power(Troot,3) + thcond_c3 / power(rhobar,5));
229 return /*thcond_kstar * */ lam;
230 }
231};
232
233} // end namespace Dumux::IAPWS
234
235#endif
A central place for various physical constants occuring in some equations.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
Definition: common.hh:40
Implements relations which are common for all regions of the IAPWS '97 formulation.
Definition: common.hh:57
static constexpr Scalar criticalMolarVolume
Critical molar volume of water .
Definition: common.hh:72
static constexpr Scalar Rs
Specific gas constant of water .
Definition: common.hh:63
static constexpr Scalar triplePressure
Triple pressure of water .
Definition: common.hh:84
static constexpr Scalar molarMass
The molar mass of water .
Definition: common.hh:60
static Scalar viscosity(Scalar temperature, Scalar rho)
The dynamic viscosity of pure water.
Definition: common.hh:100
static constexpr Scalar acentricFactor
The acentric factor of water .
Definition: common.hh:75
static constexpr Scalar criticalTemperature
Critical temperature of water .
Definition: common.hh:66
static constexpr Scalar criticalDensity
Density of water at the critical point .
Definition: common.hh:78
static constexpr Scalar tripleTemperature
Triple temperature of water .
Definition: common.hh:81
static constexpr Scalar criticalPressure
Critical pressure of water .
Definition: common.hh:69
static Scalar thermalConductivityIAPWS(const Scalar T, const Scalar rho)
Thermal conductivity water (IAPWS) .
Definition: common.hh:161
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39