https://mooseframework.inl.gov
VectorVariableComponentAux.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 
13 
16 {
17  MooseEnum component("x=0 y=1 z=2");
19  params.addClassDescription(
20  "Creates a field consisting of one component of a coupled vector variable.");
21  params.addRequiredCoupledVar("vector_variable",
22  "The variable from which to compute the component");
23  params.addParam<MooseEnum>("component", component, "The component to compute");
24  return params;
25 }
26 
28  : AuxKernel(parameters),
29  _nodal_variable_value(_nodal ? &coupledNodalValue<RealVectorValue>("vector_variable")
30  : nullptr),
31  _elemental_variable_value(_nodal ? nullptr : &coupledVectorValue("vector_variable")),
32  _component(getParam<MooseEnum>("component"))
33 {
34 }
35 
36 Real
38 {
39  if (_nodal)
41  else
43 }
virtual Real computeValue() override
Compute and return the value of the aux variable.
bool _nodal
Flag indicating if the AuxKernel is nodal.
Definition: AuxKernel.h:177
const VectorVariableValue *const _elemental_variable_value
Pointer to elemental variable value.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const int _component
Desired component.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
const RealVectorValue *const _nodal_variable_value
Pointer to nodal variable value.
registerMooseObject("MooseApp", VectorVariableComponentAux)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Extract a component from a vector variable.
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:230
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
VectorVariableComponentAux(const InputParameters &parameters)
Class constructor.