1 |
C $Header: /u/u0/gcmpack/MITgcm_contrib/high_res_cube/code-mods/exch2_uv_xyz_rl.F,v 1.2 2003/11/22 01:16:18 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_EEOPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
|
8 |
C !ROUTINE: EXCH2_UV_XYZ_RX |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE EXCH2_UV_XYZ_RX( |
12 |
U Uphi, Vphi, withSigns, |
13 |
I myThid ) |
14 |
IMPLICIT NONE |
15 |
C !DESCRIPTION: |
16 |
C *==========================================================* |
17 |
C | SUBROUTINE EXCH_UV_XYZ_RX |
18 |
C | o Handle exchanges for _RX, 3-dimensional vector arrays. |
19 |
C *==========================================================* |
20 |
C | Vector arrays need to be rotated and interchaged for |
21 |
C | exchange operations on some grids. This driver routine |
22 |
C | branches to support this. |
23 |
C *==========================================================* |
24 |
|
25 |
C !USES: |
26 |
C === Global data === |
27 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "EESUPPORT.h" |
30 |
#include "W2_EXCH2_TOPOLOGY.h" |
31 |
#include "W2_EXCH2_PARAMS.h" |
32 |
|
33 |
C !INPUT/OUTPUT PARAMETERS: |
34 |
C === Routine arguments === |
35 |
C phi :: Array with overlap regions are to be exchanged |
36 |
C Note - The interface to EXCH_RX assumes that |
37 |
C the standard Fortran 77 sequence association rules |
38 |
C apply. |
39 |
C myThid :: My thread id. |
40 |
_RX Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
41 |
_RX Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
42 |
LOGICAL withSigns |
43 |
INTEGER myThid |
44 |
|
45 |
C !LOCAL VARIABLES: |
46 |
C == Local variables == |
47 |
C OL[wens] :: Overlap extents in west, east, north, south. |
48 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
49 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
50 |
INTEGER bi, bj, myTile, k |
51 |
|
52 |
CEOP |
53 |
|
54 |
OLw = OLx |
55 |
OLe = OLx |
56 |
OLn = OLy |
57 |
OLs = OLy |
58 |
exchWidthX = OLx |
59 |
exchWidthY = OLy |
60 |
myNz = Nr |
61 |
C ** NOTE ** The exchange routine we use here does not |
62 |
C require the preceeding and following barriers. |
63 |
C However, the slow, simple exchange interface |
64 |
C that is calling it here is meant to ensure |
65 |
C that threads are synchronised before exchanges |
66 |
C begine. |
67 |
IF (useCubedSphereExchange) THEN |
68 |
CALL EXCH2_RX2_CUBE( Uphi, Vphi, withSigns, 'UV', |
69 |
I OLw, OLe, OLs, OLn, myNz, |
70 |
I exchWidthX, exchWidthY, |
71 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
72 |
CALL EXCH2_RX2_CUBE( Uphi, Vphi, withSigns, 'UV', |
73 |
I OLw, OLe, OLs, OLn, myNz, |
74 |
I exchWidthX, exchWidthY, |
75 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
76 |
CALL EXCH2_RX2_CUBE( Uphi, Vphi, withSigns, 'UV', |
77 |
I OLw, OLe, OLs, OLn, myNz, |
78 |
I exchWidthX, exchWidthY, |
79 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
80 |
CALL EXCH2_RX2_CUBE( Uphi, Vphi, withSigns, 'UV', |
81 |
I OLw, OLe, OLs, OLn, myNz, |
82 |
I exchWidthX, exchWidthY, |
83 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
84 |
DO bj=myByLo(myThid),myByHi(myThid) |
85 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
86 |
myTile = W2_myTileList(bi) |
87 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
88 |
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
89 |
DO k=1,Nr |
90 |
Uphi(snx+1, 0,k,bi,bj)= vPhi(snx+1, 1,k,bi,bj) |
91 |
ENDDO |
92 |
ENDIF |
93 |
IF ( withSigns ) THEN |
94 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
95 |
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
96 |
DO k=1,Nr |
97 |
Uphi(snx+1,sny+1,k,bi,bj)=-vPhi(snx+1,sny+1,k,bi,bj) |
98 |
ENDDO |
99 |
ENDIF |
100 |
ELSE |
101 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
102 |
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
103 |
DO k=1,Nr |
104 |
Uphi(snx+1,sny+1,k,bi,bj)= vPhi(snx+1,sny+1,k,bi,bj) |
105 |
ENDDO |
106 |
ENDIF |
107 |
ENDIF |
108 |
ENDDO |
109 |
ENDDO |
110 |
|
111 |
ELSE |
112 |
c CALL EXCH_RX( Uphi, |
113 |
c I OLw, OLe, OLs, OLn, myNz, |
114 |
c I exchWidthX, exchWidthY, |
115 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
116 |
c CALL EXCH_RX( Vphi, |
117 |
c I OLw, OLe, OLs, OLn, myNz, |
118 |
c I exchWidthX, exchWidthY, |
119 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
120 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
121 |
_EXCH_XYZ_RX( Uphi, myThid ) |
122 |
_EXCH_XYZ_RX( Vphi, myThid ) |
123 |
ENDIF |
124 |
|
125 |
RETURN |
126 |
END |