LCOV - code coverage report
Current view: top level - src/ics - MarvelTriFlowAreaIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #32971 (54bef8) with base c6cf66 Lines: 45 46 97.8 %
Date: 2026-05-29 20:40:47 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 "MarvelTriFlowAreaIC.h"
      11             : #include "TriSubChannelMesh.h"
      12             : #include "SCM.h"
      13             : 
      14             : registerMooseObject("SubChannelApp", MarvelTriFlowAreaIC);
      15             : 
      16             : InputParameters
      17          15 : MarvelTriFlowAreaIC::validParams()
      18             : {
      19          15 :   InputParameters params = TriSubChannelBaseIC::validParams();
      20          15 :   params.addClassDescription("Computes flow area of subchannels in a triangular lattice "
      21             :                              "arrangement in a MARVEL-type micro-reactor");
      22          15 :   return params;
      23           0 : }
      24             : 
      25           8 : MarvelTriFlowAreaIC::MarvelTriFlowAreaIC(const InputParameters & params)
      26           8 :   : TriSubChannelBaseIC(params), _subchannel_mesh(SCM::getConstMesh<SubChannelMesh>(_mesh))
      27             : {
      28           8 : }
      29             : 
      30             : Real
      31       31200 : MarvelTriFlowAreaIC::value(const Point & p)
      32             : {
      33             :   Real standard_area, rod_area, wire_area, additional_area;
      34       31200 :   auto pitch = _mesh.getPitch();
      35       31200 :   auto rod_diameter = _mesh.getPinDiameter();
      36       31200 :   auto wire_diameter = _mesh.getWireDiameter();
      37       31200 :   auto wire_lead_length = _mesh.getWireLeadLength();
      38       31200 :   auto gap = _mesh.getDuctToPinGap();
      39       31200 :   auto r_ref = rod_diameter / 2.0 + gap;
      40       31200 :   auto z_blockage = _mesh.getZBlockage();
      41       31200 :   auto index_blockage = _mesh.getIndexBlockage();
      42       31200 :   auto reduction_blockage = _mesh.getReductionBlockage();
      43       31200 :   auto theta = std::acos(wire_lead_length /
      44       31200 :                          std::sqrt(std::pow(wire_lead_length, 2) +
      45       31200 :                                    std::pow(libMesh::pi * (rod_diameter + wire_diameter), 2)));
      46       31200 :   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       31200 :   auto subch_type = _mesh.getSubchannelType(i);
      50             : 
      51       31200 :   if (subch_type == EChannelType::CENTER)
      52             :   {
      53       21600 :     standard_area = std::pow(pitch, 2) * std::sqrt(3.0) / 4.0;
      54       21600 :     rod_area = libMesh::pi * std::pow(rod_diameter, 2.0) / 8.0;
      55             :     additional_area = 0.0;
      56       21600 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 8.0 / std::cos(theta);
      57             :   }
      58        9600 :   else if (subch_type == EChannelType::EDGE)
      59             :   {
      60        7200 :     auto gamma = std::acos(1 - 0.5 * std::pow(pitch / r_ref, 2.0));
      61        7200 :     auto alpha = (libMesh::pi - gamma) / 2.0;
      62        7200 :     auto sector_angle = libMesh::pi / 2.0 - alpha;
      63        7200 :     auto triangle_height = std::sqrt(std::pow(r_ref, 2.0) - std::pow(pitch / 2.0, 2.0));
      64        7200 :     auto sector = 0.5 * sector_angle * std::pow(r_ref, 2.0);
      65        7200 :     auto triangle = 0.5 * pitch * triangle_height;
      66        7200 :     standard_area = 2.0 * sector + triangle;
      67        7200 :     rod_area = libMesh::pi * std::pow(rod_diameter, 2.0) / 8.0;
      68             :     additional_area = 0.0;
      69        7200 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 8.0 / std::cos(theta);
      70             :   }
      71             :   else
      72             :   {
      73        2400 :     standard_area = (libMesh::pi / 6.0) * std::pow(r_ref, 2.0);
      74        2400 :     rod_area = libMesh::pi * std::pow(rod_diameter, 2.0) / 24.0;
      75             :     additional_area = 0.0;
      76        2400 :     wire_area = libMesh::pi * std::pow(wire_diameter, 2.0) / 24.0 / std::cos(theta);
      77             :   }
      78             : 
      79             :   /// Calculate subchannel area
      80       31200 :   auto subchannel_area = standard_area + additional_area - rod_area - wire_area;
      81             : 
      82             :   /// Apply area reduction on subchannels affected by blockage
      83             :   auto index = 0;
      84       62395 :   for (const auto & i_blockage : index_blockage)
      85             :   {
      86       31200 :     if (i == i_blockage && (p(2) >= z_blockage.front() && p(2) <= z_blockage.back()))
      87             :     {
      88           5 :       return reduction_blockage[index] * subchannel_area;
      89             :     }
      90       31195 :     index++;
      91             :   }
      92             : 
      93             :   return subchannel_area;
      94       31200 : }

Generated by: LCOV version 1.14