| 1 |
C $Header: /u/gcmpack/MITgcm/pkg/mom_fluxform/mom_fluxform.F,v 1.26 2005/09/23 15:19:38 jmc Exp $ |
| 2 |
C $Name: $ |
| 3 |
|
| 4 |
CBOI |
| 5 |
C !TITLE: pkg/mom\_advdiff |
| 6 |
C !AUTHORS: adcroft@mit.edu |
| 7 |
C !INTRODUCTION: Flux-form Momentum Equations Package |
| 8 |
C |
| 9 |
C Package "mom\_fluxform" provides methods for calculating explicit terms |
| 10 |
C in the momentum equation cast in flux-form: |
| 11 |
C \begin{eqnarray*} |
| 12 |
C G^u & = & -\frac{1}{\rho} \partial_x \phi_h |
| 13 |
C -\nabla \cdot {\bf v} u |
| 14 |
C -fv |
| 15 |
C +\frac{1}{\rho} \nabla \cdot {\bf \tau}^x |
| 16 |
C + \mbox{metrics} |
| 17 |
C \\ |
| 18 |
C G^v & = & -\frac{1}{\rho} \partial_y \phi_h |
| 19 |
C -\nabla \cdot {\bf v} v |
| 20 |
C +fu |
| 21 |
C +\frac{1}{\rho} \nabla \cdot {\bf \tau}^y |
| 22 |
C + \mbox{metrics} |
| 23 |
C \end{eqnarray*} |
| 24 |
C where ${\bf v}=(u,v,w)$ and $\tau$, the stress tensor, includes surface |
| 25 |
C stresses as well as internal viscous stresses. |
| 26 |
CEOI |
| 27 |
|
| 28 |
#include "MOM_FLUXFORM_OPTIONS.h" |
| 29 |
|
| 30 |
CBOP |
| 31 |
C !ROUTINE: MOM_FLUXFORM |
| 32 |
|
| 33 |
C !INTERFACE: ========================================================== |
| 34 |
SUBROUTINE MOM_FLUXFORM( |
| 35 |
I bi,bj,iMin,iMax,jMin,jMax,k,kUp,kDown, |
| 36 |
I KappaRU, KappaRV, |
| 37 |
U fVerU, fVerV, |
| 38 |
O guDiss, gvDiss, |
| 39 |
I myTime, myIter, myThid) |
| 40 |
|
| 41 |
C !DESCRIPTION: |
| 42 |
C Calculates all the horizontal accelerations except for the implicit surface |
| 43 |
C pressure gradient and implciit vertical viscosity. |
| 44 |
|
| 45 |
C !USES: =============================================================== |
| 46 |
C == Global variables == |
| 47 |
IMPLICIT NONE |
| 48 |
#include "SIZE.h" |
| 49 |
#include "DYNVARS.h" |
| 50 |
#include "FFIELDS.h" |
| 51 |
#include "EEPARAMS.h" |
| 52 |
#include "PARAMS.h" |
| 53 |
#include "GRID.h" |
| 54 |
#include "SURFACE.h" |
| 55 |
|
| 56 |
C !INPUT PARAMETERS: =================================================== |
| 57 |
C bi,bj :: tile indices |
| 58 |
C iMin,iMax,jMin,jMAx :: loop ranges |
| 59 |
C k :: vertical level |
| 60 |
C kUp :: =1 or 2 for consecutive k |
| 61 |
C kDown :: =2 or 1 for consecutive k |
| 62 |
C KappaRU :: vertical viscosity |
| 63 |
C KappaRV :: vertical viscosity |
| 64 |
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 |
| 66 |
C guDiss :: dissipation tendency (all explicit terms), u component |
| 67 |
C gvDiss :: dissipation tendency (all explicit terms), v component |
| 68 |
C myTime :: current time |
| 69 |
C myIter :: current time-step number |
| 70 |
C myThid :: thread number |
| 71 |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
| 72 |
INTEGER k,kUp,kDown |
| 73 |
_RL KappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
| 74 |
_RL KappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
| 75 |
_RL fVerU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
| 76 |
_RL fVerV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
| 77 |
_RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 78 |
_RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 79 |
_RL myTime |
| 80 |
INTEGER myIter |
| 81 |
INTEGER myThid |
| 82 |
|
| 83 |
C !OUTPUT PARAMETERS: ================================================== |
| 84 |
C None - updates gU() and gV() in common blocks |
| 85 |
|
| 86 |
C !LOCAL VARIABLES: ==================================================== |
| 87 |
C i,j :: loop indices |
| 88 |
C vF :: viscous flux |
| 89 |
C v4F :: bi-harmonic viscous flux |
| 90 |
C cF :: Coriolis acceleration |
| 91 |
C mT :: Metric terms |
| 92 |
C fZon :: zonal fluxes |
| 93 |
C fMer :: meridional fluxes |
| 94 |
C fVrUp,fVrDw :: vertical viscous fluxes at interface k-1 & k |
| 95 |
INTEGER i,j |
| 96 |
_RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 97 |
_RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 98 |
_RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 99 |
_RL mT(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 100 |
_RL fZon(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 101 |
_RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 102 |
_RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 103 |
_RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 104 |
C afFacMom - Tracer parameters for turning terms |
| 105 |
C vfFacMom on and off. |
| 106 |
C pfFacMom afFacMom - Advective terms |
| 107 |
C cfFacMom vfFacMom - Eddy viscosity terms |
| 108 |
C mTFacMom pfFacMom - Pressure terms |
| 109 |
C cfFacMom - Coriolis terms |
| 110 |
C foFacMom - Forcing |
| 111 |
C mTFacMom - Metric term |
| 112 |
C uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off |
| 113 |
_RS hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 114 |
_RS r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 115 |
_RS xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 116 |
_RS yA(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 117 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 118 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 119 |
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 120 |
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 121 |
_RL rTransU(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 122 |
_RL rTransV(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 123 |
_RL KE(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 124 |
_RL viscAh_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 125 |
_RL viscAh_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 126 |
_RL viscA4_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 127 |
_RL viscA4_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 128 |
_RL vort3(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 129 |
_RL hDiv(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 130 |
_RL strain(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 131 |
_RL tension(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 132 |
_RL uDudxFac |
| 133 |
_RL AhDudxFac |
| 134 |
_RL vDudyFac |
| 135 |
_RL AhDudyFac |
| 136 |
_RL rVelDudrFac |
| 137 |
_RL ArDudrFac |
| 138 |
_RL fuFac |
| 139 |
_RL mtFacU |
| 140 |
_RL uDvdxFac |
| 141 |
_RL AhDvdxFac |
| 142 |
_RL vDvdyFac |
| 143 |
_RL AhDvdyFac |
| 144 |
_RL rVelDvdrFac |
| 145 |
_RL ArDvdrFac |
| 146 |
_RL fvFac |
| 147 |
_RL mtFacV |
| 148 |
LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity |
| 149 |
CEOP |
| 150 |
|
| 151 |
C Initialise intermediate terms |
| 152 |
DO j=1-OLy,sNy+OLy |
| 153 |
DO i=1-OLx,sNx+OLx |
| 154 |
vF(i,j) = 0. |
| 155 |
v4F(i,j) = 0. |
| 156 |
cF(i,j) = 0. |
| 157 |
mT(i,j) = 0. |
| 158 |
fZon(i,j) = 0. |
| 159 |
fMer(i,j) = 0. |
| 160 |
fVrUp(i,j)= 0. |
| 161 |
fVrDw(i,j)= 0. |
| 162 |
rTransU(i,j)= 0. |
| 163 |
rTransV(i,j)= 0. |
| 164 |
strain(i,j) = 0. |
| 165 |
tension(i,j)= 0. |
| 166 |
guDiss(i,j) = 0. |
| 167 |
gvDiss(i,j) = 0. |
| 168 |
ENDDO |
| 169 |
ENDDO |
| 170 |
|
| 171 |
C-- Term by term tracer parmeters |
| 172 |
C o U momentum equation |
| 173 |
uDudxFac = afFacMom*1. |
| 174 |
AhDudxFac = vfFacMom*1. |
| 175 |
vDudyFac = afFacMom*1. |
| 176 |
AhDudyFac = vfFacMom*1. |
| 177 |
rVelDudrFac = afFacMom*1. |
| 178 |
ArDudrFac = vfFacMom*1. |
| 179 |
mTFacU = mtFacMom*1. |
| 180 |
fuFac = cfFacMom*1. |
| 181 |
C o V momentum equation |
| 182 |
uDvdxFac = afFacMom*1. |
| 183 |
AhDvdxFac = vfFacMom*1. |
| 184 |
vDvdyFac = afFacMom*1. |
| 185 |
AhDvdyFac = vfFacMom*1. |
| 186 |
rVelDvdrFac = afFacMom*1. |
| 187 |
ArDvdrFac = vfFacMom*1. |
| 188 |
mTFacV = mtFacMom*1. |
| 189 |
fvFac = cfFacMom*1. |
| 190 |
|
| 191 |
IF (implicitViscosity) THEN |
| 192 |
ArDudrFac = 0. |
| 193 |
ArDvdrFac = 0. |
| 194 |
ENDIF |
| 195 |
|
| 196 |
IF ( no_slip_bottom |
| 197 |
& .OR. bottomDragQuadratic.NE.0. |
| 198 |
& .OR. bottomDragLinear.NE.0.) THEN |
| 199 |
bottomDragTerms=.TRUE. |
| 200 |
ELSE |
| 201 |
bottomDragTerms=.FALSE. |
| 202 |
ENDIF |
| 203 |
|
| 204 |
C-- Calculate open water fraction at vorticity points |
| 205 |
CALL MOM_CALC_HFACZ(bi,bj,k,hFacZ,r_hFacZ,myThid) |
| 206 |
|
| 207 |
C---- Calculate common quantities used in both U and V equations |
| 208 |
C Calculate tracer cell face open areas |
| 209 |
DO j=1-OLy,sNy+OLy |
| 210 |
DO i=1-OLx,sNx+OLx |
| 211 |
xA(i,j) = _dyG(i,j,bi,bj) |
| 212 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
| 213 |
yA(i,j) = _dxG(i,j,bi,bj) |
| 214 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
| 215 |
ENDDO |
| 216 |
ENDDO |
| 217 |
|
| 218 |
C Make local copies of horizontal flow field |
| 219 |
DO j=1-OLy,sNy+OLy |
| 220 |
DO i=1-OLx,sNx+OLx |
| 221 |
uFld(i,j) = uVel(i,j,k,bi,bj) |
| 222 |
vFld(i,j) = vVel(i,j,k,bi,bj) |
| 223 |
ENDDO |
| 224 |
ENDDO |
| 225 |
|
| 226 |
C Calculate velocity field "volume transports" through tracer cell faces. |
| 227 |
DO j=1-OLy,sNy+OLy |
| 228 |
DO i=1-OLx,sNx+OLx |
| 229 |
uTrans(i,j) = uFld(i,j)*xA(i,j) |
| 230 |
vTrans(i,j) = vFld(i,j)*yA(i,j) |
| 231 |
ENDDO |
| 232 |
ENDDO |
| 233 |
|
| 234 |
CALL MOM_CALC_KE(bi,bj,k,2,uFld,vFld,KE,myThid) |
| 235 |
CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid) |
| 236 |
CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid) |
| 237 |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
| 238 |
CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,myThid) |
| 239 |
|
| 240 |
C--- First call (k=1): compute vertical adv. flux fVerU(kUp) & fVerV(kUp) |
| 241 |
IF (momAdvection.AND.k.EQ.1) THEN |
| 242 |
|
| 243 |
C- Calculate vertical transports above U & V points (West & South face): |
| 244 |
CALL MOM_CALC_RTRANS( k, bi, bj, |
| 245 |
O rTransU, rTransV, |
| 246 |
I myTime, myIter, myThid) |
| 247 |
|
| 248 |
C- Free surface correction term (flux at k=1) |
| 249 |
CALL MOM_U_ADV_WU( bi,bj,k,uVel,wVel,rTransU, |
| 250 |
O fVerU(1-OLx,1-OLy,kUp), myThid ) |
| 251 |
|
| 252 |
CALL MOM_V_ADV_WV( bi,bj,k,vVel,wVel,rTransV, |
| 253 |
O fVerV(1-OLx,1-OLy,kUp), myThid ) |
| 254 |
|
| 255 |
C--- endif momAdvection & k=1 |
| 256 |
ENDIF |
| 257 |
|
| 258 |
|
| 259 |
C--- Calculate vertical transports (at k+1) below U & V points : |
| 260 |
IF (momAdvection) THEN |
| 261 |
CALL MOM_CALC_RTRANS( k+1, bi, bj, |
| 262 |
O rTransU, rTransV, |
| 263 |
I myTime, myIter, myThid) |
| 264 |
ENDIF |
| 265 |
|
| 266 |
IF (momViscosity) THEN |
| 267 |
CALL MOM_CALC_VISC( |
| 268 |
I bi,bj,k, |
| 269 |
O viscAh_Z,viscAh_D,viscA4_Z,viscA4_D, |
| 270 |
O harmonic,biharmonic,useVariableViscosity, |
| 271 |
I hDiv,vort3,tension,strain,KE,hFacZ, |
| 272 |
I myThid) |
| 273 |
ENDIF |
| 274 |
|
| 275 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 276 |
|
| 277 |
C---- Zonal momentum equation starts here |
| 278 |
|
| 279 |
IF (momAdvection) THEN |
| 280 |
C--- Calculate mean fluxes (advection) between cells for zonal flow. |
| 281 |
|
| 282 |
C-- Zonal flux (fZon is at east face of "u" cell) |
| 283 |
C Mean flow component of zonal flux -> fZon |
| 284 |
CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid) |
| 285 |
|
| 286 |
C-- Meridional flux (fMer is at south face of "u" cell) |
| 287 |
C Mean flow component of meridional flux -> fMer |
| 288 |
CALL MOM_U_ADV_VU(bi,bj,k,vTrans,uFld,fMer,myThid) |
| 289 |
|
| 290 |
C-- Vertical flux (fVer is at upper face of "u" cell) |
| 291 |
C Mean flow component of vertical flux (at k+1) -> fVer |
| 292 |
CALL MOM_U_ADV_WU( |
| 293 |
I bi,bj,k+1,uVel,wVel,rTransU, |
| 294 |
O fVerU(1-OLx,1-OLy,kDown), myThid ) |
| 295 |
|
| 296 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
| 297 |
DO j=jMin,jMax |
| 298 |
DO i=iMin,iMax |
| 299 |
gU(i,j,k,bi,bj) = |
| 300 |
#ifdef OLD_UV_GEOM |
| 301 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)/ |
| 302 |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
| 303 |
#else |
| 304 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
| 305 |
& *recip_rAw(i,j,bi,bj) |
| 306 |
#endif |
| 307 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac |
| 308 |
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac |
| 309 |
& +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac |
| 310 |
& ) |
| 311 |
ENDDO |
| 312 |
ENDDO |
| 313 |
|
| 314 |
#ifdef ALLOW_DIAGNOSTICS |
| 315 |
IF ( useDiagnostics ) THEN |
| 316 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Um ',k,1,2,bi,bj,myThid) |
| 317 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Um ',k,1,2,bi,bj,myThid) |
| 318 |
CALL DIAGNOSTICS_FILL(fVerU(1-Olx,1-Oly,kUp), |
| 319 |
& 'ADVrE_Um',k,1,2,bi,bj,myThid) |
| 320 |
ENDIF |
| 321 |
#endif |
| 322 |
|
| 323 |
#ifdef NONLIN_FRSURF |
| 324 |
C-- account for 3.D divergence of the flow in rStar coordinate: |
| 325 |
IF ( select_rStar.GT.0 ) THEN |
| 326 |
DO j=jMin,jMax |
| 327 |
DO i=iMin,iMax |
| 328 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
| 329 |
& - (rStarExpW(i,j,bi,bj) - 1. _d 0)/deltaTfreesurf |
| 330 |
& *uVel(i,j,k,bi,bj) |
| 331 |
ENDDO |
| 332 |
ENDDO |
| 333 |
ENDIF |
| 334 |
IF ( select_rStar.LT.0 ) THEN |
| 335 |
DO j=jMin,jMax |
| 336 |
DO i=iMin,iMax |
| 337 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
| 338 |
& - rStarDhWDt(i,j,bi,bj)*uVel(i,j,k,bi,bj) |
| 339 |
ENDDO |
| 340 |
ENDDO |
| 341 |
ENDIF |
| 342 |
#endif /* NONLIN_FRSURF */ |
| 343 |
|
| 344 |
ELSE |
| 345 |
C- if momAdvection / else |
| 346 |
DO j=1-OLy,sNy+OLy |
| 347 |
DO i=1-OLx,sNx+OLx |
| 348 |
gU(i,j,k,bi,bj) = 0. _d 0 |
| 349 |
ENDDO |
| 350 |
ENDDO |
| 351 |
|
| 352 |
C- endif momAdvection. |
| 353 |
ENDIF |
| 354 |
|
| 355 |
IF (momViscosity) THEN |
| 356 |
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow. |
| 357 |
|
| 358 |
C Bi-harmonic term del^2 U -> v4F |
| 359 |
IF (biharmonic) |
| 360 |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
| 361 |
|
| 362 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
| 363 |
CALL MOM_U_XVISCFLUX(bi,bj,k,uFld,v4F,fZon, |
| 364 |
I viscAh_D,viscA4_D,myThid) |
| 365 |
|
| 366 |
C Laplacian and bi-harmonic termis, Merid Fluxes -> fMer |
| 367 |
CALL MOM_U_YVISCFLUX(bi,bj,k,uFld,v4F,hFacZ,fMer, |
| 368 |
I viscAh_Z,viscA4_Z,myThid) |
| 369 |
|
| 370 |
C Eddy component of vertical flux (interior component only) -> fVrUp & fVrDw |
| 371 |
IF (.NOT.implicitViscosity) THEN |
| 372 |
CALL MOM_U_RVISCFLUX(bi,bj, k, uVel,KappaRU,fVrUp,myThid) |
| 373 |
CALL MOM_U_RVISCFLUX(bi,bj,k+1,uVel,KappaRU,fVrDw,myThid) |
| 374 |
ENDIF |
| 375 |
|
| 376 |
C-- Tendency is minus divergence of the fluxes |
| 377 |
DO j=jMin,jMax |
| 378 |
DO i=iMin,iMax |
| 379 |
guDiss(i,j) = |
| 380 |
#ifdef OLD_UV_GEOM |
| 381 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)/ |
| 382 |
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) ) |
| 383 |
#else |
| 384 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
| 385 |
& *recip_rAw(i,j,bi,bj) |
| 386 |
#endif |
| 387 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac |
| 388 |
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac |
| 389 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac |
| 390 |
& ) |
| 391 |
ENDDO |
| 392 |
ENDDO |
| 393 |
|
| 394 |
#ifdef ALLOW_DIAGNOSTICS |
| 395 |
IF ( useDiagnostics ) THEN |
| 396 |
CALL DIAGNOSTICS_FILL(fZon, 'VISCx_Um',k,1,2,bi,bj,myThid) |
| 397 |
CALL DIAGNOSTICS_FILL(fMer, 'VISCy_Um',k,1,2,bi,bj,myThid) |
| 398 |
IF (.NOT.implicitViscosity) |
| 399 |
& CALL DIAGNOSTICS_FILL(fVrUp,'VISrE_Um',k,1,2,bi,bj,myThid) |
| 400 |
ENDIF |
| 401 |
#endif |
| 402 |
|
| 403 |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
| 404 |
IF (no_slip_sides) THEN |
| 405 |
C- No-slip BCs impose a drag at walls... |
| 406 |
CALL MOM_U_SIDEDRAG( |
| 407 |
I bi,bj,k, |
| 408 |
I uFld, v4f, hFacZ, |
| 409 |
I viscAh_Z,viscA4_Z, |
| 410 |
I harmonic,biharmonic,useVariableViscosity, |
| 411 |
O vF, |
| 412 |
I myThid) |
| 413 |
DO j=jMin,jMax |
| 414 |
DO i=iMin,iMax |
| 415 |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
| 416 |
ENDDO |
| 417 |
ENDDO |
| 418 |
ENDIF |
| 419 |
C- No-slip BCs impose a drag at bottom |
| 420 |
IF (bottomDragTerms) THEN |
| 421 |
CALL MOM_U_BOTTOMDRAG(bi,bj,k,uFld,KE,KappaRU,vF,myThid) |
| 422 |
DO j=jMin,jMax |
| 423 |
DO i=iMin,iMax |
| 424 |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
| 425 |
ENDDO |
| 426 |
ENDDO |
| 427 |
ENDIF |
| 428 |
|
| 429 |
C- endif momViscosity |
| 430 |
ENDIF |
| 431 |
|
| 432 |
C-- Forcing term (moved to timestep.F) |
| 433 |
c IF (momForcing) |
| 434 |
c & CALL EXTERNAL_FORCING_U( |
| 435 |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
| 436 |
c I myTime,myThid) |
| 437 |
|
| 438 |
C-- Metric terms for curvilinear grid systems |
| 439 |
IF (useNHMTerms) THEN |
| 440 |
C o Non-hydrosatic metric terms |
| 441 |
CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid) |
| 442 |
DO j=jMin,jMax |
| 443 |
DO i=iMin,iMax |
| 444 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
| 445 |
ENDDO |
| 446 |
ENDDO |
| 447 |
ENDIF |
| 448 |
IF (usingSphericalPolarMTerms) THEN |
| 449 |
CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid) |
| 450 |
DO j=jMin,jMax |
| 451 |
DO i=iMin,iMax |
| 452 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
| 453 |
ENDDO |
| 454 |
ENDDO |
| 455 |
ENDIF |
| 456 |
IF (usingCylindricalGrid) THEN |
| 457 |
CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
| 458 |
DO j=jMin,jMax |
| 459 |
DO i=iMin,iMax |
| 460 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
| 461 |
ENDDO |
| 462 |
ENDDO |
| 463 |
ENDIF |
| 464 |
|
| 465 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 466 |
|
| 467 |
C---- Meridional momentum equation starts here |
| 468 |
|
| 469 |
IF (momAdvection) THEN |
| 470 |
C--- Calculate mean fluxes (advection) between cells for meridional flow. |
| 471 |
C Mean flow component of zonal flux -> fZon |
| 472 |
CALL MOM_V_ADV_UV(bi,bj,k,uTrans,vFld,fZon,myThid) |
| 473 |
|
| 474 |
C-- Meridional flux (fMer is at north face of "v" cell) |
| 475 |
C Mean flow component of meridional flux -> fMer |
| 476 |
CALL MOM_V_ADV_VV(bi,bj,k,vTrans,vFld,fMer,myThid) |
| 477 |
|
| 478 |
C-- Vertical flux (fVer is at upper face of "v" cell) |
| 479 |
C Mean flow component of vertical flux (at k+1) -> fVerV |
| 480 |
CALL MOM_V_ADV_WV( |
| 481 |
I bi,bj,k+1,vVel,wVel,rTransV, |
| 482 |
O fVerV(1-OLx,1-OLy,kDown), myThid ) |
| 483 |
|
| 484 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
| 485 |
DO j=jMin,jMax |
| 486 |
DO i=iMin,iMax |
| 487 |
gV(i,j,k,bi,bj) = |
| 488 |
#ifdef OLD_UV_GEOM |
| 489 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)/ |
| 490 |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
| 491 |
#else |
| 492 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
| 493 |
& *recip_rAs(i,j,bi,bj) |
| 494 |
#endif |
| 495 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac |
| 496 |
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac |
| 497 |
& +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac |
| 498 |
& ) |
| 499 |
ENDDO |
| 500 |
ENDDO |
| 501 |
|
| 502 |
#ifdef ALLOW_DIAGNOSTICS |
| 503 |
IF ( useDiagnostics ) THEN |
| 504 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Vm ',k,1,2,bi,bj,myThid) |
| 505 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Vm ',k,1,2,bi,bj,myThid) |
| 506 |
CALL DIAGNOSTICS_FILL(fVerV(1-Olx,1-Oly,kUp), |
| 507 |
& 'ADVrE_Vm',k,1,2,bi,bj,myThid) |
| 508 |
ENDIF |
| 509 |
#endif |
| 510 |
|
| 511 |
#ifdef NONLIN_FRSURF |
| 512 |
C-- account for 3.D divergence of the flow in rStar coordinate: |
| 513 |
IF ( select_rStar.GT.0 ) THEN |
| 514 |
DO j=jMin,jMax |
| 515 |
DO i=iMin,iMax |
| 516 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
| 517 |
& - (rStarExpS(i,j,bi,bj) - 1. _d 0)/deltaTfreesurf |
| 518 |
& *vVel(i,j,k,bi,bj) |
| 519 |
ENDDO |
| 520 |
ENDDO |
| 521 |
ENDIF |
| 522 |
IF ( select_rStar.LT.0 ) THEN |
| 523 |
DO j=jMin,jMax |
| 524 |
DO i=iMin,iMax |
| 525 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
| 526 |
& - rStarDhSDt(i,j,bi,bj)*vVel(i,j,k,bi,bj) |
| 527 |
ENDDO |
| 528 |
ENDDO |
| 529 |
ENDIF |
| 530 |
#endif /* NONLIN_FRSURF */ |
| 531 |
|
| 532 |
ELSE |
| 533 |
C- if momAdvection / else |
| 534 |
DO j=1-OLy,sNy+OLy |
| 535 |
DO i=1-OLx,sNx+OLx |
| 536 |
gV(i,j,k,bi,bj) = 0. _d 0 |
| 537 |
ENDDO |
| 538 |
ENDDO |
| 539 |
|
| 540 |
C- endif momAdvection. |
| 541 |
ENDIF |
| 542 |
|
| 543 |
IF (momViscosity) THEN |
| 544 |
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow. |
| 545 |
C Bi-harmonic term del^2 V -> v4F |
| 546 |
IF (biharmonic) |
| 547 |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
| 548 |
|
| 549 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
| 550 |
CALL MOM_V_XVISCFLUX(bi,bj,k,vFld,v4f,hFacZ,fZon, |
| 551 |
I viscAh_Z,viscA4_Z,myThid) |
| 552 |
|
| 553 |
C Laplacian and bi-harmonic termis, Merid Fluxes -> fMer |
| 554 |
CALL MOM_V_YVISCFLUX(bi,bj,k,vFld,v4f,fMer, |
| 555 |
I viscAh_D,viscA4_D,myThid) |
| 556 |
|
| 557 |
C Eddy component of vertical flux (interior component only) -> fVrUp & fVrDw |
| 558 |
IF (.NOT.implicitViscosity) THEN |
| 559 |
CALL MOM_V_RVISCFLUX(bi,bj, k, vVel,KappaRV,fVrUp,myThid) |
| 560 |
CALL MOM_V_RVISCFLUX(bi,bj,k+1,vVel,KappaRV,fVrDw,myThid) |
| 561 |
ENDIF |
| 562 |
|
| 563 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
| 564 |
DO j=jMin,jMax |
| 565 |
DO i=iMin,iMax |
| 566 |
gvDiss(i,j) = |
| 567 |
#ifdef OLD_UV_GEOM |
| 568 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)/ |
| 569 |
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) ) |
| 570 |
#else |
| 571 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
| 572 |
& *recip_rAs(i,j,bi,bj) |
| 573 |
#endif |
| 574 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac |
| 575 |
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac |
| 576 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac |
| 577 |
& ) |
| 578 |
ENDDO |
| 579 |
ENDDO |
| 580 |
|
| 581 |
#ifdef ALLOW_DIAGNOSTICS |
| 582 |
IF ( useDiagnostics ) THEN |
| 583 |
CALL DIAGNOSTICS_FILL(fZon, 'VISCx_Vm',k,1,2,bi,bj,myThid) |
| 584 |
CALL DIAGNOSTICS_FILL(fMer, 'VISCy_Vm',k,1,2,bi,bj,myThid) |
| 585 |
IF (.NOT.implicitViscosity) |
| 586 |
& CALL DIAGNOSTICS_FILL(fVrUp,'VISrE_Vm',k,1,2,bi,bj,myThid) |
| 587 |
ENDIF |
| 588 |
#endif |
| 589 |
|
| 590 |
C-- No-slip and drag BCs appear as body forces in cell abutting topography |
| 591 |
IF (no_slip_sides) THEN |
| 592 |
C- No-slip BCs impose a drag at walls... |
| 593 |
CALL MOM_V_SIDEDRAG( |
| 594 |
I bi,bj,k, |
| 595 |
I vFld, v4f, hFacZ, |
| 596 |
I viscAh_Z,viscA4_Z, |
| 597 |
I harmonic,biharmonic,useVariableViscosity, |
| 598 |
O vF, |
| 599 |
I myThid) |
| 600 |
DO j=jMin,jMax |
| 601 |
DO i=iMin,iMax |
| 602 |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
| 603 |
ENDDO |
| 604 |
ENDDO |
| 605 |
ENDIF |
| 606 |
C- No-slip BCs impose a drag at bottom |
| 607 |
IF (bottomDragTerms) THEN |
| 608 |
CALL MOM_V_BOTTOMDRAG(bi,bj,k,vFld,KE,KappaRV,vF,myThid) |
| 609 |
DO j=jMin,jMax |
| 610 |
DO i=iMin,iMax |
| 611 |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
| 612 |
ENDDO |
| 613 |
ENDDO |
| 614 |
ENDIF |
| 615 |
|
| 616 |
C- endif momViscosity |
| 617 |
ENDIF |
| 618 |
|
| 619 |
C-- Forcing term (moved to timestep.F) |
| 620 |
c IF (momForcing) |
| 621 |
c & CALL EXTERNAL_FORCING_V( |
| 622 |
c I iMin,iMax,jMin,jMax,bi,bj,k, |
| 623 |
c I myTime,myThid) |
| 624 |
|
| 625 |
C-- Metric terms for curvilinear grid systems |
| 626 |
IF (useNHMTerms) THEN |
| 627 |
C o Spherical polar grid metric terms |
| 628 |
CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid) |
| 629 |
DO j=jMin,jMax |
| 630 |
DO i=iMin,iMax |
| 631 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
| 632 |
ENDDO |
| 633 |
ENDDO |
| 634 |
ENDIF |
| 635 |
IF (usingSphericalPolarMTerms) THEN |
| 636 |
CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid) |
| 637 |
DO j=jMin,jMax |
| 638 |
DO i=iMin,iMax |
| 639 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
| 640 |
ENDDO |
| 641 |
ENDDO |
| 642 |
ENDIF |
| 643 |
IF (usingCylindricalGrid) THEN |
| 644 |
CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
| 645 |
DO j=jMin,jMax |
| 646 |
DO i=iMin,iMax |
| 647 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
| 648 |
ENDDO |
| 649 |
ENDDO |
| 650 |
ENDIF |
| 651 |
|
| 652 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 653 |
|
| 654 |
C-- Coriolis term |
| 655 |
C Note. As coded here, coriolis will not work with "thin walls" |
| 656 |
c IF (useCDscheme) THEN |
| 657 |
c CALL MOM_CDSCHEME(bi,bj,k,dPhiHydX,dPhiHydY,myThid) |
| 658 |
c ELSE |
| 659 |
IF (.NOT.useCDscheme) THEN |
| 660 |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
| 661 |
DO j=jMin,jMax |
| 662 |
DO i=iMin,iMax |
| 663 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
| 664 |
ENDDO |
| 665 |
ENDDO |
| 666 |
#ifdef ALLOW_DIAGNOSTICS |
| 667 |
IF ( useDiagnostics ) |
| 668 |
& CALL DIAGNOSTICS_FILL(cf,'Um_Cori ',k,1,2,bi,bj,myThid) |
| 669 |
#endif |
| 670 |
CALL MOM_V_CORIOLIS(bi,bj,k,uFld,cf,myThid) |
| 671 |
DO j=jMin,jMax |
| 672 |
DO i=iMin,iMax |
| 673 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
| 674 |
ENDDO |
| 675 |
ENDDO |
| 676 |
#ifdef ALLOW_DIAGNOSTICS |
| 677 |
IF ( useDiagnostics ) |
| 678 |
& CALL DIAGNOSTICS_FILL(cf,'Vm_Cori ',k,1,2,bi,bj,myThid) |
| 679 |
#endif |
| 680 |
ENDIF |
| 681 |
|
| 682 |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
| 683 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
| 684 |
DO j=jMin,jMax |
| 685 |
DO i=iMin,iMax |
| 686 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
| 687 |
ENDDO |
| 688 |
ENDDO |
| 689 |
ENDIF |
| 690 |
|
| 691 |
C-- Set du/dt & dv/dt on boundaries to zero |
| 692 |
DO j=jMin,jMax |
| 693 |
DO i=iMin,iMax |
| 694 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)*_maskW(i,j,k,bi,bj) |
| 695 |
guDiss(i,j) = guDiss(i,j) *_maskW(i,j,k,bi,bj) |
| 696 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)*_maskS(i,j,k,bi,bj) |
| 697 |
gvDiss(i,j) = gvDiss(i,j) *_maskS(i,j,k,bi,bj) |
| 698 |
ENDDO |
| 699 |
ENDDO |
| 700 |
|
| 701 |
#ifdef ALLOW_DIAGNOSTICS |
| 702 |
IF ( useDiagnostics ) THEN |
| 703 |
IF (bottomDragTerms) |
| 704 |
& CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid) |
| 705 |
CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj), |
| 706 |
& 'Um_Advec',k,1,2,bi,bj,myThid) |
| 707 |
CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj), |
| 708 |
& 'Vm_Advec',k,1,2,bi,bj,myThid) |
| 709 |
IF (momViscosity) THEN |
| 710 |
CALL DIAGNOSTICS_FILL(guDiss,'Um_Diss ',k,1,2,bi,bj,myThid) |
| 711 |
CALL DIAGNOSTICS_FILL(gvDiss,'Vm_Diss ',k,1,2,bi,bj,myThid) |
| 712 |
ENDIF |
| 713 |
ENDIF |
| 714 |
#endif /* ALLOW_DIAGNOSTICS */ |
| 715 |
|
| 716 |
RETURN |
| 717 |
END |