CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF: Repatching part temperature (

Mcgregor May 29, 2003 09:09

UDF: Repatching part temperature
Hi all,

I have written the following program that should repatch the temperature of a part, when the average temperature of another part reaches a given value.

On the first iteration of every timestep, the average temperature of thread 2 is calculated using the first part of the program and it also prints this value.

The second half of the program should reassign the cell temperature values for all of the cells in thread 4 once the average temp = 350K.

At the moment this is not happening, but i know that the final loop is being entered at the correct time because the ave temp value is printed a second time in the console window. Please help!!!!

Why does my program not reassign temperature values to the cells in thread 2?


#include "udf.h"

int last_ts = -1; /* Global variable. Time step is never <0 */


{ int curr_ts; curr_ts = RP_Get_Integer("time-step");

if (last_ts != curr_ts)

{ last_ts = curr_ts; {

real Ttot; real Tave;

Thread *t; cell_t c;

int ID =2; int ID2 = 4;

t = Lookup_Thread(d,ID);


Ttot +=C_T(c,t);


Tave = (Ttot/168.0);

printf("\n Ttot= %g Tave= %g",Ttot,Tave);

if (Tave<350.0)

{ printf("\n Ttot= %g Tave= %g",Ttot,Tave);

t = Lookup_Thread(d,ID2);


C_T(c,t) = 493.0;




} }

Markus June 2, 2003 08:51

Re: UDF: Repatching part temperature
Hi Andy,

For transient problems the temperature value of the previous time step acts like a source term for the energy equation of a given cell. I suggest you should consider to adjust C_T_M1(c,t), too.

br Markus

All times are GMT -4. The time now is 03:30.