/[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.4 - (show annotations) (download)
Tue Nov 16 17:23:25 2004 UTC (19 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
use eesupp/src version instead.

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

  ViewVC Help
Powered by ViewVC 1.1.22