My Project
Loading...
Searching...
No Matches
H2.hpp
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 This file is part of the Open Porous Media project (OPM).
5
6 OPM 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 2 of the License, or
9 (at your option) any later version.
10
11 OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
31#ifndef OPM_H2_HPP
32#define OPM_H2_HPP
33
38
39#include <cmath>
40
41namespace Opm {
42
43// this class collects all the H2tabulated quantities in one convenient place
44struct H2Tables {
45 static const Opm::UniformTabulated2DFunction<double> tabulatedEnthalpy;
46 static const Opm::UniformTabulated2DFunction<double> tabulatedDensity;
47 static constexpr double brineSalinity = 1.000000000000000e-01;
48};
49
51 typedef double Scalar;
52 static const char *name;
53 static const int numX = 200;
54 static const Scalar xMin;
55 static const Scalar xMax;
56 static const int numY = 500;
57 static const Scalar yMin;
58 static const Scalar yMax;
59
60 static const Scalar vals[200][500];
61};
62
64 typedef double Scalar;
65 static const char *name;
66 static const int numX = 200;
67 static const Scalar xMin;
68 static const Scalar xMax;
69 static const int numY = 500;
70 static const Scalar yMin;
71 static const Scalar yMax;
72 static const Scalar vals[200][500];
73};
74
88template <class Scalar>
89class H2 : public Component<Scalar, H2<Scalar> >
90{
92
93 static const UniformTabulated2DFunction<double>& tabulatedEnthalpy;
94 static const UniformTabulated2DFunction<double>& tabulatedDensity;
95
96public:
97 // For H2Tables class
98 static const Scalar brineSalinity;
99
103 static std::string name()
104 { return "H2"; }
105
109 static constexpr Scalar molarMass()
110 { return 2.01588e-3; }
111
115 static Scalar criticalTemperature()
116 { return 33.145; /* [K] */ }
117
121 static Scalar criticalPressure()
122 { return 1.2964e6; /* [N/m^2] */ }
123
127 static Scalar criticalDensity()
128 { return 15.508e-3; /* [mol/cm^3] */ }
129
133 static Scalar tripleTemperature()
134 { return 13.957; /* [K] */ }
135
139 static Scalar triplePressure()
140 { return 0.00736e6; /* [N/m^2] */ }
141
145 static Scalar tripleDensity()
146 { return 38.2e-3; /* [mol/cm^3] */ }
147
151 static Scalar criticalVolume() {return 6.45e-2; }
152
156 static Scalar acentricFactor() { return -0.22; }
157
165 template <class Evaluation>
166 static Evaluation vaporPressure(Evaluation temperature)
167 {
168 if (temperature > criticalTemperature())
169 return criticalPressure();
170 if (temperature < tripleTemperature())
171 return 0; // H2 is solid: We don't take sublimation into
172 // account
173
174 // Intermediate calculations involving temperature
175 Evaluation sigma = 1 - temperature/criticalTemperature();
176 Evaluation T_recp = criticalTemperature() / temperature;
177
178 // Parameters for normal hydrogen in Table 8
179 static const Scalar N[4] = {-4.89789, 0.988558, 0.349689, 0.499356};
180 static const Scalar k[4] = {1.0, 1.5, 2.0, 2.85};
181
182 // Eq. (33)
183 Evaluation s = 0.0; // sum calculation
184 for (int i = 0; i < 4; ++i) {
185 s += N[i] * pow(sigma, k[i]);
186 }
187 Evaluation lnPsigmaPc = T_recp * s;
188
189 return exp(lnPsigmaPc) * criticalPressure();
190 }
191
198 template <class Evaluation>
199 static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate = false)
200 {
201 return tabulatedDensity.eval(temperature, pressure, extrapolate);
202 }
203
210 template <class Evaluation>
211 static Evaluation gasMolarDensity(Evaluation temperature, Evaluation pressure, bool extrapolate = false)
212 { return gasDensity(temperature, pressure, extrapolate) / molarMass(); }
213
217 static constexpr bool gasIsCompressible()
218 { return true; }
219
223 static constexpr bool gasIsIdeal()
224 { return false; }
225
232 template <class Evaluation>
233 static Evaluation gasPressure(Evaluation temperature, Evaluation density)
234 {
235 // Eq. (56) in Span et al. (2000)
236 Scalar R = IdealGas::R;
237 Evaluation rho_red = density / (molarMass() * criticalDensity() * 1e6);
238 Evaluation T_red = H2::criticalTemperature() / temperature;
239 return rho_red * criticalDensity() * R * temperature
240 * (1 + rho_red * derivResHelmholtzWrtRedRho(T_red, rho_red));
241 }
242
246 template <class Evaluation>
247 static Evaluation gasInternalEnergy(const Evaluation& temperature,
248 const Evaluation& pressure,
249 bool extrapolate = false)
250 {
251 const Evaluation h = gasEnthalpy(temperature, pressure, extrapolate);
252 const Evaluation rho = gasDensity(temperature, pressure, extrapolate);
253
254 return h - (pressure / rho);
255 }
256
263 template <class Evaluation>
264 static const Evaluation gasEnthalpy(Evaluation temperature,
265 Evaluation pressure,
266 bool extrapolate = false)
267 {
268 return tabulatedEnthalpy.eval(temperature, pressure, extrapolate);
269 }
270
280 template <class Evaluation>
281 static Evaluation gasViscosity(const Evaluation& temperature,
282 const Evaluation& pressure,
283 bool extrapolate = false)
284 {
285 // Some needed parameters and variables
286 const Scalar M = molarMass() * 1e3; // g/mol
287 const Scalar epsilon_div_kb = 30.41;
288 const Scalar sigma = 0.297; // nm
289 const Scalar Na = 6.022137e23; // Avogadro's number
290
291 Evaluation T_star = temperature / epsilon_div_kb;
292 Evaluation ln_T_star = log(T_star);
293 Evaluation T_r = temperature / criticalTemperature();
294 Evaluation rho = gasDensity(temperature, pressure, extrapolate);
295 Evaluation rho_r = rho / 90.909090909; // see corrections
296
297 //
298 // Eta_0 terms (zero-density viscocity)
299 //
300 // Parameters in Table 2 for Eq. (4)
301 static constexpr Scalar a[5] =
302 {2.0963e-1, -4.55274e-1, 1.43602e-1, -3.35325e-2, 2.76981e-3};
303
304 // Eq. (4)
305 Evaluation ln_S_star = 0.0;
306 for (int i = 0; i < 5; ++i) {
307 ln_S_star += a[i] * pow(ln_T_star, i);
308 }
309
310 // Eq. (3)
311 Evaluation eta_0 = 0.021357 * sqrt(M * temperature) / (sigma * sigma * exp(ln_S_star));
312
313 //
314 // Eta_1 terms (excess contribution)
315 //
316 //
317 // Parameters in Table 3 for Eq. (7)
318 static constexpr Scalar b[7] =
319 {-0.187, 2.4871, 3.7151, -11.0972, 9.0965, -3.8292, 0.5166};
320
321 // Eq. (7) with corrections
322 Evaluation B_star = 0.0;
323 for (int i = 0; i < 7; ++i) {
324 B_star += b[i] * pow(T_star, -i);
325 }
326
327 // Eq. (9) (eta_1 part) using Eq. (5-7) with corrections and sigma in m (instead of nm). Note that Na * sigma_m
328 // ^ 3 have unit [m3/mol], so we need to multiply with molar density (= rho / molarMass) and not mass density in
329 // Eq. (9)
330 const Scalar sigma_m = sigma * 1e-9;
331 Evaluation eta_1 = B_star * Na * sigma_m * sigma_m * sigma_m * eta_0 * rho / M;
332
333 //
334 // delta eta_h terms (higher-order effects)
335 //
336 // Parameters in Table 4 for Eq. (9)
337 static constexpr Scalar c[6] =
338 {6.43449673, 4.56334068e-2, 2.32797868e-1, 9.58326120e-1, 1.27941189e-1, 3.63576595e-1};
339
340 // delta eta_h terms in Eq. (9)
341 Evaluation delta_eta_h = c[0] * rho_r * rho_r * exp(c[1] * T_r + c[2] / T_r +
342 (c[3] * rho_r * rho_r) / (c[4] + T_r) + c[5] * pow(rho_r, 6));
343
344 // return all terms in Eq. (9) converted from muPa*s to Pa*s
345 return (eta_0 + eta_1 + delta_eta_h) * 1e-6;
346 }
347
356 template <class Evaluation>
357 static const Evaluation gasHeatCapacity(Evaluation temperature,
358 Evaluation pressure)
359 {
360 // Reduced variables
361 Evaluation rho_red = reducedMolarDensity(temperature, pressure);
362 Evaluation T_red = criticalTemperature() / temperature;
363
364 // Need Eq. (62) in Span et al. (2000)
365 Evaluation cv = gasIsochoricHeatCapacity(temperature, pressure); // [J/(kg*K)]
366
367 // Some intermediate calculations
368 Evaluation numerator = pow(1 + rho_red * derivResHelmholtzWrtRedRho(T_red, rho_red)
369 - rho_red * T_red * secDerivResHelmholtzWrtRecipRedTempAndRedRho(T_red, rho_red), 2);
370
371 Evaluation denominator = 1 + 2 * rho_red * derivResHelmholtzWrtRedRho(T_red, rho_red)
372 + pow(rho_red, 2) * secDerivResHelmholtzWrtRedRho(T_red, rho_red);
373
374 // Eq. (63) in Span et al. (2000).
375 Scalar R = IdealGas::R;
376 Evaluation cp = cv + R * (numerator / denominator) / molarMass(); // divide by M to get [J/(kg*K)]
377
378 // Return
379 return cp;
380 }
381
389 template <class Evaluation>
390 static const Evaluation gasIsochoricHeatCapacity(Evaluation temperature,
391 Evaluation pressure)
392 {
393 // Reduced variables
394 Evaluation rho_red = reducedMolarDensity(temperature, pressure);
395 Evaluation T_red = criticalTemperature() / temperature;
396
397 // Eq. (62) in Span et al. (2000)
398 Scalar R = IdealGas::R;
399 Evaluation cv = R * (-pow(T_red, 2) * (secDerivIdealHelmholtzWrtRecipRedTemp(T_red)
400 + secDerivResHelmholtzWrtRecipRedTemp(T_red, rho_red))); // [J/(mol*K)]
401
402 return cv / molarMass();
403 }
411 template <class Evaluation>
412 static Evaluation reducedMolarDensity(const Evaluation& temperature,
413 const Evaluation& pg,
414 bool extrapolate = false)
415 {
416 return gasDensity(temperature, pg, extrapolate) / (molarMass() * criticalDensity() * 1e6);
417 }
418
425 template <class Evaluation>
426 static Evaluation idealGasPartHelmholtz(const Evaluation& T_red, const Evaluation& rho_red)
427 {
428 // Eq. (31), which can be compared with Eq. (53) in Span et al. (2000)
429 // Terms not in sum
430 Evaluation s1 = log(rho_red) + 1.5*log(T_red) + a_[0] + a_[1] * T_red;
431
432 // Sum term
433 Evaluation s2 = 0.0;
434 for (int i = 2; i < 7; ++i) {
435 s1 += a_[i] * log(1 - exp(b_[i-2] * T_red));
436 }
437
438 // Return total
439 Evaluation s = s1 + s2;
440 return s;
441 }
442
448 template <class Evaluation>
449 static Evaluation derivIdealHelmholtzWrtRecipRedTemp(const Evaluation& T_red)
450 {
451 // Derivative of Eq. (31) wrt. reciprocal reduced temperature, which can be compared with Eq. (79) in Span et
452 // al. (2000)
453 // Terms not in sum
454 Evaluation s1 = (1.5 / T_red) + a_[1];
455
456 // Sum term
457 Evaluation s2 = 0.0;
458 for (int i = 2; i < 7; ++i) {
459 s2 += (-a_[i] * b_[i-2] * exp(b_[i-2] * T_red)) / (1 - exp(b_[i-2] * T_red));
460 }
461
462 // Return total
463 Evaluation s = s1 + s2;
464 return s;
465 }
466
473 template <class Evaluation>
474 static Evaluation secDerivIdealHelmholtzWrtRecipRedTemp(const Evaluation& T_red)
475 {
476 // Second derivative of Eq. (31) wrt. reciprocal reduced temperature, which can be compared with Eq. (80) in
477 // Span et al. (2000)
478 // Sum term
479 Evaluation s1 = 0.0;
480 for (int i = 2; i < 7; ++i) {
481 s1 += (-a_[i] * pow(b_[i-2], 2) * exp(b_[i-2] * T_red)) / pow(1 - exp(b_[i-2] * T_red), 2);
482 }
483
484 // Return total
485 Evaluation s = (-1.5 / pow(T_red, 2)) + s1;
486 return s;
487 }
488
495 template <class Evaluation>
496 static Evaluation residualPartHelmholtz(const Evaluation& T_red, const Evaluation& rho_red)
497 {
498 // Eq. (32), which can be compared with Eq. (55) in Span et al. (2000)
499 // First sum term
500 Evaluation s1 = 0.0;
501 for (int i = 0; i < 7; ++i) {
502 s1 += N_[i] * pow(rho_red, d_[i]) * pow(T_red, t_[i]);
503 }
504
505 // Second sum term
506 Evaluation s2 = 0.0;
507 for (int i = 7; i < 9; ++i) {
508 s2 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]) * exp(-pow(rho_red, p_[i-7]));
509 }
510
511 // Third, and last, sum term
512 Evaluation s3 = 0.0;
513 for (int i = 9; i < 14; ++i) {
514 s3 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]) *
515 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2));
516 }
517
518 // Return total sum
519 Evaluation s = s1 + s2 + s3;
520 return s;
521 }
522
529 template <class Evaluation>
530 static Evaluation derivResHelmholtzWrtRedRho(const Evaluation& T_red, const Evaluation& rho_red)
531 {
532 // Derivative of Eq. (32) wrt to reduced density, which can be compared with Eq. (81) in Span et al. (2000)
533 // First sum term
534 Evaluation s1 = 0.0;
535 for (int i = 0; i < 7; ++i) {
536 s1 += d_[i] * N_[i] * pow(rho_red, d_[i]-1) * pow(T_red, t_[i]);
537 }
538
539 // Second sum term
540 Evaluation s2 = 0.0;
541 for (int i = 7; i < 9; ++i) {
542 s2 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]-1) * exp(-pow(rho_red, p_[i-7])) *
543 (d_[i] - p_[i-7]*pow(rho_red, p_[i-7]));
544 }
545
546 // Third, and last, sum term
547 Evaluation s3 = 0.0;
548 for (int i = 9; i < 14; ++i) {
549 s3 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]-1) *
550 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2)) *
551 (d_[i] + 2 * phi_[i-9] * rho_red * (rho_red - D_[i-9]));
552 }
553
554 // Return total sum
555 Evaluation s = s1 + s2 + s3;
556 return s;
557 }
558
565 template <class Evaluation>
566 static Evaluation secDerivResHelmholtzWrtRedRho(const Evaluation& T_red, const Evaluation& rho_red)
567 {
568 // Second derivative of Eq. (32) wrt to reduced density, which can be compared with Eq. (82) in Span et al.
569 // (2000)
570 // First sum term
571 Evaluation s1 = 0.0;
572 for (int i = 0; i < 7; ++i) {
573 s1 += d_[i] * (d_[i] - 1) * N_[i] * pow(rho_red, d_[i]-2) * pow(T_red, t_[i]);
574 }
575
576 // Second sum term
577 Evaluation s2 = 0.0;
578 for (int i = 7; i < 9; ++i) {
579 s2 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]-2) * exp(-pow(rho_red, p_[i-7])) *
580 ((d_[i] - p_[i-7] * pow(rho_red, p_[i-7])) * (d_[i] - p_[i-7] * pow(rho_red, p_[i-7]) - 1.0)
581 - pow(p_[i-7], 2) * pow(rho_red, p_[i-7]));
582 }
583
584 // Third, and last, sum term
585 Evaluation s3 = 0.0;
586 for (int i = 9; i < 14; ++i) {
587 s3 += N_[i] * pow(T_red, t_[i]) * pow(rho_red, d_[i]-2) *
588 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2)) *
589 (pow(d_[i] + 2 * phi_[i-9] * rho_red * (rho_red - D_[i-9]), 2)
590 - d_[i] + 2 * phi_[i-9] * pow(rho_red, 2));
591 }
592
593 // Return total sum
594 Evaluation s = s1 + s2 + s3;
595 return s;
596 }
597
604 template <class Evaluation>
605 static Evaluation derivResHelmholtzWrtRecipRedTemp(const Evaluation& T_red, const Evaluation& rho_red)
606 {
607 // Derivative of Eq. (32) wrt to reciprocal reduced temperature, which can be compared with Eq. (84) in Span et
608 // al. (2000).
609 // First sum term
610 Evaluation s1 = 0.0;
611 for (int i = 0; i < 7; ++i) {
612 s1 += t_[i] * N_[i] * pow(rho_red, d_[i]) * pow(T_red, t_[i]-1);
613 }
614
615 // Second sum term
616 Evaluation s2 = 0.0;
617 for (int i = 7; i < 9; ++i) {
618 s2 += t_[i] * N_[i] * pow(T_red, t_[i]-1) * pow(rho_red, d_[i]) * exp(-pow(rho_red, p_[i-7]));
619 }
620
621 // Third, and last, sum term
622 Evaluation s3 = 0.0;
623 for (int i = 9; i < 14; ++i) {
624 s3 += N_[i] * pow(T_red, t_[i]-1) * pow(rho_red, d_[i]) *
625 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2)) *
626 (t_[i] + 2 * beta_[i-9] * T_red * (T_red - gamma_[i-9]));
627 }
628
629 // Return total sum
630 Evaluation s = s1 + s2 + s3;
631 return s;
632 }
633
640 template <class Evaluation>
641 static Evaluation secDerivResHelmholtzWrtRecipRedTemp(const Evaluation& T_red, const Evaluation& rho_red)
642 {
643 // Second derivative of Eq. (32) wrt to reciprocal reduced temperature, which can be compared with Eq. (85) in
644 // Span et al. (2000).
645 // First sum term
646 Evaluation s1 = 0.0;
647 for (int i = 0; i < 7; ++i) {
648 s1 += t_[i] * (t_[i] - 1) * N_[i] * pow(rho_red, d_[i]) * pow(T_red, t_[i]-2);
649 }
650
651 // Second sum term
652 Evaluation s2 = 0.0;
653 for (int i = 7; i < 9; ++i) {
654 s2 += t_[i] * (t_[i] - 1) * N_[i] * pow(T_red, t_[i]-2) * pow(rho_red, d_[i]) * exp(-pow(rho_red, p_[i-7]));
655 }
656
657 // Third, and last, sum term
658 Evaluation s3 = 0.0;
659 for (int i = 9; i < 14; ++i) {
660 s3 += N_[i] * pow(T_red, t_[i]-2) * pow(rho_red, d_[i]) *
661 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2)) *
662 (pow(t_[i] + 2 * beta_[i-9] * T_red * (T_red - gamma_[i-9]), 2)
663 - t_[i] + 2 * beta_[i-9] * pow(T_red, 2));
664 }
665
666 // Return total sum
667 Evaluation s = s1 + s2 + s3;
668 return s;
669 }
670
678 template <class Evaluation>
679 static Evaluation secDerivResHelmholtzWrtRecipRedTempAndRedRho(const Evaluation& T_red, const Evaluation& rho_red)
680 {
681 // Second derivative of Eq. (32) wrt to reciprocal reduced temperature and reduced density, which can be
682 // compared with Eq. (86) in Span et al. (2000).
683 // First sum term
684 Evaluation s1 = 0.0;
685 for (int i = 0; i < 7; ++i) {
686 s1 += t_[i] * d_[i] * N_[i] * pow(rho_red, d_[i]-1) * pow(T_red, t_[i]-1);
687 }
688
689 // Second sum term
690 Evaluation s2 = 0.0;
691 for (int i = 7; i < 9; ++i) {
692 s2 += t_[i] * N_[i] * pow(T_red, t_[i]-1) * pow(rho_red, d_[i]-1) * exp(-pow(rho_red, p_[i-7]))
693 * (d_[i] - p_[i-7] * pow(rho_red, p_[i-7]));
694 }
695
696 // Third, and last, sum term
697 Evaluation s3 = 0.0;
698 for (int i = 9; i < 14; ++i) {
699 s3 += N_[i] * pow(T_red, t_[i]-1) * pow(rho_red, d_[i]-1) *
700 exp(phi_[i-9] * pow(rho_red - D_[i-9], 2) + beta_[i-9] * pow(T_red - gamma_[i-9], 2)) *
701 (t_[i] + 2 * beta_[i-9] * T_red * (T_red - gamma_[i-9]))
702 * (d_[i] + 2 * phi_[i-9] * rho_red * (rho_red - D_[i-9]));
703 }
704
705 // Return total sum
706 Evaluation s = s1 + s2 + s3;
707 return s;
708 }
709
710private:
711
712 // Parameter values need in the ideal-gas contribution to the reduced Helmholtz free energy given in Table 4
713 static constexpr Scalar a_[7] = {-1.4579856475, 1.888076782, 1.616, -0.4117, -0.792, 0.758, 1.217};
714 static constexpr Scalar b_[5] = {-16.0205159149, -22.6580178006, -60.0090511389, -74.9434303817, -206.9392065168};
715
716 // Parameter values needed in the residual contribution to the reduced Helmholtz free energy given in Table 5.
717 static constexpr Scalar N_[14] = {-6.93643, 0.01, 2.1101, 4.52059, 0.732564, -1.34086, 0.130985, -0.777414,
718 0.351944, -0.0211716, 0.0226312, 0.032187, -0.0231752, 0.0557346};
719 static constexpr Scalar t_[14] = {0.6844, 1.0, 0.989, 0.489, 0.803, 1.1444, 1.409, 1.754, 1.311, 4.187, 5.646,
720 0.791, 7.249, 2.986};
721 static constexpr Scalar d_[14] = {1, 4, 1, 1, 2, 2, 3, 1, 3, 2, 1, 3, 1, 1};
722 static constexpr Scalar p_[2] = {1, 1};
723 static constexpr Scalar phi_[5] = {-1.685, -0.489, -0.103, -2.506, -1.607};
724 static constexpr Scalar beta_[5] = {-0.1710, -0.2245, -0.1304, -0.2785, -0.3967};
725 static constexpr Scalar gamma_[5] = {0.7164, 1.3444, 1.4517, 0.7204, 1.5445};
726 static constexpr Scalar D_[5] = {1.506, 0.156, 1.736, 0.670, 1.662};
727
728#if 0
736 template <class Evaluation>
737 static Evaluation rootFindingObj_(const Evaluation& rho_red, const Evaluation& temperature, const Evaluation& pg)
738 {
739 // Temporary calculations
740 Evaluation T_red = criticalTemperature() / temperature; // reciprocal reduced temp.
741 Evaluation p_MPa = pg / 1.0e6; // Pa --> MPa
742 Scalar R = IdealGas::R;
743 Evaluation rho_cRT = criticalDensity() * R * temperature;
744
745 // Eq. (56) in Span et al. (2000)
746 Evaluation dResHelm_dRedRho = derivResHelmholtzWrtRedRho(T_red, rho_red);
747 Evaluation obj = rho_red * rho_cRT * (1 + rho_red * dResHelm_dRedRho) - p_MPa;
748 return obj;
749 }
750#endif
751};
752
753} // end namespace Opm
754
755#endif
Abstract base class of a pure chemical species.
Relations valid for an ideal gas.
A number of commonly used algebraic functions for the localized OPM automatic differentiation (AD) fr...
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Abstract base class of a pure chemical species.
Definition Component.hpp:44
Properties of pure molecular hydrogen .
Definition H2.hpp:90
static Evaluation secDerivResHelmholtzWrtRedRho(const Evaluation &T_red, const Evaluation &rho_red)
Second derivative of the residual part of Helmholtz energy wrt.
Definition H2.hpp:566
static std::string name()
A human readable name for the .
Definition H2.hpp:103
static Evaluation secDerivResHelmholtzWrtRecipRedTempAndRedRho(const Evaluation &T_red, const Evaluation &rho_red)
Second derivative of the residual part of Helmholtz energy first wrt.
Definition H2.hpp:679
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure molecular hydrogen at a given temperature.
Definition H2.hpp:166
static Evaluation residualPartHelmholtz(const Evaluation &T_red, const Evaluation &rho_red)
The residual part of Helmholtz energy.
Definition H2.hpp:496
static Scalar criticalTemperature()
Returns the critical temperature of molecular hydrogen.
Definition H2.hpp:115
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition H2.hpp:223
static Scalar tripleDensity()
Returns the density of molecular hydrogen's triple point.
Definition H2.hpp:145
static Scalar acentricFactor()
Acentric factor of .
Definition H2.hpp:156
static Scalar criticalDensity()
Returns the critical density of molecular hydrogen.
Definition H2.hpp:127
static const Evaluation gasIsochoricHeatCapacity(Evaluation temperature, Evaluation pressure)
Specific isochoric heat capacity of pure hydrogen gas.
Definition H2.hpp:390
static Evaluation secDerivResHelmholtzWrtRecipRedTemp(const Evaluation &T_red, const Evaluation &rho_red)
Second derivative of the residual part of Helmholtz energy wrt.
Definition H2.hpp:641
static Scalar criticalPressure()
Returns the critical pressure of molecular hydrogen.
Definition H2.hpp:121
static Evaluation gasPressure(Evaluation temperature, Evaluation density)
The pressure of gaseous in at a given density and temperature.
Definition H2.hpp:233
static Scalar tripleTemperature()
Returns the temperature at molecular hydrogen's triple point.
Definition H2.hpp:133
static Evaluation idealGasPartHelmholtz(const Evaluation &T_red, const Evaluation &rho_red)
The ideal-gas part of Helmholtz energy.
Definition H2.hpp:426
static Evaluation reducedMolarDensity(const Evaluation &temperature, const Evaluation &pg, bool extrapolate=false)
Calculate reduced density (rho/rho_crit) from pressure and temperature.
Definition H2.hpp:412
static Evaluation derivResHelmholtzWrtRedRho(const Evaluation &T_red, const Evaluation &rho_red)
Derivative of the residual part of Helmholtz energy wrt.
Definition H2.hpp:530
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of H2 [J/kg].
Definition H2.hpp:247
static const Evaluation gasHeatCapacity(Evaluation temperature, Evaluation pressure)
Specific isobaric heat capacity of pure hydrogen gas.
Definition H2.hpp:357
static Scalar criticalVolume()
Critical volume of [m2/kmol].
Definition H2.hpp:151
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of at a given pressure and temperature.
Definition H2.hpp:281
static Evaluation derivResHelmholtzWrtRecipRedTemp(const Evaluation &T_red, const Evaluation &rho_red)
Derivative of the residual part of Helmholtz energy wrt.
Definition H2.hpp:605
static constexpr bool gasIsCompressible()
Returns true if the gas phase is assumed to be compressible.
Definition H2.hpp:217
static Evaluation secDerivIdealHelmholtzWrtRecipRedTemp(const Evaluation &T_red)
Second derivative of the ideal-gas part of Helmholtz energy wrt to reciprocal reduced temperature.
Definition H2.hpp:474
static constexpr Scalar molarMass()
The molar mass in of molecular hydrogen.
Definition H2.hpp:109
static Scalar triplePressure()
Returns the pressure of molecular hydrogen's triple point.
Definition H2.hpp:139
static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
The density of at a given pressure and temperature.
Definition H2.hpp:199
static Evaluation gasMolarDensity(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
The molar density of in , depending on pressure and temperature.
Definition H2.hpp:211
static Evaluation derivIdealHelmholtzWrtRecipRedTemp(const Evaluation &T_red)
Derivative of the ideal-gas part of Helmholtz energy wrt to reciprocal reduced temperature.
Definition H2.hpp:449
static const Evaluation gasEnthalpy(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
Specific enthalpy of pure hydrogen gas.
Definition H2.hpp:264
Relations valid for an ideal gas.
Definition IdealGas.hpp:39
static constexpr Scalar R
The ideal gas constant .
Definition IdealGas.hpp:42
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Definition UniformTabulated2DFunction.hpp:64
OPM_HOST_DEVICE Evaluation eval(const Evaluation &x, const Evaluation &y, bool extrapolate) const
Evaluate the function at a given (x,y) position.
Definition UniformTabulated2DFunction.hpp:236
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition H2.hpp:44
Definition H2.hpp:50
Definition H2.hpp:63