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 14292 : FVMassMatrix::validParams() 17 : { 18 14292 : InputParameters params = FVElementalKernel::validParams(); 19 14292 : 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 14292 : params.addParam<MooseFunctorName>("density", 1.0, "Optional density weighting functor"); 23 14292 : params.set<MultiMooseEnum>("vector_tags") = ""; 24 14292 : params.set<MultiMooseEnum>("matrix_tags") = ""; 25 14292 : params.suppressParameter<MultiMooseEnum>("vector_tags"); 26 14292 : params.suppressParameter<std::vector<TagName>>("extra_vector_tags"); 27 14292 : params.suppressParameter<std::vector<TagName>>("absolute_value_vector_tags"); 28 14292 : params.set<bool>("matrix_only") = true; 29 14292 : return params; 30 0 : } 31 : 32 14 : FVMassMatrix::FVMassMatrix(const InputParameters & parameters) 33 14 : : FVElementalKernel(parameters), _density(getFunctor<Real>("density")) 34 : { 35 14 : if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags")) 36 0 : mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided"); 37 14 : } 38 : 39 : void 40 72 : FVMassMatrix::computeResidual() 41 : { 42 72 : } 43 : 44 : ADReal 45 36 : FVMassMatrix::computeQpResidual() 46 : { 47 36 : const auto elem = makeElemArg(_current_elem); 48 36 : const auto state = determineState(); 49 72 : return _density(elem, state) * _var(elem, state); 50 : }