LCOV - code coverage report
Current view: top level - src/mesh - SubChannelMesh.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 22 37 59.5 %
Date: 2025-09-04 07:58:06 Functions: 4 5 80.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 "SubChannelMesh.h"
      11             : 
      12             : InputParameters
      13         828 : SubChannelMesh::validParams()
      14             : {
      15         828 :   InputParameters params = MooseMesh::validParams();
      16         828 :   params.addClassDescription("Base class for all mesh containers");
      17         828 :   return params;
      18           0 : }
      19             : 
      20         414 : SubChannelMesh::SubChannelMesh(const InputParameters & params) : MooseMesh(params), _kij(0.0) {}
      21             : 
      22           0 : SubChannelMesh::SubChannelMesh(const SubChannelMesh & other_mesh)
      23             :   : MooseMesh(other_mesh),
      24           0 :     _unheated_length_entry(other_mesh._unheated_length_entry),
      25           0 :     _heated_length(other_mesh._heated_length),
      26           0 :     _unheated_length_exit(other_mesh._unheated_length_exit),
      27           0 :     _z_grid(other_mesh._z_grid),
      28           0 :     _k_grid(other_mesh._k_grid),
      29           0 :     _spacer_z(other_mesh._spacer_z),
      30           0 :     _spacer_k(other_mesh._spacer_k),
      31           0 :     _kij(other_mesh._kij),
      32           0 :     _pitch(other_mesh._pitch),
      33           0 :     _pin_diameter(other_mesh._pin_diameter),
      34           0 :     _n_cells(other_mesh._n_cells)
      35             : {
      36           0 : }
      37             : 
      38             : void
      39         434 : SubChannelMesh::generateZGrid(Real unheated_length_entry,
      40             :                               Real heated_length,
      41             :                               Real unheated_length_exit,
      42             :                               unsigned int n_cells,
      43             :                               std::vector<Real> & z_grid)
      44             : {
      45         434 :   Real L = unheated_length_entry + heated_length + unheated_length_exit;
      46         434 :   Real dz = L / n_cells;
      47        9935 :   for (unsigned int i = 0; i < n_cells + 1; i++)
      48        9501 :     z_grid.push_back(dz * i);
      49         434 : }
      50             : 
      51             : unsigned int
      52     1951867 : SubChannelMesh::getZIndex(const Point & point) const
      53             : {
      54     1951867 :   if (_z_grid.size() == 0)
      55           0 :     mooseError("_z_grid is empty.");
      56             : 
      57     1951867 :   if (point(2) <= _z_grid[0])
      58             :     return 0;
      59     1904546 :   if (point(2) >= _z_grid[_z_grid.size() - 1])
      60       29204 :     return _z_grid.size() - 1;
      61             : 
      62             :   unsigned int lo = 0;
      63     1875342 :   unsigned int hi = _z_grid.size();
      64    10861163 :   while (lo < hi)
      65             :   {
      66     8985821 :     unsigned int mid = (lo + hi) / 2;
      67     8985821 :     if (std::abs(_z_grid[mid] - point(2)) < 1e-5)
      68     1875342 :       return mid;
      69     7110479 :     else if (_z_grid[mid] < point(2))
      70             :       lo = mid;
      71             :     else
      72             :       hi = mid;
      73             :   }
      74             :   return lo;
      75             : }

Generated by: LCOV version 1.14