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