OGS
MaterialPropertyLib::Exponential Class Referencefinal

Detailed Description

An exponential property.

This property calculates the exponential relationship \( \alpha(\beta) = \alpha_{\mathrm{offset}} + \alpha_{\mathrm{ref}} \cdot \exp \left(m (\beta - \beta_{\mathrm{ref}})\right)\), where:

  • \(\alpha_{\mathrm{ref}}\) is a reference value, for instance reference viscosity,
  • \(\alpha_{\mathrm{offset}}\) is additive offset in units of the property,
  • \(m\) is a dimensionless exponent,
  • \(\beta_{\mathrm{ref}}\) is a reference condition value of independent variable, for instance reference temperature.

The current implementation accepts only the scalar independent variables.

Definition at line 41 of file Exponential.h.

#include <Exponential.h>

Inheritance diagram for MaterialPropertyLib::Exponential:
[legend]
Collaboration diagram for MaterialPropertyLib::Exponential:
[legend]

Public Member Functions

 Exponential (std::string name, double const offset, PropertyDataType const &property_reference_value, ExponentData const &v)
PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
PropertyDataType dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &, double const, double const) const override
PropertyDataType d2Value (VariableArray const &variable_array, Variable const pv1, Variable const pv2, ParameterLib::SpatialPosition const &, double const, double const) const override
Public Member Functions inherited from MaterialPropertyLib::Property
virtual ~Property ()
virtual PropertyDataType initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
virtual PropertyDataType value () const
virtual PropertyDataType value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
virtual PropertyDataType dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
virtual void setProperties (std::vector< std::unique_ptr< Phase > > const &phases)
 Default implementation:
void setScale (std::variant< Medium *, Phase *, Component * > scale)
template<typename T>
initialValue (ParameterLib::SpatialPosition const &pos, double const t) const
template<typename T>
value () const
template<typename T>
value (VariableArray const &variable_array, VariableArray const &variable_array_prev, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
dValue (VariableArray const &variable_array, VariableArray const &variable_array_prev, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
dValue (VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
template<typename T>
d2Value (VariableArray const &variable_array, Variable const &variable1, Variable const &variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const

Private Attributes

ExponentData const exponent_data_
double const offset_
 additive offset in units of the property.

Additional Inherited Members

Protected Attributes inherited from MaterialPropertyLib::Property
std::string name_
PropertyDataType value_
 The single value of a property.
PropertyDataType dvalue_
std::variant< Medium *, Phase *, Component * > scale_

Constructor & Destructor Documentation

◆ Exponential()

MaterialPropertyLib::Exponential::Exponential ( std::string name,
double const offset,
PropertyDataType const & property_reference_value,
ExponentData const & v )

This constructor accepts single values of double data type defined in the PropertyDataType definition and sets the protected attribute value_ of the base class Property to that value.

Definition at line 17 of file Exponential.cpp.

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}
double const offset_
additive offset in units of the property.
Definition Exponential.h:73
ExponentData const exponent_data_
Definition Exponential.h:72
PropertyDataType value_
The single value of a property.
Definition Property.h:292

References exponent_data_, MaterialPropertyLib::name, MaterialPropertyLib::Property::name_, offset_, and MaterialPropertyLib::Property::value_.

Member Function Documentation

◆ d2Value()

PropertyDataType MaterialPropertyLib::Exponential::d2Value ( VariableArray const & variable_array,
Variable const pv1,
Variable const pv2,
ParameterLib::SpatialPosition const & ,
double const ,
double const  ) const
overridevirtual

This method will compute the second derivative of a property with respect to the given primary variables pv1 and pv2.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 87 of file Exponential.cpp.

91{
92 Variable const* const independent_variable =
93 std::get_if<Variable>(&exponent_data_.type);
94 if (independent_variable == nullptr)
95 {
96 return 0.;
97 }
98 if (*independent_variable != pv1 && *independent_variable != pv2)
99 {
100 return 0.;
101 }
102
103 auto const f = std::get<double>(exponent_data_.factor);
104 auto const v = std::get<double>(variable_array[*independent_variable]);
105
106 return std::get<double>(value_) * f * f * std::exp(f * v);
107}

References exponent_data_, and MaterialPropertyLib::Property::value_.

◆ dValue()

PropertyDataType MaterialPropertyLib::Exponential::dValue ( VariableArray const & variable_array,
Variable const variable,
ParameterLib::SpatialPosition const & ,
double const ,
double const  ) const
overridevirtual

This method will compute the derivative of a property with respect to the given primary variable.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 65 of file Exponential.cpp.

69{
70 Variable const* const independent_variable =
71 std::get_if<Variable>(&exponent_data_.type);
72 if (independent_variable == nullptr)
73 {
74 return 0.;
75 }
76 if (*independent_variable != variable)
77 {
78 return 0.;
79 }
80
81 auto const f = std::get<double>(exponent_data_.factor);
82 auto const v = std::get<double>(variable_array[*independent_variable]);
83
84 return std::get<double>(value_) * f * std::exp(f * v);
85}

References exponent_data_, and MaterialPropertyLib::Property::value_.

◆ value()

PropertyDataType MaterialPropertyLib::Exponential::value ( VariableArray const & variable_array,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

This method computes the value of a property \(\alpha\) depending exponentially on the value of the given primary variable \(\beta\).

Reimplemented from MaterialPropertyLib::Property.

Definition at line 29 of file Exponential.cpp.

32{
33 double v = 0.0;
34 if (Variable const* const variable =
35 std::get_if<Variable>(&exponent_data_.type))
36 {
37 v = std::get<double>(variable_array[*variable]);
38 }
39 else if (auto* str_ptr = std::get_if<std::string>(&exponent_data_.type))
40 {
41 if (*str_ptr == "t")
42 v = t;
43 else if (*str_ptr == "x")
44 v = pos.getCoordinates().value()[0];
45 else if (*str_ptr == "y")
46 v = pos.getCoordinates().value()[1];
47 else if (*str_ptr == "z")
48 v = pos.getCoordinates().value()[2];
49 else
51 "Unknown independent_variable {:s} for exponential property.",
52 *str_ptr)
53 }
54 else
55 {
57 "Could not convert independent_variable neither to a Variable nor "
58 "to a std::string.");
59 }
60 auto const f = std::get<double>(exponent_data_.factor);
61
62 return offset_ + std::get<double>(value_) * std::exp(f * v);
63}
#define OGS_FATAL(...)
Definition Error.h:26

References exponent_data_, ParameterLib::SpatialPosition::getCoordinates(), offset_, OGS_FATAL, and MaterialPropertyLib::Property::value_.

Member Data Documentation

◆ exponent_data_

ExponentData const MaterialPropertyLib::Exponential::exponent_data_
private

Definition at line 72 of file Exponential.h.

Referenced by Exponential(), d2Value(), dValue(), and value().

◆ offset_

double const MaterialPropertyLib::Exponential::offset_
private

additive offset in units of the property.

Definition at line 73 of file Exponential.h.

Referenced by Exponential(), and value().


The documentation for this class was generated from the following files: