https://mooseframework.inl.gov
ElementExtremeFunctorValue.C
Go to the documentation of this file.
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 
11 
14 
15 template <bool is_ad>
18 {
20  params.addRequiredParam<MooseFunctorName>(
21  "functor", "The name of the functor for which to find the extrema");
22  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  params.addParam<Real>("scale", 1.0, "Scaling factor to apply to functor value");
28  params.addClassDescription(
29  "Finds either the min or max elemental value of a functor over the domain.");
30  return params;
31 }
32 
33 template <bool is_ad>
35  const InputParameters & parameters)
37  _functor(getFunctor<GenericReal<is_ad>>("functor")),
38  _proxy_functor(isParamValid("proxy_functor") ? getFunctor<GenericReal<is_ad>>("proxy_functor")
39  : getFunctor<GenericReal<is_ad>>("functor")),
40  _scale(getParam<Real>("scale"))
41 {
42 }
43 
44 template <bool is_ad>
45 std::pair<Real, Real>
47 {
48  // Most element evaluations do not use skewness correction,
49  // but this could become a parameter in the future
50  Moose::ElemArg elem = makeElemArg(_current_elem);
51  return std::make_pair(MetaPhysicL::raw_value(_proxy_functor(elem, determineState())),
52  _scale * MetaPhysicL::raw_value(_functor(elem, determineState())));
53 }
54 
Moose::GenericType< Real, is_ad > GenericReal
Definition: MooseTypes.h:693
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:100
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
static InputParameters validParams()
A structure that is used to evaluate Moose functors logically at an element/cell center.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ElementExtremeFunctorValueTempl(const InputParameters &parameters)
virtual std::pair< Real, Real > getProxyValuePair() override
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
registerMooseObject("MooseApp", ElementExtremeFunctorValue)
A postprocessor for collecting an extreme value for a functor with an element argument.