/[MITgcm]/MITgcm/pkg/obcs/obcs_readparms.F
ViewVC logotype

Diff of /MITgcm/pkg/obcs/obcs_readparms.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.36 by jmc, Tue Jun 7 22:23:46 2011 UTC revision 1.37 by jmc, Fri Jan 20 01:26:15 2012 UTC
# Line 49  C     msgBuf      :: Informational/error Line 49  C     msgBuf      :: Informational/error
49  C     iUnit       :: Work variable for IO unit number  C     iUnit       :: Work variable for IO unit number
50        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
51        INTEGER iUnit        INTEGER iUnit
52        INTEGER I, J        INTEGER i, j
53        INTEGER bi, bj, iG, jG, iGm, jGm        INTEGER bi, bj, iG, jG, iGm, jGm
54  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
55        INTEGER iTracer        INTEGER iTracer
# Line 113  C     OBEW_Ny :: height of global domain Line 113  C     OBEW_Ny :: height of global domain
113    
114        INTEGER OBNS_Nx, OBNS_Ny        INTEGER OBNS_Nx, OBNS_Ny
115        INTEGER OBEW_Nx, OBEW_Ny        INTEGER OBEW_Nx, OBEW_Ny
   
 #ifdef ALLOW_EXCH2  
 C     buf :: used to exchange OB_Jnorth, ...  
       _RS buf(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)  
 #endif  
