OGS
TemperatureDependentFraction.cpp
Go to the documentation of this file.
1
13
15
16namespace MaterialPropertyLib
17{
19 double const k,
20 double const T_c)
21 : phase_change_shape_(k, T_c)
22{
23 name_ = std::move(name);
24}
25
27{
28 if (!std::holds_alternative<Medium*>(scale_))
29 {
31 "The property 'TemperatureDependantFraction' is "
32 "implemented on the 'medium' scale only.");
33 }
34}
35
37 VariableArray const& variable_array,
38 ParameterLib::SpatialPosition const& pos, double const t,
39 double const dt) const
40{
41 auto const T = variable_array.temperature;
42
43 auto const& medium = *std::get<Medium*>(scale_);
44 auto const& porosity = medium[PropertyType::porosity];
45
46 auto const phi =
47 std::get<double>(porosity.value(variable_array, pos, t, dt));
48
49 return phi * phase_change_shape_.value(T);
50}
51
53 VariableArray const& variable_array, Variable const variable,
54 ParameterLib::SpatialPosition const& pos, double const t,
55 double const dt) const
56{
57 (void)variable;
58 assert((variable == Variable::temperature) &&
59 "TemperatureDependantFraction::dvalue is implemented for "
60 "derivatives with respect to temperature only.");
61
62 auto const T = variable_array.temperature;
63
64 auto const& medium = *std::get<Medium*>(scale_);
65 auto const& porosity = medium[PropertyType::porosity];
66
67 auto const phi =
68 std::get<double>(porosity.value(variable_array, pos, t, dt));
69
70 return phi * phase_change_shape_.dValue(T);
71}
72
74 VariableArray const& variable_array, Variable const variable1,
75 Variable const variable2, ParameterLib::SpatialPosition const& pos,
76 double const t, double const dt) const
77{
78 (void)variable1;
79 assert((variable1 == Variable::temperature) &&
80 "TemperatureDependantFraction::d2value is implemented for "
81 "derivatives with respect to temperature only.");
82
83 (void)variable2;
84 assert((variable2 == Variable::temperature) &&
85 "TemperatureDependantFraction::d2value is implemented for "
86 "derivatives with respect to temperature only.");
87
88 auto const T = variable_array.temperature;
89
90 auto const& medium = *std::get<Medium*>(scale_);
91 auto const& porosity = medium[PropertyType::porosity];
92
93 auto const phi =
94 std::get<double>(porosity.value(variable_array, pos, t, dt));
95
96 return phi * phase_change_shape_.d2Value(T);
97}
98} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
virtual PropertyDataType value() const
Definition Property.cpp:76
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297
double dValue(double const &T) const
double d2Value(double const &T) const
double value(double const &T) const
PropertyDataType d2Value(VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
Default implementation: 2nd derivative of any constant property is zero.
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
TemperatureDependentFraction(std::string name, double const k, double const T_c)
constexpr double T_c
Critical temperature.
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