function [Ux,Uy,Uz]=get_viscous_multitimes(coslip,H,stopt,tR,xloc,pmpost)

t=0:stopt/10:stopt;

npatches=size(pmpost,1);
ss=coslip(1:npatches);
ds=coslip(npatches+1:2*npatches);

for k=1:size(pmpost,1)

     if abs(ss(k)>0) | abs(ds(k)>0)
    m=[pmpost(k,:)';ss(k);ds(k);0];
    [Ueast,Unorth,Uvert]=LayeredBasis_viscous_multitimes(m,xloc,H,1,1,t,tR);

    Ux(:,:,k)=Ueast';
    Uy(:,:,k)=Unorth';
    Uz(:,:,k)=Uvert';

    else
        
    Ux(:,:,k)=zeros(length(t),size(xloc,2));
    Uy(:,:,k)=zeros(length(t),size(xloc,2));
    Uz(:,:,k)=zeros(length(t),size(xloc,2));
    
    end
    
end

Ux=sum(Ux,3);
Uy=sum(Uy,3);
Uz=sum(Uz,3);