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

308    ALGORITHM IMPLEMENTATION

                         .........continued from previous listing.............
                /* normalise coordinates */
                for(ielem=0;ielem<nelem;ielem++)
                { i1eccx[ielem]=i1eccx[ielem]-iminx;
                 i1eccy[ielem]=i1eccy[ielem]-iminy;
                 i1eccz[ielem]=i1eccz[ielem]-iminz;
                }
                ncelx=imaxx-iminx;
                ncely=imaxy-iminy;
                ncelz=imaxz-iminz;
                        Listing 10.25 Total number of cells in the x, y and z direction.


                  .........continued from previous listing...........
              /* allocate memory */
              i1cfz=TalINT1(ncelz); /* contactor first z  */
              i2cfy[0]=TalINT1(ncely); /* contactor first y (iz-1) */
              i2cfy[1]=TalINT1(ncely); /* contactor first y (iz )  */
              i2cfx[0]=TalINT1(ncelx); /* contactor first x (iz-1,iy-1)  */
              i2cfx[1]=TalINT1(ncelx); /* contactor first x (iz-1,iy )  */
              i1cnz=TalINT1(nelem);  /* contactor next z    */
              i1cny=TalINT1(nelem);  /* contactor next y    */
              i1cnx=TalINT1(nelem);  /* contactor next x    */
                                Listing 10.26 Dynamic memory allocation.


                 .........continued from previous listing.............
                /* assume no contactors at any cell */
                for(iz=0;iz<ncelz;iz++)
                { i1cfz[iz]=-1;
                }
                for(ihy=0;ihy<2;ihy++)
                { for(iy=0;iy<ncely;iy++)
                 { i2cfy[ihy][iy]=-1;
                }}
                for(ihx=0;ihx<2;ihx++)
                { for(ix=0;ix<ncelx;ix++)
                 { i2cfx[ihx][ix]=-1;
                }}
                                      Listing 10.27 Initialisation.


            where nelemd=2*nelem. Thus, even after marking the head of a list as an ‘old’ list, the
            list can still be accessed, and discrete elements from such a list are still available.
              The criterion for a new list is therefore if(i1cfz[iz]<nelem). The new list is characterised
            by the specific integerised coordinate z, and therefore represents a specific layer iz of cells.
            This layer is called the central layer, as explained in Chapter 3.
              In Listing 10.30, all the discrete elements from the central layer iz and the layer immedi-
            ately below it (layer iz-1) are loaded onto y-lists representing rows of cells. Two separate
   320   321   322   323   324   325   326   327   328   329   330