1 |
jmc |
1.4 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/fill_cs_corner_uv_rs.F,v 1.3 2009/05/12 19:53:03 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PACKAGES_CONFIG.h" |
5 |
|
|
#include "CPP_EEOPTIONS.h" |
6 |
|
|
|
7 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
|
|
CBOP |
9 |
|
|
C !ROUTINE: FILL_CS_CORNER_UV_RS |
10 |
|
|
|
11 |
|
|
C !INTERFACE: |
12 |
|
|
SUBROUTINE FILL_CS_CORNER_UV_RS( |
13 |
|
|
I withSigns, |
14 |
|
|
U uFld, vFld, |
15 |
|
|
I bi,bj, myThid) |
16 |
|
|
IMPLICIT NONE |
17 |
|
|
|
18 |
|
|
C !DESCRIPTION: |
19 |
|
|
C *==========================================================* |
20 |
|
|
C | SUBROUTINE FILL_CS_CORNER_UV_RS |
21 |
jmc |
1.4 |
C | o Fill the corner-halo region of CS-grid, |
22 |
jmc |
1.1 |
C | for a 2 components, C-grid vector field |
23 |
|
|
C *==========================================================* |
24 |
|
|
C | o the corner halo region is filled with valid values |
25 |
|
|
C | in order to extend in X and Y direction calculations |
26 |
|
|
C | of fluxes, on a wide stencil. |
27 |
|
|
C *==========================================================* |
28 |
|
|
|
29 |
|
|
C !USES: |
30 |
|
|
C == Global variables == |
31 |
|
|
|
32 |
|
|
#include "SIZE.h" |
33 |
|
|
#include "EEPARAMS.h" |
34 |
|
|
#ifdef ALLOW_EXCH2 |
35 |
jmc |
1.3 |
#include "W2_EXCH2_SIZE.h" |
36 |
jmc |
1.1 |
#include "W2_EXCH2_TOPOLOGY.h" |
37 |
|
|
#endif /* ALLOW_EXCH2 */ |
38 |
|
|
|
39 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
40 |
|
|
C == Routine arguments == |
41 |
jmc |
1.4 |
C |
42 |
jmc |
1.1 |
C withSigns :: uFld,vFld are vector components |
43 |
|
|
C uFld :: u-component, at C-grid West point location |
44 |
|
|
C vFld :: v-component, at C-grid SOuth point location |
45 |
|
|
C bi,bj :: tile indices |
46 |
|
|
C myThid :: thread number |
47 |
|
|
LOGICAL withSigns |
48 |
|
|
_RS uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
|
|
_RS vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
|
|
INTEGER bi,bj |
51 |
|
|
INTEGER myThid |
52 |
|
|
|
53 |
|
|
C !LOCAL VARIABLES: |
54 |
|
|
C == Local variables == |
55 |
|
|
C i,j :: loop indices |
56 |
|
|
C myTile :: tile number |
57 |
|
|
INTEGER i,j |
58 |
|
|
LOGICAL southWestCorner |
59 |
|
|
LOGICAL southEastCorner |
60 |
|
|
LOGICAL northWestCorner |
61 |
|
|
LOGICAL northEastCorner |
62 |
|
|
_RL negOne |
63 |
jmc |
1.2 |
#ifdef ALLOW_EXCH2 |
64 |
|
|
INTEGER myTile |
65 |
|
|
#endif |
66 |
jmc |
1.1 |
CEOP |
67 |
|
|
|
68 |
|
|
IF (useCubedSphereExchange) THEN |
69 |
|
|
|
70 |
|
|
negOne = 1. _d 0 |
71 |
|
|
IF (withSigns) negOne = -1. _d 0 |
72 |
|
|
|
73 |
|
|
#ifdef ALLOW_EXCH2 |
74 |
jmc |
1.4 |
myTile = W2_myTileList(bi,bj) |
75 |
jmc |
1.1 |
southWestCorner = exch2_isWedge(myTile).EQ.1 |
76 |
|
|
& .AND. exch2_isSedge(myTile).EQ.1 |
77 |
|
|
southEastCorner = exch2_isEedge(myTile).EQ.1 |
78 |
|
|
& .AND. exch2_isSedge(myTile).EQ.1 |
79 |
|
|
northEastCorner = exch2_isEedge(myTile).EQ.1 |
80 |
|
|
& .AND. exch2_isNedge(myTile).EQ.1 |
81 |
|
|
northWestCorner = exch2_isWedge(myTile).EQ.1 |
82 |
|
|
& .AND. exch2_isNedge(myTile).EQ.1 |
83 |
|
|
#else |
84 |
|
|
southWestCorner = .TRUE. |
85 |
|
|
southEastCorner = .TRUE. |
86 |
|
|
northWestCorner = .TRUE. |
87 |
|
|
northEastCorner = .TRUE. |
88 |
|
|
#endif |
89 |
|
|
|
90 |
|
|
C-- To extend calculations in X direction, fill uFld array |
91 |
|
|
C with valid value in the corner. |
92 |
|
|
C e.g., NW corner: copy V( 0,sNy ) into U( -1,sNy+1) |
93 |
|
|
C copy V( 0,sNy-1) into U( -2,sNy+1) |
94 |
|
|
C copy V( -1,sNy ) into U( -1,sNy+2) |
95 |
|
|
C copy V( -1,sNy-1) into U( -2,sNy+2) |
96 |
|
|
C | | |
97 |
|
|
C U(-1,sNy+1) U(1,sNy+1) U(2,sNy+1) |
98 |
|
|
C | ^ | | |
99 |
|
|
C -----|--\--------corner----------| |
100 |
|
|
C | \ | | |
101 |
jmc |
1.4 |
C | \ | |
102 |
|
|
C | \ | |
103 |
jmc |
1.1 |
C -----|---V(0,sNy)--|--------------- |
104 |
|
|
C | | |
105 |
|
|
C |
106 |
|
|
C-- to extend calculations in Y direction, fill vFld array |
107 |
|
|
C with valid value in the corner. |
108 |
|
|
C e.g., NW corner: copy U( 2,sNy+1) into V( 0,sNy+2) |
109 |
|
|
C copy U( 3,sNy+1) into V( 0,sNy+3) |
110 |
|
|
C copy U( 2,sNy+2) into V( -1,sNy+2) |
111 |
|
|
C copy U( 3,sNy+2) into V( -1,sNy+3) |
112 |
|
|
C | | | |
113 |
|
|
C -----|--V(0,sNy+2)--|--------------| |
114 |
|
|
C | ^====================\ |
115 |
|
|
C U(-1,sNy+1) U(1,sNy+1) U(2,sNy+1) |
116 |
|
|
C | | | |
117 |
|
|
C -----|--V(0,sNy+1)--o--------------| |
118 |
|
|
C | |\ | |
119 |
|
|
C | | \=corner |
120 |
jmc |
1.4 |
C | | |
121 |
jmc |
1.1 |
C -----|--V(0,sNy)----|-- |
122 |
|
|
C | | |
123 |
|
|
C |
124 |
|
|
|
125 |
|
|
IF ( southWestCorner ) THEN |
126 |
|
|
C- prepare for direction X: |
127 |
|
|
DO j=1,OLy |
128 |
|
|
DO i=1,OLx |
129 |
|
|
uFld( 1-i , 1-j ) = negOne*vFld( 1-j , 1+i ) |
130 |
|
|
ENDDO |
131 |
|
|
ENDDO |
132 |
|
|
C- prepare for direction Y: |
133 |
|
|
DO j=1,OLy |
134 |
|
|
DO i=1,OLx |
135 |
|
|
vFld( 1-i , 1-j ) = negOne*uFld( 1+j , 1-i ) |
136 |
|
|
ENDDO |
137 |
|
|
ENDDO |
138 |
|
|
ENDIF |
139 |
|
|
|
140 |
|
|
IF ( southEastCorner ) THEN |
141 |
|
|
C- prepare for direction X: |
142 |
|
|
DO j=1,OLy |
143 |
|
|
DO i=2,OLx |
144 |
|
|
uFld(sNx+i, 1-j ) = vFld(sNx+j, i ) |
145 |
|
|
ENDDO |
146 |
|
|
ENDDO |
147 |
|
|
C- prepare for direction Y: |
148 |
|
|
DO j=1,OLy |
149 |
|
|
DO i=1,OLx |
150 |
|
|
vFld(sNx+i, 1-j ) = uFld(sNx+1-j, 1-i ) |
151 |
|
|
ENDDO |
152 |
|
|
ENDDO |
153 |
|
|
ENDIF |
154 |
|
|
|
155 |
|
|
IF ( northWestCorner ) THEN |
156 |
|
|
C- prepare for direction X: |
157 |
|
|
DO j=1,OLy |
158 |
|
|
DO i=1,OLx |
159 |
|
|
uFld( 1-i ,sNy+j) = vFld( 1-j , sNy+1-i ) |
160 |
|
|
ENDDO |
161 |
|
|
ENDDO |
162 |
|
|
C- prepare for direction Y: |
163 |
|
|
DO j=2,OLy |
164 |
|
|
DO i=1,OLx |
165 |
|
|
vFld( 1-i ,sNy+j) = uFld( j , sNy+i ) |
166 |
|
|
ENDDO |
167 |
|
|
ENDDO |
168 |
|
|
ENDIF |
169 |
|
|
|
170 |
|
|
IF ( northEastCorner ) THEN |
171 |
|
|
C- prepare for direction X: |
172 |
|
|
DO j=1,OLy |
173 |
|
|
DO i=2,OLx |
174 |
|
|
uFld(sNx+i,sNy+j) = negOne*vFld(sNx+j, sNy+2-i ) |
175 |
|
|
ENDDO |
176 |
|
|
ENDDO |
177 |
|
|
C- prepare for direction Y: |
178 |
|
|
DO j=2,OLy |
179 |
|
|
DO i=1,OLx |
180 |
|
|
vFld(sNx+i,sNy+j) = negOne*uFld(sNx+2-j, sNy+i ) |
181 |
|
|
ENDDO |
182 |
|
|
ENDDO |
183 |
|
|
ENDIF |
184 |
|
|
|
185 |
|
|
C-- End useCubedSphereExchange |
186 |
|
|
ENDIF |
187 |
|
|
|
188 |
|
|
RETURN |
189 |
|
|
END |