LCOV - code coverage report
Current view: top level - src/raybcs - ViewFactorRayBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 15 16 93.8 %
Date: 2025-09-04 07:53:51 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 "ViewFactorRayBC.h"
      11             : #include "ViewFactorRayStudy.h"
      12             : 
      13             : registerMooseObject("HeatTransferApp", ViewFactorRayBC);
      14             : 
      15             : InputParameters
      16         352 : ViewFactorRayBC::validParams()
      17             : {
      18         352 :   InputParameters params = GeneralRayBC::validParams();
      19         352 :   params.addClassDescription("This ray boundary condition is applied on all sidesets bounding a "
      20             :                              "radiation cavity except symmetry sidesets. It kills rays that hit "
      21             :                              "the sideset and scores the ray for computation of view factors.");
      22         352 :   return params;
      23           0 : }
      24             : 
      25         187 : ViewFactorRayBC::ViewFactorRayBC(const InputParameters & params)
      26             :   : GeneralRayBC(params),
      27         187 :     _vf_study(getStudy<ViewFactorRayStudy>()),
      28         187 :     _ray_index_start_bnd_id(_vf_study.rayIndexStartBndID()),
      29         187 :     _ray_index_start_total_weight(_vf_study.rayIndexStartTotalWeight())
      30             : {
      31         187 : }
      32             : 
      33             : void
      34    22971762 : ViewFactorRayBC::onBoundary(const unsigned int num_applying)
      35             : {
      36             :   // The boundary ID this Ray started on
      37    22971762 :   const BoundaryID start_bnd_id = currentRay()->auxData(_ray_index_start_bnd_id);
      38             :   // Starting total weight
      39    22971762 :   const Real start_total_weight = currentRay()->auxData(_ray_index_start_total_weight);
      40             :   // Value to append (divide by num_applying if we hit an edge or node)
      41    22971762 :   const Real value = start_total_weight / (Real)num_applying;
      42             :   mooseAssert(!std::isnan(value), "Encountered NaN");
      43             : 
      44             :   // Accumulate into the view factor info
      45    22971762 :   _vf_study.addToViewFactorInfo(value, start_bnd_id, _current_bnd_id, _tid);
      46             : 
      47             :   // Either hit an obstacle here or hit its end and contributed: done with this Ray
      48             :   currentRay()->setShouldContinue(false);
      49    22971762 : }

Generated by: LCOV version 1.14