Page 428 - Handbook Of Multiphase Flow Assurance
P. 428

Computer code (Makogon, 1994, 1997)              427

            C shift the [100] cell down to locate top at z=0
                  do i=1,npts
                   z1(i)=z1(i)-1.D0
                   z2(i)=z2(i)-1.D0
                   z3(i)=z3(i)-1.D0
                  end do
                  endif

            C ------------[110]-------------------
                  if (ap.eq.3) then
            C if constructing the [110] surface, the unit cell will be
            C replicated 2 times for slicing
                  do 46 iy=0, ny
                  do 46 i=1, npts
                  x1(i+iy*npts)=x1(i)
                  y1(i+iy*npts)=y1(i)-iy
                  z1(i+iy*npts)=z1(i)
                  x2(i+iy*npts)=x2(i)
                  y2(i+iy*npts)=y2(i)-iy
                  z2(i+iy*npts)=z2(i)
                  x3(i+iy*npts)=x3(i)
                  y3(i+iy*npts)=y3(i)-iy
                  z3(i+iy*npts)=z3(i)
            46      continue

            C determine which molecules should be relocated in [110]
                  do i=1,npts*2
                   remflag(i)=0
            C check the cell in direction of equation 1: x+y=1
                   xyz=x1(i)+y1(i)
            c correct computational error
                   if(abs(xyz-dnint(xyz)).lt.1d-10) xyz=dnint(xyz)
                   if(xyz.GT.1.D0) then
                    x1(i)=x1(i)-1.D0
                    y1(i)=y1(i)-1.D0
                    x2(i)=x2(i)-1.D0
                    y2(i)=y2(i)-1.D0
                    x3(i)=x3(i)-1.D0
                    y3(i)=y3(i)-1.D0
                   endif
            C check the cell in direction of equation 2: x-y=1
                   xyz=x1(i)-y1(i)
                   if(abs(xyz-dnint(xyz)).lt.1d-10) xyz=dnint(xyz)
                   if(xyz.GT.1.D0) then
                    x1(i)=x1(i)-1.D0
   423   424   425   426   427   428   429   430   431   432   433