15#include "libmesh/utility.h"
24 "Adds the axisymmetric viscous source term mu * u_r / r^2 to the FV momentum equations.");
28 "momentum_component", component,
"Momentum component this kernel contributes to.");
29 params.
addParam<SolverVariableName>(
"u",
"The velocity in the x direction.");
30 params.
addParam<SolverVariableName>(
"v",
"The velocity in the y direction.");
32 "use_deviatoric_terms",
34 "Include the deviatoric correction (-2/3 div(u)) in the axisymmetric term.");
40 _mu(getFunctor<Real>(
NS::
mu)),
41 _component(getParam<
MooseEnum>(
"momentum_component")),
42 _rz_radial_coord(_subproblem.getAxisymmetricRadialCoord()),
43 _dim(_subproblem.
mesh().dimension()),
44 _use_deviatoric_terms(getParam<bool>(
"use_deviatoric_terms")),
45 _coord_type(getBlockCoordSystem()),
46 _stress_multiplier(_use_deviatoric_terms ? 2.0 : 1.0),
47 _velocity_vars{nullptr, nullptr}
49 if (
_coord_type != Moose::CoordinateSystemType::COORD_RZ)
50 paramError(
"block",
"LinearFVRZViscousSource is only valid on RZ coordinate systems.");
53 paramError(
"momentum_component",
"LinearFVRZViscousSource must act on the radial component.");
58 const auto get_velocity_var =
64 paramError(param_name,
"The supplied variable must be a MooseLinearVariableFVReal.");
76 paramError(
"u",
"The x-velocity must be provided when using deviatoric terms.");
78 paramError(
"v",
"The y-velocity must be provided when using deviatoric terms.");
80 for (
const auto dir : make_range(
_dim))
89 mooseAssert(r > 0,
"Axisymmetric control volumes should not sit on the axis (r = 0).");
102 Real divergence = 0.0;
103 for (
const auto dir : make_range(
_dim))
107 mooseAssert(r > 0,
"Axisymmetric control volumes should not sit on the axis (r = 0).");
110 divergence += radial_value / r;
113 const Real
mu =
_mu(elem_arg, state);
122 "Velocity variable for requested direction is not available.");
registerMooseObject("NavierStokesApp", LinearFVRZViscousSource)
const Elem * elem() const
const Point & centroid() const
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
const ElemInfo * _current_elem_info
static InputParameters validParams()
Real _current_elem_volume
MooseLinearVariableFV< Real > & _var
Adds the axisymmetric viscous source term that appears in the vector Laplacian of cylindrical coordi...
const unsigned int _dim
Spatial dimension of the mesh.
Real computeRightHandSideContribution() override
const Real _stress_multiplier
Precomputed factor (1 or 2) multiplying the implicit hoop term.
const MooseLinearVariableFVReal & velocityVar(unsigned int dir) const
Helper to access the velocity variable for a given direction.
const unsigned int _rz_radial_coord
Index of the radial coordinate for the current mesh (0 -> x, 1 -> y, ...)
Real computeMatrixContribution() override
LinearFVRZViscousSource(const InputParameters ¶ms)
std::array< MooseLinearVariableFVReal *, 2 > _velocity_vars
Cached pointers to the velocity components required to build divergence.
const Moose::Functor< Real > & _mu
Dynamic viscosity functor evaluated at each element.
const Moose::CoordinateSystemType _coord_type
Coordinate system of the active blocks (must be COORD_RZ)
static InputParameters validParams()
const bool _use_deviatoric_terms
Whether the deviatoric correction (-2/3 div u) is requested.
const unsigned int _component
Momentum component this source acts on (should equal the radial direction)
FEProblemBase & _fe_problem
void paramError(const std::string ¶m, Args... args) const
bool isParamValid(const std::string &name) const
void computeCellGradients()
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
VectorValue< Real > gradSln(const ElemInfo &elem_info, const StateArg &state) const
Moose::StateArg determineState() const
static const std::string mu