Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:39:44 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
017b6b2289 Jean*0001 CBOP
                0002 C     !ROUTINE: W2_EXCH2_TOPOLOGY.h
                0003 C     !INTERFACE:
                0004 C     #include W2_EXCH2_TOPOLOGY.h
                0005 
                0006 C     !DESCRIPTION:
                0007 C     *==========================================================*
                0008 C     | W2_EXCH2_TOPOLOGY.h
                0009 C     | o Header defining tile exchange and mapping for W2_EXCH2
                0010 C     *==========================================================*
                0011 C     | 1rst part holds the full topology structure (same for all
                0012 C     |  process) and is independent of tile-processor repartition
                0013 C     |  (needs W2_EXCH2_SIZE.h to be included before)
d6ea3164dc Jean*0014 C     | 2nd part (put in this header for convenience) holds
017b6b2289 Jean*0015 C     |   Tile Ids and is function of tile-process repartition
                0016 C     |  (needs SIZE.h to be included before)
                0017 C     *==========================================================*
                0018 CEOP
a98fc18a55 Jean*0019 
2b887796b0 Oliv*0020 C---   Parameters for enumerating directions
                0021        INTEGER W2_NORTH, W2_SOUTH, W2_EAST, W2_WEST
                0022        PARAMETER ( W2_NORTH = 1 )
                0023        PARAMETER ( W2_SOUTH = 2 )
                0024        PARAMETER ( W2_EAST  = 3 )
                0025        PARAMETER ( W2_WEST  = 4 )
017b6b2289 Jean*0026 
                0027 C---   Topology data structures
9b79698769 Jean*0028 C      exch2_global_Nx   :: Global-file domain length.
                0029 C      exch2_global_Ny   :: Global-file domain height.
1dea4b2a51 Oliv*0030 C      exch2_xStack_Nx   :: Length of domain used for north/south OBCS.
                0031 C      exch2_xStack_Ny   :: Height of domain used for north/south OBCS.
                0032 C      exch2_yStack_Nx   :: Length of domain used for east/west OBCS.
                0033 C      exch2_yStack_Ny   :: Height of domain used for east/west OBCS.
017b6b2289 Jean*0034 C---   Tiling and Exch data structures
a98fc18a55 Jean*0035 C      exch2_nTiles      :: Number of tiles in this topology
017b6b2289 Jean*0036 C      exch2_myFace      :: Face number for each tile (used for I/O).
                0037 C      exch2_mydNx       :: Face size in X for each tile (for I/O).
                0038 C      exch2_mydNy       :: Face size in Y for each tile (for I/O).
9b79698769 Jean*0039 C      exch2_tNx         :: Size in X for each tile.
                0040 C      exch2_tNy         :: Size in Y for each tile.
                0041 C      exch2_tBasex      :: Tile offset in X within its sub-domain (cube face)
                0042 C      exch2_tBasey      :: Tile offset in Y within its sub-domain (cube face)
                0043 C      exch2_txGlobalo   :: Tile base X index within global index space.
                0044 C      exch2_tyGlobalo   :: Tile base Y index within global index space.
1dea4b2a51 Oliv*0045 C      exch2_txXStackLo  :: Tile base X index within N/S OBCS index space.
                0046 C      exch2_tyXStackLo  :: Tile base Y index within N/S OBCS index space.
                0047 C      exch2_txYStackLo  :: Tile base X index within E/W OBCS index space.
                0048 C      exch2_tyYStackLo  :: Tile base Y index within E/W OBCS index space.
9b79698769 Jean*0049 C      exch2_isWedge     :: 1 if West  is at domain edge, 0 if not.
                0050 C      exch2_isNedge     :: 1 if North is at domain edge, 0 if not.
                0051 C      exch2_isEedge     :: 1 if East  is at domain edge, 0 if not.
                0052 C      exch2_isSedge     :: 1 if South is at domain edge, 0 if not.
ef53b829d7 Jean*0053 C      exch2_nNeighbours :: Tile neighbour entries count.
                0054 C      exch2_neighbourId :: Tile number for each neighbour entry.
017b6b2289 Jean*0055 C      exch2_opposingSend:: Neighbour entry in target tile send
9b79698769 Jean*0056 C                        :: which has this tile and neighbour as its target.
                0057 C      exch2_pij(:,n,t)  :: Matrix which applies to target-tile indices to get
                0058 C                        :: source-tile "t" indices, for neighbour entry "n".
                0059 C      exch2_oi(n,t)     :: Source-tile "t" X index offset in target
                0060 C                        :: to source connection (neighbour entry "n").
                0061 C      exch2_oj(n,t)     :: Source-tile "t" Y index offset in target
                0062 C                        :: to source connection (neighbour entry "n").
                0063        INTEGER exch2_global_Nx
                0064        INTEGER exch2_global_Ny
