24 params.
addClassDescription(
"Represents the matrix and right hand side contributions of the " 25 "stress and advection terms of the momentum equation.");
26 params.
addRequiredParam<SolverVariableName>(
"u",
"The velocity in the x direction.");
27 params.
addParam<SolverVariableName>(
"v",
"The velocity in the y direction.");
28 params.
addParam<SolverVariableName>(
"w",
"The velocity in the z direction.");
30 "rhie_chow_user_object",
31 "The rhie-chow user-object which is used to determine the face velocity.");
33 MooseEnum momentum_component(
"x=0 y=1 z=2");
37 "The component of the momentum equation that this kernel applies to.");
39 "use_nonorthogonal_correction",
41 "If the nonorthogonal correction should be used when computing the normal gradient.");
43 "use_deviatoric_terms",
false,
"If deviatoric terms in the stress terms need to be used.");
51 _dim(_subproblem.
mesh().dimension()),
52 _mass_flux_provider(getUserObject<
RhieChowMassFlux>(
"rhie_chow_user_object")),
53 _mu(getFunctor<
Real>(getParam<MooseFunctorName>(
NS::
mu))),
54 _use_nonorthogonal_correction(getParam<bool>(
"use_nonorthogonal_correction")),
55 _use_deviatoric_terms(getParam<bool>(
"use_deviatoric_terms")),
56 _advected_interp_coeffs(
std::make_pair<
Real,
Real>(0, 0)),
58 _boundary_normal_factor(1.0),
59 _stress_matrix_contribution(0.0),
60 _stress_rhs_contribution(0.0),
61 _index(getParam<
MooseEnum>(
"momentum_component")),
63 &_fe_problem.getVariable(_tid, getParam<SolverVariableName>(
"u")))),
64 _v_var(params.isParamValid(
"v")
66 &_fe_problem.getVariable(_tid, getParam<SolverVariableName>(
"v")))
68 _w_var(params.isParamValid(
"w")
70 &_fe_problem.getVariable(_tid, getParam<SolverVariableName>(
"w")))
81 paramError(
"u",
"the u velocity must be a MooseLinearVariableFVReal.");
85 "In two or more dimensions, the v velocity must be supplied and it must be a " 86 "MooseLinearVariableFVReal.");
90 "In three-dimensions, the w velocity must be supplied and it must be a " 91 "MooseLinearVariableFVReal.");
126 mooseAssert(adv_diff_bc,
"This should be a valid BC!");
137 mooseAssert(adv_diff_bc,
"This should be a valid BC!");
198 const auto interp_coeffs =
201 const auto correction_vector =
208 _mu(face_arg, state_arg) *
209 (interp_coeffs.first * grad_elem + interp_coeffs.second * grad_neighbor) *
216 const auto interp_coeffs =
223 Real trace_neighbor = 0;
227 deviatoric_vector_elem(0) = u_grad_elem(
_index);
228 deviatoric_vector_neighbor(0) = u_grad_neighbor(
_index);
229 trace_elem += u_grad_elem(0);
230 trace_neighbor += u_grad_neighbor(0);
240 deviatoric_vector_elem(1) = v_grad_elem(
_index);
241 deviatoric_vector_neighbor(1) = v_grad_neighbor(
_index);
242 trace_elem += v_grad_elem(1);
243 trace_neighbor += v_grad_neighbor(1);
249 deviatoric_vector_elem(2) = w_grad_elem(
_index);
250 deviatoric_vector_neighbor(2) = w_grad_neighbor(
_index);
251 trace_elem += w_grad_elem(2);
252 trace_neighbor += w_grad_neighbor(2);
255 deviatoric_vector_elem(
_index) -= 2 / 3 * trace_elem;
256 deviatoric_vector_neighbor(
_index) -= 2 / 3 * trace_neighbor;
259 (interp_coeffs.first * deviatoric_vector_elem +
260 interp_coeffs.second * deviatoric_vector_neighbor) *
310 const auto correction_vector =
330 trace_elem += u_grad_elem(0);
331 frace_grad_approx(0) = u_grad_elem(
_index);
338 trace_elem += v_grad_elem(1);
339 frace_grad_approx(1) = v_grad_elem(
_index);
344 trace_elem += w_grad_elem(2);
345 frace_grad_approx(2) = w_grad_elem(
_index);
349 frace_grad_approx(
_index) -= 2 / 3 * trace_elem;
virtual Real computeBoundaryMatrixContribution(const LinearFVBoundaryCondition &bc) override
Real computeInternalAdvectionNeighborMatrixContribution()
Computes the matrix contribution of the advective flux on the neighbor side of current face when the ...
const unsigned int _index
Index x|y|z, this is mainly to handle the deviatoric parts correctly in in the stress term...
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
const MooseLinearVariableFVReal *const _w_var
Velocity in direction z.
virtual Real computeBoundaryGradientRHSContribution() const=0
void paramError(const std::string ¶m, Args... args) const
Real computeInternalAdvectionElemMatrixContribution()
Computes the matrix contribution of the advective flux on the element side of current face when the f...
virtual Real computeNeighborRightHandSideContribution() override
std::pair< Real, Real > interpCoeffs(const InterpMethod m, const FaceInfo &fi, const bool one_is_elem, const T &face_flux=0.0)
Real getMassFlux(const FaceInfo &fi) const
Get the face velocity times density (used in advection terms)
Real computeStressBoundaryRHSContribution(const LinearFVAdvectionDiffusionBC *bc)
Computes the right hand side contributions of the boundary conditions resulting from the stress tenso...
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
Moose::StateArg determineState() const
const ElemInfo * neighborInfo() const
const Point & faceCentroid() const
Real computeInternalStressMatrixContribution()
Computes the matrix contribution of the stress term on the current face when the face is an internal ...
MooseLinearVariableFV< Real > & _var
virtual void setupFaceData(const FaceInfo *face_info)
virtual Real computeBoundaryGradientMatrixContribution() const=0
const bool _use_nonorthogonal_correction
Switch to enable/disable nonorthogonal correction in the stress term.
const ElemInfo * elemInfo() const
const RhieChowMassFlux & _mass_flux_provider
The Rhie-Chow user object that provides us with the face velocity.
registerMooseObject("NavierStokesApp", LinearWCNSFVMomentumFlux)
FaceInfo::VarFaceNeighbors _current_face_type
Real _boundary_normal_factor
Multiplier that ensures the normal of the boundary always points outwards, even in cases when the bou...
const Moose::Functor< Real > & _mu
The functor for the dynamic viscosity.
static InputParameters validParams()
static InputParameters validParams()
const FaceInfo * _current_face_info
InputParameters advectedInterpolationParameter()
virtual void setupFaceData(const FaceInfo *face_info) override
Set the current FaceInfo object.
Real computeAdvectionBoundaryMatrixContribution(const LinearFVAdvectionDiffusionBC *bc)
Computes the matrix contributions of the boundary conditions resulting from the advection term...
static const std::string mu
Kernel that implements the stress tensor and advection terms for the momentum equation.
std::pair< Real, Real > _advected_interp_coeffs
Container for the current advected interpolation coefficients on the face to make sure we don't compu...
Real computeAdvectionBoundaryRHSContribution(const LinearFVAdvectionDiffusionBC *bc)
Computes the right hand side contributions of the boundary conditions resulting from the advection te...
Real _stress_rhs_contribution
The cached right hand side contribution.
const Point & normal() const
virtual Real computeElemRightHandSideContribution() override
virtual bool includesMaterialPropertyMultiplier() const
const unsigned int _dim
The dimension of the mesh.
bool _cached_rhs_contribution
Real _stress_matrix_contribution
The cached matrix contribution.
Real computeStressBoundaryMatrixContribution(const LinearFVAdvectionDiffusionBC *bc)
Computes the matrix contributions of the boundary conditions resulting from the stress tensor...
virtual Real computeBoundaryValueMatrixContribution() const=0
virtual Real computeNeighborMatrixContribution() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & eCN() const
Real _face_mass_flux
Container for the mass flux on the face which will be reused in the advection term's matrix and right...
const MooseLinearVariableFVReal *const _v_var
Velocity in direction y.
virtual Real computeElemMatrixContribution() override
const VectorValue< Real > gradSln(const ElemInfo &elem_info) const
virtual Real computeBoundaryValueRHSContribution() const=0
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
bool _cached_matrix_contribution
LinearWCNSFVMomentumFlux(const InputParameters ¶ms)
Class constructor.
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Real computeInternalStressRHSContribution()
Computes the right hand side contribution of the stress term on the current face when the face is an ...
void computeCellGradients()
bool setInterpolationMethod(const MooseObject &obj, Moose::FV::InterpMethod &interp_method, const std::string ¶m_name)
const Point & dCN() const
const bool _use_deviatoric_terms
Switch to enable/disable deviatoric parts in the stress term.
const MooseLinearVariableFVReal *const _u_var
Velocity in direction x.
virtual Real computeBoundaryRHSContribution(const LinearFVBoundaryCondition &bc) override