OGS
TESOGS5MaterialModels.h
Go to the documentation of this file.
1
10#pragma once
11
13#include "TESAssemblyParams.h"
14
15namespace ProcessLib
16{
17namespace TES
18{
19inline double fluid_density(const double p, const double T, const double x)
20{
21 // OGS-5 density model 26
22
25
26 const double xn = M0 * x / (M0 * x + M1 * (1.0 - x));
27
29 (M1 * xn + M0 * (1.0 - xn));
30 ;
31}
32
33template <int i>
34double mypow(const double x)
35{
36 if (i < 0)
37 {
38 return 1.0 / mypow<-i>(x);
39 }
40
41 const double p = mypow<(i >> 1)>(x);
42 return (i & 1) ? p * p * x : p * p;
43}
44
45template <>
46inline double mypow<0>(const double /*x*/)
47{
48 return 1.0;
49}
50
52{
53 static double get(double rho, double T)
54 {
55 const double rho_c = 314; // [kg/m3]
56 const double CVF = 14.058; // [1e-3 Pa-s]
57
58 const double sigma = 0.36502496e-09;
59 const double k = 1.38062e-23;
60 const double eps = 138.08483e-23;
61 const double c1 = 0.3125;
62 const double c2 = 2.0442e-49;
63
64 const double T_star = T * k / eps;
65 rho = rho / rho_c;
66
67 double Omega = loop1_term<0>(T_star);
68 Omega += loop1_term<1>(T_star);
69 Omega += loop1_term<2>(T_star);
70 Omega += loop1_term<3>(T_star);
71 Omega += loop1_term<4>(T_star);
72
73 Omega = std::exp(Omega);
74
75 // eta in [Pa*s]
76 const double eta_0 = c1 * std::sqrt(c2 * T) / (sigma * sigma * Omega);
77
78 double sum = loop2_term<2>(rho);
79 sum += loop2_term<3>(rho);
80 sum += loop2_term<4>(rho);
81
82 //
83 const double eta_r =
84 CVF * 1e-6 * (C[0] / (rho - C[1]) + C[0] / C[1] + sum);
85
86 return eta_0 + eta_r; // [Pa*s]
87 }
88
89private:
90 template <unsigned i>
91 static double loop1_term(double T_star)
92 {
93 return A[i] * mypow<i>(log(T_star));
94 }
95
96 template <unsigned i>
97 static double loop2_term(double rho)
98 {
99 return C[i] * mypow<i - 1>(rho);
100 }
101
102 static const double A[5];
103 static const double C[5];
104};
105
107{
108 static double get(double rho, double T)
109 {
110 double my, my_0, my_1;
111 double H[4];
112
113 T = T / 647.096;
114 rho = rho / 322.0;
115
116 H[0] = 1.67752;
117 H[1] = 2.20462;
118 H[2] = 0.6366564;
119 H[3] = -0.241605;
120
121 double h[6][7] = {{0.0}};
122 h[0][0] = 0.520094000;
123 h[1][0] = 0.085089500;
124 h[2][0] = -1.083740000;
125 h[3][0] = -0.289555000;
126 h[0][1] = 0.222531000;
127 h[1][1] = 0.999115000;
128 h[2][1] = 1.887970000;
129 h[3][1] = 1.266130000;
130 h[5][1] = 0.120573000;
131 h[0][2] = -0.281378000;
132 h[1][2] = -0.906851000;
133 h[2][2] = -0.772479000;
134 h[3][2] = -0.489837000;
135 h[4][2] = -0.257040000;
136 h[0][3] = 0.161913000;
137 h[1][3] = 0.257399000;
138 h[0][4] = -0.032537200;
139 h[3][4] = 0.069845200;
140 h[4][5] = 0.008721020;
141 h[3][6] = -0.004356730;
142 h[5][6] = -0.000593264;
143
144 double sum1 = H[0] / mypow<0>(T);
145 sum1 += H[1] / mypow<1>(T);
146 sum1 += H[2] / mypow<2>(T);
147 sum1 += H[3] / mypow<3>(T);
148
149 my_0 = 100 * std::sqrt(T) / sum1;
150
151 double sum2 = inner_loop<0>(rho, T, h);
152 sum2 += inner_loop<1>(rho, T, h);
153 sum2 += inner_loop<2>(rho, T, h);
154 sum2 += inner_loop<3>(rho, T, h);
155 sum2 += inner_loop<4>(rho, T, h);
156 sum2 += inner_loop<5>(rho, T, h);
157
158 my_1 = std::exp(rho * sum2);
159
160 my = (my_0 * my_1) / 1e6;
161 return my;
162 }
163
164private:
165 template <int i>
166 static double inner_loop(const double rho,
167 const double T,
168 const double (&h)[6][7])
169 {
170 const double base = rho - 1.0;
171
172 double sum3 = h[i][0] * mypow<0>(base);
173 sum3 += h[i][1] * mypow<1>(base);
174 sum3 += h[i][2] * mypow<2>(base);
175 sum3 += h[i][3] * mypow<3>(base);
176 sum3 += h[i][4] * mypow<4>(base);
177 sum3 += h[i][5] * mypow<5>(base);
178 sum3 += h[i][6] * mypow<6>(base);
179
180 return mypow<i>(1 / T - 1) * sum3;
181 }
182};
183
184inline double fluid_viscosity(const double p, const double T, const double x)
185{
186 // OGS 5 viscosity model 26
187
191
192 // reactive component
193 const double x0 =
194 M0 * x / (M0 * x + M1 * (1.0 - x)); // mass in mole fraction
195 const double V0 = FluidViscosityH2O::get(M1 * p / (R * T), T);
196 // inert component
197 const double x1 = 1.0 - x0;
198 const double V1 = FluidViscosityN2::get(M0 * p / (R * T), T);
199
200 const double M0_over_M1(M1 / M0); // reactive over inert
201 const double V0_over_V1(V0 / V1);
202
203 const double phi_12 = mypow<2>(1.0 + std::sqrt(V0_over_V1) *
204 std::pow(1.0 / M0_over_M1, 0.25)) /
205 std::sqrt(8.0 * (1.0 + M0_over_M1));
206
207 const double phi_21 = phi_12 * M0_over_M1 / V0_over_V1;
208
209 return V0 * x0 / (x0 + x1 * phi_12) + V1 * x1 / (x1 + x0 * phi_21);
210}
211
213{
214 static double get(double rho, double T)
215 {
216 const double X1 = 0.95185202;
217 const double X2 = 1.0205422;
218
219 const double rho_c = 314; // [kg/m3]
220 const double M = 28.013;
221 const double k = 1.38062e-23;
222 const double eps = 138.08483e-23;
223 const double N_A = 6.02213E26;
224 const double R = 8.31434;
225 // const double R = MaterialLib::PhysicalConstant::IdealGasConstant;
226 const double CCF = 4.173; // mW/m/K
227
228 const double c1 = 0.3125;
229 const double c2 = 2.0442e-49;
230 const double sigma = 0.36502496e-09;
231
232 rho /= rho_c;
233
234 // dilute heat conductivity
235 const double sum1 = loop1_term<0>(T) + loop1_term<1>(T) +
238 loop1_term<6>(T);
239 const double temp = std::expm1(f[8] / T);
240 const double c_v0 =
241 R *
242 (sum1 + ((f[7] * (f[8] / T) * (f[8] / T) * (std::exp((f[8] / T)))) /
243 (temp * temp) -
244 1));
245
246 double cvint;
247 cvint = c_v0 * 1000 / N_A;
248
249 // dilute gas viscosity
250 const double log_T_star = std::log(T * k / eps);
251
252 const double Omega =
253 std::exp(loop2_term<0>(log_T_star) + loop2_term<1>(log_T_star) +
254 loop2_term<2>(log_T_star) + loop2_term<3>(log_T_star) +
255 loop2_term<4>(log_T_star));
256
257 // eta in [Pa*s]
258 const double eta_0 =
259 1e6 * (c1 * std::sqrt(c2 * T) / (sigma * sigma * Omega));
260
261 const double F = eta_0 * k * N_A / (M * 1000);
262
263 const double lambda_tr = 2.5 * (1.5 - X1);
264 const double lambda_in = X2 * (cvint / k + X1);
265
266 const double lambda_0 = F * (lambda_tr + lambda_in);
267
268 const double sum2 = loop3_term<0>(rho) + loop3_term<1>(rho) +
269 loop3_term<2>(rho) + loop3_term<3>(rho);
270 const double lambda_r = sum2 * CCF;
271
272 return (lambda_0 + lambda_r) / 1000; // lambda in [W/m/K]
273 }
274
275private:
276 template <int i>
277 static double loop1_term(const double T)
278 {
279 return f[i] * mypow<i - 3>(T);
280 }
281
282 template <int i>
283 static double loop2_term(const double log_T_star)
284 {
285 return A[i] * mypow<i>(log_T_star);
286 }
287
288 template <int i>
289 static double loop3_term(const double rho)
290 {
291 return C[i] * mypow<i + 1>(rho);
292 }
293
294 const static double A[5];
295 const static double f[9];
296 const static double C[4];
297};
298
300{
301 static double get(double rho, double T)
302 {
303 double S, Q;
304 double b[3], B[2], d[4], C[6];
305
306 T /= 647.096;
307 rho /= 317.11;
308
309 b[0] = -0.397070;
310 b[1] = 0.400302;
311 b[2] = 1.060000;
312
313 B[0] = -0.171587;
314 B[1] = 2.392190;
315
316 d[0] = 0.0701309;
317 d[1] = 0.0118520;
318 d[2] = 0.00169937;
319 d[3] = -1.0200;
320
321 C[0] = 0.642857;
322 C[1] = -4.11717;
323 C[2] = -6.17937;
324 C[3] = 0.00308976;
325 C[4] = 0.0822994;
326 C[5] = 10.0932;
327
328 const double sum1 = loop_term<0>(T) + loop_term<1>(T) +
330
331 const double lambda_0 = std::sqrt(T) * sum1;
332 const double lambda_1 =
333 b[0] + b[1] * rho +
334 b[2] * std::exp(B[0] * (rho + B[1]) * (rho + B[1]));
335
336 const double dT = fabs(T - 1) + C[3];
337 const double dT_pow_3_5 = std::pow(dT, 3. / 5.);
338 Q = 2 + (C[4] / dT_pow_3_5);
339
340 if (T >= 1)
341 {
342 S = 1 / dT;
343 }
344 else
345 {
346 S = C[5] / dT_pow_3_5;
347 }
348
349 const double rho_pow_9_5 = std::pow(rho, 9. / 5.);
350 const double rho_pow_Q = std::pow(rho, Q);
351 const double T_pow_3_2 = T * std::sqrt(T);
352 const double lambda_2 =
353 (d[0] / mypow<10>(T) + d[1]) * rho_pow_9_5 *
354 std::exp(C[0] * (1 - rho * rho_pow_9_5)) +
355 d[2] * S * rho_pow_Q *
356 std::exp((Q / (1. + Q)) * (1 - rho * rho_pow_Q)) +
357 d[3] * std::exp(C[1] * T_pow_3_2 + C[2] / mypow<5>(rho));
358
359 return lambda_0 + lambda_1 + lambda_2; // lambda in [W/m/K]
360 }
361
362private:
363 template <unsigned i>
364 static double loop_term(const double T)
365 {
366 return a[i] * mypow<i>(T);
367 }
368
369 static const double a[4];
370};
371
372inline double fluid_heat_conductivity(const double p,
373 const double T,
374 const double x)
375{
376 // OGS 5 fluid heat conductivity model 11
377
381
382 // TODO [CL] max() is redundant if the fraction is guaranteed to be between
383 // 0 and 1.
384 // reactive component
385 const double x0 = std::max(M0 * x / (M0 * x + M1 * (1.0 - x)),
386 0.); // convert mass to mole fraction
387 const double k0 = FluidHeatConductivityH2O::get(M1 * p / (R * T), T);
388 // inert component
389 const double x1 = 1.0 - x0;
390 const double k1 = FluidHeatConductivityN2::get(M0 * p / (R * T), T);
391
392 const double M1_over_M2 = M1 / M0; // reactive over inert
393 const double V1_over_V2 = FluidViscosityH2O::get(M1 * p / (R * T), T) /
394 FluidViscosityN2::get(M0 * p / (R * T), T);
395 const double L1_over_L2 = V1_over_V2 / M1_over_M2;
396
397 const double M12_pow_mquarter = std::pow(M1_over_M2, -0.25);
398 const double phi_12 = (1.0 + std::sqrt(L1_over_L2) * M12_pow_mquarter) *
399 (1.0 + std::sqrt(V1_over_V2) * M12_pow_mquarter) /
400 std::sqrt(8.0 * (1.0 + M1_over_M2));
401 const double phi_21 = phi_12 * M1_over_M2 / V1_over_V2;
402
403 return k0 * x0 / (x0 + x1 * phi_12) + k1 * x1 / (x1 + x0 * phi_21);
404}
405
406} // namespace TES
407} // namespace ProcessLib
double mypow(const double x)
double fluid_heat_conductivity(const double p, const double T, const double x)
double mypow< 0 >(const double)
double fluid_viscosity(const double p, const double T, const double x)
double fluid_density(const double p, const double T, const double x)
static double get(double rho, double T)
static double loop2_term(const double log_T_star)
static double get(double rho, double T)
static double loop3_term(const double rho)
static double inner_loop(const double rho, const double T, const double(&h)[6][7])
static double get(double rho, double T)
static double loop1_term(double T_star)
static double get(double rho, double T)