LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - ViewfactorVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 30 31 96.8 %
Date: 2025-09-04 07:53:51 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 "GrayLambertSurfaceRadiationBase.h"
      12             : 
      13             : registerMooseObject("HeatTransferApp", ViewfactorVectorPostprocessor);
      14             : 
      15             : InputParameters
      16          54 : ViewfactorVectorPostprocessor::validParams()
      17             : {
      18          54 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      19          54 :   params.addClassDescription(
      20             :       "VectorPostprocessor for accessing view factors from GrayLambertSurfaceRadiationBase UO");
      21         108 :   params.addRequiredParam<UserObjectName>("surface_radiation_object_name",
      22             :                                           "Name of the GrayLambertSurfaceRadiationBase UO");
      23          54 :   return params;
      24           0 : }
      25             : 
      26          23 : ViewfactorVectorPostprocessor::ViewfactorVectorPostprocessor(const InputParameters & parameters)
      27             :   : GeneralVectorPostprocessor(parameters),
      28          23 :     _glsr_uo(getUserObject<GrayLambertSurfaceRadiationBase>("surface_radiation_object_name")),
      29          46 :     _surface_ids(declareVector("subdomain_id"))
      30             : {
      31          23 : }
      32             : 
      33             : void
      34          15 : ViewfactorVectorPostprocessor::initialize()
      35             : {
      36             :   // setup of surface_id arrays
      37          15 :   std::set<BoundaryID> bids = _glsr_uo.getSurfaceIDs();
      38          15 :   unsigned int ns = bids.size();
      39          15 :   _surface_ids.resize(ns);
      40             :   unsigned int j = 0;
      41          75 :   for (auto & bid : bids)
      42             :   {
      43          60 :     _surface_ids[j] = bid;
      44          60 :     ++j;
      45             :   }
      46             : 
      47             :   // setup of view factors
      48          15 :   j = _vf.size();
      49          15 :   _vf.resize(ns);
      50          71 :   for (; j < ns; ++j)
      51             :   {
      52          56 :     std::stringstream ss;
      53          56 :     ss << "vf_to_" << _surface_ids[j];
      54          56 :     _vf[j] = &declareVector(ss.str());
      55          56 :     _vf[j]->resize(ns);
      56          56 :   }
      57          15 : }
      58             : 
      59             : void
      60          15 : ViewfactorVectorPostprocessor::execute()
      61             : {
      62          75 :   for (unsigned int i = 0; i < _surface_ids.size(); ++i)
      63         300 :     for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      64         240 :       (*_vf[j])[i] = _glsr_uo.getViewFactor(_surface_ids[i], _surface_ids[j]);
      65          15 : }

Generated by: LCOV version 1.14