LCOV - code coverage report
Current view: top level - src/nodalkernels - ArrayReactionNodalKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 16 18 88.9 %
Date: 2026-05-29 20:35:17 Functions: 8 9 88.9 %
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 "ArrayReactionNodalKernel.h"
      11             : 
      12             : registerMooseObject("MooseApp", ArrayReactionNodalKernel);
      13             : registerMooseObject("MooseApp", ADArrayReactionNodalKernel);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17        6210 : ArrayReactionNodalKernelTempl<is_ad>::validParams()
      18             : {
      19        6210 :   InputParameters params = GenericArrayNodalKernel<is_ad>::validParams();
      20       12420 :   params.addClassDescription(
      21             :       "Implements a simple consuming reaction term at nodes for an array variable");
      22       18630 :   params.addRequiredParam<RealEigenVector>("coeff",
      23             :                                            "Coefficients for multiplying the reaction term");
      24        6210 :   return params;
      25           0 : }
      26             : 
      27             : template <bool is_ad>
      28          46 : ArrayReactionNodalKernelTempl<is_ad>::ArrayReactionNodalKernelTempl(
      29             :     const InputParameters & parameters)
      30             :   : GenericArrayNodalKernel<is_ad>(parameters),
      31          92 :     _coeff(this->template getParam<RealEigenVector>("coeff"))
      32             : {
      33          46 :   if (_coeff.size() != _count)
      34           0 :     paramError("coeff",
      35             :                "The size of the coefficient vector must match the size of the array variable");
      36          46 : }
      37             : 
      38             : template <bool is_ad>
      39             : void
      40        1359 : ArrayReactionNodalKernelTempl<is_ad>::computeQpResidual(GenericRealEigenVector<is_ad> & residual)
      41             : {
      42        1359 :   residual = _coeff.cwiseProduct(_u[_qp]);
      43        1359 : }
      44             : 
      45             : template <bool is_ad>
      46             : void
      47          87 : ArrayReactionNodalKernelTempl<is_ad>::computeQpJacobian()
      48             : {
      49         261 :   for (const auto i : index_range(_coeff))
      50         174 :     setJacobian(i, i, _coeff(i));
      51          87 : }
      52             : 
      53             : template class ArrayReactionNodalKernelTempl<false>;
      54             : template class ArrayReactionNodalKernelTempl<true>;

Generated by: LCOV version 1.14