CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF to change heat transfer coefficient with wall temperature

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By hatef

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2012, 06:21
Default UDF to change heat transfer coefficient with wall temperature
  #1
New Member
 
Emma
Join Date: Sep 2009
Posts: 17
Blog Entries: 1
Rep Power: 17
emmkell is on a distinguished road
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 08:51.
emmkell is offline   Reply With Quote

Old   May 10, 2012, 10:05
Default
  #2
Member
 
Daniel Tanner
Join Date: Apr 2009
Posts: 54
Rep Power: 18
Daniel Tanner is on a distinguished road
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)
}
Daniel Tanner is offline   Reply With Quote

Old   May 10, 2012, 10:27
Default
  #3
New Member
 
Emma
Join Date: Sep 2009
Posts: 17
Blog Entries: 1
Rep Power: 17
emmkell is on a distinguished road
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.
emmkell is offline   Reply With Quote

Old   June 9, 2012, 01:23
Default
  #4
New Member
 
Ali
Join Date: Jun 2012
Posts: 6
Rep Power: 14
alighasemian is on a distinguished road
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
alighasemian is offline   Reply With Quote

Old   August 8, 2012, 12:23
Default
  #5
New Member
 
Emma
Join Date: Sep 2009
Posts: 17
Blog Entries: 1
Rep Power: 17
emmkell is on a distinguished road
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!
emmkell is offline   Reply With Quote

Old   June 19, 2013, 13:40
Default
  #6
New Member
 
Hatef Khadivinassab
Join Date: Jan 2013
Posts: 6
Rep Power: 13
hatef is on a distinguished road
Emma,

This is wrong!

regards,
hatef is offline   Reply With Quote

Old   July 10, 2013, 13:49
Default
  #7
New Member
 
Join Date: Jun 2013
Posts: 2
Rep Power: 0
ddmillar is on a distinguished road
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,
ddmillar is offline   Reply With Quote

Old   July 11, 2013, 07:19
Default
  #8
New Member
 
Hatef Khadivinassab
Join Date: Jan 2013
Posts: 6
Rep Power: 13
hatef is on a distinguished road
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,
hatef is offline   Reply With Quote

Old   January 4, 2015, 14:14
Default
  #9
New Member
 
Join Date: Oct 2014
Posts: 17
Rep Power: 12
kaeran is on a distinguished road
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.
kaeran is offline   Reply With Quote

Old   April 7, 2015, 11:27
Default 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
geeteshwaghela1234 is on a distinguished road
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.
geeteshwaghela1234 is offline   Reply With Quote

Old   April 7, 2015, 19:52
Default
  #11
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Why not let Fluent use the energy equation to simulate the temperature profile on the inner wall?
`e` is offline   Reply With Quote

Old   April 8, 2015, 00:16
Default
  #12
New Member
 
Geetesh Waghela
Join Date: Apr 2014
Posts: 6
Rep Power: 12
geeteshwaghela1234 is on a distinguished road
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?
geeteshwaghela1234 is offline   Reply With Quote

Old   May 16, 2016, 15:04
Default UDF wall heat flux
  #13
New Member
 
Narender Kumar
Join Date: May 2016
Posts: 1
Rep Power: 0
ykumarnarender is on a distinguished road
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 ?
ykumarnarender is offline   Reply With Quote

Old   September 15, 2016, 12:52
Default
  #14
New Member
 
hussein
Join Date: Aug 2016
Posts: 5
Rep Power: 10
hussein92 is on a distinguished road
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
hussein92 is offline   Reply With Quote

Old   July 12, 2017, 08:25
Default
  #15
New Member
 
AnsysUser
Join Date: Jul 2016
Posts: 9
Rep Power: 10
Shreman is on a distinguished road
Quote:
Originally Posted by emmkell View Post
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?
Shreman is offline   Reply With Quote

Old   July 15, 2017, 06:45
Default
  #16
New Member
 
Saurav Chakraborty
Join Date: Sep 2013
Posts: 14
Rep Power: 13
srv1406 is on a distinguished road
Quote:
Originally Posted by hussein92 View Post
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.
srv1406 is offline   Reply With Quote

Old   July 15, 2017, 07:54
Default
  #17
New Member
 
Saurav Chakraborty
Join Date: Sep 2013
Posts: 14
Rep Power: 13
srv1406 is on a distinguished road
Thanks to Hatef. The one written by him in the thread above works perfectly well.
srv1406 is offline   Reply With Quote

Old   August 5, 2018, 05:31
Default
  #18
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 9
gouravjee is on a distinguished road
Quote:
Originally Posted by Daniel Tanner View Post
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"


DEFINE_PROFILE(fluxloss,thread,position)
{
real h;
real T_ext;
face_t f;
begin_f_loop(f,thread)
{
h = 10;
T_ext = 300;
F_PROFILE(f,thread,position) =-10*(WALL_TEMP_INNER(f,thread)-T_ext);
}
end_f_loop(f,thread)

}
gouravjee is offline   Reply With Quote

Old   August 7, 2018, 04:44
Default
  #19
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Gouravjee, you don't need to ask the same question so many times on different locations on this forum... One time is enough!
pakk is offline   Reply With Quote

Reply

Tags
heat transfer coefficient, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Heat transfer coefficient - what is waht Stan FLUENT 28 December 29, 2021 17:29
Wall Transfer Coefficien - Heat Transfer Coefficient - CFX Gargioni CFX 12 September 23, 2019 17:09
UDF for Heat Exchanger model francois louw FLUENT 2 July 16, 2010 03:21
Flow around pipes - heat transfer coefficient on the wall of pipe doodek Main CFD Forum 2 November 23, 2009 09:48
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


All times are GMT -4. The time now is 00:33.