16 |
C == Global variables == |
C == Global variables == |
17 |
#include "SIZE.h" |
#include "SIZE.h" |
18 |
#include "GRID.h" |
#include "GRID.h" |
19 |
|
#ifdef USE_W2 |
20 |
|
#include "EEPARAMS.h" |
21 |
|
#include "W2_EXCH2_TOPOLOGY.h" |
22 |
|
#include "W2_EXCH2_PARAMS.h" |
23 |
|
#endif /* USE_W2 */ |
24 |
|
|
25 |
C == Routine arguments == |
C == Routine arguments == |
26 |
INTEGER bi,bj,k |
INTEGER bi,bj,k |
33 |
|
|
34 |
C == Local variables == |
C == Local variables == |
35 |
INTEGER I,J |
INTEGER I,J |
36 |
|
#ifndef USE_W2 |
37 |
_RL Zip,Zij,Zpj,Dim,Dij,Dmj |
_RL Zip,Zij,Zpj,Dim,Dij,Dmj |
38 |
|
#else /* USE_W2 */ |
39 |
|
_RL Zip,Zij,Zpj,Dim,Dij,Dmj,uDij |
40 |
|
LOGICAL northWestCorner, northEastCorner, |
41 |
|
& southWestCorner, southEastCorner |
42 |
|
INTEGER myTile |
43 |
|
|
44 |
|
C Special stuff for Cubed Sphere |
45 |
|
IF (useCubedSphereExchange) THEN |
46 |
|
southWestCorner = .FALSE. |
47 |
|
southEastCorner = .FALSE. |
48 |
|
northWestCorner = .FALSE. |
49 |
|
northEastCorner = .FALSE. |
50 |
|
myTile = W2_myTileList(bi) |
51 |
|
IF ( exch2_isWedge(myTile) .EQ. 1 .AND. |
52 |
|
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
53 |
|
southWestCorner = .TRUE. |
54 |
|
ENDIF |
55 |
|
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
56 |
|
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
57 |
|
southEastCorner = .TRUE. |
58 |
|
ENDIF |
59 |
|
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
60 |
|
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
61 |
|
northEastCorner = .TRUE. |
62 |
|
ENDIF |
63 |
|
IF ( exch2_isWedge(myTile) .EQ. 1 .AND. |
64 |
|
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
65 |
|
northWestCorner = .TRUE. |
66 |
|
ENDIF |
67 |
|
ENDIF |
68 |
|
#endif /* USE_W2 */ |
69 |
|
|
70 |
C - Laplacian and bi-harmonic terms |
C - Laplacian and bi-harmonic terms |
71 |
DO j=2-Oly,sNy+Oly-1 |
DO j=2-Oly,sNy+Oly-1 |
88 |
Zij= hFacZ( i , j )*vort3( i , j ) |
Zij= hFacZ( i , j )*vort3( i , j ) |
89 |
Zpj= hFacZ(i+1, j )*vort3(i+1, j ) |
Zpj= hFacZ(i+1, j )*vort3(i+1, j ) |
90 |
|
|
91 |
|
#ifdef USE_W2 |
92 |
|
C Special stuff for Cubed Sphere |
93 |
|
uDij=Dij |
94 |
|
IF (useCubedSphereExchange) THEN |
95 |
|
C U(0,1) D(0,1) U(1,1) TILE |
96 |
|
C | | |
97 |
|
C V(-1,1) --- Z(0,1) --- V(0,1) --- Z(1,1) --- V(1,1) --- |
98 |
|
C | | |
99 |
|
C U(0,0) D(0,0) U(1,0) D(1,0) |
100 |
|
C | | |
101 |
|
C --- V(0,0) --- Z(1,0) --- V(1,0) --- |
102 |
|
C | |
103 |
|
C U(1,-1) |
104 |
|
if(southWestCorner.and.i.eq.1.and.j.eq.0) Dmj=hDiv(0,1) |
105 |
|
if(southWestCorner.and.i.eq.0.and.j.eq.1) Dim=hDiv(1,0) |
106 |
|
C U(1,N+2) |
107 |
|
C | |
108 |
|
C --- V(0,N+1) --- Z(1,N+2) --- V(1,N+2) --- |
109 |
|
C | | |
110 |
|
C U(0,N+1) D(0,N+1) U(1,N+1) D(1,N+1) |
111 |
|
C | | |
112 |
|
C V(-1,N+1) --- Z(0,N+1) --- V(0,N+1) --- Z(1,N+1) --- V(1,N+1) --- |
113 |
|
C | | |
114 |
|
C U(0,N) D(0,N) U(1,N) TILE |
115 |
|
if(northWestCorner.and.i.eq.1.and.j.eq.sNy+1) Dmj=hDiv(0,sNy) |
116 |
|
if(northWestCorner.and.i.eq.0.and.j.eq.sNy+1) Dij=hDiv(1,sNy+1) |
117 |
|
C TILE U(N+1,1) D(N+1,1) U(N+2,1) |
118 |
|
C | | |
119 |
|
C V(N,1) --- Z(N+1,1) --- V(N+1,1) --- Z(N+2,1) --- V(N+3,1) --- |
120 |
|
C | | |
121 |
|
C D(N,0) U(N+1,0) D(N+1,0) U(N+2,0) |
122 |
|
C | | |
123 |
|
C V(N,0) --- Z(N+1,0) --- V(N+1,0) --- |
124 |
|
C | |
125 |
|
C U(N+1,-1) |
126 |
|
if(southEastCorner.and.i.eq.sNx+1.and.j.eq.0) Dij=hDiv(sNx+1,1) |
127 |
|
if(southEastCorner.and.i.eq.sNx+1.and.j.eq.1) Dim=hDiv(sNx,0) |
128 |
|
C U(N+1,N+2) |
129 |
|
C | |
130 |
|
C V(N,N+2) --- Z(N+1,N+2) --- V(N+1,N+2) --- |
131 |
|
C | | |
132 |
|
C D(N,N+1) U(N+1,N+1) D(N+1,N+1) U(N+2,N+1) |
133 |
|
C | | |
134 |
|
C V(N,N+1) --- Z(N+1,N+1) --- V(N+1,N+1) --- Z(N+2,N+1) --- V(N+3,N+1) --- |
135 |
|
C | | |
136 |
|
C TILE U(N+1,N) D(N+1,N) U(N+2,N) |
137 |
|
if (northEastCorner.and.i.eq.sNx+1 .and. j.eq.sNy+1) then |
138 |
|
uDij=hDiv(sNx+1,sNy) |
139 |
|
Dij=hDiv(sNx,sNy+1) |
140 |
|
endif |
141 |
|
ENDIF |
142 |
|
|
143 |
|
#endif /* USE_W2 */ |
144 |
c del2u(i,j) = recip_rAw(i,j,bi,bj)*( |
c del2u(i,j) = recip_rAw(i,j,bi,bj)*( |
145 |
c & +recip_hFacW(i,j,k,bi,bj)*( Dij-Dmj ) |
c & +recip_hFacW(i,j,k,bi,bj)*( Dij-Dmj ) |
146 |
c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) ) |
c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) ) |
148 |
c & + ( Dij-Dmj ) |
c & + ( Dij-Dmj ) |
149 |
c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) ) |
c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) ) |
150 |
del2u(i,j) = |
del2u(i,j) = |
151 |
|
#ifndef USE_W2 |
152 |
& + ( Dij-Dmj )*recip_DXC(i,j,bi,bj) |
& + ( Dij-Dmj )*recip_DXC(i,j,bi,bj) |
153 |
|
#else /* USE_W2 */ |
154 |
|
& + ( uDij-Dmj )*recip_DXC(i,j,bi,bj) |
155 |
|
#endif /* USE_W2 */ |
156 |
& -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij )*recip_DYG(i,j,bi,bj) |
& -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij )*recip_DYG(i,j,bi,bj) |
157 |
|
|
158 |
c del2v(i,j) = recip_rAs(i,j,bi,bj)*( |
c del2v(i,j) = recip_rAs(i,j,bi,bj)*( |