https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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 "Registry.h"
15#include "NonlinearSystemBase.h"
16#include "libmesh/system.h"
17
19
20void
22{
23 params.set<MultiMooseEnum>("vector_tags") = "";
24 params.set<MultiMooseEnum>("matrix_tags") = "";
25 params.suppressParameter<MultiMooseEnum>("vector_tags");
26 params.suppressParameter<std::vector<TagName>>("extra_vector_tags");
27 params.suppressParameter<std::vector<TagName>>("absolute_value_vector_tags");
28 params.set<bool>("matrix_only") = true;
29}
30
33{
35 params.addClassDescription("Computes a finite element mass matrix");
36 setMassMatrixParams(params);
37 params.addParam<MaterialPropertyName>("density", 1, "The material property defining the density");
38 return params;
39}
40
42 : Kernel(parameters), _density(getMaterialProperty<Real>("density"))
43{
44 if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags"))
45 mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided");
47 dynamic_cast<const MooseStaticCondensationPreconditioner *>(
48 cast_ref<NonlinearSystemBase &>(_sys).getPreconditioner()) &&
50 mooseError("Elemental mass matrices likely don't make sense when using static condensation");
51}
52
53Real
55{
56 mooseError("Residual should not be calculated for the MassMatrix kernel");
57}
58
59Real
registerMooseObject("MooseApp", MassMatrix)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
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.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
unsigned int _qp
The current quadrature point index.
Definition KernelBase.h:43
unsigned int _j
current index for the shape function
Definition KernelBase.h:61
unsigned int _i
current index for the test function
Definition KernelBase.h:58
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition Kernel.h:72
const VariablePhiValue & _phi
the current shape functions
Definition Kernel.h:81
const VariableTestValue & _test
the current test function
Definition Kernel.h:75
static InputParameters validParams()
Definition Kernel.C:24
Computes a finite element mass matrix.
Definition MassMatrix.h:18
static InputParameters validParams()
Definition MassMatrix.C:32
MassMatrix(const InputParameters &parameters)
Definition MassMatrix.C:41
const MaterialProperty< Real > & _density
The density of the material.
Definition MassMatrix.h:31
static void setMassMatrixParams(InputParameters &params)
Definition MassMatrix.C:21
virtual Real computeQpResidual() override
Compute this Kernel's contribution to the residual at the current quadrature point.
Definition MassMatrix.C:54
virtual Real computeQpJacobian() override
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
Definition MassMatrix.C:60
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
libMesh::FEContinuity getContinuity() const override
Return the continuity of this variable.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
SystemBase & _sys
Reference to the EquationSystem object.
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
bool has_static_condensation() const