www.mooseframework.org
ADComputeInstantaneousThermalExpansionFunctionEigenstrain.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
12 #include "Function.h"
13 #include "RankTwoTensor.h"
14 
15 registerADMooseObject("TensorMechanicsApp",
17 
19 
20 template <ComputeStage compute_stage>
21 InputParameters
23 {
25  params.addClassDescription("Computes eigenstrain due to thermal expansion using a function that "
26  "describes the instantaneous thermal expansion as a function of "
27  "temperature");
28  params.addRequiredParam<FunctionName>("thermal_expansion_function",
29  "Function describing the instantaneous thermal expansion "
30  "coefficient as a function of temperature");
31  return params;
32 }
33 
34 template <ComputeStage compute_stage>
37  : ADComputeThermalExpansionEigenstrainBase<compute_stage>(parameters),
38  _temperature_old(coupledValueOld("temperature")),
39  _thermal_expansion_function(getFunction("thermal_expansion_function")),
40  _thermal_strain(
41  declareADProperty<Real>("InstantaneousThermalExpansionFunction_thermal_strain")),
42  _thermal_strain_old(
43  getMaterialPropertyOld<Real>("InstantaneousThermalExpansionFunction_thermal_strain")),
44  _step_one(declareRestartableData<bool>("step_one", true))
45 {
46 }
47 
48 template <ComputeStage compute_stage>
49 void
51 {
52  _thermal_strain[_qp] = 0;
53 }
54 
55 template <ComputeStage compute_stage>
56 void
58  ADReal & thermal_strain)
59 {
60  if (_t_step > 1)
61  _step_one = false;
62 
63  const Real & current_temp = MetaPhysicL::raw_value(_temperature[_qp]);
64 
65  const Real & old_thermal_strain = _thermal_strain_old[_qp];
66 
67  const Real & old_temp =
68  (_step_one ? MetaPhysicL::raw_value(_stress_free_temperature[_qp]) : _temperature_old[_qp]);
69  const Real delta_T = current_temp - old_temp;
70 
71  const Point p;
72  const Real alpha_current_temp = _thermal_expansion_function.value(current_temp, p);
73  const Real alpha_old_temp = _thermal_expansion_function.value(old_temp, p);
74 
75  thermal_strain = old_thermal_strain + delta_T * 0.5 * (alpha_current_temp + alpha_old_temp);
76  _thermal_strain[_qp] = thermal_strain;
77 }
ADComputeInstantaneousThermalExpansionFunctionEigenstrain
ADComputeInstantaneousThermalExpansionFunctionEigenstrain computes an eigenstrain for thermal expansi...
Definition: ADComputeInstantaneousThermalExpansionFunctionEigenstrain.h:16
ADComputeInstantaneousThermalExpansionFunctionEigenstrain::validParams
static InputParameters validParams()
Definition: ADComputeInstantaneousThermalExpansionFunctionEigenstrain.C:22
registerADMooseObject
registerADMooseObject("TensorMechanicsApp", ADComputeInstantaneousThermalExpansionFunctionEigenstrain)
ADComputeThermalExpansionEigenstrainBase::validParams
static InputParameters validParams()
Definition: ADComputeThermalExpansionEigenstrainBase.C:17
ADComputeInstantaneousThermalExpansionFunctionEigenstrain::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: ADComputeInstantaneousThermalExpansionFunctionEigenstrain.C:50
ADComputeThermalExpansionEigenstrainBase
ADComputeThermalExpansionEigenstrainBase is a base class for all models that compute eigenstrains due...
Definition: ADComputeThermalExpansionEigenstrainBase.h:22
ADComputeInstantaneousThermalExpansionFunctionEigenstrain::computeThermalStrain
virtual void computeThermalStrain(ADReal &thermal_strain) override
Definition: ADComputeInstantaneousThermalExpansionFunctionEigenstrain.C:57
ADComputeInstantaneousThermalExpansionFunctionEigenstrain.h
ADComputeInstantaneousThermalExpansionFunctionEigenstrain::ADComputeInstantaneousThermalExpansionFunctionEigenstrain
ADComputeInstantaneousThermalExpansionFunctionEigenstrain(const InputParameters &parameters)
Definition: ADComputeInstantaneousThermalExpansionFunctionEigenstrain.C:36
defineADLegacyParams
defineADLegacyParams(ADComputeInstantaneousThermalExpansionFunctionEigenstrain)