New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 8100 – NEMO

Changeset 8100


Ignore:
Timestamp:
2017-05-30T14:56:13+02:00 (7 years ago)
Author:
timgraham
Message:

Bug fixes and small changes to interptsn, interpun and interpvn to work with sloping bathymetry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5803_UKMO_AGRIF_Vert_interp/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90

    r7824 r8100  
    754754             h_in(N_in) = ptab(ji,jj,jk,n2)/(e1e2t(ji,jj)*zrhoxy) 
    755755           END DO 
    756            N_out = jpk-1 
     756           N_out = 0 
    757757           DO jk=1,jpk ! jpk of child grid 
    758 !             IF (tmask(ji,jj,jk) == 0) EXIT ! TODO: Will not work with ISF. !This doesn't seem to work at the moment. Is it just a GYRE issue??????? 
    759 !             N_out = N_out + 1 
     758             IF (tmask(ji,jj,jk) == 0) EXIT ! TODO: Will not work with ISF. !This doesn't seem to work at the moment in GYRE but is OK in overflow model 
     759             N_out = N_out + 1 
    760760             h_out(jk) = e3t_n(ji,jj,jk) !Child grid scale factors. Could multiply by e1e2t here instead of division above 
    761761           ENDDO 
     
    904904         ! East south 
    905905         IF ((eastern_side).AND.((nbondj == -1).OR.(nbondj == 2))) THEN 
    906             tsa(nlci-1,2,:,:) = ptab_child(nlci-1,2,:,:) 
     906            tsa(nlci-1,2,:,:) = ptab_child(nlci-1,2,:,1:jpts) 
    907907         ENDIF 
    908908         ! East north 
    909909         IF ((eastern_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 
    910             tsa(nlci-1,nlcj-1,:,:) = ptab_child(nlci-1,nlcj-1,:,:) 
     910            tsa(nlci-1,nlcj-1,:,:) = ptab_child(nlci-1,nlcj-1,:,1:jpts) 
    911911         ENDIF 
    912912         ! West south 
    913913         IF ((western_side).AND.((nbondj == -1).OR.(nbondj == 2))) THEN 
    914             tsa(2,2,:,:) = ptab_child(2,2,:,:) 
     914            tsa(2,2,:,:) = ptab_child(2,2,:,1:jpts) 
    915915         ENDIF 
    916916         ! West north 
    917917         IF ((western_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 
    918             tsa(2,nlcj-1,:,:) = ptab_child(2,nlcj-1,:,:) 
     918            tsa(2,nlcj-1,:,:) = ptab_child(2,nlcj-1,:,1:jpts) 
    919919         ENDIF 
    920920         ! 
     
    978978      zrhoy = Agrif_rhoy() 
    979979      IF (before) THEN  
     980         !We can't use zero as the special value because we need to include zeros 
     981         !when interpolating the scale factors 
     982         IF(Agrif_UseSpecialValue) THEN  
     983             Agrif_SpecialValue = -999._wp 
     984         ELSE 
     985             Agrif_SpecialValue = 0._wp 
     986         ENDIF 
    980987         DO jk=1,jpk 
    981988            DO jj=j1,j2 
    982989               DO ji=i1,i2 
    983                   ptab(ji,jj,jk,1) = e2u(ji,jj) * e3u_n(ji,jj,jk) * un(ji,jj,jk) 
    984                   ptab(ji,jj,jk,2) = umask(ji,jj,jk) * e2u(ji,jj) * e3u_n(ji,jj,jk) 
     990                  ptab(ji,jj,jk,1) = (e2u(ji,jj) * e3u_n(ji,jj,jk) * un(ji,jj,jk)*umask(ji,jj,jk)) - & 
     991                                   & ((umask(ji,jj,jk)-1) * Agrif_SpecialValue) 
     992                  ptab(ji,jj,jk,2) = (umask(ji,jj,jk) * e2u(ji,jj) * e3u_n(ji,jj,jk)) 
    985993               END DO 
    986994            END DO 
     
    990998         western_side  = (nb == 1).AND.(ndir == 1) 
    991999         eastern_side  = (nb == 1).AND.(ndir == 2) 
    992           
     1000 
     1001         Agrif_SpecialValue = 0._wp ! reset specialvalue to zero now interpolation completed 
     1002 
    9931003         ptab_child(:,:,:) = 0. 
    9941004         DO jj=j1,j2 
     
    10131023              N_out = 0 
    10141024              DO jk=1,jpk 
    1015                  if (umask(iref,jj,jk) == 0) EXIT 
     1025                 if (umask(ji,jj,jk) == 0) EXIT 
    10161026                 N_out = N_out + 1 
    10171027                 h_out(N_out) = e3u_n(ji,jj,jk) 
     
    10791089      zrhox = Agrif_rhox() 
    10801090      IF (before) THEN           
     1091         IF(Agrif_UseSpecialValue) THEN  
     1092             Agrif_SpecialValue = -999._wp 
     1093         ELSE 
     1094             Agrif_SpecialValue = 0._wp 
     1095         ENDIF 
    10811096         DO jk=k1,k2 
    10821097            DO jj=j1,j2 
     
    10921107         southern_side = (nb == 2).AND.(ndir == 1) 
    10931108         northern_side = (nb == 2).AND.(ndir == 2) 
     1109 
     1110         Agrif_SpecialValue = 0._wp !Reset special value to zero now interpolation is done 
     1111 
    10941112         do jj=j1,j2 
    10951113            jref = jj 
Note: See TracChangeset for help on using the changeset viewer.