OGS
WaterDensityIAPWSIF97Region1.cpp
Go to the documentation of this file.
1
12
#include "
WaterDensityIAPWSIF97Region1.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
{
22
23
PropertyDataType
WaterDensityIAPWSIF97Region1::value
(
24
VariableArray
const
& variable_array,
25
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
26
double
const
/*dt*/
)
const
27
{
28
double
const
p = std::max(0.0, variable_array.
liquid_phase_pressure
);
29
double
const
T = variable_array.
temperature
;
30
const
double
tau =
ref_T_
/ T;
31
const
double
pi = p /
ref_p_
;
32
33
return
ref_p_
/
34
(
MaterialLib::PhysicalConstant::SpecificGasConstant::WaterVapour
*
35
T *
gibbs_free_energy_
.
get_dgamma_dpi
(tau, pi));
36
}
37
38
PropertyDataType
WaterDensityIAPWSIF97Region1::dValue
(
39
VariableArray
const
& variable_array,
Variable
const
variable,
40
ParameterLib::SpatialPosition
const
&
/*pos*/
,
double
const
/*t*/
,
41
double
const
/*dt*/
)
const
42
{
43
const
double
T = variable_array.
temperature
;
44
double
const
p = std::max(0.0, variable_array.
liquid_phase_pressure
);
45
46
const
double
tau =
ref_T_
/ T;
47
const
double
pi = p /
ref_p_
;
48
49
const
double
dgamma_dpi =
gibbs_free_energy_
.
get_dgamma_dpi
(tau, pi);
50
51
switch
(variable)
52
{
53
case
Variable::temperature
:
54
return
-(
ref_p_
-
55
tau *
ref_p_
*
56
gibbs_free_energy_
.
get_dgamma_dtau_dpi
(tau, pi) /
57
dgamma_dpi) /
58
(
MaterialLib::PhysicalConstant::SpecificGasConstant
::
59
WaterVapour *
60
T * T * dgamma_dpi);
61
case
Variable::liquid_phase_pressure
:
62
return
-
gibbs_free_energy_
.
get_dgamma_dpi_dpi
(tau, pi) /
63
(MaterialLib::PhysicalConstant::SpecificGasConstant::
64
WaterVapour *
65
T * dgamma_dpi * dgamma_dpi);
66
default
:
67
OGS_FATAL
(
68
"WaterDensityIAPWSIF97Region1::dValue is implemented for "
69
"derivatives with "
70
"respect to temperature or liquid_phase_pressure only."
);
71
}
72
}
73
74
}
// namespace MaterialPropertyLib
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
Medium.h
PhysicalConstant.h
WaterDensityIAPWSIF97Region1.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::liquid_phase_pressure
double liquid_phase_pressure
Definition
VariableType.h:181
MaterialPropertyLib::WaterDensityIAPWSIF97Region1::dValue
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Definition
WaterDensityIAPWSIF97Region1.cpp:38
MaterialPropertyLib::WaterDensityIAPWSIF97Region1::ref_p_
static constexpr double ref_p_
reference pressure in Pa.
Definition
WaterDensityIAPWSIF97Region1.h:60
MaterialPropertyLib::WaterDensityIAPWSIF97Region1::gibbs_free_energy_
const MaterialLib::Fluid::DimensionLessGibbsFreeEnergyRegion1 gibbs_free_energy_
Definition
WaterDensityIAPWSIF97Region1.h:57
MaterialPropertyLib::WaterDensityIAPWSIF97Region1::ref_T_
static constexpr double ref_T_
reference temperature in K.
Definition
WaterDensityIAPWSIF97Region1.h:59
ParameterLib::SpatialPosition
Definition
SpatialPosition.h:27
MaterialLib::PhysicalConstant::SpecificGasConstant
Definition
PhysicalConstant.h:93
MaterialLib::PhysicalConstant::SpecificGasConstant::WaterVapour
constexpr double WaterVapour
Specific gas constant for water vapour.
Definition
PhysicalConstant.h:95
MaterialPropertyLib
Definition
ChemicalSolverInterface.h:21
MaterialPropertyLib::Variable
Variable
Definition
VariableType.h:30
MaterialPropertyLib::Variable::liquid_phase_pressure
@ liquid_phase_pressure
MaterialPropertyLib::Variable::temperature
@ temperature
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::Fluid::DimensionLessGibbsFreeEnergyRegion1::get_dgamma_dpi
static double get_dgamma_dpi(const double tau, const double pi)
Definition
DimensionLessGibbsFreeEnergyRegion1.cpp:83
MaterialLib::Fluid::DimensionLessGibbsFreeEnergyRegion1::get_dgamma_dpi_dpi
static double get_dgamma_dpi_dpi(const double tau, const double pi)
Definition
DimensionLessGibbsFreeEnergyRegion1.cpp:96
MaterialLib::Fluid::DimensionLessGibbsFreeEnergyRegion1::get_dgamma_dtau_dpi
static double get_dgamma_dtau_dpi(const double tau, const double pi)
Definition
DimensionLessGibbsFreeEnergyRegion1.cpp:109
MaterialLib
MPL
Properties
Density
WaterDensityIAPWSIF97Region1.cpp
Generated by
1.11.0