LCOV - code coverage report
Current view: top level - src/dampers - NodalDamper.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 22 23 95.7 %
Date: 2026-05-29 20:35:17 Functions: 4 4 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 "NodalDamper.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "Assembly.h"
      14             : #include "FEProblem.h"
      15             : #include "MooseVariableFE.h"
      16             : #include "SubProblem.h"
      17             : #include "SystemBase.h"
      18             : 
      19             : #include "libmesh/quadrature.h"
      20             : 
      21             : InputParameters
      22        3180 : NodalDamper::validParams()
      23             : {
      24        3180 :   InputParameters params = Damper::validParams();
      25        3180 :   params += MaterialPropertyInterface::validParams();
      26        9540 :   params.addRequiredParam<NonlinearVariableName>(
      27             :       "variable", "The name of the variable that this damper operates on");
      28        3180 :   return params;
      29           0 : }
      30             : 
      31          74 : NodalDamper::NodalDamper(const InputParameters & parameters)
      32             :   : Damper(parameters),
      33             :     MaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, Moose::EMPTY_BOUNDARY_IDS),
      34          74 :     _tid(parameters.get<THREAD_ID>("_tid")),
      35          74 :     _assembly(_subproblem.assembly(_tid, _sys.number())),
      36          74 :     _coord_sys(_assembly.coordSystem()),
      37          74 :     _var(_sys.getFieldVariable<Real>(_tid, parameters.get<NonlinearVariableName>("variable"))),
      38          74 :     _current_node(_var.node()),
      39          74 :     _qp(0),
      40          74 :     _u_increment(_var.increment()),
      41         148 :     _u(_var.dofValues())
      42             : {
      43             :   mooseAssert(_var.count() == 1,
      44             :               "NodalDamper only supports scalar variables. Variable '" + _var.name() +
      45             :                   "' has multiple components.");
      46          74 : }
      47             : 
      48             : Real
      49        7525 : NodalDamper::computeDamping()
      50             : {
      51        7525 :   return computeQpDamping();
      52             : }
      53             : 
      54             : bool
      55       16356 : NodalDamper::variableDefinedOnNode(const Node * node) const
      56             : {
      57       16356 :   const unsigned int sys_num = _var.sys().number();
      58       16356 :   const unsigned int var_num = _var.number();
      59             : 
      60       16356 :   const unsigned int n_comp = node->n_comp(sys_num, var_num);
      61             : 
      62       16356 :   return n_comp;
      63             : }

Generated by: LCOV version 1.14