/[MITgcm]/MITgcm/pkg/exch2/exch2_uv_agrid_xyz_rx.template
ViewVC logotype

Contents of /MITgcm/pkg/exch2/exch2_uv_agrid_xyz_rx.template

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


Revision 1.2 - (show annotations) (download)
Thu Apr 1 18:30:32 2004 UTC (20 years, 2 months ago) by molod
Branch: MAIN
Changes since 1.1: +10 -16 lines
Fix argument list

1 subroutine exch2_uv_agrid_xyz_RX( component1,component2, myThid )
2 #include "CPP_EEOPTIONS.h"
3 implicit none
4
5 C*=====================================================================*
6 C Purpose: subroutine exch2_uv_agrid_xyz_rx will
7 C handle exchanges for a 3D vector field on an A-grid.
8 C
9 C Input: component1(lon,lat,levs,bi,bj) - first component of vector
10 C component2(lon,lat,levs,bi,bj) - second component of vector
11 C myThid - tile number
12 C
13 C Output: component1 and component2 are updated (halo regions filled)
14 C
15 C Calls: exch (exch2_xyz_rx ) - twice, once
16 C for the first-component, once for second.
17 C
18 C*=====================================================================*
19
20 #include "SIZE.h"
21 #include "EEPARAMS.h"
22 #include "EESUPPORT.h"
23 #include "W2_EXCH2_TOPOLOGY.h"
24 #include "W2_EXCH2_PARAMS.h"
25
26 C == Argument list variables ==
27 _RX component1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy)
28 _RX component2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy)
29 INTEGER myThid
30
31 C == Local variables ==
32 C i,j,L,bi,bj are do indices.
33 C OL[wens] - Overlap extents in west, east, north, south.
34 C exchWidth[XY] - Extent of regions that will be exchanged.
35 C dummy[12] - copies of the vector components with haloes filled.
36 C b[nsew] - indices of the [nswe] neighboring faces for each face.
37
38 integer i,j,L,bi,bj
39 integer OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz
40 _RX dummy1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy)
41 _RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy)
42 integer mytile, myface
43
44 OLw = OLx
45 OLe = OLx
46 OLn = OLy
47 OLs = OLy
48 exchWidthX = OLx
49 exchWidthY = OLy
50 myNz = Nr
51
52 C First call the exchanges for the two components
53
54 if (useCubedSphereExchange) then
55 call exch2_xyz_RX( component1, myThid )
56 call exch2_xyz_RX( component2, myThid )
57 else
58 c call exch_RX( component1,
59 c . OLw, OLe, OLs, OLn, myNz,
60 c . exchWidthX, exchWidthY,
61 c . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
62 c call exch_RX( component2,
63 c . OLw, OLe, OLs, OLn, myNz,
64 c . exchWidthX, exchWidthY,
65 c . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
66 _EXCH_XYZ_RL( component1, myThid )
67 _EXCH_XYZ_RL( component2, myThid )
68 endif
69
70 C Then if we are on the sphere we may need to switch u and v components
71 C and/or the signs depending on which cube face we are located.
72
73 if (useCubedSphereExchange) then
74
75 do bj = myByLo(myThid), myByHi(myThid)
76 do bi = myBxLo(myThid), myBxHi(myThid)
77
78 C First we need to copy the component info into dummy arrays
79 do L = 1,Nr
80 do j = 1-OLy,sNy+OLy
81 do i = 1-OLx,sNx+OLx
82 dummy1(i,j,L,bi,bj) = component1(i,j,L,bi,bj)
83 dummy2(i,j,L,bi,bj) = component2(i,j,L,bi,bj)
84 enddo
85 enddo
86 enddo
87
88 C Now choose what to do at each edge of the halo based on which face
89 C (we assume that bj is always=1)
90
91 mytile = W2_myTilelist(bi)
92 myface = exch2_myFace(mytile)
93 C odd faces share disposition of all sections of the halo
94 if ( mod(myface,2).eq.1 ) then
95 do L = 1,Nr
96 do j = 1,sNy
97 C east
98 if(exch2_isEedge(mytile).eq.1) then
99 do i = 1,exchWidthX
100 component1(sNx+i,j,L,bi,bj) = dummy1(sNx+i,j,L,bi,bj)
101 component2(sNx+i,j,L,bi,bj) = dummy2(sNx+i,j,L,bi,bj)
102 enddo
103 endif
104 C west
105 if(exch2_isWedge(mytile).eq.1) then
106 do i = 1,exchWidthX
107 component1(i-OLx,j,L,bi,bj) = dummy2(i-OLx,j,L,bi,bj)
108 component2(i-OLx,j,L,bi,bj) = -dummy1(i-OLx,j,L,bi,bj)
109 enddo
110 endif
111 C north
112 if(exch2_isNedge(mytile).eq.1) then
113 do i = 1,exchWidthX
114 component1(j,sNy+i,L,bi,bj) = -dummy2(j,sNy+i,L,bi,bj)
115 component2(j,sNy+i,L,bi,bj) = dummy1(j,sNy+i,L,bi,bj)
116 enddo
117 endif
118 C south
119 if(exch2_isSedge(mytile).eq.1) then
120 do i = 1,exchWidthX
121 component1(j,i-OLx,L,bi,bj) = dummy1(j,i-OLx,L,bi,bj)
122 component2(j,i-OLx,L,bi,bj) = dummy2(j,i-OLx,L,bi,bj)
123 enddo
124 endif
125 enddo
126 enddo
127 C now the even faces (share disposition of all sections of the halo)
128 elseif ( mod(myface,2).eq.0 ) then
129 do L = 1,Nr
130 do j = 1,sNy
131 C east
132 if(exch2_isEedge(mytile).eq.1) then
133 do i = 1,exchWidthX
134 component1(sNx+i,j,L,bi,bj) = dummy2(sNx+i,j,L,bi,bj)
135 component2(sNx+i,j,L,bi,bj) = -dummy1(sNx+i,j,L,bi,bj)
136 enddo
137 endif
138 C west
139 if(exch2_isWedge(mytile).eq.1) then
140 do i = 1,exchWidthX
141 component1(i-OLx,j,L,bi,bj) = dummy1(i-OLx,j,L,bi,bj)
142 component2(i-OLx,j,L,bi,bj) = dummy2(i-OLx,j,L,bi,bj)
143 enddo
144 endif
145 C north
146 if(exch2_isNedge(mytile).eq.1) then
147 do i = 1,exchWidthX
148 component1(j,sNy+i,L,bi,bj) = dummy1(j,sNy+i,L,bi,bj)
149 component2(j,sNy+i,L,bi,bj) = dummy2(j,sNy+i,L,bi,bj)
150 enddo
151 endif
152 C south
153 if(exch2_isSedge(mytile).eq.1) then
154 do i = 1,exchWidthX
155 component1(j,i-OLy,L,bi,bj) = -dummy2(j,i-OLy,L,bi,bj)
156 component2(j,i-OLy,L,bi,bj) = dummy1(j,i-OLy,L,bi,bj)
157 enddo
158 endif
159 enddo
160 enddo
161 endif
162
163 enddo
164 enddo
165
166 endif
167
168 RETURN
169 END

  ViewVC Help
Powered by ViewVC 1.1.22