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,dPhihydX,dPhiHydY,KappaRU,KappaRV, |
I dPhihydX,dPhiHydY,KappaRU,KappaRV, |
37 |
U fVerU, fVerV, |
U fVerU, fVerV, |
38 |
I myTime,myIter,myThid) |
I myTime,myIter,myThid) |
39 |
|
|
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 |
|
C phi_hyd :: hydrostatic pressure (perturbation) |
|
61 |
C dPhiHydX,Y :: Gradient (X & Y dir.) of Hydrostatic Potential |
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 |
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 |
|
_RL phi_hyd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
|
71 |
_RL dPhiHydX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dPhiHydX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
_RL dPhiHydY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_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) |
179 |
fMer(i,j) = 0. |
fMer(i,j) = 0. |
180 |
rTransU(i,j) = 0. |
rTransU(i,j) = 0. |
181 |
rTransV(i,j) = 0. |
rTransV(i,j) = 0. |
182 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
183 |
|
C- jmc: this is wrong, but at least with #ifdef/endif TAMC, it does not break |
184 |
|
C the forward code ; (same thing in mom_vectinv) |
185 |
|
fVerU(i,j,1) = 0. _d 0 |
186 |
|
fVerU(i,j,2) = 0. _d 0 |
187 |
|
fVerV(i,j,1) = 0. _d 0 |
188 |
|
fVerV(i,j,2) = 0. _d 0 |
189 |
|
#endif |
190 |
ENDDO |
ENDDO |
191 |
ENDDO |
ENDDO |
192 |
|
|
301 |
C---- Zonal momentum equation starts here |
C---- Zonal momentum equation starts here |
302 |
|
|
303 |
C Bi-harmonic term del^2 U -> v4F |
C Bi-harmonic term del^2 U -> v4F |
304 |
IF (momViscosity) |
IF (momViscosity .AND. viscA4.NE.0. ) |
305 |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
306 |
|
|
307 |
C--- Calculate mean and eddy fluxes between cells for zonal flow. |
C--- Calculate mean and eddy fluxes between cells for zonal flow. |
334 |
& CALL MOM_U_YVISCFLUX(bi,bj,k,uFld,v4F,hFacZ,vF,myThid) |
& CALL MOM_U_YVISCFLUX(bi,bj,k,uFld,v4F,hFacZ,vF,myThid) |
335 |
|
|
336 |
C Combine fluxes -> fMer |
C Combine fluxes -> fMer |
337 |
DO j=jMin,jMax |
DO j=jMin,jMax+1 |
338 |
DO i=iMin,iMax |
DO i=iMin,iMax |
339 |
fMer(i,j) = vDudyFac*aF(i,j) + AhDudyFac*vF(i,j) |
fMer(i,j) = vDudyFac*aF(i,j) + AhDudyFac*vF(i,j) |
340 |
ENDDO |
ENDDO |
417 |
ENDDO |
ENDDO |
418 |
ENDIF |
ENDIF |
419 |
|
|
420 |
C-- Forcing term |
C-- Forcing term (moved to timestep.F) |
421 |
IF (momForcing) |
c IF (momForcing) |
422 |
& CALL EXTERNAL_FORCING_U( |
c & CALL EXTERNAL_FORCING_U( |
423 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
424 |
I myTime,myThid) |
c I myTime,myThid) |
425 |
|
|
426 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
427 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
453 |
C---- Meridional momentum equation starts here |
C---- Meridional momentum equation starts here |
454 |
|
|
455 |
C Bi-harmonic term del^2 V -> v4F |
C Bi-harmonic term del^2 V -> v4F |
456 |
IF (momViscosity) |
IF (momViscosity .AND. viscA4.NE.0. ) |
457 |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
458 |
|
|
459 |
C--- Calculate mean and eddy fluxes between cells for meridional flow. |
C--- Calculate mean and eddy fluxes between cells for meridional flow. |
470 |
|
|
471 |
C Combine fluxes -> fZon |
C Combine fluxes -> fZon |
472 |
DO j=jMin,jMax |
DO j=jMin,jMax |
473 |
DO i=iMin,iMax |
DO i=iMin,iMax+1 |
474 |
fZon(i,j) = uDvdxFac*aF(i,j) + AhDvdxFac*vF(i,j) |
fZon(i,j) = uDvdxFac*aF(i,j) + AhDvdxFac*vF(i,j) |
475 |
ENDDO |
ENDDO |
476 |
ENDDO |
ENDDO |
569 |
ENDDO |
ENDDO |
570 |
ENDIF |
ENDIF |
571 |
|
|
572 |
C-- Forcing term |
C-- Forcing term (moved to timestep.F) |
573 |
IF (momForcing) |
c IF (momForcing) |
574 |
& CALL EXTERNAL_FORCING_V( |
c & CALL EXTERNAL_FORCING_V( |
575 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
576 |
I myTime,myThid) |
c I myTime,myThid) |
577 |
|
|
578 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
579 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
603 |
|
|
604 |
C-- Coriolis term |
C-- Coriolis term |
605 |
C Note. As coded here, coriolis will not work with "thin walls" |
C Note. As coded here, coriolis will not work with "thin walls" |
606 |
#ifdef INCLUDE_CD_CODE |
c IF (useCDscheme) THEN |
607 |
CALL MOM_CDSCHEME(bi,bj,k,phi_hyd,dPhiHydX,dPhiHydY,myThid) |
c CALL MOM_CDSCHEME(bi,bj,k,dPhiHydX,dPhiHydY,myThid) |
608 |
#else |
c ELSE |
609 |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
IF (.NOT.useCDscheme) THEN |
610 |
DO j=jMin,jMax |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
611 |
DO i=iMin,iMax |
DO j=jMin,jMax |
612 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
DO i=iMin,iMax |
613 |
ENDDO |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
614 |
ENDDO |
ENDDO |
615 |
CALL MOM_V_CORIOLIS(bi,bj,k,uFld,cf,myThid) |
ENDDO |
616 |
DO j=jMin,jMax |
CALL MOM_V_CORIOLIS(bi,bj,k,uFld,cf,myThid) |
617 |
DO i=iMin,iMax |
DO j=jMin,jMax |
618 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
DO i=iMin,iMax |
619 |
ENDDO |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
620 |
ENDDO |
ENDDO |
621 |
#endif /* INCLUDE_CD_CODE */ |
ENDDO |
622 |
|
ENDIF |
623 |
|
|
624 |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
625 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
626 |
DO j=jMin,jMax |
DO j=jMin,jMax |