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 "MooseObject.h" 13 : #include "MooseVariableFE.h" 14 : #include "SetupInterface.h" 15 : #include "CoupleableMooseVariableDependencyIntermediateInterface.h" 16 : #include "MaterialPropertyInterface.h" 17 : #include "FunctionInterface.h" 18 : #include "UserObjectInterface.h" 19 : #include "TransientInterface.h" 20 : #include "PostprocessorInterface.h" 21 : #include "DependencyResolverInterface.h" 22 : #include "RandomInterface.h" 23 : #include "GeometricSearchInterface.h" 24 : #include "BlockRestrictable.h" 25 : #include "BoundaryRestrictable.h" 26 : #include "Restartable.h" 27 : #include "MeshChangedInterface.h" 28 : #include "VectorPostprocessorInterface.h" 29 : #include "ElementIDInterface.h" 30 : #include "UserObject.h" 31 : #include "NonADFunctorInterface.h" 32 : 33 : // forward declarations 34 : class SubProblem; 35 : class AuxiliarySystem; 36 : class SystemBase; 37 : class MooseMesh; 38 : 39 : /** 40 : * Base class for auxiliary kernels 41 : */ 42 : class AuxKernelBase : public MooseObject, 43 : public BlockRestrictable, 44 : public BoundaryRestrictable, 45 : public SetupInterface, 46 : public CoupleableMooseVariableDependencyIntermediateInterface, 47 : public FunctionInterface, 48 : public UserObjectInterface, 49 : public TransientInterface, 50 : public MaterialPropertyInterface, 51 : public PostprocessorInterface, 52 : public DependencyResolverInterface, 53 : public RandomInterface, 54 : public GeometricSearchInterface, 55 : public Restartable, 56 : public MeshChangedInterface, 57 : protected VectorPostprocessorInterface, 58 : public ElementIDInterface, 59 : protected NonADFunctorInterface 60 : { 61 : public: 62 : static InputParameters validParams(); 63 : 64 : AuxKernelBase(const InputParameters & parameters); 65 : 66 : #ifdef MOOSE_KOKKOS_ENABLED 67 : /** 68 : * Special constructor used for Kokkos functor copy during parallel dispatch 69 : */ 70 : AuxKernelBase(const AuxKernelBase & object, const Moose::Kokkos::FunctorCopy & key); 71 : #endif 72 : 73 : virtual void compute() = 0; 74 : 75 193257 : const std::set<UserObjectName> & getDependObjects() const { return _depend_uo; } 76 : 77 : void coupledCallback(const std::string & var_name, bool is_old) const override; 78 : 79 : virtual const std::set<std::string> & getRequestedItems() override; 80 : 81 : virtual const std::set<std::string> & getSuppliedItems() override; 82 : 83 : protected: 84 : /// Base MooseVariable 85 : MooseVariableFieldBase & _var; 86 : 87 : /// true if the kernel is boundary kernel, false if it is interior kernels 88 : const bool _bnd; 89 : 90 : /** 91 : * Whether or not to check for repeated element sides on the sideset to which 92 : * the auxkernel is restricted (if boundary restricted _and_ elemental). Setting 93 : * this to false will allow an element with more than one face on the boundary 94 : * to which it is restricted allow contribution to the element's value(s). This 95 : * flag allows auxkernels that evaluate boundary-restricted elemental auxvariables 96 : * to have more than one element face on the boundary of interest. 97 : */ 98 : const bool _check_boundary_restricted; 99 : 100 : /// Whether we are computing for a lower dimensional variable using boundary restriction, e.g. a 101 : /// variable whose block restriction is coincident with a higher-dimensional boundary face 102 : const bool _coincident_lower_d_calc; 103 : 104 : /// Subproblem this kernel is part of 105 : SubProblem & _subproblem; 106 : /// System this kernel is part of 107 : SystemBase & _sys; 108 : SystemBase & _nl_sys; 109 : AuxiliarySystem & _aux_sys; 110 : 111 : /// Thread ID 112 : const THREAD_ID _tid; 113 : 114 : /// Assembly class 115 : Assembly & _assembly; 116 : 117 : /// Mesh this kernel is active on 118 : MooseMesh & _mesh; 119 : 120 : private: 121 : void addPostprocessorDependencyHelper(const PostprocessorName & name) const override final; 122 : void addUserObjectDependencyHelper(const UserObject & uo) const override final; 123 : void 124 : addVectorPostprocessorDependencyHelper(const VectorPostprocessorName & name) const override final; 125 : 126 : /// Get MooseVariable of base type from parameter 127 : MooseVariableFieldBase & getVariableHelper(const InputParameters & parameters); 128 : 129 : /// Depend AuxKernelTempls 130 : mutable std::set<std::string> _depend_vars; 131 : std::set<std::string> _supplied_vars; 132 : 133 : /// Depend UserObjects 134 : mutable std::set<UserObjectName> _depend_uo; 135 : };