https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FunctorEffectiveDynamicViscosity.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
15
16template <bool is_ad>
19{
20 auto params = FunctorMaterial::validParams();
21 params.addClassDescription(
22 "Computes the effective dynamic viscosity mu_eff = mu + mu_t / factor");
23 params.addRequiredParam<MooseFunctorName>(
24 "property_name", "Name of the functor for the effective dynamic viscosity");
25 params.addRequiredParam<MooseFunctorName>(NS::mu, "Name of the dynamic viscosity functor");
26 params.addRequiredParam<MooseFunctorName>(NS::mu_t, "Name of the turbulent viscosity functor");
27 params.addRequiredParam<MooseFunctorName>(NS::mu_t + "_inverse_factor",
28 "Factor dividing the turbulent viscosity functor");
29 params.addParam<Real>(NS::mu_t + "_extra_inverse_factor",
30 1.,
31 "Additional factor dividing the turbulent viscosity functor");
32 params.addParam<bool>(
33 "add_dynamic_viscosity", true, "Whether add the dynamic viscosity in the expression");
34
35 return params;
36}
37
38template <bool is_ad>
40 const InputParameters & parameters)
41 : FunctorMaterial(parameters),
42 _mu(getFunctor<GenericReal<is_ad>>(NS::mu)),
43 _mu_t(getFunctor<GenericReal<is_ad>>(NS::mu_t)),
44 _scale_factor(getFunctor<GenericReal<is_ad>>(NS::mu_t + "_inverse_factor")),
45 _scale_factor_real(getParam<Real>(NS::mu_t + "_extra_inverse_factor"))
46{
47 const std::set<ExecFlagType> clearance_schedule(_execute_enum.begin(), _execute_enum.end());
48 if (getParam<bool>("add_dynamic_viscosity"))
49 addFunctorProperty<GenericReal<is_ad>>(
50 getParam<MooseFunctorName>("property_name"),
51 [this](const auto & r, const auto & t) -> GenericReal<is_ad>
52 { return _mu(r, t) + _mu_t(r, t) / _scale_factor(r, t) / _scale_factor_real; },
53 clearance_schedule);
54 else
55 addFunctorProperty<GenericReal<is_ad>>(
56 getParam<MooseFunctorName>("property_name"),
57 [this](const auto & r, const auto & t) -> GenericReal<is_ad>
58 { return _mu_t(r, t) / _scale_factor(r, t) / _scale_factor_real; },
59 clearance_schedule);
60}
61
registerMooseObject("NavierStokesApp", FunctorEffectiveDynamicViscosity)
const double mu
Moose::GenericType< Real, is_ad > GenericReal
Class used to compute the effective dynamic viscosity, notably in the presence of turbulence.
FunctorEffectiveDynamicViscosityTempl(const InputParameters &parameters)
const Moose::Functor< GenericReal< is_ad > > & _scale_factor
Functor for dividing the turbulent dynamic viscosity.
const Moose::Functor< GenericReal< is_ad > > & _mu
Functor for the dynamic viscosity.
const Moose::Functor< GenericReal< is_ad > > & _mu_t
Functor for the turbulent dynamic viscosity.
Real _scale_factor_real
Factor for dividing the turbulent dynamic viscosity.
static InputParameters validParams()
MooseEnumIterator end() const
MooseEnumIterator begin() const
const ExecFlagEnum & _execute_enum
static const std::string mu_t
Definition NS.h:129
static const std::string mu
Definition NS.h:127