3.2-git
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
34
35#include <cmath>
36#include <iostream>
37
38namespace Dumux {
39namespace IAPWS {
40
54template <class Scalar>
55class Common
56{
57public:
59 static constexpr Scalar molarMass = 18.01518e-3;
60
62 static constexpr Scalar Rs = Constants<Scalar>::R / molarMass;
63
65 static constexpr Scalar criticalTemperature = 647.096;
66
68 static constexpr Scalar criticalPressure = 22.064e6;
69
71 static constexpr Scalar criticalMolarVolume = molarMass / 322.0;
72
74 static constexpr Scalar acentricFactor = 0.344;
75
77 static constexpr Scalar criticalDensity = 322;
78
80 static constexpr Scalar tripleTemperature = 273.16;
81
83 static constexpr Scalar triplePressure = 611.657;
84
99 static Scalar viscosity(Scalar temperature, Scalar rho)
100 {
101 Scalar rhoBar = rho/322.0;
102 Scalar TBar = temperature/criticalTemperature;
103
104 // muBar = muBar_1
105 constexpr Scalar Hij[6][7] = {
106 { 5.20094e-1, 2.22531e-1,-2.81378e-1, 1.61913e-1,-3.25372e-2, 0, 0 },
107 { 8.50895e-2, 9.99115e-1,-9.06851e-1, 2.57399e-1, 0, 0, 0 },
108 {-1.08374 , 1.88797 ,-7.72479e-1, 0, 0, 0, 0 },
109 {-2.89555e-1, 1.26613 ,-4.89837e-1, 0, 6.98452e-2, 0,-4.35673e-3 },
110 { 0, 0,-2.57040e-1, 0, 0, 8.72102e-3, 0 },
111 { 0, 1.20573e-1, 0, 0, 0, 0,-5.93264e-4 }
112 };
113
114 Scalar tmp, tmp2, tmp3 = 1;
115 Scalar muBar = 0;
116 for (int i = 0; i <= 5; ++i) {
117 tmp = 0;
118 tmp2 = 1;
119 for (int j = 0; j <= 6; ++j) {
120 tmp += Hij[i][j]*tmp2;
121 tmp2 *= (rhoBar - 1);
122 }
123 muBar += tmp3 * tmp;
124 tmp3 *= 1.0/TBar - 1;
125 }
126 using std::exp;
127 muBar *= rhoBar;
128 muBar = exp(muBar);
129
130 // muBar *= muBar_0
131 using std::sqrt;
132 muBar *= 100*sqrt(TBar);
133 constexpr Scalar H[4] = {
134 1.67752, 2.20462, 0.6366564, -0.241605
135 };
136
137 tmp = 0, tmp2 = 1;
138 for (int i = 0; i < 4; ++i) {
139 tmp += H[i]/tmp2;
140 tmp2 *= TBar;
141 }
142 muBar /= tmp;
143
144 return 1e-6*muBar;
145 }
146
160 static Scalar thermalConductivityIAPWS(const Scalar T, const Scalar rho)
161 {
162 Scalar thcond_tstar = 647.26 ;
163 Scalar thcond_rhostar = 317.7 ;
164 /*static constexpr Scalar thcond_kstar = 1.0 ;*/
165
166 Scalar thcond_b0 = -0.397070 ;
167 Scalar thcond_b1 = 0.400302 ;
168 Scalar thcond_b2 = 1.060000 ;
169 Scalar thcond_B1 = -0.171587 ;
170 Scalar thcond_B2 = 2.392190 ;
171
172 Scalar thcond_c1 = 0.642857 ;
173 Scalar thcond_c2 = -4.11717 ;
174 Scalar thcond_c3 = -6.17937 ;
175 Scalar thcond_c4 = 0.00308976 ;
176 Scalar thcond_c5 = 0.0822994 ;
177 Scalar thcond_c6 = 10.0932 ;
178
179 Scalar thcond_d1 = 0.0701309 ;
180 Scalar thcond_d2 = 0.0118520 ;
181 Scalar thcond_d3 = 0.00169937 ;
182 Scalar thcond_d4 = -1.0200 ;
183 constexpr unsigned int thcond_a_count = 4;
184 Scalar thcond_a[thcond_a_count] = {
185 0.0102811
186 ,0.0299621
187 ,0.0156146
188 ,-0.00422464
189 };
190
191 Scalar Tbar = T / thcond_tstar;
192 Scalar rhobar = rho / thcond_rhostar;
193
194 /* fast implementation... minimised calls to 'pow' routine... */
195 using std::sqrt;
196 Scalar Troot = sqrt(Tbar);
197 Scalar Tpow = Troot;
198 Scalar lam = 0;
199
200 for(unsigned int k = 0; k < thcond_a_count; ++k) {
201 lam += thcond_a[k] * Tpow;
202 Tpow *= Tbar;
203 }
204
205 using std::exp;
206 lam += thcond_b0 + thcond_b1
207 * rhobar + thcond_b2
208 * exp(thcond_B1 * ((rhobar + thcond_B2)*(rhobar + thcond_B2)));
209
210 using std::abs;
211 using std::pow;
212 Scalar DTbar = abs(Tbar - 1) + thcond_c4;
213 Scalar DTbarpow = pow(DTbar, 3./5);
214 Scalar Q = 2. + thcond_c5 / DTbarpow;
215
216 Scalar S;
217 if(Tbar >= 1){
218 S = 1. / DTbar;
219 }else{
220 S = thcond_c6 / DTbarpow;
221 }
222
223 Scalar rhobar18 = pow(rhobar, 1.8);
224 Scalar rhobarQ = pow(rhobar, Q);
225
226 lam +=
227 (thcond_d1 / pow(Tbar,10) + thcond_d2) * rhobar18 *
228 exp(thcond_c1 * (1 - rhobar * rhobar18))
229 + thcond_d3 * S * rhobarQ *
230 exp((Q/(1+Q))*(1 - rhobar*rhobarQ))
231 + thcond_d4 *
232 exp(thcond_c2 * pow(Troot,3) + thcond_c3 / pow(rhobar,5));
233 return /*thcond_kstar * */ lam;
234 }
235};
236
237} // end namespace IAPWS
238} // end namespace Dumux
239
240#endif
A central place for various physical constants occuring in some equations.
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
Implements relations which are common for all regions of the IAPWS '97 formulation.
Definition: common.hh:56
static constexpr Scalar criticalMolarVolume
Critical molar volume of water .
Definition: common.hh:71
static constexpr Scalar Rs
Specific gas constant of water .
Definition: common.hh:62
static constexpr Scalar triplePressure
Triple pressure of water .
Definition: common.hh:83
static constexpr Scalar molarMass
The molar mass of water .
Definition: common.hh:59
static Scalar viscosity(Scalar temperature, Scalar rho)
The dynamic viscosity of pure water.
Definition: common.hh:99
static constexpr Scalar acentricFactor
The acentric factor of water .
Definition: common.hh:74
static constexpr Scalar criticalTemperature
Critical temperature of water .
Definition: common.hh:65
static constexpr Scalar criticalDensity
Density of water at the critical point .
Definition: common.hh:77
static constexpr Scalar tripleTemperature
Triple temperature of water .
Definition: common.hh:80
static constexpr Scalar criticalPressure
Critical pressure of water .
Definition: common.hh:68
static Scalar thermalConductivityIAPWS(const Scalar T, const Scalar rho)
Thermal conductivity water (IAPWS) .
Definition: common.hh:160
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39