1dea4b2a51 Oliv*0065        INTEGER exch2_xStack_Nx
                0066        INTEGER exch2_xStack_Ny
                0067        INTEGER exch2_yStack_Nx
                0068        INTEGER exch2_yStack_Ny
a98fc18a55 Jean*0069        INTEGER exch2_nTiles
017b6b2289 Jean*0070        INTEGER exch2_myFace( W2_maxNbTiles )
                0071        INTEGER exch2_mydNx( W2_maxNbTiles )
                0072        INTEGER exch2_mydNy( W2_maxNbTiles )
                0073        INTEGER exch2_tNx( W2_maxNbTiles )
                0074        INTEGER exch2_tNy( W2_maxNbTiles )
                0075        INTEGER exch2_tBasex( W2_maxNbTiles )
                0076        INTEGER exch2_tBasey( W2_maxNbTiles )
                0077        INTEGER exch2_txGlobalo(W2_maxNbTiles )
                0078        INTEGER exch2_tyGlobalo(W2_maxNbTiles )
1dea4b2a51 Oliv*0079        INTEGER exch2_txXStackLo(W2_maxNbTiles )
                0080        INTEGER exch2_tyXStackLo(W2_maxNbTiles )
                0081        INTEGER exch2_txYStackLo(W2_maxNbTiles )
                0082        INTEGER exch2_tyYStackLo(W2_maxNbTiles )
017b6b2289 Jean*0083        INTEGER exch2_isWedge( W2_maxNbTiles )
                0084        INTEGER exch2_isNedge( W2_maxNbTiles )
                0085        INTEGER exch2_isEedge( W2_maxNbTiles )
                0086        INTEGER exch2_isSedge( W2_maxNbTiles )
                0087        INTEGER exch2_nNeighbours( W2_maxNbTiles )
                0088        INTEGER exch2_neighbourId(  W2_maxNeighbours, W2_maxNbTiles )
                0089        INTEGER exch2_opposingSend( W2_maxNeighbours, W2_maxNbTiles )
2b887796b0 Oliv*0090        INTEGER exch2_neighbourDir( W2_maxNeighbours, W2_maxNbTiles )
017b6b2289 Jean*0091        INTEGER exch2_pij(4,W2_maxNeighbours, W2_maxNbTiles )
                0092        INTEGER exch2_oi (  W2_maxNeighbours, W2_maxNbTiles )
                0093        INTEGER exch2_oj (  W2_maxNeighbours, W2_maxNbTiles )
ef53b829d7 Jean*0094 
                0095        COMMON /W2_EXCH2_TOPO_I/
017b6b2289 Jean*0096      &        exch2_global_Nx, exch2_global_Ny,
1dea4b2a51 Oliv*0097      &        exch2_xStack_Nx, exch2_xStack_Ny,
                0098      &        exch2_yStack_Nx, exch2_yStack_Ny,
f7d498dc61 Jean*0099      &        exch2_nTiles,
017b6b2289 Jean*0100      &        exch2_myFace, exch2_mydNx, exch2_mydNy,
9b79698769 Jean*0101      &        exch2_tNx, exch2_tNy,
                0102      &        exch2_tBasex, exch2_tBasey,
                0103      &        exch2_txGlobalo,exch2_tyGlobalo,
1dea4b2a51 Oliv*0104      &        exch2_txXStackLo,exch2_tyXStackLo,
                0105      &        exch2_txYStackLo,exch2_tyYStackLo,
ef53b829d7 Jean*0106      &        exch2_isWedge, exch2_isNedge,
                0107      &        exch2_isEedge, exch2_isSedge,
9b79698769 Jean*0108      &        exch2_nNeighbours, exch2_neighbourId,
2b887796b0 Oliv*0109      &        exch2_opposingSend, exch2_neighbourDir,
9b79698769 Jean*0110      &        exch2_pij,
                0111      &        exch2_oi, exch2_oj
ef53b829d7 Jean*0112 
9b79698769 Jean*0113 C---   Exchange execution loop data structures
                0114 C      exch2_iLo,iHi(n,t) :: X-index range of this tile "t" halo-region
                0115 C                         :: to be updated with neighbour entry "n".
                0116 C      exch2_jLo,jHi(n,t) :: Y-index range of this tile "t" halo-region
                0117 C                         :: to be updated with neighbour entry "n".
017b6b2289 Jean*0118        INTEGER exch2_iLo( W2_maxNeighbours, W2_maxNbTiles )
                0119        INTEGER exch2_iHi( W2_maxNeighbours, W2_maxNbTiles )
                0120        INTEGER exch2_jLo( W2_maxNeighbours, W2_maxNbTiles )
                0121        INTEGER exch2_jHi( W2_maxNeighbours, W2_maxNbTiles )
