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

UDF: Repatching part temperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2003, 10:09
Default UDF: Repatching part temperature
  #1
Mcgregor
Guest
 
Posts: n/a
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?

Andy

#include "udf.h"

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

DEFINE_ADJUST(repatch_saveb,d)

{ 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);

begin_c_loop(c,t)

Ttot +=C_T(c,t);

end_c_loop(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);

begin_c_loop(c,t)

C_T(c,t) = 493.0;

end_c_loop(c,t);

}

}

} }

  Reply With Quote

Old   June 2, 2003, 09:51
Default Re: UDF: Repatching part temperature
  #2
Markus
Guest
 
Posts: n/a
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
  Reply With Quote

Reply


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
UDF temperature profile NeoGamaes Fluent UDF and Scheme Programming 5 January 16, 2012 04:10
UDF for linear temperature profile across the hemispherical surface tshv247 Fluent UDF and Scheme Programming 1 October 3, 2011 13:44
Flowfield temperature modification through UDF Hypersonicflow Fluent UDF and Scheme Programming 2 April 18, 2011 14:27
UDF for wall temperature dhanshan1986 Main CFD Forum 2 October 8, 2009 18:07
UDF or any approach for Bulk Temperature calculation vemps FLUENT 0 May 1, 2009 02:09


All times are GMT -4. The time now is 18:51.