Page 358 - Handbook Of Multiphase Flow Assurance
P. 358

Computer code (Makogon, 1994, 1997)              357

                     js:=start1;
                     start1:=start2;
                     start2:=js;
                     end;
                   end;
                  end;
                if snext>start1 then
                  proceed:=true;              {snext can start a good short circuit}
                end;

              repeat
            S4: begin                         {search for sh.circ. starting with snext}
                if order[snext]=2 then
                  begin                          {easy find: only one possibility}
                  sfound:=true;
                  ns:=ns+1;
                  srin[ns]:=snext;
                  for js:=1 to n do
                   begin
                   if (nhb[js,1]=snext)and(nhb[js,2]<>srin[ns−1])then
                     snext:=nhb[js,1];
                   if (nhb[js,2]=snext)and(nhb[js,1]<>srin[ns−1])then
                     snext:=nhb[js,1];
                   end;
                  if snext=srin[ns] then
                   snext:=nhb[js,2];
                  sbonds[ns]:=js;
                  end
                else                          {search the tedious way}

                  for js:=1 to n do
                   if (nhb[js,1]=snext)or(nhb[js,2]=snext) then
                     begin
                     sfound:=false;
                     if nhb[js,1]=snext then
                       begin                    {one of atoms in bond fits}
                       snothere:=true;
                       for ks:=2 to ns do       {see if link was found already}
                         if srin[ks]=nhb[js,2] then
                           snothere:=false;
                       for ks:=1 to pf-1 do      {see if link is in the ring}
                         if rin[ks]=nhb[js,2] then
                           snothere:=false;      {avoiding test of finish position}
                       if pf <> nr then
                         for ks:=pf+1 to nr do
   353   354   355   356   357   358   359   360   361   362   363