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",
45 Moose::RelationshipManagerType::GEOMETRIC | Moose::RelationshipManagerType::ALGEBRAIC |
46 Moose::RelationshipManagerType::COUPLING,
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!");
89std::pair<bool, ADRealVectorValue>
95 &fi, Moose::FV::LimiterType::CentralDifference,
true,
false,
nullptr,
nullptr};
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");
161 libmesh_ignore(is_jump_face);
165 &fi, Moose::FV::LimiterType::CentralDifference,
true,
false, &fi.
elem(),
nullptr};
167 &fi, Moose::FV::LimiterType::CentralDifference,
true,
false, fi.
neighborPtr(),
nullptr};
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;
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", BernoulliPressureVariable)
static InputParameters validParams()
A special variable class for pressure which flags faces at which porosity jumps occur as extrapolated...
ADReal getDirichletBoundaryFaceValue(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
const Moose::Functor< ADReal > * _eps
The porosity.
bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
const Moose::Functor< ADReal > * _rho
The density.
std::vector< Real > _pressure_drop_form_factors
The form loss coefficients corresponding to the sidesets.
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.
std::vector< BoundaryName > _pressure_drop_sidesets
The names of the sidesets which will have associated form loss coefficients.
const Moose::Functor< ADReal > * _v
The y-component of velocity.
const Moose::Functor< ADReal > * _w
The z-component of velocity.
const bool _allow_two_term_expansion_on_bernoulli_faces
Switch to enable the two-term extrapolation on porosity jump faces.
BernoulliPressureVariable(const InputParameters ¶ms)
static InputParameters validParams()
const Moose::Functor< ADReal > * _u
The x-component of velocity.
const std::vector< BoundaryID > _pressure_drop_sideset_ids
The boundary IDs corresponding to the form loss sidesets.
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &time) const override
void initialSetup() override
const Point & normal() const
const std::set< BoundaryID > & boundaryIDs() const
const Elem & elem() const
const Elem * neighborPtr() const
const Elem * elemPtr() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
static InputParameters validParams()
bool isSeparatorBoundary(const FaceInfo &fi) const
void paramError(const std::string ¶m, Args... args) const
void initialSetup() override
Moose::FV::InterpMethod _face_interp_method
virtual bool isDirichletBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
virtual ADReal getDirichletBoundaryFaceValue(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const
bool isInternalFace(const FaceInfo &) const
static const std::string density
std::tuple< bool, T, T > isPorosityJumpFace(const Moose::FunctorBase< T > &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 const std::string porosity