www.mooseframework.org
StrainGradDispDerivatives.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "RankTwoTensor.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Material>();
15  params.addClassDescription(
16  "Provide the constant derivatives of strain w.r.t. the displacement gradient components.");
17  params.addCoupledVar("displacement_gradients",
18  "List of displacement gradient component variables");
19  return params;
20 }
21 
22 StrainGradDispDerivatives::StrainGradDispDerivatives(const InputParameters & parameters)
23  : DerivativeMaterialInterface<Material>(parameters),
24  _nvar(coupledComponents("displacement_gradients")),
25  _dstrain(_nvar)
26 {
27  switch (_nvar)
28  {
29  case 1:
30  _gdim = 1;
31  break;
32 
33  case 4:
34  _gdim = 2;
35  break;
36 
37  case 9:
38  _gdim = 3;
39  break;
40 
41  default:
42  mooseError("Supply 1, 4, or 9 displacement_gradient component variables");
43  }
44 
45  if (_gdim > LIBMESH_DIM)
46  mooseError("Too many gradient component variables for the current LIBMESH_DIM");
47 
48  for (unsigned int i = 0; i < _nvar; ++i)
49  _dstrain[i] = &declarePropertyDerivative<RankTwoTensor>(
50  "elastic_strain", getVar("displacement_gradients", i)->name());
51 }
52 
53 void
55 {
56  unsigned int i = 0;
57  for (unsigned int j = 0; j < _gdim; ++j)
58  for (unsigned int k = 0; k < _gdim; ++k)
59  {
60  (*_dstrain[i])[_qp].zero();
61  (*_dstrain[i])[_qp](j, k) += 0.5;
62  (*_dstrain[i])[_qp](k, j) += 0.5;
63  ++i;
64  }
65 }
StrainGradDispDerivatives(const InputParameters &parameters)
std::vector< MaterialProperty< RankTwoTensor > * > _dstrain
InputParameters validParams< StrainGradDispDerivatives >()