www.mooseframework.org
KernelBase.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef KERNELBASE_H
16 #define KERNELBASE_H
17 
18 #include "MooseObject.h"
19 #include "BlockRestrictable.h"
20 #include "SetupInterface.h"
22 #include "FunctionInterface.h"
23 #include "UserObjectInterface.h"
24 #include "TransientInterface.h"
25 #include "PostprocessorInterface.h"
28 #include "RandomInterface.h"
30 #include "Restartable.h"
31 #include "ZeroInterface.h"
32 #include "MeshChangedInterface.h"
33 
34 class MooseMesh;
35 class SubProblem;
36 class KernelBase;
37 class Assembly;
38 class MooseVariable;
39 
40 template <>
42 
47 class KernelBase : public MooseObject,
48  public BlockRestrictable,
49  public SetupInterface,
51  public FunctionInterface,
52  public UserObjectInterface,
53  public TransientInterface,
57  public RandomInterface,
58  protected GeometricSearchInterface,
59  public Restartable,
60  public ZeroInterface,
62 {
63 public:
65 
66  virtual ~KernelBase();
67 
69  virtual void computeResidual() = 0;
70 
72  virtual void computeJacobian() = 0;
73 
75  virtual void computeOffDiagJacobian(unsigned int jvar) = 0;
76 
81  virtual void computeOffDiagJacobianScalar(unsigned int jvar) = 0;
82 
87  virtual void computeNonlocalJacobian() {}
88 
93  virtual void computeNonlocalOffDiagJacobian(unsigned int /* jvar */) {}
94 
97 
100 
101  virtual bool isEigenKernel() const { return _eigen_kernel; }
102 
103 protected:
106 
109 
112 
115 
118 
121 
124 
125  const Elem *& _current_elem;
126 
128  const Real & _current_elem_volume;
129 
131  unsigned int _qp;
132 
135 
137  QBase *& _qrule;
138 
141 
144 
146  unsigned int _i;
147 
149  unsigned int _j;
150 
153 
156 
159 
162 
164  DenseVector<Number> _local_re;
165 
167  DenseMatrix<Number> _local_ke;
168 
171  std::vector<MooseVariable *> _save_in;
172  std::vector<AuxVariableName> _save_in_strings;
173 
176  std::vector<MooseVariable *> _diag_save_in;
177  std::vector<AuxVariableName> _diag_save_in_strings;
178 
180 };
181 
182 #endif /* KERNELBASE_H */
Interface for objects that need parallel consistent random numbers without patterns over the course o...
FEProblemBase & _fe_problem
Reference to this kernel&#39;s FEProblemBase.
Definition: KernelBase.h:108
A class for creating restricted objects.
Definition: Restartable.h:31
std::vector< MooseVariable * > _diag_save_in
Definition: KernelBase.h:176
const VariablePhiGradient & _grad_phi
gradient of the shape function
Definition: KernelBase.h:161
Keeps track of stuff related to assembling.
Definition: Assembly.h:63
Class for stuff related to variables.
Definition: MooseVariable.h:43
virtual void computeResidual()=0
Compute this Kernel&#39;s contribution to the residual.
const MooseArray< Real > & _JxW
The current quadrature point weight value.
Definition: KernelBase.h:140
const VariableTestGradient & _grad_test
gradient of the test function
Definition: KernelBase.h:155
DenseMatrix< Number > _local_ke
Holds residual entries as they are accumulated by this Kernel.
Definition: KernelBase.h:167
std::vector< AuxVariableName > _diag_save_in_strings
Definition: KernelBase.h:177
const VariableTestValue & _test
the current test function
Definition: KernelBase.h:152
SubProblem & subProblem()
Returns a reference to the SubProblem for which this Kernel is active.
Definition: KernelBase.C:162
SystemBase & _sys
Reference to the EquationSystem object.
Definition: KernelBase.h:111
THREAD_ID _tid
The thread ID for this kernel.
Definition: KernelBase.h:114
QBase *& _qrule
active quadrature rule
Definition: KernelBase.h:137
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.
Definition: KernelBase.h:164
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual ~KernelBase()
Definition: KernelBase.C:153
Base class for a system (of equations)
Definition: SystemBase.h:91
KernelBase(const InputParameters &parameters)
Definition: KernelBase.C:65
bool _has_diag_save_in
The aux variables to save the diagonal Jacobian contributions to.
Definition: KernelBase.h:175
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Assembly & _assembly
Reference to this Kernel&#39;s assembly object.
Definition: KernelBase.h:117
virtual void computeNonlocalOffDiagJacobian(unsigned int)
Computes d-residual / d-jvar...
Definition: KernelBase.h:93
Interface for objects that needs transient capabilities.
const Real & _current_elem_volume
Volume of the current element.
Definition: KernelBase.h:128
Interface for notifications that the mesh has changed.
This is the common base class for the two main kernel types implemented in MOOSE, EigenKernel and Ker...
Definition: KernelBase.h:47
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
virtual bool isEigenKernel() const
Definition: KernelBase.h:101
std::vector< MooseVariable * > _save_in
Definition: KernelBase.h:171
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
bool _has_save_in
The aux variables to save the residual contributions to.
Definition: KernelBase.h:170
virtual void computeNonlocalJacobian()
Compute this Kernel&#39;s contribution to the diagonal Jacobian entries corresponding to nonlocal dofs of...
Definition: KernelBase.h:87
unsigned int _i
current index for the test function
Definition: KernelBase.h:146
Interface for objects that need to use UserObjects.
bool _eigen_kernel
Definition: KernelBase.h:179
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz, spherical, etc.)
Definition: KernelBase.h:143
const VariablePhiValue & _phi
the current shape functions
Definition: KernelBase.h:158
MooseMesh & _mesh
Reference to this Kernel&#39;s mesh object.
Definition: KernelBase.h:123
std::vector< AuxVariableName > _save_in_strings
Definition: KernelBase.h:172
unsigned int _j
current index for the shape function
Definition: KernelBase.h:149
virtual void computeJacobian()=0
Compute this Kernel&#39;s contribution to the diagonal Jacobian entries.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
SubProblem & _subproblem
Reference to this kernel&#39;s SubProblem.
Definition: KernelBase.h:105
Interface to bring zero values inside objects.
Definition: ZeroInterface.h:35
An interface for accessing Materials.
Intermediate base class that ties together all the interfaces for getting MooseVariables with the Moo...
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
MooseVariable & variable()
Returns the variable number that this Kernel operates on.
Definition: KernelBase.C:156
virtual void computeOffDiagJacobianScalar(unsigned int jvar)=0
Computes jacobian block with respect to a scalar variable.
MooseVariable & _var
Reference to this Kernel&#39;s MooseVariable object.
Definition: KernelBase.h:120
const Elem *& _current_elem
Definition: KernelBase.h:125
Interface for objects that need to use functions.
InputParameters validParams< KernelBase >()
Definition: KernelBase.C:27
virtual void computeOffDiagJacobian(unsigned int jvar)=0
Computes d-residual / d-jvar... storing the result in Ke.
const MooseArray< Point > & _q_point
The physical location of the element&#39;s quadrature Points, indexed by _qp.
Definition: KernelBase.h:134
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
unsigned int _qp
The current quadrature point index.
Definition: KernelBase.h:131