LCOV - code coverage report
Current view: top level - src/scmclosures - SCMFrictionMATRA.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #33358 (34476d) with base 4fcf7b Lines: 30 32 93.8 %
Date: 2026-07-17 19:56:42 Functions: 5 5 100.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 "SCMFrictionMATRA.h"
      11             : 
      12             : #include <cmath>
      13             : 
      14             : registerMooseObject("SubChannelApp", SCMFrictionMATRA);
      15             : 
      16             : namespace
      17             : {
      18             : const Real matra_transition_start = std::pow(64.0 / 0.316, 4.0 / 3.0);
      19             : const Real matra_transition_end = 5000.0;
      20             : 
      21             : Real
      22             : smoothStep(const Real x)
      23             : {
      24      509540 :   return x * x * (3.0 - 2.0 * x);
      25             : }
      26             : 
      27             : Real
      28    20044608 : matraQuadLatticeFrictionFactor(const Real Re)
      29             : {
      30    20044608 :   if (Re < 1)
      31             :     return 64.0;
      32    20044608 :   else if (Re < matra_transition_start)
      33     1400068 :     return 64.0 / Re;
      34    18644540 :   else if (Re < matra_transition_end)
      35             :   {
      36             :     const auto weight =
      37      509540 :         smoothStep((Re - matra_transition_start) / (matra_transition_end - matra_transition_start));
      38      509540 :     const auto laminar_friction = 64.0 / Re;
      39      509540 :     const auto matra_friction = 0.316 * std::pow(Re, -0.25);
      40      509540 :     return (1.0 - weight) * laminar_friction + weight * matra_friction;
      41             :   }
      42             :   /// Pang, B. et al. KIT, 2013
      43    18135000 :   else if (Re >= 5000 and Re < 30000)
      44       94320 :     return 0.316 * std::pow(Re, -0.25);
      45    18040680 :   else if (Re >= 30000 and Re < 1000000)
      46    18040680 :     return 0.184 * std::pow(Re, -0.20);
      47             :   else
      48             :     // currently unreachable
      49             :     return 0.0;
      50             : }
      51             : }
      52             : 
      53             : InputParameters
      54         265 : SCMFrictionMATRA::validParams()
      55             : {
      56         265 :   InputParameters params = SCMFrictionClosureBase::validParams();
      57         265 :   params.addClassDescription(
      58             :       "Class that computes the axial friction factor using the MATRA correlation.");
      59         265 :   return params;
      60           0 : }
      61             : 
      62         137 : SCMFrictionMATRA::SCMFrictionMATRA(const InputParameters & parameters)
      63             :   : SCMFrictionClosureBase(parameters),
      64         137 :     _is_quad_lattice(dynamic_cast<const QuadSubChannelMesh *>(&_subchannel_mesh) != nullptr),
      65         274 :     _quad_sch_mesh(dynamic_cast<const QuadSubChannelMesh *>(&_subchannel_mesh))
      66             : {
      67         137 : }
      68             : 
      69             : Real
      70    20048838 : SCMFrictionMATRA::computeFrictionFactor(const FrictionStruct & friction_args) const
      71             : {
      72    20048838 :   if (_is_quad_lattice)
      73    20048838 :     return computeQuadLatticeFrictionFactor(friction_args);
      74             :   else
      75           0 :     mooseError(name(),
      76             :                ": This closure model applies only for assemblies with bare fuel pins in a square "
      77             :                "lattice. ");
      78             : }
      79             : 
      80             : Real
      81    20048838 : SCMFrictionMATRA::computeQuadLatticeFrictionFactor(const FrictionStruct & friction_args) const
      82             : {
      83    20048838 :   if (friction_args.Re >= 1000000)
      84             :   {
      85        4244 :     flagInvalidSolution("MATRA correlation out of range");
      86        4230 :     return 0.0;
      87             :   }
      88             : 
      89    20044608 :   return matraQuadLatticeFrictionFactor(friction_args.Re);
      90             : }

Generated by: LCOV version 1.14