https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VectorMagnitudeAux.C
Go to the documentation of this file.
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
15
18{
20 params.addClassDescription("Creates a field representing the magnitude of three coupled "
21 "variables using an Euclidean norm.");
22 params.addRequiredCoupledVar("x", "x-component of the vector");
23 params.addCoupledVar("y", "y-component of the vector");
24 params.addCoupledVar("z", "z-component of the vector");
25
26 return params;
27}
28
30 : AuxKernel(parameters),
31 _x(coupledValue("x")),
32 _y(_mesh.dimension() >= 2 ? coupledValue("y") : _zero),
33 _z(_mesh.dimension() >= 3 ? coupledValue("z") : _zero)
34{
35}
36
37Real
39{
40 return std::sqrt((_x[_qp] * _x[_qp]) + (_y[_qp] * _y[_qp]) + (_z[_qp] * _z[_qp]));
41}
registerMooseObject("MooseApp", VectorMagnitudeAux)
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
static InputParameters validParams()
Definition AuxKernel.C:27
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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 addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
Computes the magnitude of a vector whose components are given by up to three coupled variables.
const VariableValue & _x
const VariableValue & _z
virtual Real computeValue() override
Compute and return the value of the aux variable.
VectorMagnitudeAux(const InputParameters &parameters)
const VariableValue & _y
static InputParameters validParams()