www.mooseframework.org
VectorMagnitudeAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
17 
20 {
22  params.addClassDescription("Creates a field representing the magnitude of three coupled "
23  "variables using an Euclidean norm.");
24  params.addRequiredCoupledVar("x", "x-component of the vector");
25  params.addCoupledVar("y", "y-component of the vector");
26  params.addCoupledVar("z", "z-component of the vector");
27 
28  return params;
29 }
30 
32  : AuxKernel(parameters),
33  _x(coupledValue("x")),
34  _y(_mesh.dimension() >= 2 ? coupledValue("y") : _zero),
35  _z(_mesh.dimension() >= 3 ? coupledValue("z") : _zero)
36 {
37 }
38 
39 Real
41 {
42  return std::sqrt((_x[_qp] * _x[_qp]) + (_y[_qp] * _y[_qp]) + (_z[_qp] * _z[_qp]));
43 }
InputParameters::addRequiredCoupledVar
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
Definition: InputParameters.C:216
MooseMesh.h
VectorMagnitudeAux::VectorMagnitudeAux
VectorMagnitudeAux(const InputParameters &parameters)
Definition: VectorMagnitudeAux.C:31
VectorMagnitudeAux
Computes the magnitude of a vector whose components are given by up to three coupled variables.
Definition: VectorMagnitudeAux.h:23
VectorMagnitudeAux::validParams
static InputParameters validParams()
Definition: VectorMagnitudeAux.C:19
VectorMagnitudeAux::_z
const VariableValue & _z
Definition: VectorMagnitudeAux.h:35
AuxKernelTempl
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:35
registerMooseObject
registerMooseObject("MooseApp", VectorMagnitudeAux)
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
VectorMagnitudeAux::_y
const VariableValue & _y
Definition: VectorMagnitudeAux.h:34
InputParameters::addClassDescription
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.
Definition: InputParameters.C:70
AuxKernelTempl::validParams
static InputParameters validParams()
Definition: AuxKernel.C:28
InputParameters::addCoupledVar
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
Definition: InputParameters.C:183
VectorMagnitudeAux::computeValue
virtual Real computeValue() override
Compute and return the value of the aux variable.
Definition: VectorMagnitudeAux.C:40
VectorMagnitudeAux::_x
const VariableValue & _x
Definition: VectorMagnitudeAux.h:33
VectorMagnitudeAux.h
defineLegacyParams
defineLegacyParams(VectorMagnitudeAux)
AuxKernelTempl::_qp
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:227