www.mooseframework.org
ComputeEigenstrainBeamFromVariable.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 
13 
16 {
18  params.addClassDescription("Computes an eigenstrain from a set of variables");
19  params.addCoupledVar("displacement_eigenstrain_variables",
20  "A list of variable names describing the "
21  "displacement eigenstrain. If provided, there must be 3 "
22  "entries, corresponding to the axial and shear "
23  "eigenstrains in the global coordinate system.");
24  params.addCoupledVar("rotational_eigenstrain_variables",
25  "A list of variable names describing the rotational "
26  "eigenstrain. If provided, there must be 3 entries, "
27  "corresponding to the rotational eigenstrain in the "
28  "global coordinate system.");
29  return params;
30 }
31 
33  const InputParameters & parameters)
34  : ComputeEigenstrainBeamBase(parameters),
35  _ndisp(coupledComponents("displacement_eigenstrain_variables")),
36  _nrot(coupledComponents("rotational_eigenstrain_variables")),
37  _disp(_ndisp > 0 ? coupledValues("displacement_eigenstrain_variables")
38  : std::vector<const VariableValue *>(3, &_zero)),
39  _rot(_nrot > 0 ? coupledValues("rotational_eigenstrain_variables")
40  : std::vector<const VariableValue *>(3, &_zero))
41 {
42  if ((_ndisp != 3 && _ndisp != 0) || (_nrot != 3 && _nrot != 0))
43  mooseError("ComputeEigenstrainBeamFromVariable: If the displacement or rotational eigenstrains "
44  "are provided, it should contain 3 variables corresponding to the three "
45  "components in the global coordinate system.");
46 }
47 
48 void
50 {
51  for (unsigned int i = 0; i < 3; ++i)
52  {
53  _disp_eigenstrain[_qp](i) = (*_disp[i])[_qp];
54  _rot_eigenstrain[_qp](i) = (*_rot[i])[_qp];
55  }
56 }
ComputeEigenstrainBeamFromVariable computes an eigenstrain from displacement and rotational eigenstra...
ComputeEigenstrainBeamFromVariable(const InputParameters &parameters)
const std::vector< const VariableValue * > _rot
Rotational eigenstrain variable values.
virtual void computeQpEigenstrain() override
Compute the eigenstrain and store in _disp_eigenstrain and _rot_eigenstrain.
MaterialProperty< RealVectorValue > & _rot_eigenstrain
Stores the current rotational eigenstrain.
unsigned int _qp
const unsigned int _ndisp
Number of displacement eigenstrain variables.
MaterialProperty< RealVectorValue > & _disp_eigenstrain
Stores the current displacement eigenstrain.
void addCoupledVar(const std::string &name, const std::string &doc_string)
const std::vector< const VariableValue * > _disp
Displacemenet eigenstrain variable values.
static InputParameters validParams()
OutputTools< Real >::VariableValue VariableValue
registerMooseObject("SolidMechanicsApp", ComputeEigenstrainBeamFromVariable)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
ComputeEigenstrainBeamBase is the base class for beam eigenstrain vectors.
const unsigned int _nrot
Number of rotational eigenstrain variables.