https://mooseframework.inl.gov
FunctorVectorElementalAux.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 #include "metaphysicl/raw_type.h"
12 
15 
16 template <bool is_ad>
19 {
21  params.addClassDescription(
22  "Evaluates a vector functor (material property usually) on the current element."
23  "For finite volume, this evaluates the vector functor at the centroid.");
24  params.addRequiredParam<MooseFunctorName>("functor", "The functor to evaluate");
25  params.addRequiredParam<unsigned int>("component", "Component of the vector functor");
26  params.addParam<MooseFunctorName>("factor", 1, "A factor to apply on the functor");
27 
28  return params;
29 }
30 
31 template <bool is_ad>
33  const InputParameters & parameters)
34  : AuxKernel(parameters),
35  _functor(getFunctor<GenericRealVectorValue<is_ad>>("functor")),
36  _component(getParam<unsigned int>("component")),
37  _factor(getFunctor<GenericReal<is_ad>>("factor"))
38 {
39  if (isNodal())
40  paramError("variable", "This AuxKernel only supports Elemental fields");
41 }
42 
43 template <bool is_ad>
44 Real
46 {
47  const auto elem_arg = makeElemArg(_current_elem);
48  const auto state = determineState();
49  return MetaPhysicL::raw_value(_factor(elem_arg, state)) *
50  MetaPhysicL::raw_value(_functor(elem_arg, state)(_component));
51 }
Moose::GenericType< Real, is_ad > GenericReal
Definition: MooseTypes.h:649
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:435
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeValue() override
Compute and return the value of the aux variable.
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...
FunctorVectorElementalAuxTempl(const InputParameters &parameters)
Moose::GenericType< RealVectorValue, is_ad > GenericRealVectorValue
Definition: MooseTypes.h:653
Evaluate a functor vector (material property usually) with the element as the functor argument and sa...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
static InputParameters validParams()
Definition: AuxKernel.C:27
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:36
registerMooseObject("MooseApp", FunctorVectorElementalAux)
void ErrorVector unsigned int
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:86