OGS
MaterialPropertyLib::TemperatureDependentFraction Class Referencefinal

Detailed Description

Temperature dependent model for some volume or mass fraction

This property must be a medium property. It can be used for media with a phase change of the fluid in the pore space. Then, there is a temperature dependent (volume or mass) fraction for one of the two phases. The other one is immediately given by the remaining fraction. The fraction is computed based on a phase transition spread over a temperature interval following a sigmoid line:

\[ \frac{\phi}{1 + \exp(k(T - T_\mathrm{c}))} \]

Parameter \(k\) controlling the steepness of the phase change and \(T_\mathrm{c}\) as the characteristic temperature where the phase change is centered around (melting temperature) are forwarded to a sigmoid function.

Definition at line 38 of file TemperatureDependentFraction.h.

#include <TemperatureDependentFraction.h>

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

Public Member Functions

 TemperatureDependentFraction (std::string name, double const k, double const T_c)
 
void checkScale () const override
 
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 &pos, double const t, double const dt) const override
 
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.
 
- 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

SigmoidFunction phase_change_shape_
 

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

◆ TemperatureDependentFraction()

MaterialPropertyLib::TemperatureDependentFraction::TemperatureDependentFraction ( std::string name,
double const k,
double const T_c )

Member Function Documentation

◆ checkScale()

void MaterialPropertyLib::TemperatureDependentFraction::checkScale ( ) const
overridevirtual

Reimplemented from MaterialPropertyLib::Property.

Definition at line 26 of file TemperatureDependentFraction.cpp.

27{
28 if (!std::holds_alternative<Medium*>(scale_))
29 {
31 "The property 'TemperatureDependantFraction' is "
32 "implemented on the 'medium' scale only.");
33 }
34}
#define OGS_FATAL(...)
Definition Error.h:26
std::variant< Medium *, Phase *, Component * > scale_
Definition Property.h:297

References OGS_FATAL, and MaterialPropertyLib::Property::scale_.

◆ d2Value()

PropertyDataType MaterialPropertyLib::TemperatureDependentFraction::d2Value ( VariableArray const & variable_array,
Variable const variable1,
Variable const variable2,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

Default implementation: 2nd derivative of any constant property is zero.

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

Reimplemented from MaterialPropertyLib::Property.

Definition at line 73 of file TemperatureDependentFraction.cpp.

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}
double d2Value(double const &T) const

References MaterialPropertyLib::SigmoidFunction::d2Value(), phase_change_shape_, MaterialPropertyLib::porosity, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::temperature, and MaterialPropertyLib::VariableArray::temperature.

◆ dValue()

PropertyDataType MaterialPropertyLib::TemperatureDependentFraction::dValue ( VariableArray const & variable_array,
Variable const variable,
ParameterLib::SpatialPosition const & pos,
double const t,
double const dt ) const
overridevirtual

This virtual method will compute the property derivative value based on the variables that are passed as arguments with the default implementation using empty variables array for the previous time step.

The default implementation of this method only returns the property value derivative without altering it.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 52 of file TemperatureDependentFraction.cpp.

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}
double dValue(double const &T) const

References MaterialPropertyLib::SigmoidFunction::dValue(), phase_change_shape_, MaterialPropertyLib::porosity, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::temperature, and MaterialPropertyLib::VariableArray::temperature.

◆ value()

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

This virtual method will compute the property value based on the variables that are passed as arguments with the default implementation using empty variables array for the previous time step.

Reimplemented from MaterialPropertyLib::Property.

Definition at line 36 of file TemperatureDependentFraction.cpp.

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}
double value(double const &T) const

References phase_change_shape_, MaterialPropertyLib::porosity, MaterialPropertyLib::Property::scale_, MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::SigmoidFunction::value().

Member Data Documentation

◆ phase_change_shape_

SigmoidFunction MaterialPropertyLib::TemperatureDependentFraction::phase_change_shape_
private

Definition at line 64 of file TemperatureDependentFraction.h.

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


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