25 |
C stresses as well as internal viscous stresses. |
C stresses as well as internal viscous stresses. |
26 |
CEOI |
CEOI |
27 |
|
|
28 |
#include "CPP_OPTIONS.h" |
#include "MOM_FLUXFORM_OPTIONS.h" |
29 |
|
|
30 |
CBOP |
CBOP |
31 |
C !ROUTINE: MOM_FLUXFORM |
C !ROUTINE: MOM_FLUXFORM |
33 |
C !INTERFACE: ========================================================== |
C !INTERFACE: ========================================================== |
34 |
SUBROUTINE MOM_FLUXFORM( |
SUBROUTINE MOM_FLUXFORM( |
35 |
I bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown, |
36 |
I phi_hyd,KappaRU,KappaRV, |
I dPhihydX,dPhiHydY,KappaRU,KappaRV, |
37 |
U fVerU, fVerV, |
U fVerU, fVerV, |
38 |
I myCurrentTime,myIter,myThid) |
I myTime,myIter,myThid) |
39 |
|
|
40 |
C !DESCRIPTION: |
C !DESCRIPTION: |
41 |
C Calculates all the horizontal accelerations except for the implicit surface |
C Calculates all the horizontal accelerations except for the implicit surface |
58 |
C k :: vertical level |
C k :: vertical level |
59 |
C kUp :: =1 or 2 for consecutive k |
C kUp :: =1 or 2 for consecutive k |
60 |
C kDown :: =2 or 1 for consecutive k |
C kDown :: =2 or 1 for consecutive k |
61 |
C phi_hyd :: hydrostatic pressure (perturbation) |
C dPhiHydX,Y :: Gradient (X & Y dir.) of Hydrostatic Potential |
62 |
C KappaRU :: vertical viscosity |
C KappaRU :: vertical viscosity |
63 |
C KappaRV :: vertical viscosity |
C KappaRV :: vertical viscosity |
64 |
C fVerU :: vertical flux of U, 2 1/2 dim for pipe-lining |
C fVerU :: vertical flux of U, 2 1/2 dim for pipe-lining |
65 |
C fVerV :: vertical flux of V, 2 1/2 dim for pipe-lining |
C fVerV :: vertical flux of V, 2 1/2 dim for pipe-lining |
66 |
C myCurrentTime :: current time |
C myTime :: current time |
67 |
C myIter :: current time-step number |
C myIter :: current time-step number |
68 |
C myThid :: thread number |
C myThid :: thread number |
69 |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
70 |
INTEGER k,kUp,kDown |
INTEGER k,kUp,kDown |
71 |
_RL phi_hyd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL dPhiHydX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
|
_RL dPhiHydY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
73 |
_RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
74 |
_RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
75 |
_RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
76 |
_RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
_RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
77 |
_RL myCurrentTime |
_RL myTime |
78 |
INTEGER myIter |
INTEGER myIter |
79 |
INTEGER myThid |
INTEGER myThid |
80 |
|
|
120 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
121 |
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
122 |
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
123 |
|
_RL rTransU(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
124 |
|
_RL rTransV(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
125 |
C I,J,K - Loop counters |
C I,J,K - Loop counters |
126 |
C rVelMaskOverride - Factor for imposing special surface boundary conditions |
C rVelMaskOverride - Factor for imposing special surface boundary conditions |
127 |
C ( set according to free-surface condition ). |
C ( set according to free-surface condition ). |
177 |
pF(i,j) = 0. |
pF(i,j) = 0. |
178 |
fZon(i,j) = 0. |
fZon(i,j) = 0. |
179 |
fMer(i,j) = 0. |
fMer(i,j) = 0. |
180 |
|
rTransU(i,j) = 0. |
181 |
|
rTransV(i,j) = 0. |
182 |
ENDDO |
ENDDO |
183 |
ENDDO |
ENDDO |
184 |
|
|
255 |
|
|
256 |
CALL MOM_CALC_KE(bi,bj,k,uFld,vFld,KE,myThid) |
CALL MOM_CALC_KE(bi,bj,k,uFld,vFld,KE,myThid) |
257 |
|
|
258 |
|
C--- First call (k=1): compute vertical adv. flux fVerU(kUp) & fVerV(kUp) |
259 |
|
IF (momAdvection.AND.k.EQ.1) THEN |
260 |
|
|
261 |
|
C- Calculate vertical transports above U & V points (West & South face): |
262 |
|
CALL MOM_CALC_RTRANS( k, bi, bj, |
263 |
|
O rTransU, rTransV, |
264 |
|
I myTime, myIter, myThid) |
265 |
|
|
266 |
|
C- Free surface correction term (flux at k=1) |
267 |
|
CALL MOM_U_ADV_WU(bi,bj,k,uVel,wVel,rTransU,af,myThid) |
268 |
|
DO j=jMin,jMax |
269 |
|
DO i=iMin,iMax |
270 |
|
fVerU(i,j,kUp) = af(i,j) |
271 |
|
ENDDO |
272 |
|
ENDDO |
273 |
|
|
274 |
|
CALL MOM_V_ADV_WV(bi,bj,k,vVel,wVel,rTransV,af,myThid) |
275 |
|
DO j=jMin,jMax |
276 |
|
DO i=iMin,iMax |
277 |
|
fVerV(i,j,kUp) = af(i,j) |
278 |
|
ENDDO |
279 |
|
ENDDO |
280 |
|
|
281 |
|
C--- endif momAdvection & k=1 |
282 |
|
ENDIF |
283 |
|
|
284 |
|
|
285 |
|
C--- Calculate vertical transports (at k+1) below U & V points : |
286 |
|
IF (momAdvection) THEN |
287 |
|
CALL MOM_CALC_RTRANS( k+1, bi, bj, |
288 |
|
O rTransU, rTransV, |
289 |
|
I myTime, myIter, myThid) |
290 |
|
ENDIF |
291 |
|
|
292 |
|
|
293 |
C---- Zonal momentum equation starts here |
C---- Zonal momentum equation starts here |
294 |
|
|
295 |
C Bi-harmonic term del^2 U -> v4F |
C Bi-harmonic term del^2 U -> v4F |
296 |
IF (momViscosity) |
IF (momViscosity .AND. viscA4.NE.0. ) |
297 |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
298 |
|
|
299 |
C--- Calculate mean and eddy fluxes between cells for zonal flow. |
C--- Calculate mean and eddy fluxes between cells for zonal flow. |
326 |
& CALL MOM_U_YVISCFLUX(bi,bj,k,uFld,v4F,hFacZ,vF,myThid) |
& CALL MOM_U_YVISCFLUX(bi,bj,k,uFld,v4F,hFacZ,vF,myThid) |
327 |
|
|
328 |
C Combine fluxes -> fMer |
C Combine fluxes -> fMer |
329 |
DO j=jMin,jMax |
DO j=jMin,jMax+1 |
330 |
DO i=iMin,iMax |
DO i=iMin,iMax |
331 |
fMer(i,j) = vDudyFac*aF(i,j) + AhDudyFac*vF(i,j) |
fMer(i,j) = vDudyFac*aF(i,j) + AhDudyFac*vF(i,j) |
332 |
ENDDO |
ENDDO |
334 |
|
|
335 |
C-- Vertical flux (fVer is at upper face of "u" cell) |
C-- Vertical flux (fVer is at upper face of "u" cell) |
336 |
|
|
|
C-- Free surface correction term (flux at k=1) |
|
|
IF (momAdvection.AND.k.EQ.1) THEN |
|
|
CALL MOM_U_ADV_WU(bi,bj,k,uVel,wVel,af,myThid) |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
fVerU(i,j,kUp) = af(i,j) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
337 |
C Mean flow component of vertical flux (at k+1) -> aF |
C Mean flow component of vertical flux (at k+1) -> aF |
338 |
IF (momAdvection) |
IF (momAdvection) |
339 |
& CALL MOM_U_ADV_WU(bi,bj,k+1,uVel,wVel,af,myThid) |
& CALL MOM_U_ADV_WU(bi,bj,k+1,uVel,wVel,rTransU,af,myThid) |
340 |
|
|
341 |
C Eddy component of vertical flux (interior component only) -> vrF |
C Eddy component of vertical flux (interior component only) -> vrF |
342 |
IF (momViscosity.AND..NOT.implicitViscosity) |
IF (momViscosity.AND..NOT.implicitViscosity) |
349 |
ENDDO |
ENDDO |
350 |
ENDDO |
ENDDO |
351 |
|
|
|
C--- Hydrostatic term ( -1/rhoConst . dphi/dx ) |
|
|
IF (momPressureForcing) THEN |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
pf(i,j) = - _recip_dxC(i,j,bi,bj) |
|
|
& *(phi_hyd(i,j,k)-phi_hyd(i-1,j,k)) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
|
|
|
352 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
353 |
DO j=jMin,jMax |
DO j=jMin,jMax |
354 |
DO i=iMin,iMax |
DO i=iMin,iMax |
364 |
& +fMer(i,j+1) - fMer(i ,j) |
& +fMer(i,j+1) - fMer(i ,j) |
365 |
& +fVerU(i,j,kUp)*rkFac - fVerU(i,j,kDown)*rkFac |
& +fVerU(i,j,kUp)*rkFac - fVerU(i,j,kDown)*rkFac |
366 |
& ) |
& ) |
367 |
& _PHM( +phxFac * pf(i,j) ) |
& - phxFac*dPhiHydX(i,j) |
368 |
ENDDO |
ENDDO |
369 |
ENDDO |
ENDDO |
370 |
|
|
371 |
|
#ifdef NONLIN_FRSURF |
372 |
|
C-- account for 3.D divergence of the flow in rStar coordinate: |
373 |
|
IF ( momAdvection .AND. select_rStar.GT.0 ) THEN |
374 |
|
DO j=jMin,jMax |
375 |
|
DO i=iMin,iMax |
376 |
|
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
377 |
|
& - (rStarExpW(i,j,bi,bj) - 1. _d 0)/deltaTfreesurf |
378 |
|
& *uVel(i,j,k,bi,bj) |
379 |
|
ENDDO |
380 |
|
ENDDO |
381 |
|
ENDIF |
382 |
|
IF ( momAdvection .AND. select_rStar.LT.0 ) THEN |
383 |
|
DO j=jMin,jMax |
384 |
|
DO i=iMin,iMax |
385 |
|
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
386 |
|
& - rStarDhWDt(i,j,bi,bj)*uVel(i,j,k,bi,bj) |
387 |
|
ENDDO |
388 |
|
ENDDO |
389 |
|
ENDIF |
390 |
|
#endif /* NONLIN_FRSURF */ |
391 |
|
|
392 |
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 |
393 |
IF (momViscosity.AND.no_slip_sides) THEN |
IF (momViscosity.AND.no_slip_sides) THEN |
394 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
409 |
ENDDO |
ENDDO |
410 |
ENDIF |
ENDIF |
411 |
|
|
412 |
C-- Forcing term |
C-- Forcing term (moved to timestep.F) |
413 |
IF (momForcing) |
c IF (momForcing) |
414 |
& CALL EXTERNAL_FORCING_U( |
c & CALL EXTERNAL_FORCING_U( |
415 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
416 |
I myCurrentTime,myThid) |
c I myTime,myThid) |
417 |
|
|
418 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
419 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
445 |
C---- Meridional momentum equation starts here |
C---- Meridional momentum equation starts here |
446 |
|
|
447 |
C Bi-harmonic term del^2 V -> v4F |
C Bi-harmonic term del^2 V -> v4F |
448 |
IF (momViscosity) |
IF (momViscosity .AND. viscA4.NE.0. ) |
449 |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
450 |
|
|
451 |
C--- Calculate mean and eddy fluxes between cells for meridional flow. |
C--- Calculate mean and eddy fluxes between cells for meridional flow. |
462 |
|
|
463 |
C Combine fluxes -> fZon |
C Combine fluxes -> fZon |
464 |
DO j=jMin,jMax |
DO j=jMin,jMax |
465 |
DO i=iMin,iMax |
DO i=iMin,iMax+1 |
466 |
fZon(i,j) = uDvdxFac*aF(i,j) + AhDvdxFac*vF(i,j) |
fZon(i,j) = uDvdxFac*aF(i,j) + AhDvdxFac*vF(i,j) |
467 |
ENDDO |
ENDDO |
468 |
ENDDO |
ENDDO |
486 |
|
|
487 |
C-- Vertical flux (fVer is at upper face of "v" cell) |
C-- Vertical flux (fVer is at upper face of "v" cell) |
488 |
|
|
|
C-- Free surface correction term (flux at k=1) |
|
|
IF (momAdvection.AND.k.EQ.1) THEN |
|
|
CALL MOM_V_ADV_WV(bi,bj,k,vVel,wVel,af,myThid) |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
fVerV(i,j,kUp) = af(i,j) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
489 |
C o Mean flow component of vertical flux |
C o Mean flow component of vertical flux |
490 |
IF (momAdvection) |
IF (momAdvection) |
491 |
& CALL MOM_V_ADV_WV(bi,bj,k+1,vVel,wVel,af,myThid) |
& CALL MOM_V_ADV_WV(bi,bj,k+1,vVel,wVel,rTransV,af,myThid) |
492 |
|
|
493 |
C Eddy component of vertical flux (interior component only) -> vrF |
C Eddy component of vertical flux (interior component only) -> vrF |
494 |
IF (momViscosity.AND..NOT.implicitViscosity) |
IF (momViscosity.AND..NOT.implicitViscosity) |
501 |
ENDDO |
ENDDO |
502 |
ENDDO |
ENDDO |
503 |
|
|
|
C--- Hydorstatic term (-1/rhoConst . dphi/dy ) |
|
|
IF (momPressureForcing) THEN |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
pF(i,j) = -_recip_dyC(i,j,bi,bj) |
|
|
& *(phi_hyd(i,j,k)-phi_hyd(i,j-1,k)) |
|
|
ENDDO |
|
|
ENDDO |
|
|
ENDIF |
|
|
|
|
504 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
505 |
DO j=jMin,jMax |
DO j=jMin,jMax |
506 |
DO i=iMin,iMax |
DO i=iMin,iMax |
516 |
& +fMer(i,j ) - fMer(i,j-1) |
& +fMer(i,j ) - fMer(i,j-1) |
517 |
& +fVerV(i,j,kUp)*rkFac - fVerV(i,j,kDown)*rkFac |
& +fVerV(i,j,kUp)*rkFac - fVerV(i,j,kDown)*rkFac |
518 |
& ) |
& ) |
519 |
& _PHM( +phyFac*pf(i,j) ) |
& - phyFac*dPhiHydY(i,j) |
520 |
ENDDO |
ENDDO |
521 |
ENDDO |
ENDDO |
522 |
|
|
523 |
|
#ifdef NONLIN_FRSURF |
524 |
|
C-- account for 3.D divergence of the flow in rStar coordinate: |
525 |
|
IF ( momAdvection .AND. select_rStar.GT.0 ) THEN |
526 |
|
DO j=jMin,jMax |
527 |
|
DO i=iMin,iMax |
528 |
|
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
529 |
|
& - (rStarExpS(i,j,bi,bj) - 1. _d 0)/deltaTfreesurf |
530 |
|
& *vVel(i,j,k,bi,bj) |
531 |
|
ENDDO |
532 |
|
ENDDO |
533 |
|
ENDIF |
534 |
|
IF ( momAdvection .AND. select_rStar.LT.0 ) THEN |
535 |
|
DO j=jMin,jMax |
536 |
|
DO i=iMin,iMax |
537 |
|
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
538 |
|
& - rStarDhSDt(i,j,bi,bj)*vVel(i,j,k,bi,bj) |
539 |
|
ENDDO |
540 |
|
ENDDO |
541 |
|
ENDIF |
542 |
|
#endif /* NONLIN_FRSURF */ |
543 |
|
|
544 |
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 |
545 |
IF (momViscosity.AND.no_slip_sides) THEN |
IF (momViscosity.AND.no_slip_sides) THEN |
546 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
561 |
ENDDO |
ENDDO |
562 |
ENDIF |
ENDIF |
563 |
|
|
564 |
C-- Forcing term |
C-- Forcing term (moved to timestep.F) |
565 |
IF (momForcing) |
c IF (momForcing) |
566 |
& CALL EXTERNAL_FORCING_V( |
c & CALL EXTERNAL_FORCING_V( |
567 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
568 |
I myCurrentTime,myThid) |
c I myTime,myThid) |
569 |
|
|
570 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
571 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
595 |
|
|
596 |
C-- Coriolis term |
C-- Coriolis term |
597 |
C Note. As coded here, coriolis will not work with "thin walls" |
C Note. As coded here, coriolis will not work with "thin walls" |
598 |
#ifdef INCLUDE_CD_CODE |
c IF (useCDscheme) THEN |
599 |
CALL MOM_CDSCHEME(bi,bj,k,phi_hyd,myThid) |
c CALL MOM_CDSCHEME(bi,bj,k,dPhiHydX,dPhiHydY,myThid) |
600 |
#else |
c ELSE |
601 |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
IF (.NOT.useCDscheme) THEN |
602 |
DO j=jMin,jMax |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
603 |
DO i=iMin,iMax |
DO j=jMin,jMax |
604 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
DO i=iMin,iMax |
605 |
ENDDO |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
606 |
ENDDO |
ENDDO |
607 |
CALL MOM_V_CORIOLIS(bi,bj,k,uFld,cf,myThid) |
ENDDO |
608 |
DO j=jMin,jMax |
CALL MOM_V_CORIOLIS(bi,bj,k,uFld,cf,myThid) |
609 |
DO i=iMin,iMax |
DO j=jMin,jMax |
610 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
DO i=iMin,iMax |
611 |
ENDDO |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
612 |
ENDDO |
ENDDO |
613 |
#endif /* INCLUDE_CD_CODE */ |
ENDDO |
614 |
|
ENDIF |
615 |
|
|
616 |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
617 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
618 |
DO j=jMin,jMax |
DO j=jMin,jMax |