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 : #include "ReynoldsNumberFunctorAux.h" 11 : #include "MooseMesh.h" 12 : #include "NS.h" 13 : 14 : registerMooseObject("NavierStokesApp", ReynoldsNumberFunctorAux); 15 : 16 : InputParameters 17 82 : ReynoldsNumberFunctorAux::validParams() 18 : { 19 82 : InputParameters params = AuxKernel::validParams(); 20 82 : params.addClassDescription("Computes rho*u*L/mu."); 21 82 : params.addRequiredParam<MooseFunctorName>(NS::speed, "The fluid speed"); 22 82 : params.addRequiredParam<MooseFunctorName>(NS::density, "The fluid density"); 23 82 : params.addRequiredParam<MooseFunctorName>(NS::mu, "The fluid dynamic viscosity"); 24 82 : return params; 25 0 : } 26 : 27 44 : ReynoldsNumberFunctorAux::ReynoldsNumberFunctorAux(const InputParameters & parameters) 28 : : AuxKernel(parameters), 29 44 : _speed(getFunctor<Real>(NS::speed)), 30 44 : _rho(getFunctor<Real>(NS::density)), 31 44 : _mu(getFunctor<Real>(NS::mu)), 32 88 : _use_qp_arg(dynamic_cast<MooseVariableFE<Real> *>(&_var)) 33 : { 34 44 : if (!_use_qp_arg && !dynamic_cast<MooseVariableFV<Real> *>(&_var)) 35 0 : paramError( 36 : "variable", 37 : "The variable must be a non-vector, non-array finite-volume/finite-element variable."); 38 : 39 44 : if (isNodal()) 40 0 : mooseError("This AuxKernel only supports Elemental fields"); 41 44 : } 42 : 43 : Real 44 22500 : ReynoldsNumberFunctorAux::computeValue() 45 : { 46 : using MetaPhysicL::raw_value; 47 22500 : const auto state = determineState(); 48 : 49 22500 : if (_use_qp_arg) 50 : { 51 18000 : const Moose::ElemQpArg qp_arg = {_current_elem, _qp, _qrule, _q_point[_qp]}; 52 18000 : return _current_elem->hmax() * _rho(qp_arg, state) * _speed(qp_arg, state) / _mu(qp_arg, state); 53 : } 54 : else 55 : { 56 4500 : const auto elem_arg = makeElemArg(_current_elem); 57 4500 : return _current_elem->hmax() * _rho(elem_arg, state) * _speed(elem_arg, state) / 58 4500 : _mu(elem_arg, state); 59 : } 60 : }