21 params.addClassDescription(
22 "Computes a correction term to avoid oscillations from average pressure interpolation in " 23 "regions of high changes in friction coefficients.");
24 params.addParam<MooseFunctorName>(
"Darcy_name",
"Name of the Darcy coefficients property.");
25 params.addParam<MooseFunctorName>(
"Forchheimer_name",
26 "Name of the Forchheimer coefficients property.");
27 params.addRequiredParam<MooseFunctorName>(
NS::density,
"The density.");
28 params.addParam<MooseFunctorName>(
30 "The norm of the interstitial velocity. This is required for Forchheimer calculations");
31 params.addParam<MooseFunctorName>(
NS::mu,
NS::mu,
"The dynamic viscosity");
32 params.addRangeCheckedParam<
Real>(
"consistent_scaling",
34 "consistent_scaling >= 0",
35 "Smoothing scaling parameter to control " 36 "collocated mesh oscillations");
42 _D(isParamValid(
"Darcy_name") ? &getFunctor<
ADRealVectorValue>(
"Darcy_name") : nullptr),
43 _F(isParamValid(
"Forchheimer_name") ? &getFunctor<
ADRealVectorValue>(
"Forchheimer_name")
45 _use_Darcy_friction_model(isParamValid(
"Darcy_name")),
46 _use_Forchheimer_friction_model(isParamValid(
"Forchheimer_name")),
50 _consistent_scaling(getParam<
Real>(
"consistent_scaling"))
53 mooseError(
"At least one friction model needs to be specified.");
56 mooseError(
"If using a Forchheimer friction model, then the '",
58 "' parameter must be provided");
73 const auto elem_face =
elemArg();
80 ADReal friction_term_elem = 0;
81 ADReal friction_term_neighbor = 0;
91 friction_term_elem += (*_D)(elem_face, state)(
_index)*
_mu(elem_face, state);
92 friction_term_neighbor += (*_D)(neighbor_face, state)(
_index)*
_mu(neighbor_face, state);
97 (*_F)(elem_face, state)(
_index)*
_rho(elem_face, state) / 2 * (*_speed)(elem_face, state);
98 friction_term_neighbor += (*_F)(neighbor_face, state)(
_index)*
_rho(neighbor_face, state) / 2 *
99 (*_speed)(neighbor_face, state);
105 (_elem_centroid - _face_centroid).
norm();
111 friction_term_elem * geometric_factor,
112 friction_term_neighbor * geometric_factor,
122 friction_term_elem += (*_D)(face, state)(
_index)*
_mu(face, state);
124 friction_term_elem +=
125 (*_F)(face, state)(
_index)*
_rho(face, state) / 2 * (*_speed)(face, state);
127 Real geometric_factor =
130 diff_face = friction_term_elem * geometric_factor;
142 ADReal ae = dudn.derivatives()[dof_number];
150 ADReal an = dudn.derivatives()[dof_number];
155 const auto strong_resid = -diff_face * dudn;
static const std::string speed
A flux kernel that momentum residual objects that add non-advection flux terms, or more specifically ...
Moose::ElemArg elemArg(bool correct_skewness=false) const
const bool _use_Forchheimer_friction_model
unsigned int number() const
const Moose::Functor< ADReal > & _mu
Dynamic viscosity as a functor.
const Elem & elem() const
const FaceInfo * _face_info
Moose::StateArg determineState() const
const Point & faceCentroid() const
const unsigned int _index
index x|y|z
static const std::string density
const Moose::Functor< ADReal > & _rho
Density as a functor.
const Point & neighborCentroid() const
PINSFVMomentumFrictionCorrection(const InputParameters ¶ms)
RhieChowInterpolatorBase & _rc_uo
The Rhie Chow user object that is responsible for generating face velocities for advection terms...
virtual bool skipForBoundary(const FaceInfo &fi) const
static InputParameters validParams()
bool isInternalFace(const FaceInfo &) const
LimiterType limiterType(InterpMethod interp_method)
const Elem * neighborPtr() const
const Point & elemCentroid() const
static const std::string mu
const Elem & neighbor() const
const Point & normal() const
unsigned int number() const
FaceInfo::VarFaceNeighbors _face_type
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addResidualAndJacobian(const ADReal &residual)
Process into either the system residual or Jacobian.
virtual void addToA(const libMesh::Elem *elem, unsigned int component, const ADReal &value)=0
API for momentum residual objects that have on-diagonals for velocity call.
Moose::ElemArg neighborArg(bool correct_skewness=false) const
GradientType gradient(const ElemArg &elem, const StateArg &state) const
static InputParameters validParams()
void mooseError(Args &&... args) const
const bool _use_Darcy_friction_model
Booleans to select the right models.
Real _consistent_scaling
Parameter for scaling the consistent pressure interpolation.
MooseVariableFV< Real > & _var
const Moose::Functor< ADReal > *const _speed
Speed (norm of the interstitial velocity) as a functor.
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
registerMooseObject("NavierStokesApp", PINSFVMomentumFrictionCorrection)
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
MooseUnits pow(const MooseUnits &, int)
void gatherRCData(const FaceInfo &fi) override final
Should be a non-empty implementation if the residual object is a FVFluxKernel and introduces residual...
Moose::FaceArg makeFace(const FaceInfo &fi, const Moose::FV::LimiterType limiter_type, const bool elem_is_upwind, const bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const