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 "RankTwoCylindricalComponent.h" 11 : #include "RankTwoScalarTools.h" 12 : 13 : #include "metaphysicl/raw_type.h" 14 : 15 : registerMooseObject("SolidMechanicsApp", RankTwoCylindricalComponent); 16 : registerMooseObject("SolidMechanicsApp", ADRankTwoCylindricalComponent); 17 : 18 : template <bool is_ad> 19 : InputParameters 20 144 : RankTwoCylindricalComponentTempl<is_ad>::validParams() 21 : { 22 144 : InputParameters params = Material::validParams(); 23 144 : params.addClassDescription( 24 : "Compute components of a rank-2 tensor in a cylindrical coordinate system"); 25 288 : params.addRequiredParam<MaterialPropertyName>("rank_two_tensor", 26 : "The rank two material property tensor name"); 27 288 : params.addRequiredParam<MaterialPropertyName>( 28 : "property_name", "Name of the material property computed by this model"); 29 288 : MooseEnum cylindricalTypes("AxialStress HoopStress RadialStress"); 30 288 : params.addParam<MooseEnum>( 31 : "cylindrical_component", cylindricalTypes, "Type of cylindrical scalar output"); 32 288 : params.addParam<Point>( 33 : "cylindrical_axis_point1", 34 : "Start point for determining axis of rotation for cylindrical stress/strain components"); 35 288 : params.addParam<Point>( 36 : "cylindrical_axis_point2", 37 : "End point for determining axis of rotation for cylindrical stress/strain components"); 38 144 : return params; 39 144 : } 40 : 41 : template <bool is_ad> 42 108 : RankTwoCylindricalComponentTempl<is_ad>::RankTwoCylindricalComponentTempl( 43 : const InputParameters & parameters) 44 : : Material(parameters), 45 108 : _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("rank_two_tensor")), 46 216 : _property(declareGenericProperty<Real, is_ad>("property_name")), 47 216 : _cylindrical_component(getParam<MooseEnum>("cylindrical_component") 48 : .template getEnum<RankTwoScalarTools::CylindricalComponent>()), 49 216 : _cylindrical_axis_point1(isParamValid("cylindrical_axis_point1") 50 216 : ? getParam<Point>("cylindrical_axis_point1") 51 : : Point(0, 0, 0)), 52 216 : _cylindrical_axis_point2(isParamValid("cylindrical_axis_point2") 53 216 : ? getParam<Point>("cylindrical_axis_point2") 54 108 : : Point(0, 1, 0)) 55 : { 56 108 : } 57 : 58 : template <bool is_ad> 59 : void 60 0 : RankTwoCylindricalComponentTempl<is_ad>::initQpStatefulProperties() 61 : { 62 0 : _property[_qp] = 0.0; 63 0 : } 64 : 65 : template <bool is_ad> 66 : void 67 98880 : RankTwoCylindricalComponentTempl<is_ad>::computeQpProperties() 68 : { 69 : Point dummy_direction; 70 : 71 98880 : _property[_qp] = RankTwoScalarTools::getCylindricalComponent(MetaPhysicL::raw_value(_tensor[_qp]), 72 98880 : _cylindrical_component, 73 98880 : _cylindrical_axis_point1, 74 98880 : _cylindrical_axis_point2, 75 98880 : _q_point[_qp], 76 : dummy_direction); 77 98880 : } 78 : 79 : template class RankTwoCylindricalComponentTempl<false>; 80 : template class RankTwoCylindricalComponentTempl<true>;