Page 328 - The Combined Finite-Discrete Element Method
P. 328
NBS CONTACT DETECTION ALGORITHM IN 3D 311
.........continued from previous listing.............
/* scan all loaded x cells */
ielemy=i1heay[0];
while(ielemy>=0)
{ ix=i1eccx[ielemy];
if(i2cfx[0][ix]<nelem)
{ i1heax[0]=i2cfx[0][ix];
i1heax[1]=i2cfx[0][ix-1];
i1heax[2]=i2cfx[1][ix+1];
i1heax[3]=i2cfx[1][ix];
i1heax[4]=i2cfx[1][ix-1];
if(i1heax[1]>nelem)i1heax[1]=i1heax[1]-nelemd;
i2cfx[0][ix]=i2cfx[0][ix]+nelemd;
Listing 10.33 All x-lists from the first set of lists are searched for an x-list marked ‘new’.
i1heax[0], while the heads of x-lists corresponding to the neighbouring cells according to
the contact map are temporarily stored as i1heax[1], i1heax[2], i1heax[3] and i1heax[4].
The cell (ix,iy,iz) is currently the central cell. All discrete elements mapped to this cell
are on the i1heax[0] list. All discrete elements mapped to the neighbouring cells according
to the contact mask are on the lists as i1heax[1], i1heax[2], i1heax[3] and i1heax[4]. Thus,
each discrete element from the list i1heax[0] may be in contact with some of the discrete
elements from lists i1heax[0], i1heax[1], i1heax[2], i1heax[3] and i1heax[4].In other
words, some contacts have been detected, and contact interaction processing needs to take
place as shown in Listing 10.34. Once the contact interaction processing has been accom-
plished, the search for ‘new x-lists’ continues, thus ielemy=i1cny[ielemy].Inthisway,
another central (ix, iy, iz) cell is detected with its central x-list and neighbouring x-lists.
......continued from previous listing...........
/* detect contacts for cell (ix,iy,iz) */
ielemx=i1heax[0];
while(ielemx>=0)
{ for(ihx=0;ihx<5;ihx++)
{ jelemx=i1heax[ihx];
while(jelemx>=0)
{ if((ihx!=0)||(ielemx>jelemx))
{ CONTACT HAS BEEN DETECTED
RECORD IT, OR PROCESS CONTACT
INTERACTION
}
jelemx=i1cnx[jelemx];
}}
ielemx=i1cnx[ielemx];
}}
ielemy=i1cny[ielemy];
}
Listing 10.34 All the elements from the ‘new’ x-list are checked against all elements from neigh-
bouring x-lists according to the contact map.