
REstarA = [2400  -1800];
nR = length(REstarA);

Bo=1000;


itot = 1;

%Bo=4000;

t_stop = 19;
nt = return_basilisk_index(t_stop);

%index0=return_basilisk_index(tbp0(k));
%index_stop=index0+j_index(k);
%t_stop = return_basilisk_time(index_stop) + 1001.0
for k=1:nR,
  REstar = REstarA(k);
  SURF = cell(nt,1);
  time = nan*ones(nt,1);
  for i=1:nt,
  
    time(i)=return_basilisk_time(i);
    %  
    disp(sprintf('RE=%d, Bo=%d, doing t=%.2f',REstar,Bo,time(i)))
    [Xs,Ys,R] = read_processed_surface_extract(9,REstar,Bo,time(i)+1001);
    U = R(:,5);
    W = R(:,6);
    VORT = R(:,7);
    P = read_Poffset_file(9,REstar,Bo,time(i)+1001);  %[Xmid Ymid  P]
    Xpres = P(:,1);
    Ypres = P(:,2);
    PRES = P(:,3);
    DUDX = P(:,4);
    DUDY = P(:,5);
    DVDX = P(:,6);
    DVDY = P(:,7);    
    
    P = R(:,8);
    %    SDxx = R(:,9);
    %SDxy = R(:,10);
    %SDyy = R(:,12);
    %f = R(:,13);
    Xbar = 0.5*(Xs(1:end-1)+Xs(2:end));
    slope = diff(Ys)./diff(Xs);                
    a = struct('Xs',Xs,'Ys',Ys,'Xbar',Xbar,'slope',slope,'U',U,'W',W,'P',P,'VORT',VORT,'Xpres',Xpres,'Ypres',Ypres,'PRES',PRES,'DUDX',DUDX,'DUDY',DUDY,'DVDX',DVDX,'DVDY',DVDY);  %'SDxx',SDxx,'SDxy',SDxy,'SDyy',SDyy,'f',f);
    SURF{i}=a;
  end;
  sfile = sprintf('../surface_extract/Collected_Surface_Extract_RE%d_Bo%d',REstar,Bo);
  save(sfile,'SURF','time')
end;





%nn = length(Xn);
%Cn = [1:nn]'/nn;
    
% figure(1)
% hold on
%      scatter(Xs,Ys+(t-1002)/5,4,C,'d')
%     drawnow
%     pause(0.02)
%     %    plot(Spc.Location(:,1),Spc.Location(:,2),'kd')
% 
%     figure(2)
%     hold on
%     %for t=1011.0:1011.0, %0.5:1020.5,
% 
% nraw = length(Xraw);
% Cr = [1:nraw]'/nraw;
% %nn = length(Xn);
% %Cn = [1:nn]'/nn;
%     
% figure(2)
% hold on
%      scatter(Xraw,Yraw+(t-1002)/5,4,Cr,'d')
%     drawnow
%     pause(0.02)
%      
% end;
    
    
  %[F,x,y,t]  = read_binary_file(9,REstar,Bo,index,'f');
%[V,x,y,t]  = read_binary_file(9,REstar,Bo,index,'z')
%[P,x,y,t]  = read_binary_file(9,REstar,Bo,index,'p');
