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 "ConstantViewFactorSurfaceRadiation.h" 11 : 12 : registerMooseObjectDeprecated("HeatTransferApp", 13 : ConstantViewFactorSurfaceRadiation, 14 : "08/30/2026 24:00"); 15 : 16 : InputParameters 17 38 : ConstantViewFactorSurfaceRadiation::validParams() 18 : { 19 38 : InputParameters params = GrayLambertSurfaceRadiationBase::validParams(); 20 76 : params.addRequiredParam<std::vector<std::vector<Real>>>( 21 : "view_factors", "The view factors from sideset i to sideset j."); 22 38 : params.addClassDescription( 23 : "ConstantViewFactorSurfaceRadiation computes radiative heat transfer between side sets and " 24 : "the view factors are provided in the input file"); 25 38 : return params; 26 0 : } 27 : 28 20 : ConstantViewFactorSurfaceRadiation::ConstantViewFactorSurfaceRadiation( 29 20 : const InputParameters & parameters) 30 20 : : GrayLambertSurfaceRadiationBase(parameters) 31 : { 32 20 : mooseDeprecated("ConstantViewFactorSurfaceRadiation is deprecated. Please use " 33 : "ViewFactorObjectSurfaceRadiation in conjunction with SpecifiedViewFactor to " 34 : "achieve the same effect as this object."); 35 20 : } 36 : 37 : std::vector<std::vector<Real>> 38 3119 : ConstantViewFactorSurfaceRadiation::setViewFactors() 39 : { 40 9357 : std::vector<std::vector<Real>> vf = getParam<std::vector<std::vector<Real>>>("view_factors"); 41 : 42 : // check that the input has the right format 43 3119 : if (vf.size() != _n_sides) 44 0 : paramError("view_factors", 45 : "Leading dimension of view_factors must be equal to number of side sets."); 46 : 47 15595 : for (unsigned int i = 0; i < _n_sides; ++i) 48 12476 : if (vf[i].size() != _n_sides) 49 0 : paramError("view_factors", 50 : "view_factors must be provided as square array. Row ", 51 : i, 52 : " has ", 53 : vf[i].size(), 54 : " entries."); 55 3119 : return vf; 56 0 : } 57 : 58 : void 59 3119 : ConstantViewFactorSurfaceRadiation::initialize() 60 : { 61 3119 : GrayLambertSurfaceRadiationBase::initialize(); 62 : 63 : // check row-sum and normalize if necessary 64 15595 : for (unsigned int i = 0; i < _n_sides; ++i) 65 : { 66 12476 : Real sum = 0; 67 62380 : for (auto & v : _view_factors[i]) 68 49904 : sum += v; 69 : 70 : // an error of 5% is acceptable, but more indicates an error in the 71 : // problem setup 72 24952 : if (std::abs(sum - 1) > 0.05) 73 0 : mooseError("view_factors row ", i, " sums to ", sum); 74 : 75 : // correct view factors 76 62380 : for (auto & v : _view_factors[i]) 77 49904 : v /= sum; 78 : } 79 3119 : }