Line data Source code
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 : 10 : #include "INSFVkEpsilonViscosityFunctorMaterial.h" 11 : #include "MooseMesh.h" 12 : #include "NS.h" 13 : 14 : registerMooseObjectRenamed("NavierStokesApp", 15 : INSFVkEpsilonViscosityMaterial, 16 : "02/01/2025 00:00", 17 : INSFVkEpsilonViscosityFunctorMaterial); 18 : registerMooseObject("NavierStokesApp", INSFVkEpsilonViscosityFunctorMaterial); 19 : 20 : InputParameters 21 186 : INSFVkEpsilonViscosityFunctorMaterial::validParams() 22 : { 23 186 : InputParameters params = FunctorMaterial::validParams(); 24 186 : params.addClassDescription("Computes the turbulent dynamic viscosity given k and epsilon."); 25 186 : params.addRequiredParam<MooseFunctorName>(NS::density, "The liquid density."); 26 186 : params.addRequiredParam<MooseFunctorName>(NS::TKE, "The turbulence kinetic energy."); 27 186 : params.addRequiredParam<MooseFunctorName>(NS::TKED, 28 : "The turbulent kinetic energy dissipation rate."); 29 372 : params.addParam<MooseFunctorName>("C_mu", 0.09, "C_mu closure parameter"); 30 186 : return params; 31 0 : } 32 : 33 100 : INSFVkEpsilonViscosityFunctorMaterial::INSFVkEpsilonViscosityFunctorMaterial( 34 100 : const InputParameters & parameters) 35 : : FunctorMaterial(parameters), 36 100 : _rho(getFunctor<ADReal>(NS::density)), 37 100 : _k(getFunctor<ADReal>(NS::TKE)), 38 100 : _epsilon(getFunctor<ADReal>(NS::TKED)), 39 200 : _C_mu(getFunctor<ADReal>("C_mu")), 40 200 : _preserve_sparsity_pattern(_fe_problem.preserveMatrixSparsityPattern()) 41 : { 42 300 : addFunctorProperty<ADReal>( 43 : NS::mu_t, 44 2221200 : [this](const auto & r, const auto & t) -> ADReal 45 : { 46 2221200 : if (_preserve_sparsity_pattern) 47 2221200 : return std::max(NS::mu_t_low_limit + 0 * _k(r, t) * _epsilon(r, t), 48 6663600 : _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) / 49 8884800 : std::max(NS::epsilon_low_limit, _epsilon(r, t))); 50 : else 51 : return std::max(NS::mu_t_low_limit, 52 0 : _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) / 53 0 : std::max(NS::epsilon_low_limit, _epsilon(r, t))); 54 : }); 55 200 : }