LCOV - code coverage report
Current view: top level - include/userobjects - HeatFluxFromHeatStructureBaseUserObject.h (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 0 1 0.0 %
Date: 2025-07-30 13:02:48 Functions: 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 "ElementUserObject.h"
      13             : #include "MeshAlignment.h"
      14             : 
      15             : /**
      16             :  * Base class for caching heat flux between a flow channel and a heat structure.
      17             :  *
      18             :  * We procide an API for child classes that they need to implement:
      19             :  * 1. computeQpHeatFlux() to compute heat flux at a quadrature point
      20             :  * 2. computeQpHeatFluxJacobian() to compute the jacobian of the heat flux
      21             :  *    computed by the computeQpHeatFlux() method.
      22             :  *
      23             :  * There are 2 different clients to the values we cached:
      24             :  * 1. BoundaryFluxXYZBC to apply the heat flux on a heat structure boundary
      25             :  * 2. OneDXYZEnergyHeatFlux to apply the heat flux on the flow channel side.
      26             :  */
      27             : class HeatFluxFromHeatStructureBaseUserObject : public ElementUserObject
      28             : {
      29             : public:
      30             :   HeatFluxFromHeatStructureBaseUserObject(const InputParameters & parameters);
      31             : 
      32             :   virtual void initialize() override;
      33             :   virtual void execute() override;
      34             :   virtual void finalize() override;
      35             :   virtual void threadJoin(const UserObject & y) override;
      36             : 
      37             :   const std::vector<Real> & getHeatedPerimeter(dof_id_type element_id) const;
      38             :   const std::vector<Real> & getHeatFlux(dof_id_type element_id) const;
      39             :   const std::vector<DenseVector<Real>> & getHeatFluxJacobian(dof_id_type element_id) const;
      40             : 
      41             :   /**
      42             :    * Get the nearest element ID for given element ID
      43             :    *
      44             :    * Used when a heat structure element needs to know what its nearest element is and vice versa.
      45             :    * @param elem_id Element ID either from a flow channel or a heat structure
      46             :    * @return Nearest element corresponding to a `elem_id`
      47             :    */
      48             :   const dof_id_type & getNearestElem(dof_id_type elem_id) const
      49             :   {
      50           0 :     return _mesh_alignment.getCoupledElemID(elem_id);
      51             :   }
      52             : 
      53             : protected:
      54             :   virtual Real computeQpHeatFlux() = 0;
      55             :   virtual DenseVector<Real> computeQpHeatFluxJacobian() = 0;
      56             : 
      57             :   /// Mesh alignment object
      58             :   MeshAlignment & _mesh_alignment;
      59             :   /// Quadrature point index
      60             :   unsigned int _qp;
      61             :   /// Cached heated perimeter
      62             :   std::map<dof_id_type, std::vector<Real>> _heated_perimeter;
      63             :   /// Cached heat flux
      64             :   std::map<dof_id_type, std::vector<Real>> _heat_flux;
      65             :   /// Cached heat flux jacobians
      66             :   std::map<dof_id_type, std::vector<DenseVector<Real>>> _heat_flux_jacobian;
      67             :   /// Coupled heated perimeter variable
      68             :   const VariableValue & _P_hf;
      69             : 
      70             : public:
      71             :   static InputParameters validParams();
      72             : };

Generated by: LCOV version 1.14