LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - ViewFactorVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 40 47 85.1 %
Date: 2026-05-29 20:37:03 Functions: 4 4 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 "ViewFactorVectorPostprocessor.h"
      11             : #include "ViewFactorBase.h"
      12             : #include "GrayLambertSurfaceRadiationBase.h"
      13             : 
      14             : registerMooseObject("HeatTransferApp", ViewFactorVectorPostprocessor);
      15             : registerMooseObjectRenamed("HeatTransferApp",
      16             :                            ViewfactorVectorPostprocessor,
      17             :                            "08/30/2026 24:00",
      18             :                            ViewFactorVectorPostprocessor);
      19             : 
      20             : InputParameters
      21          30 : ViewFactorVectorPostprocessor::validParams()
      22             : {
      23          30 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      24          30 :   params.addClassDescription(
      25             :       "VectorPostprocessor for accessing view factors from GrayLambertSurfaceRadiationBase UO");
      26          60 :   params.addParam<UserObjectName>("view_factor_object_name", "Name of the ViewFactorBase UO");
      27             :   // TODO: after deleting this parameter, make 'view_factor_object_name' required
      28             :   // and delete the associated error checks
      29          60 :   params.addDeprecatedParam<UserObjectName>("surface_radiation_object_name",
      30             :                                             "Name of the GrayLambertSurfaceRadiationBase UO",
      31             :                                             "Please use 'view_factor_object_name' instead.");
      32          30 :   return params;
      33           0 : }
      34             : 
      35           9 : ViewFactorVectorPostprocessor::ViewFactorVectorPostprocessor(const InputParameters & parameters)
      36             :   : GeneralVectorPostprocessor(parameters),
      37          27 :     _view_factor_uo(isParamValid("view_factor_object_name")
      38          18 :                         ? &getUserObject<ViewFactorBase>("view_factor_object_name")
      39             :                         : nullptr),
      40           9 :     _glsr_uo(isParamValid("surface_radiation_object_name")
      41           9 :                  ? &getUserObject<GrayLambertSurfaceRadiationBase>("surface_radiation_object_name")
      42             :                  : nullptr),
      43          18 :     _surface_ids(declareVector("subdomain_id"))
      44             : {
      45          45 :   if (!isParamValid("surface_radiation_object_name") && !isParamValid("view_factor_object_name"))
      46           0 :     mooseError("The parameter 'view_factor_object_name' must be provided.");
      47          18 :   if (isParamValid("surface_radiation_object_name") && isParamValid("view_factor_object_name"))
      48           0 :     mooseError("The parameters 'surface_radiation_object_name' and 'view_factor_object_name' "
      49             :                "cannot both be provided. Please delete 'surface_radiation_object_name'.");
      50           9 : }
      51             : 
      52             : void
      53           9 : ViewFactorVectorPostprocessor::initialize()
      54             : {
      55             :   // setup of surface_id arrays
      56             :   std::set<BoundaryID> bids;
      57           9 :   if (_glsr_uo)
      58           0 :     bids = _glsr_uo->getSurfaceIDs();
      59           9 :   if (_view_factor_uo)
      60           9 :     bids = _view_factor_uo->boundaryIDs();
      61             : 
      62           9 :   unsigned int ns = bids.size();
      63           9 :   _surface_ids.resize(ns);
      64             :   unsigned int j = 0;
      65          45 :   for (auto & bid : bids)
      66             :   {
      67          36 :     _surface_ids[j] = bid;
      68          36 :     ++j;
      69             :   }
      70             : 
      71             :   // setup of view factors
      72           9 :   j = _vf.size();
      73           9 :   _vf.resize(ns);
      74          41 :   for (; j < ns; ++j)
      75             :   {
      76          32 :     std::stringstream ss;
      77          32 :     ss << "vf_to_" << _surface_ids[j];
      78          32 :     _vf[j] = &declareVector(ss.str());
      79          32 :     _vf[j]->resize(ns);
      80          32 :   }
      81           9 : }
      82             : 
      83             : void
      84           9 : ViewFactorVectorPostprocessor::execute()
      85             : {
      86           9 :   if (_view_factor_uo)
      87             :   {
      88          45 :     for (unsigned int i = 0; i < _surface_ids.size(); ++i)
      89         180 :       for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      90         144 :         (*_vf[j])[i] = _view_factor_uo->getViewFactor(_surface_ids[i], _surface_ids[j]);
      91             :   }
      92             : 
      93           9 :   if (_glsr_uo)
      94             :   {
      95           0 :     for (unsigned int i = 0; i < _surface_ids.size(); ++i)
      96           0 :       for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      97           0 :         (*_vf[j])[i] = _glsr_uo->getViewFactor(_surface_ids[i], _surface_ids[j]);
      98             :   }
      99           9 : }

Generated by: LCOV version 1.14