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 "HSBoundaryExternalAppConvection.h" 11 : #include "HeatStructureCylindricalBase.h" 12 : #include "HeatConductionModel.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", HSBoundaryExternalAppConvection); 15 : 16 : InputParameters 17 36 : HSBoundaryExternalAppConvection::validParams() 18 : { 19 36 : InputParameters params = HSBoundary::validParams(); 20 : 21 72 : params.addParam<VariableName>("T_ext", "T_ext", "Temperature from external application"); 22 72 : params.addParam<VariableName>( 23 : "htc_ext", "htc_ext", "Heat transfer coefficient from external application"); 24 72 : params.addDeprecatedParam<PostprocessorName>( 25 : "scale_pp", 26 : "Post-processor by which to scale boundary condition", 27 : "The 'scale' parameter is replacing the 'scale_pp' parameter. 'scale' is a function " 28 : "parameter instead of a post-processor parameter. If you need to scale from a post-processor " 29 : "value, use a PostprocessorFunction."); 30 72 : params.addParam<FunctionName>("scale", 1.0, "Function by which to scale the boundary condition"); 31 72 : params.addParam<bool>( 32 : "scale_heat_rate_pp", 33 72 : true, 34 : "If true, the scaling function is applied to the heat rate post-processor."); 35 : 36 36 : params.addClassDescription("Heat structure boundary condition to perform convective heat " 37 : "transfer with an external application"); 38 36 : return params; 39 0 : } 40 : 41 18 : HSBoundaryExternalAppConvection::HSBoundaryExternalAppConvection(const InputParameters & params) 42 : : HSBoundary(params), 43 : 44 18 : _T_ext_var_name(getParam<VariableName>("T_ext")), 45 54 : _htc_ext_var_name(getParam<VariableName>("htc_ext")) 46 : { 47 18 : } 48 : 49 : void 50 18 : HSBoundaryExternalAppConvection::addVariables() 51 : { 52 36 : const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs"); 53 : const std::vector<SubdomainName> & subdomain_names = 54 18 : hs.getGeometricalComponent().getSubdomainNames(); 55 : 56 18 : getTHMProblem().addSimVariable( 57 : false, _T_ext_var_name, HeatConductionModel::feType(), subdomain_names); 58 18 : getTHMProblem().addSimVariable( 59 : false, _htc_ext_var_name, HeatConductionModel::feType(), subdomain_names); 60 18 : } 61 : 62 : void 63 18 : HSBoundaryExternalAppConvection::addMooseObjects() 64 : { 65 18 : const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs"); 66 : const HeatStructureCylindricalBase * hs_cyl = 67 18 : dynamic_cast<const HeatStructureCylindricalBase *>(&hs); 68 : const bool is_cylindrical = hs_cyl != nullptr; 69 : 70 : { 71 : const std::string class_name = is_cylindrical ? "ADExternalAppConvectionHeatTransferRZBC" 72 36 : : "ADExternalAppConvectionHeatTransferBC"; 73 18 : InputParameters pars = _factory.getValidParams(class_name); 74 36 : pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE; 75 18 : pars.set<std::vector<BoundaryName>>("boundary") = _boundary; 76 54 : pars.set<std::vector<VariableName>>("T_ext") = {_T_ext_var_name}; 77 54 : pars.set<std::vector<VariableName>>("htc_ext") = {_htc_ext_var_name}; 78 18 : if (is_cylindrical) 79 : { 80 0 : pars.set<Point>("axis_point") = hs_cyl->getPosition(); 81 0 : pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection(); 82 : } 83 54 : pars.set<FunctionName>("scale") = getParam<FunctionName>("scale"); 84 36 : if (isParamValid("scale_pp")) 85 0 : pars.set<PostprocessorName>("scale_pp") = getParam<PostprocessorName>("scale_pp"); 86 : 87 36 : getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars); 88 18 : } 89 : 90 : // Create integral PP for cylindrical heat structures 91 18 : if (is_cylindrical) 92 : { 93 0 : const std::string class_name = "HeatRateExternalAppConvectionRZ"; 94 0 : InputParameters pars = _factory.getValidParams(class_name); 95 0 : pars.set<std::vector<BoundaryName>>("boundary") = _boundary; 96 0 : pars.set<std::vector<VariableName>>("T") = {HeatConductionModel::TEMPERATURE}; 97 0 : pars.set<std::vector<VariableName>>("T_ext") = {_T_ext_var_name}; 98 0 : pars.set<std::vector<VariableName>>("htc_ext") = {_htc_ext_var_name}; 99 0 : pars.set<Point>("axis_point") = hs_cyl->getPosition(); 100 0 : pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection(); 101 0 : if (getParam<bool>("scale_heat_rate_pp")) 102 0 : pars.set<FunctionName>("scale") = getParam<FunctionName>("scale"); 103 0 : pars.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END}; 104 0 : getTHMProblem().addPostprocessor(class_name, genSafeName(name(), "integral"), pars); 105 0 : } 106 54 : }