OGS
MaterialPropertyLib::Linear Class Referencefinal

Detailed Description

The linear property class. This property calculates the linear relationship. The current implementation accepts only the double datatype defined in PropertyDataType.

Definition at line 27 of file Linear.h.

#include <Linear.h>

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

Public Member Functions

 Linear (std::string name, PropertyDataType const &property_reference_value, std::vector< IndependentVariable > const &vs)
 
PropertyDataType value (VariableArray const &variable_array, ParameterLib::SpatialPosition const &, double const, double const) const override
 
PropertyDataType dValue (VariableArray const &variable_array, Variable const primary_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
 
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

std::vector< IndependentVariable > const independent_variables_
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Linear()

MaterialPropertyLib::Linear::Linear ( std::string  name,
PropertyDataType const &  property_reference_value,
std::vector< IndependentVariable > const &  vs 
)

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 Linear.cpp.

21 {
22  name_ = std::move(name);
23  value_ = property_reference_value;
24 }
std::vector< IndependentVariable > const independent_variables_
Definition: Linear.h:61
PropertyDataType value_
The single value of a property.
Definition: Property.h:282

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

Member Function Documentation

◆ d2Value()

PropertyDataType MaterialPropertyLib::Linear::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 66 of file Linear.cpp.

70 {
71  return decltype(value_){};
72 }

References MaterialPropertyLib::Property::value_.

◆ dValue()

PropertyDataType MaterialPropertyLib::Linear::dValue ( VariableArray const &  variable_array,
Variable const  primary_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 49 of file Linear.cpp.

53 {
54  auto const independent_variable =
55  std::find_if(independent_variables_.begin(),
57  [&primary_variable](auto const& iv) -> bool
58  { return iv.type == primary_variable; });
59 
60  return independent_variable != independent_variables_.end()
61  ? std::get<double>(value_) *
62  std::get<double>(independent_variable->slope)
63  : decltype(value_){};
64 }

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

◆ value()

PropertyDataType MaterialPropertyLib::Linear::value ( VariableArray const &  variable_array,
ParameterLib::SpatialPosition const &  ,
double const  ,
double const   
) const
overridevirtual

This method computes the value of a property depending linearly on the value of the given primary variable.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 26 of file Linear.cpp.

29 {
30  auto calculate_linearized_ratio =
31  [&variable_array](double const initial_linearized_ratio, auto const& iv)
32  {
33  return initial_linearized_ratio +
34  std::get<double>(iv.slope) *
35  (std::get<double>(
36  variable_array[static_cast<int>(iv.type)]) -
37  std::get<double>(iv.reference_condition));
38  };
39 
40  double const linearized_ratio_to_reference_value =
41  std::accumulate(independent_variables_.begin(),
43  1.0,
44  calculate_linearized_ratio);
45 
46  return std::get<double>(value_) * linearized_ratio_to_reference_value;
47 }

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

Member Data Documentation

◆ independent_variables_

std::vector<IndependentVariable> const MaterialPropertyLib::Linear::independent_variables_
private

Definition at line 61 of file Linear.h.

Referenced by dValue(), and value().


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