https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad > Class Template Reference

ComputeDilatationThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansion from an dilatation function. More...

#include <ComputeDilatationThermalExpansionFunctionEigenstrain.h>

Inheritance diagram for ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 ComputeDilatationThermalExpansionFunctionEigenstrainTempl (const InputParameters &parameters)
 
virtual void subdomainSetup () final
 resize _temperature_buffer More...
 
virtual void computeProperties () final
 update _temperature_buffer More...
 
virtual void computeQpEigenstrain () override
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual ValueAndDerivative< is_ad > computeDilatation (const ValueAndDerivative< is_ad > &temperature) override
 Compute the fractional linear dilatation due to thermal expansion delta L / L along with its temperature derivative. More...
 
virtual ValueAndDerivative< is_ad > computeThermalStrain () override
 computeThermalStrain must be overridden in derived classes. More...
 

Protected Attributes

const Function_dilatation_function
 Dilatation function. More...
 
const std::vector< ValueAndDerivative< is_ad > > & _temperature
 Temperature to use in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true). More...
 
const bool _use_old_temperature
 lag temperature variable More...
 
const VariableValue_temperature_old
 previous time step temperature More...
 
MaterialProperty< RankTwoTensor > * _deigenstrain_dT
 
const VariableValue_stress_free_temperature
 

Detailed Description

template<bool is_ad>
class ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad >

ComputeDilatationThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansion from an dilatation function.

Definition at line 19 of file ComputeDilatationThermalExpansionFunctionEigenstrain.h.

Constructor & Destructor Documentation

◆ ComputeDilatationThermalExpansionFunctionEigenstrainTempl()

Definition at line 32 of file ComputeDilatationThermalExpansionFunctionEigenstrain.C.

34  _dilatation_function(this->getFunction("dilatation_function"))
35 {
36 }
ComputeDilatationThermalExpansionEigenstrainBase computes an eigenstrain for thermal expansion from a...

Member Function Documentation

◆ computeDilatation()

template<bool is_ad>
ValueAndDerivative< is_ad > ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad >::computeDilatation ( const ValueAndDerivative< is_ad > &  temperature)
overrideprotectedvirtual

Compute the fractional linear dilatation due to thermal expansion delta L / L along with its temperature derivative.

Parameters
temperaturecurrent temperature
Returns
fractional linear dilatation with temperature derivative

Implements ComputeDilatationThermalExpansionEigenstrainBaseTempl< is_ad >.

Definition at line 40 of file ComputeDilatationThermalExpansionFunctionEigenstrain.C.

42 {
43  // we need these two branches because we cannot yet evaluate Functions with ChainedReals
44  if constexpr (is_ad)
46  else
47  return {_dilatation_function.value(temperature.value()),
49 }
virtual Real timeDerivative(Real t, const Point &p) const
static const std::string temperature
Definition: NS.h:59
virtual Real value(Real t, const Point &p) const

◆ computeProperties()

template<bool is_ad>
void ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::computeProperties ( )
finalvirtualinherited

update _temperature_buffer

Definition at line 71 of file ComputeThermalExpansionEigenstrainBase.C.

72 {
73  // we need to convert the temperature variable to a ChainedReal in the is_ad == false case
74  for (_qp = 0; _qp < this->_qrule->n_points(); ++_qp)
75  if constexpr (is_ad)
76  _temperature_buffer[_qp] =
78  else
79  {
81  _temperature_buffer[_qp] = {_temperature_old[_qp], 0};
82  else
83  _temperature_buffer[_qp] = {_temperature_prop[_qp], 1};
84  }
85 
87 }
const GenericVariableValue< is_ad > & _temperature_prop
current temperature
virtual void computeProperties() override
const VariableValue & _temperature_old
previous time step temperature
std::vector< ValueAndDerivative< is_ad > > _temperature_buffer
Temperature used in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true).

◆ computeQpEigenstrain()

template<bool is_ad>
void ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::computeQpEigenstrain ( )
overridevirtualinherited

Definition at line 91 of file ComputeThermalExpansionEigenstrainBase.C.

