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 "VectorVariableComponentAux.h" 11 : 12 : registerMooseObject("MooseApp", VectorVariableComponentAux); 13 : 14 : InputParameters 15 14486 : VectorVariableComponentAux::validParams() 16 : { 17 14486 : MooseEnum component("x=0 y=1 z=2"); 18 14486 : InputParameters params = AuxKernel::validParams(); 19 14486 : params.addClassDescription( 20 : "Creates a field consisting of one component of a coupled vector variable."); 21 14486 : params.addRequiredCoupledVar("vector_variable", 22 : "The variable from which to compute the component"); 23 14486 : params.addParam<MooseEnum>("component", component, "The component to compute"); 24 28972 : return params; 25 14486 : } 26 : 27 115 : VectorVariableComponentAux::VectorVariableComponentAux(const InputParameters & parameters) 28 : : AuxKernel(parameters), 29 115 : _nodal_variable_value(_nodal ? &coupledNodalValue<RealVectorValue>("vector_variable") 30 : : nullptr), 31 115 : _elemental_variable_value(_nodal ? nullptr : &coupledVectorValue("vector_variable")), 32 230 : _component(getParam<MooseEnum>("component")) 33 : { 34 115 : } 35 : 36 : Real 37 21254 : VectorVariableComponentAux::computeValue() 38 : { 39 21254 : if (_nodal) 40 5184 : return (*_nodal_variable_value)(_component); 41 : else 42 16070 : return (*_elemental_variable_value)[_qp](_component); 43 : }