116  CEOP  CEOP
117    
118  C     retired parameters  C     retired parameters
# Line 184  C     retired parameters Line 179  C     retired parameters
179    
180  C--   Default flags and values for OBCS  C--   Default flags and values for OBCS
181        insideOBmaskFile = ' '        insideOBmaskFile = ' '
182        DO I=1,OBNS_Nx        DO i=1,OBNS_Nx
183         OB_Jnorth(I)=0         OB_Jnorth(i)=0
184         OB_Jsouth(I)=0         OB_Jsouth(i)=0
185        ENDDO        ENDDO
186        DO J=1,OBEW_Ny        DO j=1,OBEW_Ny
187         OB_Ieast(J)=0         OB_Ieast(j)=0
188         OB_Iwest(J)=0         OB_Iwest(j)=0
189        ENDDO        ENDDO
190          OBCS_indexStatus = 0
191        useOrlanskiNorth   =.FALSE.        useOrlanskiNorth   =.FALSE.
192        useOrlanskiSouth   =.FALSE.        useOrlanskiSouth   =.FALSE.
193        useOrlanskiEast    =.FALSE.        useOrlanskiEast    =.FALSE.
# Line 357  C-    retired parameter Line 353  C-    retired parameter
353        ENDIF        ENDIF
354    
355  C-    Account for periodicity if negative indices were supplied  C-    Account for periodicity if negative indices were supplied
356        DO J=1,OBEW_Ny        DO j=1,OBEW_Ny
357         IF (OB_Ieast(J).LT.0) OB_Ieast(J)=OB_Ieast(J)+OBEW_Nx+1         IF (OB_Ieast(j) .LT.0) OB_Ieast(j) = OB_Ieast(j)+OBEW_Nx+1
358        ENDDO        ENDDO
359        DO I=1,OBNS_Nx        DO i=1,OBNS_Nx
360         IF (OB_Jnorth(I).LT.0) OB_Jnorth(I)=OB_Jnorth(I)+OBNS_Ny+1         IF (OB_Jnorth(i).LT.0) OB_Jnorth(i)=OB_Jnorth(i)+OBNS_Ny+1
361        ENDDO        ENDDO
362        IF ( debugLevel.GE.debLevA ) THEN        IF ( debugLevel.GE.debLevA ) THEN
363  c       write(*,*) 'OB Jn =',OB_Jnorth  c       write(*,*) 'OB Jn =',OB_Jnorth
# Line 401  C--   Calculate the tiled index arrays O Line 397  C--   Calculate the tiled index arrays O
397  C     global arrays OB_Jnorth/Jsouth/Ieast/Iwest.  C     global arrays OB_Jnorth/Jsouth/Ieast/Iwest.
398  C     Note: This part of the code has been moved from obcs_init_fixed to  C     Note: This part of the code has been moved from obcs_init_fixed to
399  C     routine routine because the OB_Jn/Js/Ie/Iw index arrays are  C     routine routine because the OB_Jn/Js/Ie/Iw index arrays are
400  C     required by ini_depth which is called before obcs_init_fixed  C     required by INI_DEPTH (calling OBCS_CHECK_DEPTHS, but only needs
401    C     valid interior indices) which is called before OBCS_INIT_FIXED.
402        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
403         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
404    
405          DO I=1-Olx,sNx+Olx          DO i=1-OLx,sNx+OLx
406           OB_Jn(I,bi,bj)=0           OB_Jn(i,bi,bj)=0
407           OB_Js(I,bi,bj)=0           OB_Js(i,bi,bj)=0
408          ENDDO          ENDDO
409    
410          DO J=1-Oly,sNy+Oly          DO j=1-OLy,sNy+OLy
411           OB_Ie(J,bi,bj)=0           OB_Ie(j,bi,bj)=0
412           OB_Iw(J,bi,bj)=0           OB_Iw(J,bi,bj)=0
413          ENDDO          ENDDO
414    
# Line 419  C     required by ini_depth which is cal Line 416  C     required by ini_depth which is cal
416  C       We apply OBCS only inside tile and exchange overlaps later  C       We apply OBCS only inside tile and exchange overlaps later
417          tN = W2_myTileList(bi,bj)          tN = W2_myTileList(bi,bj)
418  C 1. N/S boundaries  C 1. N/S boundaries
419          DO J=1,sNy          DO j=1,sNy
420  C   convert from local y index J to global y index jG  C   convert from local y index J to global y index jG
421  c   for N/S boundaries, we use faces stacked in x direction  c   for N/S boundaries, we use faces stacked in x direction
422           jG = exch2_tyXStackLo(tN)+J-1           jG = exch2_tyXStackLo(tN)+j-1
423  C   loop over local x index I  C   loop over local x index I
424           DO I=1,sNx           DO i=1,sNx
425            iG = exch2_txXStackLo(tN)+I-1            iG = exch2_txXStackLo(tN)+i-1
426            IF (jG.EQ.OB_Jnorth(iG)) OB_Jn(I,bi,bj)=J            IF (jG.EQ.OB_Jnorth(iG)) OB_Jn(i,bi,bj)=j
427            IF (jG.EQ.OB_Jsouth(iG)) OB_Js(I,bi,bj)=J            IF (jG.EQ.OB_Jsouth(iG)) OB_Js(i,bi,bj)=j
428           ENDDO           ENDDO
429          ENDDO          ENDDO
430  C 2. E/W boundaries  C 2. E/W boundaries
431          DO J=1,sNy          DO j=1,sNy
432  C   convert from local y index J to global y index jG  C   convert from local y index J to global y index jG
433  c   for E/W boundaries, we use faces stacked in y direction  c   for E/W boundaries, we use faces stacked in y direction
434           jG = exch2_tyYStackLo(tN)+J-1           jG = exch2_tyYStackLo(tN)+j-1
435  C   loop over local x index I  C   loop over local x index I
436           DO I=1,sNx           DO i=1,sNx
437            iG = exch2_txYStackLo(tN)+I-1            iG = exch2_txYStackLo(tN)+i-1
438            IF (iG.EQ.OB_Ieast(jG))  OB_Ie(J,bi,bj)=I            IF (iG.EQ.OB_Ieast(jG))  OB_Ie(j,bi,bj)=i
439            IF (iG.EQ.OB_Iwest(jG))  OB_Iw(J,bi,bj)=I            IF (iG.EQ.OB_Iwest(jG))  OB_Iw(j,bi,bj)=i
440           ENDDO           ENDDO
441          ENDDO          ENDDO
442            _BEGIN_MASTER(myThid)
443    C-    OB-index tiled-arrays are set for tile-interior region
444             OBCS_indexStatus = 1
445            _END_MASTER(myThid)
446    
447  #else /* ALLOW_EXCH2 */  #else /* ALLOW_EXCH2 */
448    
449          DO J=1-Oly,sNy+Oly          DO j=1-OLy,sNy+OLy
450  C convert from local y index J to global y index jG  C convert from local y index J to global y index jG
451           jG = myYGlobalLo-1+(bj-1)*sNy+J           jG = myYGlobalLo+(bj-1)*sNy+j-1
452  C use periodicity to deal with out of range points caused by the overlaps.  C use periodicity to deal with out of range points caused by the overlaps.
453  C they will be excluded by the mask in any case, but this saves array  C they will be excluded by the mask in any case, but this saves array
454  C out-of-bounds errors here.  C out-of-bounds errors here.
455           jGm = 1+mod( jG-1+Ny , Ny )           jGm = 1+mod( jG-1+Ny , Ny )
456  C loop over local x index I  C loop over local x index I
457           DO I=1,sNx           DO i=1,sNx
458            iG = myXGlobalLo-1+(bi-1)*sNx+I            iG = myXGlobalLo+(bi-1)*sNx+i-1
459            iGm = 1+mod( iG-1+Nx , Nx )            iGm = 1+mod( iG-1+Nx , Nx )
460  C OB_Ieast(jGm) allows for the eastern boundary to be at variable x locations  C OB_Ieast(jGm) allows for the eastern boundary to be at variable x locations
461            IF (iG.EQ.OB_Ieast(jGm))  OB_Ie(J,bi,bj)=I            IF (iG.EQ.OB_Ieast(jGm))  OB_Ie(j,bi,bj)=i
462            IF (iG.EQ.OB_Iwest(jGm))  OB_Iw(J,bi,bj)=I            IF (iG.EQ.OB_Iwest(jGm))  OB_Iw(j,bi,bj)=i
463           ENDDO           ENDDO
464          ENDDO          ENDDO
465          DO J=1,sNy          DO j=1,sNy
466           jG = myYGlobalLo-1+(bj-1)*sNy+J           jG = myYGlobalLo+(bj-1)*sNy+j-1
467           jGm = 1+mod( jG-1+Ny , Ny )           jGm = 1+mod( jG-1+Ny , Ny )
468           DO I=1-Olx,sNx+Olx           DO i=1-OLx,sNx+OLx
469            iG = myXGlobalLo-1+(bi-1)*sNx+I            iG = myXGlobalLo+(bi-1)*sNx+i-1
470            iGm = 1+mod( iG-1+Nx , Nx )            iGm = 1+mod( iG-1+Nx , Nx )
471  C OB_Jnorth(iGm) allows for the northern boundary to be at variable y locations  C OB_Jnorth(iGm) allows for the northern boundary to be at variable y locations
472            IF (jG.EQ.OB_Jnorth(iGm)) OB_Jn(I,bi,bj)=J            IF (jG.EQ.OB_Jnorth(iGm)) OB_Jn(i,bi,bj)=j
473            IF (jG.EQ.OB_Jsouth(iGm)) OB_Js(I,bi,bj)=J            IF (jG.EQ.OB_Jsouth(iGm)) OB_Js(i,bi,bj)=j
474           ENDDO           ENDDO
475          ENDDO          ENDDO
476            _BEGIN_MASTER(myThid)
477    C-    OB-index tiled-arrays are set for interior and overlap regions
478            OBCS_indexStatus = 2
479            _END_MASTER(myThid)
480  #endif /* ALLOW_EXCH2 */  #endif /* ALLOW_EXCH2 */
481    
482  C     bi,bj-loops  C     bi,bj-loops
483         ENDDO         ENDDO
484        ENDDO        ENDDO
485    
486  #ifdef ALLOW_EXCH2  C--   Everyone else must wait for OBCS_indexStatus to be set
487  C     exchange with neighbors        _BARRIER
       DO bj = myByLo(myThid), myByHi(myThid)  
        DO bi = myBxLo(myThid), myBxHi(myThid)  
         DO J=1,sNy  
          buf(sNx,J,bi,bj) = OB_Ie(J,bi,bj)  
          buf(  1,J,bi,bj) = OB_Iw(J,bi,bj)  
         ENDDO  
        ENDDO  
       ENDDO  
       CALL EXCH_3D_RS( buf, 1, myThid )  
       DO bj = myByLo(myThid), myByHi(myThid)  
        DO bi = myBxLo(myThid), myBxHi(myThid)  
         DO J=1-Oly,sNy+Oly  
          OB_Ie(J,bi,bj) = buf(sNx,J,bi,bj)  
          OB_Iw(J,bi,bj) = buf(  1,J,bi,bj)  
         ENDDO  
        ENDDO  
       ENDDO  
   
       DO bj = myByLo(myThid), myByHi(myThid)  
        DO bi = myBxLo(myThid), myBxHi(myThid)  
         DO I=1,sNx  
          buf(I,sNy,bi,bj) = OB_Jn(I,bi,bj)  
          buf(I,  1,bi,bj) = OB_Js(I,bi,bj)  
         ENDDO  
        ENDDO  
       ENDDO  
       CALL EXCH_3D_RS( buf, 1, myThid )  
       DO bj = myByLo(myThid), myByHi(myThid)  
        DO bi = myBxLo(myThid), myBxHi(myThid)  
         DO I=1-Olx,sNx+Olx  
          OB_Jn(I,bi,bj) = buf(I,sNy,bi,bj)  
          OB_Js(I,bi,bj) = buf(I,  1,bi,bj)  
         ENDDO  
        ENDDO  
       ENDDO  
 #endif /* ALLOW_EXCH2 */  
488    
489  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
490        RETURN        RETURN

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.22