LCOV - code coverage report
Current view: top level - src/ics - SCMTriFlowAreaIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 38 39 97.4 %
Date: 2025-09-04 07:58:06 Functions: 3 3 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 "SCMTriFlowAreaIC.h"
      11             : #include "TriSubChannelMesh.h"
      12             : #include "SCM.h"
      13             : 
      14             : registerMooseObject("SubChannelApp", SCMTriFlowAreaIC);
      15             : registerMooseObjectRenamed("SubChannelApp", TriFlowAreaIC, "06/30/2025 24:00", SCMTriFlowAreaIC);
      16             : 
      17             : InputParameters
      18         274 : SCMTriFlowAreaIC::validParams()
      19             : {
      20         274 :   InputParameters params = TriSubChannelBaseIC::validParams();
      21         274 :   params.addClassDescription(
      22             :       "Computes flow area of subchannels in a triangular lattice arrangement");
      23         274 :   return params;
      24           0 : }
      25             : 
      26         154 : SCMTriFlowAreaIC::SCMTriFlowAreaIC(const InputParameters & params)
      27         154 :   : TriSubChannelBaseIC(params), _subchannel_mesh(SCM::getConstMesh<SubChannelMesh>(_mesh))
      28             : {
      29         154 : }
      30             : 
      31             : Real
      32      372240 : SCMTriFlowAreaIC::value(const Point & p)
      33             : {
      34             :   Real standard_area, rod_area, wire_area, additional_area;
      35      372240 :   auto pitch = _mesh.getPitch();
      36      372240 :   auto pin_diameter = _mesh.getPinDiameter();
      37      372240 :   auto wire_diameter = _mesh.getWireDiameter();
      38      372240 :   auto wire_lead_length = _mesh.getWireLeadLength();
      39      372240 :   auto gap = _mesh.getDuctToPinGap();
      40      372240 :   auto z_blockage = _mesh.getZBlockage();
      41      372240 :   auto index_blockage = _mesh.getIndexBlockage();
      42      372240 :   auto reduction_blockage = _mesh.getReductionBlockage();
      43      372240 :   auto theta = std::acos(wire_lead_length /
      44      372240 :                          std::sqrt(std::pow(wire_lead_length, 2) +
      45      372240 :                                    std::pow(libMesh::pi * (pin_diameter + wire_diameter), 2)));
      46      372240 :   auto i = _mesh.getSubchannelIndexFromPoint(p);
      47             :   // given the channel number, i, it computes the flow area of the subchannel
      48             :   // based on the subchannel type: CENTER, EDGE or CORNER.
      49      372240 :   auto subch_type = _mesh.getSubchannelType(i);
      50             : 
      51      372240 :   if (subch_type == EChannelType::CENTER)
      52             :   {
      53      244080 :     standard_area = std::pow(pitch, 2) * std::sqrt(3.0) / 4.0;
      54      244080 :     rod_area = libMesh::pi * std::pow(pin_diameter, 2.0) / 8.0;
      55             :     additional_area = 0.0;
      56      244080 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 8.0 / std::cos(theta);
      57             :   }
      58      128160 :   else if (subch_type == EChannelType::EDGE)
      59             :   {
      60       90000 :     standard_area = pitch * (pin_diameter / 2.0 + gap);
      61       90000 :     rod_area = libMesh::pi * std::pow(pin_diameter, 2.0) / 8.0;
      62             :     additional_area = 0.0;
      63       90000 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 8.0 / std::cos(theta);
      64             :   }
      65             :   else
      66             :   {
      67       38160 :     standard_area = 1.0 / std::sqrt(3.0) * std::pow((pin_diameter / 2.0 + gap), 2.0);
      68       38160 :     rod_area = libMesh::pi * std::pow(pin_diameter, 2.0) / 24.0;
      69             :     additional_area = 0.0;
      70       38160 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 24.0 / std::cos(theta);
      71             :   }
      72             : 
      73             :   /// Calculate subchannel area
      74      372240 :   auto subchannel_area = standard_area + additional_area - rod_area - wire_area;
      75             : 
      76             :   /// Apply area reduction on subchannels affected by blockage
      77             :   auto index = 0;
      78     1487532 :   for (const auto & i_blockage : index_blockage)
      79             :   {
      80     1115796 :     if (i == i_blockage && (p(2) >= z_blockage.front() && p(2) <= z_blockage.back()))
      81             :     {
      82         504 :       return reduction_blockage[index] * subchannel_area;
      83             :     }
      84     1115292 :     index++;
      85             :   }
      86             : 
      87             :   return subchannel_area;
      88      372240 : }

Generated by: LCOV version 1.14