The collision search MFiX

In the calculation of particle collisions, the need for searching neighbor particles only know about the way the grid is based on the particle binding, but the specific implementation is quite vague. Search part of the code as follows (mfix-19.2.2):

That can be directly observed, as used herein the two docycles, the outer loop is traversed ID of all the particles, LLthis ID is a global tag for each particle. The inner loop is used to iterate particles LLaround the particles, ID is I. The main problem is that the meaning of the contents of the red box on the map.
The above can probably understand the content by means mfix-16.1 version this section of code debug output content. Version 16 code is as follows:

Here, the output of the outer loop of the three variables, LL, , CC_START, CC_ENDthe inner loop is output I. The output is:

The output can be seen from the above NEIGHBOR_INDEX(MAX_PIP-1)returns the total number of neighbor, it can be seen from the following output CC_START = NEIGHBOR_INDEX(LL-1)and CC_END = NEIGHBOR_INDEX(LL)represent particles LLneighbor traversing interval, the logic will now be explained here.

By observing the output of the last can be concluded, first, the program will give the number of all neighbor particles, and then use the array NEIGHBOR_INDEX(:)to give all neighbor particle number, for example, the examples are a total of 2400 particles, neighbor particles are a total of 6924, and therefore numbered from 1 ~ 6924.

Particles LLneighbor particles are numbered from NEIGHBOR_INDEX(LL-1)to NEIGHBOR_INDEX(LL) - 1, this number is continuous, then this can be acquired ID number and neighbor particles, such as I = NEIGHBORS(CC).

需要注意的是,这里在遍历neighbor的时候,没有出现重复计数的情况,用上面的图来举例:
47号颗粒的neighbor编号为75~77(CC = CC_START, CC_END-1),也就是说它有三个neighbor,对应的ID为48,78,79。48号颗粒的neighbor编号为78~80,对应的编号为49,79,80。可以看到48号颗粒的neighbor不再包含47号,因为47号颗粒遍历neighbor的时候已经将48号包含进去了,这样避免了重复循环带来的额外开销。

因此NEIGHBOR_INDEX(MAX_PIP-1)返回的是总的neighbor数量,因为最后一个颗粒MAX_PIP的neighbor编号一定是最大的编号,后面不再有未被遍历的neighbor了,如下图所示:

Guess you like

Origin www.cnblogs.com/Jay-CFD/p/11934451.html