|
[Sponsors] |
October 2, 2015, 08:48 |
Problems with UDF in parallel mode
|
#1 |
New Member
Rikard
Join Date: Sep 2015
Posts: 4
Rep Power: 10 |
Hi!
I have written a UDF to calculate the average value of a passive scalar at the outlet boundary to use it as a prescribed value at the inlet. The code works fine when in serial mode but not in parallel. seems like only one of the cores got the right value!? or how to express it. Would be very pleased if someone knows what's wrong or could guide me in right direction! see code below #include "udf.h" #include "mem.h" real concavg, concavg1; real conc; DEFINE_EXECUTE_AT_END(out_ave) { Domain *d; real area, real area_tot; real A[ND_ND]; Thread *t; face_t f; d=Get_Domain(1); t=Lookup_Thread(d,5); area=0; area_tot=0; conc=0; concavg=0; concavg1=0; begin_f_loop(f,t) { F_AREA(A,f,t); area=NV_MAG(A); area_tot+=area; conc=F_UDSI(f, t, 0); concavg += conc*area; concavg1=concavg/area_tot; printf("\n area_tot = %f\n",area_tot); /*print once for every cell face on outlet, counts to the right area, OK!*/ printf("\n concavg = %f\n",concavg1); /*print once for every cell face on outlet, right value, OK!*/ } end_f_loop(f,t) printf("\n area_tot2 = %f\n",area_tot);/* Print once for every core, first one OK the other three =0??!*/ printf("\n concavg2 = %f\n",concavg1); } DEFINE_PROFILE ( inl_uds, t, i) { face_t face; face_t f; real flow_time, inlvalue; flow_time=RP_Get_Real("flow-time"); if(flow_time<0.5) { begin_f_loop(face, t) { F_PROFILE(face, t, i)=1; } end_f_loop(face, t) } else { begin_f_loop(face, t) { inlvalue=concavg1;/*F_UDMI(f,t,0);*/ F_PROFILE(face, t, i)=inlvalue; } end_f_loop(face, t) } } |
|
Tags |
parallel, scalar, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem with compiling boundary condition udf in parallel mode | chem engineer | Fluent UDF and Scheme Programming | 11 | June 29, 2015 06:23 |
decomposePar is missing a library | whk1992 | OpenFOAM Pre-Processing | 8 | March 7, 2015 07:53 |
compiling UDF for moving mesh in parallel mode | vespa50l | Fluent UDF and Scheme Programming | 3 | September 22, 2014 11:11 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 22:14 |
problem using property udfs in parallel mode | EllenW | Fluent UDF and Scheme Programming | 5 | July 10, 2009 04:31 |