3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
region4.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_REGION4_HH
31#define DUMUX_IAPWS_REGION4_HH
32
33#include <cmath>
34#include <iostream>
35
36#include <dune/common/math.hh>
37
38namespace Dumux::IAPWS {
39
51template <class Scalar>
53{
54public:
64 static Scalar saturationPressure(Scalar temperature)
65 {
66 constexpr Scalar n[10] = {
67 0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
68 0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
69 -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
70 0.65017534844798e3
71 };
72
73 const Scalar sigma = temperature + n[8]/(temperature - n[9]);
74
75 const Scalar A = (sigma + n[0])*sigma + n[1];
76 const Scalar B = (n[2]*sigma + n[3])*sigma + n[4];
77 const Scalar C = (n[5]*sigma + n[6])*sigma + n[7];
78
79 using std::sqrt;
80 Scalar tmp = 2*C/(sqrt(B*B - 4*A*C) - B);
81 tmp *= tmp;
82 tmp *= tmp;
83
84 return 1e6*tmp;
85 }
86
95 static Scalar vaporTemperature(Scalar pressure)
96 {
97 constexpr Scalar n[10] = {
98 0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
99 0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
100 -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
101 0.65017534844798e3
102 };
103
104 using std::pow;
105 using Dune::power;
106 const Scalar beta = pow((pressure/1e6 /*from Pa to MPa*/), (1./4.));
107 const Scalar beta2 = power(beta, 2);
108 const Scalar E = beta2 + n[2] * beta + n[5];
109 const Scalar F = n[0]*beta2 + n[3]*beta + n[6];
110 const Scalar G = n[1]*beta2 + n[4]*beta + n[7];
111
112 using std::sqrt;
113 const Scalar D = ( 2.*G)/(-F -sqrt(power(F,2) - 4.*E*G));
114 return (n[9] + D - sqrt(power(n[9]+D , 2) - 4.* (n[8] + n[9]*D)) ) * 0.5;
115 }
116};
117
118} // end namespace Dumux::IAPWS
119
120#endif
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
Definition: common.hh:40
Implements the equations for region 4 of the IAPWS '97 formulation.
Definition: region4.hh:53
static Scalar saturationPressure(Scalar temperature)
Returns the saturation pressure in of pure water at a given temperature.
Definition: region4.hh:64
static Scalar vaporTemperature(Scalar pressure)
Returns the saturation temperature in of pure water at a given pressure.
Definition: region4.hh:95