CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF to change heat transfer coefficient with wall temperature (http://www.cfd-online.com/Forums/fluent-udf/101658-udf-change-heat-transfer-coefficient-wall-temperature.html)

emmkell May 10, 2012 05:21

UDF to change heat transfer coefficient with wall temperature
 
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?

Daniel Tanner May 10, 2012 09:05

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)
}

emmkell May 10, 2012 09:27

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.

alighasemian June 9, 2012 00:23

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

emmkell August 8, 2012 11:23

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!

hatef June 19, 2013 12:40

Emma,

This is wrong!

regards,

ddmillar July 10, 2013 12:49

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,

hatef July 11, 2013 06:19

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,


All times are GMT -4. The time now is 06:44.