https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad > Class Template Reference

ComputeInstantaneousThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansion according to an instantaneous thermal expansion function. More...

#include <ComputeInstantaneousThermalExpansionFunctionEigenstrain.h>

Inheritance diagram for ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl (const InputParameters &parameters)
 
virtual void subdomainSetup () final
 resize _temperature_buffer
 
virtual void computeProperties () final
 update _temperature_buffer
 
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 void initQpStatefulProperties () override
 
virtual ValueAndDerivative< is_ad > computeThermalStrain () override
 computeThermalStrain must be overridden in derived classes.
 

Protected Attributes

const Function_thermal_expansion_function
 
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).
 
const bool _use_old_temperature
 lag temperature variable
 
const VariableValue_temperature_old
 previous time step temperature
 
MaterialProperty< RankTwoTensor > * _deigenstrain_dT
 
const VariableValue_stress_free_temperature
 
GenericMaterialProperty< Real, is_ad > & _thermal_strain
 Stores the thermal strain as a scalar for use in computing an incremental update.
 
const MaterialProperty< Real > & _thermal_strain_old
 
bool & _step_one
 Indicates whether we are on the first step, avoiding false positives when restarting.
 

Private Member Functions

bool haveMaterialProperty (const std::string &prop_name)
 
std::vector< VariableName > buildVariableVector (const VariableName &c1, const VariableName &c2, const VariableName &c3)
 
void validateCouplingHelper (const MaterialPropertyName &base, const std::vector< VariableName > &c, const System &system, std::vector< VariableName > &missing)
 
bool isNotObjectVariable (const VariableName &name)
 

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

Detailed Description

template<bool is_ad>
class ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >

ComputeInstantaneousThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansion according to an instantaneous thermal expansion function.

Definition at line 19 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.h.

Constructor & Destructor Documentation

◆ ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl()

Definition at line 34 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.C.

37 _thermal_expansion_function(this->getFunction("thermal_expansion_function")),
38 _thermal_strain(this->template declareGenericProperty<Real, is_ad>(
39 this->_base_name + "InstantaneousThermalExpansionFunction_thermal_strain")),
40 _thermal_strain_old(this->template getMaterialPropertyOld<Real>(
41 this->_base_name + "InstantaneousThermalExpansionFunction_thermal_strain")),
42 _step_one(this->template declareRestartableData<bool>("step_one", true))
43{
44 if (this->_use_old_temperature)
45 this->paramError("use_old_temperature",
46 "The old temperature value cannot be used in this incremental update model.");
47}
bool & _step_one
Indicates whether we are on the first step, avoiding false positives when restarting.
GenericMaterialProperty< Real, is_ad > & _thermal_strain
Stores the thermal strain as a scalar for use in computing an incremental update.
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)
78 else
79 {
82 else
84 }
85
87}
const GenericVariableValue< is_ad > & _temperature_prop
current temperature
std::vector< ValueAndDerivative< is_ad > > _temperature_buffer
Temperature used in the eigenstrain calculation (current value if _use_old_temperature=false,...
const VariableValue & _temperature_old
previous time step temperature
virtual void computeProperties() override

◆ 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 {
114 (*_mean_thermal_expansion_coefficient)[_qp] = 0.0;
115 else
117 thermal_strain.value() / (_temperature[_qp].value() - _stress_free_temperature[_qp]);
118 }
120 {
121 (*_deigenstrain_dT)[_qp].zero();
123 (*_deigenstrain_dT)[_qp].addIa(thermal_strain.derivatives());
124 }
125 }
126}
const std::vector< ValueAndDerivative< is_ad > > & _temperature
Temperature to use in the eigenstrain calculation (current value if _use_old_temperature=false,...
MaterialProperty< Real > * _mean_thermal_expansion_coefficient
mean coefficient of thermal expansion (for output verification)
virtual ValueAndDerivative< is_ad > computeThermalStrain()=0
computeThermalStrain must be overridden in derived classes.
auto raw_value(const Eigen::Map< T > &in)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

◆ computeThermalStrain()

template<bool is_ad>
ValueAndDerivative< is_ad > ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< 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 (\delta L / L)

Implements ComputeThermalExpansionEigenstrainBaseTempl< is_ad >.

Definition at line 58 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.C.

59{
60 if (this->_t_step > 1)
61 _step_one = false;
62
63 const auto & old_temp =
64 (_step_one ? this->_stress_free_temperature[_qp] : this->_temperature_old[_qp]);
65 const auto delta_T = this->_temperature[_qp] - old_temp;
66
67 const auto alpha_current_temp = _thermal_expansion_function.value(this->_temperature[_qp]);
68 const auto alpha_old_temp = _thermal_expansion_function.value(old_temp);
69
70 const auto thermal_strain =
71 _thermal_strain_old[_qp] + delta_T * 0.5 * (alpha_current_temp + alpha_old_temp);
72
73 // Store thermal strain for use in the next timestep (casts ValueAndDerivative<is_ad>
74 // to GenericReal<is_ad>).
75 _thermal_strain[_qp] = dual_number_cast<GenericReal<is_ad>>(thermal_strain);
76
77 return thermal_strain;
78}
virtual Real value(Real t, const Point &p) const

◆ initQpStatefulProperties()

template<bool is_ad>
void ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 51 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.C.

52{
53 _thermal_strain[_qp] = 0;
54}

◆ 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

◆ validParams()

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

Definition at line 20 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.C.

21{
23 params.addClassDescription("Computes eigenstrain due to thermal expansion using a function that "
24 "describes the instantaneous thermal expansion as a function of "
25 "temperature");
26 params.addRequiredParam<FunctionName>("thermal_expansion_function",
27 "Function describing the instantaneous thermal expansion "
28 "coefficient as a function of temperature");
29 params.suppressParameter<bool>("use_old_temperature");
30 return params;
31}
void suppressParameter(const std::string &name)
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.

◆ _mean_thermal_expansion_coefficient

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

mean coefficient of thermal expansion (for output verification)

Definition at line 91 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _step_one

template<bool is_ad>
bool& ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::_step_one
protected

Indicates whether we are on the first step, avoiding false positives when restarting.

Definition at line 42 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.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_buffer

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

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
protectedinherited

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
privateinherited

current temperature

Definition at line 88 of file ComputeThermalExpansionEigenstrainBase.h.

◆ _thermal_expansion_function

template<bool is_ad>
const Function& ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::_thermal_expansion_function
protected

◆ _thermal_strain

template<bool is_ad>
GenericMaterialProperty<Real, is_ad>& ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::_thermal_strain
protected

Stores the thermal strain as a scalar for use in computing an incremental update.

Definition at line 37 of file ComputeInstantaneousThermalExpansionFunctionEigenstrain.h.

◆ _thermal_strain_old

template<bool is_ad>
const MaterialProperty<Real>& ComputeInstantaneousThermalExpansionFunctionEigenstrainTempl< is_ad >::_thermal_strain_old
protected

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