|
[Sponsors] |
April 23, 2019, 08:23 |
Paralellization of compiled DPM UDF
|
#1 |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
I am trying to find the distance between a particle and the wall using a Compiled UDF and DPM_OUTPUT. To do this I want to use the C_WALL_DISTANCE(c,t) macro, but I am struggling to use it in parallel mode. I figure I should take the cell a particle is in using P_CELL(p), and then calculate the wall distance from there. The UDF compiles and loads without errors, but then you "start" the trajectory sampling you get SIGSEGV errors and figure it must require some extra constraints. My UDF is below if anyone has experience with the C_WALL_DISTANCE(c,t) macro please help.
DEFINE_DPM_OUTPUT(particledata,header,fp,p,t,plane ) { cell_t c=P_CELL(p); if(header) { par_fprintf_head(fp,"Particle-ID X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity Time Wall_Dist\n "); } if(NULLP(p)) return; par_fprintf(fp,"%d %" int64_fmt " %d %e %e %e %e %e %e %e %e \n", P_INJ_ID(P_INJECTION(p)), p->part_id, p->part_id,P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],P_TIME(p),C_WALL_DIST(c,t)); } |
|
April 23, 2019, 23:30 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
if you are going to use C_WALL_DISTANCE(c,t) where is it?
for your code try this: Code:
DEFINE_DPM_OUTPUT(particledata,header,fp,p,t,plane ) { #if !RP_NODE cell_t c=P_CELL(p); if(header) { par_fprintf_head(fp,"Particle-ID X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity Time Wall_Dist\n "); } if(NULLP(p)) return; par_fprintf(fp,"%d %" int64_fmt " %d %e %e %e %e %e %e %e %e \n", P_INJ_ID(P_INJECTION(p)), p->part_id, p->part_id,P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],P_TIME(p),C_WALL_DIST(c,t)); #endif } in Ansys Fluent Customization Manual |
|
April 24, 2019, 05:43 |
|
#3 | |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
Quote:
Using the command you suggest causes the error before you start the calculation, when you "start" the sampling. "================================================= ============================= Node 999999: Process 29151: Received signal SIGSEGV. ================================================== ============================ MPI Application rank 9 exited before MPI_Finalize() with status 2 The fluent process could not be started." So I'm just not sure how to use this in paralell. |
||
April 25, 2019, 04:29 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
try
Code:
C_WALL_DIST(F_C0(f,t),THREAD_T0(t)) |
|
April 25, 2019, 08:31 |
|
#5 |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
||
April 26, 2019, 01:34 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
my bad,
yes try Code:
f = P_FILM_FACE(p); |
|
April 26, 2019, 05:55 |
|
#7 |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
Thank you for your help but the UDF is still not able to compile. The code below:
Code:
DEFINE_DPM_OUTPUT(sampleparticles,header,fp,p,t,plane) { real f; real distance; f=P_FILM_FACE(p); cell_t c=P_CELL(p); distance=(C_WALL_DIST(F_C0(f,t),THREAD_T0(t))); if(header) { par_fprintf_head(fp,"Particle-ID X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity Time Wall Dist \n "); } if(NULLP(p)) return; par_fprintf(fp,"%d %" int64_fmt " %d %e %e %e %e %e %e %e %e \n", P_INJ_ID(P_INJECTION(p)), p->part_id, p->part_id,P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],P_TIME(p),distance); #if REMOVE_PARTICLES MARK_PARTICLE(p, P_FL_REMOVED); #endif } Code:
in file included from /rds/bear-apps/handbuilt/software/ansys_inc/v181/fluent/fluent18.1.0/src/udf/udf.h:24:0, from dpm.c:3: dpm.c: In function sampleparticles: /rds/bear-apps/handbuilt/software/ansys_inc/v181/fluent/fluent18.1.0/src/storage/mem.h:1002:52: error: array subscript is not an integer #define F_STORAGE(f,t,sv,type)(T_STORAGE(t,sv,type)[f]) ^ /rds/bear-apps/handbuilt/software/ansys_inc/v181/fluent/fluent18.1.0/src/storage/mem.h:1105:54: note: in definition of macro C_STORAGE_R #define C_STORAGE_R(c,t,n)(T_STORAGE_R_NO_CHECK(t,n)[c]) ^ dpm.c:14:11: note: in expansion of macro C_WALL_DIST distance=(C_WALL_DIST(F_C0(f,t),THREAD_T0(t))); ^ /rds/bear-apps/handbuilt/software/ansys_inc/v181/fluent/fluent18.1.0/src/storage/mem.h:2151:18: note: in expansion of macro F_STORAGE #define F_C0(f,t)F_STORAGE(f,t,SV_C0,cell_t *) ^ dpm.c:14:23: note: in expansion of macro F_C0 distance=(C_WALL_DIST(F_C0(f,t),THREAD_T0(t))); ^ dpm.c:13:8: warning: unused variable c [-Wunused-variable] cell_t c=P_CELL(p); ^ dpm.c:10:6: warning: variable f set but not used [-Wunused-but-set-variable] real f; |
|
April 29, 2019, 02:17 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
f is a face and should be defined as:
Code:
face_t f; try to find information related to your problem in Ansys Fluent Customization manual first best regards |
|
Tags |
dpm, sigsegv, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for deleting particles in DPM | imanmirzaii | Fluent UDF and Scheme Programming | 12 | November 25, 2020 20:27 |
Viscosity UDF works when interpreted, Doesn't when compiled? | bloodflow | Fluent UDF and Scheme Programming | 4 | April 11, 2019 10:06 |
UDF compiled and loaded but not available | Easyeight | Fluent UDF and Scheme Programming | 7 | June 28, 2018 12:54 |
Conditional Release of DPM Particles in Fluent - UDF | nvschandra | Fluent UDF and Scheme Programming | 0 | December 16, 2013 21:32 |
Conditional Release of DPM particles - UDF | nvschandra | Fluent UDF and Scheme Programming | 0 | December 10, 2013 12:02 |