LCOV - code coverage report
Current view: top level - src/interfaces - HeatStructureInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #31405 (292dce) with base fef103 Lines: 42 44 95.5 %
Date: 2025-09-04 07:58:41 Functions: 8 8 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 "HeatStructureInterface.h"
      11             : #include "HeatConductionModel.h"
      12             : #include "GeometricalComponent.h"
      13             : 
      14             : InputParameters
      15        3782 : HeatStructureInterface::validParams()
      16             : {
      17        3782 :   InputParameters params = emptyInputParameters();
      18             : 
      19        7564 :   params.addParam<FunctionName>("initial_T", "Initial temperature [K]");
      20        7564 :   params.addParam<Real>(
      21        7564 :       "scaling_factor_temperature", 1.0, "Scaling factor for solid temperature variable.");
      22             : 
      23        7564 :   params.addPrivateParam<std::string>("component_type", "heat_struct");
      24             : 
      25        3782 :   return params;
      26           0 : }
      27             : 
      28        1890 : HeatStructureInterface::HeatStructureInterface(GeometricalComponent * geometrical_component)
      29        1890 :   : _geometrical_component_hsi(*geometrical_component)
      30             : {
      31        1890 : }
      32             : 
      33             : std::shared_ptr<HeatConductionModel>
      34        1863 : HeatStructureInterface::buildModel()
      35             : {
      36        1863 :   auto & factory = _geometrical_component_hsi.getMooseApp().getFactory();
      37             : 
      38        1863 :   const std::string class_name = "HeatConductionModel";
      39        1863 :   InputParameters params = factory.getValidParams(class_name);
      40        1863 :   params.set<THMProblem *>("_thm_problem") = &_geometrical_component_hsi.getTHMProblem();
      41        1863 :   params.set<HeatStructureInterface *>("_hs") = this;
      42        1863 :   params.applyParameters(_geometrical_component_hsi.parameters());
      43             :   return factory.create<HeatConductionModel>(
      44        3726 :       class_name, _geometrical_component_hsi.name(), params, 0);
      45        1863 : }
      46             : 
      47             : void
      48        1863 : HeatStructureInterface::init()
      49             : {
      50        1863 :   _hc_model = buildModel();
      51        1863 : }
      52             : 
      53             : void
      54        1838 : HeatStructureInterface::check() const
      55             : {
      56        1838 :   auto & moose_app = _geometrical_component_hsi.getMooseApp();
      57        1838 :   bool ics_set = _geometrical_component_hsi.getTHMProblem().hasInitialConditionsFromFile() ||
      58        3640 :                  _geometrical_component_hsi.isParamValid("initial_T");
      59        1838 :   if (!ics_set && !moose_app.isRestarting())
      60           8 :     _geometrical_component_hsi.logError("Missing initial condition for temperature.");
      61        1838 : }
      62             : 
      63             : void
      64        1711 : HeatStructureInterface::addVariables()
      65             : {
      66        1711 :   _hc_model->addVariables();
      67        3422 :   if (_geometrical_component_hsi.isParamValid("initial_T"))
      68        1659 :     _hc_model->addInitialConditions();
      69        1711 : }
      70             : 
      71             : void
      72        1711 : HeatStructureInterface::addMooseObjects()
      73             : {
      74        1711 :   if (useCylindricalTransformation())
      75        1209 :     _hc_model->addHeatEquationRZ();
      76             :   else
      77         502 :     _hc_model->addHeatEquationXYZ();
      78        1711 : }
      79             : 
      80             : FunctionName
      81        1972 : HeatStructureInterface::getInitialT() const
      82             : {
      83        3944 :   if (_geometrical_component_hsi.isParamValid("initial_T"))
      84        3944 :     return _geometrical_component_hsi.getParam<FunctionName>("initial_T");
      85             :   else
      86           0 :     _geometrical_component_hsi.mooseError(
      87             :         _geometrical_component_hsi.name(),
      88             :         ": The parameter 'initial_T' was requested but not supplied");
      89             : }

Generated by: LCOV version 1.14