LCOV - code coverage report
Current view: top level - src/hdgkernels - MassMatrixHDG.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #31405 (292dce) with base fef103 Lines: 20 21 95.2 %
Date: 2025-09-04 07:54:44 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "MassMatrixHDG.h"
      11             : #include "MassMatrix.h"
      12             : 
      13             : // MOOSE includes
      14             : #include "MooseVariableFE.h"
      15             : 
      16             : registerMooseObject("NavierStokesApp", MassMatrixHDG);
      17             : 
      18             : InputParameters
      19          40 : MassMatrixHDG::validParams()
      20             : {
      21          40 :   InputParameters params = HDGKernel::validParams();
      22          80 :   params.setDocString(
      23             :       "variable",
      24             :       "The facet variable for whom we will be computing the mass on the internal sides");
      25          40 :   params.addClassDescription(
      26             :       "Computes a finite element mass matrix on internal faces (element by "
      27             :       "element!) meant for use in preconditioning schemes which require one");
      28          40 :   MassMatrix::setMassMatrixParams(params);
      29          80 :   params.addParam<Real>("density", 1, "The density");
      30          40 :   return params;
      31           0 : }
      32             : 
      33          20 : MassMatrixHDG::MassMatrixHDG(const InputParameters & parameters)
      34          40 :   : HDGKernel(parameters), _face_phi(_var.phiFace()), _density(getParam<Real>("density"))
      35             : {
      36          20 : }
      37             : 
      38             : void
      39       95680 : MassMatrixHDG::computeJacobianOnSide()
      40             : {
      41             :   mooseAssert(_face_phi.size() == _var.dofIndices().size(), "These should be the same size");
      42             :   // resize always zeroes for DenseMatrix
      43       95680 :   _mass.resize(_face_phi.size(), _face_phi.size());
      44      382720 :   for (const auto qp : make_range(_qrule_face->n_points()))
      45             :   {
      46             :     // The division by 2 here is necessary because each face will be visited twice, once from each
      47             :     // neighboring element
      48      287040 :     const auto qp_quant = _JxW_face[qp] * _coord[qp] * _density / 2;
      49     2870400 :     for (const auto i : index_range(_face_phi))
      50             :     {
      51     2583360 :       const auto qp_i_quant = qp_quant * _face_phi[i][qp];
      52    25833600 :       for (const auto j : index_range(_face_phi))
      53    23250240 :         _mass(i, j) += qp_i_quant * _face_phi[j][qp];
      54             :     }
      55             :   }
      56             : 
      57       95680 :   addJacobian(_assembly, _mass, _var.dofIndices(), _var.dofIndices(), _var.scalingFactor());
      58       95680 : }

Generated by: LCOV version 1.14