Page 109 - The Combined Finite-Discrete Element Method
P. 109

92     CONTACT DETECTION

            implementations using computer languages such as C or C++, which allow pointers, it
            is better to use dynamic, purpose-built arrays. More on this can be found in the section
            dealing with computational aspects of the combined finite-discrete element method in
            Chapter 9.
              To achieve the maximum CPU efficiency of the algorithm, it is necessary to min-
            imise the number of operations when mapping discrete elements onto the cells. Thus the
            mapping is done as follows:

            Step 0: Initialisation: this is done by setting all numbers of arrays C and E to −1(empty
            lists and/or ends of lists). This step is done only once, i.e. when the computer program
            is started:

               Loop over all rows of cells(i=1; i≤n cel ; i++)
               {   Loop over all cells in a row(j=1;j≤n cel ; j++)
                    {   set

                                            C[i][j] =−1                          (3.32)

                    }
               }
               Loop over all discrete elements(k=1; k≤N; k++)
               {    set

                                             E[k] =−1                            (3.33)

               }


            Step 1: Mapping of discrete elements onto cells: this operation is done each time discrete
            elements move, for instance at each time step. It involves building of a singly connected
            list for each cell. This is achieved by looping over all discrete elements, integerising its
            coordinates and placing the discrete element onto the corresponding singly connected list:


               Loop over all discrete elements (k=1; k≤N;k++)
               {    Integerise current coordinates using equation (26) and set

                                        int          x k − x min
                                     i =  x k = 1 + Int                          (3.34)
                                                        d

                                        int          y k − y min
                                    j =  y k = 1 + Int
                                                        d
                    Place the discrete element onto the
                       corresponding singly connected list by

                                      setting E[k] = C[i][j]
                                                                                 (3.35)
                                      and afterwards C[i][j] = k
               }
   104   105   106   107   108   109   110   111   112   113   114