LCOV - code coverage report
Current view: top level - src/bcs - ADCoupledSimpleRadiativeHeatFluxBC.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 29 30 96.7 %
Date: 2025-08-02 07:01:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************************/
       2             : /*                        DO NOT MODIFY THIS HEADER                         */
       3             : /*                                                                          */
       4             : /* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
       5             : /*                                                                          */
       6             : /*           Copyright 2021 - 2024, Battelle Energy Alliance, LLC           */
       7             : /*                           ALL RIGHTS RESERVED                            */
       8             : /****************************************************************************/
       9             : 
      10             : #include "ADCoupledSimpleRadiativeHeatFluxBC.h"
      11             : 
      12             : registerMooseObject("MalamuteApp", ADCoupledSimpleRadiativeHeatFluxBC);
      13             : 
      14             : InputParameters
      15          86 : ADCoupledSimpleRadiativeHeatFluxBC::validParams()
      16             : {
      17          86 :   InputParameters params = ADIntegratedBC::validParams();
      18          86 :   params.addClassDescription(
      19             :       "Radiative heat transfer boundary condition with the far field temperature, of an assumed "
      20             :       "black body, given by auxiliary variables and constant emissivity");
      21         172 :   params.addCoupledVar("alpha", 1., "Volume fraction of components");
      22         172 :   params.addRequiredCoupledVar("T_infinity",
      23             :                                "Field holding the far-field temperature for each component");
      24         172 :   params.addRequiredParam<std::vector<Real>>(
      25             :       "emissivity", "The emissivity of the surface to which this boundary belongs");
      26         172 :   params.addParam<Real>("sigma", 5.67e-8, "The Stefan-Boltzmann constant");
      27             : 
      28          86 :   return params;
      29           0 : }
      30             : 
      31          44 : ADCoupledSimpleRadiativeHeatFluxBC::ADCoupledSimpleRadiativeHeatFluxBC(
      32          44 :     const InputParameters & parameters)
      33             :   : ADIntegratedBC(parameters),
      34          44 :     _n_components(coupledComponents("T_infinity")),
      35          88 :     _emissivity(getParam<std::vector<Real>>("emissivity")),
      36         176 :     _sigma(getParam<Real>("sigma"))
      37             : {
      38          44 :   if (coupledComponents("alpha") != _n_components)
      39           1 :     paramError(
      40             :         "alpha",
      41             :         "The number of coupled components does not match the number of `T_infinity` components.");
      42             : 
      43          43 :   _T_infinity.resize(_n_components);
      44          43 :   _alpha.resize(_n_components);
      45          88 :   for (std::size_t c = 0; c < _n_components; c++)
      46             :   {
      47          45 :     _T_infinity[c] = &coupledValue("T_infinity", c);
      48          45 :     _alpha[c] = &coupledValue("alpha", c);
      49             :   }
      50             : 
      51          43 :   if (_emissivity.size() != _n_components)
      52           1 :     paramError(
      53             :         "emissivity",
      54             :         "The number of coupled components does not match the number of `T_infinity` components.");
      55          42 : }
      56             : 
      57             : ADReal
      58     1325176 : ADCoupledSimpleRadiativeHeatFluxBC::computeQpResidual()
      59             : {
      60     1325176 :   ADReal q = 0;
      61     2658352 :   for (std::size_t c = 0; c < _n_components; c++)
      62     1333176 :     q += (*_alpha[c])[_qp] * _emissivity[c] * _sigma *
      63     2666352 :          (Utility::pow<4>(_u[_qp]) - Utility::pow<4>((*_T_infinity[c])[_qp]));
      64             : 
      65     2650352 :   return _test[_i][_qp] * q;
      66             : }

Generated by: LCOV version 1.14