LCOV - code coverage report
Current view: top level - src/functormaterials - FunctorEffectiveDynamicViscosity.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 26 29 89.7 %
Date: 2026-05-29 20:37:52 Functions: 6 28 21.4 %
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 "FunctorEffectiveDynamicViscosity.h"
      11             : #include "NS.h"
      12             : 
      13             : registerMooseObject("NavierStokesApp", FunctorEffectiveDynamicViscosity);
      14             : registerMooseObject("NavierStokesApp", ADFunctorEffectiveDynamicViscosity);
      15             : 
      16             : template <bool is_ad>
      17             : InputParameters
      18         389 : FunctorEffectiveDynamicViscosityTempl<is_ad>::validParams()
      19             : {
      20         389 :   auto params = FunctorMaterial::validParams();
      21         389 :   params.addClassDescription(
      22             :       "Computes the effective dynamic viscosity mu_eff = mu + mu_t / factor");
      23         778 :   params.addRequiredParam<MooseFunctorName>(
      24             :       "property_name", "Name of the functor for the effective dynamic viscosity");
      25         389 :   params.addRequiredParam<MooseFunctorName>(NS::mu, "Name of the dynamic viscosity functor");
      26         389 :   params.addRequiredParam<MooseFunctorName>(NS::mu_t, "Name of the turbulent viscosity functor");
      27         778 :   params.addRequiredParam<MooseFunctorName>(NS::mu_t + "_inverse_factor",
      28             :                                             "Factor dividing the turbulent viscosity functor");
      29         778 :   params.addParam<Real>(NS::mu_t + "_extra_inverse_factor",
      30         778 :                         1.,
      31             :                         "Additional factor dividing the turbulent viscosity functor");
      32         778 :   params.addParam<bool>(
      33         778 :       "add_dynamic_viscosity", true, "Whether add the dynamic viscosity in the expression");
      34             : 
      35         389 :   return params;
      36           0 : }
      37             : 
      38             : template <bool is_ad>
      39         209 : FunctorEffectiveDynamicViscosityTempl<is_ad>::FunctorEffectiveDynamicViscosityTempl(
      40             :     const InputParameters & parameters)
      41             :   : FunctorMaterial(parameters),
      42         209 :     _mu(getFunctor<GenericReal<is_ad>>(NS::mu)),
      43         209 :     _mu_t(getFunctor<GenericReal<is_ad>>(NS::mu_t)),
      44         418 :     _scale_factor(getFunctor<GenericReal<is_ad>>(NS::mu_t + "_inverse_factor")),
      45         627 :     _scale_factor_real(getParam<Real>(NS::mu_t + "_extra_inverse_factor"))
      46             : {
      47         209 :   const std::set<ExecFlagType> clearance_schedule(_execute_enum.begin(), _execute_enum.end());
      48         418 :   if (getParam<bool>("add_dynamic_viscosity"))
      49         169 :     addFunctorProperty<GenericReal<is_ad>>(
      50         338 :         getParam<MooseFunctorName>("property_name"),
      51     6372288 :         [this](const auto & r, const auto & t) -> GenericReal<is_ad>
      52     6372288 :         { return _mu(r, t) + _mu_t(r, t) / _scale_factor(r, t) / _scale_factor_real; },
      53             :         clearance_schedule);
      54             :   else
      55          40 :     addFunctorProperty<GenericReal<is_ad>>(
      56          80 :         getParam<MooseFunctorName>("property_name"),
      57           0 :         [this](const auto & r, const auto & t) -> GenericReal<is_ad>
      58           0 :         { return _mu_t(r, t) / _scale_factor(r, t) / _scale_factor_real; },
      59             :         clearance_schedule);
      60         209 : }
      61             : 
      62             : template class FunctorEffectiveDynamicViscosityTempl<false>;
      63             : template class FunctorEffectiveDynamicViscosityTempl<true>;

Generated by: LCOV version 1.14