LCOV - code coverage report
Current view: top level - src/materials/cohesive_zone_model - CZMRealVectorScalar.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 30 32 93.8 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.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 "CZMRealVectorScalar.h"
      11             : #include "CohesiveZoneModelTools.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", CZMRealVectorScalar);
      14             : 
      15             : InputParameters
      16         912 : CZMRealVectorScalar::validParams()
      17             : {
      18         912 :   InputParameters params = InterfaceMaterial::validParams();
      19         912 :   params.addClassDescription("Compute the normal or tangent component of a vector quantity defined "
      20             :                              "on a cohesive interface.");
      21        1824 :   params.addRequiredParam<std::string>("real_vector_value", "The vector material name");
      22        1824 :   params.addRequiredParam<MaterialPropertyName>(
      23             :       "property_name", "Name of the material property computed by this model");
      24        1824 :   MooseEnum directionType("Normal Tangent");
      25        1824 :   params.addRequiredParam<MooseEnum>("direction", directionType, "the direction: Normal, Tangent");
      26        1824 :   params.addParam<std::string>("base_name", "Material property base name");
      27         912 :   return params;
      28         912 : }
      29             : 
      30         456 : CZMRealVectorScalar::CZMRealVectorScalar(const InputParameters & parameters)
      31             :   : InterfaceMaterial(parameters),
      32        1512 :     _base_name(isParamValid("base_name") && !getParam<std::string>("base_name").empty()
      33         456 :                    ? getParam<std::string>("base_name") + "_"
      34             :                    : ""),
      35         912 :     _direction(getParam<MooseEnum>("direction").getEnum<DirectionType>()),
      36         912 :     _property(declarePropertyByName<Real>(getParam<MaterialPropertyName>("property_name"))),
      37        1368 :     _vector(getMaterialPropertyByName<RealVectorValue>(_base_name +
      38             :                                                        getParam<std::string>("real_vector_value"))),
      39        1368 :     _czm_rotation(getMaterialPropertyByName<RankTwoTensor>(_base_name + "czm_total_rotation"))
      40             : {
      41         456 : }
      42             : 
      43             : void
      44      176896 : CZMRealVectorScalar::computeQpProperties()
      45             : {
      46      176896 :   const RealVectorValue normal = _czm_rotation[_qp] * RealVectorValue(1.0, 0.0, 0.0);
      47      176896 :   switch (_direction)
      48             :   {
      49       88448 :     case DirectionType::Normal:
      50       88448 :       _property[_qp] =
      51       88448 :           CohesiveZoneModelTools::computeNormalComponents(normal, _vector[_qp]) * normal;
      52       88448 :       break;
      53       88448 :     case DirectionType::Tangent:
      54       88448 :       _property[_qp] =
      55       88448 :           CohesiveZoneModelTools::computeTangentComponents(normal, _vector[_qp]).norm();
      56       88448 :       break;
      57           0 :     default:
      58           0 :       mooseError("ScalarType type not recognized");
      59             :       break;
      60             :   }
      61      176896 : }

Generated by: LCOV version 1.14