OGS
MaterialPropertyLib::Curve Class Referencefinal

Detailed Description

Definition of a curve property, i.e., a piecewise linear property given by pairs of supporting point and value. The pairs are specified by a curve. The current implementation accepts only the double datatype defined in PropertyDataType.

Definition at line 22 of file Curve.h.

#include <Curve.h>

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

Public Member Functions

 Curve (std::string name, Variable const independent_variable, MathLib::PiecewiseLinearInterpolation const &curve)
 
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
 
- 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 PropertyDataType d2Value (VariableArray const &variable_array, Variable const variable1, Variable const variable2, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const
 Default implementation: 2nd derivative of any constant property is zero.
 
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

Variable const independent_variable_
 The variable type that the curve property depends on.
 
MathLib::PiecewiseLinearInterpolation const & curve_
 The curve used by 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

◆ Curve()

MaterialPropertyLib::Curve::Curve ( std::string name,
Variable const independent_variable,
MathLib::PiecewiseLinearInterpolation const & curve )

This constructor allows to specify the independent variable of the curve and the curve itself, i.e., a piecewise linear function.

Definition at line 15 of file Curve.cpp.

18 : independent_variable_(independent_variable), curve_(curve)
19{
20 name_ = std::move(name);
21}
MathLib::PiecewiseLinearInterpolation const & curve_
The curve used by the property.
Definition Curve.h:48
Variable const independent_variable_
The variable type that the curve property depends on.
Definition Curve.h:46

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

Member Function Documentation

◆ dValue()

PropertyDataType MaterialPropertyLib::Curve::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 31 of file Curve.cpp.

35{
36 if (variable != independent_variable_)
37 {
38 return 0.0;
39 }
40
41 auto const x = std::get<double>(variable_array[independent_variable_]);
42 return curve_.getDerivative(x);
43}
double getDerivative(double const pnt_to_interpolate) const
Calculates derivative using quadratic interpolation and central difference quotient.

References curve_, MathLib::PiecewiseLinearInterpolation::getDerivative(), and independent_variable_.

◆ value()

PropertyDataType MaterialPropertyLib::Curve::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 depending linearly on the value of the given primary variable.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 23 of file Curve.cpp.

26{
27 auto const x = std::get<double>(variable_array[independent_variable_]);
28 return curve_.getValue(x);
29}
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.

References curve_, MathLib::PiecewiseLinearInterpolation::getValue(), and independent_variable_.

Member Data Documentation

◆ curve_

MathLib::PiecewiseLinearInterpolation const& MaterialPropertyLib::Curve::curve_
private

The curve used by the property.

Definition at line 48 of file Curve.h.

Referenced by dValue(), and value().

◆ independent_variable_

Variable const MaterialPropertyLib::Curve::independent_variable_
private

The variable type that the curve property depends on.

Definition at line 46 of file Curve.h.

Referenced by dValue(), and value().


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