/[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.5 - (show annotations) (download)
Wed Nov 17 16:29:22 2004 UTC (19 years, 6 months ago) by molod
Branch: MAIN
Changes since 1.4: +8 -4 lines
Add withSigns to argument list

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

  ViewVC Help
Powered by ViewVC 1.1.22