|
[Sponsors] |
Counting number of times a particle hits a wall |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Join Date: Jul 2015
Posts: 4
Rep Power: 11 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
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.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Join Date: Jul 2015
Posts: 4
Rep Power: 11 ![]() |
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; } |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
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.; |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Natural convection in a closed domain STILL NEEDING help! | Yr0gErG | FLUENT | 4 | December 2, 2019 01:04 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 07:20 |
[blockMesh] --> foam fatal error: | lillo763 | OpenFOAM Meshing & Mesh Conversion | 0 | March 5, 2014 11:27 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |