LCOV - code coverage report
Current view: top level - include/nodalkernels - ArrayNodalKernel.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31706 (f8ed4a) with base bb0a08 Lines: 1 1 100.0 %
Date: 2025-11-03 17:23:24 Functions: 1 1 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             : #pragma once
      11             : 
      12             : #include "NodalKernelBase.h"
      13             : #include "MooseVariableInterface.h"
      14             : 
      15             : /**
      16             :  * Base class for creating nodal kernels with hand-coded Jacobians
      17             :  */
      18             : class ArrayNodalKernel : public NodalKernelBase, public MooseVariableInterface<RealEigenVector>
      19             : {
      20             : public:
      21             :   /**
      22             :    * Class constructor.
      23             :    * @param parameters The InputParameters for the object
      24             :    */
      25             :   static InputParameters validParams();
      26             : 
      27             :   ArrayNodalKernel(const InputParameters & parameters);
      28             : 
      29             :   /**
      30             :    * Compute and assemble the residual at the current node
      31             :    *
      32             :    * Note: This is NOT what a user would normally want to override.
      33             :    * Usually a user would override computeQpResidual()
      34             :    */
      35             :   virtual void computeResidual() override;
      36             : 
      37             :   /**
      38             :    * Compute and assemble the Jacobian at one node.
      39             :    *
      40             :    * Note: This is NOT what a user would normally want to override.
      41             :    * Usually a user would override computeQpJacobian()
      42             :    */
      43             :   virtual void computeJacobian() override;
      44             : 
      45             :   /**
      46             :    * Compute the off-diagonal Jacobian at one node.
      47             :    *
      48             :    * Note: This is NOT what a user would normally want to override.
      49             :    * Usually a user would override computeQpOffDiagJacobian()
      50             :    * @param jvar Coupled variable for the off-diagonal Jacobian contribution
      51             :    */
      52             :   virtual void computeOffDiagJacobian(unsigned int jvar) override;
      53             : 
      54             :   /**
      55             :    * Gets the variable this is active on
      56             :    * @return the variable
      57             :    */
      58         442 :   const MooseVariableFE<RealEigenVector> & variable() const override { return _var; }
      59             : 
      60             : protected:
      61             :   /**
      62             :    * The user must override this function to compute the residual at a node.
      63             :    * @param residual Reference to the residual, computed by this method
      64             :    */
      65             :   virtual void computeQpResidual(RealEigenVector & residual) = 0;
      66             : 
      67             :   /**
      68             :    * The user can override this function to compute the "on-diagonal"
      69             :    * Jacobian contribution.  If not overriden,
      70             :    * returns an array of 1s.
      71             :    * @return On-diagonal Jacobian contribution
      72             :    */
      73             :   virtual RealEigenVector computeQpJacobian();
      74             : 
      75             :   /**
      76             :    * This is the virtual that derived classes should override for
      77             :    * computing an off-diagonal jacobian component.
      78             :    * @param Coupled variable for the off-diagonal Jacobian contribution
      79             :    * @return Off-diagonal Jacobian contribution
      80             :    */
      81             :   virtual RealEigenMatrix computeQpOffDiagJacobian(const MooseVariableFieldBase & jvar);
      82             : 
      83             :   /// variable this works on
      84             :   MooseVariableFE<RealEigenVector> & _var;
      85             : 
      86             :   /// Value of the unknown variable this is acting on
      87             :   const ArrayVariableValue & _u;
      88             : 
      89             :   /// Number of components of the array variable
      90             :   const unsigned int _count;
      91             : 
      92             : private:
      93             :   /**
      94             :    * Prepare our array variable degrees of freedom
      95             :    */
      96             :   void prepareDofs();
      97             : 
      98             :   /// Work vector for residual
      99             :   RealEigenVector _work_vector;
     100             : 
     101             :   /// Work vector for the degree of freedom indices
     102             :   std::vector<dof_id_type> _work_dofs;
     103             : };

Generated by: LCOV version 1.14