LCOV - code coverage report
Current view: top level - include/components - FlowChannelBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 8 10 80.0 %
Date: 2025-07-30 13:02:48 Functions: 0 1 0.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             : #pragma once
      11             : 
      12             : #include "Component1D.h"
      13             : #include "GravityInterface.h"
      14             : 
      15             : class ClosuresBase;
      16             : 
      17             : /**
      18             :  * A base class for flow channels
      19             :  *
      20             :  * A flow channel is defined by its position, direction, length and area.
      21             :  */
      22             : class FlowChannelBase : public Component1D, public GravityInterface
      23             : {
      24             : public:
      25             :   FlowChannelBase(const InputParameters & params);
      26             : 
      27             :   /// Type of convective heat transfer geometry
      28             :   enum EConvHeatTransGeom
      29             :   {
      30             :     PIPE,          ///< pipe geometry
      31             :     ROD_BUNDLE,    ///< square array rod bundle geometry
      32             :     HEX_ROD_BUNDLE ///< hexagonal array rod bundle geometry
      33             :   };
      34             :   /// Pipe type
      35             :   enum EPipeType
      36             :   {
      37             :     STRAIGHT,
      38             :     CURVED,
      39             :     DOWNCOMER
      40             :   };
      41             :   /// Pipe location
      42             :   enum EPipeLocation
      43             :   {
      44             :     INTERIOR,
      45             :     EDGE,
      46             :     CORNER
      47             :   };
      48             :   /// Map of convective heat transfer geometry type to enum
      49             :   static const std::map<std::string, EConvHeatTransGeom> _heat_transfer_geom_to_enum;
      50             :   /// Map of pipe type to enum
      51             :   static const std::map<std::string, EPipeType> _pipe_type_to_enum;
      52             :   /// Map of pipe location to enum
      53             :   static const std::map<std::string, EPipeLocation> _pipe_location_to_enum;
      54             : 
      55             :   virtual void addVariables() override;
      56             :   virtual void addMooseObjects() override;
      57             : 
      58             :   /**
      59             :    * Gets the gravity angle for this component
      60             :    *
      61             :    * @return gravity angle for this component
      62             :    */
      63           0 :   virtual const Real & getGravityAngle() const { return _gravity_angle; }
      64             : 
      65             :   /**
      66             :    * Gets the name of the fluid properties user object for this component
      67             :    */
      68        9187 :   const UserObjectName & getFluidPropertiesName() const { return _fp_name; }
      69             : 
      70             :   /**
      71             :    * Gets the flow model ID
      72             :    */
      73             :   virtual const THM::FlowModelID & getFlowModelID() const = 0;
      74             : 
      75             :   /**
      76             :    * Gets a MooseEnum for convective heat transfer geometry type
      77             :    *
      78             :    * @param[in] name   default value
      79             :    * @returns MooseEnum for convective heat transfer geometry type
      80             :    */
      81             :   static MooseEnum getConvHeatTransGeometry(const std::string & name);
      82             : 
      83             :   /**
      84             :    * Gets a MooseEnum for pipe type
      85             :    *
      86             :    * @param[in] name   default value
      87             :    * @returns MooseEnum for pipe type
      88             :    */
      89             :   static MooseEnum getPipeType(const std::string & name);
      90             : 
      91             :   /**
      92             :    * Gets a MooseEnum for pipe location
      93             :    *
      94             :    * @param[in] name   default value
      95             :    * @returns MooseEnum for pipe location
      96             :    */
      97             :   static MooseEnum getPipeLocation(const std::string & name);
      98             : 
      99             :   // Flow channel specific interface ----
     100             :   virtual std::shared_ptr<const FlowModel> getFlowModel() const;
     101             : 
     102             :   /**
     103             :    * Get the name of the function describing the flow channel area
     104             :    *
     105             :    * @return The name of the function describing the flow channel area
     106             :    */
     107             :   const FunctionName & getAreaFunctionName() const;
     108             : 
     109             :   /**
     110             :    * Creates the area function if needed and then stores the name
     111             :    */
     112             :   virtual FunctionName createAreaFunctionAndGetName();
     113             : 
     114             :   /**
     115             :    * Gets heat transfer geometry
     116             :    */
     117          38 :   EConvHeatTransGeom getHeatTransferGeometry() const { return _HT_geometry; }
     118             : 
     119             :   /**
     120             :    * Gets the pipe location
     121             :    */
     122          19 :   EPipeLocation getPipeLocation() const { return _pipe_location; }
     123             : 
     124             :   /**
     125             :    * Gets the names of all connected heat transfer components
     126             :    */
     127             :   std::vector<std::string> getHeatTransferNames() const;
     128             : 
     129             :   /**
     130             :    * Gets temperature mode flag
     131             :    */
     132         911 :   bool getTemperatureMode() const { return _temperature_mode; }
     133             : 
     134             :   /**
     135             :    * Gets the number of heat transfer connections
     136             :    */
     137        4064 :   unsigned int getNumberOfHeatTransferConnections() const { return _n_heat_transfer_connections; }
     138             : 
     139             :   /**
     140             :    * Gets heated perimeter names for connected heat transfers
     141             :    */
     142          70 :   std::vector<VariableName> getHeatedPerimeterNames() const { return _P_hf_names; }
     143             : 
     144             :   /**
     145             :    * Gets wall temperature names for connected heat transfers
     146             :    */
     147        1988 :   std::vector<VariableName> getWallTemperatureNames() const { return _T_wall_names; }
     148             :   std::vector<MaterialPropertyName> getWallTemperatureMatNames() const { return _T_wall_mat_names; }
     149             : 
     150             :   /**
     151             :    * Gets wall heat flux names for connected heat transfers
     152             :    */
     153           0 :   std::vector<MaterialPropertyName> getWallHeatFluxNames() const { return _q_wall_names; }
     154             : 
     155             :   /**
     156             :    * Adds the name of a heat transfer component to the flow channel's list.
     157             :    *
     158             :    * This function is called from a heat transfer component to add its name to
     159             :    * the flow channel's list, so that the flow channel can communicate with it, such as for
     160             :    * determining variable names used in averages of heat transfer variables.
     161             :    *
     162             :    * @param[in] ht_name  name of the heat transfer component
     163             :    */
     164             :   void addHeatTransferName(const std::string & ht_name) const;
     165             : 
     166             :   /**
     167             :    * Gets suffix to add to heat-transfer-related names in a heat transfer component
     168             :    *
     169             :    * This function is called from a heat transfer component to determine how to
     170             :    * name its variables. If the flow channel has only one heat transfer coefficient, for
     171             :    * example, then no suffix is returned. This function must be called after all
     172             :    * of the heat transfer component names have been added to the flow channel's list
     173             :    * (via \c addHeatTransferName()).
     174             :    *
     175             :    * @param[in] ht_name  name of the heat transfer component
     176             :    * @return suffix to add to heat transfer variable names
     177             :    */
     178             :   std::string getHeatTransferNamesSuffix(const std::string & ht_name) const;
     179             : 
     180             :   /**
     181             :    * Get the used closures object(s)
     182             :    *
     183             :    * @return The closures object(s)
     184             :    */
     185             :   std::vector<std::shared_ptr<ClosuresBase>> getClosuresObjects() const
     186             :   {
     187        1049 :     return _closures_objects;
     188             :   }
     189             : 
     190             : protected:
     191             :   virtual std::shared_ptr<FlowModel> buildFlowModel() = 0;
     192             :   virtual void init() override;
     193             :   virtual void initSecondary() override;
     194             :   virtual void check() const override;
     195             : 
     196             :   /**
     197             :    * Adds objects which are common for single- and two-phase flow
     198             :    */
     199             :   virtual void addCommonObjects();
     200             : 
     201             :   /**
     202             :    * Populates heat connection variable names lists
     203             :    */
     204             :   virtual void getHeatTransferVariableNames();
     205             : 
     206             :   /// The flow model used by this flow channel
     207             :   std::shared_ptr<FlowModel> _flow_model;
     208             : 
     209             :   /// Name of fluid properties user object
     210             :   const UserObjectName & _fp_name;
     211             : 
     212             :   /// Angle between orientation vector and gravity vector, in degrees
     213             :   const Real _gravity_angle;
     214             : 
     215             :   /// Function describing the flow channel area
     216             :   FunctionName _area_function;
     217             : 
     218             :   /// Closures object(s)
     219             :   std::vector<std::shared_ptr<ClosuresBase>> _closures_objects;
     220             : 
     221             :   const bool & _pipe_pars_transferred;
     222             : 
     223             :   /// Roughness of flow channel surface, [m]
     224             :   const Real & _roughness;
     225             : 
     226             :   /// Convective Heat transfer geometry
     227             :   EConvHeatTransGeom _HT_geometry;
     228             :   /// Pipe location within the bundle
     229             :   EPipeLocation _pipe_location;
     230             :   /// Pitch to diameter ratio for parallel bundle heat transfer
     231             :   const Real & _PoD;
     232             :   /// True if user provides PoD
     233             :   bool _has_PoD;
     234             : 
     235             :   /// True if there is one or more sources specified by wall temperature
     236             :   bool _temperature_mode;
     237             :   /// Names of the heat transfer components connected to this component
     238             :   mutable std::vector<std::string> _heat_transfer_names;
     239             :   /// Number of connected heat transfer components
     240             :   mutable unsigned int _n_heat_transfer_connections;
     241             : 
     242             :   /// 1-phase wall heat transfer coefficient names for connected heat transfers
     243             :   std::vector<MaterialPropertyName> _Hw_1phase_names;
     244             :   /// liquid wall heat transfer coefficient names for connected heat transfers
     245             :   std::vector<MaterialPropertyName> _Hw_liquid_names;
     246             :   /// vapor wall heat transfer coefficient names for connected heat transfers
     247             :   std::vector<MaterialPropertyName> _Hw_vapor_names;
     248             :   /// heated perimeter names for connected heat transfers
     249             :   std::vector<VariableName> _P_hf_names;
     250             :   /// wall temperature auxvariable names for connected heat transfers
     251             :   std::vector<VariableName> _T_wall_names;
     252             :   /// wall temperature material names for connected heat transfers
     253             :   std::vector<MaterialPropertyName> _T_wall_mat_names;
     254             :   /// wall heat flux names for connected heat transfers
     255             :   std::vector<MaterialPropertyName> _q_wall_names;
     256             : 
     257             : public:
     258             :   static InputParameters validParams();
     259             : };
     260             : 
     261             : namespace THM
     262             : {
     263             : template <>
     264             : FlowChannelBase::EConvHeatTransGeom stringToEnum(const std::string & s);
     265             : 
     266             : template <>
     267             : FlowChannelBase::EPipeType stringToEnum(const std::string & s);
     268             : 
     269             : template <>
     270             : FlowChannelBase::EPipeLocation stringToEnum(const std::string & s);
     271             : }

Generated by: LCOV version 1.14