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 "HeatStructureCylindrical.h" 11 : 12 : registerMooseObject("ThermalHydraulicsApp", HeatStructureCylindrical); 13 : 14 : InputParameters 15 1452 : HeatStructureCylindrical::validParams() 16 : { 17 1452 : InputParameters params = HeatStructureCylindricalBase::validParams(); 18 : 19 2904 : params.addRequiredParam<std::vector<std::string>>("names", "Name of each radial region"); 20 2904 : params.addRequiredParam<std::vector<Real>>("widths", "Width of each radial region [m]"); 21 2904 : params.addRequiredParam<std::vector<unsigned int>>("n_part_elems", 22 : "Number of elements of each radial region"); 23 2904 : params.addParam<std::vector<UserObjectName>>( 24 : "solid_properties", "Solid properties object name for each radial region"); 25 2904 : params.addParam<std::vector<Real>>( 26 : "solid_properties_T_ref", 27 : {}, 28 : "Density reference temperatures for each radial region. This is required if " 29 : "'solid_properties' is provided. The density in each region will be a constant value " 30 : "computed by evaluating the density function at the reference temperature."); 31 2904 : params.addParam<Real>("num_rods", 1.0, "Number of rods represented by this heat structure"); 32 2904 : params.addParam<Real>("inner_radius", 0., "Inner radius of the heat structure [m]"); 33 : 34 1452 : params.addClassDescription("Cylindrical heat structure"); 35 : 36 1452 : return params; 37 0 : } 38 : 39 726 : HeatStructureCylindrical::HeatStructureCylindrical(const InputParameters & params) 40 726 : : HeatStructureCylindricalBase(params) 41 : { 42 2178 : _names = getParam<std::vector<std::string>>("names"); 43 726 : _n_regions = _names.size(); 44 1788 : for (unsigned int i = 0; i < _names.size(); i++) 45 1062 : _name_index[_names[i]] = i; 46 : 47 2178 : _width = getParam<std::vector<Real>>("widths"); 48 726 : _total_width = std::accumulate(_width.begin(), _width.end(), 0.0); 49 : 50 1452 : _n_part_elems = getParam<std::vector<unsigned int>>("n_part_elems"); 51 1784 : for (unsigned int i = 0; i < _n_part_elems.size(); i++) 52 1058 : _total_elem_number += _n_part_elems[i]; 53 : 54 1452 : _num_rods = getParam<Real>("num_rods"); 55 : 56 1452 : _inner_radius = getParam<Real>("inner_radius"); 57 : 58 726 : if (_width.size() == _n_regions) 59 : { 60 724 : std::vector<Real> r(_n_regions + 1, _inner_radius); 61 1780 : for (unsigned int i = 0; i < _n_regions; i++) 62 : { 63 1056 : r[i + 1] = r[i] + _width[i]; 64 1056 : _volume.push_back(_num_rods * M_PI * (r[i + 1] * r[i + 1] - r[i] * r[i]) * _length); 65 : } 66 724 : } 67 726 : } 68 : 69 : void 70 720 : HeatStructureCylindrical::check() const 71 : { 72 720 : HeatStructureCylindricalBase::check(); 73 : 74 1440 : checkEqualSize<std::string, unsigned int>("names", "n_part_elems"); 75 1440 : checkEqualSize<std::string, Real>("names", "widths"); 76 1440 : if (isParamValid("solid_properties")) 77 : { 78 1290 : checkEqualSize<UserObjectName, std::string>("solid_properties", "names"); 79 1290 : checkEqualSize<UserObjectName, Real>("solid_properties", "solid_properties_T_ref"); 80 : } 81 720 : }