www.mooseframework.org
RankTwoAux.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 /****************************************************************/
7 #include "RankTwoAux.h"
8 #include "RankTwoScalarTools.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<AuxKernel>();
15  params.addClassDescription("Access a component of a RankTwoTensor");
16  params.addRequiredParam<MaterialPropertyName>("rank_two_tensor",
17  "The rank two material tensor name");
18  params.addRequiredRangeCheckedParam<unsigned int>(
19  "index_i",
20  "index_i >= 0 & index_i <= 2",
21  "The index i of ij for the tensor to output (0, 1, 2)");
22  params.addRequiredRangeCheckedParam<unsigned int>(
23  "index_j",
24  "index_j >= 0 & index_j <= 2",
25  "The index j of ij for the tensor to output (0, 1, 2)");
26  params.addParam<unsigned int>("selected_qp", "Evaluate the tensor at this specific quadpoint");
27  params.addParamNamesToGroup("selected_qp", "Advanced");
28  return params;
29 }
30 
31 RankTwoAux::RankTwoAux(const InputParameters & parameters)
32  : AuxKernel(parameters),
33  _tensor(getMaterialProperty<RankTwoTensor>("rank_two_tensor")),
34  _i(getParam<unsigned int>("index_i")),
35  _j(getParam<unsigned int>("index_j")),
36  _has_selected_qp(isParamValid("selected_qp")),
37  _selected_qp(_has_selected_qp ? getParam<unsigned int>("selected_qp") : 0)
38 {
39 }
40 
41 Real
43 {
44  unsigned int qp = _qp;
45  if (_has_selected_qp)
46  {
47  if (_selected_qp >= _q_point.size())
48  {
49  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
50  mooseError("RankTwoAux. selected_qp specified as ",
52  " but there are only ",
53  _q_point.size(),
54  " quadpoints in the element");
55  }
56  qp = _selected_qp;
57  }
58 
60 }
const MaterialProperty< RankTwoTensor > & _tensor
Definition: RankTwoAux.h:33
const unsigned int _selected_qp
The std::vector will be evaluated at this quadpoint only if defined.
Definition: RankTwoAux.h:41
Real component(const RankTwoTensor &r2tensor, unsigned int i, unsigned int j)
const unsigned int _j
Definition: RankTwoAux.h:35
InputParameters validParams< RankTwoAux >()
RankTwoAux is designed to take the data in the RankTwoTensor material property, for example stress or...
Definition: RankTwoAux.C:12
const unsigned int _i
Definition: RankTwoAux.h:34
virtual Real computeValue()
Definition: RankTwoAux.C:42
const bool _has_selected_qp
whether or not selected_qp has been set
Definition: RankTwoAux.h:38
RankTwoAux(const InputParameters &parameters)
Definition: RankTwoAux.C:31