1 |
C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch2_3d_rx.template,v 1.5 2009/06/28 00:57:51 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_EEOPTIONS.h" |
5 |
#include "W2_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: EXCH2_3D_RX |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE EXCH2_3D_RX( |
12 |
U phi, |
13 |
I myNz, myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C *==========================================================* |
17 |
C | SUBROUTINE EXCH2_3D_RX |
18 |
C | o Handle exchanges for _RX, three-dim scalar arrays. |
19 |
C *==========================================================* |
20 |
|
21 |
C !USES: |
22 |
IMPLICIT NONE |
23 |
C === Global data === |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "W2_EXCH2_SIZE.h" |
27 |
#include "W2_EXCH2_TOPOLOGY.h" |
28 |
#ifdef W2_FILL_NULL_REGIONS |
29 |
#include "W2_EXCH2_PARAMS.h" |
30 |
#endif |
31 |
|
32 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
C === Routine arguments === |
34 |
C phi :: Array with overlap regions are to be exchanged |
35 |
C myNz :: 3rd dimension of array to exchange |
36 |
C myThid :: My thread id. |
37 |
INTEGER myNz |
38 |
_RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy) |
39 |
INTEGER myThid |
40 |
|
41 |
C !LOCAL VARIABLES: |
42 |
C == Local variables == |
43 |
C OL[wens] :: Overlap extents in west, east, north, south. |
44 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
45 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
46 |
#ifdef W2_FILL_NULL_REGIONS |
47 |
INTEGER bi, bj, myTile, i, j, k |
48 |
#endif |
49 |
|
50 |
CEOP |
51 |
|
52 |
OLw = OLx |
53 |
OLe = OLx |
54 |
OLn = OLy |
55 |
OLs = OLy |
56 |
exchWidthX = OLx |
57 |
exchWidthY = OLy |
58 |
|
59 |
CALL EXCH2_RX1_CUBE( phi, .FALSE., 'T ', |
60 |
I OLw, OLe, OLs, OLn, myNz, |
61 |
I exchWidthX, exchWidthY, |
62 |
I EXCH_UPDATE_CORNERS, myThid ) |
63 |
|
64 |
CALL EXCH2_RX1_CUBE( phi, .FALSE., 'T ', |
65 |
I OLw, OLe, OLs, OLn, myNz, |
66 |
I exchWidthX, exchWidthY, |
67 |
I EXCH_UPDATE_CORNERS, myThid ) |
68 |
|
69 |
#ifdef W2_FILL_NULL_REGIONS |
70 |
IF (useCubedSphereExchange) THEN |
71 |
DO bj=myByLo(myThid),myByHi(myThid) |
72 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
73 |
myTile = W2_myTileList(bi,bj) |
74 |
C South-east corner |
75 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
76 |
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
77 |
DO j=1-OLy,0 |
78 |
DO i=sNx+1,sNx+OLx |
79 |
DO k=1,myNz |
80 |
phi(i,j,k,bi,bj)=e2FillValue_RX |
81 |
ENDDO |
82 |
ENDDO |
83 |
ENDDO |
84 |
ENDIF |
85 |
C North-east corner |
86 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
87 |
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
88 |
DO j=sNy+1,sNy+OLy |
89 |
DO i=sNx+1,sNx+OLx |
90 |
DO k=1,myNz |
91 |
phi(i,j,k,bi,bj)=e2FillValue_RX |
92 |
ENDDO |
93 |
ENDDO |
94 |
ENDDO |
95 |
ENDIF |
96 |
C South-west corner |
97 |
IF ( exch2_isWedge(myTile) .EQ. 1 .AND. |
98 |
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
99 |
DO j=1-OLy,0 |
100 |
DO i=1-OLx,0 |
101 |
DO k=1,myNz |
102 |
phi(i,j,k,bi,bj)=e2FillValue_RX |
103 |
ENDDO |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDIF |
107 |
C North-west corner |
108 |
IF ( exch2_isWedge(myTile) .EQ. 1 .AND. |
109 |
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
110 |
DO j=sNy+1,sNy+OLy |
111 |
DO i=1-OLx,0 |
112 |
DO k=1,myNz |
113 |
phi(i,j,k,bi,bj)=e2FillValue_RX |
114 |
ENDDO |
115 |
ENDDO |
116 |
ENDDO |
117 |
ENDIF |
118 |
ENDDO |
119 |
ENDDO |
120 |
ENDIF |
121 |
#endif /* W2_FILL_NULL_REGIONS */ |
122 |
|
123 |
RETURN |
124 |
END |
125 |
|
126 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
127 |
|
128 |
CEH3 ;;; Local Variables: *** |
129 |
CEH3 ;;; mode:fortran *** |
130 |
CEH3 ;;; End: *** |