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 "HeatStructure2DRadiationCouplerRZ.h" 11 : #include "HeatStructureCylindricalBase.h" 12 : #include "HeatConductionNames.h" 13 : #include "THMMesh.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", HeatStructure2DRadiationCouplerRZ); 16 : 17 : InputParameters 18 92 : HeatStructure2DRadiationCouplerRZ::validParams() 19 : { 20 92 : InputParameters params = HeatStructure2DCouplerBase::validParams(); 21 : 22 184 : params.addRequiredParam<Real>("primary_emissivity", "Emissivity for the primary side"); 23 184 : params.addRequiredParam<Real>("secondary_emissivity", "Emissivity for the secondary side"); 24 184 : params.addParam<Real>("stefan_boltzmann_constant", 25 : HeatConduction::Constants::sigma, 26 : "Stefan Boltzmann constant [W/(m^2-K^4)]. This constant is provided as a " 27 : "parameter to allow different precisions."); 28 : 29 92 : params.addClassDescription( 30 : "Couples boundaries of two 2D cylindrical heat structures via radiation"); 31 : 32 92 : return params; 33 0 : } 34 : 35 46 : HeatStructure2DRadiationCouplerRZ::HeatStructure2DRadiationCouplerRZ( 36 46 : const InputParameters & parameters) 37 : : HeatStructure2DCouplerBase(parameters), 38 : 39 184 : _emissivities({getParam<Real>("primary_emissivity"), getParam<Real>("secondary_emissivity")}) 40 : { 41 46 : } 42 : 43 : void 44 46 : HeatStructure2DRadiationCouplerRZ::init() 45 : { 46 46 : HeatStructure2DCouplerBase::init(); 47 : 48 : if (hasComponentByName<HeatStructureBase>(_hs_names[0]) && 49 46 : hasComponentByName<HeatStructureBase>(_hs_names[1]) && _hs_side_types.size() == 2) 50 : { 51 44 : _view_factors.resize(2); 52 44 : if (_areas[0] > _areas[1]) 53 : { 54 0 : _view_factors[0] = _areas[1] / _areas[0]; 55 0 : _view_factors[1] = 1.0; 56 : } 57 : else 58 : { 59 44 : _view_factors[0] = 1.0; 60 44 : _view_factors[1] = _areas[0] / _areas[1]; 61 : } 62 : } 63 46 : } 64 : 65 : void 66 46 : HeatStructure2DRadiationCouplerRZ::check() const 67 : { 68 46 : HeatStructure2DCouplerBase::check(); 69 : 70 46 : if (!_is_cylindrical[0] || !_is_cylindrical[1]) 71 2 : logError("The primary and secondary heat structures must be of a type inherited from " 72 : "'HeatStructureCylindricalBase'."); 73 : 74 46 : if (!_mesh_alignment.meshesAreAligned()) 75 4 : logError("The primary and secondary boundaries must be aligned."); 76 : 77 : if (hasComponentByName<HeatStructureBase>(_hs_names[0]) && 78 : hasComponentByName<HeatStructureBase>(_hs_names[1])) 79 : { 80 : const HeatStructureBase & primary_hs = getComponentByName<HeatStructureBase>(_hs_names[0]); 81 : const HeatStructureBase & secondary_hs = getComponentByName<HeatStructureBase>(_hs_names[1]); 82 46 : if (primary_hs.hasBoundary(_hs_boundaries[0]) && secondary_hs.hasBoundary(_hs_boundaries[1])) 83 : { 84 44 : if (_hs_side_types[0] == Component2D::ExternalBoundaryType::START || 85 44 : _hs_side_types[0] == Component2D::ExternalBoundaryType::END || 86 88 : _hs_side_types[1] == Component2D::ExternalBoundaryType::START || 87 : _hs_side_types[1] == Component2D::ExternalBoundaryType::END) 88 0 : logError("The primary and secondary boundaries must be radial boundaries."); 89 : } 90 : } 91 46 : } 92 : 93 : void 94 36 : HeatStructure2DRadiationCouplerRZ::addMooseObjects() 95 : { 96 36 : HeatStructure2DCouplerBase::addMooseObjects(); 97 : 98 108 : for (unsigned int i = 0; i < 2; i++) 99 : { 100 72 : const unsigned int j = i == 0 ? 1 : 0; 101 : 102 72 : const auto & hs_cyl = getComponentByName<HeatStructureCylindricalBase>(_hs_names[i]); 103 : 104 72 : const std::string class_name = "HeatStructure2DRadiationCouplerRZBC"; 105 72 : InputParameters params = _factory.getValidParams(class_name); 106 144 : params.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE; 107 144 : params.set<std::string>("coupled_variable") = HeatConductionModel::TEMPERATURE; 108 216 : params.set<std::vector<BoundaryName>>("boundary") = {_hs_boundaries[i]}; 109 72 : params.set<MeshAlignment *>("_mesh_alignment") = &_mesh_alignment; 110 72 : params.set<Real>("emissivity") = _emissivities[i]; 111 72 : params.set<Real>("coupled_emissivity") = _emissivities[j]; 112 72 : params.set<Real>("view_factor") = _view_factors[i]; 113 72 : params.set<Real>("area") = _areas[i]; 114 72 : params.set<Real>("coupled_area") = _areas[j]; 115 144 : params.set<Real>("stefan_boltzmann_constant") = getParam<Real>("stefan_boltzmann_constant"); 116 72 : params.set<Point>("axis_point") = hs_cyl.getPosition(); 117 72 : params.set<RealVectorValue>("axis_dir") = hs_cyl.getDirection(); 118 72 : getTHMProblem().addBoundaryCondition(class_name, genName(name(), class_name, i), params); 119 72 : } 120 36 : }