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

help temperature profil

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2011, 06:14
Default help temperature profil
  #1
New Member
 
nhh
Join Date: May 2011
Posts: 12
Rep Power: 15
bounhh is on a distinguished road
Hello
Help
I want to introduce an array of temperature fonction of time as a boundary condition to simulate unsteady conduction problem by using udf
I try this udf
NNN time in hours
/************************************************** ********************
unsteady.c
UDF for specifying a transient temperature profile boundary condition
TT temperature

************************************************** *********************/

#include "udf.h"


DEFINE_PROFILE(unsteady_TEMP, thread, position)
{
face_t f;
float t = CURRENT_TIME;
float TT[24];
int NNN;
int first = 1;


TT[1]=31.2 + 273.;
TT[2]=30.9 + 273.;
TT[3]=30.3 + 273.;
TT[4]=30. + 273.;
TT[5]=29.6 + 273.;
TT[6]=29.2 + 273.;
TT[7]=29.8 + 273.;
TT[8]=31.3 + 273.;
TT[9]=32.9 + 273.;
TT[10]=34.7 + 273.;
TT[11]=36.1 + 273.;
TT[12]=36.9 + 273.;
TT[13]=37.6 + 273.;
TT[14]=38.2 + 273.;
TT[15]=38.2 + 273.;
TT[16]=37.9 + 273.;
TT[17]=37.7 + 273.;
TT[18]=36.7 + 273.;
TT[19]=35.3 + 273.;
TT[20]=34.6 + 273.;
TT[21]=33.9 + 273.;
TT[22]=33.3 + 273.;
TT[23]=32.6 + 273.;
TT[24]=31.9 + 273.;



begin_f_loop(f, thread)
{

t = CURRENT_TIME;
if (first == 1){
first_iteration=0;
if(t < 3600.)
{

NNN = 1;
F_PROFILE(f, thread, position) = TT[NNN];

}
else if ((t == (NNN*3600.)) && (NNN <= 23) ){
NNN++;


F_PROFILE(f, thread, position) = TT[NNN];
printf("\n NNN=%d fprofil=%f t=%f\n",NNN,F_PROFILE(f, thread, position),t);
}
}
}

end_f_loop(f, thread)
}
bounhh is offline   Reply With Quote

Old   May 5, 2011, 06:18
Default help temperature profil
  #2
New Member
 
nhh
Join Date: May 2011
Posts: 12
Rep Power: 15
bounhh is on a distinguished road
Hello
Help
I want to introduce an array of temperature fonction of time as a boundary condition to simulate unsteady conduction problem by using udf
I try this udf

/************************************************** ********************
unsteady.c
UDF for specifying a transient temperature profile boundary condition
TT temperature
NNN time in hours
************************************************** *********************/

#include "udf.h"


DEFINE_PROFILE(unsteady_TEMP, thread, position)
{
face_t f;
float t = CURRENT_TIME;
float TT[24];
int NNN;
int first = 1;


TT[1]=31.2 + 273.;
TT[2]=30.9 + 273.;
TT[3]=30.3 + 273.;
TT[4]=30. + 273.;
TT[5]=29.6 + 273.;
TT[6]=29.2 + 273.;
TT[7]=29.8 + 273.;
TT[8]=31.3 + 273.;
TT[9]=32.9 + 273.;
TT[10]=34.7 + 273.;
TT[11]=36.1 + 273.;
TT[12]=36.9 + 273.;
TT[13]=37.6 + 273.;
TT[14]=38.2 + 273.;
TT[15]=38.2 + 273.;
TT[16]=37.9 + 273.;
TT[17]=37.7 + 273.;
TT[18]=36.7 + 273.;
TT[19]=35.3 + 273.;
TT[20]=34.6 + 273.;
TT[21]=33.9 + 273.;
TT[22]=33.3 + 273.;
TT[23]=32.6 + 273.;
TT[24]=31.9 + 273.;



begin_f_loop(f, thread)
{

t = CURRENT_TIME;
if (first == 1){
first=0;
if(t < 3600.)
{

NNN = 1;
F_PROFILE(f, thread, position) = TT[NNN];

}
else if ((t == (NNN*3600.)) & (NNN <= 23) ){
NNN++;


F_PROFILE(f, thread, position) = TT[NNN];
printf("\n NNN=%d fprofil=%f t=%f\n",NNN,F_PROFILE(f, thread, position),t);
}
}
}

end_f_loop(f, thread)
}
bounhh is offline   Reply With Quote

Old   May 5, 2011, 08:51
Default
  #3
New Member
 
Ján
Join Date: Mar 2010
Location: Slovakia
Posts: 24
Rep Power: 16
argeus is on a distinguished road
Hi, try this. Not sure if it is OK.


DEFINE_PROFILE(unsteady_TEMP, thread, position)
{
real x[ND_ND];
real y;
face_t f;

float TT[24];
int NNN;
float time;

TT[1]=31.2 + 273.;
TT[2]=30.9 + 273.;
TT[3]=30.3 + 273.;
TT[4]=30. + 273.;
TT[5]=29.6 + 273.;
TT[6]=29.2 + 273.;
TT[7]=29.8 + 273.;
TT[8]=31.3 + 273.;
TT[9]=32.9 + 273.;
TT[10]=34.7 + 273.;
TT[11]=36.1 + 273.;
TT[12]=36.9 + 273.;
TT[13]=37.6 + 273.;
TT[14]=38.2 + 273.;
TT[15]=38.2 + 273.;
TT[16]=37.9 + 273.;
TT[17]=37.7 + 273.;
TT[18]=36.7 + 273.;
TT[19]=35.3 + 273.;
TT[20]=34.6 + 273.;
TT[21]=33.9 + 273.;
TT[22]=33.3 + 273.;
TT[23]=32.6 + 273.;
TT[24]=31.9 + 273.;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y = x[1];

time = CURRENT_TIME/3600;

if (time>=24.) // you need to fix it
;
else if (time >= 23.)
NNN=23;
else if (time >= 22.)
NNN=22;
//and so on
.
.
.

F_PROFILE(f, thread, position) = TT[NNN];
}
end_f_loop(f,thread)
}

another way Im not sure if it is possible is to declare variable NNN as integer and set NNN=CURRENT_TIME/3600; (and take care about NNN=0)
argeus is offline   Reply With Quote

Old   May 5, 2011, 12:12
Default
  #4
New Member
 
nhh
Join Date: May 2011
Posts: 12
Rep Power: 15
bounhh is on a distinguished road
It’s very good idea
Thank you very much
bounhh is offline   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
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
problem to export a temperature profil hittie FLUENT 0 May 4, 2011 20:09
Boundary Conditions: Non constant flow pattern / temperature profil Janshi FloEFD, FloWorks & FloTHERM 1 September 1, 2010 03:56
Temperature Profil Plate UDF mannobot FLUENT 0 June 16, 2010 14:06
save transient temperature profil isaac FLUENT 1 May 26, 2004 05:06


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