21 "Computes Darcy and/or Forchheimer resistance in a Navier-Stokes momentum equation.");
22 params.
addParam<MooseFunctorName>(
"Darcy_name",
"Name of the Darcy coefficients property.");
23 params.
addParam<MooseFunctorName>(
"Forchheimer_name",
24 "Name of the Forchheimer coefficients property.");
25 params.
addParam<MooseFunctorName>(
NS::mu,
"The dynamic viscosity required by Darcy resistance.");
26 params.
addParam<MooseFunctorName>(
NS::density,
"The density required by Forchheimer resistance.");
28 params.
addParam<MooseFunctorName>(
"u",
"The x-component of superficial velocity.");
29 params.
addParam<MooseFunctorName>(
"v",
"The y-component of superficial velocity.");
30 params.
addParam<MooseFunctorName>(
"w",
"The z-component of superficial velocity.");
32 MooseEnum momentum_component(
"x=0 y=1 z=2");
36 "The component of the momentum equation that this kernel applies to.");
43 _index(getParam<
MooseEnum>(
"momentum_component")),
44 _D(isParamValid(
"Darcy_name") ? &getFunctor<RealVectorValue>(
"Darcy_name") : nullptr),
45 _F(isParamValid(
"Forchheimer_name") ? &getFunctor<RealVectorValue>(
"Forchheimer_name")
47 _mu(isParamValid(
NS::
mu) ? &getFunctor<Real>(
NS::
mu) : nullptr),
48 _rho(isParamValid(
NS::density) ? &getFunctor<Real>(
NS::density) : nullptr),
49 _porosity(getFunctor<Real>(
NS::porosity)),
50 _dim(_subproblem.
mesh().dimension()),
51 _u(isParamValid(
"u") ? &getFunctor<Real>(
"u") : nullptr),
52 _v(isParamValid(
"v") ? &getFunctor<Real>(
"v") : nullptr),
53 _w(isParamValid(
"w") ? &getFunctor<Real>(
"w") : nullptr)
56 paramError(
"Darcy_name",
"Provide Darcy_name, Forchheimer_name, or both.");
58 paramError(
NS::mu,
"The mu parameter is required when Darcy_name is provided.");
62 paramError(
"u",
"The u parameter is required when Forchheimer_name is provided.");
64 paramError(
"v",
"The v parameter is required for Forchheimer resistance in 2D or 3D.");
66 paramError(
"w",
"The w parameter is required for Forchheimer resistance in 3D.");
87 Real coefficient =
_D ? (*_mu)(elem_arg, state) * (*
_D)(elem_arg, state)(
_index) : 0.0;
91 const Real porosity =
_porosity(elem_arg, state);
93 mooseError(
"porosity must be positive when using Forchheimer friction.");
95 const Real u = (*_u)(elem_arg, state);
96 const Real
v =
_v ? (*_v)(elem_arg, state) : 0.0;
97 const Real w =
_w ? (*_w)(elem_arg, state) : 0.0;
99 coefficient += 0.5 * (*_rho)(elem_arg, state) * (*
_F)(elem_arg, state)(
_index)*speed;
registerMooseObject("NavierStokesApp", LinearFVMomentumFriction)
const Elem * elem() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
const ElemInfo * _current_elem_info
static InputParameters validParams()
Real _current_elem_volume
Imposes Darcy and/or Forchheimer resistance on the momentum equation.
const Moose::Functor< RealVectorValue > *const _D
Darcy coefficient.
Real computeFrictionCoefficient(const Moose::ElemArg &elem_arg, const Moose::StateArg &state) const
LinearFVMomentumFriction(const InputParameters ¶ms)
const Moose::Functor< Real > *const _mu
Dynamic viscosity.
const Moose::Functor< Real > *const _v
const Moose::Functor< RealVectorValue > *const _F
Forchheimer coefficient.
const Moose::Functor< Real > *const _w
const Moose::Functor< Real > & _porosity
Porosity.
static InputParameters validParams()
const unsigned int _dim
Mesh dimension.
const Moose::Functor< Real > *const _rho
Density.
Real computeMatrixContribution() override
const unsigned int _index
Index x|y|z of the momentum equation component.
Real computeRightHandSideContribution() override
const Moose::Functor< Real > *const _u
Velocity components used to evaluate the Forchheimer speed.
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
Moose::StateArg determineState() const
static const std::string density
static const std::string mu
static const std::string porosity
T computeSpeed(const libMesh::VectorValue< T > &velocity)
Compute the speed (velocity norm) given the supplied velocity.