Line data Source code
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 "VariableGradientComponent.h" 11 : 12 : registerMooseObject("MooseApp", VariableGradientComponent); 13 : 14 : InputParameters 15 14365 : VariableGradientComponent::validParams() 16 : { 17 14365 : MooseEnum component("x=0 y=1 z=2"); 18 14365 : InputParameters params = AuxKernel::validParams(); 19 14365 : params.addClassDescription( 20 : "Creates a field consisting of one component of the gradient of a coupled variable."); 21 14365 : params.addRequiredCoupledVar("gradient_variable", 22 : "The variable from which to compute the gradient component"); 23 14365 : params.addParam<MooseEnum>("component", component, "The gradient component to compute"); 24 28730 : return params; 25 14365 : } 26 : 27 52 : VariableGradientComponent::VariableGradientComponent(const InputParameters & parameters) 28 : : AuxKernel(parameters), 29 52 : _gradient(coupledGradient("gradient_variable")), 30 104 : _component(getParam<MooseEnum>("component")) 31 : { 32 52 : } 33 : 34 : Real 35 105600 : VariableGradientComponent::computeValue() 36 : { 37 105600 : return _gradient[_qp](_component); 38 : }