CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How many particles are in a cell? (https://www.cfd-online.com/Forums/openfoam-programming-development/239109-how-many-particles-cell.html)

sharonyue October 21, 2021 03:27

How many particles are in a cell?
 
Hello there,

I know that p.cell() tells you that which cell this particle belongs to. On the contrary, I want to know the particles' label if they belong to a same cell. I tried some ways but they are cumbersome. Is there any simple way to achieve this?

Thanks.

In the following it is an example, we have 5 particles labeling 1,2,3,4,5.
particle 1 belongs to cell 23
particle 2 belongs to cell 20
particle 3 belongs to cell 23
particle 4 belongs to cell 21
particle 5 belongs to cell 23
therefore, cell 23 has particle 1 3 5. How can we extract the labels "1" "3" "5"?

guin October 21, 2021 05:40

You seem to be actually looking for what cellOccupancy() does

https://cpp.openfoam.org/v7/classFoa...bcb51500c11841

I am not sure if it will give you with the appropriate output format out of the box, but you can try it out.

jairoandres December 26, 2021 14:01

Now that you ask that, I wonder how could you determine the number of particles inside a specific cell. For example for celli, I want to determine the number of particles inside (or previously tracked into it). Is that information stored for each cell? or the information is stored for the particles with the cell number containing it?


All times are GMT -4. The time now is 02:56.