Line data Source code
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" 13 : #include "MooseVariableInterface.h" 14 : 15 : class VectorKernel : public KernelBase, public MooseVariableInterface<RealVectorValue> 16 : { 17 : public: 18 : static InputParameters validParams(); 19 : 20 : VectorKernel(const InputParameters & parameters); 21 : 22 : /// Compute this VectorKernel's contribution to the residual 23 : virtual void computeResidual() override; 24 : 25 : /// Compute this VectorKernel's contribution to the diagonal Jacobian entries 26 : virtual void computeJacobian() override; 27 : 28 : /// Computes d-residual / d-jvar... storing the result in Ke. 29 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 30 : 31 : /** 32 : * Computes jacobian block with respect to a scalar variable 33 : * @param jvar The number of the scalar variable 34 : */ 35 : virtual void computeOffDiagJacobianScalar(unsigned int jvar) override; 36 : 37 1004546 : virtual const VectorMooseVariable & variable() const override { return _var; } 38 : 39 : protected: 40 : /** 41 : * Compute this Kernel's contribution to the residual at the current quadrature point 42 : */ 43 : virtual Real computeQpResidual() = 0; 44 : 45 : /** 46 : * Compute this Kernel's contribution to the Jacobian at the current quadrature point 47 : */ 48 46947335 : virtual Real computeQpJacobian() { return 0; } 49 : 50 : /** 51 : * This is the virtual that derived classes should override for computing an off-diagonal Jacobian 52 : * component. 53 : */ 54 34443904 : virtual Real computeQpOffDiagJacobian(unsigned int /*jvar*/) { return 0; } 55 : 56 : /** 57 : * For coupling scalar variables 58 : */ 59 0 : virtual Real computeQpOffDiagJacobianScalar(unsigned int /*jvar*/) { return 0; } 60 : 61 : /// This is a regular kernel so we cast to a regular MooseVariable 62 : const VectorMooseVariable & _var; 63 : 64 : /// the current test function 65 : const VectorVariableTestValue & _test; 66 : 67 : /// gradient of the test function 68 : const VectorVariableTestGradient & _grad_test; 69 : 70 : /// the current shape functions 71 : const VectorVariablePhiValue & _phi; 72 : 73 : /// gradient of the shape function 74 : const VectorVariablePhiGradient & _grad_phi; 75 : 76 : /// Holds the solution at current quadrature points 77 : const VectorVariableValue & _u; 78 : 79 : /// Holds the solution gradient at current quadrature points 80 : const VectorVariableGradient & _grad_u; 81 : };