| 1 |
molod |
1.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 |
edhill |
1.2 |
#include "EXCH.h" |
| 27 |
molod |
1.1 |
|
| 28 |
|
|
C == Argument list variables == |
| 29 |
|
|
_RX component1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 30 |
|
|
_RX component2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 31 |
|
|
INTEGER myThid |
| 32 |
|
|
|
| 33 |
|
|
C == Local variables == |
| 34 |
|
|
C i,j,L,bi,bj are do indices. |
| 35 |
|
|
C OL[wens] - Overlap extents in west, east, north, south. |
| 36 |
|
|
C exchWidth[XY] - Extent of regions that will be exchanged. |
| 37 |
|
|
C dummy[12] - copies of the vector components with haloes filled. |
| 38 |
|
|
C b[nsew] - indices of the [nswe] neighboring faces for each face. |
| 39 |
|
|
|
| 40 |
|
|
integer i,j,L,bi,bj |
| 41 |
|
|
integer OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
| 42 |
|
|
_RX dummy1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 43 |
|
|
_RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 44 |
|
|
|
| 45 |
|
|
OLw = OLx |
| 46 |
|
|
OLe = OLx |
| 47 |
|
|
OLn = OLy |
| 48 |
|
|
OLs = OLy |
| 49 |
|
|
exchWidthX = OLx |
| 50 |
|
|
exchWidthY = OLy |
| 51 |
|
|
myNz = 1 |
| 52 |
|
|
|
| 53 |
|
|
C First call the exchanges for the two components |
| 54 |
|
|
|
| 55 |
|
|
if (useCubedSphereExchange) then |
| 56 |
|
|
call exch_RX_cube( component1, |
| 57 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
| 58 |
|
|
. exchWidthX, exchWidthY, |
| 59 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 60 |
|
|
call exch_RX_cube( component2, |
| 61 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
| 62 |
|
|
. exchWidthX, exchWidthY, |
| 63 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 64 |
|
|
else |
| 65 |
|
|
call exch_RX( component1, |
| 66 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
| 67 |
|
|
. exchWidthX, exchWidthY, |
| 68 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 69 |
|
|
call exch_RX( component2, |
| 70 |
|
|
. OLw, OLe, OLs, OLn, myNz, |
| 71 |
|
|
. exchWidthX, exchWidthY, |
| 72 |
|
|
. FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 73 |
|
|
endif |
| 74 |
|
|
|
| 75 |
|
|
C Then if we are on the sphere we may need to switch u and v components |
| 76 |
|
|
C and/or the signs depending on which cube face we are located. |
| 77 |
|
|
|
| 78 |
|
|
if (useCubedSphereExchange) then |
| 79 |
|
|
|
| 80 |
|
|
do bj = myByLo(myThid), myByHi(myThid) |
| 81 |
|
|
do bi = myBxLo(myThid), myBxHi(myThid) |
| 82 |
|
|
|
| 83 |
|
|
C First we need to copy the component info into dummy arrays |
| 84 |
|
|
do j = 1-OLy,sNy+OLy |
| 85 |
|
|
do i = 1-OLx,sNx+OLx |
| 86 |
|
|
dummy1(i,j,bi,bj) = component1(i,j,bi,bj) |
| 87 |
|
|
dummy2(i,j,bi,bj) = component2(i,j,bi,bj) |
| 88 |
|
|
enddo |
| 89 |
|
|
enddo |
| 90 |
|
|
|
| 91 |
|
|
C Now choose what to do at each edge of the halo based on which face |
| 92 |
|
|
C (we assume that bj is always=1) |
| 93 |
|
|
|
| 94 |
|
|
C odd faces share disposition of all sections of the halo |
| 95 |
|
|
if ( mod(bi,2).eq.1 ) then |
| 96 |
|
|
do j = 1,sNy |
| 97 |
|
|
do i = 1,exchWidthX |
| 98 |
|
|
C east |
| 99 |
|
|
component1(sNx+i,j,bi,bj) = dummy1(sNx+i,j,bi,bj) |
| 100 |
|
|
component2(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj) |
| 101 |
|
|
C west |
| 102 |
|
|
component1(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj) |
| 103 |
|
|
component2(i-OLx,j,bi,bj) = -dummy1(i-OLx,j,bi,bj) |
| 104 |
|
|
C north |
| 105 |
|
|
component1(j,sNy+i,bi,bj) = -dummy2(j,sNy+i,bi,bj) |
| 106 |
|
|
component2(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj) |
| 107 |
|
|
C south |
| 108 |
|
|
component1(j,i-OLx,bi,bj) = dummy1(j,i-OLx,bi,bj) |
| 109 |
|
|
component2(j,i-OLx,bi,bj) = dummy2(j,i-OLx,bi,bj) |
| 110 |
|
|
enddo |
| 111 |
|
|
enddo |
| 112 |
|
|
C now the even faces (share disposition of all sections of the halo) |
| 113 |
|
|
elseif ( mod(bi,2).eq.0 ) then |
| 114 |
|
|
do j = 1,sNy |
| 115 |
|
|
do i = 1,exchWidthX |
| 116 |
|
|
C east |
| 117 |
|
|
component1(sNx+i,j,bi,bj) = dummy2(sNx+i,j,bi,bj) |
| 118 |
|
|
component2(sNx+i,j,bi,bj) = -dummy1(sNx+i,j,bi,bj) |
| 119 |
|
|
C west |
| 120 |
|
|
component1(i-OLx,j,bi,bj) = dummy1(i-OLx,j,bi,bj) |
| 121 |
|
|
component2(i-OLx,j,bi,bj) = dummy2(i-OLx,j,bi,bj) |
| 122 |
|
|
C north |
| 123 |
|
|
component1(j,sNy+i,bi,bj) = dummy1(j,sNy+i,bi,bj) |
| 124 |
|
|
component2(j,sNy+i,bi,bj) = dummy2(j,sNy+i,bi,bj) |
| 125 |
|
|
C south |
| 126 |
|
|
component1(j,i-OLy,bi,bj) = -dummy2(j,i-OLy,bi,bj) |
| 127 |
|
|
component2(j,i-OLy,bi,bj) = dummy1(j,i-OLy,bi,bj) |
| 128 |
|
|
enddo |
| 129 |
|
|
enddo |
| 130 |
|
|
endif |
| 131 |
|
|
|
| 132 |
|
|
enddo |
| 133 |
|
|
enddo |
| 134 |
|
|
|
| 135 |
|
|
endif |
| 136 |
|
|
|
| 137 |
|
|
RETURN |
| 138 |
|
|
END |