92 {
93  _eigenstrain[_qp].zero();
94  const auto thermal_strain = computeThermalStrain();
95 
96  if constexpr (is_ad)
97  {
98  _eigenstrain[_qp].addIa(thermal_strain);
100  {
101  if (_temperature[_qp] == _stress_free_temperature[_qp])
102  (*_mean_thermal_expansion_coefficient)[_qp] = 0.0;
103  else
105  thermal_strain / (_temperature[_qp] - _stress_free_temperature[_qp]));
106  }
107  }
108  else
109  {
110  _eigenstrain[_qp].addIa(thermal_strain.value());
112  {
113  if (_temperature[_qp].value() == _stress_free_temperature[_qp])
115  else
117  thermal_strain.value() / (_temperature[_qp].value() - _stress_free_temperature[_qp]);
118  }
119  if (_deigenstrain_dT)
120  {
121  (*_deigenstrain_dT)[_qp].zero();
123  (*_deigenstrain_dT)[_qp].addIa(thermal_strain.derivatives());
124  }
125  }
126 }
MaterialProperty< Real > * _mean_thermal_expansion_coefficient
mean coefficient of thermal expansion (for output verification)
auto raw_value(const Eigen::Map< T > &in)
virtual ValueAndDerivative< is_ad > computeThermalStrain()=0
computeThermalStrain must be overridden in derived classes.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const std::vector< ValueAndDerivative< is_ad > > & _temperature
Temperature to use in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true).

◆ computeThermalStrain()

template<bool is_ad>
ValueAndDerivative< is_ad > ComputeDilatationThermalExpansionEigenstrainBaseTempl< is_ad >::computeThermalStrain ( )
overrideprotectedvirtualinherited

computeThermalStrain must be overridden in derived classes.

The return type ValueAndDerivative<is_ad> contains the value for the thermal strain and its temperature derivative. Derived classes should use _temperature[_qp] to obtain the current temperature. In the is_ad == false case that member variable is agumented and will be of the type ChainedReal. I.e. even with is_ad == false a variant of forward mode automatic differentiation will be used internally to compute the thermal strain and no manual implementation of the temperature derivative is needed.

Returns
thermal strain and its derivative, where the thermal strain is the linear thermal strain ( L / L)

Implements ComputeThermalExpansionEigenstrainBaseTempl< is_ad >.

Definition at line 28 of file ComputeDilatationThermalExpansionEigenstrainBase.C.

29 {
30  const auto stress_free = computeDilatation(this->_stress_free_temperature[_qp]);
31  const auto current = computeDilatation(this->_temperature[_qp]);
32 
33  // in non-AD mode the T derivative of the stress_free term needs get dropped.
34  // We assume _stress_free_temperature does not depend on T. In AD mode this is automatic.
35  return current - (is_ad ? stress_free : stress_free.value());
36 }
const std::vector< ValueAndDerivative< is_ad > > & _temperature
Temperature to use in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true).
virtual ValueAndDerivative< is_ad > computeDilatation(const ValueAndDerivative< is_ad > &temperature)=0
Compute the fractional linear dilatation due to thermal expansion delta L / L along with its temperat...

◆ subdomainSetup()

template<bool is_ad>
void ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::subdomainSetup ( )
finalvirtualinherited

resize _temperature_buffer

Definition at line 59 of file ComputeThermalExpansionEigenstrainBase.C.

60 {
61  // call parent class subdomain setup, which ultimately calls Material::subdomainSetup()
63 
64  // make sure we have enouch space to hold the augmented temperature values
65  const auto nqp = this->_fe_problem.getMaxQps();
66  _temperature_buffer.resize(nqp);
67 }
virtual void subdomainSetup() override
std::vector< ValueAndDerivative< is_ad > > _temperature_buffer
Temperature used in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true).

◆ validParams()

template<bool is_ad>
InputParameters ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad >::validParams ( )
static

Definition at line 19 of file ComputeDilatationThermalExpansionFunctionEigenstrain.C.

20 {
22  params.addClassDescription("Computes eigenstrain due to thermal expansion using a function that "
23  "describes the total dilatation as a function of temperature");
24  params.addRequiredParam<FunctionName>(
25  "dilatation_function",
26  "Function describing the thermal dilatation as a function of temperature");
27  return params;
28 }
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _deigenstrain_dT

template<bool is_ad>
MaterialProperty<RankTwoTensor>* ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_deigenstrain_dT
protectedinherited

Definition at line 72 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _dilatation_function

template<bool is_ad>
const Function& ComputeDilatationThermalExpansionFunctionEigenstrainTempl< is_ad >::_dilatation_function
protected

Dilatation function.

Definition at line 36 of file ComputeDilatationThermalExpansionFunctionEigenstrain.h.

◆ _stress_free_temperature

template<bool is_ad>
const VariableValue& ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_stress_free_temperature
protectedinherited

Definition at line 74 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _temperature

template<bool is_ad>
const std::vector<ValueAndDerivative<is_ad> >& ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_temperature
protectedinherited

Temperature to use in the eigenstrain calculation (current value if _use_old_temperature=false, old value if _use_old_temperature=true).

We use a const reference to a private member here to prevent derived classes from accidentally overwriting any values.

Definition at line 63 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _temperature_old

template<bool is_ad>
const VariableValue& ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_temperature_old
protectedinherited

previous time step temperature

Definition at line 69 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _use_old_temperature

template<bool is_ad>
const bool ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_use_old_temperature
protectedinherited

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