https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Kernel.h
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#pragma once
11
12#include "KernelBase.h"
14
15class Kernel : public KernelBase, public MooseVariableInterface<Real>
16{
17public:
19
21
23 virtual void computeResidual() override;
24
26 virtual void computeJacobian() override;
27
29 virtual void computeOffDiagJacobian(unsigned int jvar) override;
30
32 virtual void computeResidualAndJacobian() override;
33
38 virtual void computeOffDiagJacobianScalar(unsigned int jvar) override;
39
40 virtual const MooseVariable & variable() const override { return _var; }
41
42protected:
46 virtual Real computeQpResidual() = 0;
47
51 virtual Real computeQpJacobian() { return 0; }
52
56 virtual Real computeQpOffDiagJacobian(unsigned int /*jvar*/) { return 0; }
57
61 virtual Real computeQpOffDiagJacobianScalar(unsigned int /*jvar*/) { return 0; }
62
66 virtual RealEigenVector computeQpOffDiagJacobianArray(const ArrayMooseVariable & jvar)
67 {
68 return RealEigenVector::Zero(jvar.count());
69 }
70
73
76
79
82
85
88
91};
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition MooseTypes.h:353
OutputTools< Real >::VariableTestValue VariableTestValue
Definition MooseTypes.h:358
OutputTools< Real >::VariableGradient VariableGradient
Definition MooseTypes.h:349
OutputTools< Real >::VariableTestGradient VariableTestGradient
Definition MooseTypes.h:359
OutputTools< Real >::VariableValue VariableValue
Definition MooseTypes.h:348
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition MooseTypes.h:354
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition KernelBase.h:29
virtual void computeResidual() override
Compute this Kernel's contribution to the residual.
Definition Kernel.C:92
virtual Real computeQpResidual()=0
Compute this Kernel's contribution to the residual at the current quadrature point.
virtual void computeOffDiagJacobianScalar(unsigned int jvar) override
Computes jacobian block with respect to a scalar variable.
Definition Kernel.C:186
virtual void computeResidualAndJacobian() override
Compute the residual and Jacobian together.
Definition Kernel.C:200
const VariableGradient & _grad_u
Holds the solution gradient at the current quadrature points.
Definition Kernel.h:90
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-residual / d-jvar... storing the result in Ke.
Definition Kernel.C:133
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition Kernel.h:72
const VariablePhiValue & _phi
the current shape functions
Definition Kernel.h:81
virtual RealEigenVector computeQpOffDiagJacobianArray(const ArrayMooseVariable &jvar)
For coupling array variables.
Definition Kernel.h:66
virtual Real computeQpOffDiagJacobian(unsigned int)
For coupling standard variables.
Definition Kernel.h:56
virtual void computeJacobian() override
Compute this Kernel's contribution to the diagonal Jacobian entries.
Definition Kernel.C:112
const VariableTestValue & _test
the current test function
Definition Kernel.h:75
static InputParameters validParams()
Definition Kernel.C:24
virtual Real computeQpJacobian()
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
Definition Kernel.h:51
const VariablePhiGradient & _grad_phi
gradient of the shape function
Definition Kernel.h:84
virtual Real computeQpOffDiagJacobianScalar(unsigned int)
For coupling scalar variables.
Definition Kernel.h:61
const VariableTestGradient & _grad_test
gradient of the test function
Definition Kernel.h:78
const VariableValue & _u
Holds the solution at current quadrature points.
Definition Kernel.h:87
virtual const MooseVariable & variable() const override
Returns the variable that this object operates on.
Definition Kernel.h:40
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
Interface for objects that need to get values of MooseVariables.