LCOV - code coverage report
Current view: top level - src/functormaterials - INSFVkEpsilonViscosityFunctorMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 22 25 88.0 %
Date: 2026-05-29 20:37:52 Functions: 4 8 50.0 %
Legend: Lines: hit not hit

          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          98 : INSFVkEpsilonViscosityFunctorMaterial::validParams()
      22             : {
      23          98 :   InputParameters params = FunctorMaterial::validParams();
      24          98 :   params.addClassDescription("Computes the turbulent dynamic viscosity given k and epsilon.");
      25          98 :   params.addRequiredParam<MooseFunctorName>(NS::density, "The liquid density.");
      26          98 :   params.addRequiredParam<MooseFunctorName>(NS::TKE, "The turbulence kinetic energy.");
      27          98 :   params.addRequiredParam<MooseFunctorName>(NS::TKED,
      28             :                                             "The turbulent kinetic energy dissipation rate.");
      29         196 :   params.addParam<MooseFunctorName>("C_mu", 0.09, "C_mu closure parameter");
      30          98 :   return params;
      31           0 : }
      32             : 
      33          52 : INSFVkEpsilonViscosityFunctorMaterial::INSFVkEpsilonViscosityFunctorMaterial(
      34          52 :     const InputParameters & parameters)
      35             :   : FunctorMaterial(parameters),
      36          52 :     _rho(getFunctor<ADReal>(NS::density)),
      37          52 :     _k(getFunctor<ADReal>(NS::TKE)),
      38          52 :     _epsilon(getFunctor<ADReal>(NS::TKED)),
      39         104 :     _C_mu(getFunctor<ADReal>("C_mu")),
      40         104 :     _preserve_sparsity_pattern(_fe_problem.preserveMatrixSparsityPattern())
      41             : {
      42         156 :   addFunctorProperty<ADReal>(NS::mu_t,
      43     1504200 :                              [this](const auto & r, const auto & t) -> ADReal
      44             :                              {
      45             :                                using std::max;
      46             : 
      47     1504200 :                                if (_preserve_sparsity_pattern)
      48     3008400 :                                  return max(NS::mu_t_low_limit + 0 * _k(r, t) * _epsilon(r, t),
      49     4512600 :                                             _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) /
      50     6016800 :                                                 max(NS::epsilon_low_limit, _epsilon(r, t)));
      51             :                                else
      52             :                                  return max(NS::mu_t_low_limit,
      53           0 :                                             _C_mu(r, t) * _rho(r, t) * Utility::pow<2>(_k(r, t)) /
      54           0 :                                                 max(NS::epsilon_low_limit, _epsilon(r, t)));
      55             :                              });
      56         104 : }

Generated by: LCOV version 1.14