22 "Computes the Darcy friction factor using the Colebrook-White correlation.");
24 params.
addRequiredParam<MaterialPropertyName>(
"vel",
"x-component of the velocity");
27 params.
addRequiredParam<MaterialPropertyName>(
"f_D",
"Darcy friction factor material property");
28 params.
addRequiredParam<MaterialPropertyName>(
"mu",
"Dynamic viscosity material property");
30 params.
addParam<Real>(
"roughness", 0,
"Surface roughness");
33 params.
addParam<Real>(
"rtol", 1e-14,
"Relative tolerance for implicit solve.");
34 params.
addParam<
unsigned int>(
"max_iterations", 20,
"Max iterations for iterative solve.");
35 MooseEnum max_its_behavior{
"error warn accept",
"error"};
38 "Whether to error, warn or accept when max iterations is reached");
45 _f_D_name(getParam<MaterialPropertyName>(
"f_D")),
46 _f_D(declareADProperty<Real>(_f_D_name)),
48 _mu(getADMaterialProperty<Real>(
"mu")),
49 _rho(getADMaterialProperty<Real>(
"rho")),
50 _vel(getADMaterialProperty<Real>(
"vel")),
51 _D_h(getADMaterialProperty<Real>(
"D_h")),
52 _roughness(getParam<Real>(
"roughness")),
53 _max_its(getParam<unsigned
int>(
"max_iterations")),
54 _max_its_behavior(getParam<
MooseEnum>(
"max_iterations_behavior")),
55 _tol(getParam<Real>(
"rtol"))
57 if (_tol < 0. || _tol >= 1.)
58 mooseError(
"Colebrook-White friction factor relative tolerance must be between 0 and 1");
67 mooseDoOnce(
mooseWarning(
"Calculated Reynolds number below 4000 (",
69 "), consider using different friction factor"));
82 if (abs(f_D - f_D_old) / f_D <
_tol)
89 mooseError(
"Colebrook-White friction factor maximum iterations reached: ",
_max_its,
".");
92 "Colebrook-White friction factor maximum iterations reached: ",
_max_its,
"."));
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADWallFrictionColebrookWhiteMaterial)
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
void ErrorVector unsigned int
Computes drag coefficient using the Colebrook-White formula for the Darcy friction factor.
static InputParameters validParams()
const ADMaterialProperty< Real > & _mu
Dynamic viscosity.
const unsigned int _max_its
max iterations for iterative solve
const ADMaterialProperty< Real > & _rho
Density of the phase.
ADWallFrictionColebrookWhiteMaterial(const InputParameters ¶meters)
const ADMaterialProperty< Real > & _D_h
Hydraulic diameter.
const Real _tol
Tolerance for implicit solve.
virtual void computeQpProperties()
ADMaterialProperty< Real > & _f_D
const ADMaterialProperty< Real > & _vel
Velocity (x-component)
MooseEnum _max_its_behavior
Whether to error, warn or accept on reaching max its.
const Real & _roughness
Roughness of the surface.
static InputParameters validParams()
void mooseError(Args &&... args) const
void mooseWarning(Args &&... args) const
auto Reynolds(const T1 &volume_fraction, const T2 &rho, const T3 &vel, const T4 &D_h, const T5 &mu)
Compute Reynolds number.