/[MITgcm]/MITgcm/eesupp/src/exch_uv_agrid_xy.rx.template
ViewVC logotype

Contents of /MITgcm/eesupp/src/exch_uv_agrid_xy.rx.template

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


Revision 1.4 - (show annotations) (download)
Thu Apr 1 18:39:16 2004 UTC (20 years, 1 month ago) by molod
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
FILE REMOVED
Change Makefile to reflect new file names

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 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 exch_RX_cube( component1,
56 . OLw, OLe, OLs, OLn, myNz,
57 . exchWidthX, exchWidthY,
58 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
59 call exch_RX_cube( component2,
60 . OLw, OLe, OLs, OLn, myNz,
61 . exchWidthX, exchWidthY,
62 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
63 else
64 call exch_RX( component1,
65 . OLw, OLe, OLs, OLn, myNz,
66 . exchWidthX, exchWidthY,
67 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
68 call exch_RX( component2,
69 . OLw, OLe, OLs, OLn, myNz,
70 . exchWidthX, exchWidthY,
71 . FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
72 endif
73
74 C Then if we are on the sphere we may need to switch u and v components
75 C and/or the signs depending on which cube face we are located.
76
77 if (useCubedSphereExchange) then
78
79 do bj = myByLo(myThid), myByHi(myThid)
80 do bi = myBxLo(myThid), myBxHi(myThid)
81
82 C First we need to copy the component info into dummy arrays
83 do j = 1-OLy,sNy+OLy
84 do i = 1-OLx,sNx+OLx
85 dummy1(i,j,bi,bj) = component1(i,j,bi,bj)
86 dummy2(i,j,bi,bj) = component2(i,j,bi,bj)
87 enddo
88 enddo
89
90 C Now choose what to do at each edge of the halo based on which face
91 C (we assume that bj is always=1)
92
93 C odd faces share disposition of all sections of the halo
94 if ( mod(bi,2).eq.1 ) then
95 do j = 1,sNy
96 do i = 1,exchWidthX
97 C east
98 component1(sNx+i,j,bi,bj) = dummy1(sNx+i,j,bi,bj)
99 component2(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj)
100 C west
101 component1(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj)
102 component2(i-OLx,j,bi,bj) = -dummy1(i-OLx,j,bi,bj)
103 C north
104 component1(j,sNy+i,bi,bj) = -dummy2(j,sNy+i,bi,bj)
105 component2(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj)
106 C south
107 component1(j,i-OLx,bi,bj) = dummy1(j,i-OLx,bi,bj)
108 component2(j,i-OLx,bi,bj) = dummy2(j,i-OLx,bi,bj)
109 enddo
110 enddo
111 C now the even faces (share disposition of all sections of the halo)
112 elseif ( mod(bi,2).eq.0 ) then
113 do j = 1,sNy
114 do i = 1,exchWidthX
115 C east
116 component1(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj)
117 component2(sNx+i,j,bi,bj) = -dummy1(sNx+i,j,bi,bj)
118 C west
119 component1(i-OLx,j,bi,bj) = dummy1(i-OLx,j,bi,bj)
120 component2(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj)
121 C north
122 component1(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj)
123 component2(j,sNy+i,bi,bj) = dummy2(j,sNy+i,bi,bj)
124 C south
125 component1(j,i-OLy,bi,bj) = -dummy2(j,i-OLy,bi,bj)
126 component2(j,i-OLy,bi,bj) = dummy1(j,i-OLy,bi,bj)
127 enddo
128 enddo
129 endif
130
131 enddo
132 enddo
133
134 endif
135
136 RETURN
137 END

  ViewVC Help
Powered by ViewVC 1.1.22