LCOV - code coverage report
Current view: top level - src/hdgkernels - MassMatrixHDG.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 21 22 95.5 %
Date: 2026-05-29 20:37:52 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          84 : MassMatrixHDG::validParams()
      20             : {
      21          84 :   InputParameters params = HDGKernel::validParams();
      22         168 :   params.setDocString(
      23             :       "variable",
      24             :       "The facet variable for whom we will be computing the mass on the internal sides");
      25          84 :   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          84 :   MassMatrix::setMassMatrixParams(params);
      29         168 :   params.addParam<Real>("density", 1, "The density");
      30          84 :   return params;
      31           0 : }
      32             : 
      33          43 : MassMatrixHDG::MassMatrixHDG(const InputParameters & parameters)
      34          86 :   : HDGKernel(parameters), _face_phi(_var.phiFace()), _density(getParam<Real>("density"))
      35             : {
      36          43 : }
      37             : 
      38             : void
      39      247844 : MassMatrixHDG::computeJacobianOnSide()
      40             : {
      41             :   mooseAssert(_face_phi.size() == _var.dofIndices().size(), "These should be the same size");
      42             :   // resize always zeroes for DenseMatrix
      43      247844 :   _mass.resize(_face_phi.size(), _face_phi.size());
      44             :   // The division by 2 here is necessary because each face will be visited twice, once from each
      45             :   // neighboring element
      46      247844 :   const auto quant = _density / 2 * _current_side_elem->hmax();
      47      989426 :   for (const auto qp : make_range(_qrule_face->n_points()))
      48             :   {
      49      741582 :     const auto qp_quant = _JxW_face[qp] * _coord[qp] * quant;
      50     7404120 :     for (const auto i : index_range(_face_phi))
      51             :     {
      52     6662538 :       const auto qp_i_quant = qp_quant * _face_phi[i][qp];
      53    66555180 :       for (const auto j : index_range(_face_phi))
      54    59892642 :         _mass(i, j) += qp_i_quant * _face_phi[j][qp];
      55             :     }
      56             :   }
      57             : 
      58      247844 :   addJacobian(_assembly, _mass, _var.dofIndices(), _var.dofIndices(), _var.scalingFactor());
      59      247844 : }

Generated by: LCOV version 1.14