www.mooseframework.org
RankTwoScalarAux.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 
8 #include "RankTwoScalarAux.h"
9 #include "RankTwoScalarTools.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<AuxKernel>();
16  params.addClassDescription("Compute a scalar property of a RankTwoTensor");
17  params.addRequiredParam<MaterialPropertyName>("rank_two_tensor",
18  "The rank two material tensor name");
19  params.addParam<MooseEnum>(
20  "scalar_type", RankTwoScalarTools::scalarOptions(), "Type of scalar output");
21  params.addParam<unsigned int>(
22  "selected_qp",
23  "Evaluate the tensor at this quadpoint. This option only needs to be used if "
24  "you are interested in a particular quadpoint in each element: otherwise do "
25  "not include this parameter in your input file");
26  params.addParamNamesToGroup("selected_qp", "Advanced");
27 
28  params.addParam<Point>(
29  "point1",
30  Point(0, 0, 0),
31  "Start point for axis used to calculate some cylinderical material tensor quantities");
32  params.addParam<Point>("point2",
33  Point(0, 1, 0),
34  "End point for axis used to calculate some material tensor quantities");
35  params.addParam<Point>("direction", Point(0, 0, 1), "Direction vector");
36  return params;
37 }
38 
39 RankTwoScalarAux::RankTwoScalarAux(const InputParameters & parameters)
40  : AuxKernel(parameters),
41  _tensor(getMaterialProperty<RankTwoTensor>("rank_two_tensor")),
42  _scalar_type(getParam<MooseEnum>("scalar_type")),
43  _has_selected_qp(isParamValid("selected_qp")),
44  _selected_qp(_has_selected_qp ? getParam<unsigned int>("selected_qp") : 0),
45  _point1(parameters.get<Point>("point1")),
46  _point2(parameters.get<Point>("point2")),
47  _input_direction(parameters.get<Point>("direction") / parameters.get<Point>("direction").norm())
48 {
49 }
50 
51 Real
53 {
54  unsigned int qp = _qp;
55  if (_has_selected_qp)
56  {
57  if (_selected_qp >= _q_point.size())
58  {
59  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
60  mooseError("RankTwoScalarAux. selected_qp specified as ",
62  " but there are only ",
63  _q_point.size(),
64  " quadpoints in the element");
65  }
66  qp = _selected_qp;
67  }
68 
70  _tensor[qp], _scalar_type, _point1, _point2, _q_point[qp], _input_direction);
71 }
const Point _point2
MooseEnum _scalar_type
Determines the information to be extracted from the tensor by using the RankTwoScalarTools namespace...
const Point _point1
const bool _has_selected_qp
whether or not selected_qp has been set
const unsigned int _selected_qp
The std::vector will be evaluated at this quadpoint only if defined.
Real getQuantity(const RankTwoTensor &tensor, const MooseEnum scalar_type, const Point &point1, const Point &point2, const Point &curr_point, Point &direction)
virtual Real computeValue()
const MaterialProperty< RankTwoTensor > & _tensor
RankTwoScalarAux(const InputParameters &parameters)
InputParameters validParams< RankTwoScalarAux >()