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.");
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.");
52 if (_component != _rz_radial_coord)
53 paramError(
"momentum_component",
"LinearFVRZViscousSource must act on the radial component.");
55 if (_use_deviatoric_terms)
56 _var.computeCellGradients();
58 const auto get_velocity_var =
61 auto & var = _fe_problem.getVariable(_tid, getParam<SolverVariableName>(param_name));
64 paramError(param_name,
"The supplied variable must be a MooseLinearVariableFVReal.");
68 if (_use_deviatoric_terms)
70 if (isParamValid(
"u"))
71 _velocity_vars[0] = get_velocity_var(
"u");
72 if (isParamValid(
"v"))
73 _velocity_vars[1] = get_velocity_var(
"v");
75 if (!_velocity_vars[0])
76 paramError(
"u",
"The x-velocity must be provided when using deviatoric terms.");
77 if (!_velocity_vars[1])
78 paramError(
"v",
"The y-velocity must be provided when using deviatoric terms.");
81 _velocity_vars[dir]->computeCellGradients();
89 mooseAssert(r > 0,
"Axisymmetric control volumes should not sit on the axis (r = 0).");
107 mooseAssert(r > 0,
"Axisymmetric control volumes should not sit on the axis (r = 0).");
122 "Velocity variable for requested direction is not available.");
const ElemInfo * _current_elem_info
const bool _use_deviatoric_terms
Whether the deviatoric correction (-2/3 div u) is requested.
T divergence(const TensorValue< T > &gradient, const VectorType &value, const PointType &point, const Moose::CoordinateSystemType &coord_sys, const unsigned int rz_radial_coord)
Compute the divergence of a vector given its matrix of derivatives.
const Moose::Functor< Real > & _mu
Dynamic viscosity functor evaluated at each element.
static const std::string component
Real computeMatrixContribution() override
std::array< MooseLinearVariableFVReal *, 2 > _velocity_vars
Cached pointers to the velocity components required to build divergence.
Moose::StateArg determineState() const
const Elem * elem() const
static InputParameters validParams()
const MooseLinearVariableFVReal & velocityVar(unsigned int dir) const
Helper to access the velocity variable for a given direction.
Adds the axisymmetric viscous source term that appears in the vector Laplacian of cylindrical coordi...
const unsigned int _rz_radial_coord
Index of the radial coordinate for the current mesh (0 -> x, 1 -> y, ...)
VectorValue< Real > gradSln(const ElemInfo &elem_info, const StateArg &state) const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
const Point & centroid() const
static const std::string mu
static InputParameters validParams()
registerMooseObject("NavierStokesApp", LinearFVRZViscousSource)
Real computeRightHandSideContribution() override
const unsigned int _dim
Spatial dimension of the mesh.
LinearFVRZViscousSource(const InputParameters ¶ms)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
IntRange< T > make_range(T beg, T end)
const Real _stress_multiplier
Precomputed factor (1 or 2) multiplying the implicit hoop term.
Real _current_elem_volume