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