https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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 using std::pow;
57 return _c1 * pow(_Re(r, t), _c2) *
58 (_include_velocity_factor ? (*_speed)(r, t) : ADReal(1.0));
59 });
60}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObjectRenamed("NavierStokesApp", ExponentialFrictionMaterial, "02/01/2025 00:00", ExponentialFrictionFunctorMaterial)
registerMooseObject("NavierStokesApp", ExponentialFrictionFunctorMaterial)
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Class responsible for generating a friction factor for the friction-based pressure loss terms in the ...
const Real _c2
$C_2$ in $f(Re) = C_1 Re^{C_2}$
const Moose::Functor< ADReal > *const _speed
Speed (velocity magnitude) of the fluid.
const std::string _friction_factor_name
The name of the output friction factor functor.
const Moose::Functor< ADReal > & _Re
Functor for the Reynolds number.
ExponentialFrictionFunctorMaterial(const InputParameters &parameters)
const Real _c1
$C_1$ in $f(Re) = C_1 Re^{C_2}$
const bool _include_velocity_factor
If a factor of velocity should be included or not.
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
static const std::string speed
Definition NS.h:147
static const std::string Reynolds
Definition NS.h:143