www.mooseframework.org
VariableGradientComponent.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 the gradient of a coupled variable.");
21  params.addRequiredCoupledVar("gradient_variable",
22  "The variable from which to compute the gradient component");
23  params.addParam<MooseEnum>("component", component, "The gradient component to compute");
24  return params;
25 }
26 
28  : AuxKernel(parameters),
29  _gradient(coupledGradient("gradient_variable")),
30  _component(getParam<MooseEnum>("component"))
31 {
32 }
33 
34 Real
36 {
37  return _gradient[_qp](_component);
38 }
int _component
Desired component.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
const VariableGradient & _gradient
Reference to the gradient of the coupled variable.
virtual Real computeValue() override
Compute and return the value of the aux variable.
registerMooseObject("MooseApp", VariableGradientComponent)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Extract a component from the gradient of a variable.
VariableGradientComponent(const InputParameters &parameters)
Class constructor.
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 option 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
static InputParameters validParams()