LCOV - code coverage report
Current view: top level - src/bcs - CoupledConvectiveHeatFluxBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 27 28 96.4 %
Date: 2025-09-04 07:53:51 Functions: 4 4 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 "CoupledConvectiveHeatFluxBC.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", CoupledConvectiveHeatFluxBC);
      13             : 
      14             : InputParameters
      15         296 : CoupledConvectiveHeatFluxBC::validParams()
      16             : {
      17         296 :   InputParameters params = IntegratedBC::validParams();
      18         296 :   params.addClassDescription(
      19             :       "Convective heat transfer boundary condition with temperature and heat "
      20             :       "transfer coefficent given by auxiliary variables.");
      21         592 :   params.addCoupledVar("scale_factor", 1., "Scale factor to multiply the heat flux with");
      22         592 :   params.addCoupledVar("alpha", 1., "Volume fraction of components");
      23         592 :   params.addRequiredCoupledVar("T_infinity", "Field holding far-field temperature");
      24         592 :   params.addRequiredCoupledVar("htc", "Heat transfer coefficient");
      25             : 
      26         296 :   return params;
      27           0 : }
      28             : 
      29         160 : CoupledConvectiveHeatFluxBC::CoupledConvectiveHeatFluxBC(const InputParameters & parameters)
      30             :   : IntegratedBC(parameters),
      31         160 :     _n_components(coupledComponents("T_infinity")),
      32         160 :     _T_infinity(coupledValues("T_infinity")),
      33         160 :     _htc(coupledValues("htc")),
      34         160 :     _alpha(coupledValues("alpha")),
      35         320 :     _scale_factor(coupledValue("scale_factor"))
      36             : {
      37         160 :   if (coupledComponents("alpha") != _n_components)
      38           2 :     paramError(
      39             :         "alpha",
      40             :         "The number of coupled components does not match the number of `T_infinity` components.");
      41         158 :   if (coupledComponents("htc") != _n_components)
      42           2 :     paramError(
      43             :         "htc",
      44             :         "The number of coupled components does not match the number of `T_infinity` components.");
      45         156 : }
      46             : 
      47             : Real
      48      295760 : CoupledConvectiveHeatFluxBC::computeQpResidual()
      49             : {
      50             :   Real q = 0;
      51      599440 :   for (std::size_t c = 0; c < _n_components; c++)
      52      303680 :     q += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * (_u[_qp] - (*_T_infinity[c])[_qp]);
      53      295760 :   return _test[_i][_qp] * q * _scale_factor[_qp];
      54             : }
      55             : 
      56             : Real
      57      183168 : CoupledConvectiveHeatFluxBC::computeQpJacobian()
      58             : {
      59             :   Real dq = 0;
      60      372096 :   for (std::size_t c = 0; c < _n_components; c++)
      61      188928 :     dq += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * _phi[_j][_qp];
      62      183168 :   return _test[_i][_qp] * dq * _scale_factor[_qp];
      63             : }

Generated by: LCOV version 1.14