LCOV - code coverage report
Current view: top level - include/utils - CHTHandler.h (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 4 6 66.7 %
Date: 2026-05-29 20:37:52 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 "MooseObject.h"
      13             : #include "FaceCenteredMapFunctor.h"
      14             : #include "SystemBase.h"
      15             : #include "NS.h"
      16             : 
      17             : class LinearFVFluxKernel;
      18             : class LinearFVBoundaryCondition;
      19             : 
      20             : namespace NS
      21             : {
      22             : namespace FV
      23             : {
      24             : 
      25             : /**
      26             :  * This class provides an interface for managing  conjugate heat transfer (CHT)
      27             :  * between fluid and solid domains.
      28             :  */
      29             : class CHTHandler : public MooseObject
      30             : {
      31             : public:
      32             :   /// Constructor with initialization parameters
      33             :   CHTHandler(const InputParameters & parameters);
      34             : 
      35             :   static InputParameters validParams();
      36             : 
      37             :   /// Link energy systems
      38             :   void linkEnergySystems(SystemBase * solid_energy_system,
      39             :                          SystemBase * fluid_energy_system,
      40             :                          std::vector<SystemBase *> pm_radiation_systems);
      41             : 
      42             :   /// Set up the boundary condition pairs, functor maps, and every other necessary
      43             :   /// structure for the conjugate heat transfer routines
      44             :   void setupConjugateHeatTransferContainers();
      45             : 
      46             :   /// Run error checks and make sure everything works
      47             :   void deduceCHTBoundaryCoupling();
      48             : 
      49             :   /// Update the coupling fields for \param side
      50             :   void updateCHTBoundaryCouplingFields(const NS::CHTSide side);
      51             : 
      52             :   /// Initialize the coupling fields for the conjugate heat transfer routines
      53             :   void initializeCHTCouplingFields();
      54             : 
      55             :   /// Check if CHT iteration converged
      56             :   bool converged() const;
      57             : 
      58             :   /// Reset the convergence data
      59             :   void resetCHTConvergence();
      60             : 
      61             :   /// Increment CHT iterators in the loop
      62             :   void incrementCHTIterators();
      63             : 
      64             :   /// Sum the integrated fluxes over all processors
      65             :   void sumIntegratedFluxes();
      66             : 
      67             :   /// Print the integrated heat fluxes
      68             :   void printIntegratedFluxes() const;
      69             : 
      70             :   /// Reset the heat fluxes to 0
      71             :   void resetIntegratedFluxes();
      72             : 
      73             :   /// Check if CHT treatment is needed
      74             :   virtual bool enabled() const override final;
      75             : 
      76             : protected:
      77             :   /// Reference to FEProblem
      78             :   FEProblemBase & _problem;
      79             : 
      80             :   /// Mesh
      81             :   MooseMesh & _mesh;
      82             : 
      83             :   /// The energy system
      84             :   SystemBase * _energy_system;
      85             : 
      86             :   /// The solid energy system
      87             :   SystemBase * _solid_energy_system;
      88             : 
      89             :   /// The solid energy system
      90             :   std::vector<SystemBase *> _pm_radiation_systems;
      91             : 
      92             :   /// The names of the CHT boundaries
      93             :   std::vector<BoundaryName> _cht_boundary_names;
      94             : 
      95             :   /// The IDs of the CHT boundaries
      96             :   std::vector<BoundaryID> _cht_boundary_ids;
      97             : 
      98             :   /// Maximum number of CHT fixed point iterations.
      99             :   const unsigned int _max_cht_fpi;
     100             : 
     101             :   /// Tolerance for heat flux at the CHT interfaces
     102             :   const Real _cht_heat_flux_tolerance;
     103             : 
     104             :   /// The relaxation factors for flux fields for the CHT boundaries
     105             :   /// first index is solid/fluid second is the interface
     106             :   std::vector<std::vector<Real>> _cht_flux_relaxation_factor;
     107             : 
     108             :   /// The relaxation factors for temperature fields for the CHT boundaries
     109             :   /// first index is solid/fluid second is the interface
     110             :   std::vector<std::vector<Real>> _cht_temperature_relaxation_factor;
     111             : 
     112             :   /// The solid (0) and fluid (1) system numbers.
     113             :   std::vector<unsigned int> _cht_system_numbers;
     114             : 
     115             :   /// The participating media radiation system numbers.
     116             :   std::vector<unsigned int> _cht_pm_radiation_system_numbers;
     117             : 
     118             :   /// The subset of the FaceInfo objects that belong to the given boundaries.
     119             :   std::vector<std::vector<const FaceInfo *>> _cht_face_info;
     120             : 
     121             :   /// The conduction kernels from the solid/fluid domains. Can't be const, considering we are updating the inner structures for every face.
     122             :   std::vector<LinearFVFluxKernel *> _cht_conduction_kernels;
     123             : 
     124             :   /// The conduction radiation kernels from the fluid domains.
     125             :   std::vector<LinearFVFluxKernel *> _cht_pm_radiation_kernels;
     126             : 
     127             :   /// Vector of boundary conditions that describe the conjugate heat transfer from each side.
     128             :   std::vector<std::vector<LinearFVBoundaryCondition *>> _cht_boundary_conditions;
     129             : 
     130             :   /// Vector of boundary conditions that describe the radiation pm bcs from each side.
     131             :   std::vector<std::vector<LinearFVBoundaryCondition *>> _cht_pm_radiation_boundary_conditions;
     132             : 
     133             :   /// Functors describing the heat flux on the conjugate heat transfer interfaces.
     134             :   /// Two functors per sideset, first is solid second is fluid.
     135             :   std::vector<std::vector<FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real>>>>
     136             :       _boundary_heat_flux;
     137             : 
     138             :   /// Integrated flux for the boundaries, first index is the boundary second is solid/fluid.
     139             :   std::vector<std::vector<Real>> _integrated_boundary_heat_flux;
     140             : 
     141             :   /// Functors describing the heat flux on the conjugate heat transfer interfaces.
     142             :   /// Two functors per sideset, first is solid second is fluid.
     143             :   std::vector<std::vector<FaceCenteredMapFunctor<Real, std::unordered_map<dof_id_type, Real>>>>
     144             :       _boundary_temperature;
     145             : 
     146             : private:
     147             :   /// CHT fixed point iteration counter
     148             :   unsigned int _fpi_it;
     149             : };
     150             : 
     151             : inline bool
     152           0 : CHTHandler::enabled() const
     153             : {
     154           0 :   return !_cht_boundary_names.empty();
     155             : }
     156             : 
     157             : inline void
     158             : CHTHandler::resetCHTConvergence()
     159             : {
     160       27102 :   _fpi_it = 0;
     161       27102 : }
     162             : 
     163             : inline void
     164             : CHTHandler::incrementCHTIterators()
     165             : {
     166       29806 :   _fpi_it++;
     167       29806 : }
     168             : 
     169             : } // End FV namespace
     170             : } // End Moose namespace

Generated by: LCOV version 1.14