18 #include "libmesh/nonlinear_solver.h" 27 params.addRequiredParam<MooseFunctorName>(
NS::mu,
"The viscosity");
28 params.addClassDescription(
29 "Implements the Laplace form of the viscous stress in the Navier-Stokes equation.");
31 MooseEnum coeff_interp_method(
"average harmonic",
"harmonic");
32 params.addParam<
MooseEnum>(
"mu_interp_method",
34 "Switch that can select face interpolation method for the viscosity.");
35 params.set<
unsigned short>(
"ghost_layers") = 2;
39 params.addRelationshipManager(
40 "ElementSideNeighborLayers",
46 params.addParam<
bool>(
49 "Boolean parameter to use complete momentum expansion is the diffusion term.");
50 params.addParam<MooseFunctorName>(
"u",
"The velocity in the x direction.");
51 params.addParam<MooseFunctorName>(
"v",
"The velocity in the y direction.");
52 params.addParam<MooseFunctorName>(
"w",
"The velocity in the z direction.");
53 params.addParam<
bool>(
54 "limit_interpolation",
false,
"Flag to limit interpolation to positive values.");
55 params.addParam<
bool>(
"newton_solve",
false,
"Whether a Newton nonlinear solve is being used");
56 params.addParamNamesToGroup(
"newton_solve",
"Advanced");
67 _u_var(params.isParamValid(
"u") ? &getFunctor<
ADReal>(
"u") : nullptr),
68 _v_var(params.isParamValid(
"v") ? &getFunctor<
ADReal>(
"v") : nullptr),
69 _w_var(params.isParamValid(
"w") ? &getFunctor<
ADReal>(
"w") : nullptr),
70 _complete_expansion(getParam<bool>(
"complete_expansion")),
71 _limit_interpolation(getParam<bool>(
"limit_interpolation")),
72 _dim(_subproblem.
mesh().dimension()),
73 _newton_solve(getParam<bool>(
"newton_solve"))
76 paramError(
"u",
"The u velocity must be defined when 'complete_expansion=true'.");
80 "The v velocity must be defined when 'complete_expansion=true'" 81 "and problem dimension is larger or equal to 2.");
85 "The w velocity must be defined when 'complete_expansion=true'" 86 "and problem dimension is larger or equal to three.");
113 "Negative face viscosity has been encountered. Value ",
117 " limiting it to 0!\nFurther warnings for this issue will be silenced, but the " 118 "occurrences will be recorded through the solution invalidity interface."));
119 flagInvalidSolution(
"Negative face dynamic viscosity has been encountered.");
122 face_mu = 0 * face_mu;
125 if (populate_a_coeffs)
133 _ae = dudn.derivatives()[dof_number];
140 _an = dudn.derivatives()[dof_number];
145 ADReal dudn_transpose = 0.0;
160 const auto & grad_u =
_u_var->gradient(face, state);
165 const auto & grad_u =
_u_var->gradient(face, state);
166 const auto & grad_v =
_v_var->gradient(face, state);
171 const auto & grad_u =
_u_var->gradient(face, state);
172 const auto & grad_v =
_v_var->gradient(face, state);
173 const auto & grad_w =
_w_var->gradient(face, state);
178 const auto gradient_transpose =
gradient.transpose();
183 return -face_mu * (dudn + dudn_transpose);
ADReal _ae
The a coefficient for the element.
virtual ADReal gradUDotNormal(const Moose::StateArg &time, const bool correct_skewness) const
ADReal _an
The a coefficient for the neighbor.
const unsigned int _dim
dimension
A flux kernel that momentum residual objects that add non-advection flux terms, or more specifically ...
const bool _limit_interpolation
Boolean parameter to limit interpolation.
Moose::ElemArg elemArg(bool correct_skewness=false) const
unsigned int number() const
const Elem & elem() const
const Moose::Functor< ADReal > *const _v_var
y-velocity
const FaceInfo * _face_info
Moose::StateArg determineState() const
const Point & faceCentroid() const
virtual ADReal computeStrongResidual(const bool populate_a_coeffs)
Routine to compute this object's strong residual (e.g.
virtual ADReal computeSegregatedContribution() override
Compute the contribution which goes into the residual of the segregated system.
const unsigned int _index
index x|y|z
DualNumber< Real, DNDerivativeType, true > ADReal
const Moose::FV::InterpMethod _mu_interp_method
The face interpolation method for the viscosity.
void mooseWarning(Args &&... args) const
registerMooseObject("NavierStokesApp", INSFVMomentumDiffusion)
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
bool onBoundary(const FaceInfo &fi) const
const Elem * neighborPtr() const
const bool _correct_skewness
static const std::string mu
static InputParameters validParams()
const Moose::Functor< ADReal > & _mu
The dynamic viscosity.
const Elem & neighbor() const
const Point & normal() const
void paramError(const std::string ¶m, Args... args) const
unsigned int number() const
const Moose::Functor< ADReal > *const _u_var
x-velocity
FaceInfo::VarFaceNeighbors _face_type
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
static InputParameters validParams()
virtual const OutputTools< Real >::VariableGradient & gradient()
static InputParameters validParams()
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 singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
InterpMethod selectInterpolationMethod(const std::string &interp_method)
MooseVariableFV< Real > & _var
const Moose::Functor< ADReal > *const _w_var
z-velocity
static void setRMParamsDiffusion(const InputParameters &obj_params, InputParameters &rm_params, const unsigned short conditional_extended_layers)
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
INSFVMomentumDiffusion(const InputParameters ¶ms)
const bool _complete_expansion
Boolean parameter to include the complete momentum expansion.
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const