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 "Kernel.h" 13 : 14 : /** 15 : * NonlocalKernel is used for solving integral terms in integro-differential equations. 16 : * Integro-differential equations includes spatial integral terms over variables in the domain. 17 : * In this case the jacobian calculation is not restricted to local dofs of an element, it requires 18 : * additional contributions from all the dofs in the domain. NonlocalKernel adds capability to 19 : * consider 20 : * nonlocal jacobians in addition to the local jacobians. 21 : */ 22 : class NonlocalKernel : public Kernel 23 : { 24 : public: 25 : static InputParameters validParams(); 26 : 27 : NonlocalKernel(const InputParameters & parameters); 28 : 29 : /** 30 : * computeJacobian and computeQpOffDiagJacobian methods are almost same 31 : * as Kernel except for few additional optimization options regarding the integral terms. 32 : * Looping order of _i & _j are reversed for providing opimization options and 33 : * additional getUserObjectJacobian method is provided as an option to obtain 34 : * jocobians of the integral term from userobject once per dof 35 : */ 36 : virtual void computeJacobian() override; 37 : virtual void computeOffDiagJacobian(unsigned int jvar) override; 38 : 39 : /** 40 : * computeNonlocalJacobian and computeNonlocalOffDiagJacobian methods are 41 : * introduced for providing the jacobian contribution corresponding to nolocal dofs. 42 : * Nonlocal jacobian block is sized with respect to the all the dofs of jacobian variable. 43 : * Looping order of _i & _k are reversed for opimization purpose and 44 : * additional globalDoFEnabled method is provided as an option to execute nonlocal 45 : * jocobian calculations only for nonlocal dofs that has nonzero jacobian contribution. 46 : */ 47 : virtual void computeNonlocalJacobian() override; 48 : virtual void computeNonlocalOffDiagJacobian(unsigned int jvar) override; 49 : 50 : protected: 51 : /// Compute this Kernel's contribution to the Jacobian corresponding to nolocal dof at the current quadrature point 52 0 : virtual Real computeQpNonlocalJacobian(dof_id_type /*dof_index*/) { return 0; } 53 0 : virtual Real computeQpNonlocalOffDiagJacobian(unsigned int /*jvar*/, dof_id_type /*dof_index*/) 54 : { 55 0 : return 0; 56 : } 57 : 58 : /// Optimization option for getting jocobinas from userobject once per dof 59 3780 : virtual void getUserObjectJacobian(unsigned int /*jvar*/, dof_id_type /*dof_index*/) {} 60 : /// optimization option for executing nonlocal jacobian calculation only for nonzero elements 61 2352 : virtual bool globalDoFEnabled(MooseVariableFEBase & /*var*/, dof_id_type /*dof_index*/) 62 : { 63 2352 : return true; 64 : } 65 : 66 : unsigned int _k; 67 : };