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 : // local includes 13 : #include "Kernel.h" 14 : 15 : /** 16 : * The KernelGrad class is responsible for calculating the residuals in form: 17 : * 18 : * JxW[_qp] * _vector[_qp] * _grad_test[_i][_qp] 19 : * 20 : */ 21 : class KernelGrad : public Kernel 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : /** 27 : * Factory constructor initializes all internal references needed for residual computation. 28 : * 29 : * @param parameters The parameters object for holding additional parameters for kernels and 30 : * derived kernels 31 : */ 32 : KernelGrad(const InputParameters & parameters); 33 : 34 : virtual void computeResidual() override; 35 : 36 : virtual void computeJacobian() override; 37 : 38 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 39 : 40 : protected: 41 : /** 42 : * Called before forming the residual for an element 43 : */ 44 : virtual RealGradient precomputeQpResidual() = 0; 45 : 46 : /** 47 : * Called before forming the jacobian for an element 48 : */ 49 0 : virtual RealGradient precomputeQpJacobian() { return RealGradient(0.0); } 50 : 51 0 : virtual Real computeQpResidual() override final { return 0.0; } 52 : 53 0 : virtual Real computeQpJacobian() override final { return 0.0; } 54 : };