https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVMassMatrix.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 "FVMassMatrix.h"
11#include "Function.h"
12
14
17{
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 params.addParam<MooseFunctorName>("density", 1.0, "Optional density weighting functor");
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 return params;
30}
31
33 : FVElementalKernel(parameters), _density(getFunctor<Real>("density"))
34{
35 if (!isParamValid("matrix_tags") && !isParamValid("extra_matrix_tags"))
36 mooseError("One of 'matrix_tags' or 'extra_matrix_tags' must be provided");
37}
38
39void
43
46{
47 const auto elem = makeElemArg(_current_elem);
48 const auto state = determineState();
49 return _density(elem, state) * _var(elem, state);
50}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("MooseApp", FVMassMatrix)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
FVElemental is used for calculating residual contributions from volume integral terms of a PDE where ...
static InputParameters validParams()
MooseVariableFV< Real > & _var
const Elem *const & _current_elem
Computes a 'mass matrix', which will just be a diagonal matrix for the finite volume method,...
virtual void computeResidual() override
Usually you should not override these functions - they have some tricky stuff in them that you don't ...
FVMassMatrix(const InputParameters &parameters)
ADReal computeQpResidual() override
This is the primary function that must be implemented for flux kernel terms.
static InputParameters validParams()
const Moose::Functor< Real > & _density
Elemental weighting functor.
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Helper method to create an elemental argument for a functor that includes whether to perform skewness...
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.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.