https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MassMatrixHDG.C
Go to the documentation of this file.
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
17
20{
22 params.setDocString(
23 "variable",
24 "The facet variable for whom we will be computing the mass on the internal sides");
26 "Computes a finite element mass matrix on internal faces (element by "
27 "element!) meant for use in preconditioning schemes which require one");
29 params.addParam<Real>("density", 1, "The density");
30 return params;
31}
32
34 : HDGKernel(parameters), _face_phi(_var.phiFace()), _density(getParam<Real>("density"))
35{
36}
37
38void
40{
41 mooseAssert(_face_phi.size() == _var.dofIndices().size(), "These should be the same size");
42 // resize always zeroes for DenseMatrix
43 _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 const auto quant = _density / 2 * _current_side_elem->hmax();
47 for (const auto qp : make_range(_qrule_face->n_points()))
48 {
49 const auto qp_quant = _JxW_face[qp] * _coord[qp] * quant;
50 for (const auto i : index_range(_face_phi))
51 {
52 const auto qp_i_quant = qp_quant * _face_phi[i][qp];
53 for (const auto j : index_range(_face_phi))
54 _mass(i, j) += qp_i_quant * _face_phi[j][qp];
55 }
56 }
57
59}
registerMooseObject("NavierStokesApp", MassMatrixHDG)
const QBase *const & _qrule_face
const Elem *const & _current_side_elem
const MooseArray< Real > & _JxW_face
static InputParameters validParams()
void setDocString(const std::string &name, const std::string &doc)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const MooseArray< Real > & _coord
MooseVariable & _var
This class computes a mass for facet unkowns on interior faces just like MassMatrixDGKernel.
static InputParameters validParams()
DenseMatrix< Number > _mass
MassMatrixHDG(const InputParameters &parameters)
const VariablePhiValue & _face_phi
const Real _density
virtual void computeJacobianOnSide() override
static void setMassMatrixParams(InputParameters &params)
void scalingFactor(const std::vector< Real > &factor)
const std::vector< dof_id_type > & dofIndices() const final
Assembly & _assembly
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
void resize(const unsigned int new_m, const unsigned int new_n)