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