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

ComputeThermalExpansionEigenstrain computes an eigenstrain for thermal expansion with a constant expansion coefficient. More...

#include <ComputeThermalExpansionEigenstrain.h>

Inheritance diagram for ComputeThermalExpansionEigenstrainTempl< is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 ComputeThermalExpansionEigenstrainTempl (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 > computeThermalStrain () override
 computeThermalStrain must be overridden in derived classes. More...
 

Protected Attributes

const Real_thermal_expansion_coeff
 
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 ComputeThermalExpansionEigenstrainTempl< is_ad >

ComputeThermalExpansionEigenstrain computes an eigenstrain for thermal expansion with a constant expansion coefficient.

Definition at line 19 of file ComputeThermalExpansionEigenstrain.h.

Constructor & Destructor Documentation

◆ ComputeThermalExpansionEigenstrainTempl()

Definition at line 29 of file ComputeThermalExpansionEigenstrain.C.

32  _thermal_expansion_coeff(this->template getParam<Real>("thermal_expansion_coeff"))
33 {
34 }
ComputeThermalExpansionEigenstrainBase is a base class for all models that compute eigenstrains due t...

Member Function Documentation

◆ 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 > ComputeThermalExpansionEigenstrainTempl< is_ad >::computeThermalStrain ( )
overrideprotectedvirtual

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 38 of file ComputeThermalExpansionEigenstrain.C.

39 {
41 }
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).

◆ 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 ComputeThermalExpansionEigenstrainTempl< is_ad >::validParams ( )
static

Definition at line 17 of file ComputeThermalExpansionEigenstrain.C.

18 {
20  params.addClassDescription("Computes eigenstrain due to thermal expansion "
21  "with a constant coefficient");
22  params.addRequiredParam<Real>("thermal_expansion_coeff", "Thermal expansion coefficient");
23  params.declareControllable("thermal_expansion_coeff");
24 
25  return params;
26 }
void addRequiredParam(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})

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.

◆ _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.

◆ _thermal_expansion_coeff

template<bool is_ad>
const Real& ComputeThermalExpansionEigenstrainTempl< is_ad >::_thermal_expansion_coeff
protected

Definition at line 30 of file ComputeThermalExpansionEigenstrain.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: