https://mooseframework.inl.gov
ElementUOAux.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 
10 #include "ElementUOAux.h"
11 #include "ElementUOProvider.h"
12 
14 
17 {
19  params.addRequiredParam<UserObjectName>("element_user_object",
20  "The ElementUOProvider where this Aux pulls values from");
21 
22  params.addParam<std::string>("field_name",
23  "The field name to retrieve from the ElementUOProvider");
24 
25  MooseEnum field_type("long Real", "long");
26  params.addParam<MooseEnum>("field_type", field_type, "The type of field to retrieve");
27 
28  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_BEGIN;
29  params.addClassDescription("Aux Kernel to display generic spatial (elemental) information from a "
30  "UserObject that satisfies the underlying ElementUOProvider "
31  "interface.");
32  return params;
33 }
34 
36  : AuxKernel(params),
37  // doco-get-user-object-begin
38  _elem_uo(getUserObject<ElementUOProvider>("element_user_object")),
39  // doco-get-user-object-end
40  _field_name(isParamValid("field_name") ? getParam<std::string>("field_name") : "default"),
41  _field_type(getParam<MooseEnum>("field_type"))
42 {
43  if (isNodal())
44  mooseError("This AuxKernel only supports Elemental fields");
45 }
46 
47 Real
49 {
50  if (_field_type == "long")
51  {
54  return -1.0;
55  else
56  return value;
57  }
58  else
60 }
ElementUOAux(const InputParameters &params)
Definition: ElementUOAux.C:35
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
static InputParameters validParams()
Definition: ElementUOAux.C:16
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual Real computeValue() override
Compute and return the value of the aux variable.
Definition: ElementUOAux.C:48
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const std::string _field_name
Definition: ElementUOAux.h:32
registerMooseObject("MooseApp", ElementUOAux)
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...
auto max(const L &left, const R &right)
const ElementUOProvider & _elem_uo
Definition: ElementUOAux.h:31
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition: Moose.C:37
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
virtual const OutputTools< Real >::VariableValue & value()
The value of the variable this object is operating on.
User object intermediate base class that declares an interface for providing generic fields by name...
virtual Real getElementalValueReal(dof_id_type, const std::string &) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This AuxKernel retrieves values from a ElementUOProvider derived class and returns the reported spati...
Definition: ElementUOAux.h:21
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:267
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:204
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
const std::string _field_type
Definition: ElementUOAux.h:33
virtual unsigned long getElementalValueLong(dof_id_type, const std::string &) const
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:86