LCOV - code coverage report
Current view: top level - src/bcs - ConvectiveFluxFunction.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 27 27 100.0 %
Date: 2026-05-29 20:37:03 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 "ConvectiveFluxFunction.h"
      11             : 
      12             : #include "Function.h"
      13             : 
      14             : registerMooseObject("HeatTransferApp", ConvectiveFluxFunction);
      15             : 
      16             : InputParameters
      17         452 : ConvectiveFluxFunction::validParams()
      18             : {
      19         452 :   InputParameters params = IntegratedBC::validParams();
      20         904 :   params.addRequiredParam<FunctionName>("T_infinity", "Function describing far-field temperature");
      21         904 :   params.addRequiredParam<FunctionName>("coefficient",
      22             :                                         "Function describing heat transfer coefficient");
      23         904 :   MooseEnum coef_func_type("TIME_AND_POSITION TEMPERATURE", "TIME_AND_POSITION");
      24         904 :   params.addParam<MooseEnum>(
      25             :       "coefficient_function_type",
      26             :       coef_func_type,
      27             :       "Type of function for heat transfer coefficient provided in 'coefficient' parameter");
      28         452 :   params.addClassDescription(
      29             :       "Determines boundary value by fluid heat transfer coefficient and far-field temperature");
      30             : 
      31         452 :   return params;
      32         452 : }
      33             : 
      34         239 : ConvectiveFluxFunction::ConvectiveFluxFunction(const InputParameters & parameters)
      35             :   : IntegratedBC(parameters),
      36         239 :     _T_infinity(getFunction("T_infinity")),
      37         239 :     _coefficient(getFunction("coefficient")),
      38         717 :     _coef_func_type(getParam<MooseEnum>("coefficient_function_type").getEnum<CoefFuncType>())
      39             : {
      40         239 : }
      41             : 
      42             : Real
      43    10988720 : ConvectiveFluxFunction::computeQpResidual()
      44             : {
      45             :   Real coef;
      46    10988720 :   if (_coef_func_type == CoefFuncType::TIME_AND_POSITION)
      47    10987824 :     coef = _coefficient.value(_t, _q_point[_qp]);
      48             :   else
      49         896 :     coef = _coefficient.value(_u[_qp], Point());
      50             : 
      51    10988720 :   return _test[_i][_qp] * coef * (_u[_qp] - _T_infinity.value(_t, _q_point[_qp]));
      52             : }
      53             : 
      54             : Real
      55    34041440 : ConvectiveFluxFunction::computeQpJacobian()
      56             : {
      57    34041440 :   if (_coef_func_type == CoefFuncType::TIME_AND_POSITION)
      58             :   {
      59    34040320 :     Real coef = _coefficient.value(_t, _q_point[_qp]);
      60    34040320 :     return _test[_i][_qp] * coef * _phi[_j][_qp];
      61             :   }
      62             :   else
      63             :   {
      64        1120 :     const Real coef = _coefficient.value(_u[_qp]);
      65        1120 :     const Real dcoef_dT = _coefficient.timeDerivative(_u[_qp]);
      66        1120 :     return _test[_i][_qp] * (coef + (_u[_qp] - _T_infinity.value(_t, _q_point[_qp])) * dcoef_dT) *
      67        1120 :            _phi[_j][_qp];
      68             :   }
      69             : }

Generated by: LCOV version 1.14