CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF temperature profile (https://www.cfd-online.com/Forums/fluent-udf/113104-udf-temperature-profile.html)

Roil January 2, 2016 01:31

Dear All,

I need UDF representing a logarithmic variation for temperature as boundary condition in one wall of my geometry. I appreciate you advice me. (2D problem)

The temperature varies logarithmically from x=0,y=225mm from 75 (centigrade) to x=1000 mm,y=225 to 21(centigrade). there is no z direction. I appreciate if you guide me.

`e` January 2, 2016 17:35

Use the DEFINE_PROFILE macro (see the UDF manual). Write out the temperature equation as a function of x as you'll need to code this function into the UDF. The first example in the UDF manual applies a parabolic pressure profile which should give you a starting point for your code.

asal January 3, 2016 04:13

Hi!


It is easy as it said by others. just find an equation representing your temperature variation in Kelvin and add it to the below UDF. That's it!

#include "udf.h"

DEFINE_PROFILE(inlet_x_temperature, 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) = Your Equarion;
}
end_f_loop(f, thread)
}

mmunige August 5, 2016 20:09

UDF for temperature variation with time and space
 
Respected members

I have to write a UDF for temperature variation along with time and flow domain. actually temperature is varying with time at four points in flow domain, (different relation for time and temperature at these points.
for example at x=0.20m i have following code:
DEFINE_PROFILE(solid_temperature,thread,position )

{
face_t f;
begin_f_loop(f,thread)
{

real t = RP_Get_Real("flow-time");
if ( t <= 100.0 )

{

F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (100.0 < t && t <= 180.0 )
{
F_PROFILE(f,thread,position) = -8.34641*pow(10,-6)*pow(t,4.0)+ 5.49800*pow(10,-3)*pow(t,3.0)- 1.35243*pow(t,2.0)+ 1.47648*pow(10,2.0)*t - 5.51650*pow(10,3.0);
}
else

{
F_PROFILE(f,thread,position) = 727.82;
}
}
end_f_loop(f,thread)

}
at x=0.40m (second point) i have following relations:

if ( t <= 100.0 )

{
F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;
}
else if (100.0 < t && t <= 180.0 )
{
F_PROFILE(f,thread,position) = 0.2716*t + 494.4;
}
else
{
F_PROFILE(f,thread,position) = 727.82;
}
}
end_f_loop(f,thread)
}


and similarly for other 2 points
can any body pl guide me how to include these points in code. i just know how to write variation of temperature with time but i could not find way to write above relations at different points.
Please guide me.
thanks.

erfan1995 May 21, 2018 08:34

hi i have same problem!!!can you please help me?
suppose i have a cylinder shaped cpu and i want a temperature profile on it which is varying with radius and angle!
for example i want this profile: T=25*r+2sin(teta)
teta is from zero to 360 on top of the cylinder.

gouravjee August 5, 2018 04:32

Quote:

Originally Posted by flotus1 (Post 407442)
Which formula describes your function? Without knowing what you put instead of the "..." in

F_PROFILE(f, thread, position) = ...;

no one can guess what is causing the error.

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)

}


pakk August 7, 2018 03:41

The problem is WALL_TEMP_INNER.

We don't know what this is. It is not something standard in Fluent, so it is something that you added. Did you define this somewhere else in your code?


If no: you are putting words that have no meaning in your code, and Fluent does not know what to do with this, so it gives an error.

If yes: tell us how you defined it!

gouravjee August 7, 2018 12:41

Quote:

Originally Posted by pakk (Post 701745)
The problem is WALL_TEMP_INNER.

We don't know what this is. It is not something standard in Fluent, so it is something that you added. Did you define this somewhere else in your code?


If no: you are putting words that have no meaning in your code, and Fluent does not know what to do with this, so it gives an error.

If yes: tell us how you defined it!

i have followed the link given below::
http://cape-forum.com/index.php/topic,3.0.html

I have also looked for this in fluent and i have found similar to this in a radition model which was define as "WALL_OUTER_TEMPERATURE(f,t)"


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