www.mooseframework.org
VariableGradientComponent.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
15 
16 template <>
19 {
20  MooseEnum component("x=0 y=1 z=2");
22  params.addClassDescription(
23  "Creates a field with consisting of one component of a coupled variable.");
24  params.addRequiredCoupledVar("gradient_variable",
25  "The variable from which to compute the gradient component");
26  params.addParam<MooseEnum>("component", component, "The gradient component to compute");
27  return params;
28 }
29 
31  : AuxKernel(parameters),
32  _gradient(coupledGradient("gradient_variable")),
33  _component(getParam<MooseEnum>("component"))
34 {
35 }
36 
37 Real
39 {
40  return _gradient[_qp](_component);
41 }
int _component
Desired component.
InputParameters validParams< VariableGradientComponent >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< AuxKernel >()
Definition: AuxKernel.C:30
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:192
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:51
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
VariableGradientComponent(const InputParameters &parameters)
Class constructor.
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...