1 |
molod |
1.1 |
subroutine exch2_uv_agrid_xy_RX( component1,component2, myThid ) |
2 |
|
|
#include "CPP_EEOPTIONS.h" |
3 |
|
|
implicit none |
4 |
|
|
|
5 |
|
|
C*=====================================================================* |
6 |
|
|
C Purpose: subroutine exch2_uv_agrid_xy_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_xy_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,nSx,nSy) |
28 |
|
|
_RX component2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
29 |
|
|
INTEGER myThid |
30 |
|
|
|
31 |
|
|
C == Local variables == |
32 |
|
|
C i,j,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,bi,bj |
39 |
|
|
integer OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
40 |
|
|
_RX dummy1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
41 |
|
|
_RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,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 = 1 |
51 |
|
|
|
52 |
|
|
C First call the exchanges for the two components |
53 |
|
|
|
54 |
|
|
if (useCubedSphereExchange) then |
55 |
|
|
call exch2_xy_RX( component1, |
56 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
57 |
|
|
. exchWidthX, exchWidthY, |
58 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
59 |
|
|
call exch2_xy_RX( component2, |
60 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
61 |
|
|
. exchWidthX, exchWidthY, |
62 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
63 |
|
|
else |
64 |
|
|
c call exch_RX( component1, |
65 |
|
|
c . OLw, OLe, OLs, OLn, myNz, |
66 |
|
|
c . exchWidthX, exchWidthY, |
67 |
|
|
c . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
68 |
|
|
c call exch_RX( component2, |
69 |
|
|
c . OLw, OLe, OLs, OLn, myNz, |
70 |
|
|
c . exchWidthX, exchWidthY, |
71 |
|
|
c . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
72 |
|
|
_EXCH_XY_RL( component1, myThid ) |
73 |
|
|
_EXCH_XY_RL( component2, myThid ) |
74 |
|
|
endif |
75 |
|
|
|
76 |
|
|
C Then if we are on the sphere we may need to switch u and v components |
77 |
|
|
C and/or the signs depending on which cube face we are located. |
78 |
|
|
|
79 |
|
|
if (useCubedSphereExchange) then |
80 |
|
|
|
81 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
82 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
83 |
|
|
|
84 |
|
|
C First we need to copy the component info into dummy arrays |
85 |
|
|
do j = 1-OLy,sNy+OLy |
86 |
|
|
do i = 1-OLx,sNx+OLx |
87 |
|
|
dummy1(i,j,bi,bj) = component1(i,j,bi,bj) |
88 |
|
|
dummy2(i,j,bi,bj) = component2(i,j,bi,bj) |
89 |
|
|
enddo |
90 |
|
|
enddo |
91 |
|
|
|
92 |
|
|
C Now choose what to do at each edge of the halo based on which face |
93 |
|
|
C (we assume that bj is always=1) |
94 |
|
|
|
95 |
|
|
mytile = W2_myTilelist(bi) |
96 |
|
|
myface = exch2_myFace(mytile) |
97 |
|
|
C odd faces share disposition of all sections of the halo |
98 |
|
|
if ( mod(myface,2).eq.1 ) then |
99 |
|
|
do j = 1,sNy |
100 |
|
|
C east |
101 |
|
|
if(exch2_is_Eedge(mytile).eq.1) then |
102 |
|
|
do i = 1,exchWidthX |
103 |
|
|
component1(sNx+i,j,bi,bj) = dummy1(sNx+i,j,bi,bj) |
104 |
|
|
component2(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj) |
105 |
|
|
enddo |
106 |
|
|
endif |
107 |
|
|
C west |
108 |
|
|
if(exch2_is_Wedge(mytile).eq.1) then |
109 |
|
|
do i = 1,exchWidthX |
110 |
|
|
component1(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj) |
111 |
|
|
component2(i-OLx,j,bi,bj) = -dummy1(i-OLx,j,bi,bj) |
112 |
|
|
enddo |
113 |
|
|
endif |
114 |
|
|
C north |
115 |
|
|
if(exch2_is_Nedge(mytile).eq.1) then |
116 |
|
|
do i = 1,exchWidthX |
117 |
|
|
component1(j,sNy+i,bi,bj) = -dummy2(j,sNy+i,bi,bj) |
118 |
|
|
component2(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj) |
119 |
|
|
enddo |
120 |
|
|
endif |
121 |
|
|
C south |
122 |
|
|
if(exch2_is_Sedge(mytile).eq.1) then |
123 |
|
|
do i = 1,exchWidthX |
124 |
|
|
component1(j,i-OLx,bi,bj) = dummy1(j,i-OLx,bi,bj) |
125 |
|
|
component2(j,i-OLx,bi,bj) = dummy2(j,i-OLx,bi,bj) |
126 |
|
|
enddo |
127 |
|
|
endif |
128 |
|
|
enddo |
129 |
|
|
C now the even faces (share disposition of all sections of the halo) |
130 |
|
|
elseif ( mod(myface,2).eq.0 ) then |
131 |
|
|
do j = 1,sNy |
132 |
|
|
C east |
133 |
|
|
if(exch2_is_Eedge(mytile).eq.1) then |
134 |
|
|
do i = 1,exchWidthX |
135 |
|
|
component1(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj) |
136 |
|
|
component2(sNx+i,j,bi,bj) = -dummy1(sNx+i,j,bi,bj) |
137 |
|
|
enddo |
138 |
|
|
endif |
139 |
|
|
C west |
140 |
|
|
if(exch2_is_Wedge(mytile).eq.1) then |
141 |
|
|
do i = 1,exchWidthX |
142 |
|
|
component1(i-OLx,j,bi,bj) = dummy1(i-OLx,j,bi,bj) |
143 |
|
|
component2(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj) |
144 |
|
|
enddo |
145 |
|
|
endif |
146 |
|
|
C north |
147 |
|
|
if(exch2_is_Nedge(mytile).eq.1) then |
148 |
|
|
do i = 1,exchWidthX |
149 |
|
|
component1(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj) |
150 |
|
|
component2(j,sNy+i,bi,bj) = dummy2(j,sNy+i,bi,bj) |
151 |
|
|
enddo |
152 |
|
|
endif |
153 |
|
|
C south |
154 |
|
|
if(exch2_is_Sedge(mytile).eq.1) then |
155 |
|
|
do i = 1,exchWidthX |
156 |
|
|
component1(j,i-OLy,bi,bj) = -dummy2(j,i-OLy,bi,bj) |
157 |
|
|
component2(j,i-OLy,bi,bj) = dummy1(j,i-OLy,bi,bj) |
158 |
|
|
enddo |
159 |
|
|
endif |
160 |
|
|
enddo |
161 |
|
|
endif |
162 |
|
|
|
163 |
|
|
enddo |
164 |
|
|
enddo |
165 |
|
|
|
166 |
|
|
endif |
167 |
|
|
|
168 |
|
|
RETURN |
169 |
|
|
END |