LCOV - code coverage report
Current view: top level - src/components - HSBoundaryHeatFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 38 39 97.4 %
Date: 2026-05-29 20:41:18 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 "HSBoundaryHeatFlux.h"
      11             : #include "HeatConductionModel.h"
      12             : #include "HeatStructureInterface.h"
      13             : #include "HeatStructureCylindricalBase.h"
      14             : 
      15             : registerMooseObject("ThermalHydraulicsApp", HSBoundaryHeatFlux);
      16             : 
      17             : InputParameters
      18          68 : HSBoundaryHeatFlux::validParams()
      19             : {
      20          68 :   InputParameters params = HSBoundary::validParams();
      21             : 
      22         136 :   params.addRequiredParam<FunctionName>("q", "Heat flux [W/m^2]");
      23         136 :   params.addParam<FunctionName>("scale", 1.0, "Function by which to scale the boundary condition");
      24         136 :   params.addParam<bool>(
      25             :       "scale_heat_rate_pp",
      26         136 :       true,
      27             :       "If true, the scaling function is applied to the heat rate post-processor.");
      28             : 
      29          68 :   params.addClassDescription("Applies a specified heat flux to a heat structure boundary");
      30             : 
      31          68 :   return params;
      32           0 : }
      33             : 
      34          34 : HSBoundaryHeatFlux::HSBoundaryHeatFlux(const InputParameters & params)
      35             :   : HSBoundary(params),
      36             : 
      37          68 :     _q_fn_name(getParam<FunctionName>("q"))
      38             : {
      39          34 : }
      40             : 
      41             : void
      42          30 : HSBoundaryHeatFlux::addMooseObjects()
      43             : {
      44          30 :   const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs");
      45             :   const HeatStructureCylindricalBase * hs_cyl =
      46          30 :       dynamic_cast<const HeatStructureCylindricalBase *>(&hs);
      47             :   const bool is_cylindrical = hs_cyl != nullptr;
      48             : 
      49             :   {
      50          52 :     const std::string class_name = is_cylindrical ? "ADHSHeatFluxRZBC" : "ADHSHeatFluxBC";
      51          30 :     InputParameters pars = _factory.getValidParams(class_name);
      52          60 :     pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
      53          30 :     pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
      54          30 :     pars.set<FunctionName>("function") = _q_fn_name;
      55          30 :     if (is_cylindrical)
      56             :     {
      57           8 :       pars.set<Point>("axis_point") = hs_cyl->getPosition();
      58           8 :       pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
      59             :     }
      60          90 :     pars.set<FunctionName>("scale") = getParam<FunctionName>("scale");
      61             : 
      62          60 :     getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars);
      63          30 :   }
      64             : 
      65             :   // Create integral PP for cylindrical heat structures
      66          30 :   if (is_cylindrical)
      67             :   {
      68           8 :     const std::string class_name = "HeatRateHeatFluxRZ";
      69           8 :     InputParameters pars = _factory.getValidParams(class_name);
      70           8 :     pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
      71           8 :     pars.set<FunctionName>("function") = _q_fn_name;
      72           8 :     pars.set<Point>("axis_point") = hs_cyl->getPosition();
      73           8 :     pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
      74          16 :     if (getParam<bool>("scale_heat_rate_pp"))
      75          24 :       pars.set<FunctionName>("scale") = getParam<FunctionName>("scale");
      76          32 :     pars.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
      77          16 :     getTHMProblem().addPostprocessor(class_name, genSafeName(name(), "integral"), pars);
      78           8 :   }
      79          38 : }

Generated by: LCOV version 1.14