LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - SurfaceRadiationVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 39 41 95.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 "SurfaceRadiationVectorPostprocessor.h"
      11             : #include "GrayLambertSurfaceRadiationBase.h"
      12             : #include <limits>
      13             : #include "libmesh/utility.h"
      14             : 
      15             : registerMooseObject("HeatTransferApp", SurfaceRadiationVectorPostprocessor);
      16             : 
      17             : InputParameters
      18          30 : SurfaceRadiationVectorPostprocessor::validParams()
      19             : {
      20          30 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      21          30 :   params.addClassDescription(
      22             :       "VectorPostprocessor for accessing information stored in surface radiation user object");
      23          60 :   params.addRequiredParam<UserObjectName>("surface_radiation_object_name",
      24             :                                           "Name of the GrayLambertSurfaceRadiationBase UO");
      25             :   MultiMooseEnum information_type("temperature=0 heat_flux_density=1 radiosity=2 emissivity=3",
      26          30 :                                   "temperature");
      27          60 :   params.addParam<MultiMooseEnum>(
      28             :       "information",
      29             :       information_type,
      30             :       "The type of information to obtain from surface radiation user object");
      31          30 :   return params;
      32          30 : }
      33             : 
      34           9 : SurfaceRadiationVectorPostprocessor::SurfaceRadiationVectorPostprocessor(
      35           9 :     const InputParameters & parameters)
      36             :   : GeneralVectorPostprocessor(parameters),
      37           9 :     _glsr_uo(getUserObject<GrayLambertSurfaceRadiationBase>("surface_radiation_object_name")),
      38          18 :     _information_types(getParam<MultiMooseEnum>("information")),
      39           9 :     _n_data(_information_types.size()),
      40           9 :     _data(_n_data),
      41          18 :     _surface_ids(declareVector("subdomain_id"))
      42             : {
      43          45 :   for (unsigned int j = 0; j < _n_data; ++j)
      44          36 :     _data[j] = &declareVector(_information_types[j]);
      45           9 : }
      46             : 
      47             : void
      48           9 : SurfaceRadiationVectorPostprocessor::initialize()
      49             : {
      50           9 :   std::set<BoundaryID> bids = _glsr_uo.getSurfaceIDs();
      51           9 :   _surface_ids.resize(bids.size());
      52          45 :   for (unsigned int j = 0; j < _n_data; ++j)
      53          36 :     _data[j]->resize(bids.size());
      54             :   unsigned int j = 0;
      55          45 :   for (auto & bid : bids)
      56             :   {
      57          36 :     _surface_ids[j] = bid;
      58          36 :     ++j;
      59             :   }
      60           9 : }
      61             : 
      62             : void
      63           9 : SurfaceRadiationVectorPostprocessor::execute()
      64             : {
      65          45 :   for (unsigned int i = 0; i < _n_data; ++i)
      66             :   {
      67          36 :     switch (_information_types.get(i))
      68             :     {
      69             :       case 0:
      70          45 :         for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      71          36 :           (*_data[i])[j] = _glsr_uo.getSurfaceTemperature(_surface_ids[j]);
      72             :         break;
      73             :       case 1:
      74          45 :         for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      75          36 :           (*_data[i])[j] = _glsr_uo.getSurfaceHeatFluxDensity(_surface_ids[j]);
      76             :         break;
      77             :       case 2:
      78          45 :         for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      79          36 :           (*_data[i])[j] = _glsr_uo.getSurfaceRadiosity(_surface_ids[j]);
      80             :         break;
      81             :       case 3:
      82          45 :         for (unsigned int j = 0; j < _surface_ids.size(); ++j)
      83          36 :           (*_data[i])[j] = _glsr_uo.getSurfaceEmissivity(_surface_ids[j]);
      84             :         break;
      85           0 :       default:
      86           0 :         mooseError("Unrecognized information type. This should never happen");
      87             :         break;
      88             :     }
      89             :   }
      90           9 : }

Generated by: LCOV version 1.14