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 "SideSetHeatTransferMaterial.h" 11 : 12 : #include "Function.h" 13 : 14 : // Stefan - Boltzmann Constant 15 : const Real SIGMA = 5.670374419E-8; 16 : 17 : registerMooseObject("HeatTransferApp", SideSetHeatTransferMaterial); 18 : 19 : InputParameters 20 81 : SideSetHeatTransferMaterial::validParams() 21 : { 22 81 : InputParameters params = InterfaceMaterial::validParams(); 23 81 : params.addClassDescription("This material constructs the necessary coefficients and properties " 24 : "for SideSetHeatTransferKernel."); 25 162 : params.addParam<FunctionName>("conductivity", 0.0, "Heat conductivity in W/m/K."); 26 162 : params.addParam<FunctionName>("conductivity_temperature_function", 27 : "Heat conductivity in W/m/K as a function of temperature."); 28 162 : params.addCoupledVar( 29 : "gap_temperature", 30 : "Coupled Temperature of gap, used for computing temperature dependent conductivity."); 31 162 : params.addParam<FunctionName>("gap_length", 1.0, "Total width of gap in m."); 32 162 : params.addParam<FunctionName>("Tbulk", 300, "Bulk temperature of gap in K."); 33 162 : params.addParam<FunctionName>( 34 162 : "h_primary", 0.0, "Convective heat transfer coefficient (primary face) in W/m^2/K."); 35 162 : params.addParam<FunctionName>( 36 162 : "h_neighbor", 0.0, "Convective heat transfer coefficient (neighbor face) in W/m^2/K."); 37 162 : params.addParam<FunctionName>("emissivity_primary", 0.0, "Primary face emissivity."); 38 162 : params.addParam<FunctionName>("emissivity_neighbor", 0.0, "Neighbor face emissivity."); 39 162 : params.addParam<FunctionName>("reflectivity_primary", 40 : "Primary face reflectivity, uses (1-emissivity) if not provided."); 41 162 : params.addParam<FunctionName>("reflectivity_neighbor", 42 : "Neighbor face reflectivity, uses (1-emissivity) if not provided."); 43 81 : return params; 44 0 : } 45 : 46 43 : SideSetHeatTransferMaterial::SideSetHeatTransferMaterial(const InputParameters & parameters) 47 : : InterfaceMaterial(parameters), 48 129 : _kgap(isParamValid("conductivity_temperature_function") 49 86 : ? getFunction("conductivity_temperature_function") 50 76 : : getFunction("conductivity")), 51 53 : _Tk(isCoupled("gap_temperature") ? &coupledValue("gap_temperature") : nullptr), 52 43 : _dgap(getFunction("gap_length")), 53 43 : _Tb(getFunction("Tbulk")), 54 43 : _hp(getFunction("h_primary")), 55 43 : _hm(getFunction("h_neighbor")), 56 43 : _eps_p(getFunction("emissivity_primary")), 57 43 : _eps_m(getFunction("emissivity_neighbor")), 58 86 : _rho_p(isParamValid("reflectivity_primary") ? &getFunction("reflectivity_primary") : nullptr), 59 86 : _rho_m(isParamValid("reflectivity_neighbor") ? &getFunction("reflectivity_neighbor") : nullptr), 60 43 : _cond(declareProperty<Real>("gap_conductance")), 61 43 : _Tbulk(declareProperty<Real>("gap_Tbulk")), 62 43 : _h_primary(declareProperty<Real>("gap_h_primary")), 63 43 : _h_neighbor(declareProperty<Real>("gap_h_neighbor")), 64 43 : _emmissivity_eff_primary(declareProperty<Real>("gap_emissivity_eff_primary")), 65 43 : _emmissivity_eff_neighbor(declareProperty<Real>("gap_emissivity_eff_neighbor")), 66 43 : _sigma(SIGMA) 67 : { 68 96 : if ((parameters.isParamSetByUser("conductivity") || 69 129 : isParamValid("conductivity_temperature_function")) && 70 129 : !parameters.isParamSetByUser("gap_length")) 71 0 : paramError("gap_length", "gap_length not set, but conduction term requested."); 72 129 : if (parameters.isParamSetByUser("gap_length") && 73 96 : !(parameters.isParamSetByUser("conductivity") || 74 63 : isParamValid("conductivity_temperature_function"))) 75 0 : paramError("conductivity", "conductivity not set, but conduction term requested."); 76 129 : if (isParamValid("conductivity_temperature_function") && 77 53 : parameters.isParamSetByUser("conductivity")) 78 0 : paramError("conductivity", 79 : "Cannot specify both conductivity and conductivity_temperature_function."); 80 129 : if (isParamValid("conductivity_temperature_function") && !_Tk) 81 0 : paramError("gap_temperature", 82 : "Variable specification for temp needed if specifying a temperature dependent " 83 : "conductivity."); 84 : 85 129 : if (parameters.isParamSetByUser("h_primary") && !parameters.isParamSetByUser("h_neighbor")) 86 0 : paramError("h_neighbor", "h_neighbor not set, but convection term requested."); 87 129 : if (parameters.isParamSetByUser("h_neighbor") && !parameters.isParamSetByUser("h_primary")) 88 0 : paramError("h_primary", "h_primary not set, but convection term requested."); 89 : 90 129 : if (parameters.isParamSetByUser("emissivity_primary") && 91 129 : !parameters.isParamSetByUser("emissivity_neighbor")) 92 0 : paramError("emissivity_neighbor", "emissivity_neighbor not set, but radiation term requested"); 93 129 : if (parameters.isParamSetByUser("emissivity_neighbor") && 94 129 : !parameters.isParamSetByUser("emissivity_primary")) 95 0 : paramError("emissivity_primary", "emissivity_primary not set, but radiation term requested"); 96 43 : } 97 : 98 : void 99 21078 : SideSetHeatTransferMaterial::computeQpProperties() 100 : { 101 : // Conductance defined as k_{gap}/\delta 102 21078 : Real tqp = (_Tk ? (*_Tk)[_qp] : _t); 103 21078 : _cond[_qp] = _kgap.value(tqp, _q_point[_qp]) / _dgap.value(_t, _q_point[_qp]); 104 : 105 : // Convection parameters 106 21078 : _Tbulk[_qp] = _Tb.value(_t, _q_point[_qp]); 107 21078 : _h_primary[_qp] = _hp.value(_t, _q_point[_qp]); 108 21078 : _h_neighbor[_qp] = _hm.value(_t, _q_point[_qp]); 109 : 110 : // If reflectivity not provided, assume 1 - epsilon 111 21078 : Real rhop = (_rho_p ? (*_rho_p).value(_t, _q_point[_qp]) : 1.0 - _eps_p.value(_t, _q_point[_qp])); 112 21078 : Real rhom = (_rho_m ? (*_rho_m).value(_t, _q_point[_qp]) : 1.0 - _eps_m.value(_t, _q_point[_qp])); 113 : 114 : // Compute effective emissivity (primary): \frac{\sigma\epsilon^+(1-\rho^-)}{1-rho^+\rho^-} 115 21078 : _emmissivity_eff_primary[_qp] = _sigma * _eps_p.value(_t, _q_point[_qp]) * (1.0 - rhom); 116 21078 : if (_emmissivity_eff_primary[_qp] != 0.0) // Making sure we don't devide by zero 117 21078 : _emmissivity_eff_primary[_qp] /= 1.0 - rhop * rhom; 118 : 119 : // Compute effective emissivity (neighbor): \frac{\sigma\epsilon^-(1-\rho^+)}{1-rho^+\rho^-} 120 21078 : _emmissivity_eff_neighbor[_qp] = _sigma * _eps_m.value(_t, _q_point[_qp]) * (1.0 - rhop); 121 21078 : if (_emmissivity_eff_neighbor[_qp] != 0.0) // Making sure we don't devide by zero 122 21078 : _emmissivity_eff_neighbor[_qp] /= 1.0 - rhop * rhom; 123 21078 : }