www.mooseframework.org
KernelBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "BlockRestrictable.h"
14 #include "SetupInterface.h"
16 #include "FunctionInterface.h"
17 #include "UserObjectInterface.h"
18 #include "TransientInterface.h"
19 #include "PostprocessorInterface.h"
22 #include "RandomInterface.h"
24 #include "Restartable.h"
25 #include "MeshChangedInterface.h"
26 #include "TaggingInterface.h"
27 #include "ElementIDInterface.h"
28 
29 class MooseMesh;
30 class SubProblem;
31 class KernelBase;
32 class Assembly;
33 template <typename>
37 
38 template <>
40 
45 class KernelBase : public MooseObject,
46  public BlockRestrictable,
47  public SetupInterface,
49  public FunctionInterface,
50  public UserObjectInterface,
51  public TransientInterface,
55  public RandomInterface,
56  protected GeometricSearchInterface,
57  public Restartable,
58  public MeshChangedInterface,
59  public TaggingInterface,
60  public ElementIDInterface
61 {
62 public:
64 
66 
67  virtual ~KernelBase();
68 
70  virtual void computeResidual() = 0;
71 
73  virtual void computeJacobian() = 0;
74 
76  virtual void computeOffDiagJacobian(MooseVariableFEBase & jvar) = 0;
77 
78  virtual void computeADOffDiagJacobian()
79  {
80  mooseError("The computeADOffDiagJacobian method should only be called on ADKernel objects");
81  }
82 
87  virtual void computeOffDiagJacobianScalar(unsigned int jvar) = 0;
88 
93  virtual void computeNonlocalJacobian() {}
94 
99  virtual void computeNonlocalOffDiagJacobian(unsigned int /* jvar */) {}
100 
104  virtual MooseVariableFEBase & variable() = 0;
105 
110 
111 protected:
115  virtual void precalculateResidual() {}
116  virtual void precalculateJacobian() {}
117  virtual void precalculateOffDiagJacobian(unsigned int /* jvar */) {}
118 
119 protected:
122 
125 
128 
131 
134 
137 
138  const Elem * const & _current_elem;
139 
141  const Real & _current_elem_volume;
142 
144  unsigned int _qp;
145 
148 
150  const QBase * const & _qrule;
151 
154 
157 
159  unsigned int _i;
160 
162  unsigned int _j;
163 
166  std::vector<MooseVariableFEBase *> _save_in;
167  std::vector<AuxVariableName> _save_in_strings;
168 
171  std::vector<MooseVariableFEBase *> _diag_save_in;
172  std::vector<AuxVariableName> _diag_save_in_strings;
173 
174  std::vector<unsigned int> _displacements;
175 };
KernelBase::_i
unsigned int _i
current index for the test function
Definition: KernelBase.h:159
MooseVariableFEBase
Definition: MooseVariableFEBase.h:27
THREAD_ID
unsigned int THREAD_ID
Definition: MooseTypes.h:196
SetupInterface
Definition: SetupInterface.h:28
KernelBase::_diag_save_in
std::vector< MooseVariableFEBase * > _diag_save_in
Definition: KernelBase.h:171
KernelBase::_assembly
Assembly & _assembly
Reference to this Kernel's assembly object.
Definition: KernelBase.h:133
GeometricSearchInterface
Definition: GeometricSearchInterface.h:23
GeometricSearchInterface.h
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
MeshChangedInterface.h
KernelBase::_save_in_strings
std::vector< AuxVariableName > _save_in_strings
Definition: KernelBase.h:167
KernelBase::_j
unsigned int _j
current index for the shape function
Definition: KernelBase.h:162
ElementIDInterface
Definition: ElementIDInterface.h:21
UserObjectInterface.h
MooseVariable
MooseVariableFE< Real > MooseVariable
Definition: KernelBase.h:34
KernelBase::computeJacobian
virtual void computeJacobian()=0
Compute this Kernel's contribution to the diagonal Jacobian entries.
KernelBase::_subproblem
SubProblem & _subproblem
Reference to this kernel's SubProblem.
Definition: KernelBase.h:121
VectorPostprocessorInterface.h
KernelBase::_mesh
MooseMesh & _mesh
Reference to this Kernel's mesh object.
Definition: KernelBase.h:136
KernelBase::subProblem
SubProblem & subProblem()
Returns a reference to the SubProblem for which this Kernel is active.
Definition: KernelBase.h:109
KernelBase::_current_elem
const Elem *const & _current_elem
Definition: KernelBase.h:138
FunctionInterface
Interface for objects that need to use functions.
Definition: FunctionInterface.h:38
MooseObject::parameters
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:76
UserObjectInterface
Interface for objects that need to use UserObjects.
Definition: UserObjectInterface.h:28
MaterialPropertyInterface.h
BlockRestrictable.h
SetupInterface.h
KernelBase::precalculateResidual
virtual void precalculateResidual()
Following methods are used for Kernels that need to perform a per-element calculation.
Definition: KernelBase.h:115
KernelBase::computeADOffDiagJacobian
virtual void computeADOffDiagJacobian()
Definition: KernelBase.h:78
KernelBase::validParams
static InputParameters validParams()
Definition: KernelBase.C:23
KernelBase::variable
virtual MooseVariableFEBase & variable()=0
Returns the variable that this Kernel operates on.
MooseObject
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:50
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
KernelBase::_qp
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:144
SubProblem
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:62
KernelBase::computeOffDiagJacobianScalar
virtual void computeOffDiagJacobianScalar(unsigned int jvar)=0
Computes jacobian block with respect to a scalar variable.
VectorPostprocessorInterface
Definition: VectorPostprocessorInterface.h:20
TransientInterface.h
PostprocessorInterface
Interface class for classes which interact with Postprocessors.
Definition: PostprocessorInterface.h:34
KernelBase::_fe_problem
FEProblemBase & _fe_problem
Reference to this kernel's FEProblemBase.
Definition: KernelBase.h:124
ElementIDInterface.h
KernelBase::_save_in
std::vector< MooseVariableFEBase * > _save_in
Definition: KernelBase.h:166
Restartable
A class for creating restricted objects.
Definition: Restartable.h:29
KernelBase::_tid
THREAD_ID _tid
The thread ID for this kernel.
Definition: KernelBase.h:130
KernelBase::_JxW
const MooseArray< Real > & _JxW
The current quadrature point weight value.
Definition: KernelBase.h:153
TransientInterface
Interface for objects that needs transient capabilities.
Definition: TransientInterface.h:35
FunctionInterface.h
KernelBase::_q_point
const MooseArray< Point > & _q_point
The physical location of the element's quadrature Points, indexed by _qp.
Definition: KernelBase.h:147
CoupleableMooseVariableDependencyIntermediateInterface
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
Definition: CoupleableMooseVariableDependencyIntermediateInterface.h:20
MeshChangedInterface
Interface for notifications that the mesh has changed.
Definition: MeshChangedInterface.h:28
MooseObject.h
KernelBase::computeOffDiagJacobian
virtual void computeOffDiagJacobian(MooseVariableFEBase &jvar)=0
Computes d-residual / d-jvar... storing the result in Ke.
MooseArray< Point >
Assembly
Keeps track of stuff related to assembling.
Definition: Assembly.h:62
Restartable.h
KernelBase::precalculateOffDiagJacobian
virtual void precalculateOffDiagJacobian(unsigned int)
Definition: KernelBase.h:117
KernelBase::KernelBase
KernelBase(const InputParameters &parameters)
Definition: KernelBase.C:61
KernelBase::_sys
SystemBase & _sys
Reference to the EquationSystem object.
Definition: KernelBase.h:127
KernelBase::_has_diag_save_in
bool _has_diag_save_in
The aux variables to save the diagonal Jacobian contributions to.
Definition: KernelBase.h:170
KernelBase::computeResidual
virtual void computeResidual()=0
Compute this Kernel's contribution to the residual.
BlockRestrictable
An interface that restricts an object to subdomains via the 'blocks' input parameter.
Definition: BlockRestrictable.h:61
KernelBase::_diag_save_in_strings
std::vector< AuxVariableName > _diag_save_in_strings
Definition: KernelBase.h:172
SystemBase
Base class for a system (of equations)
Definition: SystemBase.h:95
KernelBase::precalculateJacobian
virtual void precalculateJacobian()
Definition: KernelBase.h:116
MooseMesh
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
KernelBase::_qrule
const QBase *const & _qrule
active quadrature rule
Definition: KernelBase.h:150
VectorMooseVariable
MooseVariableFE< VectorValue< Real > > VectorMooseVariable
Definition: KernelBase.h:36
RandomInterface
Interface for objects that need parallel consistent random numbers without patterns over the course o...
Definition: RandomInterface.h:33
PostprocessorInterface.h
validParams< KernelBase >
InputParameters validParams< KernelBase >()
KernelBase::~KernelBase
virtual ~KernelBase()
Definition: KernelBase.C:103
TaggingInterface.h
CoupleableMooseVariableDependencyIntermediateInterface.h
KernelBase
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition: KernelBase.h:45
FEProblemBase
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblemBase.h:139
KernelBase::computeNonlocalJacobian
virtual void computeNonlocalJacobian()
Compute this Kernel's contribution to the diagonal Jacobian entries corresponding to nonlocal dofs of...
Definition: KernelBase.h:93
TaggingInterface
Definition: TaggingInterface.h:31
KernelBase::computeNonlocalOffDiagJacobian
virtual void computeNonlocalOffDiagJacobian(unsigned int)
Computes d-residual / d-jvar...
Definition: KernelBase.h:99
MooseVariableFE
Class for stuff related to variables.
Definition: Adaptivity.h:31
MaterialPropertyInterface
An interface for accessing Materials.
Definition: MaterialPropertyInterface.h:38
KernelBase::_displacements
std::vector< unsigned int > _displacements
Definition: KernelBase.h:174
KernelBase::_current_elem_volume
const Real & _current_elem_volume
Volume of the current element.
Definition: KernelBase.h:141
KernelBase::_has_save_in
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: KernelBase.h:165
KernelBase::_coord
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz,...
Definition: KernelBase.h:156
RandomInterface.h