https://mooseframework.inl.gov
ExponentialFrictionFunctorMaterial.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 "MooseMesh.h"
12 #include "NS.h"
13 
14 registerMooseObjectRenamed("NavierStokesApp",
15  ExponentialFrictionMaterial,
16  "02/01/2025 00:00",
19 
22 {
24  params.addClassDescription("Computes a Reynolds number-exponential friction factor.");
25  params.addRequiredParam<MooseFunctorName>(NS::Reynolds, "The Reynolds number.");
26  params.addParam<MooseFunctorName>(NS::speed, "The velocity magnitude of the fluid.");
27  params.addRequiredParam<Real>("c1", "c2 in c1/Re^(c2) expression.");
28  params.addRequiredParam<Real>("c2", "c2 in c1/Re^(c2) expression.");
29  params.addRequiredParam<std::string>("friction_factor_name",
30  "The name of the output friction factor.");
31  params.addParam<bool>(
32  "include_velocity_factor",
33  false,
34  "If a factor of velocity magnitude should be included in the friction factor. This is "
35  "typically the case for prorous medium Forcheimer friction therms.");
36  return params;
37 }
38 
40  const InputParameters & parameters)
41  : FunctorMaterial(parameters),
42  _Re(getFunctor<ADReal>(NS::Reynolds)),
43  _speed(isParamValid(NS::speed) ? &getFunctor<ADReal>(NS::speed) : nullptr),
44  _c1(getParam<Real>("c1")),
45  _c2(getParam<Real>("c2")),
46  _friction_factor_name(getParam<std::string>("friction_factor_name")),
47  _include_velocity_factor(getParam<bool>("include_velocity_factor"))
48 {
51  "To be able to include an additional multiplier in the friction factor, please "
52  "provide the speed of the fluid.");
53  addFunctorProperty<ADReal>(_friction_factor_name,
54  [this](const auto & r, const auto & t) -> ADReal
55  {
56  return _c1 * std::pow(_Re(r, t), _c2) *
57  (_include_velocity_factor ? (*_speed)(r, t) : ADReal(1.0));
58  });
59 }
registerMooseObject("NavierStokesApp", ExponentialFrictionFunctorMaterial)
const std::string _friction_factor_name
The name of the output friction factor functor.
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)
const Real _c1
$C_1$ in $f(Re) = C_1 Re^{C_2}$
static const std::string Reynolds
Definition: NS.h:139
const bool _include_velocity_factor
If a factor of velocity should be included or not.
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
const Moose::Functor< ADReal > & _Re
Functor for the Reynolds number.
ExponentialFrictionFunctorMaterial(const InputParameters &parameters)
Class responsible for generating a friction factor for the friction-based pressure loss terms in the ...
void paramError(const std::string &param, Args... args) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _c2
$C_2$ in $f(Re) = C_1 Re^{C_2}$
void addClassDescription(const std::string &doc_string)
const Moose::Functor< ADReal > *const _speed
Speed (velocity magnitude) of the fluid.
registerMooseObjectRenamed("NavierStokesApp", ExponentialFrictionMaterial, "02/01/2025 00:00", ExponentialFrictionFunctorMaterial)
MooseUnits pow(const MooseUnits &, int)