https://mooseframework.inl.gov
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 
16 registerMooseObject("NavierStokesApp", MassMatrixHDG);
17 
20 {
22  params.setDocString(
23  "variable",
24  "The facet variable for whom we will be computing the mass on the internal sides");
25  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");
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 
38 void
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  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  const auto qp_quant = _JxW_face[qp] * _coord[qp] * _density / 2;
49  for (const auto i : index_range(_face_phi))
50  {
51  const auto qp_i_quant = qp_quant * _face_phi[i][qp];
52  for (const auto j : index_range(_face_phi))
53  _mass(i, j) += qp_i_quant * _face_phi[j][qp];
54  }
55  }
56 
58 }
static void setMassMatrixParams(InputParameters &params)
This class computes a mass for facet unkowns on interior faces just like MassMatrixDGKernel.
Definition: MassMatrixHDG.h:19
static InputParameters validParams()
Definition: MassMatrixHDG.C:19
const QBase *const & _qrule_face
MooseVariable & _var
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void setDocString(const std::string &name, const std::string &doc)
const VariablePhiValue & _face_phi
Definition: MassMatrixHDG.h:33
virtual void computeJacobianOnSide() override
Definition: MassMatrixHDG.C:39
DenseMatrix< Number > _mass
Definition: MassMatrixHDG.h:35
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
const Real _density
Definition: MassMatrixHDG.h:34
const std::vector< dof_id_type > & dofIndices() const final
const MooseArray< Real > & _JxW_face
const MooseArray< Real > & _coord
Assembly & _assembly
MassMatrixHDG(const InputParameters &parameters)
Definition: MassMatrixHDG.C:33
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void resize(const unsigned int new_m, const unsigned int new_n)
IntRange< T > make_range(T beg, T end)
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
registerMooseObject("NavierStokesApp", MassMatrixHDG)
static InputParameters validParams()
auto index_range(const T &sizable)
void scalingFactor(const std::vector< Real > &factor)