LCOV - code coverage report
Current view: top level - src/userobjects - GapFluxModelRadiationBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 39 44 88.6 %
Date: 2026-05-29 20:37:03 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         498 : GapFluxModelRadiationBase::validParams()
      14             : {
      15         498 :   InputParameters params = GapFluxModelBase::validParams();
      16         996 :   params.addParam<Real>("stefan_boltzmann", 5.670373e-8, "Stefan-Boltzmann constant");
      17         996 :   params.addRangeCheckedParam<Real>("primary_emissivity",
      18             :                                     1,
      19             :                                     "primary_emissivity>=0 & primary_emissivity<=1",
      20             :                                     "The emissivity of the primary surface");
      21         996 :   params.addRangeCheckedParam<Real>("secondary_emissivity",
      22             :                                     1,
      23             :                                     "secondary_emissivity>=0 & secondary_emissivity<=1",
      24             :                                     "The emissivity of the secondary surface");
      25         996 :   params.addParamNamesToGroup("stefan_boltzmann primary_emissivity secondary_emissivity",
      26             :                               "Gap Radiative Flux");
      27         498 :   return params;
      28           0 : }
      29             : 
      30         185 : GapFluxModelRadiationBase::GapFluxModelRadiationBase(const InputParameters & parameters)
      31             :   : GapFluxModelBase(parameters),
      32         185 :     _stefan_boltzmann(getParam<Real>("stefan_boltzmann")),
      33         185 :     _radial_coord(),
      34         370 :     _eps_primary(getParam<Real>("primary_emissivity")),
      35         370 :     _eps_secondary(getParam<Real>("secondary_emissivity")),
      36         185 :     _has_zero_emissivity(_eps_primary == 0 && _eps_secondary == 0),
      37         185 :     _parallel_plate_emissivity(
      38         370 :         _has_zero_emissivity ? 0 : 1 / (1.0 / _eps_primary + 1.0 / _eps_secondary - 1))
      39             : {
      40         185 :   const auto & coord_systems = _mesh.getCoordSystem();
      41             :   mooseAssert(coord_systems.size(), "This better not be empty");
      42         185 :   _coord_system = coord_systems.begin()->second;
      43        1025 :   for (const auto [sub_id, coord_system_type] : coord_systems)
      44             :   {
      45             :     libmesh_ignore(sub_id);
      46         840 :     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         185 :   if (_coord_sys == Moose::COORD_RZ)
      53           0 :     _radial_coord = _mesh.getAxisymmetricRadialCoord();
      54         185 : }
      55             : 
      56             : Real
      57    24317754 : GapFluxModelRadiationBase::emissivity() const
      58             : {
      59    24317754 :   if (_has_zero_emissivity)
      60             :     return 0;
      61             : 
      62      136212 :   switch (_coord_system)
      63             :   {
      64      132018 :     case Moose::COORD_XYZ:
      65      132018 :       return _parallel_plate_emissivity;
      66             : 
      67        4194 :     case Moose::COORD_RZ:
      68             :     {
      69        4194 :       const auto primary_r = _primary_point.point(_radial_coord);
      70        4194 :       const auto secondary_r = _secondary_point.point(_radial_coord);
      71             :       const bool primary_is_inner = primary_r < secondary_r;
      72        4194 :       const auto inner_r = primary_is_inner ? primary_r : secondary_r;
      73        4194 :       const auto outer_r = primary_is_inner ? secondary_r : primary_r;
      74        4194 :       const auto inner_eps = primary_is_inner ? _eps_primary : _eps_secondary;
      75        4194 :       const auto outer_eps = primary_is_inner ? _eps_secondary : _eps_primary;
      76             : 
      77             :       // Taken from our documentation of FVInfiniteCylinderRadiativeBC
      78        4194 :       return inner_eps * outer_eps * outer_r /
      79        4194 :              (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    24317754 : 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    24317754 :       (primary_T * primary_T + secondary_T * secondary_T) * (primary_T + secondary_T);
      95             : 
      96    24317754 :   return (primary_T - secondary_T) * _stefan_boltzmann * temp_func * emissivity() *
      97    48635508 :          _surface_integration_factor;
      98             : }

Generated by: LCOV version 1.14