19 "Computes the turbulent mixing length by assuming that it is " 20 "proportional to the distance from the nearest wall. The mixing" 21 "length is capped at a distance proportional to inputted parameter delta.");
23 "Boundaries that correspond to solid walls.");
24 params.
addParam<MooseFunctorName>(
"von_karman_const", 0.41,
"");
25 params.
addParam<MooseFunctorName>(
"von_karman_const_0", 0.09,
"");
36 _wall_boundary_names(getParam<
std::vector<BoundaryName>>(
"walls")),
37 _von_karman_const(getFunctor<
Real>(
"von_karman_const")),
38 _von_karman_const_0(getFunctor<
Real>(
"von_karman_const_0")),
39 _delta(getFunctor<
Real>(
"delta"))
42 if (!
mesh.is_replicated())
43 mooseError(
"WallDistanceMixingLengthAux only supports replicated meshes");
48 "' computes the distance from the closest wall to an approximation of the element " 49 "centroid; only a single dof is required to hold this value. Consequently users " 50 "should always use a constant monomial finite element type (this is what finite " 51 "volume variables implicitly use) for the auxiliary variables.");
69 auto search = bnd_to_elem_map.find(bid);
70 if (search == bnd_to_elem_map.end())
71 mooseError(
"Error computing wall distance; the boundary id ", bid,
" is invalid");
72 const auto & bnd_elems = search->second;
77 const Elem & elem = l_mesh.elem_ref(elem_id);
79 const auto bnd_pos = elem.side_ptr(side)->vertex_average();
82 mooseAssert(dist2 != 0,
"This distance should never be 0");
83 min_dist2 = std::min(min_dist2, dist2);
94 if (std::sqrt(min_dist2) /
delta <= von_karman_const_0 / von_karman_const)
95 return von_karman_const * std::sqrt(min_dist2);
97 return von_karman_const_0 *
delta;
virtual MooseMesh & mesh()=0
const libMesh::FEType & feType() const
const std::vector< BoundaryName > & _wall_boundary_names
const Moose::Functor< Real > & _von_karman_const_0
void paramError(const std::string ¶m, Args... args) const
static InputParameters validParams()
int delta(unsigned int i, unsigned int j)
Delta function, which returns zero if $i j$ and unity if $i=j$.
virtual Real computeValue()
Real distance(const Point &p)
const Moose::Functor< Real > & _von_karman_const
const std::string & name() const
WallDistanceMixingLengthAux(const InputParameters ¶meters)
boundary_id_type BoundaryID
unsigned int sideWithBoundaryID(const Elem *const elem, const BoundaryID boundary_id) const
MooseVariableField< Real > & _var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("NavierStokesApp", WallDistanceMixingLengthAux)
void mooseError(Args &&... args) const
const Elem *const & _current_elem
static InputParameters validParams()
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
const Moose::Functor< Real > & _delta
const MooseArray< Point > & _q_point
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToActiveSemiLocalElemIds() const