Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:36:08 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
44027b6abc Jean*0001 #include "PACKAGES_CONFIG.h"
                0002 #include "CPP_EEOPTIONS.h"
                0003 
                0004 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0005 CBOP
                0006 C     !ROUTINE: FILL_CS_CORNER_UV_RS
                0007 
                0008 C     !INTERFACE:
                0009       SUBROUTINE FILL_CS_CORNER_UV_RS(
                0010      I     withSigns,
                0011      U     uFld, vFld,
                0012      I     bi,bj, myThid)
                0013       IMPLICIT NONE
                0014 
                0015 C     !DESCRIPTION:
                0016 C     *==========================================================*
                0017 C     | SUBROUTINE FILL_CS_CORNER_UV_RS
6e33c64afb Jean*0018 C     | o Fill the corner-halo region of CS-grid,
44027b6abc Jean*0019 C     |   for a 2 components, C-grid vector field
                0020 C     *==========================================================*
                0021 C     | o the corner halo region is filled with valid values
                0022 C     |   in order to extend in X and Y direction calculations
                0023 C     |   of fluxes, on a wide stencil.
                0024 C     *==========================================================*
                0025 
                0026 C     !USES:
                0027 C     == Global variables ==
                0028 
                0029 #include "SIZE.h"
                0030 #include "EEPARAMS.h"
                0031 #ifdef ALLOW_EXCH2
1cc6effca6 Jean*0032 #include "W2_EXCH2_SIZE.h"
44027b6abc Jean*0033 #include "W2_EXCH2_TOPOLOGY.h"
                0034 #endif /* ALLOW_EXCH2 */
                0035 
                0036 C     !INPUT/OUTPUT PARAMETERS:
                0037 C     == Routine arguments ==
6e33c64afb Jean*0038 C
44027b6abc Jean*0039 C     withSigns :: uFld,vFld are vector components
                0040 C     uFld      :: u-component, at C-grid West  point location
                0041 C     vFld      :: v-component, at C-grid SOuth point location
                0042 C     bi,bj     :: tile indices
                0043 C     myThid    :: thread number
                0044       LOGICAL withSigns
                0045       _RS     uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0046       _RS     vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0047       INTEGER bi,bj
                0048       INTEGER myThid
                0049 
                0050 C     !LOCAL VARIABLES:
                0051 C     == Local variables ==
                0052 C      i,j           :: loop indices
                0053 C      myTile        :: tile number
                0054       INTEGER i,j
                0055       LOGICAL southWestCorner
                0056       LOGICAL southEastCorner
                0057       LOGICAL northWestCorner
                0058       LOGICAL northEastCorner
                0059       _RL negOne
89b34fe90d Jean*0060 #ifdef ALLOW_EXCH2
                0061       INTEGER myTile
                0062 #endif
44027b6abc Jean*0063 CEOP
                0064 
                0065       IF (useCubedSphereExchange) THEN
                0066 
                0067        negOne = 1. _d 0
                0068        IF (withSigns) negOne = -1. _d 0
                0069 
                0070 #ifdef ALLOW_EXCH2
6e33c64afb Jean*0071        myTile = W2_myTileList(bi,bj)
44027b6abc Jean*0072        southWestCorner = exch2_isWedge(myTile).EQ.1
                0073      &             .AND. exch2_isSedge(myTile).EQ.1
                0074        southEastCorner = exch2_isEedge(myTile).EQ.1
                0075      &             .AND. exch2_isSedge(myTile).EQ.1
                0076        northEastCorner = exch2_isEedge(myTile).EQ.1
                0077      &             .AND. exch2_isNedge(myTile).EQ.1
                0078        northWestCorner = exch2_isWedge(myTile).EQ.1
                0079      &             .AND. exch2_isNedge(myTile).EQ.1
                0080 #else
                0081        southWestCorner = .TRUE.
                0082        southEastCorner = .TRUE.
                0083        northWestCorner = .TRUE.
                0084        northEastCorner = .TRUE.
                0085 #endif
                0086 
                0087 C--    To extend calculations in X direction, fill uFld array
                0088 C        with valid value in the corner.
                0089 C  e.g., NW corner: copy V(    0,sNy  ) into U(   -1,sNy+1)
                0090 C                   copy V(    0,sNy-1) into U(   -2,sNy+1)
                0091 C                   copy V(   -1,sNy  ) into U(   -1,sNy+2)
                0092 C                   copy V(   -1,sNy-1) into U(   -2,sNy+2)
                0093 C          |             |
                0094 C      U(-1,sNy+1)   U(1,sNy+1)   U(2,sNy+1)
                0095 C          | ^           |             |
                0096 C     -----|--\--------corner----------|
                0097 C          |   \         |             |
