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

Paralellization of compiled DPM UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2019, 08:23
Default Paralellization of compiled DPM UDF
  #1
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
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));
}
bloodflow is offline   Reply With Quote

Old   April 23, 2019, 23:30
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
}
read Chapter 7: Parallel Considerations
in Ansys Fluent Customization Manual
AlexanderZ is offline   Reply With Quote

Old   April 24, 2019, 05:43
Default
  #3
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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
}
read Chapter 7: Parallel Considerations
in Ansys Fluent Customization Manual
I am looking through that chapter but cannot work out which part of my code should be done on which node. The Wall distance macro is the last thing to be called in the "P->" string.

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.
bloodflow is offline   Reply With Quote

Old   April 25, 2019, 04:29
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try
Code:
C_WALL_DIST(F_C0(f,t),THREAD_T0(t))
best regrards
AlexanderZ is offline   Reply With Quote

Old   April 25, 2019, 08:31
Default
  #5
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
try
Code:
C_WALL_DIST(F_C0(f,t),THREAD_T0(t))
best regrards
Do I need to define any additional things? Like "f"?
bloodflow is offline   Reply With Quote

Old   April 26, 2019, 01:34
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
my bad,
yes
try
Code:
 f = P_FILM_FACE(p);
best regards
AlexanderZ is offline   Reply With Quote

Old   April 26, 2019, 05:55
Default
  #7
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
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
}
Gives the following error below:




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;
bloodflow is offline   Reply With Quote

Old   April 29, 2019, 02:17
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
f is a face and should be defined as:
Code:
face_t f;
seems you dont know the basis,
try to find information related to your problem in Ansys Fluent Customization manual first

best regards
AlexanderZ is offline   Reply With Quote

Reply

Tags
dpm, sigsegv, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 13:37.