opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
Region4.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
*/
27
#ifndef OPM_IAPWS_REGION4_HPP
28
#define OPM_IAPWS_REGION4_HPP
29
30
#include <
opm/material/common/MathToolbox.hpp
>
31
32
#include <cmath>
33
34
namespace
Opm
{
35
namespace
IAPWS {
36
50
template
<
class
Scalar>
51
class
Region4
52
{
53
public
:
62
template
<
class
Evaluation>
63
static
Evaluation
saturationPressure
(
const
Evaluation& temperature)
64
{
65
static
const
Scalar n[10] = {
66
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
67
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
68
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
69
0.65017534844798e3
70
};
71
72
const
Evaluation& sigma = temperature + n[8]/(temperature - n[9]);
73
74
const
Evaluation& A = (sigma + n[0])*sigma + n[1];
75
const
Evaluation& B = (n[2]*sigma + n[3])*sigma + n[4];
76
const
Evaluation& C = (n[5]*sigma + n[6])*sigma + n[7];
77
78
Evaluation tmp = 2*C/(sqrt(B*B - 4*A*C) - B);
79
tmp *= tmp;
80
tmp *= tmp;
81
82
return
1e6*tmp;
83
}
84
93
template
<
class
Evaluation>
94
static
Evaluation
vaporTemperature
(
const
Evaluation& pressure)
95
{
96
static
const
Scalar n[10] = {
97
0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
98
0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
99
-0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
100
0.65017534844798e3
101
};
102
const
Evaluation& beta = pow((pressure/1e6
/*from Pa to MPa*/
), (1./4.));
103
const
Evaluation& beta2 = pow(beta, 2.);
104
const
Evaluation& E = beta2 + n[2] * beta + n[5];
105
const
Evaluation& F = n[0]*beta2 + n[3]*beta + n[6];
106
const
Evaluation& G = n[1]*beta2 + n[4]*beta + n[7];
107
108
const
Evaluation& D = ( 2.*G)/(-F -sqrt(pow(F,2.) - 4.*E*G));
109
110
const
Evaluation& temperature = (n[9] + D - sqrt(pow(n[9]+D , 2.) - 4.* (n[8] + n[9]*D)) ) * 0.5;
111
112
return
temperature;
113
}
114
};
115
116
}
// namespace IAPWS
117
}
// namespace Opm
118
119
#endif
MathToolbox.hpp
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Opm::IAPWS::Region4
Implements the equations for region 4 of the IAPWS '97 formulation.
Definition
Region4.hpp:52
Opm::IAPWS::Region4::vaporTemperature
static Evaluation vaporTemperature(const Evaluation &pressure)
Returns the saturation temperature in of pure water at a given pressure.
Definition
Region4.hpp:94
Opm::IAPWS::Region4::saturationPressure
static Evaluation saturationPressure(const Evaluation &temperature)
Returns the saturation pressure in of pure water at a given temperature.
Definition
Region4.hpp:63
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
opm
material
components
iapws
Region4.hpp
Generated by
1.17.0