6e33c64afb Jean*0098 C          |    \        |
                0099 C          |     \       |
44027b6abc Jean*0100 C     -----|---V(0,sNy)--|---------------
                0101 C          |             |
                0102 C
                0103 C--    to extend calculations in Y direction, fill vFld array
                0104 C        with valid value in the corner.
                0105 C  e.g., NW corner: copy U(    2,sNy+1) into V(   0,sNy+2)
                0106 C                   copy U(    3,sNy+1) into V(   0,sNy+3)
                0107 C                   copy U(    2,sNy+2) into V(  -1,sNy+2)
                0108 C                   copy U(    3,sNy+2) into V(  -1,sNy+3)
                0109 C          |              |              |
                0110 C     -----|--V(0,sNy+2)--|--------------|
                0111 C          |    ^====================\
                0112 C      U(-1,sNy+1)     U(1,sNy+1)     U(2,sNy+1)
                0113 C          |              |              |
                0114 C     -----|--V(0,sNy+1)--o--------------|
                0115 C          |              |\             |
                0116 C          |              | \=corner
6e33c64afb Jean*0117 C          |              |
44027b6abc Jean*0118 C     -----|--V(0,sNy)----|--
                0119 C          |              |
                0120 C
                0121 
                0122         IF ( southWestCorner ) THEN
                0123 C-        prepare for direction X:
                0124           DO j=1,OLy
                0125            DO i=1,OLx
                0126             uFld( 1-i , 1-j ) = negOne*vFld( 1-j , 1+i )
                0127            ENDDO
                0128           ENDDO
                0129 C-        prepare for direction Y:
                0130           DO j=1,OLy
                0131            DO i=1,OLx
                0132             vFld( 1-i , 1-j ) = negOne*uFld( 1+j , 1-i )
                0133            ENDDO
                0134           ENDDO
                0135         ENDIF
                0136 
                0137         IF ( southEastCorner ) THEN
                0138 C-        prepare for direction X:
                0139           DO j=1,OLy
                0140            DO i=2,OLx
                0141             uFld(sNx+i, 1-j ) = vFld(sNx+j, i  )
                0142            ENDDO
                0143           ENDDO
                0144 C-        prepare for direction Y:
                0145           DO j=1,OLy
                0146            DO i=1,OLx
                0147             vFld(sNx+i, 1-j ) = uFld(sNx+1-j, 1-i  )
                0148            ENDDO
                0149           ENDDO
                0150         ENDIF
                0151 
                0152         IF ( northWestCorner ) THEN
                0153 C-        prepare for direction X:
                0154           DO j=1,OLy
                0155            DO i=1,OLx
                0156             uFld( 1-i ,sNy+j) = vFld( 1-j , sNy+1-i )
                0157            ENDDO
                0158           ENDDO
                0159 C-        prepare for direction Y:
                0160           DO j=2,OLy
                0161            DO i=1,OLx
                0162             vFld( 1-i ,sNy+j) = uFld(  j  , sNy+i )
                0163            ENDDO
                0164           ENDDO
                0165         ENDIF
                0166 
                0167         IF ( northEastCorner ) THEN
                0168 C-        prepare for direction X:
                0169           DO j=1,OLy
                0170            DO i=2,OLx
                0171             uFld(sNx+i,sNy+j) = negOne*vFld(sNx+j, sNy+2-i )
                0172            ENDDO
                0173           ENDDO
                0174 C-        prepare for direction Y:
                0175           DO j=2,OLy
                0176            DO i=1,OLx
                0177             vFld(sNx+i,sNy+j) = negOne*uFld(sNx+2-j, sNy+i )
                0178            ENDDO
                0179           ENDDO
                0180         ENDIF
                0181 
                0182 C--   End useCubedSphereExchange
                0183       ENDIF
                0184 
                0185       RETURN
                0186       END