Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "CylindricalRankTwoAux.h" 11 : 12 : registerMooseObject("SolidMechanicsApp", CylindricalRankTwoAux); 13 : 14 : InputParameters 15 48 : CylindricalRankTwoAux::validParams() 16 : { 17 48 : InputParameters params = AuxKernel::validParams(); 18 48 : params.addClassDescription( 19 : "Takes RankTwoTensor material and outputs component in cylindrical coordinates"); 20 96 : params.addRequiredParam<MaterialPropertyName>("rank_two_tensor", 21 : "The rank two material tensor name"); 22 96 : params.addRequiredRangeCheckedParam<unsigned int>( 23 : "index_i", 24 : "index_i >= 0 & index_i <= 2", 25 : "The index i of ij for the tensor to output (0, 1, 2)"); 26 96 : params.addRequiredRangeCheckedParam<unsigned int>( 27 : "index_j", 28 : "index_j >= 0 & index_j <= 2", 29 : "The index j of ij for the tensor to output (0, 1, 2)"); 30 96 : params.addRequiredParam<Point>("center_point", 31 : "Location of the center point of the cylindrical coordinates"); 32 48 : return params; 33 0 : } 34 : 35 24 : CylindricalRankTwoAux::CylindricalRankTwoAux(const InputParameters & parameters) 36 : : AuxKernel(parameters), 37 24 : _tensor(getMaterialProperty<RankTwoTensor>("rank_two_tensor")), 38 48 : _i(getParam<unsigned int>("index_i")), 39 48 : _j(getParam<unsigned int>("index_j")), 40 72 : _center_point(getParam<Point>("center_point")) 41 : { 42 24 : } 43 : 44 : Real 45 1608000 : CylindricalRankTwoAux::computeValue() 46 : { 47 1608000 : Point loc_from_center = _q_point[_qp] - _center_point; 48 : 49 1608000 : Real theta = std::atan2(loc_from_center(1), loc_from_center(0)); 50 1608000 : RankTwoTensor R; 51 1608000 : R(0, 0) = std::cos(theta); 52 1608000 : R(0, 1) = std::sin(theta); 53 1608000 : R(1, 0) = -std::sin(theta); 54 1608000 : R(1, 1) = std::cos(theta); 55 : 56 1608000 : RankTwoTensor rotated_tensor = R * _tensor[_qp] * R.transpose(); 57 : 58 1608000 : return rotated_tensor(_i, _j); 59 : }