# UDF to change heat transfer coefficient with wall temperature

 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 10, 2012, 05:21 UDF to change heat transfer coefficient with wall temperature #1 New Member   Emma Join Date: Sep 2009 Posts: 17 Blog Entries: 1 Rep Power: 16 Hi I need to change the heat transfer coefficient on a wall with changing temperature on the wall. I have written a simple UDF to change the heat transfer coefficient, which is interpreting into Fluent with no problems, but when I run a monitor on the wall for Total surface heat transfer coefficient it is giving me strange answers with negative values. I know that very low values of ln() will give a negative answer but anything over ln(0.4) in this equation will give a postivie answer. At a temperature of 297, this equation should give a h value of 3.06, but instead it keeps returning a value of 0.0002. Is my UDF too basic? or is the problem with my monitor? #include "udf.h" DEFINE_PROFILE(HTC, thread, index) { face_t f; real Temp = 293.15; F_PROFILE(f, thread, index) = 1.2854*log(Temp - 293) + 1.2822; } Or should i be using the return HTC function as is used in DEFINE_PROPERTY which change with temperature also? Last edited by emmkell; May 10, 2012 at 07:51.

 May 10, 2012, 09:05 #2 Member   Daniel Tanner Join Date: Apr 2009 Posts: 54 Rep Power: 18 You cannot use Define_Profile this way. There needs to be a loop that loops over each element on the boundary/face of interest. I ripped the udf below out of the UDF manual. You need to have something of this form (take out the velocity stuff and enter your temperature stuff). Currently I think your UDF will only apply this correction to the first element of the face! Let me know how you get on. /************************************************** ********************* vprofile.c UDF for specifying steady-state velocity profile boundary condition ************************************************** **********************/ #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = 20. - y*y/(.0745*.0745)*20.; } end_f_loop(f, thread) }

 May 10, 2012, 09:27 #3 New Member   Emma Join Date: Sep 2009 Posts: 17 Blog Entries: 1 Rep Power: 16 Thanks Dan! I had tried some variations of this but didnt get anything to give the right ht coefficient. I will give it another try just changing the details to what I need. I read in a couple of differnet threads on this forum that fluent doesnt give accurate readings of heat transfer coefficient from its surface monitor readout and I'd need another UDF to findout what fluent is settin gthe heat transfer coefficient to.

 June 9, 2012, 00:23 #4 New Member   Ali Join Date: Jun 2012 Posts: 6 Rep Power: 13 Hi Emmkell, did you solve your problem? I mean did write a UDF which change the heat transfer coefficient on a wall in terms of the wall temperature? if you solved your problem could you help me? I have a similar problem! this is my email: ghasemian.a@gmail.com

 August 8, 2012, 11:23 #5 New Member   Emma Join Date: Sep 2009 Posts: 17 Blog Entries: 1 Rep Power: 16 I got this working, I forgot to post it up here, using your recommendation Daniel, thank you! I had to change y = x[1] to y = x[0] for some reason, i didnt understand what it meant at the time but i understand now that it is picking the values in the x array in either cell 0,1 or 2, so the fact that it worked for me must be something to do with how i set up my geometry? Changing the wall thickness also helped. #include "udf.h" /* UDF Define Temperature dependant heat transfer coefficient) */ DEFINE_PROFILE(htc, thread, position) { face_t f; real x[ND_ND]; /* this will hold the position vector */ real y = F_T(f,thread); begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[0]; F_PROFILE(f, thread, position) = 0.7942 + 1.3915*log(y); } end_f_loop(f, thread) } Wohoo! Now on to the next UDF problem!

 June 19, 2013, 12:40 #6 New Member   Hatef Khadivinassab Join Date: Jan 2013 Posts: 6 Rep Power: 13 Emma, This is wrong! regards,

 July 10, 2013, 12:49 #7 New Member   Join Date: Jun 2013 Posts: 2 Rep Power: 0 Hatef, Care to elaborate on why this is wrong? I'm about to start writing a similar UDF and would greatly appreciate an explanation on why you think this is incorrect. Cheers,

 July 11, 2013, 06:19 #8 New Member   Hatef Khadivinassab Join Date: Jan 2013 Posts: 6 Rep Power: 13 Ddmillar, Because in Emma's code, she has defined y (the temperature of the face) outside the loop, and inside the loop the value of y is overwritten by x[0]. Although this was really helpful, but unfortunately this does not work. I have written a code for time and temperature dependent heat transfer coefficient as follows; #include "udf.h" DEFINE_PROFILE(htc, thread, position) { face_t f; real y; real t = CURRENT_TIME; begin_f_loop(f, thread) { y = F_T(f,thread); if (t<250) F_PROFILE(f, thread, position) = 0.00000026*(y*y*y) - 0.00038*(y*y) + 0.25*y - 38; else F_PROFILE(f, thread, position) = 0.00000014*(y*y*y) - 0.00021*(y*y) + 0.14*y - 20; } end_f_loop(f, thread) } Regards, M123, rajendra kumar, Haseeb and 1 others like this.

 January 4, 2015, 13:14 #9 New Member   Join Date: Oct 2014 Posts: 17 Rep Power: 11 Hello Hatef, I have similar problem in defining HTC through UDF. If I am not wrong, bulk temperature or reference temperature has to be also included in the program. But I could see only a temperature polynomial equation is defined to get HTC. Could you please expalin me, how did you arrive with this equation? I am relatively new to UDF...So please help me out in understanding the UDF written by you.

 April 7, 2015, 10:27 Want to write UDF for heat flux on wall for a cylindrical tube change with temperatur #10 New Member   Geetesh Waghela Join Date: Apr 2014 Posts: 6 Rep Power: 12 hey guys, I am doing analysis on a cylinder with 2D axisymmetric model in fluent. I have implemented a profile file for outer wall of cylinder but i want to implement a udf for inner wall as a function of temperature so that i could get accurate temperature on axis(fluid region). my axial length is 0.1m and longitudnal length is 0.003m from axis. I have tried using constant heat flux and coupled condition on inner wall but it does not help. i want to get temperature profile in fluid region.

 April 7, 2015, 18:52 #11 Senior Member   Join Date: Mar 2015 Posts: 892 Rep Power: 18 Why not let Fluent use the energy equation to simulate the temperature profile on the inner wall?

 April 7, 2015, 23:16 #12 New Member   Geetesh Waghela Join Date: Apr 2014 Posts: 6 Rep Power: 12 Hey e, I have outer wall temperature profile from experiment using methane-air as fluid entering into the geometry. I made the temperature profile as boundary condition on outer wall using profile. If i let the inner wall as coupled then axis nor the inner wall does not get sufficient temperature as it should get. the material i use is fused silica for cylinder. If i choose inner wall as heat flux and i gave it as zero then inner wall receives proper temperature but axis remains at 300 K. According to the results my inner wall and axis both should have a temperature of 1300 K but i am getting till 800 K only at the place of highest temperature. What should i do?

 May 16, 2016, 14:04 UDF wall heat flux #13 New Member   Narender Kumar Join Date: May 2016 Posts: 1 Rep Power: 0 Hello everyone, i am simulating turbulent flow in a rectangular duct with heat flux from one side wall (bottom). I want the heat flux vary axially (as a function of axial distance). Does anyone have any idea about how it can be done ?

 September 15, 2016, 11:52 #14 New Member   hussein Join Date: Aug 2016 Posts: 5 Rep Power: 9 please help how can i define the heat flux as a function of temperature of wall q=1000*(1-0.014*(T-298)) any one can help me in writing the UDF please

