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

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

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


Revision 1.1 - (show annotations) (download)
Thu Apr 1 17:10:57 2004 UTC (20 years, 2 months ago) by edhill
Branch: MAIN
 o minor makefile cleanup

1 subroutine exch_uv_agrid_xy_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 2D vector field on an A-grid.
8 C
9 C Input: component1(lon,lat,bi,bj) - first component of vector
10 C component2(lon,lat,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,nSx,nSy)
29 _RX component2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,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,nSx,nSy)
42 _RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
43
44 call exch2_uv_agrid_xy_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 = 1
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 j = 1-OLy,sNy+OLy
88 do i = 1-OLx,sNx+OLx
89 dummy1(i,j,bi,bj) = component1(i,j,bi,bj)
90 dummy2(i,j,bi,bj) = component2(i,j,bi,bj)
91 enddo
92 enddo
93
94 C Now choose what to do at each edge of the halo based on which face
95 C (we assume that bj is always=1)
96
97 C odd faces share disposition of all sections of the halo
98 if ( mod(bi,2).eq.1 ) then
99 do j = 1,sNy
100 do i = 1,exchWidthX
101 C east
102 component1(sNx+i,j,bi,bj) = dummy1(sNx+i,j,bi,bj)
103 component2(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj)
104 C west
105 component1(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj)
106 component2(i-OLx,j,bi,bj) = -dummy1(i-OLx,j,bi,bj)
107 C north
108 component1(j,sNy+i,bi,bj) = -dummy2(j,sNy+i,bi,bj)
109 component2(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj)
110 C south
111 component1(j,i-OLx,bi,bj) = dummy1(j,i-OLx,bi,bj)
112 component2(j,i-OLx,bi,bj) = dummy2(j,i-OLx,bi,bj)
113 enddo
114 enddo
115 C now the even faces (share disposition of all sections of the halo)
116 elseif ( mod(bi,2).eq.0 ) then
117 do j = 1,sNy
118 do i = 1,exchWidthX
119 C east
120 component1(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj)
121 component2(sNx+i,j,bi,bj) = -dummy1(sNx+i,j,bi,bj)
122 C west
123 component1(i-OLx,j,bi,bj) = dummy1(i-OLx,j,bi,bj)
124 component2(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj)
125 C north
126 component1(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj)
127 component2(j,sNy+i,bi,bj) = dummy2(j,sNy+i,bi,bj)
128 C south
129 component1(j,i-OLy,bi,bj) = -dummy2(j,i-OLy,bi,bj)
130 component2(j,i-OLy,bi,bj) = dummy1(j,i-OLy,bi,bj)
131 enddo
132 enddo
133 endif
134
135 enddo
136 enddo
137
138 endif
139
140 RETURN
141 END

  ViewVC Help
Powered by ViewVC 1.1.22