https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeInstantaneousThermalExpansionFunctionEigenstrain.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11#include "Function.h"
12#include "CastDualNumber.h"
13#include "RankTwoTensor.h"
14
17
18template <bool is_ad>
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}
32
33template <bool is_ad>
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}
48
49template <bool is_ad>
50void
55
56template <bool is_ad>
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}
79
registerMooseObject("SolidMechanicsApp", ComputeInstantaneousThermalExpansionFunctionEigenstrain)
typename std::conditional< is_ad, ADReal, ChainedReal >::type ValueAndDerivative
Return type with a single derivative.
ComputeInstantaneousThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansion...
virtual ValueAndDerivative< is_ad > computeThermalStrain() override
computeThermalStrain must be overridden in derived classes.
ComputeThermalExpansionEigenstrainBase is a base class for all models that compute eigenstrains due t...
void suppressParameter(const std::string &name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)