Line data Source code
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 : 18 : InputParameters 19 14290 : MassMatrix::validParams() 20 : { 21 14290 : InputParameters params = Kernel::validParams(); 22 14290 : params.addClassDescription("Computes a finite element mass matrix"); 23 14290 : params.addParam<MaterialPropertyName>("density", 1, "The material property defining the density"); 24 14290 : params.set<MultiMooseEnum>("vector_tags") = ""; 25 14290 : params.set<MultiMooseEnum>("matrix_tags") = ""; 26 14290 : params.suppressParameter<MultiMooseEnum>("vector_tags"); 27 14290 : params.suppressParameter<std::vector<TagName>>("extra_vector_tags"); 28 14290 : params.suppressParameter<std::vector<TagName>>("absolute_value_vector_tags"); 29 14290 : params.set<bool>("matrix_only") = true; 30 14290 : return params; 31 0 : } 32 : 33 13 : MassMatrix::MassMatrix(const InputParameters & parameters) 34 13 : : Kernel(parameters), _density(getMaterialProperty<Real>("density")) 35 : { 36 13 : if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags")) 37 0 : mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided"); 38 13 : } 39 : 40 : Real 41 0 : MassMatrix::computeQpResidual() 42 : { 43 0 : mooseError("Residual should not be calculated for the MassMatrix kernel"); 44 : } 45 : 46 : Real 47 2048 : MassMatrix::computeQpJacobian() 48 : { 49 2048 : return _test[_i][_qp] * _density[_qp] * _phi[_j][_qp]; 50 : }