LCOV - code coverage report
Current view: top level - src/base - ThermalHydraulicsApp.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 46 57 80.7 %
Date: 2025-07-30 13:02:48 Functions: 6 10 60.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 "ThermalHydraulicsApp.h"
      11             : #include "THMSyntax.h"
      12             : #include "HeatTransferApp.h"
      13             : #include "FluidPropertiesApp.h"
      14             : #include "NavierStokesApp.h"
      15             : #include "RayTracingApp.h"
      16             : #include "RdgApp.h"
      17             : #include "SolidPropertiesApp.h"
      18             : #include "MiscApp.h"
      19             : 
      20             : #include "AppFactory.h"
      21             : #include "Simulation.h"
      22             : 
      23             : #include "FlowModelSinglePhase.h"
      24             : #include "SinglePhaseFluidProperties.h"
      25             : #include "TwoPhaseFluidProperties.h"
      26             : #include "TwoPhaseNCGFluidProperties.h"
      27             : 
      28             : std::map<THM::FlowModelID, std::string> ThermalHydraulicsApp::_flow_model_map;
      29             : 
      30             : namespace THM
      31             : {
      32             : 
      33             : FlowModelID
      34       26240 : registerFlowModelID()
      35             : {
      36             :   static FlowModelID flow_model_id = 0;
      37       26240 :   flow_model_id++;
      38       26240 :   return flow_model_id;
      39             : }
      40             : 
      41             : FlowModelID FM_INVALID = registerFlowModelID();
      42             : FlowModelID FM_SINGLE_PHASE = registerFlowModelID();
      43             : FlowModelID FM_TWO_PHASE = registerFlowModelID();
      44             : FlowModelID FM_TWO_PHASE_NCG = registerFlowModelID();
      45             : FlowModelID FM_GAS_MIX = registerFlowModelID();
      46             : 
      47             : } // namespace THM
      48             : 
      49             : InputParameters
      50        5439 : ThermalHydraulicsApp::validParams()
      51             : {
      52        5439 :   InputParameters params = MooseApp::validParams();
      53        5439 :   params.set<bool>("use_legacy_output_syntax") = false;
      54        5439 :   params.set<bool>("use_legacy_material_output") = false;
      55        5439 :   params.set<bool>("use_legacy_initial_residual_evaluation_behavior") = false;
      56        5439 :   return params;
      57           0 : }
      58             : 
      59             : registerKnownLabel("ThermalHydraulicsApp");
      60             : 
      61        5439 : ThermalHydraulicsApp::ThermalHydraulicsApp(const InputParameters & parameters)
      62        5439 :   : MooseApp(parameters)
      63             : {
      64        5439 :   ThermalHydraulicsApp::registerAll(_factory, _action_factory, _syntax);
      65        5439 : }
      66             : 
      67        5214 : ThermalHydraulicsApp::~ThermalHydraulicsApp() {}
      68             : 
      69             : void
      70       10691 : ThermalHydraulicsApp::registerAll(Factory & f, ActionFactory & af, Syntax & s)
      71             : {
      72       32073 :   Registry::registerObjectsTo(f, {"ThermalHydraulicsApp"});
      73       32073 :   Registry::registerActionsTo(af, {"ThermalHydraulicsApp"});
      74             : 
      75       10691 :   HeatTransferApp::registerAll(f, af, s);
      76       10691 :   FluidPropertiesApp::registerAll(f, af, s);
      77       10691 :   NavierStokesApp::registerAll(f, af, s);
      78       10691 :   RayTracingApp::registerAll(f, af, s);
      79       10691 :   RdgApp::registerAll(f, af, s);
      80       10691 :   SolidPropertiesApp::registerAll(f, af, s);
      81       10691 :   MiscApp::registerAll(f, af, s);
      82             : 
      83       10691 :   THM::associateSyntax(s);
      84       10691 :   THM::registerActions(s);
      85             : 
      86             :   // flow models
      87       21382 :   registerFlowModel(THM::FM_SINGLE_PHASE, FlowModelSinglePhase);
      88             : 
      89             :   // Component variable ordering:
      90             :   // Note that this particular order ({rhoA, rhoEA, rhouA}) corresponds to the
      91             :   // the alphabetic ordering, which was the ordering used before this ordering
      92             :   // feature was implemented. We preserve this order for ease of transition,
      93             :   // but an order such as {rhoA, rhouA, rhoEA} may work as well.
      94       21382 :   Simulation::setComponentVariableOrder(FlowModelSinglePhase::RHOA, 0);
      95       21382 :   Simulation::setComponentVariableOrder(FlowModelSinglePhase::RHOEA, 1);
      96       21382 :   Simulation::setComponentVariableOrder(FlowModelSinglePhase::RHOUA, 2);
      97       21382 :   Simulation::setComponentVariableOrder("rhoV", 3);
      98       21382 :   Simulation::setComponentVariableOrder("rhouV", 4);
      99       21382 :   Simulation::setComponentVariableOrder("rhovV", 5);
     100       21382 :   Simulation::setComponentVariableOrder("rhowV", 6);
     101       10691 :   Simulation::setComponentVariableOrder("rhoEV", 7);
     102       42764 : }
     103             : 
     104             : const std::string &
     105           0 : ThermalHydraulicsApp::getFlowModelClassName(const THM::FlowModelID & flow_model_id)
     106             : {
     107             :   const auto it = _flow_model_map.find(flow_model_id);
     108           0 :   if (it == _flow_model_map.end())
     109           0 :     mooseError("Flow model with ID '" + Moose::stringify(flow_model_id) +
     110             :                "' is not associated with any flow models class. Register your flow model class to "
     111             :                "a flow model ID by calling registerFlowModel().");
     112           0 :   return it->second;
     113             : }
     114             : 
     115             : void
     116        5247 : ThermalHydraulicsApp::registerApps()
     117             : {
     118        5247 :   registerApp(ThermalHydraulicsApp);
     119             : 
     120        5247 :   HeatTransferApp::registerApps();
     121        5247 :   FluidPropertiesApp::registerApps();
     122        5247 :   NavierStokesApp::registerApps();
     123        5247 :   RayTracingApp::registerApps();
     124        5247 :   RdgApp::registerApps();
     125        5247 :   SolidPropertiesApp::registerApps();
     126        5247 :   MiscApp::registerApps();
     127        5247 : }
     128             : 
     129             : //
     130             : // Dynamic Library Entry Points - DO NOT MODIFY
     131             : //
     132             : extern "C" void
     133           0 : ThermalHydraulicsApp__registerAll(Factory & f, ActionFactory & af, Syntax & s)
     134             : {
     135           0 :   ThermalHydraulicsApp::registerAll(f, af, s);
     136           0 : }
     137             : 
     138             : extern "C" void
     139           0 : ThermalHydraulicsApp__registerApps()
     140             : {
     141           0 :   ThermalHydraulicsApp::registerApps();
     142           0 : }

Generated by: LCOV version 1.14