Changeset 8690
- Timestamp:
- 2017-11-10T12:39:45+01:00 (7 years ago)
- Location:
- branches/2017/dev_r8126_UKMO_AGRIF_vert_interp/NEMOGCM/NEMO/NST_SRC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_r8126_UKMO_AGRIF_vert_interp/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90
r8596 r8690 601 601 INTEGER , INTENT(in ) :: nb , ndir 602 602 ! 603 INTEGER :: ji, jj, jk, jn ! dummy loop indices603 INTEGER :: ji, jj, jk, jn, iref, jref ! dummy loop indices 604 604 INTEGER :: imin, imax, jmin, jmax 605 605 REAL(wp) :: zrhox , zalpha1, zalpha2, zalpha3 … … 618 618 zrhoxy = Agrif_rhox()*Agrif_rhoy() 619 619 620 621 620 622 IF (before) THEN 621 623 IF(Agrif_UseSpecialValue) THEN 622 Agrif_SpecialValue = -999._wp 624 ! Agrif_SpecialValue = -999._wp 625 Agrif_SpecialValue = 0._wp 623 626 ELSE 624 627 Agrif_SpecialValue = 0._wp … … 628 631 DO jj=j1,j2 629 632 DO ji=i1,i2 630 ptab(ji,jj,jk,jn) = tsn(ji,jj,jk,jn) * e1e2t(ji,jj) * e3t_n(ji,jj,jk) * tmask(ji,jj,jk) - &631 & (tmask(ji,jj,jk)-1) * Agrif_SpecialValue633 ptab(ji,jj,jk,jn) = tsn(ji,jj,jk,jn) * e1e2t(ji,jj) * e3t_n(ji,jj,jk)! * tmask(ji,jj,jk) - & 634 ! & (tmask(ji,jj,jk)-1) * Agrif_SpecialValue 632 635 END DO 633 636 END DO … … 642 645 END DO 643 646 ELSE 647 western_side = (nb == 1).AND.(ndir == 1) 648 eastern_side = (nb == 1).AND.(ndir == 2) 649 southern_side = (nb == 2).AND.(ndir == 1) 650 northern_side = (nb == 2).AND.(ndir == 2) 644 651 Agrif_SpecialValue = 0._wp !reset now interpolation is done 645 652 ! VERTICAL REFINEMENT BEGIN … … 648 655 do jj=j1,j2 649 656 do ji=i1,i2 657 iref = ji 658 jref = jj 659 if(western_side) iref=2 660 if(eastern_side) iref=nlci-1 661 if(southern_side) jref=2 662 if(northern_side) jref=nlcj-1 650 663 N_in = 0 651 664 DO jk=k1,k2 !k2 = jpk of parent grid … … 653 666 N_in = N_in + 1 654 667 tabin(jk,:) = ptab(ji,jj,jk,n1:n2-1)/ptab(ji,jj,jk,n2) 655 h_in(N_in) = ptab(ji,jj,jk,n2)/(e1e2t(ji,jj) *zrhoxy)668 h_in(N_in) = ptab(ji,jj,jk,n2)/(e1e2t(ji,jj)) 656 669 END DO 657 670 N_out = 0 658 671 DO jk=1,jpk ! jpk of child grid 659 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 model672 IF (tmask(iref,jref,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 660 673 N_out = N_out + 1 661 h_out(jk) = e3t_n( ji,jj,jk) !Child grid scale factors. Could multiply by e1e2t here instead of division above674 h_out(jk) = e3t_n(iref,jref,jk) !Child grid scale factors. Could multiply by e1e2t here instead of division above 662 675 ENDDO 663 676 IF (N_in > 0) THEN … … 891 904 !when interpolating the scale factors 892 905 IF(Agrif_UseSpecialValue) THEN 893 Agrif_SpecialValue = -999._wp 906 ! Agrif_SpecialValue = -999._wp 907 Agrif_SpecialValue = 0._wp 894 908 ELSE 895 909 Agrif_SpecialValue = 0._wp … … 925 939 N_in = N_in + 1 926 940 tabin(jk) = ptab(ji,jj,jk,1)/ptab(ji,jj,jk,2) 927 h_in(N_in) = ptab(ji,jj,jk,2)/(e2u(ji,jj) * zrhoy)941 h_in(N_in) = ptab(ji,jj,jk,2)/(e2u(ji,jj)) 928 942 ENDDO 929 943 … … 945 959 ENDIF 946 960 947 !IF (N_in * N_out > 0) THEN948 !h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in))961 IF (N_in * N_out > 0) THEN 962 h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in)) 949 963 ! Should be able to remove the next IF/ELSEIF statement once scale factors are dealt with properly 950 ! if (h_diff < 0.) then951 !print *,'CHECK YOUR BATHY ...', h_diff, sum(h_out(1:N_out)), sum(h_in(1:N_in))964 if (h_diff < -1.e4) then 965 print *,'CHECK YOUR BATHY ...', h_diff, sum(h_out(1:N_out)), sum(h_in(1:N_in)) 952 966 ! stop 953 !endif954 !ENDIF967 endif 968 ENDIF 955 969 call reconstructandremap(tabin(1:N_in),h_in(1:N_in),ptab_child(ji,jj,1:N_out),h_out(1:N_out),N_in,N_out) 956 970 … … 958 972 ENDDO 959 973 960 ! in the following961 ! remove division of ua by fs e3u (already done) and also zrhoy and e2u962 974 ! VERTICAL REFINEMENT END 963 975 DO jk = 1, jpkm1 … … 1006 1018 IF (before) THEN 1007 1019 IF(Agrif_UseSpecialValue) THEN 1008 Agrif_SpecialValue = -999._wp 1020 ! Agrif_SpecialValue = -999._wp 1021 Agrif_SpecialValue = 0._wp 1009 1022 ELSE 1010 1023 Agrif_SpecialValue = 0._wp … … 1037 1050 N_in = N_in + 1 1038 1051 tabin(jk) = ptab(ji,jj,jk,1)/ptab(ji,jj,jk,2) 1039 h_in(N_in) = ptab(ji,jj,jk,2)/(e1v(ji,jj) *zrhox)1052 h_in(N_in) = ptab(ji,jj,jk,2)/(e1v(ji,jj)) 1040 1053 enddo 1041 1054 IF (N_in == 0) THEN -
branches/2017/dev_r8126_UKMO_AGRIF_vert_interp/NEMOGCM/NEMO/NST_SRC/agrif_opa_update.F90
r8596 r8690 200 200 IF (before) THEN 201 201 # if defined key_vertical 202 AGRIF_SpecialValue = -999._wp 202 203 zrho_xy = Agrif_rhox() * Agrif_rhoy() 203 204 DO jn = n1,n2-1 … … 205 206 DO jj=j1,j2 206 207 DO ji=i1,i2 207 tabres(ji,jj,jk,jn) = zrho_xy * tsn(ji,jj,jk,jn) * e1e2t(ji,jj) * e3t_n(ji,jj,jk) 208 tabres(ji,jj,jk,jn) = (zrho_xy * tsn(ji,jj,jk,jn) * e1e2t(ji,jj) * e3t_n(ji,jj,jk) ) & 209 * tmask(ji,jj,jk) + (tmask(ji,jj,jk)-1)*999._wp 208 210 END DO 209 211 END DO … … 213 215 DO jj=j1,j2 214 216 DO ji=i1,i2 215 tabres(ji,jj,jk,n2) = tmask(ji,jj,jk) * zrho_xy * e1e2t(ji,jj) * e3t_n(ji,jj,jk) 217 tabres(ji,jj,jk,n2) = tmask(ji,jj,jk) * e1e2t(ji,jj) * e3t_n(ji,jj,jk) & 218 + (tmask(ji,jj,jk)-1)*999._wp 216 219 END DO 217 220 END DO … … 232 235 tabres_child(:,:,:,:) = 0. 233 236 # if defined key_vertical 237 AGRIF_SpecialValue = 0._wp 234 238 DO jj=j1,j2 235 239 DO ji=i1,i2 236 240 N_in = 0 237 241 DO jk=k1,k2 !k2 = jpk of child grid 238 IF (tabres(ji,jj,jk,n2) ==0) EXIT242 IF (tabres(ji,jj,jk,n2) > -900) EXIT 239 243 N_in = N_in + 1 240 244 tabin(jk,:) = tabres(ji,jj,jk,n1:n2-1)/tabres(ji,jj,jk,n2) … … 247 251 h_out(N_out) = e3t_n(ji,jj,jk) !Parent grid scale factors. Could multiply by e1e2t here instead of division above 248 252 ENDDO 253 ! IF(ji.EQ.i1 .AND. jj.EQ.j1) print *,'1st parent point',sum(h_in(1:N_in)), sum(h_out(1:N_out)) 249 254 IF (N_in > 0) THEN 250 255 h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in)) … … 255 260 ! tabin(N_in,:) = tabin(N_in-1,:) 256 261 IF (h_diff < -1.e-4) THEN 257 print *,'CHECK YOUR bathy T points ...',ji,jj,h_diff,sum(h_in(1:N_in)),sum(h_out(1:N_out)) 258 print *, tabres(ji,j1:j2,1,n2) 262 print *,'CHECK YOUR bathy T points ...',ji,jj,h_diff,e1e2t(ji,jj),sum(h_in(1:N_in)),sum(h_out(1:N_out)), N_in, N_out 263 print *,h_in(1:N_in) 264 print *,h_out(1:N_out) 259 265 STOP 260 266 ! N_out = N_out + 1 … … 329 335 ! 330 336 IF( before ) THEN 337 print *, i1,i2,j1,j2,k1,k2 331 338 zrhoy = Agrif_Rhoy() 332 339 # if defined key_vertical 340 AGRIF_SpecialValue = -999._wp 333 341 DO jk=k1,k2 334 342 DO jj=j1,j2 335 343 DO ji=i1,i2 336 tabres(ji,jj,jk,1) = zrhoy * e2u(ji,jj) * e3u_n(ji,jj,jk) * umask(ji,jj,jk) * un(ji,jj,jk) 337 tabres(ji,jj,jk,2) = umask(ji,jj,jk) * zrhoy * e2u(ji,jj) * e3u_n(ji,jj,jk) 344 tabres(ji,jj,jk,1) = zrhoy * e2u(ji,jj) * e3u_n(ji,jj,jk) * umask(ji,jj,jk) * un(ji,jj,jk) & 345 - (umask(ji,jj,jk)-1)*999._wp 346 tabres(ji,jj,jk,2) = umask(ji,jj,jk) * e2u(ji,jj) * e3u_n(ji,jj,jk) & 347 - (umask(ji,jj,jk)-1)*999._wp 338 348 END DO 339 349 END DO … … 347 357 tabres_child(:,:,:) = 0. 348 358 # if defined key_vertical 349 ! VERTICAL REFINEMENT BEGIN 359 AGRIF_SpecialValue = -999._wp 350 360 DO jj=j1,j2 351 361 DO ji=i1,i2 352 362 N_in = 0 353 363 DO jk=k1,k2 !k2=jpk of child grid 354 IF (tabres(ji,jj,jk,2) ==0) EXIT364 IF (tabres(ji,jj,jk,2) > -900) EXIT 355 365 N_in = N_in + 1 356 366 tabin(jk) = tabres(ji,jj,jk,1)/tabres(ji,jj,jk,2) … … 367 377 ! Should be able to remove the next IF/ELSEIF statement once scale factors are dealt with properly 368 378 if (h_diff < -1.e-4) then 369 print *,'CHECK YOUR BATHY ...'379 print *,'CHECK YOUR bathy U points ...',ji,jj,h_diff,e2u(ji,jj),sum(h_in(1:N_in)),sum(h_out(1:N_out)), N_in, N_out 370 380 stop 371 381 ! else ! Extends with 0
Note: See TracChangeset
for help on using the changeset viewer.