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 149 : FVFunctorConvectiveHeatFluxBC::validParams() 17 : { 18 149 : InputParameters params = FVFluxBC::validParams(); 19 149 : params.addClassDescription( 20 : "Convective heat transfer boundary condition with temperature and heat " 21 : "transfer coefficient given by functors."); 22 298 : params.addRequiredParam<MooseFunctorName>("T_solid", "Functor for wall temperature"); 23 298 : params.addRequiredParam<MooseFunctorName>("T_bulk", "Functor for far-field temperature"); 24 298 : params.addRequiredParam<MooseFunctorName>("heat_transfer_coefficient", 25 : "Functor for heat transfer coefficient"); 26 298 : params.addRequiredParam<bool>("is_solid", "Whether this kernel acts on the solid temperature"); 27 : 28 149 : return params; 29 0 : } 30 : 31 50 : FVFunctorConvectiveHeatFluxBC::FVFunctorConvectiveHeatFluxBC(const InputParameters & parameters) 32 : : FVFluxBC(parameters), 33 50 : _T_solid(getFunctor<ADReal>("T_solid")), 34 100 : _T_bulk(getFunctor<ADReal>("T_bulk")), 35 100 : _htc(getFunctor<ADReal>("heat_transfer_coefficient")), 36 150 : _is_solid(getParam<bool>("is_solid")) 37 : { 38 50 : } 39 : 40 : ADReal 41 1950 : 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 1950 : const Moose::FaceArg face{ 46 1950 : _face_info, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr}; 47 1950 : const auto flux = _htc(face, determineState()) * 48 1950 : (_T_bulk(face, determineState()) - _T_solid(face, determineState())); 49 1950 : if (_is_solid) 50 220 : return -flux; 51 : else 52 1730 : return flux; 53 : }