|
[Sponsors] |
December 23, 2011, 05:51 |
UDF - Parallel processes
|
#1 |
Senior Member
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 16 |
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) } 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 10:28. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parallel UDF problem | Lindsay | FLUENT | 4 | June 20, 2016 10:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
loading udf in parallel sytem | tahere | FLUENT | 5 | December 13, 2008 02:17 |
UDF for parallel computation | Stanislav Kraev | FLUENT | 3 | October 10, 2006 04:12 |
UDF in parallel version of fluent | yobee | FLUENT | 2 | August 5, 2004 01:36 |