It can be avoided by using the following if statement at about line 262:
Code: Select all
if (vbar(i,j,knew).ne.0.0) then
Qshape(is,k)=ABS(v(i,j,k,nnew)/vbar(i,j,knew))* &
& (z_w(i,j-1,k)-z_w(i,j-1,k-1)+ &
& z_w(i ,j,k)-z_w(i ,j,k-1))/ &
& (z_w(i,j-1,N(ng))-z_w(i,j-1,0)+ &
& z_w(i ,j,N(ng))-z_w(i ,j,0))
else
Qshape(is,k) = 0.0
end if