LCOV - code coverage report
Current view: top level - src/materials - RankTwoSphericalComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 23 26 88.5 %
Date: 2025-07-25 05:00:39 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         360 : RankTwoSphericalComponentTempl<is_ad>::validParams()
      21             : {
      22         360 :   InputParameters params = Material::validParams();
      23         360 :   params.addClassDescription(
      24             :       "Compute components of a rank-2 tensor in a spherical coordinate system");
      25         720 :   params.addRequiredParam<MaterialPropertyName>("rank_two_tensor",
      26             :                                                 "The rank two material tensor name");
      27         720 :   params.addRequiredParam<MaterialPropertyName>(
      28             :       "property_name", "Name of the material property computed by this model");
      29         720 :   MooseEnum sphericalTypes("HoopStress RadialStress");
      30         720 :   params.addParam<MooseEnum>(
      31             :       "spherical_component", sphericalTypes, "Type of spherical scalar output");
      32         720 :   params.addParam<Point>("spherical_center_point",
      33             :                          "Center point of the spherical coordinate system.");
      34         360 :   return params;
      35         360 : }
      36             : 
      37             : template <bool is_ad>
      38         270 : RankTwoSphericalComponentTempl<is_ad>::RankTwoSphericalComponentTempl(
      39             :     const InputParameters & parameters)
      40             :   : Material(parameters),
      41         270 :     _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("rank_two_tensor")),
      42         540 :     _property(declareGenericProperty<Real, is_ad>("property_name")),
      43         540 :     _spherical_component(getParam<MooseEnum>("spherical_component")
      44             :                              .template getEnum<RankTwoScalarTools::SphericalComponent>()),
      45        1080 :     _center(isParamValid("spherical_center_point") ? getParam<Point>("spherical_center_point")
      46         270 :                                                    : Point(0, 0, 0))
      47             : {
      48         270 : }
      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        6288 : RankTwoSphericalComponentTempl<is_ad>::computeQpProperties()
      60             : {
      61             :   Point dummy_direction;
      62             : 
      63        6288 :   _property[_qp] = RankTwoScalarTools::getSphericalComponent(MetaPhysicL::raw_value(_tensor[_qp]),
      64        6288 :                                                              _spherical_component,
      65        6288 :                                                              _center,
      66        6288 :                                                              _q_point[_qp],
      67             :                                                              dummy_direction);
      68        6288 : }
      69             : 
      70             : template class RankTwoSphericalComponentTempl<false>;
      71             : template class RankTwoSphericalComponentTempl<true>;

Generated by: LCOV version 1.14