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 "MooseArray.h" 14 : #include "NeighborResidualObject.h" 15 : #include "BoundaryRestrictable.h" 16 : #include "NeighborCoupleableMooseVariableDependencyIntermediateInterface.h" 17 : #include "TwoMaterialPropertyInterface.h" 18 : #include "ElementIDInterface.h" 19 : 20 : /** 21 : * InterfaceKernelBase is the base class for all InterfaceKernel type classes. 22 : */ 23 : 24 : class InterfaceKernelBase : public NeighborResidualObject, 25 : public BoundaryRestrictable, 26 : public NeighborCoupleableMooseVariableDependencyIntermediateInterface, 27 : public TwoMaterialPropertyInterface, 28 : public ElementIDInterface 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : InterfaceKernelBase(const InputParameters & parameters); 34 : 35 : /// The neighbor variable number that this interface kernel operates on 36 : virtual const MooseVariableFEBase & neighborVariable() const = 0; 37 : 38 : /// Selects the correct Jacobian type and routine to call for the primary variable jacobian 39 : virtual void computeElementOffDiagJacobian(unsigned int jvar) = 0; 40 : 41 : /// Selects the correct Jacobian type and routine to call for the secondary variable jacobian 42 : virtual void computeNeighborOffDiagJacobian(unsigned int jvar) = 0; 43 : 44 : void prepareShapes(unsigned int var_num) override final; 45 : 46 : protected: 47 : /// Compute jacobians at quadrature points 48 0 : virtual Real computeQpJacobian(Moose::DGJacobianType /*type*/) { return 0; } 49 : 50 : /// compute off-diagonal jacobian components at quadrature points 51 0 : virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType /*type*/, unsigned int /*jvar*/) 52 : { 53 0 : return 0; 54 : } 55 : 56 : /// The volume of the current neighbor 57 : const Real & getNeighborElemVolume(); 58 : 59 : /// Pointer reference to the current element 60 : const Elem * const & _current_elem; 61 : 62 : /// The volume (or length) of the current element 63 : const Real & _current_elem_volume; 64 : 65 : /// The neighboring element 66 : const Elem * const & _neighbor_elem; 67 : 68 : /// The neighboring element volume 69 : const Real & _neighbor_elem_volume; 70 : 71 : /// Current side 72 : const unsigned int & _current_side; 73 : 74 : /// Current side element 75 : const Elem * const & _current_side_elem; 76 : 77 : /// The volume (or length) of the current side 78 : const Real & _current_side_volume; 79 : 80 : /// Coordinate system 81 : const Moose::CoordinateSystemType & _coord_sys; 82 : 83 : /// Current quadrature point 84 : unsigned int _qp; 85 : 86 : /// Array that holds element quadrature point coordinates 87 : const MooseArray<Point> & _q_point; 88 : 89 : /// Quadrature rule 90 : const QBase * const & _qrule; 91 : 92 : /// Elemtn Jacobian/quadrature weight 93 : const MooseArray<Real> & _JxW; 94 : 95 : /// Coordinate transformation value; relevant in axisymmetric simulations for example 96 : const MooseArray<Real> & _coord; 97 : 98 : /// Index for test and trial functions 99 : unsigned int _i, _j; 100 : 101 : /** MultiMooseEnum specifying whether residual save-in 102 : * aux variables correspond to primary or secondary side 103 : */ 104 : MultiMooseEnum _save_in_var_side; 105 : 106 : /** The names of the aux variables that will be used to save-in residuals 107 : * (includes both primary and secondary variable names) 108 : */ 109 : std::vector<AuxVariableName> _save_in_strings; 110 : 111 : /// Whether there are primary residual aux variables 112 : bool _has_primary_residuals_saved_in; 113 : 114 : /// The aux variables to save the primary residual contributions to 115 : std::vector<MooseVariableFEBase *> _primary_save_in_residual_variables; 116 : 117 : /// Whether there are secondary residual aux variables 118 : bool _has_secondary_residuals_saved_in; 119 : 120 : /// The aux variables to save the secondary contributions to 121 : std::vector<MooseVariableFEBase *> _secondary_save_in_residual_variables; 122 : 123 : /** MultiMooseEnum specifying whether jacobian save-in 124 : * aux variables correspond to primary or secondary side 125 : */ 126 : MultiMooseEnum _diag_save_in_var_side; 127 : 128 : /** The names of the aux variables that will be used to save-in jacobians 129 : * (includes both primary and secondary variable names) 130 : */ 131 : std::vector<AuxVariableName> _diag_save_in_strings; 132 : 133 : /// Whether there are primary jacobian aux variables 134 : bool _has_primary_jacobians_saved_in; 135 : 136 : /// The aux variables to save the diagonal Jacobian contributions of the primary variables to 137 : std::vector<MooseVariableFEBase *> _primary_save_in_jacobian_variables; 138 : 139 : /// Whether there are secondary jacobian aux variables 140 : bool _has_secondary_jacobians_saved_in; 141 : 142 : /// The aux variables to save the diagonal Jacobian contributions of the secondary variables to 143 : std::vector<MooseVariableFEBase *> _secondary_save_in_jacobian_variables; 144 : 145 : /// Mutex that prevents multiple threads from saving into the residual aux_var at the same time 146 : static Threads::spin_mutex _resid_vars_mutex; 147 : 148 : /// Mutex that prevents multiple threads from saving into the jacobian aux_var at the same time 149 : static Threads::spin_mutex _jacoby_vars_mutex; 150 : };