https://mooseframework.inl.gov
INSFVInletIntensityTKEBC.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 
13 
16 {
18  params.addClassDescription("Adds inlet boudnary conditon for the turbulent kinetic energy based "
19  "on turbulent intensity.");
20  params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction.");
21  params.addParam<MooseFunctorName>("v", "The velocity in the y direction.");
22  params.addParam<MooseFunctorName>("w", "The velocity in the z direction.");
23  params.addRequiredParam<MooseFunctorName>("intensity", "Turbulent intensity.");
24  return params;
25 }
26 
28  : FVDirichletBCBase(params),
29  _u(getFunctor<ADReal>("u")),
30  _v(isParamValid("v") ? &getFunctor<ADReal>("v") : nullptr),
31  _w(isParamValid("w") ? &getFunctor<ADReal>("w") : nullptr),
32  _intensity(getFunctor<ADReal>("intensity")),
33  _dim(_subproblem.mesh().dimension())
34 {
35  if (_dim >= 2 && !_v)
36  mooseError(
37  "In two or more dimensions, the v velocity must be supplied using the 'v' parameter");
38  if (_dim >= 3 && !_w)
39  mooseError("In threedimensions, the w velocity must be supplied using the 'w' parameter");
40 }
41 
42 ADReal
44 {
45  const auto boundary_face = singleSidedFaceArg(&fi);
46 
47  ADRealVectorValue velocity(_u(boundary_face, state));
48  if (_v)
49  velocity(1) = (*_v)(boundary_face, state);
50  if (_w)
51  velocity(2) = (*_w)(boundary_face, state);
52 
53  const auto velocity_normal = fi.normal() * velocity;
54 
55  return 1.5 * Utility::pow<2>(_intensity(boundary_face, state) * velocity_normal);
56 }
const Moose::Functor< ADReal > & _u
x-velocity
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
MeshBase & mesh
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
const Moose::Functor< ADReal > *const _w
z-velocity
ADReal boundaryValue(const FaceInfo &fi, const Moose::StateArg &state) const override
static InputParameters validParams()
INSFVInletIntensityTKEBC(const InputParameters &params)
static InputParameters validParams()
const Moose::Functor< ADReal > *const _v
y-velocity
const Point & normal() const
registerMooseObject("NavierStokesApp", INSFVInletIntensityTKEBC)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const Moose::Functor< ADReal > & _intensity
turbulent intensity
static const std::string velocity
Definition: NS.h:45
const unsigned int _dim
the dimension of the domain
A class for turbulent kinetic energy inlet boundary conditions.