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 : #include "ElementExtremeFunctorValue.h" 11 : 12 : registerMooseObject("MooseApp", ElementExtremeFunctorValue); 13 : registerMooseObject("MooseApp", ADElementExtremeFunctorValue); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 6779 : ElementExtremeFunctorValueTempl<is_ad>::validParams() 18 : { 19 6779 : InputParameters params = ExtremeValueBase<ElementPostprocessor>::validParams(); 20 27116 : params.addRequiredParam<MooseFunctorName>( 21 : "functor", "The name of the functor for which to find the extrema"); 22 27116 : params.addParam<MooseFunctorName>( 23 : "proxy_functor", 24 : "The name of the functor to use to identify the location at which " 25 : "the functor value should be taken; if not provided, this defaults " 26 : "to the 'functor' parameter."); 27 27116 : params.addParam<Real>("scale", 1.0, "Scaling factor to apply to functor value"); 28 6779 : params.addClassDescription( 29 : "Finds either the min or max elemental value of a functor over the domain."); 30 6779 : return params; 31 0 : } 32 : 33 : template <bool is_ad> 34 342 : ElementExtremeFunctorValueTempl<is_ad>::ElementExtremeFunctorValueTempl( 35 : const InputParameters & parameters) 36 : : ExtremeValueBase<ElementPostprocessor>(parameters), 37 342 : _functor(getFunctor<GenericReal<is_ad>>("functor")), 38 1156 : _proxy_functor(isParamValid("proxy_functor") ? getFunctor<GenericReal<is_ad>>("proxy_functor") 39 896 : : getFunctor<GenericReal<is_ad>>("functor")), 40 1026 : _scale(getParam<Real>("scale")) 41 : { 42 342 : } 43 : 44 : template <bool is_ad> 45 : std::pair<Real, Real> 46 108435 : ElementExtremeFunctorValueTempl<is_ad>::getProxyValuePair() 47 : { 48 : // Most element evaluations do not use skewness correction, 49 : // but this could become a parameter in the future 50 108435 : Moose::ElemArg elem = makeElemArg(_current_elem); 51 198035 : return std::make_pair(MetaPhysicL::raw_value(_proxy_functor(elem, determineState())), 52 306470 : _scale * MetaPhysicL::raw_value(_functor(elem, determineState()))); 53 : } 54 : 55 : template class ElementExtremeFunctorValueTempl<false>; 56 : template class ElementExtremeFunctorValueTempl<true>;