LCOV - code coverage report
Current view: top level - src/materials - RankTwoCylindricalComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 31 31 100.0 %
Date: 2024-02-27 11:53:14 Functions: 4 8 50.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14