51 |
C == Local variables == |
C == Local variables == |
52 |
LOGICAL momForcing_In_AB |
LOGICAL momForcing_In_AB |
53 |
LOGICAL momDissip_In_AB |
LOGICAL momDissip_In_AB |
54 |
|
LOGICAL momStartAB |
55 |
INTEGER i,j |
INTEGER i,j |
56 |
_RL ab15,ab05 |
_RL ab15,ab05 |
57 |
_RL phxFac,phyFac, psFac |
_RL phxFac,phyFac, psFac |
58 |
_RL gUtmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL gUtmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
59 |
_RL gVtmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL gVtmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
60 |
|
#ifdef ALLOW_DIAGNOSTICS |
61 |
|
C Allow diagnosis of external forcing |
62 |
|
LOGICAL externForcDiagIsOn |
63 |
|
LOGICAL DIAGNOSTICS_IS_ON |
64 |
|
EXTERNAL DIAGNOSTICS_IS_ON |
65 |
|
_RL gUext(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
66 |
|
_RL gVext(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
67 |
|
#endif |
68 |
#ifdef ALLOW_CD_CODE |
#ifdef ALLOW_CD_CODE |
69 |
_RL guCor(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL guCor(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
70 |
_RL gvCor(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL gvCor(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
CEOP |
CEOP |
73 |
|
|
74 |
C Adams-Bashforth timestepping weights |
C Adams-Bashforth timestepping weights |
75 |
|
momStartAB = nIter0.EQ.0 |
76 |
IF (myIter .EQ. 0) THEN |
IF (myIter .EQ. 0) THEN |
77 |
ab15=1.0 |
ab15=1.0 |
78 |
ab05=0.0 |
ab05=0.0 |
84 |
C-- explicit part of the surface potential gradient is added in this S/R |
C-- explicit part of the surface potential gradient is added in this S/R |
85 |
psFac = pfFacMom*(1. _d 0 - implicSurfPress) |
psFac = pfFacMom*(1. _d 0 - implicSurfPress) |
86 |
|
|
87 |
|
C-- factors for gradient (X & Y directions) of Hydrostatic Potential |
88 |
|
phxFac = pfFacMom |
89 |
|
phyFac = pfFacMom |
90 |
|
|
91 |
C-- including or excluding momentum forcing from Adams-Bashforth: |
C-- including or excluding momentum forcing from Adams-Bashforth: |
92 |
momForcing_In_AB = forcing_In_AB |
momForcing_In_AB = forcing_In_AB |
93 |
momForcing_In_AB = .TRUE. |
momForcing_In_AB = .TRUE. |
94 |
momDissip_In_AB = .TRUE. |
momDissip_In_AB = .TRUE. |
95 |
|
|
96 |
|
#ifdef ALLOW_DIAGNOSTICS |
97 |
|
externForcDiagIsOn = useDiagnostics .AND. momForcing |
98 |
|
IF ( externForcDiagIsOn ) THEN |
99 |
|
externForcDiagIsOn = DIAGNOSTICS_IS_ON('Um_Ext ',myThid) |
100 |
|
& .OR. DIAGNOSTICS_IS_ON('Vm_Ext ',myThid) |
101 |
|
ENDIF |
102 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
103 |
|
|
104 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
105 |
|
|
106 |
C- Initialize local arrays (not really necessary but safer) |
C- Initialize local arrays (not really necessary but safer) |
115 |
ENDDO |
ENDDO |
116 |
ENDDO |
ENDDO |
117 |
|
|
118 |
C-- Stagger time step: grad Phi_Hyp will be added later |
IF ( .NOT.staggerTimeStep ) THEN |
|
IF (staggerTimeStep) THEN |
|
|
phxFac = pfFacMom |
|
|
phyFac = pfFacMom |
|
|
ELSE |
|
119 |
C-- Synchronous time step: add grad Phi_Hyp to gU,gV before doing Adams-Bashforth |
C-- Synchronous time step: add grad Phi_Hyp to gU,gV before doing Adams-Bashforth |
120 |
C note: already done in S/R mom_vecinv and mom_fluxform but would be better |
DO j=jMin,jMax |
121 |
C to add it to gU,gV here. |
DO i=iMin,iMax |
122 |
c DO j=jMin,jMax |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) - phxFac*dPhiHydX(i,j) |
123 |
c DO i=iMin,iMax |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) - phyFac*dPhiHydY(i,j) |
124 |
c gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) - pfFacMom*dPhiHydX(i,j) |
ENDDO |
125 |
c gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) - pfFacMom*dPhiHydY(i,j) |
ENDDO |
|
c ENDDO |
|
|
c ENDDO |
|
126 |
phxFac = 0. |
phxFac = 0. |
127 |
phyFac = 0. |
phyFac = 0. |
128 |
|
c ELSE |
129 |
|
C-- Stagger time step: grad Phi_Hyp will be added later |
130 |
ENDIF |
ENDIF |
131 |
|
|
|
#ifdef ALLOW_MOM_VECINV |
|
132 |
C-- Dissipation term inside the Adams-Bashforth: |
C-- Dissipation term inside the Adams-Bashforth: |
133 |
C note: already in gU,gV if using fluxform |
IF ( momViscosity .AND. momDissip_In_AB) THEN |
|
IF ( momViscosity .AND. momDissip_In_AB |
|
|
& .AND. vectorInvariantMomentum ) THEN |
|
134 |
DO j=jMin,jMax |
DO j=jMin,jMax |
135 |
DO i=iMin,iMax |
DO i=iMin,iMax |
136 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) + guDissip(i,j) |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) + guDissip(i,j) |
138 |
ENDDO |
ENDDO |
139 |
ENDDO |
ENDDO |
140 |
ENDIF |
ENDIF |
|
#endif |
|
141 |
|
|
142 |
C-- Forcing term inside the Adams-Bashforth: |
C-- Forcing term inside the Adams-Bashforth: |
143 |
IF (momForcing .AND. momForcing_In_AB) THEN |
IF (momForcing .AND. momForcing_In_AB) THEN |
144 |
|
#ifdef ALLOW_DIAGNOSTICS |
145 |
|
IF ( useDiagnostics .AND. externForcDiagIsOn ) THEN |
146 |
|
DO j=1,sNy+1 |
147 |
|
DO i=1,sNx+1 |
148 |
|
gUext(i,j) = gU(i,j,k,bi,bj) |
149 |
|
gVext(i,j) = gV(i,j,k,bi,bj) |
150 |
|
ENDDO |
151 |
|
ENDDO |
152 |
|
ENDIF |
153 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
154 |
|
|
155 |
CALL EXTERNAL_FORCING_U( |
CALL EXTERNAL_FORCING_U( |
156 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
I iMin,iMax,jMin,jMax,bi,bj,k, |
157 |
I myTime,myThid) |
I myTime,myThid) |
158 |
CALL EXTERNAL_FORCING_V( |
CALL EXTERNAL_FORCING_V( |
159 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
I iMin,iMax,jMin,jMax,bi,bj,k, |
160 |
I myTime,myThid) |
I myTime,myThid) |
161 |
|
|
162 |
|
#ifdef ALLOW_DIAGNOSTICS |
163 |
|
IF ( useDiagnostics .AND. externForcDiagIsOn ) THEN |
164 |
|
DO j=1,sNy+1 |
165 |
|
DO i=1,sNx+1 |
166 |
|
gUext(i,j) = gU(i,j,k,bi,bj)-gUext(i,j) |
167 |
|
gVext(i,j) = gV(i,j,k,bi,bj)-gVext(i,j) |
168 |
|
ENDDO |
169 |
|
ENDDO |
170 |
|
ENDIF |
171 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
172 |
ENDIF |
ENDIF |
173 |
|
|
174 |
IF (useCDscheme) THEN |
IF (useCDscheme) THEN |
175 |
C- for CD-scheme, store gU,Vtmp = gU,V^n + forcing |
C- for CD-scheme, store gU,Vtmp = gU,V^n + dissip. + forcing |
176 |
DO j=jMin,jMax |
IF ( momViscosity .AND. .NOT.momDissip_In_AB ) THEN |
177 |
DO i=iMin,iMax |
DO j=jMin,jMax |
178 |
gUtmp(i,j) = gU(i,j,k,bi,bj) |
DO i=iMin,iMax |
179 |
gVtmp(i,j) = gV(i,j,k,bi,bj) |
gUtmp(i,j) = gU(i,j,k,bi,bj) + guDissip(i,j) |
180 |
ENDDO |
gVtmp(i,j) = gV(i,j,k,bi,bj) + gvDissip(i,j) |
181 |
ENDDO |
ENDDO |
182 |
|
ENDDO |
183 |
|
ELSE |
184 |
|
DO j=jMin,jMax |
185 |
|
DO i=iMin,iMax |
186 |
|
gUtmp(i,j) = gU(i,j,k,bi,bj) |
187 |
|
gVtmp(i,j) = gV(i,j,k,bi,bj) |
188 |
|
ENDDO |
189 |
|
ENDDO |
190 |
|
ENDIF |
191 |
ENDIF |
ENDIF |
192 |
|
|
193 |
C- Compute effective gU,gV_[n+1/2] terms (including Adams-Bashforth weights) |
C- Compute effective gU,gV_[n+1/2] terms (including Adams-Bashforth weights) |
196 |
CALL ADAMS_BASHFORTH3( |
CALL ADAMS_BASHFORTH3( |
197 |
I bi, bj, k, |
I bi, bj, k, |
198 |
U gU, guNm, |
U gU, guNm, |
199 |
I myIter, myThid ) |
I momStartAB, myIter, myThid ) |
200 |
CALL ADAMS_BASHFORTH3( |
CALL ADAMS_BASHFORTH3( |
201 |
I bi, bj, k, |
I bi, bj, k, |
202 |
U gV, gvNm, |
U gV, gvNm, |
203 |
I myIter, myThid ) |
I momStartAB, myIter, myThid ) |
204 |
#else /* ALLOW_ADAMSBASHFORTH_3 */ |
#else /* ALLOW_ADAMSBASHFORTH_3 */ |
205 |
CALL ADAMS_BASHFORTH2( |
CALL ADAMS_BASHFORTH2( |
206 |
I bi, bj, k, |
I bi, bj, k, |
213 |
#endif /* ALLOW_ADAMSBASHFORTH_3 */ |
#endif /* ALLOW_ADAMSBASHFORTH_3 */ |
214 |
|
|
215 |
C-- Forcing term outside the Adams-Bashforth: |
C-- Forcing term outside the Adams-Bashforth: |
216 |
C (not recommanded with CD-scheme ON) |
C (not recommended with CD-scheme ON) |
217 |
IF (momForcing .AND. .NOT.momForcing_In_AB) THEN |
IF (momForcing .AND. .NOT.momForcing_In_AB) THEN |
218 |
IF (useCDscheme) THEN |
IF (useCDscheme) THEN |
219 |
DO j=jMin,jMax |
DO j=jMin,jMax |
223 |
ENDDO |
ENDDO |
224 |
ENDDO |
ENDDO |
225 |
ENDIF |
ENDIF |
226 |
|
#ifdef ALLOW_DIAGNOSTICS |
227 |
|
IF ( useDiagnostics .AND. externForcDiagIsOn ) THEN |
228 |
|
DO j=1,sNy+1 |
229 |
|
DO i=1,sNx+1 |
230 |
|
gUext(i,j) = gU(i,j,k,bi,bj) |
231 |
|
gVext(i,j) = gV(i,j,k,bi,bj) |
232 |
|
ENDDO |
233 |
|
ENDDO |
234 |
|
ENDIF |
235 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
236 |
|
|
237 |
CALL EXTERNAL_FORCING_U( |
CALL EXTERNAL_FORCING_U( |
238 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
I iMin,iMax,jMin,jMax,bi,bj,k, |
239 |
I myTime,myThid) |
I myTime,myThid) |
241 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
I iMin,iMax,jMin,jMax,bi,bj,k, |
242 |
I myTime,myThid) |
I myTime,myThid) |
243 |
|
|
244 |
|
#ifdef ALLOW_DIAGNOSTICS |
245 |
|
IF ( useDiagnostics .AND. externForcDiagIsOn ) THEN |
246 |
|
DO j=1,sNy+1 |
247 |
|
DO i=1,sNx+1 |
248 |
|
gUext(i,j) = gU(i,j,k,bi,bj)-gUext(i,j) |
249 |
|
gVext(i,j) = gV(i,j,k,bi,bj)-gVext(i,j) |
250 |
|
ENDDO |
251 |
|
ENDDO |
252 |
|
ENDIF |
253 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
254 |
|
|
255 |
C- for CD-scheme, compute gU,Vtmp = gU,V^n + forcing |
C- for CD-scheme, compute gU,Vtmp = gU,V^n + forcing |
256 |
IF (useCDscheme) THEN |
IF (useCDscheme) THEN |
257 |
DO j=jMin,jMax |
DO j=jMin,jMax |
320 |
|
|
321 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
322 |
|
|
|
#ifdef ALLOW_MOM_VECINV |
|
323 |
C-- Dissipation term outside the Adams-Bashforth: |
C-- Dissipation term outside the Adams-Bashforth: |
324 |
C note: only implemented with vecinv formulation |
IF ( momViscosity .AND. .NOT.momDissip_In_AB ) THEN |
|
IF ( momViscosity .AND. .NOT.momDissip_In_AB |
|
|
& .AND. vectorInvariantMomentum ) THEN |
|
325 |
DO j=jMin,jMax |
DO j=jMin,jMax |
326 |
DO i=iMin,iMax |
DO i=iMin,iMax |
327 |
gUtmp(i,j) = gUtmp(i,j) + guDissip(i,j) |
gUtmp(i,j) = gUtmp(i,j) + guDissip(i,j) |
329 |
ENDDO |
ENDDO |
330 |
ENDDO |
ENDDO |
331 |
ENDIF |
ENDIF |
|
#endif |
|
332 |
|
|
333 |
C Step forward zonal velocity (store in Gu) |
C Step forward zonal velocity (store in Gu) |
334 |
DO j=jMin,jMax |
DO j=jMin,jMax |
354 |
ENDDO |
ENDDO |
355 |
ENDDO |
ENDDO |
356 |
|
|
357 |
|
#ifdef ALLOW_DIAGNOSTICS |
358 |
|
IF ( useDiagnostics .AND. externForcDiagIsOn ) THEN |
359 |
|
CALL DIAGNOSTICS_FILL(gUext,'Um_Ext ',k,1,2,bi,bj,myThid) |
360 |
|
CALL DIAGNOSTICS_FILL(gVext,'Vm_Ext ',k,1,2,bi,bj,myThid) |
361 |
|
ENDIF |
362 |
|
#ifdef ALLOW_CD_CODE |
363 |
|
IF ( useCDscheme .AND. useDiagnostics ) THEN |
364 |
|
CALL DIAGNOSTICS_FILL(guCor,'Um_Cori ',k,1,2,bi,bj,myThid) |
365 |
|
CALL DIAGNOSTICS_FILL(gvCor,'Vm_Cori ',k,1,2,bi,bj,myThid) |
366 |
|
ENDIF |
367 |
|
#endif /* ALLOW_CD_CODE */ |
368 |
|
#endif /* ALLOW_DIAGNOSTICS */ |
369 |
|
|
370 |
RETURN |
RETURN |
371 |
END |
END |