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 "FVFunctorConvectiveHeatFluxBC.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("HeatTransferApp", FVFunctorConvectiveHeatFluxBC); 14 : 15 : InputParameters 16 319 : FVFunctorConvectiveHeatFluxBC::validParams() 17 : { 18 319 : InputParameters params = FVFluxBC::validParams(); 19 319 : params.addClassDescription( 20 : "Convective heat transfer boundary condition with temperature and heat " 21 : "transfer coefficient given by functors."); 22 638 : params.addRequiredParam<MooseFunctorName>("T_solid", "Functor for wall temperature"); 23 638 : params.addRequiredParam<MooseFunctorName>("T_bulk", "Functor for far-field temperature"); 24 638 : params.addRequiredParam<MooseFunctorName>("heat_transfer_coefficient", 25 : "Functor for heat transfer coefficient"); 26 638 : params.addRequiredParam<bool>("is_solid", "Whether this kernel acts on the solid temperature"); 27 : 28 319 : return params; 29 0 : } 30 : 31 110 : FVFunctorConvectiveHeatFluxBC::FVFunctorConvectiveHeatFluxBC(const InputParameters & parameters) 32 : : FVFluxBC(parameters), 33 110 : _T_solid(getFunctor<ADReal>("T_solid")), 34 220 : _T_bulk(getFunctor<ADReal>("T_bulk")), 35 220 : _htc(getFunctor<ADReal>("heat_transfer_coefficient")), 36 330 : _is_solid(getParam<bool>("is_solid")) 37 : { 38 110 : } 39 : 40 : ADReal 41 3000 : FVFunctorConvectiveHeatFluxBC::computeQpResidual() 42 : { 43 : // Allow the functors to pick their side evaluation since either T_bulk or T_solid is likely not 44 : // defined on this boundary condition's side 45 3000 : const Moose::FaceArg face{ 46 3000 : _face_info, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr}; 47 3000 : const auto flux = _htc(face, determineState()) * 48 3000 : (_T_bulk(face, determineState()) - _T_solid(face, determineState())); 49 3000 : if (_is_solid) 50 325 : return -flux; 51 : else 52 2675 : return flux; 53 : }