21 params.addRequiredParam<MooseFunctorName>(
"u",
"The x-component of velocity");
22 params.addParam<MooseFunctorName>(
"v", 0,
"The y-component of velocity");
23 params.addParam<MooseFunctorName>(
"w", 0,
"The z-component of velocity");
24 params.addRequiredParam<MooseFunctorName>(
NS::porosity,
"The porosity");
25 params.addRequiredParam<MooseFunctorName>(
NS::density,
"The density");
26 params.addParam<std::vector<BoundaryName>>(
27 "pressure_drop_sidesets", {},
"Sidesets over which form loss coefficients are to be applied");
28 params.addParam<std::vector<Real>>(
29 "pressure_drop_form_factors",
31 "User-supplied form loss coefficients to be applied over the sidesets listed above");
32 params.addParam<
bool>(
33 "allow_two_term_expansion_on_bernoulli_faces",
35 "Switch to enable the two-term extrapolation on porosity jump faces. " 36 "WARNING: This might lead to crushes in parallel runs if porosity jump faces are connected " 37 "with one cell (usually corners) due to the insufficient number of ghosted " 43 params.addRelationshipManager(
44 "ElementSideNeighborLayers",
48 { rm_params.
set<
unsigned short>(
"layers") = 3; });
60 _pressure_drop_sidesets(getParam<
std::vector<BoundaryName>>(
"pressure_drop_sidesets")),
61 _pressure_drop_sideset_ids(this->_mesh.
getBoundaryIDs(_pressure_drop_sidesets)),
62 _pressure_drop_form_factors(getParam<
std::vector<
Real>>(
"pressure_drop_form_factors")),
63 _allow_two_term_expansion_on_bernoulli_faces(
64 getParam<bool>(
"allow_two_term_expansion_on_bernoulli_faces"))
69 "allow_two_term_expansion_on_bernoulli_faces",
70 "Skewness correction with two term extrapolation on Bernoulli faces is not supported!");
74 "The number of sidesets and the number of supplied form losses are not equal!");
89 std::pair<bool, ADRealVectorValue>
97 const VectorValue<ADReal> vel_face{(*_u)(face, time), (*
_v)(face, time), (*
_w)(face, time)};
98 const bool fi_elem_is_upwind = vel_face * fi.
normal() > 0;
99 const bool elem_is_upwind = &elem == &fi.
elem() ? fi_elem_is_upwind : !fi_elem_is_upwind;
101 return {elem_is_upwind, vel_face};
106 const Elem *
const elem,
127 const Elem *
const elem,
148 const Elem *
const elem,
158 mooseAssert(is_jump_face,
159 "If we are not a traditional Dirichlet face, then we must be a jump face");
169 const auto [elem_is_upwind, vel_face] =
elemIsUpwind(*elem, fi, time);
171 const bool fi_elem_is_upwind = elem == &fi.
elem() ? elem_is_upwind : !elem_is_upwind;
172 const auto & downwind_face = fi_elem_is_upwind ? face_neighbor : face_elem;
177 const auto & vel_upwind = vel_face;
178 const auto & vel_downwind = vel_face;
180 const auto & eps_upwind = fi_elem_is_upwind ? eps_elem : eps_neighbor;
181 const auto & eps_downwind = fi_elem_is_upwind ? eps_neighbor : eps_elem;
190 const auto & rho_upwind = (*_rho)(upwind_elem, time);
191 const auto & rho_downwind = (*_rho)(downwind_elem, time);
193 const VectorValue<ADReal> interstitial_vel_upwind = vel_upwind * (1 / eps_upwind);
194 const VectorValue<ADReal> interstitial_vel_downwind = vel_downwind * (1 / eps_downwind);
196 const auto v_dot_n_upwind = interstitial_vel_upwind * fi.
normal();
197 const auto v_dot_n_downwind = interstitial_vel_downwind * fi.
normal();
207 auto upwind_bernoulli_vel_chunk = 0.5 * rho_upwind * v_dot_n_upwind * v_dot_n_upwind;
208 auto downwind_bernoulli_vel_chunk = 0.5 * rho_downwind * v_dot_n_downwind * v_dot_n_downwind;
212 if (eps_downwind < eps_upwind)
213 downwind_bernoulli_vel_chunk +=
214 0.5 * factor * rho_downwind * v_dot_n_downwind * v_dot_n_downwind;
216 upwind_bernoulli_vel_chunk += -0.5 * factor * rho_upwind * v_dot_n_upwind * v_dot_n_upwind;
220 p_downwind = (*this)(downwind_face, time);
222 p_downwind = (*this)(downwind_elem, time);
224 return p_downwind + downwind_bernoulli_vel_chunk - upwind_bernoulli_vel_chunk;
const Moose::Functor< ADReal > * _eps
The porosity.
const std::vector< BoundaryID > _pressure_drop_sideset_ids
The boundary IDs corresponding to the form loss sidesets.
Moose::FV::InterpMethod _face_interp_method
BernoulliPressureVariable(const InputParameters ¶ms)
const Moose::Functor< ADReal > * _rho
The density.
const std::set< BoundaryID > & boundaryIDs() const
const Elem & elem() const
std::tuple< bool, ADReal, ADReal > isPorosityJumpFace(const Moose::Functor< ADReal > &porosity, const FaceInfo &fi, const Moose::StateArg &time)
Checks to see whether the porosity value jumps from one side to the other of the provided face...
static InputParameters validParams()
static const std::string density
bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
static InputParameters validParams()
const Moose::Functor< ADReal > * _v
The y-component of velocity.
std::vector< Real > _pressure_drop_form_factors
The form loss coefficients corresponding to the sidesets.
DualNumber< Real, DNDerivativeType, true > ADReal
bool isSeparatorBoundary(const FaceInfo &fi) const
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
static const std::string porosity
bool isInternalFace(const FaceInfo &) const
void libmesh_ignore(const Args &...)
const Moose::Functor< ADReal > * _u
The x-component of velocity.
virtual void initialSetup() override
const Elem * neighborPtr() const
ADReal getDirichletBoundaryFaceValue(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
const Moose::Functor< ADReal > * _w
The z-component of velocity.
registerMooseObject("NavierStokesApp", BernoulliPressureVariable)
const bool _allow_two_term_expansion_on_bernoulli_faces
Switch to enable the two-term extrapolation on porosity jump faces.
std::vector< BoundaryID > getBoundaryIDs(const libMesh::MeshBase &mesh, const std::vector< BoundaryName > &boundary_name, bool generate_unknown, const std::set< BoundaryID > &mesh_boundary_ids)
const Point & normal() const
void paramError(const std::string ¶m, Args... args) const
std::pair< bool, ADRealVectorValue > elemIsUpwind(const Elem &elem, const FaceInfo &fi, const Moose::StateArg &time) const
Checks to see whether the provided element is upwind of the provided face.
const Elem * elemPtr() const
A special variable class for pressure which flags faces at which porosity jumps occur as extrapolated...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void initialSetup() override
virtual ADReal getDirichletBoundaryFaceValue(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
std::vector< BoundaryName > _pressure_drop_sidesets
The names of the sidesets which will have associated form loss coefficients.
static InputParameters validParams()
auto index_range(const T &sizable)