LCOV - code coverage report
Current view: top level - src/interfaces - ADShaftConnectableUserObjectInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 39 41 95.1 %
Date: 2025-07-30 13:02:48 Functions: 11 12 91.7 %
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 "ADShaftConnectableUserObjectInterface.h"
      11             : #include "MooseVariableScalar.h"
      12             : #include "UserObject.h"
      13             : #include "metaphysicl/parallel_numberarray.h"
      14             : #include "metaphysicl/parallel_dualnumber.h"
      15             : #include "metaphysicl/parallel_semidynamicsparsenumberarray.h"
      16             : #include "libmesh/parallel_algebra.h"
      17             : 
      18             : InputParameters
      19         929 : ADShaftConnectableUserObjectInterface::validParams()
      20             : {
      21         929 :   InputParameters params = emptyInputParameters();
      22         929 :   return params;
      23             : }
      24             : 
      25         479 : ADShaftConnectableUserObjectInterface::ADShaftConnectableUserObjectInterface(
      26         479 :     const MooseObject * moose_object)
      27         479 :   : _moose_object(moose_object), _n_shaft_eq(1)
      28             : {
      29         479 :   _omega_dof.resize(_n_shaft_eq);
      30         479 : }
      31             : 
      32             : void
      33       16908 : ADShaftConnectableUserObjectInterface::initialize()
      34             : {
      35       16908 :   _torque = 0;
      36       16908 :   _moment_of_inertia = 0;
      37       16908 : }
      38             : 
      39             : void
      40           0 : ADShaftConnectableUserObjectInterface::execute()
      41             : {
      42           0 : }
      43             : 
      44             : ADReal
      45       12857 : ADShaftConnectableUserObjectInterface::getTorque() const
      46             : {
      47       12857 :   return _torque;
      48             : }
      49             : 
      50             : ADReal
      51       21531 : ADShaftConnectableUserObjectInterface::getMomentOfInertia() const
      52             : {
      53       21531 :   return _moment_of_inertia;
      54             : }
      55             : 
      56             : void
      57         207 : ADShaftConnectableUserObjectInterface::setupConnections(unsigned int n_connections,
      58             :                                                         unsigned int n_flow_eq)
      59             : {
      60         207 :   _n_connections = n_connections;
      61         207 :   _n_flow_eq = n_flow_eq;
      62         207 : }
      63             : 
      64             : void
      65       25928 : ADShaftConnectableUserObjectInterface::setConnectionData(
      66             :     const std::vector<std::vector<dof_id_type>> & flow_channel_dofs)
      67             : {
      68       25928 :   _flow_channel_dofs = flow_channel_dofs;
      69       25928 : }
      70             : 
      71             : void
      72       14614 : ADShaftConnectableUserObjectInterface::setOmegaDofs(const MooseVariableScalar * omega_var)
      73             : {
      74       14614 :   auto && dofs = omega_var->dofIndices();
      75             :   mooseAssert(dofs.size() == 1,
      76             :               "There should be exactly 1 coupled DoF index for the variable '" + omega_var->name() +
      77             :                   "'.");
      78       14614 :   _omega_dof = dofs;
      79       14614 : }
      80             : 
      81             : void
      82       14614 : ADShaftConnectableUserObjectInterface::setupJunctionData(std::vector<dof_id_type> & scalar_dofs)
      83             : {
      84       14614 :   _scalar_dofs = scalar_dofs;
      85       14614 : }
      86             : 
      87             : void
      88       16328 : ADShaftConnectableUserObjectInterface::finalize()
      89             : {
      90       16328 :   _moose_object->comm().sum(_torque);
      91       16328 :   _moose_object->comm().sum(_moment_of_inertia);
      92       16328 : }
      93             : 
      94             : void
      95        2294 : ADShaftConnectableUserObjectInterface::threadJoin(const UserObject & uo)
      96             : {
      97             :   const ADShaftConnectableUserObjectInterface & sctc_uo =
      98        2294 :       dynamic_cast<const ADShaftConnectableUserObjectInterface &>(uo);
      99        2294 :   _torque += sctc_uo._torque;
     100        2294 :   _moment_of_inertia += sctc_uo._moment_of_inertia;
     101        2294 : }

Generated by: LCOV version 1.14