LCOV - code coverage report
Current view: top level - src/userobjects - GapFluxModelRadiationBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 39 44 88.6 %
Date: 2025-09-04 07:53:51 Functions: 5 5 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 "GapFluxModelRadiationBase.h"
      11             : 
      12             : InputParameters
      13        1026 : GapFluxModelRadiationBase::validParams()
      14             : {
      15        1026 :   InputParameters params = GapFluxModelBase::validParams();
      16        2052 :   params.addParam<Real>("stefan_boltzmann", 5.670373e-8, "Stefan-Boltzmann constant");
      17        2052 :   params.addRangeCheckedParam<Real>("primary_emissivity",
      18             :                                     1,
      19             :                                     "primary_emissivity>=0 & primary_emissivity<=1",
      20             :                                     "The emissivity of the primary surface");
      21        2052 :   params.addRangeCheckedParam<Real>("secondary_emissivity",
      22             :                                     1,
      23             :                                     "secondary_emissivity>=0 & secondary_emissivity<=1",
      24             :                                     "The emissivity of the secondary surface");
      25        2052 :   params.addParamNamesToGroup("stefan_boltzmann primary_emissivity secondary_emissivity",
      26             :                               "Gap Radiative Flux");
      27        1026 :   return params;
      28           0 : }
      29             : 
      30         385 : GapFluxModelRadiationBase::GapFluxModelRadiationBase(const InputParameters & parameters)
      31             :   : GapFluxModelBase(parameters),
      32         385 :     _stefan_boltzmann(getParam<Real>("stefan_boltzmann")),
      33         385 :     _radial_coord(),
      34         770 :     _eps_primary(getParam<Real>("primary_emissivity")),
      35         770 :     _eps_secondary(getParam<Real>("secondary_emissivity")),
      36         385 :     _has_zero_emissivity(_eps_primary == 0 && _eps_secondary == 0),
      37         385 :     _parallel_plate_emissivity(
      38         770 :         _has_zero_emissivity ? 0 : 1 / (1.0 / _eps_primary + 1.0 / _eps_secondary - 1))
      39             : {
      40         385 :   const auto & coord_systems = _mesh.getCoordSystem();
      41             :   mooseAssert(coord_systems.size(), "This better not be empty");
      42         385 :   _coord_system = coord_systems.begin()->second;
      43        2145 :   for (const auto [sub_id, coord_system_type] : coord_systems)
      44             :   {
      45             :     libmesh_ignore(sub_id);
      46        1760 :     if (coord_system_type != _coord_system)
      47           0 :       mooseError(
      48             :           "Multiple coordinate system types detected. If you need this object to work with "
      49             :           "multiple coordinate system types in the same mesh, please contact a MOOSE developer");
      50             :   }
      51             : 
      52         385 :   if (_coord_sys == Moose::COORD_RZ)
      53           0 :     _radial_coord = _mesh.getAxisymmetricRadialCoord();
      54         385 : }
      55             : 
      56             : Real
      57    26514378 : GapFluxModelRadiationBase::emissivity() const
      58             : {
      59    26514378 :   if (_has_zero_emissivity)
      60             :     return 0;
      61             : 
      62      204318 :   switch (_coord_system)
      63             :   {
      64      198027 :     case Moose::COORD_XYZ:
      65      198027 :       return _parallel_plate_emissivity;
      66             : 
      67        6291 :     case Moose::COORD_RZ:
      68             :     {
      69        6291 :       const auto primary_r = _primary_point.point(_radial_coord);
      70        6291 :       const auto secondary_r = _secondary_point.point(_radial_coord);
      71             :       const bool primary_is_inner = primary_r < secondary_r;
      72        6291 :       const auto inner_r = primary_is_inner ? primary_r : secondary_r;
      73        6291 :       const auto outer_r = primary_is_inner ? secondary_r : primary_r;
      74        6291 :       const auto inner_eps = primary_is_inner ? _eps_primary : _eps_secondary;
      75        6291 :       const auto outer_eps = primary_is_inner ? _eps_secondary : _eps_primary;
      76             : 
      77             :       // Taken from our documentation of FVInfiniteCylinderRadiativeBC
      78        6291 :       return inner_eps * outer_eps * outer_r /
      79        6291 :              (outer_eps * outer_r + inner_eps * inner_r * (1 - outer_eps));
      80             :     }
      81             : 
      82           0 :     default:
      83           0 :       mooseError("spherical coordinates not yet supported for this object");
      84             :   }
      85             : }
      86             : 
      87             : ADReal
      88    26514378 : GapFluxModelRadiationBase::computeRadiationFlux(const ADReal & secondary_T,
      89             :                                                 const ADReal & primary_T) const
      90             : {
      91             :   // We add 'surface_integration_factor' to account for the surface integration of the conductance
      92             :   // due to radiation.
      93             :   const ADReal temp_func =
      94    26514378 :       (primary_T * primary_T + secondary_T * secondary_T) * (primary_T + secondary_T);
      95             : 
      96    26514378 :   return (primary_T - secondary_T) * _stefan_boltzmann * temp_func * emissivity() *
      97    53028756 :          _surface_integration_factor;
      98             : }

Generated by: LCOV version 1.14