/[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.4 - (show annotations) (download)
Thu Jan 22 17:17:19 2004 UTC (20 years, 4 months ago) by afe
Branch: MAIN
CVS Tags: hrcube_2
Changes since 1.3: +95 -1 lines
o merged mom_vi_calc_relvort3.F, mom_vi_del2uv.F and
  mon_vort3.F to make exch2 friendly with >1 tile per cube
  face

1 C $Header: /u/u3/gcmpack/MITgcm_contrib/high_res_cube/code-mods/mom_vi_del2uv.F,v 1.2 2003/12/19 20:14:06 dimitri 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 #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 ==
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 #ifndef USE_W2
37 _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
71 DO j=2-Oly,sNy+Oly-1
72 DO i=2-Olx,sNx+Olx-1
73
74 c Dim=dyF( i ,j-1,bi,bj)*hFacC( i ,j-1,k,bi,bj)*hDiv( i ,j-1)
75 c Dij=dyF( i , j ,bi,bj)*hFacC( i , j ,k,bi,bj)*hDiv( i , j )
76 c Dmj=dyF(i-1, j ,bi,bj)*hFacC(i-1, j ,k,bi,bj)*hDiv(i-1, j )
77 c Dim=dyF( i ,j-1,bi,bj)* hDiv( i ,j-1)
78 c Dij=dyF( i , j ,bi,bj)* hDiv( i , j )
79 c Dmj=dyF(i-1, j ,bi,bj)* hDiv(i-1, j )
80 Dim= hDiv( i ,j-1)
81 Dij= hDiv( i , j )
82 Dmj= hDiv(i-1, j )
83
84 c Zip=dxV( i ,j+1,bi,bj)*hFacZ( i ,j+1)*vort3( i ,j+1)
85 c Zij=dxV( i , j ,bi,bj)*hFacZ( i , j )*vort3( i , j )
86 c Zpj=dxV(i+1, j ,bi,bj)*hFacZ(i+1, j )*vort3(i+1, j )
87 Zip= hFacZ( i ,j+1)*vort3( i ,j+1)
88 Zij= hFacZ( i , j )*vort3( i , j )
89 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)*(
145 c & +recip_hFacW(i,j,k,bi,bj)*( Dij-Dmj )
146 c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) )
147 c del2u(i,j) = recip_rAw(i,j,bi,bj)*(
148 c & + ( Dij-Dmj )
149 c & -recip_hFacW(i,j,k,bi,bj)*( Zip-Zij ) )
150 del2u(i,j) =
151 #ifndef USE_W2
152 & + ( 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)
157
158 c del2v(i,j) = recip_rAs(i,j,bi,bj)*(
159 c & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )
160 c & +recip_hFacS(i,j,k,bi,bj)*( Dij-Dim ) )
161 c del2v(i,j) = recip_rAs(i,j,bi,bj)*(
162 c & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )
163 c & + ( Dij-Dim ) )
164 del2v(i,j) =
165 & recip_hFacS(i,j,k,bi,bj)*( Zpj-Zij )*recip_DXG(i,j,bi,bj)
166 & + ( Dij-Dim )*recip_DYC(i,j,bi,bj)
167
168 ENDDO
169 ENDDO
170
171 RETURN
172 END

  ViewVC Help
Powered by ViewVC 1.1.22