26 |
CEOI |
CEOI |
27 |
|
|
28 |
#include "MOM_FLUXFORM_OPTIONS.h" |
#include "MOM_FLUXFORM_OPTIONS.h" |
29 |
|
#ifdef ALLOW_MOM_COMMON |
30 |
|
# include "MOM_COMMON_OPTIONS.h" |
31 |
|
#endif |
32 |
|
|
33 |
CBOP |
CBOP |
34 |
C !ROUTINE: MOM_FLUXFORM |
C !ROUTINE: MOM_FLUXFORM |
35 |
|
|
36 |
C !INTERFACE: ========================================================== |
C !INTERFACE: ========================================================== |
37 |
SUBROUTINE MOM_FLUXFORM( |
SUBROUTINE MOM_FLUXFORM( |
38 |
I bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown, |
I bi,bj,k,iMin,iMax,jMin,jMax, |
39 |
I KappaRU, KappaRV, |
I KappaRU, KappaRV, |
40 |
U fVerU, fVerV, |
U fVerUkm, fVerVkm, |
41 |
|
O fVerUkp, fVerVkp, |
42 |
O guDiss, gvDiss, |
O guDiss, gvDiss, |
43 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid ) |
44 |
|
|
45 |
C !DESCRIPTION: |
C !DESCRIPTION: |
46 |
C Calculates all the horizontal accelerations except for the implicit surface |
C Calculates all the horizontal accelerations except for the implicit surface |
47 |
C pressure gradient and implciit vertical viscosity. |
C pressure gradient and implicit vertical viscosity. |
48 |
|
|
49 |
C !USES: =============================================================== |
C !USES: =============================================================== |
50 |
C == Global variables == |
C == Global variables == |
51 |
IMPLICIT NONE |
IMPLICIT NONE |
52 |
#include "SIZE.h" |
#include "SIZE.h" |
|
#include "DYNVARS.h" |
|
|
#include "FFIELDS.h" |
|
53 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
54 |
#include "PARAMS.h" |
#include "PARAMS.h" |
55 |
#include "GRID.h" |
#include "GRID.h" |
56 |
|
#include "DYNVARS.h" |
57 |
|
#include "FFIELDS.h" |
58 |
#include "SURFACE.h" |
#include "SURFACE.h" |
59 |
|
#ifdef ALLOW_MOM_COMMON |
60 |
|
# include "MOM_VISC.h" |
61 |
|
#endif |
62 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
63 |
|
# include "tamc.h" |
64 |
|
# include "tamc_keys.h" |
65 |
|
# include "MOM_FLUXFORM.h" |
66 |
|
#endif |
67 |
|
|
68 |
C !INPUT PARAMETERS: =================================================== |
C !INPUT PARAMETERS: =================================================== |
69 |
C bi,bj :: tile indices |
C bi,bj :: current tile indices |
70 |
C iMin,iMax,jMin,jMAx :: loop ranges |
C k :: current vertical level |
71 |
C k :: vertical level |
C iMin,iMax,jMin,jMax :: loop ranges |
|
C kUp :: =1 or 2 for consecutive k |
|
|
C kDown :: =2 or 1 for consecutive k |
|
72 |
C KappaRU :: vertical viscosity |
C KappaRU :: vertical viscosity |
73 |
C KappaRV :: vertical viscosity |
C KappaRV :: vertical viscosity |
74 |
C fVerU :: vertical flux of U, 2 1/2 dim for pipe-lining |
C fVerUkm :: vertical advective flux of U, interface above (k-1/2) |
75 |
C fVerV :: vertical flux of V, 2 1/2 dim for pipe-lining |
C fVerVkm :: vertical advective flux of V, interface above (k-1/2) |
76 |
|
C fVerUkp :: vertical advective flux of U, interface below (k+1/2) |
77 |
|
C fVerVkp :: vertical advective flux of V, interface below (k+1/2) |
78 |
C guDiss :: dissipation tendency (all explicit terms), u component |
C guDiss :: dissipation tendency (all explicit terms), u component |
79 |
C gvDiss :: dissipation tendency (all explicit terms), v component |
C gvDiss :: dissipation tendency (all explicit terms), v component |
80 |
C myTime :: current time |
C myTime :: current time |
81 |
C myIter :: current time-step number |
C myIter :: current time-step number |
82 |
C myThid :: thread number |
C myThid :: my Thread Id number |
83 |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
INTEGER bi,bj,k |
84 |
INTEGER k,kUp,kDown |
INTEGER iMin,iMax,jMin,jMax |
85 |
_RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
86 |
_RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
87 |
_RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerUkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
88 |
_RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerVkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
89 |
|
_RL fVerUkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
90 |
|
_RL fVerVkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
91 |
_RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
92 |
_RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
93 |
_RL myTime |
_RL myTime |
105 |
C mT :: Metric terms |
C mT :: Metric terms |
106 |
C fZon :: zonal fluxes |
C fZon :: zonal fluxes |
107 |
C fMer :: meridional fluxes |
C fMer :: meridional fluxes |
108 |
C fVrUp,fVrDw :: vertical viscous fluxes at interface k-1 & k |
C fVrUp,fVrDw :: vertical viscous fluxes at interface k & k+1 |
109 |
INTEGER i,j |
INTEGER i,j |
110 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
111 |
|
INTEGER imomkey |
112 |
|
#endif |
113 |
_RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
114 |
_RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
115 |
_RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
119 |
_RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
120 |
_RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
121 |
C afFacMom :: Tracer parameters for turning terms on and off. |
C afFacMom :: Tracer parameters for turning terms on and off. |
122 |
C vfFacMom |
C vfFacMom |
123 |
C pfFacMom afFacMom - Advective terms |
C pfFacMom afFacMom - Advective terms |
124 |
C cfFacMom vfFacMom - Eddy viscosity terms |
C cfFacMom vfFacMom - Eddy viscosity terms |
125 |
C mtFacMom pfFacMom - Pressure terms |
C mtFacMom pfFacMom - Pressure terms |
126 |
C cfFacMom - Coriolis terms |
C cfFacMom - Coriolis terms |
165 |
_RL mtFacV |
_RL mtFacV |
166 |
_RL mtNHFacV |
_RL mtNHFacV |
167 |
_RL sideMaskFac |
_RL sideMaskFac |
168 |
LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity |
LOGICAL bottomDragTerms |
169 |
CEOP |
CEOP |
170 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
171 |
|
COMMON / MOM_FLUXFORM_LOCAL / uBnd, vBnd |
172 |
|
_RL uBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
173 |
|
_RL vBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
174 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
175 |
|
|
176 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
177 |
|
act0 = k - 1 |
178 |
|
max0 = Nr |
179 |
|
act1 = bi - myBxLo(myThid) |
180 |
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
181 |
|
act2 = bj - myByLo(myThid) |
182 |
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
183 |
|
act3 = myThid - 1 |
184 |
|
max3 = nTx*nTy |
185 |
|
act4 = ikey_dynamics - 1 |
186 |
|
imomkey = (act0 + 1) |
187 |
|
& + act1*max0 |
188 |
|
& + act2*max0*max1 |
189 |
|
& + act3*max0*max1*max2 |
190 |
|
& + act4*max0*max1*max2*max3 |
191 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
192 |
|
|
193 |
C Initialise intermediate terms |
C Initialise intermediate terms |
194 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
203 |
fVrDw(i,j)= 0. |
fVrDw(i,j)= 0. |
204 |
rTransU(i,j)= 0. |
rTransU(i,j)= 0. |
205 |
rTransV(i,j)= 0. |
rTransV(i,j)= 0. |
206 |
|
c KE(i,j) = 0. |
207 |
|
hDiv(i,j) = 0. |
208 |
|
vort3(i,j) = 0. |
209 |
strain(i,j) = 0. |
strain(i,j) = 0. |
210 |
tension(i,j)= 0. |
tension(i,j)= 0. |
211 |
guDiss(i,j) = 0. |
guDiss(i,j) = 0. |
212 |
gvDiss(i,j) = 0. |
gvDiss(i,j) = 0. |
|
#ifdef ALLOW_AUTODIFF_TAMC |
|
|
vort3(i,j) = 0. _d 0 |
|
|
strain(i,j) = 0. _d 0 |
|
|
tension(i,j) = 0. _d 0 |
|
|
#endif |
|
213 |
ENDDO |
ENDDO |
214 |
ENDDO |
ENDDO |
215 |
|
|
263 |
C Calculate tracer cell face open areas |
C Calculate tracer cell face open areas |
264 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
265 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
266 |
xA(i,j) = _dyG(i,j,bi,bj) |
xA(i,j) = _dyG(i,j,bi,bj)*deepFacC(k) |
267 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
268 |
yA(i,j) = _dxG(i,j,bi,bj) |
yA(i,j) = _dxG(i,j,bi,bj)*deepFacC(k) |
269 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
270 |
ENDDO |
ENDDO |
271 |
ENDDO |
ENDDO |
272 |
|
|
279 |
ENDDO |
ENDDO |
280 |
|
|
281 |
C Calculate velocity field "volume transports" through tracer cell faces. |
C Calculate velocity field "volume transports" through tracer cell faces. |
282 |
|
C anelastic: transports are scaled by rhoFacC (~ mass transport) |
283 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
284 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
285 |
uTrans(i,j) = uFld(i,j)*xA(i,j) |
uTrans(i,j) = uFld(i,j)*xA(i,j)*rhoFacC(k) |
286 |
vTrans(i,j) = vFld(i,j)*yA(i,j) |
vTrans(i,j) = vFld(i,j)*yA(i,j)*rhoFacC(k) |
287 |
ENDDO |
ENDDO |
288 |
ENDDO |
ENDDO |
289 |
|
|
293 |
CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid) |
CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid) |
294 |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
295 |
CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid) |
CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid) |
296 |
DO j=1-Oly,sNy+Oly |
DO j=1-OLy,sNy+OLy |
297 |
DO i=1-Olx,sNx+Olx |
DO i=1-OLx,sNx+OLx |
298 |
IF ( hFacZ(i,j).EQ.0. ) THEN |
IF ( hFacZ(i,j).EQ.0. ) THEN |
299 |
vort3(i,j) = sideMaskFac*vort3(i,j) |
vort3(i,j) = sideMaskFac*vort3(i,j) |
300 |
strain(i,j) = sideMaskFac*strain(i,j) |
strain(i,j) = sideMaskFac*strain(i,j) |
311 |
#endif |
#endif |
312 |
ENDIF |
ENDIF |
313 |
|
|
314 |
C--- First call (k=1): compute vertical adv. flux fVerU(kUp) & fVerV(kUp) |
C--- First call (k=1): compute vertical adv. flux fVerUkm & fVerVkm |
315 |
IF (momAdvection.AND.k.EQ.1) THEN |
IF (momAdvection.AND.k.EQ.1) THEN |
316 |
|
|
317 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
318 |
|
CALL MOM_UV_BOUNDARY( bi, bj, k, |
319 |
|
I uVel, vVel, |
320 |
|
O uBnd(1-OLx,1-OLy,k,bi,bj), |
321 |
|
O vBnd(1-OLx,1-OLy,k,bi,bj), |
322 |
|
I myTime, myIter, myThid ) |
323 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
324 |
|
|
325 |
C- Calculate vertical transports above U & V points (West & South face): |
C- Calculate vertical transports above U & V points (West & South face): |
326 |
|
|
327 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
328 |
|
# ifdef NONLIN_FRSURF |
329 |
|
# ifndef DISABLE_RSTAR_CODE |
330 |
|
CADJ STORE dwtransc(:,:,bi,bj) = |
331 |
|
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte |
332 |
|
CADJ STORE dwtransu(:,:,bi,bj) = |
333 |
|
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte |
334 |
|
CADJ STORE dwtransv(:,:,bi,bj) = |
335 |
|
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte |
336 |
|
# endif |
337 |
|
# endif /* NONLIN_FRSURF */ |
338 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
339 |
CALL MOM_CALC_RTRANS( k, bi, bj, |
CALL MOM_CALC_RTRANS( k, bi, bj, |
340 |
O rTransU, rTransV, |
O rTransU, rTransV, |
341 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
342 |
|
|
343 |
C- Free surface correction term (flux at k=1) |
C- Free surface correction term (flux at k=1) |
344 |
CALL MOM_U_ADV_WU( bi,bj,k,uVel,wVel,rTransU, |
CALL MOM_U_ADV_WU( bi,bj,k,uVel,wVel,rTransU, |
345 |
O fVerU(1-OLx,1-OLy,kUp), myThid ) |
O fVerUkm, myThid ) |
346 |
|
|
347 |
CALL MOM_V_ADV_WV( bi,bj,k,vVel,wVel,rTransV, |
CALL MOM_V_ADV_WV( bi,bj,k,vVel,wVel,rTransV, |
348 |
O fVerV(1-OLx,1-OLy,kUp), myThid ) |
O fVerVkm, myThid ) |
349 |
|
|
350 |
C--- endif momAdvection & k=1 |
C--- endif momAdvection & k=1 |
351 |
ENDIF |
ENDIF |
358 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
359 |
ENDIF |
ENDIF |
360 |
|
|
361 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
362 |
|
IF ( momAdvection .AND. k.LT.Nr ) THEN |
363 |
|
CALL MOM_UV_BOUNDARY( bi, bj, k+1, |
364 |
|
I uVel, vVel, |
365 |
|
O uBnd(1-OLx,1-OLy,k+1,bi,bj), |
366 |
|
O vBnd(1-OLx,1-OLy,k+1,bi,bj), |
367 |
|
I myTime, myIter, myThid ) |
368 |
|
ENDIF |
369 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
370 |
|
|
371 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
372 |
CALL MOM_CALC_VISC( |
CALL MOM_CALC_VISC( bi, bj, k, |
373 |
I bi,bj,k, |
O viscAh_Z, viscAh_D, viscA4_Z, viscA4_D, |
374 |
O viscAh_Z,viscAh_D,viscA4_Z,viscA4_D, |
I hDiv, vort3, tension, strain, KE, hFacZ, |
375 |
O harmonic,biharmonic,useVariableViscosity, |
I myThid ) |
|
I hDiv,vort3,tension,strain,KE,hFacZ, |
|
|
I myThid) |
|
376 |
ENDIF |
ENDIF |
377 |
|
|
378 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
382 |
IF (momAdvection) THEN |
IF (momAdvection) THEN |
383 |
C--- Calculate mean fluxes (advection) between cells for zonal flow. |
C--- Calculate mean fluxes (advection) between cells for zonal flow. |
384 |
|
|
385 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
386 |
|
CALL MOM_U_ADV_UU( bi,bj,k,uTrans,uBnd(1-OLx,1-OLy,k,bi,bj), |
387 |
|
O fZon,myThid ) |
388 |
|
CALL MOM_U_ADV_VU( bi,bj,k,vTrans,uBnd(1-OLx,1-OLy,k,bi,bj), |
389 |
|
O fMer,myThid ) |
390 |
|
CALL MOM_U_ADV_WU( |
391 |
|
I bi,bj,k+1,uBnd,wVel,rTransU, |
392 |
|
O fVerUkp, myThid ) |
393 |
|
#else /* MOM_BOUNDARY_CONSERVE */ |
394 |
C-- Zonal flux (fZon is at east face of "u" cell) |
C-- Zonal flux (fZon is at east face of "u" cell) |
395 |
C Mean flow component of zonal flux -> fZon |
C Mean flow component of zonal flux -> fZon |
396 |
CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid) |
CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid) |
403 |
C Mean flow component of vertical flux (at k+1) -> fVer |
C Mean flow component of vertical flux (at k+1) -> fVer |
404 |
CALL MOM_U_ADV_WU( |
CALL MOM_U_ADV_WU( |
405 |
I bi,bj,k+1,uVel,wVel,rTransU, |
I bi,bj,k+1,uVel,wVel,rTransU, |
406 |
O fVerU(1-OLx,1-OLy,kDown), myThid ) |
O fVerUkp, myThid ) |
407 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
408 |
|
|
409 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
410 |
DO j=jMin,jMax |
DO j=jMin,jMax |
415 |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
416 |
#else |
#else |
417 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
418 |
& *recip_rAw(i,j,bi,bj) |
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k) |
419 |
#endif |
#endif |
420 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac |
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac |
421 |
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac |
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac |
422 |
& +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac |
& +( fVerUkp(i,j) - fVerUkm(i,j) )*rkSign*rVelDudrFac |
423 |
& ) |
& ) |
424 |
ENDDO |
ENDDO |
425 |
ENDDO |
ENDDO |
426 |
|
|
427 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
428 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
429 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Um ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Um ',k,1,2,bi,bj,myThid) |
430 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Um ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Um ',k,1,2,bi,bj,myThid) |
431 |
CALL DIAGNOSTICS_FILL(fVerU(1-Olx,1-Oly,kUp), |
CALL DIAGNOSTICS_FILL(fVerUkm,'ADVrE_Um',k,1,2,bi,bj,myThid) |
|
& 'ADVrE_Um',k,1,2,bi,bj,myThid) |
|
432 |
ENDIF |
ENDIF |
433 |
#endif |
#endif |
434 |
|
|
455 |
# endif /* DISABLE_RSTAR_CODE */ |
# endif /* DISABLE_RSTAR_CODE */ |
456 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
457 |
|
|
458 |
|
#ifdef ALLOW_ADDFLUID |
459 |
|
IF ( selectAddFluid.GE.1 ) THEN |
460 |
|
DO j=jMin,jMax |
461 |
|
DO i=iMin,iMax |
462 |
|
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
463 |
|
& + uVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0 |
464 |
|
& *( addMass(i-1,j,k,bi,bj) + addMass(i,j,k,bi,bj) ) |
465 |
|
& *_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k) |
466 |
|
& * recip_rAw(i,j,bi,bj)*recip_deepFac2C(k) |
467 |
|
ENDDO |
468 |
|
ENDDO |
469 |
|
ENDIF |
470 |
|
#endif /* ALLOW_ADDFLUID */ |
471 |
|
|
472 |
ELSE |
ELSE |
473 |
C- if momAdvection / else |
C- if momAdvection / else |
474 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
484 |
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow. |
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow. |
485 |
|
|
486 |
C Bi-harmonic term del^2 U -> v4F |
C Bi-harmonic term del^2 U -> v4F |
487 |
IF (biharmonic) |
IF ( useBiharmonicVisc ) |
488 |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
489 |
|
|
490 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
502 |
ENDIF |
ENDIF |
503 |
|
|
504 |
C-- Tendency is minus divergence of the fluxes |
C-- Tendency is minus divergence of the fluxes |
505 |
|
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is) |
506 |
DO j=jMin,jMax |
DO j=jMin,jMax |
507 |
DO i=iMin,iMax |
DO i=iMin,iMax |
508 |
guDiss(i,j) = |
guDiss(i,j) = |
511 |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
512 |
#else |
#else |
513 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
514 |
& *recip_rAw(i,j,bi,bj) |
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k) |
515 |
#endif |
#endif |
516 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac |
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac |
517 |
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac |
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac |
518 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac |
519 |
|
& *recip_rhoFacC(k) |
520 |
& ) |
& ) |
521 |
ENDDO |
ENDDO |
522 |
ENDDO |
ENDDO |
530 |
ENDIF |
ENDIF |
531 |
#endif |
#endif |
532 |
|
|
533 |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
534 |
IF (no_slip_sides) THEN |
IF (no_slip_sides) THEN |
535 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
536 |
CALL MOM_U_SIDEDRAG( |
CALL MOM_U_SIDEDRAG( bi, bj, k, |
|
I bi,bj,k, |
|
537 |
I uFld, v4f, hFacZ, |
I uFld, v4f, hFacZ, |
538 |
I viscAh_Z,viscA4_Z, |
I viscAh_Z, viscA4_Z, |
539 |
I harmonic,biharmonic,useVariableViscosity, |
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc, |
540 |
O vF, |
O vF, |
541 |
I myThid) |
I myThid ) |
542 |
DO j=jMin,jMax |
DO j=jMin,jMax |
543 |
DO i=iMin,iMax |
DO i=iMin,iMax |
544 |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
609 |
C---- Meridional momentum equation starts here |
C---- Meridional momentum equation starts here |
610 |
|
|
611 |
IF (momAdvection) THEN |
IF (momAdvection) THEN |
612 |
|
|
613 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
614 |
|
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vBnd(1-OLx,1-OLy,k,bi,bj), |
615 |
|
O fZon,myThid ) |
616 |
|
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vBnd(1-OLx,1-OLy,k,bi,bj), |
617 |
|
O fMer,myThid ) |
618 |
|
CALL MOM_V_ADV_WV( bi,bj,k+1,vBnd,wVel,rTransV, |
619 |
|
O fVerVkp, myThid ) |
620 |
|
#else /* MOM_BOUNDARY_CONSERVE */ |
621 |
C--- Calculate mean fluxes (advection) between cells for meridional flow. |
C--- Calculate mean fluxes (advection) between cells for meridional flow. |
622 |
C Mean flow component of zonal flux -> fZon |
C Mean flow component of zonal flux -> fZon |
623 |
CALL MOM_V_ADV_UV(bi,bj,k,uTrans,vFld,fZon,myThid) |
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vFld,fZon,myThid ) |
624 |
|
|
625 |
C-- Meridional flux (fMer is at north face of "v" cell) |
C-- Meridional flux (fMer is at north face of "v" cell) |
626 |
C Mean flow component of meridional flux -> fMer |
C Mean flow component of meridional flux -> fMer |
627 |
CALL MOM_V_ADV_VV(bi,bj,k,vTrans,vFld,fMer,myThid) |
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vFld,fMer,myThid ) |
628 |
|
|
629 |
C-- Vertical flux (fVer is at upper face of "v" cell) |
C-- Vertical flux (fVer is at upper face of "v" cell) |
630 |
C Mean flow component of vertical flux (at k+1) -> fVerV |
C Mean flow component of vertical flux (at k+1) -> fVerV |
631 |
CALL MOM_V_ADV_WV( |
CALL MOM_V_ADV_WV( bi,bj,k+1,vVel,wVel,rTransV, |
632 |
I bi,bj,k+1,vVel,wVel,rTransV, |
O fVerVkp, myThid ) |
633 |
O fVerV(1-OLx,1-OLy,kDown), myThid ) |
#endif /* MOM_BOUNDARY_CONSERVE */ |
634 |
|
|
635 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
636 |
DO j=jMin,jMax |
DO j=jMin,jMax |
641 |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
642 |
#else |
#else |
643 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
644 |
& *recip_rAs(i,j,bi,bj) |
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k) |
645 |
#endif |
#endif |
646 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac |
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac |
647 |
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac |
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac |
648 |
& +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac |
& +( fVerVkp(i,j) - fVerVkm(i,j) )*rkSign*rVelDvdrFac |
649 |
& ) |
& ) |
650 |
ENDDO |
ENDDO |
651 |
ENDDO |
ENDDO |
652 |
|
|
653 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
654 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
655 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Vm ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Vm ',k,1,2,bi,bj,myThid) |
656 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Vm ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Vm ',k,1,2,bi,bj,myThid) |
657 |
CALL DIAGNOSTICS_FILL(fVerV(1-Olx,1-Oly,kUp), |
CALL DIAGNOSTICS_FILL(fVerVkm,'ADVrE_Vm',k,1,2,bi,bj,myThid) |
|
& 'ADVrE_Vm',k,1,2,bi,bj,myThid) |
|
658 |
ENDIF |
ENDIF |
659 |
#endif |
#endif |
660 |
|
|
681 |
# endif /* DISABLE_RSTAR_CODE */ |
# endif /* DISABLE_RSTAR_CODE */ |
682 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
683 |
|
|
684 |
|
#ifdef ALLOW_ADDFLUID |
685 |
|
IF ( selectAddFluid.GE.1 ) THEN |
686 |
|
DO j=jMin,jMax |
687 |
|
DO i=iMin,iMax |
688 |
|
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
689 |
|
& + vVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0 |
690 |
|
& *( addMass(i,j-1,k,bi,bj) + addMass(i,j,k,bi,bj) ) |
691 |
|
& *_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k) |
692 |
|
& * recip_rAs(i,j,bi,bj)*recip_deepFac2C(k) |
693 |
|
ENDDO |
694 |
|
ENDDO |
695 |
|
ENDIF |
696 |
|
#endif /* ALLOW_ADDFLUID */ |
697 |
|
|
698 |
ELSE |
ELSE |
699 |
C- if momAdvection / else |
C- if momAdvection / else |
700 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
709 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
710 |
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow. |
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow. |
711 |
C Bi-harmonic term del^2 V -> v4F |
C Bi-harmonic term del^2 V -> v4F |
712 |
IF (biharmonic) |
IF ( useBiharmonicVisc ) |
713 |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
714 |
|
|
715 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
727 |
ENDIF |
ENDIF |
728 |
|
|
729 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
730 |
|
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is) |
731 |
DO j=jMin,jMax |
DO j=jMin,jMax |
732 |
DO i=iMin,iMax |
DO i=iMin,iMax |
733 |
gvDiss(i,j) = |
gvDiss(i,j) = |
736 |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
737 |
#else |
#else |
738 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
739 |
& *recip_rAs(i,j,bi,bj) |
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k) |
740 |
#endif |
#endif |
741 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac |
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac |
742 |
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac |
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac |
743 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac |
744 |
|
& *recip_rhoFacC(k) |
745 |
& ) |
& ) |
746 |
ENDDO |
ENDDO |
747 |
ENDDO |
ENDDO |
755 |
ENDIF |
ENDIF |
756 |
#endif |
#endif |
757 |
|
|
758 |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
759 |
IF (no_slip_sides) THEN |
IF (no_slip_sides) THEN |
760 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
761 |
CALL MOM_V_SIDEDRAG( |
CALL MOM_V_SIDEDRAG( bi, bj, k, |
|
I bi,bj,k, |
|
762 |
I vFld, v4f, hFacZ, |
I vFld, v4f, hFacZ, |
763 |
I viscAh_Z,viscA4_Z, |
I viscAh_Z,viscA4_Z, |
764 |
I harmonic,biharmonic,useVariableViscosity, |
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc, |
765 |
O vF, |
O vF, |
766 |
I myThid) |
I myThid ) |
767 |
DO j=jMin,jMax |
DO j=jMin,jMax |
768 |
DO i=iMin,iMax |
DO i=iMin,iMax |
769 |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
782 |
|
|
783 |
#ifdef ALLOW_SHELFICE |
#ifdef ALLOW_SHELFICE |
784 |
IF (useShelfIce) THEN |
IF (useShelfIce) THEN |
785 |
CALL SHELFICE_V_DRAG(bi,bj,k,vFld,KE,KappaRU,vF,myThid) |
CALL SHELFICE_V_DRAG(bi,bj,k,vFld,KE,KappaRV,vF,myThid) |
786 |
DO j=jMin,jMax |
DO j=jMin,jMax |
787 |
DO i=iMin,iMax |
DO i=iMin,iMax |
788 |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
859 |
#endif |
#endif |
860 |
ENDIF |
ENDIF |
861 |
|
|
862 |
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -f'*w) |
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -fprime*w) |
863 |
IF ( nonHydrostatic.OR.quasiHydrostatic ) THEN |
IF ( use3dCoriolis ) THEN |
864 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
865 |
DO j=jMin,jMax |
DO j=jMin,jMax |
866 |
DO i=iMin,iMax |
DO i=iMin,iMax |
891 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
892 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
893 |
CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid) |
894 |
CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj), |
CALL DIAGNOSTICS_FILL(gU(1-OLx,1-OLy,k,bi,bj), |
895 |
& 'Um_Advec',k,1,2,bi,bj,myThid) |
& 'Um_Advec',k,1,2,bi,bj,myThid) |
896 |
CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj), |
CALL DIAGNOSTICS_FILL(gV(1-OLx,1-OLy,k,bi,bj), |
897 |
& 'Vm_Advec',k,1,2,bi,bj,myThid) |
& 'Vm_Advec',k,1,2,bi,bj,myThid) |
898 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
899 |
CALL DIAGNOSTICS_FILL(guDiss,'Um_Diss ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL(guDiss,'Um_Diss ',k,1,2,bi,bj,myThid) |