https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16template <bool is_ad>
19{
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
31template <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
43template <bool is_ad>
44Real
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}
registerMooseObject("MooseApp", FunctorVectorElementalAux)
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
Moose::GenericType< RealVectorValue, is_ad > GenericRealVectorValue
Definition MooseTypes.h:702
void ErrorVector unsigned int
bool isNodal() const
Nodal or elemental kernel?
Definition AuxKernel.h:43
static InputParameters validParams()
Definition AuxKernel.C:27
Evaluate a functor vector (material property usually) with the element as the functor argument and sa...
virtual Real computeValue() override
Compute and return the value of the aux variable.
FunctorVectorElementalAuxTempl(const InputParameters &parameters)
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.
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:457
auto raw_value(const Eigen::Map< T > &in)