LCOV - code coverage report
Current view: top level - src/components - HSBoundaryAmbientConvection.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 43 44 97.7 %
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 "HSBoundaryAmbientConvection.h"
      11             : #include "HeatConductionModel.h"
      12             : #include "HeatStructureCylindricalBase.h"
      13             : 
      14             : registerMooseObject("ThermalHydraulicsApp", HSBoundaryAmbientConvection);
      15             : 
      16             : InputParameters
      17         182 : HSBoundaryAmbientConvection::validParams()
      18             : {
      19         182 :   InputParameters params = HSBoundary::validParams();
      20             : 
      21         364 :   params.addRequiredParam<MooseFunctorName>(
      22             :       "htc_ambient", "Ambient Convective heat transfer coefficient functor [W/(m^2-K)]");
      23         364 :   params.addRequiredParam<MooseFunctorName>("T_ambient", "Ambient temperature functor [K]");
      24         364 :   params.addParam<MooseFunctorName>(
      25         364 :       "scale", 1.0, "Functor by which to scale the boundary condition");
      26         364 :   params.addParam<bool>(
      27             :       "scale_heat_rate_pp",
      28         364 :       true,
      29             :       "If true, the 'scale' parameter is also applied to the heat rate post-processor.");
      30             : 
      31         182 :   params.addClassDescription("Applies a convective boundary condition to a heat structure");
      32             : 
      33         182 :   return params;
      34           0 : }
      35             : 
      36          90 : HSBoundaryAmbientConvection::HSBoundaryAmbientConvection(const InputParameters & params)
      37          90 :   : HSBoundary(params)
      38             : {
      39          90 : }
      40             : 
      41             : void
      42          90 : HSBoundaryAmbientConvection::addMooseObjects()
      43             : {
      44          90 :   const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs");
      45             :   const HeatStructureCylindricalBase * hs_cyl =
      46          90 :       dynamic_cast<const HeatStructureCylindricalBase *>(&hs);
      47             :   const bool is_cylindrical = hs_cyl != nullptr;
      48             : 
      49             :   {
      50             :     const std::string class_name =
      51         124 :         is_cylindrical ? "ADConvectionHeatTransferRZBC" : "ADConvectionHeatTransferBC";
      52          90 :     InputParameters pars = _factory.getValidParams(class_name);
      53         180 :     pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
      54          90 :     pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
      55         270 :     pars.set<MooseFunctorName>("T_ambient") = getParam<MooseFunctorName>("T_ambient");
      56         270 :     pars.set<MooseFunctorName>("htc_ambient") = getParam<MooseFunctorName>("htc_ambient");
      57          90 :     if (is_cylindrical)
      58             :     {
      59          56 :       pars.set<Point>("axis_point") = hs_cyl->getPosition();
      60          56 :       pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
      61             :     }
      62         270 :     pars.set<MooseFunctorName>("scale") = getParam<MooseFunctorName>("scale");
      63             : 
      64         180 :     getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars);
      65          90 :   }
      66             : 
      67             :   // Create integral PP for cylindrical heat structures
      68          90 :   if (is_cylindrical)
      69             :   {
      70          56 :     const std::string class_name = "HeatRateConvectionRZ";
      71          56 :     InputParameters pars = _factory.getValidParams(class_name);
      72         112 :     pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
      73         168 :     pars.set<std::vector<VariableName>>("T") = {HeatConductionModel::TEMPERATURE};
      74         168 :     pars.set<MooseFunctorName>("T_ambient") = getParam<MooseFunctorName>("T_ambient");
      75         168 :     pars.set<MooseFunctorName>("htc") = getParam<MooseFunctorName>("htc_ambient");
      76          56 :     pars.set<Point>("axis_point") = hs_cyl->getPosition();
      77          56 :     pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
      78         112 :     if (getParam<bool>("scale_heat_rate_pp"))
      79         168 :       pars.set<MooseFunctorName>("scale") = getParam<MooseFunctorName>("scale");
      80         224 :     pars.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
      81         112 :     getTHMProblem().addPostprocessor(class_name, genSafeName(name(), "integral"), pars);
      82          56 :   }
      83         146 : }

Generated by: LCOV version 1.14