function [xpos2,ypos2] = partical_B_new(xpos1,ypos1,u0,v0,lon1,lat1,ix,iy,dtuv)
%  for Arakawa-B grid  %
xdif=(xpos1-lon1(ix))./(lon1(ix+1)-lon1(ix));
ydif=(ypos1-lat1(iy))./(lat1(iy+1)-lat1(iy));
if ix==1 | ix==size(u0,1) |iy==1 |iy==size(u0,2);
    xpos2=xpos1;
    ypos2=ypos1;
else
u1=u0(ix,iy);u2=u0(ix+1,iy);u3=u0(ix+1,iy+1);u4=u0(ix,iy+1);

A=[u1,u2,u3,u4];AA=find(~isnan(A));
if isempty(AA)==0
for k=1:4;if isnan(A(k))==1;A(k)=A(AA(1));end;end
% for k=1:4;if isnan(A(k))==1;A(k)=0;end;end
end
u1=A(1);u2=A(2);u3=A(3);u4=A(4);
ux=(1.-xdif)*(1.-ydif)*u1+xdif*(1.-ydif)*u2+xdif*ydif*u3+(1.-xdif)*ydif*u4;

v1=v0(ix,iy);v2=v0(ix+1,iy);v3=v0(ix+1,iy+1);v4=v0(ix,iy+1);
A=[v1,v2,v3,v4];AA=find(~isnan(A));
if isempty(AA)==0
for k=1:4;if isnan(A(k))==1;A(k)=A(AA(1));end;end
% for k=1:4;if isnan(A(k))==1;A(k)=0;end;end
end
v1=A(1);v2=A(2);v3=A(3);v4=A(4);
vy=(1.-xdif)*(1.-ydif)*v1+xdif*(1.-ydif)*v2+xdif*ydif*v3+(1.-xdif)*ydif*v4;

dx=pos2dist(lat1(iy),lon1(ix),lat1(iy),lon1(ix+1),1).*1000;
dy=pos2dist(lat1(iy),lon1(ix),lat1(iy+1),lon1(ix),1).*1000;
xpos2=(ux.*dtuv)/dx.*(lon1(ix+1)-lon1(ix))+xpos1;
ypos2=(vy.*dtuv)/dy.*(lat1(iy+1)-lat1(iy))+ypos1;
end
end
