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 "SideIntegralPostprocessor.h" 13 : #include "FaceArgInterface.h" 14 : 15 : /** 16 : * This postprocessor computes a surface integral of the specified functor 17 : * 18 : * Note that specializations of this integral are possible by deriving from this 19 : * class and overriding computeQpIntegral() or computeFaceInfoIntegral() 20 : */ 21 : template <bool is_ad> 22 : class SideIntegralFunctorPostprocessorTempl : public SideIntegralPostprocessor, 23 : public FaceArgProducerInterface 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : SideIntegralFunctorPostprocessorTempl(const InputParameters & parameters); 29 : 30 : bool hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const override; 31 : 32 : protected: 33 : /** 34 : * Compute contribution from an element face, either on a boundary or between two active elements 35 : * @param fi the FaceInfo, containing the geometric information of the face 36 : * @return the integral for this element (_current_elem) and side (_current_side) 37 : */ 38 : virtual Real computeFaceInfoIntegral(const FaceInfo * fi) override; 39 : 40 : Real computeQpIntegral() override; 41 : 42 : /// Check if the functor and the prefactor are defined on the primary block by the sideset 43 : bool checkFunctorDefinedOnSideBlock() const; 44 : 45 : /// Error with a helpful message if the functor is not defined on the primary block by the sideset 46 : void errorFunctorNotDefinedOnSideBlock() const; 47 : 48 4 : void errorNoFaceInfo() const override 49 : { 50 4 : mooseError("The parameter 'functor_argument' was set to 'face', but the mesh contains no face " 51 : "info objects."); 52 : } 53 : 54 : /// Functor being integrated 55 : const Moose::Functor<GenericReal<is_ad>> & _functor; 56 : 57 : /// Factor multiplying the functor being integrated 58 : const Moose::Functor<GenericReal<is_ad>> & _prefactor; 59 : 60 : /// Whether to skip integrating where the functors are not both defined 61 : const bool _partial_integral; 62 : 63 : private: 64 : template <typename T> 65 : Real computeLocalContribution(const T & functor_arg) const; 66 : }; 67 : 68 : typedef SideIntegralFunctorPostprocessorTempl<false> SideIntegralFunctorPostprocessor; 69 : typedef SideIntegralFunctorPostprocessorTempl<true> ADSideIntegralFunctorPostprocessor;