20 "Adds a fixed diffusive flux BC which can be used for the assembly of linear " 21 "finite volume system and whose normal face gradient values are determined " 22 "using the H/A flux and a prescribed boundary velocity. This boundary condition is only " 23 "designed to work with advection-diffusion problems.");
24 params.
addRequiredParam<MooseFunctorName>(
"HbyA_flux",
"The total HbyA face flux value.");
26 "Ainv",
"The 1/A where A is the momentum system diagonal vector.");
28 "use_two_term_expansion",
30 "Whether to reconstruct the boundary pressure using the pressure flux and cell gradient. If " 31 "false, the boundary pressure is approximated by the adjacent cell pressure.");
32 params.
addRequiredParam<MooseFunctorName>(
"u",
"The x-velocity functor on the boundary.");
33 params.
addParam<MooseFunctorName>(
"v",
"The y-velocity functor on the boundary.");
34 params.
addParam<MooseFunctorName>(
"w",
"The z-velocity functor on the boundary.");
36 NS::density,
"The density functor used together with the prescribed boundary velocity.");
42 _HbyA_flux(getFunctor<
Real>(
"HbyA_flux")),
44 _dim(_subproblem.
mesh().dimension()),
45 _two_term_expansion(getParam<bool>(
"use_two_term_expansion")),
46 _u(getFunctor<
Real>(
"u")),
47 _v(parameters.isParamValid(
"v") ? &getFunctor<
Real>(
"v") : nullptr),
48 _w(parameters.isParamValid(
"w") ? &getFunctor<
Real>(
"w") : nullptr),
52 paramError(
"v",
"The 'v' boundary velocity functor must be provided for 2D and 3D problems.");
55 paramError(
"w",
"The 'w' boundary velocity functor must be provided for 3D problems.");
58 paramError(
"v",
"The 'v' boundary velocity functor is only valid in 2D and 3D problems.");
61 paramError(
"w",
"The 'w' boundary velocity functor is only valid in 3D problems.");
75 Real boundary_velocity_dot_normal =
_u(face_arg, state) * normal(0);
78 boundary_velocity_dot_normal += (*_v)(face_arg, state) * normal(1);
81 boundary_velocity_dot_normal += (*_w)(face_arg, state) * normal(2);
85 const Real boundary_normal_multiplier =
87 required_pressure_flux +=
88 _rho(face_arg, state) * boundary_normal_multiplier * boundary_velocity_dot_normal;
90 return required_pressure_flux;
102 Real normal_ainv = 0.0;
104 normal_ainv += normal(i) * normal(i) * face_ainv(i);
106 if (normal_ainv < 0.0)
107 mooseError(
"The boundary-normal Ainv coefficient must be nonnegative, but its value is ",
130 if (normal_ainv == 0.0)
136 const auto tangential_cell_to_face = d_cf - (d_cf * face_normal) * face_normal;
140 _var.
gradSln(*elem_info, state) * tangential_cell_to_face;
150 if (normal_ainv == 0.0)
158 const Real boundary_normal_multiplier =
164 normal_scaled_ainv(i) = boundary_normal(i) * face_ainv(i);
168 const auto tangential_ainv = normal_scaled_ainv - normal_ainv * boundary_normal;
169 const Real tangential_pressure_flux = tangential_ainv *
_var.
gradSln(*elem_info, state);
RealVectorValue computeCellToFaceVector() const
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
const Moose::Functor< Real > & _rho
Density functor used with the prescribed boundary velocity.
Real computeCellToFaceDistance() const
Moose::StateArg determineState() const
const ElemInfo * neighborInfo() const
virtual Real computeBoundaryNormalGradient() const override
static const std::string density
const ElemInfo * elemInfo() const
Real distance(const Point &p)
const Moose::Functor< Real > *const _v
LinearFVPressureFluxBC(const InputParameters ¶meters)
Class constructor.
VectorValue< Real > gradSln(const ElemInfo &elem_info, const StateArg &state) const
const bool _two_term_expansion
Whether to reconstruct the boundary pressure with the pressure flux and cell gradient.
const Moose::Functor< RealVectorValue > & _Ainv
The functor for the 1/A tensor serving as a diffusion coefficient.
FaceInfo::VarFaceNeighbors _current_face_type
Class implementing a flux boundary condition for linear finite volume pressure variables used in the ...
const Point & normal() const
Real computeRequiredPressureFlux() const
Compute the required boundary pressure flux contribution.
Real computeBoundaryAinv() const
Compute the scalar A^{-1} coefficient, which is zero before the first momentum assembly.
MooseLinearVariableFV< Real > & _var
const unsigned short _dim
Spatial dimension of the mesh.
registerMooseObject("NavierStokesApp", LinearFVPressureFluxBC)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeBoundaryValueRHSContribution() const override
const Moose::Functor< Real > *const _w
const FaceInfo * _current_face_info
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
virtual Real computeBoundaryGradientMatrixContribution() const override
const Moose::Functor< Real > & _u
Velocity functors used to prescribe a boundary mass flux.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
virtual Real computeBoundaryValueMatrixContribution() const override
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
virtual Real computeBoundaryGradientRHSContribution() const override
virtual Real computeBoundaryValue() const override
void computeCellGradients()
static InputParameters validParams()
const Moose::Functor< Real > & _HbyA_flux
The H/A flux functor for this BC (can be variable, function, etc)