/[MITgcm]/MITgcm/pkg/atm_compon_interf/cpl_register.F
ViewVC logotype

Contents of /MITgcm/pkg/atm_compon_interf/cpl_register.F

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


Revision 1.5 - (show annotations) (download)
Thu Nov 12 01:01:58 2015 UTC (8 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65q
Changes since 1.4: +2 -3 lines
add ATM_CPL_OPTIONS.h in component pkg and include it in all pkg source files

1 C $Header: /u/gcmpack/MITgcm/pkg/atm_compon_interf/cpl_register.F,v 1.4 2015/06/15 15:19:32 jmc Exp $
2 C $Name: $
3
4 #include "ATM_CPL_OPTIONS.h"
5
6 CBOP 0
7 C !ROUTINE: CPL_REGISTER
8
9 C !INTERFACE:
10 SUBROUTINE CPL_REGISTER
11
12 C !DESCRIPTION:
13 C *==========================================================*
14 C | SUBROUTINE CPL_REGISTER
15 C | o Routine controlling registration with MIT coupler.
16 C | - Atmospheric version -
17 C *==========================================================*
18 C | This version talks to the MIT Coupler. It uses the MIT
19 C | Coupler "checkpoint1" library calls.
20 C *==========================================================*
21
22 C !USES:
23 IMPLICIT NONE
24 C == Global variables ==
25 #include "SIZE.h"
26 #include "EEPARAMS.h"
27 #include "ATMIDS.h"
28 #ifdef ALLOW_EXCH2
29 # include "W2_EXCH2_SIZE.h"
30 # include "W2_EXCH2_TOPOLOGY.h"
31 # include "W2_EXCH2_PARAMS.h"
32 #endif /* ALLOW_EXCH2 */
33
34 C !INPUT/OUTPUT PARAMETERS:
35 C == Routine arguments ==
36 C myThid :: Thread number for this instance of the routine
37 c INTEGER myThid
38 CEOP
39
40 #ifdef COMPONENT_MODULE
41 C !LOCAL VARIABLES:
42 C == Local variables ==
43 C bi, bj :: Tile indices
44 C j :: Loop counter
45 C iG0, jG0 :: Base coordinates of a tile on the global grid.
46 C iReg :: Array for passing attributes to the coupler
47 C x,ySize :: expected size of the coupler 2-D maps
48 INTEGER iG0, jG0
49 INTEGER bi, bj
50 INTEGER j, nTiles
51 INTEGER iReg(6,nSx*nSy)
52 c INTEGER xSize, ySize
53 #ifdef ALLOW_EXCH2
54 INTEGER tN
55 LOGICAL useExch2LayOut
56 #endif /* ALLOW_EXCH2 */
57
58 C-- Set dimensions of coupler 2-D maps:
59 c xSize = Nx
60 c ySize = Ny
61
62 #ifdef ALLOW_EXCH2
63 C-- Note: current coupler mapping relies only on i0,j0,nx,ny ; this prevent to
64 C map tiles to Exch-2 global map when faces do not fit in global-IO-array
65 C (see, e.g., gather/scatter_2d routines in eesupp/src, case where
66 C iGjLoc <> 0 or jGjLoc <> 1 ).
67 useExch2LayOut = .FALSE.
68 IF ( W2_useE2ioLayOut ) THEN
69 useExch2LayOut = .TRUE.
70 DO tN=1,exch2_nTiles
71 IF ( exch2_mydNx(tN) .GT. exch2_global_Nx ) THEN
72 useExch2LayOut = .FALSE.
73 C- face x-size larger than glob-size : fold it
74 c iGjLoc = 0
75 c jGjLoc = exch2_mydNx(tN) / xSize
76 ELSEIF ( exch2_tNy(tN) .GT. exch2_global_Ny ) THEN
77 useExch2LayOut = .FALSE.
78 C- tile y-size larger than glob-size : make a long line
79 c iGjLoc = exch2_mydNx(tN)
80 c jGjLoc = 0
81 ELSE
82 C- default (face fit into global-IO-array)
83 c iGjLoc = 0
84 c jGjLoc = 1
85 ENDIF
86 ENDDO
87 ENDIF
88 c IF ( useExch2LayOut ) THEN
89 c xSize = exch2_global_Nx
90 c ySize = exch2_global_Ny
91 c ENDIF
92 C-- Note: should check that xSize,ySize match with coupler Nx_atm,Ny_atm
93 #endif /* ALLOW_EXCH2 */
94
95 C-- Register with the MIT coupler
96 j = 0
97 DO bj=1,nSy
98 DO bi=1,nSx
99 j = j+1
100 jG0 = myYGlobalLo+(bj-1)*sNy
101 iG0 = myXGlobalLo+(bi-1)*sNx
102 #ifdef ALLOW_EXCH2
103 IF ( useExch2LayOut ) THEN
104 tN = W2_myTileList(bi,bj)
105 iG0 = exch2_txGlobalo(tN)
106 jG0 = exch2_tyGlobalo(tN)
107 ENDIF
108 #endif /* ALLOW_EXCH2 */
109 iReg(1,j) = bi
110 iReg(2,j) = bj
111 iReg(3,j) = sNx
112 iReg(4,j) = sNy
113 iReg(5,j) = iG0
114 iReg(6,j) = jG0
115 ENDDO
116 ENDDO
117 nTiles = nSx*nSy
118 CALL MITCOMPONENT_TILE_REGISTER( nTiles, iReg )
119 #endif /* COMPONENT_MODULE */
120
121 RETURN
122 END

  ViewVC Help
Powered by ViewVC 1.1.22