OGS
WaterVapourDensity.cpp
Go to the documentation of this file.
1
12
#include "
WaterVapourDensity.h
"
13
14
#include <cmath>
15
16
#include "
BaseLib/Error.h
"
17
#include "
MaterialLib/MPL/Medium.h
"
18
#include "
MaterialLib/PhysicalConstant.h
"
19
20
namespace
MaterialPropertyLib
21
{
23
static
double
saturatedVaporDensity
(
double
const
T)
24
{
25
return
1.0e-3 * std::exp(19.819 - 4975.9 / T);
26
}
27
29
static
double
dsaturatedVaporDensitydT
(
double
const
T)
30
{
31
return
4.9759 * std::exp(19.819 - 4975.9 / T) / (T * T);
32
}
33
34
static
double
humidity
(
double
const
T,
double
const
p,
35
double
const
water_density)
36
{
37
return
std::exp(
38
p / (
MaterialLib::PhysicalConstant::SpecificGasConstant::WaterVapour
*
39
T * water_density));
40
}
41
42
PropertyDataType
WaterVapourDensity::value
(
43
VariableArray
const
& variable_array,
44
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
45
double
const
/*dt*/
)
const
46
{
47
double
const
p = variable_array.
liquid_phase_pressure
;
48
double
const
T = variable_array.
temperature
;
49
assert(T >= 273.);
50
double
const
water_density = variable_array.
density
;
51
assert(water_density > 0.);
52
53
return
humidity
(T, p, water_density) *
saturatedVaporDensity
(T);
54
}
55
56
PropertyDataType
WaterVapourDensity::dValue
(
57
VariableArray
const
& variable_array,
Variable
const
variable,
58
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
59
double
const
/*dt*/
)
const
60
{
61
double
const
p = variable_array.
liquid_phase_pressure
;
62
double
const
T = variable_array.
temperature
;
63
assert(T >= 273.);
64
double
const
water_density = variable_array.
density
;
65
assert(water_density > 0.);
66
67
if
(variable ==
Variable::temperature
)
68
{
69
double
const
h =
humidity
(T, p, water_density);
70
double
const
rho_v = h *
saturatedVaporDensity
(T);
71
double
const
drho_vS_dT =
dsaturatedVaporDensitydT
(T);
72
73
return
h * drho_vS_dT - rho_v * p /
74
(water_density * T * T *
75
MaterialLib::PhysicalConstant::
76
SpecificGasConstant::WaterVapour
);
77
}
78
79
if
(variable ==
Variable::liquid_phase_pressure
)
80
{
81
double
const
factor =
82
1.0 /
83
(
MaterialLib::PhysicalConstant::SpecificGasConstant::WaterVapour
*
84
T * water_density);
85
double
const
dhumiditydp = factor * std::exp(factor * p);
86
87
return
dhumiditydp *
saturatedVaporDensity
(T);
88
}
89
90
OGS_FATAL
(
91
"WaterVapourDensity::dValue is implemented for derivatives with "
92
"respect to temperature or liquid_phase_pressure only."
);
93
}
94
95
}
// namespace MaterialPropertyLib
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
Medium.h
PhysicalConstant.h
WaterVapourDensity.h
MaterialPropertyLib::Property::value
virtual PropertyDataType value() const
Definition
Property.cpp:76
MaterialPropertyLib::VariableArray
Definition
VariableType.h:99
MaterialPropertyLib::VariableArray::temperature
double temperature
Definition
VariableType.h:191
MaterialPropertyLib::VariableArray::density
double density
Definition
VariableType.h:174
MaterialPropertyLib::VariableArray::liquid_phase_pressure
double liquid_phase_pressure
Definition
VariableType.h:181
MaterialPropertyLib::WaterVapourDensity::dValue
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Definition
WaterVapourDensity.cpp:56
ParameterLib::SpatialPosition
Definition
SpatialPosition.h:27
MaterialLib::PhysicalConstant::SpecificGasConstant::WaterVapour
constexpr double WaterVapour
Specific gas constant for water vapour.
Definition
PhysicalConstant.h:95
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:21
MaterialPropertyLib::humidity
static double humidity(double const T, double const p, double const water_density)
Definition
WaterVapourDensity.cpp:34
MaterialPropertyLib::Variable
Variable
Definition
VariableType.h:30
MaterialPropertyLib::Variable::liquid_phase_pressure
@ liquid_phase_pressure
MaterialPropertyLib::Variable::temperature
@ temperature
MaterialPropertyLib::saturatedVaporDensity
static double saturatedVaporDensity(double const T)
Definition
WaterVapourDensity.cpp:23
MaterialPropertyLib::dsaturatedVaporDensitydT
static double dsaturatedVaporDensitydT(double const T)
Definition
WaterVapourDensity.cpp:29
MaterialPropertyLib::PropertyDataType
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 >, Eigen::MatrixXd > PropertyDataType
Definition
Property.h:31
MaterialLib
MPL
Properties
Density
WaterVapourDensity.cpp
Generated by
1.11.0