13 #include "libmesh/nonlinear_solver.h" 23 params.
addCoupledVar(
"v",
"The velocity in the y direction.");
24 params.
addCoupledVar(
"w",
"The velocity in the z direction.");
25 params.
addParam<MooseFunctorName>(
"k",
"Turbulent kinetic energy functor.");
29 params.
addParam<std::vector<BoundaryName>>(
30 "walls", {},
"Boundaries that correspond to solid walls.");
31 MooseEnum wall_treatment(
"eq_newton eq_incremental eq_linearized neq",
"neq");
34 "The method used for computing the y_plus in the wall functions " 35 "'eq_newton', 'eq_incremental', 'eq_linearized', 'neq'");
36 params.
addParam<
Real>(
"C_mu", 0.09,
"Coupled turbulent kinetic energy closure coefficient.");
43 _dim(_subproblem.
mesh().dimension()),
44 _u_var(getFunctor<
Real>(
"u")),
45 _v_var(params.isParamValid(
"v") ? &(getFunctor<
Real>(
"v")) : nullptr),
46 _w_var(params.isParamValid(
"w") ? &(getFunctor<
Real>(
"w")) : nullptr),
47 _k(params.isParamValid(
NS::
TKE) ? &(getFunctor<
Real>(
NS::
TKE)) : nullptr),
50 _wall_boundary_names(getParam<
std::vector<BoundaryName>>(
"walls")),
52 _C_mu(getParam<
Real>(
"C_mu"))
55 paramError(
"v",
"In two or more dimensions, the v velocity must be supplied!");
58 paramError(
"w",
"In three or more dimensions, the w velocity must be supplied!");
61 paramError(
NS::TKE,
"In the non-equilibrium wall treatment the TKE must be supplied!");
81 const auto rho =
_rho(elem_arg, state);
82 const auto mu =
_mu(elem_arg, state);
84 std::vector<Real> y_plus_vec;
88 velocity(1) = (*_v_var)(elem_arg, state);
90 velocity(2) = (*_w_var)(elem_arg, state);
95 for (
unsigned int i = 0; i < distance_vec.size(); i++)
98 velocity -
velocity * face_info_vec[i]->normal() * face_info_vec[i]->normal());
99 const auto distance = distance_vec[i];
108 y_plus_vec.push_back(y_plus);
111 return std::accumulate(y_plus_vec.begin(), y_plus_vec.end(), 0.0) / y_plus_vec.size();
Computes wall y+ based on wall functions.
const Real _C_mu
C_mu constant.
Moose::StateArg determineState() const
const unsigned int _dim
the dimension of the simulation
static const std::string density
static const std::string TKE
WallTreatmentEnum
Wall treatment options.
const Moose::Functor< Real > & _rho
Density.
NS::WallTreatmentEnum _wall_treatment
Method used for wall treatment.
const Moose::Functor< Real > & _mu
Dynamic viscosity.
void getWallBoundedElements(const std::vector< BoundaryName > &wall_boundary_name, const FEProblemBase &fe_problem, const SubProblem &subproblem, const std::set< SubdomainID > &block_ids, std::unordered_set< const Elem *> &wall_bounded)
Map marking wall bounded elements The map passed in wall_bounded_map gets cleared and re-populated...
virtual const std::set< SubdomainID > & blockIDs() const
std::unordered_set< const Elem * > _wall_bounded
Real distance(const Point &p)
FEProblemBase & _c_fe_problem
const Moose::Functor< Real > * _v_var
y-velocity
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
template Real findyPlus< Real >(const Real &mu, const Real &rho, const Real &u, Real dist)
virtual Real computeValue() override
const Moose::Functor< Real > * _w_var
z-velocity
const Moose::Functor< Real > * _k
Turbulent kinetic energy.
static const std::string mu
std::map< const Elem *, std::vector< Real > > _dist
registerMooseObject("NavierStokesApp", RANSYPlusAux)
void paramError(const std::string ¶m, Args... args) const
void getWallDistance(const std::vector< BoundaryName > &wall_boundary_name, const FEProblemBase &fe_problem, const SubProblem &subproblem, const std::set< SubdomainID > &block_ids, std::map< const Elem *, std::vector< Real >> &dist_map)
Map storing wall ditance for near-wall marked elements The map passed in dist_map gets cleared and re...
std::map< const Elem *, std::vector< const FaceInfo * > > _face_infos
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RANSYPlusAux(const InputParameters ¶meters)
const Elem *const & _current_elem
const std::vector< BoundaryName > & _wall_boundary_names
Wall boundary names.
void getElementFaceArgs(const std::vector< BoundaryName > &wall_boundary_name, const FEProblemBase &fe_problem, const SubProblem &subproblem, const std::set< SubdomainID > &block_ids, std::map< const Elem *, std::vector< const FaceInfo *>> &face_info_map)
Map storing face arguments to wall bounded faces The map passed in face_info_map gets cleared and re-...
static InputParameters validParams()
static const std::string velocity
template Real computeSpeed< Real >(const libMesh::VectorValue< Real > &velocity)
const Moose::Functor< Real > & _u_var
x-velocity
virtual void initialSetup() override
MooseUnits pow(const MooseUnits &, int)