LCOV - code coverage report
Current view: top level - src/materials - RankTwoSphericalComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 23 26 88.5 %
Date: 2025-09-04 07:57:23 Functions: 6 8 75.0 %
Legend: Lines: hit not hit

          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 "RankTwoSphericalComponent.h"
      11             : #include "RankTwoScalarTools.h"
      12             : 
      13             : #include "metaphysicl/raw_type.h"
      14             : 
      15             : registerMooseObject("SolidMechanicsApp", RankTwoSphericalComponent);
      16             : registerMooseObject("SolidMechanicsApp", ADRankTwoSphericalComponent);
      17             : 
      18             : template <bool is_ad>
      19             : InputParameters
      20         400 : RankTwoSphericalComponentTempl<is_ad>::validParams()
      21             : {
      22         400 :   InputParameters params = Material::validParams();
      23         400 :   params.addClassDescription(
      24             :       "Compute components of a rank-2 tensor in a spherical coordinate system");
      25         800 :   params.addRequiredParam<MaterialPropertyName>("rank_two_tensor",
      26             :                                                 "The rank two material tensor name");
      27         800 :   params.addRequiredParam<MaterialPropertyName>(
      28             :       "property_name", "Name of the material property computed by this model");
      29         800 :   MooseEnum sphericalTypes("HoopStress RadialStress");
      30         800 :   params.addParam<MooseEnum>(
      31             :       "spherical_component", sphericalTypes, "Type of spherical scalar output");
      32         800 :   params.addParam<Point>("spherical_center_point",
      33             :                          "Center point of the spherical coordinate system.");
      34         400 :   return params;
      35         400 : }
      36             : 
      37             : template <bool is_ad>
      38         300 : RankTwoSphericalComponentTempl<is_ad>::RankTwoSphericalComponentTempl(
      39             :     const InputParameters & parameters)
      40             :   : Material(parameters),
      41         300 :     _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("rank_two_tensor")),
      42         600 :     _property(declareGenericProperty<Real, is_ad>("property_name")),
      43         600 :     _spherical_component(getParam<MooseEnum>("spherical_component")
      44             :                              .template getEnum<RankTwoScalarTools::SphericalComponent>()),
      45        1200 :     _center(isParamValid("spherical_center_point") ? getParam<Point>("spherical_center_point")
      46         300 :                                                    : Point(0, 0, 0))
      47             : {
      48         300 : }
      49             : 
      50             : template <bool is_ad>
      51             : void
      52           0 : RankTwoSphericalComponentTempl<is_ad>::initQpStatefulProperties()
      53             : {
      54           0 :   _property[_qp] = 0.0;
      55           0 : }
      56             : 
      57             : template <bool is_ad>
      58             : void
      59        7596 : RankTwoSphericalComponentTempl<is_ad>::computeQpProperties()
      60             : {
      61             :   Point dummy_direction;
      62             : 
      63        7596 :   _property[_qp] = RankTwoScalarTools::getSphericalComponent(MetaPhysicL::raw_value(_tensor[_qp]),
      64        7596 :                                                              _spherical_component,
      65        7596 :                                                              _center,
      66        7596 :                                                              _q_point[_qp],
      67             :                                                              dummy_direction);
      68        7596 : }
      69             : 
      70             : template class RankTwoSphericalComponentTempl<false>;
      71             : template class RankTwoSphericalComponentTempl<true>;

Generated by: LCOV version 1.14