https://mooseframework.inl.gov
Loading...
Searching...
No Matches
StrainGradDispDerivatives.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 "RankTwoTensor.h"
12
14
17{
20 "Provide the constant derivatives of strain w.r.t. the displacement gradient components.");
21 params.addCoupledVar("displacement_gradients",
22 "List of displacement gradient component variables");
23 return params;
24}
25
28 _nvar(coupledComponents("displacement_gradients")),
29 _dstrain(_nvar)
30{
31 switch (_nvar)
32 {
33 case 1:
34 _gdim = 1;
35 break;
36
37 case 4:
38 _gdim = 2;
39 break;
40
41 case 9:
42 _gdim = 3;
43 break;
44
45 default:
46 mooseError("Supply 1, 4, or 9 displacement_gradient component variables");
47 }
48
49 if (_gdim > LIBMESH_DIM)
50 mooseError("Too many gradient component variables for the current LIBMESH_DIM");
51
52 for (unsigned int i = 0; i < _nvar; ++i)
53 _dstrain[i] = &declarePropertyDerivative<RankTwoTensor>(
54 "elastic_strain", coupledName("displacement_gradients", i));
55}
56
57void
59{
60 unsigned int i = 0;
61 for (unsigned int j = 0; j < _gdim; ++j)
62 for (unsigned int k = 0; k < _gdim; ++k)
63 {
64 (*_dstrain[i])[_qp].zero();
65 (*_dstrain[i])[_qp](j, k) += 0.5;
66 (*_dstrain[i])[_qp](k, j) += 0.5;
67 ++i;
68 }
69}
void mooseError(Args &&... args)
registerMooseObject("PhaseFieldApp", StrainGradDispDerivatives)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
std::vector< MaterialProperty< RankTwoTensor > * > _dstrain
StrainGradDispDerivatives(const InputParameters &parameters)
static InputParameters validParams()