LCOV - code coverage report
Current view: top level - include/hdgkernels - IPHDGAssemblyHelper.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 5 5 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 3 66.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             : #pragma once
      11             : 
      12             : #include "Moose.h"
      13             : #include "MooseTypes.h"
      14             : #include "MooseArray.h"
      15             : #include "MooseFunctor.h"
      16             : #include "Function.h"
      17             : #include "Kernel.h"
      18             : #include "MooseVariableDependencyInterface.h"
      19             : #include "TaggingInterface.h"
      20             : #include "ThreeMaterialPropertyInterface.h"
      21             : 
      22             : #include "libmesh/vector_value.h"
      23             : #include <vector>
      24             : 
      25             : template <typename>
      26             : class MooseVariableFE;
      27             : class MooseVariableScalar;
      28             : template <typename>
      29             : class MooseArray;
      30             : class SystemBase;
      31             : class MooseMesh;
      32             : class MooseObject;
      33             : class MooseVariableDependencyInterface;
      34             : class TransientInterface;
      35             : 
      36             : /**
      37             :  * Base class that declares all the methods for assembling a hybridized interior penalty
      38             :  * discontinuous Galerkin (IPDG-H), which is a type of HDG method, discretization of an equation.
      39             :  * These routines may be called by both HDG kernels and integrated boundary conditions.
      40             :  */
      41             : class IPHDGAssemblyHelper : public ThreeMaterialPropertyInterface
      42             : {
      43             : public:
      44             :   static InputParameters validParams();
      45             : 
      46             :   IPHDGAssemblyHelper(const MooseObject * const moose_obj,
      47             :                       MooseVariableDependencyInterface * const mvdi,
      48             :                       const TransientInterface * const ti,
      49             :                       SystemBase & sys,
      50             :                       const Assembly & assembly,
      51             :                       const THREAD_ID tid,
      52             :                       const std::set<SubdomainID> & blocks_ids,
      53             :                       const std::set<BoundaryID> & boundary_ids);
      54             : 
      55             :   void resizeResiduals();
      56             :   virtual void scalarVolume() = 0;
      57             : 
      58             :   //
      59             :   // Methods which can be leveraged both on internal sides in the kernel and by boundary conditions
      60             :   //
      61             : 
      62             :   virtual void scalarFace() = 0;
      63             : 
      64             :   virtual void lmFace() = 0;
      65             : 
      66             :   virtual void scalarDirichlet(const Moose::Functor<Real> & dirichlet_value) = 0;
      67             : 
      68             :   void lmDirichlet(const Moose::Functor<Real> & dirichlet_value);
      69             : 
      70             :   void lmPrescribedFlux(const Moose::Functor<Real> & flux_value);
      71             : 
      72             :   /**
      73             :    * @returns The various residuals and degree of freedom indices this helper operators on
      74             :    */
      75             :   std::array<ADResidualsPacket, 2> taggingData() const;
      76             : 
      77             :   /**
      78             :    * @returns The LM facet variable as a set
      79             :    */
      80             :   std::set<std::string> additionalROVariables();
      81             : 
      82        1303 :   virtual ~IPHDGAssemblyHelper() = default;
      83             : 
      84             : protected:
      85             :   const TransientInterface & _ti;
      86             :   const MooseVariableFE<Real> & _u_var;
      87             :   const MooseVariableFE<Real> & _u_face_var;
      88             : 
      89             :   // Containers for dof indices
      90             :   const std::vector<dof_id_type> & _u_dof_indices;
      91             :   const std::vector<dof_id_type> & _lm_u_dof_indices;
      92             : 
      93             :   // local solutions at quadrature points
      94             :   const MooseArray<ADReal> & _u_sol;
      95             :   const MooseArray<ADRealVectorValue> & _grad_u_sol;
      96             :   const MooseArray<ADReal> & _lm_u_sol;
      97             : 
      98             :   // Element shape functions
      99             :   const MooseArray<std::vector<Real>> & _scalar_phi;
     100             :   const MooseArray<std::vector<RealVectorValue>> & _grad_scalar_phi;
     101             : 
     102             :   // Face shape functions
     103             :   const MooseArray<std::vector<Real>> & _scalar_phi_face;
     104             :   const MooseArray<std::vector<RealVectorValue>> & _grad_scalar_phi_face;
     105             :   const MooseArray<std::vector<Real>> & _lm_phi_face;
     106             : 
     107             :   /// The current element volume
     108             :   const Real & _elem_volume;
     109             : 
     110             :   /// The current element side area
     111             :   const Real & _side_area;
     112             : 
     113             :   /// The current element
     114             :   const Elem * const & _ip_current_elem;
     115             : 
     116             :   /// The current element side
     117             :   const unsigned int & _ip_current_side;
     118             : 
     119             :   /// The element JxW
     120             :   const MooseArray<Real> & _ip_JxW;
     121             : 
     122             :   /// The element qrule
     123             :   const QBase * const & _ip_qrule;
     124             : 
     125             :   /// The physical quadrature point locations in the element volume
     126             :   const MooseArray<Point> & _ip_q_point;
     127             : 
     128             :   /// The face JxW
     129             :   const MooseArray<Real> & _ip_JxW_face;
     130             : 
     131             :   /// The face qrule
     132             :   const QBase * const & _ip_qrule_face;
     133             : 
     134             :   /// The physical quadrature point locations on the face
     135             :   const MooseArray<Point> & _ip_q_point_face;
     136             : 
     137             :   /// The normal vector on the face
     138             :   const MooseArray<Point> & _ip_normals;
     139             : 
     140             :   // Local residual vectors
     141             :   DenseVector<ADReal> _scalar_re, _lm_re;
     142             : };
     143             : 
     144             : inline void
     145     5067412 : IPHDGAssemblyHelper::resizeResiduals()
     146             : {
     147     5067412 :   _scalar_re.resize(_u_dof_indices.size());
     148     5067412 :   _lm_re.resize(_lm_u_dof_indices.size());
     149     5067412 : }

Generated by: LCOV version 1.14