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"
19
20namespace MaterialPropertyLib
21{
23static double saturatedVaporDensity(double const T)
24{
25 return 1.0e-3 * std::exp(19.819 - 4975.9 / T);
26}
27
29static double dsaturatedVaporDensitydT(double const T)
30{
31 return 4.9759 * std::exp(19.819 - 4975.9 / T) / (T * T);
32}
33
34static double humidity(double const T, double const p,
35 double const water_density)
36{
37 return std::exp(
39 T * water_density));
40}
41
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
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 *
77 }
78
79 if (variable == Variable::liquid_phase_pressure)
80 {
81 double const factor =
82 1.0 /
84 T * water_density);
85 double const dhumiditydp = factor * std::exp(factor * p);
86
87 return dhumiditydp * saturatedVaporDensity(T);
88 }
89
91 "WaterVapourDensity::dValue is implemented for derivatives with "
92 "respect to temperature or liquid_phase_pressure only.");
93}
94
95} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
constexpr double WaterVapour
Specific gas constant for water vapour.
static double humidity(double const T, double const p, double const water_density)
static double saturatedVaporDensity(double const T)
static double dsaturatedVaporDensitydT(double const T)
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