OGS
LiquidDensity.h
Go to the documentation of this file.
1
14#pragma once
15
16#include <vector>
17
20
21namespace MaterialLib
22{
23namespace Fluid
24{
49class LiquidDensity final : public FluidProperty
50{
51public:
52 explicit LiquidDensity(const double beta, const double rho0,
53 const double T0, const double p0, const double E)
54 : _beta(beta), _rho0(rho0), _temperature0(T0), _p0(p0), _bulk_modulus(E)
55 {
56 }
57
59 std::string getName() const override
60 {
61 return "Temperature or pressure dependent liquid density";
62 }
63
67 double getValue(const ArrayType& var_vals) const override
68 {
69 const double T = var_vals[static_cast<int>(PropertyVariableType::T)];
70 const double p = var_vals[static_cast<int>(PropertyVariableType::p)];
71 return _rho0 / (1. + _beta * (T - _temperature0)) /
72 (1. - (p - _p0) / _bulk_modulus);
73 }
74
80 double getdValue(const ArrayType& var_vals,
81 const PropertyVariableType var) const override
82 {
83 const double T = var_vals[static_cast<int>(PropertyVariableType::T)];
84 const double p = var_vals[static_cast<int>(PropertyVariableType::p)];
85 switch (var)
86 {
88 return dLiquidDensity_dT(T, p);
90 return dLiquidDensity_dp(T, p);
91 default:
92 return 0.;
93 }
94 }
95
96private:
98 const double _beta;
99
101 const double _rho0;
102
104 const double _temperature0;
105
107 const double _p0;
108
110 const double _bulk_modulus;
111
118 double dLiquidDensity_dT(const double T, const double p) const
119 {
120 const double fac_T = 1. + _beta * (T - _temperature0);
121 return -_beta * _rho0 / (fac_T * fac_T) /
122 (1. - (p - _p0) / _bulk_modulus);
123 }
124
130 double dLiquidDensity_dp(const double T, const double p) const
131 {
132 const double fac_p = 1. - (p - _p0) / _bulk_modulus;
133 return _rho0 / (1. + _beta * (T - _temperature0)) /
134 (fac_p * fac_p * _bulk_modulus);
135 }
136};
137
138} // namespace Fluid
139} // namespace MaterialLib
Base class of fluid properties.
std::array< double, PropertyVariableNumber > ArrayType
const double _beta
Volumetric temperature expansion coefficient.
const double _p0
Initial pressure.
const double _rho0
Initial density.
double dLiquidDensity_dp(const double T, const double p) const
double getValue(const ArrayType &var_vals) const override
double getdValue(const ArrayType &var_vals, const PropertyVariableType var) const override
const double _temperature0
Initial temperature.
const double _bulk_modulus
Bulk modulus.
double dLiquidDensity_dT(const double T, const double p) const
LiquidDensity(const double beta, const double rho0, const double T0, const double p0, const double E)
std::string getName() const override
Get density model name.
PropertyVariableType
Variable that determine the property.