39 |
C == Local variables |
C == Local variables |
40 |
C xA, yA - Per block temporaries holding face areas |
C xA, yA - Per block temporaries holding face areas |
41 |
C uTrans, vTrans, wTrans - Per block temporaries holding flow transport |
C uTrans, vTrans, wTrans - Per block temporaries holding flow transport |
42 |
C o uTrans: Zonal transport |
C wVel o uTrans: Zonal transport |
43 |
C o vTrans: Meridional transport |
C o vTrans: Meridional transport |
44 |
C o wTrans: Vertical transport |
C o wTrans: Vertical transport |
45 |
|
C o wVel: Vertical velocity at upper and lower |
46 |
|
C cell faces. |
47 |
C maskC,maskUp o maskC: land/water mask for tracer cells |
C maskC,maskUp o maskC: land/water mask for tracer cells |
48 |
C o maskUp: land/water mask for W points |
C o maskUp: land/water mask for W points |
49 |
C aTerm, xTerm, cTerm - Work arrays for holding separate terms in |
C aTerm, xTerm, cTerm - Work arrays for holding separate terms in |
70 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
71 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
_RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
73 |
|
_RL wVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
74 |
_RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
75 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
76 |
_RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
94 |
_RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL K23 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
95 |
_RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
_RL K33 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz) |
96 |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL KapGM (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
97 |
|
_RL KappaZT(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz) |
98 |
|
_RL KappaZS(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nz) |
99 |
|
|
100 |
INTEGER iMin, iMax |
INTEGER iMin, iMax |
101 |
INTEGER jMin, jMax |
INTEGER jMin, jMax |
102 |
INTEGER bi, bj |
INTEGER bi, bj |
112 |
C with the free-surface evolution or the rigid-lid: |
C with the free-surface evolution or the rigid-lid: |
113 |
C U[n] = U* + dt x d/dx P |
C U[n] = U* + dt x d/dx P |
114 |
C V[n] = V* + dt x d/dy P |
C V[n] = V* + dt x d/dy P |
|
C With implicit diffusion, the tracers must also be "finalized" |
|
|
C (1 + dt * K * d_zz) theta[n] = theta* |
|
|
C (1 + dt * K * d_zz) salt[n] = salt* |
|
115 |
C |
C |
116 |
C "Calculation of Gs" |
C "Calculation of Gs" |
117 |
C =================== |
C =================== |
125 |
C Gt[n] = Gt( theta[n], u[n], v[n], w, K31, ... ) |
C Gt[n] = Gt( theta[n], u[n], v[n], w, K31, ... ) |
126 |
C Gs[n] = Gs( salt[n], u[n], v[n], w, K31, ... ) |
C Gs[n] = Gs( salt[n], u[n], v[n], w, K31, ... ) |
127 |
C |
C |
128 |
C "Time-stepping" or "Predicition" |
C "Time-stepping" or "Prediction" |
129 |
C ================================ |
C ================================ |
130 |
C The models variables are stepped forward with the appropriate |
C The models variables are stepped forward with the appropriate |
131 |
C time-stepping scheme (currently we use Adams-Bashforth II) |
C time-stepping scheme (currently we use Adams-Bashforth II) |
140 |
C V* = V[n] + dt x ( 3/2 Gv[n] - 1/2 Gv[n-1] ) |
C V* = V[n] + dt x ( 3/2 Gv[n] - 1/2 Gv[n-1] ) |
141 |
C theta[n+1] = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
C theta[n+1] = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
142 |
C salt[n+1] = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
C salt[n+1] = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
143 |
C or with implicit diffusion |
C With implicit diffusion: |
144 |
C theta* = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
C theta* = theta[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
|
C |
|
145 |
C salt* = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
C salt* = salt[n] + dt x ( 3/2 Gt[n] - 1/2 atG[n-1] ) |
146 |
|
C (1 + dt * K * d_zz) theta[n] = theta* |
147 |
|
C (1 + dt * K * d_zz) salt[n] = salt* |
148 |
C--- |
C--- |
149 |
|
|
|
|
|
150 |
C-- Set up work arrays with valid (i.e. not NaN) values |
C-- Set up work arrays with valid (i.e. not NaN) values |
151 |
C These inital values do not alter the numerical results. They |
C These inital values do not alter the numerical results. They |
152 |
C just ensure that all memory references are to valid floating |
C just ensure that all memory references are to valid floating |
170 |
K13(i,j,k) = 0. _d 0 |
K13(i,j,k) = 0. _d 0 |
171 |
K23(i,j,k) = 0. _d 0 |
K23(i,j,k) = 0. _d 0 |
172 |
K33(i,j,k) = 0. _d 0 |
K33(i,j,k) = 0. _d 0 |
173 |
|
KappaZT(i,j,k) = 0. _d 0 |
174 |
ENDDO |
ENDDO |
175 |
rhokm1(i,j) = 0. _d 0 |
rhokm1(i,j) = 0. _d 0 |
176 |
rhokp1(i,j) = 0. _d 0 |
rhokp1(i,j) = 0. _d 0 |
177 |
rhotmp(i,j) = 0. _d 0 |
rhotmp(i,j) = 0. _d 0 |
178 |
|
maskC (i,j) = 0. _d 0 |
179 |
ENDDO |
ENDDO |
180 |
ENDDO |
ENDDO |
181 |
|
|
186 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
187 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
188 |
wTrans(i,j) = 0. _d 0 |
wTrans(i,j) = 0. _d 0 |
189 |
|
wVel (i,j,1) = 0. _d 0 |
190 |
|
wVel (i,j,2) = 0. _d 0 |
191 |
fVerT(i,j,1) = 0. _d 0 |
fVerT(i,j,1) = 0. _d 0 |
192 |
fVerT(i,j,2) = 0. _d 0 |
fVerT(i,j,2) = 0. _d 0 |
193 |
fVerS(i,j,1) = 0. _d 0 |
fVerS(i,j,1) = 0. _d 0 |
229 |
I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1, |
I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1, |
230 |
U pH, |
U pH, |
231 |
I myThid ) |
I myThid ) |
232 |
DO J=1-Oly,sNy+Oly |
DO J=jMin,jMax |
233 |
DO I=1-Olx,sNx+Olx |
DO I=iMin,iMax |
234 |
rhoKp1(I,J)=rhoKm1(I,J) |
rhoKp1(I,J)=rhoKm1(I,J) |
235 |
ENDDO |
ENDDO |
236 |
ENDDO |
ENDDO |
245 |
copt O rhoKm1, |
copt O rhoKm1, |
246 |
copt I myThid ) |
copt I myThid ) |
247 |
C rhoKm1=rhoKp1 |
C rhoKm1=rhoKp1 |
248 |
DO J=1-Oly,sNy+Oly |
DO J=jMin,jMax |
249 |
DO I=1-Olx,sNx+Olx |
DO I=iMin,iMax |
250 |
rhoKm1(I,J)=rhoKp1(I,J) |
rhoKm1(I,J)=rhoKp1(I,J) |
251 |
ENDDO |
ENDDO |
252 |
ENDDO |
ENDDO |
268 |
I myThid ) |
I myThid ) |
269 |
C-- Calculate static stability and mix where convectively unstable |
C-- Calculate static stability and mix where convectively unstable |
270 |
CALL CONVECT( |
CALL CONVECT( |
271 |
I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1, |
I bi,bj,iMin,iMax,jMin,jMax,K,rhotmp,rhoKp1, |
272 |
I myTime,myIter,myThid) |
I myTime,myIter,myThid) |
273 |
C-- Density of K-1 level (above W(K)) reference to K-1 level |
C-- Density of K-1 level (above W(K)) reference to K-1 level |
274 |
CALL FIND_RHO( |
CALL FIND_RHO( |
307 |
C-- Get temporary terms used by tendency routines |
C-- Get temporary terms used by tendency routines |
308 |
CALL CALC_COMMON_FACTORS ( |
CALL CALC_COMMON_FACTORS ( |
309 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
310 |
O xA,yA,uTrans,vTrans,wTrans,maskC,maskUp, |
O xA,yA,uTrans,vTrans,wTrans,wVel,maskC,maskUp, |
311 |
|
I myThid) |
312 |
|
|
313 |
|
C-- Calculate the total vertical diffusivity |
314 |
|
CALL CALC_DIFFUSIVITY( |
315 |
|
I bi,bj,iMin,iMax,jMin,jMax,K, |
316 |
|
I maskC,maskUp,KapGM,K33, |
317 |
|
O KappaZT,KappaZS, |
318 |
I myThid) |
I myThid) |
319 |
|
|
320 |
C-- Calculate accelerations in the momentum equations |
C-- Calculate accelerations in the momentum equations |
321 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
322 |
CALL CALC_MOM_RHS( |
CALL CALC_MOM_RHS( |
323 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
324 |
I xA,yA,uTrans,vTrans,wTrans,maskC, |
I xA,yA,uTrans,vTrans,wTrans,wVel,maskC, |
325 |
I pH, |
I pH, |
326 |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
U aTerm,xTerm,cTerm,mTerm,pTerm, |
327 |
U fZon, fMer, fVerU, fVerV, |
U fZon, fMer, fVerU, fVerV, |
333 |
CALL CALC_GT( |
CALL CALC_GT( |
334 |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
335 |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
336 |
I K13,K23,K33,KapGM, |
I K13,K23,KappaZT,KapGM, |
337 |
U aTerm,xTerm,fZon,fMer,fVerT, |
U aTerm,xTerm,fZon,fMer,fVerT, |
338 |
I myThid) |
I myThid) |
339 |
ENDIF |
ENDIF |
340 |
Cdbg CALL CALC_GS( |
IF ( saltStepping ) THEN |
341 |
Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
CALL CALC_GS( |
342 |
Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp, |
I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown, |
343 |
Cdbg I K13,K23,K33,KapGM, |
I xA,yA,uTrans,vTrans,wTrans,maskUp, |
344 |
Cdbg U aTerm,xTerm,fZon,fMer,fVerS, |
I K13,K23,KappaZS,KapGM, |
345 |
Cdbg I myThid) |
U aTerm,xTerm,fZon,fMer,fVerS, |
346 |
|
I myThid) |
347 |
|
ENDIF |
348 |
|
|
349 |
C-- Prediction step (step forward all model variables) |
C-- Prediction step (step forward all model variables) |
350 |
CALL TIMESTEP( |
CALL TIMESTEP( |
358 |
I myThid) |
I myThid) |
359 |
|
|
360 |
ENDDO ! K |
ENDDO ! K |
361 |
|
|
362 |
|
C-- Implicit diffusion |
363 |
|
IF (implicitDiffusion) THEN |
364 |
|
CALL IMPLDIFF( bi, bj, iMin, iMax, jMin, jMax, |
365 |
|
I KappaZT,KappaZS, |
366 |
|
I myThid ) |
367 |
|
ENDIF |
368 |
|
|
369 |
ENDDO |
ENDDO |
370 |
ENDDO |
ENDDO |
371 |
|
|
372 |
!dbg write(0,*) 'dynamics: pS',minval(cg2d_x),maxval(cg2d_x) |
write(0,*) 'dynamics: pS ',minval(cg2d_x(1:sNx,1:sNy,:,:)), |
373 |
!dbg write(0,*) 'dynamics: U',minval(uVel(1:sNx,1:sNy,:,:,:)), |
& maxval(cg2d_x(1:sNx,1:sNy,:,:)) |
374 |
!dbg & maxval(uVel(1:sNx,1:sNy,:,:,:)) |
write(0,*) 'dynamics: U ',minval(uVel(1:sNx,1:sNy,:,:,:)), |
375 |
!dbg write(0,*) 'dynamics: V',minval(vVel(1:sNx,1:sNy,:,:,:)), |
& maxval(uVel(1:sNx,1:sNy,:,:,:)) |
376 |
!dbg & maxval(vVel(1:sNx,1:sNy,:,:,:)) |
write(0,*) 'dynamics: V ',minval(vVel(1:sNx,1:sNy,:,:,:)), |
377 |
!dbg write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)), |
& maxval(vVel(1:sNx,1:sNy,:,:,:)) |
378 |
!dbg & maxval(K13(1:sNx,1:sNy,:)) |
cblk write(0,*) 'dynamics: K13',minval(K13(1:sNx,1:sNy,:)), |
379 |
!dbg write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)), |
cblk & maxval(K13(1:sNx,1:sNy,:)) |
380 |
!dbg & maxval(K23(1:sNx,1:sNy,:)) |
cblk write(0,*) 'dynamics: K23',minval(K23(1:sNx,1:sNy,:)), |
381 |
!dbg write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)), |
cblk & maxval(K23(1:sNx,1:sNy,:)) |
382 |
!dbg & maxval(K33(1:sNx,1:sNy,:)) |
cblk write(0,*) 'dynamics: K33',minval(K33(1:sNx,1:sNy,:)), |
383 |
!dbg write(0,*) 'dynamics: gT',minval(gT(1:sNx,1:sNy,:,:,:)), |
cblk & maxval(K33(1:sNx,1:sNy,:)) |
384 |
!dbg & maxval(gT(1:sNx,1:sNy,:,:,:)) |
write(0,*) 'dynamics: gT ',minval(gT(1:sNx,1:sNy,:,:,:)), |
385 |
!dbg write(0,*) 'dynamics: T',minval(Theta(1:sNx,1:sNy,:,:,:)), |
& maxval(gT(1:sNx,1:sNy,:,:,:)) |
386 |
!dbg & maxval(Theta(1:sNx,1:sNy,:,:,:)) |
write(0,*) 'dynamics: T ',minval(Theta(1:sNx,1:sNy,:,:,:)), |
387 |
!dbg write(0,*) 'dynamics: pH',minval(pH/(Gravity*Rhonil)), |
& maxval(Theta(1:sNx,1:sNy,:,:,:)) |
388 |
!dbg & maxval(pH/(Gravity*Rhonil)) |
write(0,*) 'dynamics: gS ',minval(gS(1:sNx,1:sNy,:,:,:)), |
389 |
|
& maxval(gS(1:sNx,1:sNy,:,:,:)) |
390 |
|
write(0,*) 'dynamics: S ',minval(salt(1:sNx,1:sNy,:,:,:)), |
391 |
|
& maxval(salt(1:sNx,1:sNy,:,:,:)) |
392 |
|
cblk write(0,*) 'dynamics: pH ',minval(pH/(Gravity*Rhonil)), |
393 |
|
cblk & maxval(pH/(Gravity*Rhonil)) |
394 |
|
|
395 |
RETURN |
RETURN |
396 |
END |
END |