20 params.addClassDescription(
21 "Provides Bernoulli and form-loss pressure jumps to PorousRhieChowMassFlux.");
22 params.addRequiredParam<MooseFunctorName>(
"porosity",
"The porosity functor.");
23 params.addRequiredParam<MooseFunctorName>(
"density",
"The density functor.");
24 params.addParam<std::vector<Real>>(
25 "form_loss", {},
"Form-loss coefficients for each pressure-jump boundaries.");
26 MultiMooseEnum reference_velocity_side(
"lower_porosity higher_porosity");
28 "reference_velocity_side",
29 reference_velocity_side,
30 "Reference-velocity sides for each the pressure-jump boundaries. The default is "
37 _porosity(getFunctor<Real>(
"porosity")),
38 _density(getFunctor<Real>(
"density"))
40 const auto & boundary_names = getParam<std::vector<BoundaryName>>(
"boundary");
41 const auto & form_loss = getParam<std::vector<Real>>(
"form_loss");
42 const auto & reference_velocity_side = getParam<MultiMooseEnum>(
"reference_velocity_side");
44 if (!form_loss.empty() && form_loss.size() != boundary_names.size())
45 paramError(
"form_loss",
"Must have the same length as boundary.");
47 reference_velocity_side.size() != boundary_names.size())
48 paramError(
"reference_velocity_side",
"Must have the same length as boundary.");
50 paramError(
"reference_velocity_side",
"Requires form_loss to be provided.");
52 for (
const auto value : form_loss)
54 paramError(
"form_loss",
"All entries must be >= 0.");
56 for (
const auto i : index_range(boundary_names))
61 ? reference_velocity_side[i] ==
"higher_porosity"
68 const Real face_mass_flux)
const
70 mooseAssert(
appliesTo(fi),
"The pressure jump model must apply to the supplied face.");
71 mooseAssert(fi.
neighborPtr(),
"A pressure jump requires an internal face.");
79 if (elem_rho <= 0.0 || neighbor_rho <= 0.0)
80 mooseError(
"density must be positive on pressure-jump face ", fi.
id(),
".");
83 mooseAssert(elem_porosity > 0.0 && neighbor_porosity > 0.0,
84 "Porosity must be positive on pressure-jump face " + std::to_string(fi.
id()) +
".");
88 Moose::FV::InterpMethod::Average, face_rho, elem_rho, neighbor_rho, fi,
true);
91 const Real porosity_owner = elem_is_owner ? elem_porosity : neighbor_porosity;
92 const Real porosity_non_owner = elem_is_owner ? neighbor_porosity : elem_porosity;
97 const Real superficial_velocity = face_mass_flux / face_rho;
98 const Real velocity_owner = superficial_velocity / porosity_owner;
99 const Real velocity_non_owner = superficial_velocity / porosity_non_owner;
101 0.5 * face_rho * (velocity_owner * velocity_owner - velocity_non_owner * velocity_non_owner);
110 "Pressure-jump face " + std::to_string(fi.
id()) +
111 " lies on more than one boundary of this model.");
112 boundary_id = candidate_id;
116 if (form_loss > 0.0 && face_mass_flux != 0.0)
119 const bool use_elem = use_higher_porosity ? elem_porosity >= neighbor_porosity
120 : elem_porosity <= neighbor_porosity;
121 const Real reference_velocity =
122 superficial_velocity / (use_elem ? elem_porosity : neighbor_porosity);
123 const Real owner_to_non_owner_mass_flux = elem_is_owner ? face_mass_flux : -face_mass_flux;
124 const Real flow_sign = owner_to_non_owner_mass_flux > 0.0 ? 1.0 : -1.0;
126 flow_sign * 0.5 * form_loss * face_rho * reference_velocity * reference_velocity;
129 return pressure_jump;
boundary_id_type BoundaryID
const std::set< BoundaryID > & boundaryIDs() const
const Elem * neighborPtr() const
const Elem * elemPtr() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Interface for pressure-jump models evaluated by PorousRhieChowMassFlux.
MooseMesh & _moose_mesh
Mesh used to resolve boundary names and determine pressure-jump orientation.
const std::unordered_set< BoundaryID > & boundaryIDs() const
Boundary IDs handled by this model.
static InputParameters validParams()
Return the input parameters shared by pressure-jump models.
bool elemIsOwner(const FaceInfo &fi) const
Return whether the FaceInfo element is the oriented owner of the pressure jump.
bool appliesTo(const FaceInfo &fi) const
Return whether this model applies to a face.
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
const BoundaryID INVALID_BOUNDARY_ID