1 |
subroutine exch_uv_agrid_xyz_RX( component1,component2, myThid ) |
2 |
#include "CPP_EEOPTIONS.h" |
3 |
implicit none |
4 |
|
5 |
C*=====================================================================* |
6 |
C Purpose: subroutine exch_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 (either exch_rx_cube or exch_rx) - twice, once |
16 |
C for the first-component, once for second. |
17 |
C |
18 |
C NOTES: 1) This code, as written, only works on ONE PROCESSOR! |
19 |
C 2) This code assumes that the faces are square (sNx=sNy....) |
20 |
C (also - we don't worry about barriers) |
21 |
C*=====================================================================* |
22 |
|
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "EESUPPORT.h" |
26 |
|
27 |
C == Argument list variables == |
28 |
_RX component1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
29 |
_RX component2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
30 |
INTEGER myThid |
31 |
|
32 |
C == Local variables == |
33 |
C i,j,L,bi,bj are do indices. |
34 |
C OL[wens] - Overlap extents in west, east, north, south. |
35 |
C exchWidth[XY] - Extent of regions that will be exchanged. |
36 |
C dummy[12] - copies of the vector components with haloes filled. |
37 |
C b[nsew] - indices of the [nswe] neighboring faces for each face. |
38 |
|
39 |
integer i,j,L,bi,bj |
40 |
integer OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
41 |
_RX dummy1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
42 |
_RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
43 |
|
44 |
call exch2_uv_agrid_xyz_RX( component1,component2, myThid ) |
45 |
|
46 |
RETURN |
47 |
|
48 |
OLw = OLx |
49 |
OLe = OLx |
50 |
OLn = OLy |
51 |
OLs = OLy |
52 |
exchWidthX = OLx |
53 |
exchWidthY = OLy |
54 |
myNz = Nr |
55 |
|
56 |
C First call the exchanges for the two components |
57 |
|
58 |
if (useCubedSphereExchange) then |
59 |
call exch_RX_cube( component1, |
60 |
. OLw, OLe, OLs, OLn, myNz, |
61 |
. exchWidthX, exchWidthY, |
62 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
63 |
call exch_RX_cube( component2, |
64 |
. OLw, OLe, OLs, OLn, myNz, |
65 |
. exchWidthX, exchWidthY, |
66 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
67 |
else |
68 |
call exch_RX( component1, |
69 |
. OLw, OLe, OLs, OLn, myNz, |
70 |
. exchWidthX, exchWidthY, |
71 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
72 |
call exch_RX( component2, |
73 |
. OLw, OLe, OLs, OLn, myNz, |
74 |
. exchWidthX, exchWidthY, |
75 |
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
76 |
endif |
77 |
|
78 |
C Then if we are on the sphere we may need to switch u and v components |
79 |
C and/or the signs depending on which cube face we are located. |
80 |
|
81 |
if (useCubedSphereExchange) then |
82 |
|
83 |
do bj = myByLo(myThid), myByHi(myThid) |
84 |
do bi = myBxLo(myThid), myBxHi(myThid) |
85 |
|
86 |
C First we need to copy the component info into dummy arrays |
87 |
do L = 1,Nr |
88 |
do j = 1-OLy,sNy+OLy |
89 |
do i = 1-OLx,sNx+OLx |
90 |
dummy1(i,j,L,bi,bj) = component1(i,j,L,bi,bj) |
91 |
dummy2(i,j,L,bi,bj) = component2(i,j,L,bi,bj) |
92 |
enddo |
93 |
enddo |
94 |
enddo |
95 |
|
96 |
C Now choose what to do at each edge of the halo based on which face |
97 |
C (we assume that bj is always=1) |
98 |
|
99 |
C odd faces share disposition of all sections of the halo |
100 |
if ( mod(bi,2).eq.1 ) then |
101 |
do L = 1,Nr |
102 |
do j = 1,sNy |
103 |
do i = 1,exchWidthX |
104 |
C east |
105 |
component1(sNx+i,j,L,bi,bj) = dummy1(sNx+i,j,L,bi,bj) |
106 |
component2(sNx+i,j,L,bi,bj) = dummy2(sNx+i,j,L,bi,bj) |
107 |
C west |
108 |
component1(i-OLx,j,L,bi,bj) = dummy2(i-OLx,j,L,bi,bj) |
109 |
component2(i-OLx,j,L,bi,bj) = -dummy1(i-OLx,j,L,bi,bj) |
110 |
C north |
111 |
component1(j,sNy+i,L,bi,bj) = -dummy2(j,sNy+i,L,bi,bj) |
112 |
component2(j,sNy+i,L,bi,bj) = dummy1(j,sNy+i,L,bi,bj) |
113 |
C south |
114 |
component1(j,i-OLx,L,bi,bj) = dummy1(j,i-OLx,L,bi,bj) |
115 |
component2(j,i-OLx,L,bi,bj) = dummy2(j,i-OLx,L,bi,bj) |
116 |
enddo |
117 |
enddo |
118 |
enddo |
119 |
C now the even faces (share disposition of all sections of the halo) |
120 |
elseif ( mod(bi,2).eq.0 ) then |
121 |
do L = 1,Nr |
122 |
do j = 1,sNy |
123 |
do i = 1,exchWidthX |
124 |
C east |
125 |
component1(sNx+i,j,L,bi,bj) = dummy2(sNx+i,j,L,bi,bj) |
126 |
component2(sNx+i,j,L,bi,bj) = -dummy1(sNx+i,j,L,bi,bj) |
127 |
C west |
128 |
component1(i-OLx,j,L,bi,bj) = dummy1(i-OLx,j,L,bi,bj) |
129 |
component2(i-OLx,j,L,bi,bj) = dummy2(i-OLx,j,L,bi,bj) |
130 |
C north |
131 |
component1(j,sNy+i,L,bi,bj) = dummy1(j,sNy+i,L,bi,bj) |
132 |
component2(j,sNy+i,L,bi,bj) = dummy2(j,sNy+i,L,bi,bj) |
133 |
C south |
134 |
component1(j,i-OLy,L,bi,bj) = -dummy2(j,i-OLy,L,bi,bj) |
135 |
component2(j,i-OLy,L,bi,bj) = dummy1(j,i-OLy,L,bi,bj) |
136 |
enddo |
137 |
enddo |
138 |
enddo |
139 |
endif |
140 |
|
141 |
enddo |
142 |
enddo |
143 |
|
144 |
endif |
145 |
|
146 |
RETURN |
147 |
END |