July 12, 2017, 07:25
#15
New Member

AnsysUser
Join Date: Jul 2016
Posts: 9
Rep Power: 9
Quote:
 Originally Posted by emmkell I got this working, I forgot to post it up here, using your recommendation Daniel, thank you! I had to change y = x[1] to y = x[0] for some reason, i didnt understand what it meant at the time but i understand now that it is picking the values in the x array in either cell 0,1 or 2, so the fact that it worked for me must be something to do with how i set up my geometry? Changing the wall thickness also helped. #include "udf.h" /* UDF Define Temperature dependant heat transfer coefficient) */ DEFINE_PROFILE(htc, thread, position) { face_t f; real x[ND_ND]; /* this will hold the position vector */ real y = F_T(f,thread); begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[0]; F_PROFILE(f, thread, position) = 0.7942 + 1.3915*log(y); } end_f_loop(f, thread) } Wohoo! Now on to the next UDF problem!

Hello,

where ¨F_PROFILE(f, thread, position) = 0.7942 + 1.3915*log(y);¨ this equation comes from?

July 15, 2017, 05:45
#16
New Member

Saurav Chakraborty
Join Date: Sep 2013
Posts: 14
Rep Power: 12
Quote:
 Originally Posted by hussein92 please help how can i define the heat flux as a function of temperature of wall q=1000*(1-0.014*(T-298)) any one can help me in writing the UDF please

hello Hussein, please let me know if you got your UDF working for the temperature dependent heat flux. I am also trying for the same, not yet successful. It seems the DEFINE_PROFILE macro is not sufficient. I was suggested that the DEFINE_EXECUTE_AT_END macro is also required, but i am not able to put it up together.

Any help from a senior member would also be highly appreciated.

 July 15, 2017, 06:54 #17 New Member   Saurav Chakraborty Join Date: Sep 2013 Posts: 14 Rep Power: 12 Thanks to Hatef. The one written by him in the thread above works perfectly well.

August 5, 2018, 04:31
#18
Member

Join Date: Oct 2017
Posts: 52
Rep Power: 8
Quote:
 Originally Posted by Daniel Tanner You cannot use Define_Profile this way. There needs to be a loop that loops over each element on the boundary/face of interest. I ripped the udf below out of the UDF manual. You need to have something of this form (take out the velocity stuff and enter your temperature stuff). Currently I think your UDF will only apply this correction to the first element of the face! Let me know how you get on. /************************************************** ********************* vprofile.c UDF for specifying steady-state velocity profile boundary condition ************************************************** **********************/ #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = 20. - y*y/(.0745*.0745)*20.; } end_f_loop(f, thread) }
I have to calculate heat transfer losses from radial surface of the cylinder.
I have written a udf for this but it is showing "segmentation fault".
can you tell me where might be the problem ?

Code:
```#include "udf.h"

{
real h;
real T_ext;
face_t f;
{
h = 10;
T_ext = 300;
}

}```

 August 7, 2018, 03:44 #19 Senior Member   Join Date: Nov 2013 Posts: 1,965 Rep Power: 26 Gouravjee, you don't need to ask the same question so many times on different locations on this forum... One time is enough!

 Tags heat transfer coefficient, udf