https://mooseframework.inl.gov
INSFVkEpsilonViscosityFunctorMaterial.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  INSFVkEpsilonViscosityMaterial,
16  "02/01/2025 00:00",
19 
22 {
24  params.addClassDescription("Computes the turbulent dynamic viscosity given k and epsilon.");
25  params.addRequiredParam<MooseFunctorName>(NS::density, "The liquid density.");
26  params.addRequiredParam<MooseFunctorName>(NS::TKE, "The turbulence kinetic energy.");
27  params.addRequiredParam<MooseFunctorName>(NS::TKED,
28  "The turbulent kinetic energy dissipation rate.");
29  params.addParam<MooseFunctorName>("C_mu", 0.09, "C_mu closure parameter");
30  return params;
31 }
32 
34  const InputParameters & parameters)
35  : FunctorMaterial(parameters),
36  _rho(getFunctor<ADReal>(NS::density)),
37  _k(getFunctor<ADReal>(NS::TKE)),
38  _epsilon(getFunctor<ADReal>(NS::TKED)),
39  _C_mu(getFunctor<ADReal>("C_mu")),
40  _preserve_sparsity_pattern(_fe_problem.preserveMatrixSparsityPattern())
41 {
42  addFunctorProperty<ADReal>(
43  NS::mu_t,
44  [this](const auto & r, const auto & t) -> ADReal
45  {
47  return std::max(NS::mu_t_low_limit + 0 * _k(r, t) * _epsilon(r, t),
48  _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) /
49  std::max(NS::epsilon_low_limit, _epsilon(r, t)));
50  else
51  return std::max(NS::mu_t_low_limit,
52  _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) /
53  std::max(NS::epsilon_low_limit, _epsilon(r, t)));
54  });
55 }
This is the material class used to compute the viscosity of the kEpsilon model.
static const std::string mu_t
Definition: NS.h:125
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Moose::Functor< ADReal > & _epsilon
The turbulent kinetic energy dissipation rate.
const bool _preserve_sparsity_pattern
Whether to preserve the sparsity pattern between iterations (needed for Newton solvers) ...
static const std::string density
Definition: NS.h:33
static const std::string TKE
Definition: NS.h:176
const Moose::Functor< ADReal > & _rho
The density.
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
const Moose::Functor< ADReal > & _C_mu
The C_mu.
registerMooseObject("NavierStokesApp", INSFVkEpsilonViscosityFunctorMaterial)
registerMooseObjectRenamed("NavierStokesApp", INSFVkEpsilonViscosityMaterial, "02/01/2025 00:00", INSFVkEpsilonViscosityFunctorMaterial)
const Moose::Functor< ADReal > & _k
The turbulent kinetic energy.
INSFVkEpsilonViscosityFunctorMaterial(const InputParameters &parameters)
static const std::string TKED
Definition: NS.h:177
void addClassDescription(const std::string &doc_string)
static constexpr Real mu_t_low_limit
Definition: NS.h:194
static constexpr Real epsilon_low_limit
Definition: NS.h:196