https://mooseframework.inl.gov
LinearFrictionFactorFunctorMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "NS.h"
12 #include "NavierStokesMethods.h"
13 
15 
18 {
20  params.addClassDescription(
21  "Material class used to compute a friction factor of the form A * "
22  "f(r, t) + B * g(r, t) * |v_I| with A, B vector constants, f(r, t) and g(r, t) "
23  "functors of space and time, and |v_I| the interstitial speed");
24 
25  params.addRequiredParam<MooseFunctorName>("functor_name",
26  "The name of functor storing the friction factor");
27  params.addRequiredParam<MooseFunctorName>(NS::porosity, "porosity");
28  params.addParam<MooseFunctorName>(
29  NS::superficial_velocity_x, 0, "The x component of the fluid superficial velocity variable.");
30  params.addParam<MooseFunctorName>(
31  NS::superficial_velocity_y, 0, "The y component of the fluid superficial velocity variable.");
32  params.addParam<MooseFunctorName>(
33  NS::superficial_velocity_z, 0, "The z component of the fluid superficial velocity variable.");
34  params.addParam<RealVectorValue>(
35  "A", RealVectorValue(1, 1, 1), "Coefficient of the A * f(t) term");
36  params.addParam<RealVectorValue>(
37  "B", RealVectorValue(), "Coefficient of the B * g(t) * |v_I| term");
38  params.addParam<MooseFunctorName>("f", "Functor f in the A * f(t) term");
39  params.addParam<MooseFunctorName>("g", "Functor g in the B * g(t) * |v_I| term");
40  return params;
41 }
42 
44  const InputParameters & parameters)
45  : FunctorMaterial(parameters),
46  _functor_name(getParam<MooseFunctorName>("functor_name")),
47  _A(getParam<RealVectorValue>("A")),
48  _B(getParam<RealVectorValue>("B")),
49  _f(getFunctor<ADReal>("f")),
50  _g(getFunctor<ADReal>("g")),
51  _eps(getFunctor<ADReal>(NS::porosity)),
52  _superficial_vel_x(getFunctor<ADReal>(NS::superficial_velocity_x)),
53  _superficial_vel_y(getFunctor<ADReal>(NS::superficial_velocity_y)),
54  _superficial_vel_z(getFunctor<ADReal>(NS::superficial_velocity_z))
55 {
56  // Check dimension of the mesh
57  const unsigned int num_components_specified =
61  if (num_components_specified != blocksMaxDimension())
62  mooseError("Only ",
63  num_components_specified,
64  " superficial velocity components were provided for a mesh of dimension ",
66 
67  addFunctorProperty<ADRealVectorValue>(
69  [this](const auto & r, const auto & t) -> ADRealVectorValue
70  {
71  // Compute speed
72  // see PINSFVSpeedFunctorMaterial.C for explanation
73  const ADRealVectorValue superficial_vel(
75  const auto speed = NS::computeSpeed(superficial_vel) / _eps(r, t);
76 
77  return _A * _f(r, t) + _B * _g(r, t) * speed;
78  });
79 }
unsigned int blocksMaxDimension() const
MooseFunctorName _functor_name
name of the functor computed by this material
static const std::string speed
Definition: NS.h:143
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
LinearFrictionFactorFunctorMaterial(const InputParameters &parameters)
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string porosity
Definition: NS.h:104
static const std::string superficial_velocity_y
Definition: NS.h:51
const Moose::Functor< ADReal > & _eps
Porosity.
Material class used to compute a friction factor of the form A * f(t) + B * g(t) * |v_I| with A...
registerMooseObject("NavierStokesApp", LinearFrictionFactorFunctorMaterial)
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
const RealVectorValue _A
A, B, f(t), g(t)
ADReal computeSpeed(const ADRealVectorValue &velocity)
Compute the speed (velocity norm) given the supplied velocity.
static const std::string superficial_velocity_z
Definition: NS.h:52
static const std::string superficial_velocity_x
Definition: NS.h:50