LCOV - code coverage report
Current view: top level - include/functormaterials - FunctorIsotropicDragCoefficients.h (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 17 18 94.4 %
Date: 2025-08-14 10:14:56 Functions: 4 14 28.6 %
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             : #pragma once
      11             : 
      12             : #include "FunctorDragCoefficients.h"
      13             : #include "NS.h"
      14             : 
      15             : /**
      16             :  * Abstract base class to compute isotropic drag coefficients, where \f$C_L\f$ and
      17             :  * \f$C_Q\f$ are independent of direction. Each of \f$C_L\f$ and\f$C_Q\f$
      18             :  * are separated into the calculation of a prefactor and a coefficient,where the
      19             :  * total drag coefficient is the multiplication of these two. This separation
      20             :  * reduces some code duplication.
      21             :  */
      22             : template <typename Derived>
      23             : class FunctorIsotropicDragCoefficients : public FunctorDragCoefficients
      24             : {
      25             : public:
      26             :   FunctorIsotropicDragCoefficients(const InputParameters & parameters);
      27             : 
      28             :   static InputParameters validParams();
      29             : 
      30             : protected:
      31             :   /// a multiplier for adjusting Darcy coefficients
      32             :   Real _darcy_mult;
      33             : 
      34             :   /// a multiplier for adjusting Forchheimer coefficients
      35             :   Real _forchheimer_mult;
      36             : };
      37             : 
      38             : template <typename Derived>
      39             : InputParameters
      40          41 : FunctorIsotropicDragCoefficients<Derived>::validParams()
      41             : {
      42          41 :   auto params = FunctorDragCoefficients::validParams();
      43          82 :   params.addParam<Real>("Darcy_multiplier", 1, "A multiplier to adjust Darcy coefficients");
      44          82 :   params.addParam<Real>(
      45          82 :       "Forchheimer_multiplier", 1, "A multiplier to adjust Forchheimer coefficients");
      46          41 :   return params;
      47           0 : }
      48             : 
      49             : template <typename Derived>
      50          22 : FunctorIsotropicDragCoefficients<Derived>::FunctorIsotropicDragCoefficients(
      51             :     const InputParameters & parameters)
      52             :   : FunctorDragCoefficients(parameters),
      53          22 :     _darcy_mult(getParam<Real>("Darcy_multiplier")),
      54          66 :     _forchheimer_mult(getParam<Real>("Forchheimer_multiplier"))
      55             : {
      56          66 :   addFunctorProperty<ADRealVectorValue>(
      57             :       NS::cL,
      58      644000 :       [this](const auto & r, const auto & t) -> ADRealVectorValue
      59             :       {
      60             :         RealVectorValue multipliers(1.0, 1.0, 1.0);
      61             :         return multipliers * static_cast<Derived *>(this)->computeDarcyPrefactor(r, t) *
      62     1288000 :                static_cast<Derived *>(this)->computeDarcyCoefficient(r, t) * _darcy_mult;
      63             :       });
      64             : 
      65          66 :   addFunctorProperty<ADRealVectorValue>(
      66             :       NS::cQ,
      67      644000 :       [this](const auto & r, const auto & t) -> ADRealVectorValue
      68             :       {
      69             :         RealVectorValue multipliers(1.0, 1.0, 1.0);
      70             :         return multipliers * static_cast<Derived *>(this)->computeForchheimerPrefactor(r, t) *
      71      644000 :                static_cast<Derived *>(this)->computeForchheimerCoefficient(r, t) *
      72     1288000 :                _forchheimer_mult;
      73             :       });
      74          66 : }

Generated by: LCOV version 1.14