ef53b829d7 Jean*0122        COMMON /W2_EXCH2_HALO_SPEC/
9b79698769 Jean*0123      &        exch2_iLo, exch2_iHi,
                0124      &        exch2_jLo, exch2_jHi
                0125 
a98fc18a55 Jean*0126 C---   Cumulated Sum operator
                0127 C      W2_tMC1, W2_tMC2 :: tile that holds Missing Corners (=f1.NW,f2.SE)
575f97366a Jean*0128 C      W2_cumSum_facet(1,f1,f2) :: cum-sum at facet f2 origin function of
                0129 C                                  facet f1 X-increment
                0130 C      W2_cumSum_facet(2,f1,f2) :: cum-sum at tile f2 origin function of
                0131 C                                  facet f1 Y-increment
a98fc18a55 Jean*0132 C      W2_cumSum_tiles(1,t1,t2) :: cum-sum at tile t2 origin function of
                0133 C                                  tile t1 X-increment
                0134 C      W2_cumSum_tiles(2,t1,t2) :: cum-sum at tile t2 origin function of
                0135 C                                  tile t1 Y-increment
                0136        INTEGER W2_tMC1, W2_tMC2
575f97366a Jean*0137        INTEGER W2_cumSum_facet( 2, W2_maxNbFacets,W2_maxNbFacets)
                0138        COMMON /W2_CUMSUM_TOPO_I/
                0139      &        W2_tMC1, W2_tMC2,
                0140      &        W2_cumSum_facet
                0141 #ifdef W2_CUMSUM_USE_MATRIX
a98fc18a55 Jean*0142        INTEGER W2_cumSum_tiles( 2, W2_maxNbTiles, W2_maxNbTiles )
                0143        COMMON /W2_CUMSUM_MATRIX/
                0144      &        W2_cumSum_tiles
575f97366a Jean*0145 #endif /* W2_CUMSUM_USE_MATRIX */
a98fc18a55 Jean*0146 
017b6b2289 Jean*0147 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0148 
f7d498dc61 Jean*0149 C--   COMMON /W2_MAP_TILE2PROC/ mapping of tiles to process:
                0150 C     get W2 tile Id from process Id + subgrid indices (bi,bj) or the reverse
                0151 C     (tile ids are no longer a simple function of process and subgrid indices).
                0152 C
                0153 C     W2_tileProc(tN) :: Rank of process owning tile tN (filled at run time).
                0154 C     W2_tileIndex(tN):: local subgrid index of tile tN
                0155 C     W2_tileRank(tN) :: rank of tile tN in full-tile list (without blank)
017b6b2289 Jean*0156 C     W2_myTileList   :: list of tiles owned by this process
                0157 C     W2_procTileList :: same as W2_myTileList, but contains
                0158 C                        information for all processes
f7d498dc61 Jean*0159       INTEGER W2_tileProc ( W2_maxNbTiles )
a561475a37 Jean*0160       INTEGER W2_tileIndex( W2_maxNbTiles )
f7d498dc61 Jean*0161 c     INTEGER W2_tileRank ( W2_maxNbTiles )
                0162       INTEGER W2_myTileList ( nSx,nSy )
                0163       INTEGER W2_procTileList(nSx,nSy,nPx*nPy )
                0164       COMMON /W2_MAP_TILE2PROC/
                0165      &        W2_tileProc,
a561475a37 Jean*0166      &        W2_tileIndex,
f7d498dc61 Jean*0167 c    &        W2_tileRank,
017b6b2289 Jean*0168      &        W2_myTileList, W2_procTileList
                0169 
f7d498dc61 Jean*0170 C--   COMMON /W2_EXCH2_COMMFLAG/ EXCH2 character Flag for type of communication
                0171       CHARACTER W2_myCommFlag( W2_maxNeighbours, nSx, nSy )
                0172       COMMON /W2_EXCH2_COMMFLAG/ W2_myCommFlag
                0173 
                0174 C--   COMMON /EXCH2_FILLVAL_RX/ real type filling value used by EXCH2
                0175 C     e2FillValue_RX :: filling value for null regions (facet-corner
                0176 C                    :: halo regions)
                0177       _RL e2FillValue_RL
                0178       _RS e2FillValue_RS
                0179       _R4 e2FillValue_R4
                0180       _R8 e2FillValue_R8
                0181       COMMON /EXCH2_FILLVAL_RL/ e2FillValue_RL
                0182       COMMON /EXCH2_FILLVAL_RS/ e2FillValue_RS
                0183       COMMON /EXCH2_FILLVAL_R4/ e2FillValue_R4
                0184       COMMON /EXCH2_FILLVAL_R8/ e2FillValue_R8
                0185 
017b6b2289 Jean*0186 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|