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 "HSBoundaryHeatFlux.h" 11 : #include "HeatConductionModel.h" 12 : #include "HeatStructureInterface.h" 13 : #include "HeatStructureCylindricalBase.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", HSBoundaryHeatFlux); 16 : 17 : InputParameters 18 132 : HSBoundaryHeatFlux::validParams() 19 : { 20 132 : InputParameters params = HSBoundary::validParams(); 21 : 22 264 : params.addRequiredParam<FunctionName>("q", "Heat flux [W/m^2]"); 23 264 : params.addDeprecatedParam<PostprocessorName>( 24 : "scale_pp", 25 : "Post-processor by which to scale boundary condition", 26 : "The 'scale' parameter is replacing the 'scale_pp' parameter. 'scale' is a function " 27 : "parameter instead of a post-processor parameter. If you need to scale from a post-processor " 28 : "value, use a PostprocessorFunction."); 29 264 : params.addParam<FunctionName>("scale", 1.0, "Function by which to scale the boundary condition"); 30 264 : params.addParam<bool>( 31 : "scale_heat_rate_pp", 32 264 : true, 33 : "If true, the scaling function is applied to the heat rate post-processor."); 34 : 35 132 : params.addClassDescription("Applies a specified heat flux to a heat structure boundary"); 36 : 37 132 : return params; 38 0 : } 39 : 40 66 : HSBoundaryHeatFlux::HSBoundaryHeatFlux(const InputParameters & params) 41 : : HSBoundary(params), 42 : 43 132 : _q_fn_name(getParam<FunctionName>("q")) 44 : { 45 66 : } 46 : 47 : void 48 62 : HSBoundaryHeatFlux::addMooseObjects() 49 : { 50 62 : const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs"); 51 : const HeatStructureCylindricalBase * hs_cyl = 52 62 : dynamic_cast<const HeatStructureCylindricalBase *>(&hs); 53 : const bool is_cylindrical = hs_cyl != nullptr; 54 : 55 : { 56 106 : const std::string class_name = is_cylindrical ? "ADHSHeatFluxRZBC" : "ADHSHeatFluxBC"; 57 62 : InputParameters pars = _factory.getValidParams(class_name); 58 124 : pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE; 59 62 : pars.set<std::vector<BoundaryName>>("boundary") = _boundary; 60 62 : pars.set<FunctionName>("function") = _q_fn_name; 61 62 : if (is_cylindrical) 62 : { 63 18 : pars.set<Point>("axis_point") = hs_cyl->getPosition(); 64 18 : pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection(); 65 : } 66 186 : pars.set<FunctionName>("scale") = getParam<FunctionName>("scale"); 67 124 : if (isParamValid("scale_pp")) 68 0 : pars.set<PostprocessorName>("scale_pp") = getParam<PostprocessorName>("scale_pp"); 69 : 70 124 : getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars); 71 62 : } 72 : 73 : // Create integral PP for cylindrical heat structures 74 62 : if (is_cylindrical) 75 : { 76 18 : const std::string class_name = "HeatRateHeatFluxRZ"; 77 18 : InputParameters pars = _factory.getValidParams(class_name); 78 18 : pars.set<std::vector<BoundaryName>>("boundary") = _boundary; 79 18 : pars.set<FunctionName>("function") = _q_fn_name; 80 18 : pars.set<Point>("axis_point") = hs_cyl->getPosition(); 81 18 : pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection(); 82 36 : if (getParam<bool>("scale_heat_rate_pp")) 83 54 : pars.set<FunctionName>("scale") = getParam<FunctionName>("scale"); 84 72 : pars.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END}; 85 36 : getTHMProblem().addPostprocessor(class_name, genSafeName(name(), "integral"), pars); 86 18 : } 87 80 : }