https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReynoldsNumberFunctorAux.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
11#include "MooseMesh.h"
12#include "NS.h"
13
15
18{
20 params.addClassDescription("Computes rho*u*L/mu.");
21 params.addRequiredParam<MooseFunctorName>(NS::speed, "The fluid speed");
22 params.addRequiredParam<MooseFunctorName>(NS::density, "The fluid density");
23 params.addRequiredParam<MooseFunctorName>(NS::mu, "The fluid dynamic viscosity");
24 return params;
25}
26
28 : AuxKernel(parameters),
29 _speed(getFunctor<Real>(NS::speed)),
30 _rho(getFunctor<Real>(NS::density)),
31 _mu(getFunctor<Real>(NS::mu)),
32 _use_qp_arg(dynamic_cast<MooseVariableFE<Real> *>(&_var))
33{
34 if (!_use_qp_arg && !dynamic_cast<MooseVariableFV<Real> *>(&_var))
36 "variable",
37 "The variable must be a non-vector, non-array finite-volume/finite-element variable.");
38
39 if (isNodal())
40 mooseError("This AuxKernel only supports Elemental fields");
41}
42
43Real
45{
47 const auto state = determineState();
48
49 if (_use_qp_arg)
50 {
52 return _current_elem->hmax() * _rho(qp_arg, state) * _speed(qp_arg, state) / _mu(qp_arg, state);
53 }
54 else
55 {
56 const auto elem_arg = makeElemArg(_current_elem);
57 return _current_elem->hmax() * _rho(elem_arg, state) * _speed(elem_arg, state) /
58 _mu(elem_arg, state);
59 }
60}
const double mu
registerMooseObject("NavierStokesApp", ReynoldsNumberFunctorAux)
const MooseArray< Point > & _q_point
const Elem *const & _current_elem
MooseVariableField< ComputeValueType > & _var
const QBase *const & _qrule
static InputParameters validParams()
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
Computes rho*u*L/mu where L is the maximum element dimension.
ReynoldsNumberFunctorAux(const InputParameters &parameters)
const Moose::Functor< Real > & _rho
The fluid density.
const Moose::Functor< Real > & _speed
The fluid speed.
const bool _use_qp_arg
Whether to use a quadrature-based argument to evaluate the functors.
const Moose::Functor< Real > & _mu
The fluid dynamic viscosity.
static InputParameters validParams()
Moose::StateArg determineState() const
auto raw_value(const Eigen::Map< T > &in)
static const std::string density
Definition NS.h:34
static const std::string mu
Definition NS.h:127
static const std::string speed
Definition NS.h:147