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 "IntegralRayKernelBase.h" 14 : 15 : // MOOSE Includes 16 : #include "MooseVariableInterface.h" 17 : #include "TaggingInterface.h" 18 : 19 : // Forward declarations 20 : template <typename> 21 : class RayKernelTempl; 22 : 23 : using RayKernel = RayKernelTempl<Real>; 24 : // Not implementing this until there is a use case and tests for it! 25 : // using VectorRayKernel = RayKernelTempl<RealVectorValue>; 26 : 27 : /** 28 : * Base class for a ray kernel that contributes to the residual and/or Jacobian 29 : */ 30 : template <typename T> 31 : class RayKernelTempl : public IntegralRayKernelBase, 32 : public MooseVariableInterface<T>, 33 : public TaggingInterface 34 : { 35 : public: 36 : RayKernelTempl(const InputParameters & params); 37 : 38 : static InputParameters validParams(); 39 : 40 : /** 41 : * The MooseVariable this RayKernel contributes to 42 : */ 43 366 : MooseVariableFE<T> & variable() { return _var; } 44 : 45 : void onSegment() override final; 46 : 47 : protected: 48 : /** 49 : * Compute this RayKernel's contribution to the residual at _qp and _i 50 : */ 51 : virtual Real computeQpResidual() = 0; 52 : /** 53 : * Compute this RayKernel's contribution to the residual at _qp, _i, and _j 54 : */ 55 478464 : virtual Real computeQpJacobian() { return 0; } 56 : /** 57 : * Compute this RayKernel's contribution to the off diagonal jacobian for the variable numbered 58 : * jvar_num. 59 : */ 60 0 : virtual Real computeQpOffDiagJacobian(const unsigned int /* jvar_num */) { return 0; } 61 : 62 : /** 63 : * Insertion point for calculation before the residual contribution 64 : */ 65 60469 : virtual void precalculateResidual(){}; 66 : /** 67 : * Insertion point for calculation before the Jacobian contribution 68 : */ 69 16944 : virtual void precalculateJacobian(){}; 70 : /** 71 : * Insertion point for calculation before an off-diagonal Jacobian contribution 72 : */ 73 462 : virtual void precalculateOffDiagJacobian(unsigned int /* jvar_num */){}; 74 : 75 : /// This is a regular kernel so we cast to a regular MooseVariable 76 : MooseVariableFE<T> & _var; 77 : 78 : /// Holds the solution at current quadrature points 79 : const typename OutputTools<T>::VariableValue & _u; 80 : 81 : /// Holds the solution gradient at the current quadrature points 82 : const typename OutputTools<T>::VariableGradient & _grad_u; 83 : 84 : /// Test function 85 : const typename OutputTools<T>::VariableTestValue & _test; 86 : 87 : /// Gradient of the test function 88 : const typename OutputTools<T>::VariableTestGradient & _grad_test; 89 : 90 : /// Current shape functions 91 : const typename OutputTools<T>::VariablePhiValue & _phi; 92 : 93 : /// gradient of the shape function 94 : const typename OutputTools<T>::VariablePhiGradient & _grad_phi; 95 : 96 : /// Current index for the test function 97 : unsigned int _i; 98 : 99 : /// Current index for the shape function 100 : unsigned int _j; 101 : 102 : private: 103 : /** 104 : * Computes and contributes to the Jacobian for a segment 105 : */ 106 : void computeJacobian(); 107 : /** 108 : * Computes and contributes to the residual for a segment 109 : */ 110 : void computeResidual(); 111 : }; 112 : 113 : extern template class RayKernelTempl<Real>;