LCOV - code coverage report
Current view: top level - src/interfaces - ADShaftConnectableUserObjectInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 39 41 95.1 %
Date: 2026-05-29 20:41:18 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         457 : ADShaftConnectableUserObjectInterface::validParams()
      20             : {
      21         457 :   InputParameters params = emptyInputParameters();
      22         457 :   return params;
      23             : }
      24             : 
      25         234 : ADShaftConnectableUserObjectInterface::ADShaftConnectableUserObjectInterface(
      26         234 :     const MooseObject * moose_object)
      27         234 :   : _moose_object(moose_object), _n_shaft_eq(1)
      28             : {
      29         234 :   _omega_dof.resize(_n_shaft_eq);
      30         234 : }
      31             : 
      32             : void
      33        3777 : ADShaftConnectableUserObjectInterface::initialize()
      34             : {
      35        3777 :   _torque = 0;
      36        3777 :   _moment_of_inertia = 0;
      37        3777 : }
      38             : 
      39             : void
      40           0 : ADShaftConnectableUserObjectInterface::execute()
      41             : {
      42           0 : }
      43             : 
      44             : ADReal
      45        2644 : ADShaftConnectableUserObjectInterface::getTorque() const
      46             : {
      47        2644 :   return _torque;
      48             : }
      49             : 
      50             : ADReal
      51        4512 : ADShaftConnectableUserObjectInterface::getMomentOfInertia() const
      52             : {
      53        4512 :   return _moment_of_inertia;
      54             : }
      55             : 
      56             : void
      57          96 : ADShaftConnectableUserObjectInterface::setupConnections(unsigned int n_connections,
      58             :                                                         unsigned int n_flow_eq)
      59             : {
      60          96 :   _n_connections = n_connections;
      61          96 :   _n_flow_eq = n_flow_eq;
      62          96 : }
      63             : 
      64             : void
      65        5414 : ADShaftConnectableUserObjectInterface::setConnectionData(
      66             :     const std::vector<std::vector<dof_id_type>> & flow_channel_dofs)
      67             : {
      68        5414 :   _flow_channel_dofs = flow_channel_dofs;
      69        5414 : }
      70             : 
      71             : void
      72        3375 : ADShaftConnectableUserObjectInterface::setOmegaDofs(const MooseVariableScalar * omega_var)
      73             : {
      74        3375 :   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        3375 :   _omega_dof = dofs;
      79        3375 : }
      80             : 
      81             : void
      82        3375 : ADShaftConnectableUserObjectInterface::setupJunctionData(std::vector<dof_id_type> & scalar_dofs)
      83             : {
      84        3375 :   _scalar_dofs = scalar_dofs;
      85        3375 : }
      86             : 
      87             : void
      88        3872 : ADShaftConnectableUserObjectInterface::finalize()
      89             : {
      90        3872 :   _moose_object->comm().sum(_torque);
      91        3872 :   _moose_object->comm().sum(_moment_of_inertia);
      92        3872 : }
      93             : 
      94             : void
      95         402 : ADShaftConnectableUserObjectInterface::threadJoin(const UserObject & uo)
      96             : {
      97             :   const ADShaftConnectableUserObjectInterface & sctc_uo =
      98         402 :       dynamic_cast<const ADShaftConnectableUserObjectInterface &>(uo);
      99         402 :   _torque += sctc_uo._torque;
     100         402 :   _moment_of_inertia += sctc_uo._moment_of_inertia;
     101         402 : }

Generated by: LCOV version 1.14