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

Counting number of times a particle hits a wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 9, 2015, 13:18
Default Counting number of times a particle hits a wall
  #1
New Member
 
Join Date: Jul 2015
Posts: 4
Rep Power: 10
davidsq is on a distinguished road
I am trying to write a UDF which tracks how many times each particle hits a wall. I'm assuming that since the DEFINE_DPM_BC macro activates upon particle impact I should use this macro to begin. Additionally in the DEFINE_DPM_EROSION example in fluent help it shows how to track how many impacts occur on a specific face, however I cannot find an example regarding how many times a specific particle impacts the surface.

Any help or guidance for this UDF would be greatly appreciated - even if it's just pointing me in the right directions.

Thanks.
davidsq is offline   Reply With Quote

Old   November 9, 2015, 15:28
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Enable one user-defined value for the particles and increment this value each time the particle impacts a boundary. Use the P_USER_REAL macro for accessing this memory within a DEFINE_DPM_BC UDF.
`e` is offline   Reply With Quote

Old   November 9, 2015, 16:15
Default
  #3
New Member
 
Join Date: Jul 2015
Posts: 4
Rep Power: 10
davidsq is on a distinguished road
Could it be something as simple as the following? I'm getting the error: P_USER_REAL: undeclared variable. I've included the udf.h and the dpm.h header files in the local folder. Not sure why this is happening. Thanks!

#include "udf.h"
#include "dpm.h"

int num_hits = 0;

DEFINE_DPM_BC(num_of_hits,p,t,f,f_normal,dim)
{
num_hits = num_hits+1;
P_USER_REAL(p,0) = num_hits;

}
davidsq is offline   Reply With Quote

Old   November 9, 2015, 21:11
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Yes, that UDF should work for counting a single particle in serial mode. However, you may encounter issues with tracking several particles (they're counting with the same num_hits variable) and in parallel (num_hits may be different on each compute node). I recommend updating the number of hits with:

Code:
P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.;
The dpm.h header file is already included in the udf.h header file. Enable the particle memory via Discrete Phase Model > UDF > User Variables > Number of Scalars: 1.
`e` 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
Natural convection in a closed domain STILL NEEDING help! Yr0gErG FLUENT 4 December 2, 2019 00:04
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
[blockMesh] --> foam fatal error: lillo763 OpenFOAM Meshing & Mesh Conversion 0 March 5, 2014 10:27
Radiation interface hinca CFX 15 January 26, 2014 17:11
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


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