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");
44 if (
_var.
feType() != FEType(CONSTANT, MONOMIAL))
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;
75 for (dof_id_type elem_id : bnd_elems)
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);
90 const auto delta =
_delta(elem_arg, state_arg);
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;
boundary_id_type BoundaryID
registerMooseObject("NavierStokesApp", WallDistanceMixingLengthAux)
const MooseArray< Point > & _q_point
const Elem *const & _current_elem
MooseVariableField< ComputeValueType > & _var
static InputParameters validParams()
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
unsigned int sideWithBoundaryID(const Elem *const elem, const BoundaryID boundary_id) const
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToActiveSemiLocalElemIds() const
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
const libMesh::FEType & feType() const
virtual MooseMesh & mesh()=0
WallDistanceMixingLengthAux(const InputParameters ¶meters)
const Moose::Functor< Real > & _von_karman_const_0
virtual Real computeValue()
static InputParameters validParams()
const Moose::Functor< Real > & _von_karman_const
const std::vector< BoundaryName > & _wall_boundary_names
const Moose::Functor< Real > & _delta
Real distance(const Point &p)