Page 329 - The Combined Finite-Discrete Element Method
P. 329
312 ALGORITHM IMPLEMENTATION
At some point the ielemy=i1cny[ielemy]=-1 will be obtained, i.e. the end of the central
y-list will have been reached. By that time, all x-lists will have been visited and will
have become ‘old x-lists’. There is no use for these lists any longer, and they have to be
‘emptied’, i.e. turned into empty lists. This is done by ‘unloading’ discrete elements from
the x-lists, as shown in Listing 10.35.
A loop over discrete elements from the central row iy and neighbouring rows according
to the contact mask is performed. For each discrete element, the corresponding x-list
according to the integerised x coordinate is set to an empty list. This is done by simply
setting i2cfx[ihx][(i1eccx[ielemy])]=-1.
After completion of these processes, no non-empty x-list is left. Thus the search for
non-empty y-lists is continued by setting ielemz=i1cnz[ielemz], and another non-empty
‘new y-list’ is discovered and called the central y-list, while the row that list corre-
sponds to is called the ‘central row’. For this central row, x-lists are assembled, a search
for new x-lists is performed, the central cell is located and contact detected, and con-
tact interaction is performed. The process is repeated until ielemz becomes equal to
−1. At that point, the end of the central z-list is reached and all iy-lists have become
old y-lists, i.e. there is no ‘new y-list’ left. At this stage there is no use for these y-
lists any longer, and they must be turned into empty y-lists. This is done by looping
over all discrete elements from the central layer and neighbouring central layer, and
for each discrete element setting the corresponding y-list (according to the integerised
y coordinate of the discrete element) to an empty list by assigning −1 as the list head
(Listing 10.35).
There is no need to empty z-lists, because by the time the last z-list has been processed,
contact detection has reached completion. Thus, dynamically allocated memory is returned
to the operating system, in opposite order of allocation, to avoid memory fragmentation
(Listing 10.36).
.........continued from previous listing.............
/* unload elements from x cells */
ihx=0;
for(ihy=0;ihy<5;ihy++)
{ if(ihy>0)ihx=1;
ielemy=i1heay[ihy];
while(ielemy>=0)
{ i2cfx[ihx][(i1eccx[ielemy])]=-1;
ielemy=i1cny[ielemy];
}}}
ielemz=i1cnz[ielemz];
}
/* unload elements from y cells */
for(ihz=0;ihz<2;ihz++)
{ ielemz=i1heaz[ihz];
while(ielemz>=0)
{ i2cfy[ihz][(i1eccy[ielemz])]=-1;
ielemz=i1cnz[ielemz];
}}}}
Listing 10.35 Elements are removed from both the x-lists and y-lists.