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

UDF - Parallel processes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 23, 2011, 04:51
Default UDF - Parallel processes
  #1
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 15
Bionico is on a distinguished road
Hi everybody,
I'm working on this UDF using a 32 processors workstation

Code:
 
#include "udf.h"
real tm=0.00;
DEFINE_ADJUST(tsensor,d)
{
 
 real trif;
 real trif_coordinate[ND_ND];
 real x,y,z;
 real nt;
 int ID=120573;
 
 Thread *t=Lookup_Thread(d,ID);
 cell_t c;
 
 nt=0.0;
 trif=0.0;
 
 printf("trif iniziale vale %f\n", trif);
 /* Loop on the thread */
 begin_c_loop(c,t)
  {
   C_CENTROID(trif_coordinate,c,t);
 
   x=trif_coordinate[0];
   y=trif_coordinate[1];
   z=trif_coordinate[2];
 
     if (sqrt(ND_SUM(pow(x+1.900,2.),pow(y+1.000,2.),pow(z-1.400,2.))) < 0.04)
      {
        trif=trif + C_T(c,t); 
        nt=nt+1.0;   
        printf("trif somma vale %f\n", trif);  
        printf("nr celle vale %f\n", nt);  
      }
  }
 end_c_loop(c,t)
 if (nt!=0)
   {
     tm=trif/nt; /* calculate average*/
   } 
printf("tm vale %f\n", tm);
}
DEFINE_PROFILE(twall, thread, position)
{
 real tlim;
 face_t f;
 tlim=291.65;
 if (tm>tlim)
 
   begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15-(tm-291.15);  
 }
   end_f_loop(f, thread)
 
 else
 
 begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15;    
 }
   end_f_loop(f, thread)
}
This UDF should do a feedback: the wall temperature must depend on the temperature of a sensor in a fixed point of the room.
The problem is that it calculates 32 times (and once there's the average, only the processor that calculates in the zone of the sensor)!
Can anyone tell me how parallelize my UDF in such a way that it calculates my UDF once?
(excuse for my horrible english)

Last edited by Bionico; December 23, 2011 at 09:28.
Bionico 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
Parallel UDF problem Lindsay FLUENT 4 June 20, 2016 09:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
loading udf in parallel sytem tahere FLUENT 5 December 13, 2008 01:17
UDF for parallel computation Stanislav Kraev FLUENT 3 October 10, 2006 03:12
UDF in parallel version of fluent yobee FLUENT 2 August 5, 2004 00:36


All times are GMT -4. The time now is 07:53.