https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementIntegralFunctorPostprocessor.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
15template <bool is_ad>
18{
20 params.addRequiredParam<MooseFunctorName>("functor",
21 "The name of the functor that this object operates on");
22 params.addParam<MooseFunctorName>(
23 "prefactor", 1, "The name of a pre-factor inside the integrand");
24 params.addClassDescription("Computes a volume integral of the specified functor");
25 MooseEnum evaluation_type(getFunctorEvaluationTypeOptions(), "QUADRATURE_POINT");
26 params.addParam<MooseEnum>(
27 "evaluation_type", evaluation_type, "How the functor should be evaluated.");
28 return params;
29}
30
31template <bool is_ad>
33 const InputParameters & parameters)
34 : ElementIntegralPostprocessor(parameters),
35 _functor(getFunctor<GenericReal<is_ad>>("functor")),
36 _prefactor(getFunctor<GenericReal<is_ad>>("prefactor")),
37 _evaluation_type(
38 getParam<MooseEnum>("evaluation_type").template getEnum<FunctorEvaluationType>())
39{
40}
41
42template <bool is_ad>
43Real
45{
46 switch (_evaluation_type)
47 {
48 case FunctorEvaluationType::QUADRATURE_POINT:
50 case FunctorEvaluationType::CELL_AVERAGE:
51 return _current_elem_volume * cellAverage();
52 default:
53 mooseError("Unhandled enumerator type");
54 }
55}
56
57template <bool is_ad>
58Real
60{
61 Moose::ElemQpArg elem_qp = {_current_elem, _qp, _qrule, _q_point[_qp]};
62 return MetaPhysicL::raw_value(_prefactor(elem_qp, determineState()) *
63 MetaPhysicL::raw_value(_functor(elem_qp, determineState())));
64}
65
66template <bool is_ad>
67Real
69{
70 const Moose::ElemArg elem_arg = makeElemArg(_current_elem);
71 return MetaPhysicL::raw_value(_prefactor(elem_arg, determineState()) *
72 MetaPhysicL::raw_value(_functor(elem_arg, determineState())));
73}
74
registerMooseObject("MooseApp", ElementIntegralFunctorPostprocessor)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
This postprocessor computes an element integral of the specified functor.
ElementIntegralFunctorPostprocessorTempl(const InputParameters &parameters)
This postprocessor computes a volume integral of the specified variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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...
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
auto raw_value(const Eigen::Map< T > &in)
A structure that is used to evaluate Moose functors logically at an element/cell center.
Argument for requesting functor evaluation at a quadrature point location in an element.