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

Copying temperatures from one solid to another

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 1, 2013, 19:10
Default Copying temperatures from one solid to another
  #1
New Member
 
Jerónimo
Join Date: Feb 2013
Posts: 6
Rep Power: 13
Jeronimo97 is on a distinguished road
Hi everyone. I'm here with some trouble trying to fix my UDF for a problem that it seemed to me that could be easy, but actually it revealed not to be.
I'm simulating a tempering furnace, and inside the furnace there are 6 solids that they jump from one position to another, in order to complete the process of tempering. I would like to simulate the change of position by simply changing the temperature of one solid to the solid of the next position, and set again to 293K (environment temperature) the temperature of the first solid in the line.
I have tried already lots of diferent things, but I was never able to see the UDF performing anything at all. I think that the main problem is that I need to be looping inside a thread and copy those values of temperature to another thread, and its not possible to have a loop over 2 threads at the same time. I have tried to copy all the cell values from the 6 threads to a matrice, and then impose the nem temperatures from there, but it didn't work. I always receive the message that ir performed the loop, but nothing happens.
Here is the last code that I tried, and the compiler had no problem running it.

#include "udf.h"
#define GALLOPING 20 /*proceeds the change of position at each 20s*/
int n = 1; /*counting of changes of position*/
int zone_id;
int zone_id1;

DEFINE_ADJUST(cell_temp,d)
{
real time = CURRENT_TIME;
cell_t c;
if(time == n * GALLOPING) /*time to update temperatures*/
for(zone_id = 7; zone_id > 1; zone_id--) /*loops from thread #7 till #2*/
{
Thread *t = Lookup_Thread(d,zone_id);
begin_c_loop_int(c,t)
{
C_UDMI(c,t,0) = C_T(c,t); /*saving the temperatures*/
}
end_c_loop_int(c,t)
} /*for*/
for(zone_id = 7; zone_id > 1; zone_id--)
{
zone_id1 = zone_id - 1;
if(zone_id > 2)
{
Thread *t = Lookup_Thread(d,zone_id);
Thread *t1 = Lookup_Thread(d,zone_id1);
begin_c_loop(c,t)
{
C_T(c,t) = C_UDMI(c,t1,0); /*imposing the new temperatures to the next position*/
}
end_c_loop(c,t)
}
else
{
Thread *t = Lookup_Thread(d,zone_id);
begin_c_loop(c,t)
{
C_T(c,t) = 293; /*putting a new solid in the furnace*/
}
end_c_loop(c,t)
}
} /*for*/
Message0("\Temperatures updated\n");
n += 1;
} /*if*/
} /*define_adjust*/


I would be very grateful if anyone could help me with this.
And then I would also need to parellize my function, but first things first.
Thanks in advance.
Jerónimo.
Jeronimo97 is offline   Reply With Quote

Old   February 3, 2013, 05:26
Default
  #2
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 15
msaeedsadeghi is on a distinguished road
I have done like these UDFs. You should first define "thread" of that solid, capture it's data, then use it in the new "thread".
msaeedsadeghi is offline   Reply With Quote

Old   February 3, 2013, 16:39
Default
  #3
New Member
 
Jerónimo
Join Date: Feb 2013
Posts: 6
Rep Power: 13
Jeronimo97 is on a distinguished road
Thanks for your reply, Saeed. Actually, I think I didn't understand your suggestion. Should I define just "Thread *t" outside the DEFINE_ADJUST function? I will always have to use the Lookup_Thread inside each for, since I only want to loop inside the solid threads.
How would you suggest to apply the temperatures to the next position? It seems to me that the C_UDMI doesn't allow what I want because I would need to loop over two threads at the same time. I have tried to copy the different cell and thread temperatures to a matrice, but it didn't work also.
Jeronimo97 is offline   Reply With Quote

Old   February 5, 2013, 01:20
Default
  #4
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 15
msaeedsadeghi is on a distinguished road
It works but need more cosideration. Try more
msaeedsadeghi is offline   Reply With Quote

Old   February 5, 2013, 06:27
Default
  #5
New Member
 
Jerónimo
Join Date: Feb 2013
Posts: 6
Rep Power: 13
Jeronimo97 is on a distinguished road
Needs more consideration on what? I was expecting a kind of more assertive answer. But it's OK.
You see, I've got this deadline to finish my thesis, and I'm only 10 weeks out from it. So, I haven't got that much time to waste on effortless tries. CFD is not my livelihood. I'm just a regular guy, trying to finish my degree in mechanical eng.. And that is why I came here, because there's nobody in my school that could help me on this.
Anyway, thank you Saeed for your suggestion.
Jeronimo97 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
How model radiation of both solid wall and fluid£¿ Harry Qiu FLUENT 2 February 4, 2013 00:04
[CFX] How to avoid negative temperatures? rogbrito CFX 3 February 15, 2010 06:59
Multiple Solid Domains - Interfaces Scott CFX 8 July 31, 2008 16:20
Different Starting temperatures in a Solid Optixxx FLUENT 3 April 19, 2004 13:53
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 17:52.