LCOV - code coverage report
Current view: top level - src/scalarkernels - ShaftComponentTorqueScalarKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 22 23 95.7 %
Date: 2025-07-30 13:02:48 Functions: 5 5 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 "ShaftComponentTorqueScalarKernel.h"
      11             : #include "MooseVariableScalar.h"
      12             : #include "Assembly.h"
      13             : #include "UserObject.h"
      14             : #include "ShaftConnectableUserObjectInterface.h"
      15             : 
      16             : registerMooseObject("ThermalHydraulicsApp", ShaftComponentTorqueScalarKernel);
      17             : 
      18             : InputParameters
      19          10 : ShaftComponentTorqueScalarKernel::validParams()
      20             : {
      21          10 :   InputParameters params = ScalarKernel::validParams();
      22          20 :   params.addRequiredParam<UserObjectName>("shaft_connected_component_uo",
      23             :                                           "Shaft connected component user object name");
      24          10 :   params.addClassDescription("Torque contributed by a component connected to a shaft");
      25          10 :   return params;
      26           0 : }
      27             : 
      28           5 : ShaftComponentTorqueScalarKernel::ShaftComponentTorqueScalarKernel(
      29           5 :     const InputParameters & parameters)
      30             :   : ScalarKernel(parameters),
      31           5 :     _shaft_connected_component_uo(
      32           5 :         getUserObject<ShaftConnectableUserObjectInterface>("shaft_connected_component_uo"))
      33             : {
      34           5 : }
      35             : 
      36             : void
      37          30 : ShaftComponentTorqueScalarKernel::reinit()
      38             : {
      39          30 : }
      40             : 
      41             : void
      42          25 : ShaftComponentTorqueScalarKernel::computeResidual()
      43             : {
      44          25 :   prepareVectorTag(_assembly, _var.number());
      45             : 
      46          25 :   _local_re(0) -= _shaft_connected_component_uo.getTorque();
      47             : 
      48          25 :   accumulateTaggedLocalResidual();
      49          25 : }
      50             : 
      51             : void
      52           5 : ShaftComponentTorqueScalarKernel::computeJacobian()
      53             : {
      54           5 :   DenseMatrix<Real> jacobian_block;
      55             :   std::vector<dof_id_type> dofs_j;
      56           5 :   _shaft_connected_component_uo.getTorqueJacobianData(jacobian_block, dofs_j);
      57             :   jacobian_block.scale(-1);
      58           5 :   addJacobian(_assembly, jacobian_block, _var.dofIndices(), dofs_j, _var.scalingFactor());
      59           5 : }

Generated by: LCOV version 1.14