Looping macro for DPM
Hi all,
I am aware that in the customization manual there are some examples of looping macros including one to loop over all particles in a cell. But I was just wondering if there is any way of defining a certain radius around let's say a cell, where the tracked particle is currently located, and then loop over all particles that are located within that defined radius? May be we can identify the cells that fall withing that radius and then extend our looping macro to go over multiple cells, instead of just one? Thanks a lot for your help in advance. With best regards Hasan |
you may define cell by it's coordinates and find all adjusted cells within radius, which you specify
to make this loop over all cells and check if coordinates are inside sphere. Ansys Fluetn Customization manual -> C_CENTROID best regards |
Hi Alexander,
Thanks a lot for your very helpful hint. In order to confirm what you suggested, I have drafted a test code. Would you please check my test code and let me know whether or not I was able to implement the idea correctly. The other idea I have is to check it with DEFINE_ON_DEMAND, however this UDF has no pointer to the tracked particle. Perhaps you have a hint to resolve that issue. Furthermore, I was wondering if there was any alternative way of doing the check, as opposed to unnecessarily going through the entire domain. Because if I execute this every time step it is going to take forever, isn't it? Cheers Hasan Code:
#include <udf.h> |
first of all, try to compile your code, you will get some errors.
I don't understand your line Code:
C_CENTROID(xc0, cell, thread); /*This should be my reference cell where the currently tracked particle is located*/ so you get them, but later do the same again Code:
C_CENTROID(xc, c, t); so delete: Code:
thread_loop_c(t, d) Code:
if (sqrt(ND_SUM(pow(xc[0] - xc0[0], 2.), Code:
FILE *debugf; to be Code:
C_UDMI(c,t,0) = n; Code:
DEFINE_EXECUTE_AT_END(write_log) best regards |
first of all, thanks heaps! You are awesome!!
Let me quickly explain the part that created confusion. My understanding was Code:
C_CENTROID(xc0, cell, thread); Code:
TP_POS(tp)[0], TP_POS(tp)[1], TP_POS(tp)[2] Code:
C_CENTROID(xc, c, t); I know that I do not need to check all the cells in the domain, as most of them would obviously be outside the reach/radius. But Is there any way to limit my search to the neighbouring threads only? Does it make sense now? Cheers Hasan |
Hello everyone,
Is there any way to loop through all the particles in my calculation domain (transient case) without going into the thread and cell loop? Code:
Cheers Hasan |
Code:
C_CENTROID(xc0, cell, thread); Aa you've mentioned, you need Code:
P_POS(tp)[0], P_POS(tp)[1], P_POS(tp)[2] For more information about UDF for DPM read Ansys FLuent Customization manual , DPM Macros chapter best regards |
Thank you for your time and help.
|
All times are GMT -4. The time now is 06:17. |