OGS
Exponential.cpp
Go to the documentation of this file.
1
12
13#include <cmath>
14
15namespace MaterialPropertyLib
16{
18 double const offset,
19 PropertyDataType const& property_reference_value,
20 ExponentData const& v)
21 : exponent_data_(v), offset_(offset)
22{
23 name_ = std::move(name);
24 auto const f = std::get<double>(exponent_data_.factor);
25 auto const v0 = std::get<double>(exponent_data_.reference_condition);
26 value_ = std::get<double>(property_reference_value) * std::exp(-f * v0);
27}
28
30 VariableArray const& variable_array,
31 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
32 double const /*dt*/) const
33{
34 auto const f = std::get<double>(exponent_data_.factor);
35 auto const v = std::get<double>(variable_array[exponent_data_.type]);
36
37 return offset_ + std::get<double>(value_) * std::exp(f * v);
38}
39
41 VariableArray const& variable_array, Variable const variable,
42 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
43 double const /*dt*/) const
44{
45 if (exponent_data_.type != variable)
46 {
47 return 0.;
48 }
49
50 auto const f = std::get<double>(exponent_data_.factor);
51 auto const v = std::get<double>(variable_array[exponent_data_.type]);
52
53 return std::get<double>(value_) * f * std::exp(f * v);
54}
55
57 VariableArray const& variable_array, Variable const pv1, Variable const pv2,
58 ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
59 double const /*dt*/) const
60{
61 if (exponent_data_.type != pv1 && exponent_data_.type != pv2)
62 {
63 return 0.;
64 }
65
66 auto const f = std::get<double>(exponent_data_.factor);
67 auto const v = std::get<double>(variable_array[exponent_data_.type]);
68
69 return std::get<double>(value_) * f * f * std::exp(f * v);
70}
71
72} // namespace MaterialPropertyLib
double const offset_
additive offset in units of the property.
Definition Exponential.h:72
ExponentData const exponent_data_
Definition Exponential.h:71
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &, double const, double const) const override
Exponential(std::string name, double const offset, PropertyDataType const &property_reference_value, ExponentData const &v)
PropertyDataType d2Value(VariableArray const &variable_array, Variable const pv1, Variable const pv2, ParameterLib::SpatialPosition const &, double const, double const) const override
PropertyDataType value_
The single value of a property.
Definition Property.h:292
virtual PropertyDataType value() const
Definition Property.cpp:76
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
VariableType factor
a dimensionless exponent.
Definition Exponential.h:23