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 "FVMassMatrix.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", FVMassMatrix); 14 : 15 : InputParameters 16 14290 : FVMassMatrix::validParams() 17 : { 18 14290 : InputParameters params = FVElementalKernel::validParams(); 19 14290 : params.addClassDescription( 20 : "Computes a 'mass matrix', which will just be a diagonal matrix for the finite volume " 21 : "method, meant for use in preconditioning schemes which require one"); 22 14290 : params.addParam<MooseFunctorName>("density", 1.0, "Optional density weighting functor"); 23 14290 : params.set<MultiMooseEnum>("vector_tags") = ""; 24 14290 : params.set<MultiMooseEnum>("matrix_tags") = ""; 25 14290 : params.suppressParameter<MultiMooseEnum>("vector_tags"); 26 14290 : params.suppressParameter<std::vector<TagName>>("extra_vector_tags"); 27 14290 : params.suppressParameter<std::vector<TagName>>("absolute_value_vector_tags"); 28 14290 : params.set<bool>("matrix_only") = true; 29 14290 : return params; 30 0 : } 31 : 32 13 : FVMassMatrix::FVMassMatrix(const InputParameters & parameters) 33 13 : : FVElementalKernel(parameters), _density(getFunctor<Real>("density")) 34 : { 35 13 : if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags")) 36 0 : mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided"); 37 13 : } 38 : 39 : void 40 64 : FVMassMatrix::computeResidual() 41 : { 42 64 : } 43 : 44 : ADReal 45 32 : FVMassMatrix::computeQpResidual() 46 : { 47 32 : const auto elem = makeElemArg(_current_elem); 48 32 : const auto state = determineState(); 49 64 : return _density(elem, state) * _var(elem, state); 50 : }