https://mooseframework.inl.gov
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 
27 void
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 
37 void
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 
48 void
50 {
51  _current_elem_info = elem_info;
53 }
const ElemInfo * _current_elem_info
Pointer to the current element info.
const unsigned int _var_num
Cache for the variable number.
Base class for finite volume kernels that contribute to a linear systems.
static InputParameters validParams()
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...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
std::vector< NumericVector< Number > * > _vectors
Pointers to the vectors that need contributions from this kernel.
virtual void addMatrixContribution() override
Add this object&#39;s contribution to the system matrix.
std::vector< SparseMatrix< Number > * > _matrices
Pointers to the matrices that need contributions from this kernel.
dof_id_type _dof_id
The dof index for the current variable associated with the element.
virtual void setCurrentElemInfo(const ElemInfo *elem_info)
Set the current ElemInfo object.
virtual Real computeMatrixContribution()=0
Computes the system matrix contribution for the given variable on the current element.
const std::vector< std::vector< dof_id_type > > & dofIndices() const
Definition: ElemInfo.h:39
LinearFVElementalKernel(const InputParameters &params)
Class constructor.
virtual void addRightHandSideContribution() override
Add this object&#39;s contribution to the system right hand side.
Class used for caching additional information for elements such as the volume and centroid...
Definition: ElemInfo.h:25
const unsigned int _sys_num
Cache for the system number.
virtual Real computeRightHandSideContribution()=0
Computes the right hand side contribution for the given variable on the current element.