/[MITgcm]/MITgcm/pkg/mom_vecinv/mom_vi_del2uv.F
ViewVC logotype

Contents of /MITgcm/pkg/mom_vecinv/mom_vi_del2uv.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Mon Mar 8 21:20:03 2004 UTC (20 years, 2 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint52l_pre, hrcube5, checkpoint52l_post
Changes since 1.5: +7 -7 lines
Renamed "USE_W2" to "ALLOW_EXCH2" so that it is no longer necessary to edit
CPP_EEOPTION.h as well as packages.conf to turn on/off exch2.
 - you can control the use of exch2 through packages.conf or -enable/disable.
 + need to add a run-time flag for this

1 C $Header: /u/gcmpack/MITgcm/pkg/mom_vecinv/mom_vi_del2uv.F,v 1.5 2004/02/06 20:52:37 adcroft Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 SUBROUTINE MOM_VI_DEL2UV(
7 I bi,bj,k,
8 I hDiv,vort3,hFacZ,
9 O del2u,del2v,
10 I myThid)
11 IMPLICIT NONE
12 C
13 C Calculate del^2 of (u,v) in terms of hDiv and vort3
14 C
15
16 C == Global variables ==
17 #include "SIZE.h"
18 #include "GRID.h"
19 #include "EEPARAMS.h"
20 #ifdef ALLOW_EXCH2
21 #include "W2_EXCH2_TOPOLOGY.h"
22 #include "W2_EXCH2_PARAMS.h"
23 #endif /* ALLOW_EXCH2 */
24
25 C == Routine arguments ==
26 INTEGER bi,bj,k
27 _RL hDiv(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
28 _RL vort3(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
29 _RS hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
30 _RL del2u(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
31 _RL del2v(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
32 INTEGER myThid
33
34 C == Local variables ==
35 INTEGER I,J
36 _RL Zip,Zij,Zpj,Dim,Dij,Dmj,uDij
37 LOGICAL northWestCorner, northEastCorner,
38 & southWestCorner, southEastCorner
39 #ifdef ALLOW_EXCH2
40 INTEGER myTile
41 #endif /* ALLOW_EXCH2 */
42
43 C Special stuff for Cubed Sphere
44 IF (useCubedSphereExchange) THEN
45 #ifdef ALLOW_EXCH2
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 #else
68 southWestCorner = .TRUE.
69 southEastCorner = .TRUE.
70 northWestCorner = .TRUE.
71 northEastCorner = .TRUE.
72 #endif /* ALLOW_EXCH2 */
73 ENDIF
74
75 C - Laplacian and bi-harmonic terms
76 DO j=2-Oly,sNy+Oly-1
77 DO i=2-Olx,sNx+Olx-1
78
79 c Dim=dyF( i ,j-1,bi,bj)*hFacC( i ,j-1,k,bi,bj)*hDiv( i ,j-1)
80 c Dij=dyF( i , j ,bi,bj)*hFacC( i , j ,k,bi,bj)*hDiv( i , j )
81 c Dmj=dyF(i-1, j ,bi,bj)*hFacC(i-1, j ,k,bi,bj)*hDiv(i-1, j )
82 c Dim=dyF( i ,j-1,bi,bj)* hDiv( i ,j-1)
83 c Dij=dyF( i , j ,bi,bj)* hDiv( i , j )
84 c Dmj=dyF(i-1, j ,bi,bj)* hDiv(i-1, j )
85 Dim= hDiv( i ,j-1)
86 Dij= hDiv( i , j )
87 Dmj= hDiv(i-1, j )
88
89 c Zip=dxV( i ,j+1,bi,bj)*hFacZ( i ,j+1)*vort3( i ,j+1)
90 c Zij=dxV( i , j ,bi,bj)*hFacZ( i , j )*vort3( i , j )
91 c Zpj=dxV(i+1, j ,bi,bj)*hFacZ(i+1, j )*vort3(i+1, j )
92 Zip= hFacZ( i ,j+1)*vort3( i ,j+1)
93 Zij= hFacZ( i , j )*vort3( i , j )
94 Zpj= hFacZ(i+1, j )*vort3(i+1, j )
95
96 C Special stuff for Cubed Sphere
97 uDij=Dij
98 IF (useCubedSphereExchange) THEN
99 C U(0,1) D(0,1) U(1,1) TILE
100 C | |
101 C V(-1,1) --- Z(0,1) --- V(0,1) --- Z(1,1) --- V(1,1) ---
102 C | |
103 C U(0,0) D(0,0) U(1,0) D(1,0)
104 C | |
105 C --- V(0,0) --- Z(1,0) --- V(1,0) ---
106 C |
107 C U(1,-1)
108 if(southWestCorner.and.i.eq.1.and.j.eq.0) Dmj=hDiv(0,1)
109 if(southWestCorner.and.i.eq.0.and.j.eq.1) Dim=hDiv(1,0)
110 C U(1,N+2)
111 C |
112 C --- V(0,N+1) --- Z(1,N+2) --- V(1,N+2) ---
113 C | |
114 C U(0,N+1) D(0,N+1) U(1,N+1) D(1,N+1)
115 C | |
116 C V(-1,N+1) --- Z(0,N+1) --- V(0,N+1) --- Z(1,N+1) --- V(1,N+1) ---
117 C | |
118 C U(0,N) D(0,N) U(1,N) TILE
119 if(northWestCorner.and.i.eq.1.and.j.eq.sNy+1) Dmj=hDiv(0,sNy)
120 if(northWestCorner.and.i.eq.0.and.j.eq.sNy+1) Dij=hDiv(1,sNy+1)
121 C TILE U(N+1,1) D(N+1,1) U(N+2,1)
122 C | |
123 C V(N,1) --- Z(N+1,1) --- V(N+1,1) --- Z(N+2,1) --- V(N+3,1) ---
124 C | |
125 C D(N,0) U(N+1,0) D(N+1,0) U(N+2,0)
126 C | |
127 C V(N,0) --- Z(N+1,0) --- V(N+1,0) ---
128 C |
129 C U(N+1,-1)
130 if(southEastCorner.and.i.eq.sNx+1.and.j.eq.0) Dij=hDiv(sNx+1,1)
131 if(southEastCorner.and.i.eq.sNx+1.and.j.eq.1) Dim=hDiv(sNx,0)
132 C U(N+1,N+2)
133 C |
134 C V(N,N+2) --- Z(N+1,N+2) --- V(N+1,N+2) ---
135 C | |
136 C D(N,N+1) U(N+1,N+1) D(N+1,N+1) U(N+2,N+1)
137 C | |
138 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) ---
139 C | |
140 C TILE U(N+1,N) D(N+1,N) U(N+2,N)
141 if (northEastCorner.and.i.eq.sNx+1 .and. j.eq.sNy+1) then
142 uDij=hDiv(sNx+1,sNy)
143 Dij=hDiv(sNx,sNy+1)
144 endif
145 ENDIF
146
147 c del2u(i,j) = recip_rAw(i,j,bi,bj)*(
148 c & +recip_hFacW(i,j,k,bi,bj)*( Dij-Dmj )
149 c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) )
150 c del2u(i,j) = recip_rAw(i,j,bi,bj)*(
151 c & + ( Dij-Dmj )
152 c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) )
153 del2u(i,j) =
154 & + ( uDij-Dmj )*recip_DXC(i,j,bi,bj)
155 & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij )*recip_DYG(i,j,bi,bj)
156
157 c del2v(i,j) = recip_rAs(i,j,bi,bj)*(
158 c & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )
159 c & +recip_hFacS(i,j,k,bi,bj)*( Dij-Dim ) )
160 c del2v(i,j) = recip_rAs(i,j,bi,bj)*(
161 c & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )
162 c & + ( Dij-Dim ) )
163 del2v(i,j) =
164 & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )*recip_DXG(i,j,bi,bj)
165 & + ( Dij-Dim )*recip_DYC(i,j,bi,bj)
166
167 ENDDO
168 ENDDO
169
170 RETURN
171 END

  ViewVC Help
Powered by ViewVC 1.1.22