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 910 : ConvectiveFluxFunction::validParams() 18 : { 19 910 : InputParameters params = IntegratedBC::validParams(); 20 1820 : params.addRequiredParam<FunctionName>("T_infinity", "Function describing far-field temperature"); 21 1820 : params.addRequiredParam<FunctionName>("coefficient", 22 : "Function describing heat transfer coefficient"); 23 1820 : MooseEnum coef_func_type("TIME_AND_POSITION TEMPERATURE", "TIME_AND_POSITION"); 24 1820 : params.addParam<MooseEnum>( 25 : "coefficient_function_type", 26 : coef_func_type, 27 : "Type of function for heat transfer coefficient provided in 'coefficient' parameter"); 28 910 : params.addClassDescription( 29 : "Determines boundary value by fluid heat transfer coefficient and far-field temperature"); 30 : 31 910 : return params; 32 910 : } 33 : 34 487 : ConvectiveFluxFunction::ConvectiveFluxFunction(const InputParameters & parameters) 35 : : IntegratedBC(parameters), 36 487 : _T_infinity(getFunction("T_infinity")), 37 487 : _coefficient(getFunction("coefficient")), 38 1461 : _coef_func_type(getParam<MooseEnum>("coefficient_function_type").getEnum<CoefFuncType>()) 39 : { 40 487 : } 41 : 42 : Real 43 13255480 : ConvectiveFluxFunction::computeQpResidual() 44 : { 45 : Real coef; 46 13255480 : if (_coef_func_type == CoefFuncType::TIME_AND_POSITION) 47 13254200 : coef = _coefficient.value(_t, _q_point[_qp]); 48 : else 49 1280 : coef = _coefficient.value(_u[_qp], Point()); 50 : 51 13255480 : return _test[_i][_qp] * coef * (_u[_qp] - _T_infinity.value(_t, _q_point[_qp])); 52 : } 53 : 54 : Real 55 38842912 : ConvectiveFluxFunction::computeQpJacobian() 56 : { 57 38842912 : if (_coef_func_type == CoefFuncType::TIME_AND_POSITION) 58 : { 59 38841312 : Real coef = _coefficient.value(_t, _q_point[_qp]); 60 38841312 : return _test[_i][_qp] * coef * _phi[_j][_qp]; 61 : } 62 : else 63 : { 64 1600 : const Real coef = _coefficient.value(_u[_qp]); 65 1600 : const Real dcoef_dT = _coefficient.timeDerivative(_u[_qp]); 66 1600 : return _test[_i][_qp] * (coef + (_u[_qp] - _T_infinity.value(_t, _q_point[_qp])) * dcoef_dT) * 67 1600 : _phi[_j][_qp]; 68 : } 69 : }