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

ComputeThermalExpansionEigenstrainBase is a base class for all models that compute eigenstrains due to thermal expansion of a material. More...

#include <ComputeThermalExpansionEigenstrainBase.h>

Inheritance diagram for ComputeThermalExpansionEigenstrainBaseTempl< is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 ComputeThermalExpansionEigenstrainBaseTempl (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 ()=0
 computeThermalStrain must be overridden in derived classes. More...
 

Protected Attributes

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
 

Private Attributes

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). More...
 
const GenericVariableValue< is_ad > & _temperature_prop
 current temperature More...
 
MaterialProperty< Real > * _mean_thermal_expansion_coefficient
 mean coefficient of thermal expansion (for output verification) More...
 

Detailed Description

template<bool is_ad>
class ComputeThermalExpansionEigenstrainBaseTempl< is_ad >

ComputeThermalExpansionEigenstrainBase is a base class for all models that compute eigenstrains due to thermal expansion of a material.

Definition at line 26 of file ComputeThermalExpansionEigenstrainBase.h.

Constructor & Destructor Documentation

◆ ComputeThermalExpansionEigenstrainBaseTempl()

Definition at line 32 of file ComputeThermalExpansionEigenstrainBase.C.

36  _use_old_temperature(this->template getParam<bool>("use_old_temperature")),
37  _temperature_old(this->_fe_problem.isTransient() ? this->coupledValueOld("temperature")
38  : this->_zero),
39  _deigenstrain_dT((is_ad || this->isCoupledConstant("temperature"))
40  ? nullptr
41  : &this->template declarePropertyDerivative<RankTwoTensor>(
42  _eigenstrain_name, this->coupledName("temperature"))),
43  _stress_free_temperature(this->coupledValue("stress_free_temperature")),
44  _temperature_prop(this->template coupledGenericValue<is_ad>("temperature")),
46  this->isParamValid("mean_thermal_expansion_coefficient_name")
47  ? &this->template declareProperty<Real>(this->template getParam<MaterialPropertyName>(
48  "mean_thermal_expansion_coefficient_name"))
49  : nullptr)
50 {
51  if (_use_old_temperature && !this->_fe_problem.isTransient())
52  this->paramError(
53  "use_old_temperature",
54  "The old state of the temperature variable is only available in a transient simulation.");
55 }
MaterialProperty< Real > * _mean_thermal_expansion_coefficient
mean coefficient of thermal expansion (for output verification)
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
const GenericVariableValue< is_ad > & _temperature_prop
current temperature
const VariableValue & _temperature_old
previous time step temperature
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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).
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).

Member Function Documentation

◆ computeProperties()

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

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 ( )
overridevirtual

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>
virtual ValueAndDerivative<is_ad> ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::computeThermalStrain ( )
protectedpure virtual

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)

Implemented in ComputeMeanThermalExpansionEigenstrainBaseTempl< is_ad >, ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >, ComputeDilatationThermalExpansionEigenstrainBaseTempl< is_ad >, and ComputeThermalExpansionEigenstrainTempl< is_ad >.

◆ subdomainSetup()

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

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

Definition at line 15 of file ComputeThermalExpansionEigenstrainBase.C.

Referenced by ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::validParams(), ComputeThermalExpansionEigenstrainTempl< is_ad >::validParams(), ComputeDilatationThermalExpansionEigenstrainBaseTempl< is_ad >::validParams(), and ComputeMeanThermalExpansionEigenstrainBaseTempl< is_ad >::validParams().

16 {
18  params.addCoupledVar("temperature", "Coupled temperature");
19  params.addRequiredCoupledVar("stress_free_temperature",
20  "Reference temperature at which there is no "
21  "thermal expansion for thermal eigenstrain "
22  "calculation");
23  params.addParam<bool>("use_old_temperature",
24  false,
25  "Flag to optionally use the temperature value from the previous timestep.");
26  params.addParam<MaterialPropertyName>("mean_thermal_expansion_coefficient_name",
27  "Name of the mean coefficient of thermal expansion.");
28  return params;
29 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)

Member Data Documentation

◆ _deigenstrain_dT

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

Definition at line 72 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _mean_thermal_expansion_coefficient

template<bool is_ad>
MaterialProperty<Real>* ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_mean_thermal_expansion_coefficient
private

mean coefficient of thermal expansion (for output verification)

Definition at line 91 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _stress_free_temperature

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

Definition at line 74 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _temperature

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

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_buffer

template<bool is_ad>
std::vector<ValueAndDerivative<is_ad> > ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_temperature_buffer
private

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

Definition at line 85 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _temperature_old

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

previous time step temperature

Definition at line 69 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _temperature_prop

template<bool is_ad>
const GenericVariableValue<is_ad>& ComputeThermalExpansionEigenstrainBaseTempl< is_ad >::_temperature_prop
private

current temperature

Definition at line 88 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _use_old_temperature

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

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