LCOV - code coverage report
Current view: top level - include/interfacekernels - InterfaceKernel.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 8601ad Lines: 4 5 80.0 %
Date: 2025-07-18 13:27:08 Functions: 8 10 80.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             : // local includes
      13             : #include "InterfaceKernelBase.h"
      14             : 
      15             : #define TemplateVariableValue typename OutputTools<T>::VariableValue
      16             : #define TemplateVariableGradient typename OutputTools<T>::VariableGradient
      17             : #define TemplateVariablePhiValue typename OutputTools<T>::VariablePhiValue
      18             : #define TemplateVariablePhiGradient typename OutputTools<T>::VariablePhiGradient
      19             : #define TemplateVariableTestValue typename OutputTools<T>::VariableTestValue
      20             : #define TemplateVariableTestGradient typename OutputTools<T>::VariableTestGradient
      21             : 
      22             : // Forward Declarations
      23             : template <typename T>
      24             : class InterfaceKernelTempl;
      25             : 
      26             : typedef InterfaceKernelTempl<Real> InterfaceKernel;
      27             : typedef InterfaceKernelTempl<RealVectorValue> VectorInterfaceKernel;
      28             : 
      29             : /**
      30             :  * InterfaceKernel and VectorInterfaceKernel is responsible for interfacing physics across
      31             :  * subdomains
      32             :  */
      33             : template <typename T>
      34             : class InterfaceKernelTempl : public InterfaceKernelBase, public NeighborMooseVariableInterface<T>
      35             : {
      36             : public:
      37             :   static InputParameters validParams();
      38             : 
      39             :   InterfaceKernelTempl(const InputParameters & parameters);
      40             : 
      41             :   /// The primary variable that this interface kernel operates on
      42       30550 :   virtual const MooseVariableFE<T> & variable() const override { return _var; }
      43             : 
      44             :   /// The neighbor variable number that this interface kernel operates on
      45       29743 :   virtual const MooseVariableFE<T> & neighborVariable() const override { return _neighbor_var; }
      46             : 
      47             :   /**
      48             :    * Using the passed DGResidual type, selects the correct test function space and residual block,
      49             :    * and then calls computeQpResidual
      50             :    */
      51             :   virtual void computeElemNeighResidual(Moose::DGResidualType type);
      52             : 
      53             :   /**
      54             :    * Using the passed DGJacobian type, selects the correct test function and trial function spaces
      55             :    * and jacobian block, and then calls computeQpJacobian
      56             :    */
      57             :   virtual void computeElemNeighJacobian(Moose::DGJacobianType type);
      58             : 
      59             :   /**
      60             :    * Using the passed DGJacobian type, selects the correct test function and trial function spaces
      61             :    * and
      62             :    * jacobian block, and then calls computeQpOffDiagJacobian with the passed jvar
      63             :    */
      64             :   virtual void computeOffDiagElemNeighJacobian(Moose::DGJacobianType type, unsigned int jvar);
      65             : 
      66             :   /// Selects the correct Jacobian type and routine to call for the primary variable jacobian
      67             :   virtual void computeElementOffDiagJacobian(unsigned int jvar) override;
      68             : 
      69             :   /// Selects the correct Jacobian type and routine to call for the secondary variable jacobian
      70             :   virtual void computeNeighborOffDiagJacobian(unsigned int jvar) override;
      71             : 
      72             :   /// Computes the residual for the current side.
      73             :   virtual void computeResidual() override;
      74             : 
      75             :   /// Computes the jacobian for the current side.
      76             :   virtual void computeJacobian() override;
      77             : 
      78             :   /// Computes the residual and Jacobian for the current side.
      79             :   virtual void computeResidualAndJacobian() override;
      80             : 
      81             :   /// Compute residuals at quadrature points
      82             :   virtual Real computeQpResidual(Moose::DGResidualType type) = 0;
      83             : 
      84             :   /**
      85             :    * Put necessary evaluations depending on qp but independent on test functions here
      86             :    */
      87      536178 :   virtual void initQpResidual(Moose::DGResidualType /* type */) {}
      88             : 
      89             :   /**
      90             :    * Put necessary evaluations depending on qp but independent on test and shape functions here
      91             :    */
      92       76476 :   virtual void initQpJacobian(Moose::DGJacobianType /* type */) {}
      93             : 
      94             :   /**
      95             :    * Put necessary evaluations depending on qp but independent on test and shape functions here for
      96             :    * off-diagonal Jacobian assembly
      97             :    */
      98           0 :   virtual void initQpOffDiagJacobian(Moose::DGJacobianType /* type */, unsigned int /* jvar */) {}
      99             : 
     100             : protected:
     101             :   /// The primary side MooseVariable
     102             :   MooseVariableFE<T> & _var;
     103             : 
     104             :   /// Normal vectors at the quadrature points
     105             :   const MooseArray<Point> & _normals;
     106             : 
     107             :   /// Holds the current solution at the current quadrature point on the face.
     108             :   const TemplateVariableValue & _u;
     109             : 
     110             :   /// Holds the current solution gradient at the current quadrature point on the face.
     111             :   const TemplateVariableGradient & _grad_u;
     112             : 
     113             :   /// shape function
     114             :   const TemplateVariablePhiValue & _phi;
     115             : 
     116             :   /// Shape function gradient
     117             :   const TemplateVariablePhiGradient & _grad_phi;
     118             : 
     119             :   /// Side shape function.
     120             :   const TemplateVariableTestValue & _test;
     121             : 
     122             :   /// Gradient of side shape function
     123             :   const TemplateVariableTestGradient & _grad_test;
     124             : 
     125             :   /// Coupled neighbor variable
     126             :   const MooseVariableFE<T> & _neighbor_var;
     127             : 
     128             :   /// Coupled neighbor variable value
     129             :   const TemplateVariableValue & _neighbor_value;
     130             : 
     131             :   /// Coupled neighbor variable gradient
     132             :   const TemplateVariableGradient & _grad_neighbor_value;
     133             : 
     134             :   /// Side neighbor shape function.
     135             :   const TemplateVariablePhiValue & _phi_neighbor;
     136             : 
     137             :   /// Gradient of side neighbor shape function
     138             :   const TemplateVariablePhiGradient & _grad_phi_neighbor;
     139             : 
     140             :   /// Side neighbor test function
     141             :   const TemplateVariableTestValue & _test_neighbor;
     142             : 
     143             :   /// Gradient of side neighbor shape function
     144             :   const TemplateVariableTestGradient & _grad_test_neighbor;
     145             : 
     146             :   /// Whether the variable and the neighbor variables are part of the same system
     147             :   /// (whether from two different nonlinear systems or a nonlinear and an auxiliary system)
     148             :   const bool _same_system;
     149             : 
     150             :   /// Holds residual entries as they are accumulated by this InterfaceKernel
     151             :   /// This variable is temporarily reserved for RattleSnake
     152             :   DenseMatrix<Number> _local_kxx;
     153             : };

Generated by: LCOV version 1.14