


{"id":314241,"date":"2023-11-01T00:48:07","date_gmt":"2023-11-01T00:48:07","guid":{"rendered":"\/forum\/forums\/topic\/how-ansys-flunet-calculate-the-wall-heat-flux\/"},"modified":"2023-11-01T10:08:22","modified_gmt":"2023-11-01T10:08:22","slug":"how-ansys-flunet-calculate-the-wall-heat-flux","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-ansys-flunet-calculate-the-wall-heat-flux\/","title":{"rendered":"How Ansys Fluent Calculate the Wall Heat Flux?"},"content":{"rendered":"<p>Hi all, I am currently working on a simulatoin case of &#8220;crossflow over a tube&#8221;, the shematic geometry and boundary conditions are shown in following figure<\/p>\n<p><a class=\"wp-colorbox-image cboxElement\" href=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799513-cross_flow_over_a_tube.png\"><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799513-cross_flow_over_a_tube.png\" alt=\"\"><\/a><\/p>\n<p>&#8211; Introduction &#8211;<br \/>I&#8217;ve develpoed a mathematical model ( in-house code ) to simulate the heat transfer of the tube solid region including external flow ( see above figure ) and aim to couple it with Ansys Fluent. The in-house code require the outer wall heat flux from Ansys Fluent as the boundary conditions.<\/p>\n<p>&#8211; How I calculate the outer wall heat flux using UDF &#8211;<br \/>The whole process is control by DEFINE_ON_DEMAND ( a macro in UDF ) which is a general-purpose macro in Ansys Fluent. I calculate the outer wall heat flux as below:<\/p>\n<p><a class=\"wp-colorbox-image cboxElement\" href=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799539-harmonic_mean.png\"><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799539-harmonic_mean.png\" alt=\"\"><\/a><br \/>Using right hand side of Eq. (1) in above figure, the snippet of code&nbsp;<\/p>\n<pre class=\"alt2\" dir=\"ltr\">        \/\/ Phase domain\n        Domain *domain = Get_Domain(1) ;\n\n        \/\/ The ID of the BC created in ANSYS Fluent\n        const int wall_ID = 21 ;\n\n        \/\/ Get the thread from the domain, the thread is partitioned\n        Thread *f_thread = Lookup_Thread( domain, wall_ID ) ;\n        \n        \/\/ Create face ID\n        face_t f_ID ;\n        \n        \/* Adjacent cell information *\/\n\n        \/\/ adjacent cell index of the boundary face\n        cell_t c0 ;  \n\n        \/\/ thread index of adjacent cell\n        Thread *t0 ; \n        \n        \/\/ xf represents facets location array and xc is cell center locatoin array\n        real xf[ND_ND] ;\n        real xc[ND_ND] ;\n\n        begin_f_loop( f_ID, f_thread )\n        {\n            \/* Get the cell center \n            F_CENTROID( xf, f_ID, f_thread ) ;\n   \n            \/* Get the cell id of the cell adjacent to the face*\/\n            c0 = F_C0( f_ID, f_thread ) ;         \n            \n            \/* Get the Thread id of the cells adjacent to the face*\/\n            t0 = F_C0_THREAD( f_ID, f_thread ) ; \n            \n            C_CENTROID( xc, c0, t0 ) ;\n\n            \/* dx is ignored because the cell center and face center are align in radial direction\n            double dy = abs(xc[1] - xf[1]) ;\n            double dz = abs(xc[2] - xf[2]) ;\n            double dr = sqrt(dy*dy+dz*dz)  ;\n\n            <span style=\"color: red\">\/\/ Calculate the surface heat flux, k_f * (T_cell - T_face ) \/ dr\n            q_array[ f_ID ] = C_K_L(c0, t0) * (C_T(c0, t0) - F_T(f_ID, f_thread)) \/ dr ; \/\/ C_K_L(c0, t0) is the UDF macro return fluid thermal conductivity<\/span>\n        }\n        end_f_loop( f_ID, f_thread )<\/pre>\n<p class=\"alt2\" dir=\"ltr\">\n<p>&#8211; Main Issue &#8211;<br \/>The difference between the outer wall heat flux calcuted by UDF and from Ansys ( using built-in function on GUI, File-&gt;export-&gt;solution data-&gt;Total Surface Heat Flux ) are shown below<\/p>\n<p><a class=\"wp-colorbox-image cboxElement\" href=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799637-outer_wall_heat_flux.png\"><img decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2023\/11\/01-11-2023-1698799637-outer_wall_heat_flux.png\" alt=\"\"><\/a><\/p>\n<p>The outer wall heat flux is represented in 2D and &theta;=180&deg; is bottom region of the tube. Refer to the figure, most of the error occurs at &theta;=120&deg;~240&deg; and the maximum error of 5.33%.<\/p>\n<p><span style=\"color: red\">Does anyone have any experience with this? I would appreciate your advice and suggestions.<\/span><\/p>\n","protected":false},"template":"","class_list":["post-314241","topic","type-topic","status-closed","hentry","topic-tag-ansys-fluent","topic-tag-heat-flux","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["296999","15180"],"_bbp_author_ip":["23.52.43.81"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["3016"],"_edit_lock":["1698833268:237258"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["314241"],"_bbp_forum_id":["27792"],"_bbp_engagement":["15180","296999"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["315041"],"_bbp_last_active_id":["315041"],"_bbp_last_active_time":["2023-11-06 13:11:35"]},"test":"eddie4160gmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/314241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/314241\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=314241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}