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