Changeset 9000
 Timestamp:
 20171213T10:09:47+01:00 (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2017/dev_METO_MERCATOR_2017_agrif/NEMOGCM/NEMO/NST_SRC/agrif_top_interp.F90
r6140 r9000 50 50 ! 51 51 INTEGER :: ji, jj, jk, jn ! dummy loop indices 52 INTEGER :: imin, imax, jmin, jmax52 INTEGER :: imin, imax, jmin, jmax, N_in, N_out 53 53 REAL(wp) :: zrhox , zalpha1, zalpha2, zalpha3 54 54 REAL(wp) :: zalpha4, zalpha5, zalpha6, zalpha7 55 55 LOGICAL :: western_side, eastern_side,northern_side,southern_side 56 56 ! vertical interpolation: 57 REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk,n1:n2) :: ptab_child 58 REAL(wp), DIMENSION(k1:k2,n1:n21) :: tabin 59 REAL(wp), DIMENSION(k1:k2) :: h_in 60 REAL(wp), DIMENSION(1:jpk) :: h_out(1:jpk) 61 REAL(wp) :: h_diff, zrhoxy 62 63 zrhoxy = Agrif_rhox()*Agrif_rhoy() 57 64 IF (before) THEN 58 ptab(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2) 65 DO jn = 1,jpts 66 DO jk=k1,k2 67 DO jj=j1,j2 68 DO ji=i1,i2 69 ptab(ji,jj,jk,jn) = trn(ji,jj,jk,jn) 70 END DO 71 END DO 72 END DO 73 END DO 74 # if defined key_vertical 75 DO jk=k1,k2 76 DO jj=j1,j2 77 DO ji=i1,i2 78 ptab(ji,jj,jk,jpts+1) = tmask(ji,jj,jk) * e3t_n(ji,jj,jk) 79 END DO 80 END DO 81 END DO 82 # endif 83 59 84 ELSE 60 85 ! … … 63 88 southern_side = (nb == 2).AND.(ndir == 1) 64 89 northern_side = (nb == 2).AND.(ndir == 2) 90 91 # if defined key_vertical 92 DO jj=j1,j2 93 DO ji=i1,i2 94 iref = ji 95 jref = jj 96 if(western_side) iref=MAX(2,ji) 97 if(eastern_side) iref=MIN(nlci1,ji) 98 if(southern_side) jref=MAX(2,jj) 99 if(northern_side) jref=MIN(nlcj1,jj) 100 N_in = 0 101 DO jk=k1,k2 !k2 = jpk of parent grid 102 IF (ptab(ji,jj,jk,n2) == 0) EXIT 103 N_in = N_in + 1 104 tabin(jk,:) = ptab(ji,jj,jk,n1:n21) 105 h_in(N_in) = ptab(ji,jj,jk,n2) 106 END DO 107 N_out = 0 108 DO jk=1,jpk ! jpk of child grid 109 IF (tmask(iref,jref,jk) == 0) EXIT 110 N_out = N_out + 1 111 h_out(jk) = e3t_n(iref,jref,jk) 112 ENDDO 113 IF (N_in > 0) THEN 114 h_diff = sum(h_out(1:N_out))sum(h_in(1:N_in)) 115 DO jn=1,jptra 116 call reconstructandremap(tabin(1:N_in,jn),h_in,ptab_child(ji,jj,1:N_out,jn),h_out,N_in,N_out) 117 ENDDO 118 ENDIF 119 ENDDO 120 ENDDO 121 # else 122 ptab_child(i1:i2,j1:j2,1:jpk,1:jptra) = ptab(i1:i2,j1:j2,1:jpk,1:jptra) 123 # endif 124 65 125 ! 66 126 zrhox = Agrif_Rhox() … … 89 149 IF( eastern_side) THEN 90 150 DO jn = 1, jptra 91 tra(nlci,j1:j2, k1:k2,jn) = zalpha1 * ptab(nlci,j1:j2,k1:k2,jn) + zalpha2 * ptab(nlci1,j1:j2,k1:k2,jn)151 tra(nlci,j1:j2,1:jpk,jn) = zalpha1 * ptab_child(nlci,j1:j2,1:jpk,jn) + zalpha2 * ptab_child(nlci1,j1:j2,1:jpk,jn) 92 152 DO jk = 1, jpkm1 93 153 DO jj = jmin,jmax … … 108 168 IF( northern_side ) THEN 109 169 DO jn = 1, jptra 110 tra(i1:i2,nlcj, k1:k2,jn) = zalpha1 * ptab(i1:i2,nlcj,k1:k2,jn) + zalpha2 * ptab(i1:i2,nlcj1,k1:k2,jn)170 tra(i1:i2,nlcj,1:jpk,jn) = zalpha1 * ptab_child(i1:i2,nlcj,1:jpk,jn) + zalpha2 * ptab_child(i1:i2,nlcj1,1:jpk,jn) 111 171 DO jk = 1, jpkm1 112 172 DO ji = imin,imax … … 127 187 IF( western_side) THEN 128 188 DO jn = 1, jptra 129 tra(1,j1:j2, k1:k2,jn) = zalpha1 * ptab(1,j1:j2,k1:k2,jn) + zalpha2 * ptab(2,j1:j2,k1:k2,jn)189 tra(1,j1:j2,1:jpk,jn) = zalpha1 * ptab_child(1,j1:j2,1:jpk,jn) + zalpha2 * ptab_child(2,j1:j2,1:jpk,jn) 130 190 DO jk = 1, jpkm1 131 191 DO jj = jmin,jmax … … 145 205 IF( southern_side ) THEN 146 206 DO jn = 1, jptra 147 tra(i1:i2,1, k1:k2,jn) = zalpha1 * ptab(i1:i2,1,k1:k2,jn) + zalpha2 * ptab(i1:i2,2,k1:k2,jn)148 DO jk=1,jpk 207 tra(i1:i2,1,1:jpk,jn) = zalpha1 * ptab_child(i1:i2,1,1:jpk,jn) + zalpha2 * ptab_child(i1:i2,2,1:jpk,jn) 208 DO jk=1,jpkm1 149 209 DO ji=imin,imax 150 210 IF( vmask(ji,2,jk) == 0.e0 ) THEN … … 165 225 ! East south 166 226 IF ((eastern_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 167 tra(nlci1,2,:,:) = ptab (nlci1,2,:,:)227 tra(nlci1,2,:,:) = ptab_child(nlci1,2,:,:) 168 228 ENDIF 169 229 ! East north 170 230 IF ((eastern_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 171 tra(nlci1,nlcj1,:,:) = ptab (nlci1,nlcj1,:,:)231 tra(nlci1,nlcj1,:,:) = ptab_child(nlci1,nlcj1,:,:) 172 232 ENDIF 173 233 ! West south 174 234 IF ((western_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 175 tra(2,2,:,:) = ptab (2,2,:,:)235 tra(2,2,:,:) = ptab_child(2,2,:,:) 176 236 ENDIF 177 237 ! West north 178 238 IF ((western_side).AND.((nbondj == 1).OR.(nbondj == 2))) THEN 179 tra(2,nlcj1,:,:) = ptab (2,nlcj1,:,:)239 tra(2,nlcj1,:,:) = ptab_child(2,nlcj1,:,:) 180 240 ENDIF 181 241 !
Note: See TracChangeset
for help on using the changeset viewer.