www.mooseframework.org
ComputeVariableEigenstrain.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 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<ComputeEigenstrain>();
14  params.addClassDescription("Computes an Eigenstrain and its derivatives that is a function of "
15  "multiple variables, where the prefactor is defined in a derivative "
16  "material");
17  params.addRequiredCoupledVar("args", "variable dependencies for the prefactor");
18  return params;
19 }
20 
21 ComputeVariableEigenstrain::ComputeVariableEigenstrain(const InputParameters & parameters)
22  : DerivativeMaterialInterface<ComputeEigenstrain>(parameters),
23  _num_args(coupledComponents("args")),
24  _dprefactor(_num_args),
25  _d2prefactor(_num_args),
26  _delastic_strain(_num_args),
27  _d2elastic_strain(_num_args)
28 {
29  // fetch prerequisite derivatives and build elastic_strain derivatives and cross-derivatives
30  for (unsigned int i = 0; i < _num_args; ++i)
31  {
32  const VariableName & iname = getVar("args", i)->name();
33  _dprefactor[i] = &getMaterialPropertyDerivative<Real>("prefactor", iname);
34  _delastic_strain[i] =
35  &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", iname);
36 
37  _d2prefactor[i].resize(_num_args);
38  _d2elastic_strain[i].resize(_num_args);
39 
40  for (unsigned int j = i; j < _num_args; ++j)
41  {
42  const VariableName & jname = getVar("args", j)->name();
43  _d2prefactor[i][j] = &getMaterialPropertyDerivative<Real>("prefactor", iname, jname);
44  _d2elastic_strain[i][j] =
45  &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", iname, jname);
46  }
47  }
48 }
49 
50 void
52 {
54 
55  // Define derivatives of the elastic strain
56  for (unsigned int i = 0; i < _num_args; ++i)
57  {
58  (*_delastic_strain[i])[_qp] = -_eigen_base_tensor * (*_dprefactor[i])[_qp];
59  for (unsigned int j = i; j < _num_args; ++j)
60  (*_d2elastic_strain[i][j])[_qp] = -_eigen_base_tensor * (*_d2prefactor[i][j])[_qp];
61  }
62 }
const unsigned int _num_args
number of variables the prefactor depends on
InputParameters validParams< ComputeVariableEigenstrain >()
ComputeVariableEigenstrain(const InputParameters &parameters)
ComputeEigenstrain computes an Eigenstrain that is a function of a single variable defined by a base ...
std::vector< std::vector< MaterialProperty< RankTwoTensor > * > > _d2elastic_strain
second derivatives of the elastic strain w.r.t. to the args
virtual void computeQpEigenstrain()
Compute the eigenstrain and store in _eigenstrain.
std::vector< std::vector< const MaterialProperty< Real > * > > _d2prefactor
second derivatives of the prefactor w.r.t. to the args
std::vector< MaterialProperty< RankTwoTensor > * > _delastic_strain
first derivatives of the elastic strain w.r.t. to the args
InputParameters validParams< ComputeEigenstrain >()
std::vector< const MaterialProperty< Real > * > _dprefactor
first derivatives of the prefactor w.r.t. to the args