www.mooseframework.org
CylindricalRankTwoAux.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 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<AuxKernel>();
14  params.addClassDescription(
15  "Takes RankTwoTensor material and outputs component in cylindrical coordinates");
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.addRequiredParam<Point>("center_point",
27  "Location of the center point of the cylindrical coordinates");
28  return params;
29 }
30 
31 CylindricalRankTwoAux::CylindricalRankTwoAux(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  _center_point(getParam<Point>("center_point"))
37 {
38 }
39 
40 Real
42 {
43  Point loc_from_center = _q_point[_qp] - _center_point;
44 
45  Real theta = std::atan2(loc_from_center(1), loc_from_center(0));
46  RankTwoTensor R;
47  R(0, 0) = std::cos(theta);
48  R(0, 1) = std::sin(theta);
49  R(1, 0) = -std::sin(theta);
50  R(1, 1) = std::cos(theta);
51 
52  RankTwoTensor rotated_tensor = R * _tensor[_qp] * R.transpose();
53 
54  return rotated_tensor(_i, _j);
55 }
InputParameters validParams< CylindricalRankTwoAux >()
CylindricalRankTwoAux(const InputParameters &parameters)
const MaterialProperty< RankTwoTensor > & _tensor