www.mooseframework.org
ADComputeIncrementalStrainBase.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 #include "MooseMesh.h"
12 
14 
15 template <ComputeStage compute_stage>
17  const InputParameters & parameters)
18  : ADComputeStrainBase<compute_stage>(parameters),
19  _grad_disp_old(3),
20  _strain_rate(adDeclareADProperty<RankTwoTensor>(_base_name + "strain_rate")),
21  _strain_increment(adDeclareADProperty<RankTwoTensor>(_base_name + "strain_increment")),
22  _rotation_increment(adDeclareADProperty<RankTwoTensor>(_base_name + "rotation_increment")),
23  _mechanical_strain_old(
24  adGetMaterialPropertyOld<RankTwoTensor>(_base_name + "mechanical_strain")),
25  _total_strain_old(adGetMaterialPropertyOld<RankTwoTensor>(_base_name + "total_strain")),
26  _eigenstrains_old(_eigenstrain_names.size())
27 {
28  for (unsigned int i = 0; i < _eigenstrains_old.size(); ++i)
29  _eigenstrains_old[i] = &adGetMaterialPropertyOld<RankTwoTensor>(_eigenstrain_names[i]);
30 }
31 
32 template <ComputeStage compute_stage>
33 void
35 {
37  for (unsigned int i = 0; i < 3; ++i)
38  {
39  if (_fe_problem.isTransient() && i < _ndisp)
40  _grad_disp_old[i] = &coupledGradientOld("displacements", i);
41  else
42  _grad_disp_old[i] = &_grad_zero;
43  }
44 }
45 
46 template <ComputeStage compute_stage>
47 void
49 {
50  _mechanical_strain[_qp].zero();
51  _total_strain[_qp].zero();
52 }
53 
54 template <ComputeStage compute_stage>
55 void
57  ADRankTwoTensor & strain)
58 {
59  for (unsigned int i = 0; i < _eigenstrains.size(); ++i)
60  {
61  strain -= (*_eigenstrains[i])[_qp];
62  strain += (*_eigenstrains_old[i])[_qp];
63  }
64 }
65 
66 // explicit instantiation is required for AD base classes
void subtractEigenstrainIncrementFromStrain(ADRankTwoTensor &strain)
std::vector< MaterialPropertyName > _eigenstrain_names
void initialSetup() override
adBaseClass(ADComputeIncrementalStrainBase)
std::vector< const MaterialProperty< RankTwoTensor > * > _eigenstrains_old
ADADComputeStrainBase is the base class for strain tensors.
defineADValidParams(ADComputeIncrementalStrainBase, ADComputeStrainBase,)
ADComputeIncrementalStrainBase is the base class for strain tensors using incremental formulations...
ADComputeIncrementalStrainBase(const InputParameters &parameters)