{"id":2667,"date":"2026-03-13T22:45:12","date_gmt":"2026-03-13T22:45:12","guid":{"rendered":"https:\/\/laserphotonics.uk\/?p=2667"},"modified":"2026-03-13T22:45:16","modified_gmt":"2026-03-13T22:45:16","slug":"h-setting","status":"publish","type":"post","link":"https:\/\/laserphotonics.uk\/?p=2667","title":{"rendered":"h setting"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><strong>In COMSOL<\/strong>: h_top = 14.4, h_bot = 7.2 W\/m\u00b2K are <strong>fixed constants<\/strong> from t=0. Full convective cooling is applied from the very first second.<\/p>\n\n\n\n<p><strong>In TS<\/strong>: h is recomputed every timestep from the Churchill &amp; Chu correlation at <code>T_mean<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>T_mean = float(np.mean(T))   # starts at T_amb = 20\u00b0C\nht = calc_h_top(T_mean)      # \u2192 h \u2248 0 at t=0 !\n<\/code><\/pre>\n\n\n\n<p>At t=0, <code>T_mean = T_amb<\/code>, so <code>\u0394T = 0<\/code>, <code>Ra = 0<\/code>, <code>h = 0<\/code>. TS starts with <strong>essentially zero convective cooling<\/strong> and only builds up h as the board heats. The full h=14.4 isn&#8217;t reached until T_mean \u2248 55\u00b0C (\u0394T \u2248 35K above ambient).<\/p>\n\n\n\n<p>So early in the transient:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Time<\/th><th>COMSOL h_top<\/th><th>TS h_top (approx)<\/th><\/tr><\/thead><tbody><tr><td>t = 0 s<\/td><td>14.4 W\/m\u00b2K<\/td><td>~0<\/td><\/tr><tr><td>t = 60 s<\/td><td>14.4 W\/m\u00b2K<\/td><td>~5\u20138<\/td><\/tr><tr><td>t = 300 s<\/td><td>14.4 W\/m\u00b2K<\/td><td>~11\u201313<\/td><\/tr><tr><td>SS<\/td><td>14.4 W\/m\u00b2K<\/td><td>14.4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>TS has far less cooling during the transient \u2192 rises faster and higher. At SS both converge to the same h, so SS temperatures should match closely. This matches exactly what the chart shows.<\/p>\n\n\n\n<p><strong>Simple fix<\/strong>: evaluate h at a representative \u0394T from the start (e.g., use the current local temperature rather than T_mean, or initialise h at the SS value and let it update). The most direct fix to match the COMSOL setup would be to use fixed h values:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Option: fix h to SS calibrated values (matches COMSOL setup)\nht = calc_h_top(T_AMB + 35.0)   # evaluate at design \u0394T=35K, constant\nhb = calc_h_bottom(T_AMB + 35.0)\n<\/code><\/pre>\n\n\n\n<p>Or keep temperature-dependent h but evaluate at a better representative temperature than T_mean.no, I want fix that in comsol, not in TS, teach me how to defin ht and hb in comsol as fucntion of position and temperature.<\/p>\n\n\n\n<p>In COMSOL, you define h as an expression in T directly in the <strong>Heat Flux<\/strong> boundary condition. Here&#8217;s how:<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3>Step 1 \u2014 Define parameters (Global Definitions &gt; Parameters)<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Name<\/th><th>Expression<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>T_amb<\/code><\/td><td><code>293.15[K]<\/code><\/td><td>Ambient temperature<\/td><\/tr><tr><td><code>k_air<\/code><\/td><td><code>0.0271[W\/(m*K)]<\/code><\/td><td>Air conductivity<\/td><\/tr><tr><td><code>nu_air<\/code><\/td><td><code>1.655e-5[m^2\/s]<\/code><\/td><td>Kinematic viscosity<\/td><\/tr><tr><td><code>alpha_air<\/code><\/td><td><code>2.34e-5[m^2\/s]<\/code><\/td><td>Thermal diffusivity<\/td><\/tr><tr><td><code>L_c<\/code><\/td><td><code>0.0292[m]<\/code><\/td><td>Characteristic length (A\/P)<\/td><\/tr><tr><td><code>H_SCALE<\/code><\/td><td><code>1.76<\/code><\/td><td>Nu calibration multiplier<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3>Step 2 \u2014 Define variables (Global Definitions &gt; Variables)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dT_surf   = max(T - T_amb, 0.001&#91;K])\nT_film    = (T + T_amb) \/ 2\nbeta_air  = 1 \/ T_film\nRa        = 9.81&#91;m\/s^2] * beta_air * dT_surf * L_c^3 \/ (nu_air * alpha_air)\nNu_top    = if(Ra &lt; 1e7, 0.54 * Ra^0.25, 0.15 * Ra^(1\/3))\nNu_bot    = 0.27 * Ra^0.25\nh_top_fn  = Nu_top * k_air \/ L_c * H_SCALE\nh_bot_fn  = Nu_bot * k_air \/ L_c * H_SCALE\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><code>max(..., 0.001)<\/code> avoids Ra=0 at t=0 when T=T_amb.<\/p><\/blockquote>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3>Step 3 \u2014 Apply to boundary conditions<\/h3>\n\n\n\n<p><strong>Top surface<\/strong> \u2014 Heat Flux BC:<\/p>\n\n\n\n<ul><li>Type:&nbsp;<code>General inward heat flux<\/code><\/li><li>Expression:&nbsp;<code>h_top_fn * (T_amb - T)<\/code><\/li><\/ul>\n\n\n\n<p><strong>Bottom surface<\/strong> \u2014 Heat Flux BC:<\/p>\n\n\n\n<ul><li>Expression:&nbsp;<code>h_bot_fn * (T_amb - T)<\/code><\/li><\/ul>\n\n\n\n<p>Alternatively, use the built-in <strong>&#8220;Convective heat flux&#8221;<\/strong> type and enter <code>h_top_fn<\/code> in the h field \u2014 COMSOL will evaluate it locally at each surface node&#8217;s current T automatically.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3>What this achieves<\/h3>\n\n\n\n<ul><li>At t=0: T=T_amb, dT\u22480, Ra\u22480, h\u22480 (matches TS behaviour)<\/li><li>At SS: Ra\u224871,000, h_top\u224814.4, h_bot\u22487.2 W\/m\u00b2K (matches calibrated values)<\/li><li>COMSOL evaluates the expression&nbsp;<strong>locally per element<\/strong>&nbsp;at each timestep \u2014 better than TS which uses T_mean globally<\/li><li>The transient h buildup will match TS more closely<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In COMSOL: h_top = 14.4, h_bot = 7.2 W\/m\u00b2K are fixed constants from t=0. Full convective cooling is applied from the very first second. In TS: h is recomputed every timestep from the Churchill &amp; Chu correlation at T_mean: At t=0, T_mean = T_amb, so \u0394T = 0, Ra = 0, h = 0. TS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/2667"}],"collection":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2667"}],"version-history":[{"count":1,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/2667\/revisions"}],"predecessor-version":[{"id":2668,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/2667\/revisions\/2668"}],"wp:attachment":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}