LCOV - code coverage report
Current view: top level - src/postprocessors - PolarMomentOfInertia.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 14 15 93.3 %
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 "PolarMomentOfInertia.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", PolarMomentOfInertia);
      13             : 
      14             : InputParameters
      15          60 : PolarMomentOfInertia::validParams()
      16             : {
      17          60 :   InputParameters params = SideIntegralPostprocessor::validParams();
      18         120 :   params.addRequiredParam<Point>("origin", "Axis origin");
      19         120 :   params.addRequiredParam<RealVectorValue>("direction", "Axis direction");
      20          60 :   params.addClassDescription(
      21             :       "Compute the polar moment of inertia of a sideset w.r.t. a point and a direction");
      22          60 :   return params;
      23           0 : }
      24             : 
      25          30 : PolarMomentOfInertia::PolarMomentOfInertia(const InputParameters & parameters)
      26             :   : SideIntegralPostprocessor(parameters),
      27          30 :     _origin(getParam<Point>("origin")),
      28          90 :     _direction(getParam<RealVectorValue>("direction"))
      29             : {
      30             :   // normalize direction
      31          30 :   _direction /= _direction.norm();
      32          30 : }
      33             : 
      34             : Real
      35        2400 : PolarMomentOfInertia::computeQpIntegral()
      36             : {
      37        2400 :   auto dr = _q_point[_qp] - _origin;
      38             :   const auto projection = _direction * (_direction * dr);
      39             :   dr -= projection;
      40             : 
      41        2400 :   return dr.norm_sq();
      42             : }

Generated by: LCOV version 1.14