diff --git a/ROMSPath.f90 b/ROMSPath.f90 index d3e4b1e..ac3f130 100644 --- a/ROMSPath.f90 +++ b/ROMSPath.f90 @@ -344,6 +344,7 @@ subroutine ini_ROMSPath() par(n,pVort) = 0.0 par(n,pbehaveW) = 0.0 par(n,pSSF) = 0.0 + par(n,pWD) = 9999.0 Ipar(n)=0.0 Jpar(n)=0.0 diff --git a/advection_module.f90 b/advection_module.f90 index 0c88923..bd7d3e8 100644 --- a/advection_module.f90 +++ b/advection_module.f90 @@ -165,6 +165,8 @@ SUBROUTINE find_currents(Xpar,Ypar,Zpar,ex,ix,ng,ets,Uad,Vad,Wad,tdepth,zeta) !******************************* ! ! !Check if particle location above or below boundary, If so, place ! ! ! just within boundary (1 mm) + + if (Zpar.LT.tdepth) then Zpar = tdepth + DBLE(0.001) !IF(TrackCollisions) hitBottom(n) = hitBottom(n) + 1 diff --git a/boundary_module.f90 b/boundary_module.f90 index 1da593b..63a09bd 100644 --- a/boundary_module.f90 +++ b/boundary_module.f90 @@ -149,7 +149,8 @@ SUBROUTINE zbounds(ng,Ipar,Jpar,Zpar,ingrid,t) use param_mod, only: xi_rho,eta_rho use INT_MOD, only: getInterp2D IMPLICIT NONE - DOUBLE PRECISION, INTENT(IN) :: Ipar,Jpar,Zpar + DOUBLE PRECISION, INTENT(IN) :: Ipar,Jpar + DOUBLE PRECISION, INTENT(INOUT) :: Zpar INTEGER :: I,J INTEGER, INTENT(IN) :: ng ,t LOGICAL, INTENT(OUT) :: ingrid @@ -167,6 +168,12 @@ SUBROUTINE zbounds(ng,Ipar,Jpar,Zpar,ingrid,t) ingrid=.TRUE. endif + if (Zpar.GE.tzeta) then + Zpar=tzeta-0.01D0 !set particle depth to 1 less than + ingrid=.TRUE. + endif + + endif END SUBROUTINE zbounds diff --git a/interpolation_module.f90 b/interpolation_module.f90 index 4e44951..f37020d 100644 --- a/interpolation_module.f90 +++ b/interpolation_module.f90 @@ -1224,9 +1224,17 @@ SUBROUTINE getcoeff(X,Y,m,cff) W(4)=m(4)/dist(4) WT=W(1)+W(2)+W(3)+W(4) - do i=1,4 - cff(i)=W(i)/WT - enddo + + if ( WT.EQ.0.0D0) then + do i=1,4 + cff(i)=0.0D0 + enddo + else + do i=1,4 + cff(i)=W(i)/WT + enddo + endif +