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 54 : SurfaceRadiationVectorPostprocessor::validParams() 19 : { 20 54 : InputParameters params = GeneralVectorPostprocessor::validParams(); 21 54 : params.addClassDescription( 22 : "VectorPostprocessor for accessing information stored in surface radiation user object"); 23 108 : 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 54 : "temperature"); 27 108 : params.addParam<MultiMooseEnum>( 28 : "information", 29 : information_type, 30 : "The type of information to obtain from surface radiation user object"); 31 54 : return params; 32 54 : } 33 : 34 23 : SurfaceRadiationVectorPostprocessor::SurfaceRadiationVectorPostprocessor( 35 23 : const InputParameters & parameters) 36 : : GeneralVectorPostprocessor(parameters), 37 23 : _glsr_uo(getUserObject<GrayLambertSurfaceRadiationBase>("surface_radiation_object_name")), 38 46 : _information_types(getParam<MultiMooseEnum>("information")), 39 23 : _n_data(_information_types.size()), 40 23 : _data(_n_data), 41 46 : _surface_ids(declareVector("subdomain_id")) 42 : { 43 115 : for (unsigned int j = 0; j < _n_data; ++j) 44 92 : _data[j] = &declareVector(_information_types[j]); 45 23 : } 46 : 47 : void 48 15 : SurfaceRadiationVectorPostprocessor::initialize() 49 : { 50 15 : std::set<BoundaryID> bids = _glsr_uo.getSurfaceIDs(); 51 15 : _surface_ids.resize(bids.size()); 52 75 : for (unsigned int j = 0; j < _n_data; ++j) 53 60 : _data[j]->resize(bids.size()); 54 : unsigned int j = 0; 55 75 : for (auto & bid : bids) 56 : { 57 60 : _surface_ids[j] = bid; 58 60 : ++j; 59 : } 60 15 : } 61 : 62 : void 63 15 : SurfaceRadiationVectorPostprocessor::execute() 64 : { 65 75 : for (unsigned int i = 0; i < _n_data; ++i) 66 : { 67 60 : switch (_information_types.get(i)) 68 : { 69 : case 0: 70 75 : for (unsigned int j = 0; j < _surface_ids.size(); ++j) 71 60 : (*_data[i])[j] = _glsr_uo.getSurfaceTemperature(_surface_ids[j]); 72 : break; 73 : case 1: 74 75 : for (unsigned int j = 0; j < _surface_ids.size(); ++j) 75 60 : (*_data[i])[j] = _glsr_uo.getSurfaceHeatFluxDensity(_surface_ids[j]); 76 : break; 77 : case 2: 78 75 : for (unsigned int j = 0; j < _surface_ids.size(); ++j) 79 60 : (*_data[i])[j] = _glsr_uo.getSurfaceRadiosity(_surface_ids[j]); 80 : break; 81 : case 3: 82 75 : for (unsigned int j = 0; j < _surface_ids.size(); ++j) 83 60 : (*_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 15 : }