https://mooseframework.inl.gov
MassMatrix.C
Go to the documentation of this file.
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 #include "Kernel.h"
11 #include "MassMatrix.h"
12 #include "MaterialProperty.h"
13 #include "MooseError.h"
14 #include "Registry.h"
15 
16 registerMooseObject("MooseApp", MassMatrix);
17 
20 {
22  params.addClassDescription("Computes a finite element mass matrix");
23  params.addParam<MaterialPropertyName>("density", 1, "The material property defining the density");
24  params.set<MultiMooseEnum>("vector_tags") = "";
25  params.set<MultiMooseEnum>("matrix_tags") = "";
26  params.suppressParameter<MultiMooseEnum>("vector_tags");
27  params.suppressParameter<std::vector<TagName>>("extra_vector_tags");
28  params.suppressParameter<std::vector<TagName>>("absolute_value_vector_tags");
29  params.set<bool>("matrix_only") = true;
30  return params;
31 }
32 
34  : Kernel(parameters), _density(getMaterialProperty<Real>("density"))
35 {
36  if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags"))
37  mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided");
38 }
39 
40 Real
42 {
43  mooseError("Residual should not be calculated for the MassMatrix kernel");
44 }
45 
46 Real
48 {
49  return _test[_i][_qp] * _density[_qp] * _phi[_j][_qp];
50 }
static InputParameters validParams()
Definition: Kernel.C:24
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeQpJacobian() override
Compute this Kernel&#39;s contribution to the Jacobian at the current quadrature point.
Definition: MassMatrix.C:47
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn&#39;t required or valid in the derived class...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual Real computeQpResidual() override
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
Definition: MassMatrix.C:41
registerMooseObject("MooseApp", MassMatrix)
const MaterialProperty< Real > & _density
The density of the material.
Definition: MassMatrix.h:30
const VariableTestValue & _test
the current test function
Definition: Kernel.h:75
unsigned int _i
current index for the test function
Definition: KernelBase.h:58
MassMatrix(const InputParameters &parameters)
Definition: MassMatrix.C:33
unsigned int _j
current index for the shape function
Definition: KernelBase.h:61
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Computes a finite element mass matrix.
Definition: MassMatrix.h:17
Definition: Kernel.h:15
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
const VariablePhiValue & _phi
the current shape functions
Definition: Kernel.h:81
static InputParameters validParams()
Definition: MassMatrix.C:19
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:43