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 : // MOOSE includes 11 : #include "VectorMagnitudeAux.h" 12 : #include "MooseMesh.h" 13 : 14 : registerMooseObject("MooseApp", VectorMagnitudeAux); 15 : 16 : InputParameters 17 14315 : VectorMagnitudeAux::validParams() 18 : { 19 14315 : InputParameters params = AuxKernel::validParams(); 20 14315 : params.addClassDescription("Creates a field representing the magnitude of three coupled " 21 : "variables using an Euclidean norm."); 22 14315 : params.addRequiredCoupledVar("x", "x-component of the vector"); 23 14315 : params.addCoupledVar("y", "y-component of the vector"); 24 14315 : params.addCoupledVar("z", "z-component of the vector"); 25 : 26 14315 : return params; 27 0 : } 28 : 29 26 : VectorMagnitudeAux::VectorMagnitudeAux(const InputParameters & parameters) 30 : : AuxKernel(parameters), 31 26 : _x(coupledValue("x")), 32 26 : _y(_mesh.dimension() >= 2 ? coupledValue("y") : _zero), 33 52 : _z(_mesh.dimension() >= 3 ? coupledValue("z") : _zero) 34 : { 35 26 : } 36 : 37 : Real 38 2287 : VectorMagnitudeAux::computeValue() 39 : { 40 2287 : return std::sqrt((_x[_qp] * _x[_qp]) + (_y[_qp] * _y[_qp]) + (_z[_qp] * _z[_qp])); 41 : }