https://mooseframework.inl.gov
PecletNumberFunctorAux.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 #include "PecletNumberFunctorAux.h"
11 #include "MooseMesh.h"
12 #include "NS.h"
13 
15 
18 {
20  params.addClassDescription("Computes the Peclet number: u*L/alpha.");
21  params.addRequiredParam<MooseFunctorName>(NS::speed, "The fluid speed");
22  params.addRequiredParam<MooseFunctorName>(
24  "The fluid thermal diffusivity, or if using this object for evaluating mass transfer, the "
25  "mass diffusivity. Regardless of which, this should have units of length^2/time");
26  return params;
27 }
28 
30  : AuxKernel(parameters),
31  _speed(getFunctor<ADReal>(NS::speed)),
32  _alpha(getFunctor<ADReal>(NS::thermal_diffusivity)),
33  _use_qp_arg(dynamic_cast<MooseVariableFE<Real> *>(&_var))
34 {
35  if (!_use_qp_arg && !dynamic_cast<MooseVariableFV<Real> *>(&_var))
36  paramError(
37  "variable",
38  "The variable must be a non-vector, non-array finite-volume/finite-element variable.");
39 
40  if (isNodal())
41  mooseError("This AuxKernel only supports Elemental fields");
42 }
43 
44 Real
46 {
48  const auto state = determineState();
49 
50  if (_use_qp_arg)
51  {
52  const Moose::ElemQpArg qp_arg = {_current_elem, _qp, _qrule, _q_point[_qp]};
53  return _current_elem->hmax() * raw_value(_speed(qp_arg, state)) /
54  raw_value(_alpha(qp_arg, state));
55  }
56  else
57  {
58  const auto elem_arg = makeElemArg(_current_elem);
59  return _current_elem->hmax() * raw_value(_speed(elem_arg, state)) /
60  raw_value(_alpha(elem_arg, state));
61  }
62 }
static const std::string speed
Definition: NS.h:143
const Moose::Functor< ADReal > & _alpha
The fluid thermal diffusivity or mass diffusivity. Should have units of length^2/time.
Moose::StateArg determineState() const
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
PecletNumberFunctorAux(const InputParameters &parameters)
void paramError(const std::string &param, Args... args) const
Computes u*L/alpha where L is the maximum element dimension.
MooseVariableField< Real > & _var
static const std::string thermal_diffusivity
Definition: NS.h:133
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
registerMooseObject("NavierStokesApp", PecletNumberFunctorAux)
void mooseError(Args &&... args) const
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
const bool _use_qp_arg
Whether to use a quadrature-based argument to evaluate the functors.
static InputParameters validParams()
const MooseArray< Point > & _q_point
const Moose::Functor< ADReal > & _speed
The fluid speed.