https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVElementalKernel.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
11#include "Assembly.h"
12#include "SubProblem.h"
13
16{
18 params.registerSystemAttributeName("LinearFVElementalKernel");
19 return params;
20}
21
23 : LinearFVKernel(params), _current_elem_info(nullptr)
24{
25}
26
27void
29{
30 // These only contribute to the diagonal of the matrix, so we just get
31 // the contribution and insert it immediately. We add it to every tagged matrix.
32 const auto mx_contrib = computeMatrixContribution();
33 for (auto & matrix : _matrices)
34 (*matrix).add(_dof_id, _dof_id, mx_contrib);
35}
36
37void
39{
40 // These only contribute to one entry of the right hand side, so we just get
41 // the contribution and insert it immediately. We add it to every tagged
42 // vector.
43 const auto rhs_contrib = computeRightHandSideContribution();
44 for (auto & vector : _vectors)
45 (*vector).add(_dof_id, rhs_contrib);
46}
47
48void
Class used for caching additional information for elements such as the volume and centroid.
Definition ElemInfo.h:26
const std::vector< std::vector< dof_id_type > > & dofIndices() const
Definition ElemInfo.h:39
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
virtual void setCurrentElemInfo(const ElemInfo *elem_info)
Set the current ElemInfo object.
LinearFVElementalKernel(const InputParameters &params)
Class constructor.
const ElemInfo * _current_elem_info
Pointer to the current element info.
virtual Real computeRightHandSideContribution()=0
Computes the right hand side contribution for the given variable on the current element.
static InputParameters validParams()
virtual Real computeMatrixContribution()=0
Computes the system matrix contribution for the given variable on the current element.
virtual void addRightHandSideContribution() override
Add this object's contribution to the system right hand side.
dof_id_type _dof_id
The dof index for the current variable associated with the element.
virtual void addMatrixContribution() override
Add this object's contribution to the system matrix.
Base class for finite volume kernels that contribute to a linear systems.
static InputParameters validParams()
const unsigned int _sys_num
Cache for the system number.
const unsigned int _var_num
Cache for the variable number.
std::vector< SparseMatrix< Number > * > _matrices
Pointers to the matrices that need contributions from this kernel.
std::vector< NumericVector< Number > * > _vectors
Pointers to the vectors that need contributions from this kernel.