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 "HeatSourceBase.h" 11 : #include "HeatStructureBase.h" 12 : #include "HeatStructureInterface.h" 13 : #include "HeatStructureFromFile3D.h" 14 : 15 : InputParameters 16 492 : HeatSourceBase::validParams() 17 : { 18 492 : InputParameters params = Component::validParams(); 19 984 : params.addRequiredParam<std::string>("hs", "Heat structure in which to apply heat source"); 20 984 : params.addRequiredParam<std::vector<std::string>>( 21 : "regions", "Heat structure regions where heat generation is to be applied"); 22 492 : params.addClassDescription("Base class for heat source components"); 23 492 : return params; 24 0 : } 25 : 26 246 : HeatSourceBase::HeatSourceBase(const InputParameters & parameters) 27 : : Component(parameters), 28 246 : _hs_name(getParam<std::string>("hs")), 29 738 : _region_names(getParam<std::vector<std::string>>("regions")) 30 : { 31 246 : checkSizeGreaterThan<std::string>("regions", 0); 32 : 33 508 : for (auto && region : _region_names) 34 524 : _subdomain_names.push_back(genName(_hs_name, region)); 35 246 : } 36 : 37 : void 38 246 : HeatSourceBase::check() const 39 : { 40 246 : Component::check(); 41 : 42 246 : checkComponentOfTypeExists<HeatStructureInterface>("hs"); 43 : 44 492 : if (hasComponent<HeatStructureBase>("hs")) 45 : { 46 226 : const HeatStructureBase & hs = getComponent<HeatStructureBase>("hs"); 47 468 : for (auto && region : _region_names) 48 242 : if (!hs.hasBlock(region)) 49 12 : logError("Region '", 50 : region, 51 : "' does not exist in heat structure '", 52 : getParam<std::string>("hs"), 53 : "'."); 54 : } 55 40 : else if (hasComponent<HeatStructureFromFile3D>("hs")) 56 : { 57 16 : const HeatStructureFromFile3D & hs = getComponent<HeatStructureFromFile3D>("hs"); 58 32 : for (auto && region : _region_names) 59 16 : if (!hs.hasRegion(region)) 60 0 : logError("Region '", 61 : region, 62 : "' does not exist in heat structure '", 63 : getParam<std::string>("hs"), 64 : "'."); 65 : } 66 : else 67 4 : logError("Heat structure must be of type 'HeatStructureBase' or 'HeatStructureFromFile3D'."); 68 246 : }