LCOV - code coverage report
Current view: top level - src/components - HSBoundaryRadiation.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 46 48 95.8 %
Date: 2025-07-30 13:02:48 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14