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) |
118 |
_RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL fMer(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 |
C afFacMom :: Tracer parameters for turning terms on and off. |
122 |
C vfFacMom on and off. |
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 |
127 |
C foFacMom - Forcing |
C foFacMom - Forcing |
128 |
C mTFacMom - Metric term |
C mtFacMom - Metric term |
129 |
C uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off |
C uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off |
130 |
_RS hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
131 |
_RS r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
154 |
_RL ArDudrFac |
_RL ArDudrFac |
155 |
_RL fuFac |
_RL fuFac |
156 |
_RL mtFacU |
_RL mtFacU |
157 |
|
_RL mtNHFacU |
158 |
_RL uDvdxFac |
_RL uDvdxFac |
159 |
_RL AhDvdxFac |
_RL AhDvdxFac |
160 |
_RL vDvdyFac |
_RL vDvdyFac |
163 |
_RL ArDvdrFac |
_RL ArDvdrFac |
164 |
_RL fvFac |
_RL fvFac |
165 |
_RL mtFacV |
_RL mtFacV |
166 |
LOGICAL bottomDragTerms,harmonic,biharmonic,useVariableViscosity |
_RL mtNHFacV |
167 |
|
_RL sideMaskFac |
168 |
|
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. |
221 |
AhDudyFac = vfFacMom*1. |
AhDudyFac = vfFacMom*1. |
222 |
rVelDudrFac = afFacMom*1. |
rVelDudrFac = afFacMom*1. |
223 |
ArDudrFac = vfFacMom*1. |
ArDudrFac = vfFacMom*1. |
224 |
mTFacU = mtFacMom*1. |
mtFacU = mtFacMom*1. |
225 |
|
mtNHFacU = 1. |
226 |
fuFac = cfFacMom*1. |
fuFac = cfFacMom*1. |
227 |
C o V momentum equation |
C o V momentum equation |
228 |
uDvdxFac = afFacMom*1. |
uDvdxFac = afFacMom*1. |
231 |
AhDvdyFac = vfFacMom*1. |
AhDvdyFac = vfFacMom*1. |
232 |
rVelDvdrFac = afFacMom*1. |
rVelDvdrFac = afFacMom*1. |
233 |
ArDvdrFac = vfFacMom*1. |
ArDvdrFac = vfFacMom*1. |
234 |
mTFacV = mtFacMom*1. |
mtFacV = mtFacMom*1. |
235 |
|
mtNHFacV = 1. |
236 |
fvFac = cfFacMom*1. |
fvFac = cfFacMom*1. |
237 |
|
|
238 |
IF (implicitViscosity) THEN |
IF (implicitViscosity) THEN |
240 |
ArDvdrFac = 0. |
ArDvdrFac = 0. |
241 |
ENDIF |
ENDIF |
242 |
|
|
243 |
|
C note: using standard stencil (no mask) results in under-estimating |
244 |
|
C vorticity at a no-slip boundary by a factor of 2 = sideDragFactor |
245 |
|
IF ( no_slip_sides ) THEN |
246 |
|
sideMaskFac = sideDragFactor |
247 |
|
ELSE |
248 |
|
sideMaskFac = 0. _d 0 |
249 |
|
ENDIF |
250 |
|
|
251 |
IF ( no_slip_bottom |
IF ( no_slip_bottom |
252 |
& .OR. bottomDragQuadratic.NE.0. |
& .OR. bottomDragQuadratic.NE.0. |
253 |
& .OR. bottomDragLinear.NE.0.) THEN |
& .OR. bottomDragLinear.NE.0.) THEN |
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 |
|
|
290 |
CALL MOM_CALC_KE(bi,bj,k,2,uFld,vFld,KE,myThid) |
CALL MOM_CALC_KE(bi,bj,k,2,uFld,vFld,KE,myThid) |
291 |
CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid) |
IF ( momViscosity) THEN |
292 |
CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid) |
CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid) |
293 |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
CALL MOM_CALC_RELVORT3(bi,bj,k,uFld,vFld,hFacZ,vort3,myThid) |
294 |
CALL MOM_CALC_STRAIN(bi,bj,k,uFld,vFld,hFacZ,strain,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) |
296 |
|
DO j=1-OLy,sNy+OLy |
297 |
|
DO i=1-OLx,sNx+OLx |
298 |
|
IF ( hFacZ(i,j).EQ.0. ) THEN |
299 |
|
vort3(i,j) = sideMaskFac*vort3(i,j) |
300 |
|
strain(i,j) = sideMaskFac*strain(i,j) |
301 |
|
ENDIF |
302 |
|
ENDDO |
303 |
|
ENDDO |
304 |
|
#ifdef ALLOW_DIAGNOSTICS |
305 |
|
IF ( useDiagnostics ) THEN |
306 |
|
CALL DIAGNOSTICS_FILL(hDiv, 'momHDiv ',k,1,2,bi,bj,myThid) |
307 |
|
CALL DIAGNOSTICS_FILL(vort3, 'momVort3',k,1,2,bi,bj,myThid) |
308 |
|
CALL DIAGNOSTICS_FILL(tension,'Tension ',k,1,2,bi,bj,myThid) |
309 |
|
CALL DIAGNOSTICS_FILL(strain, 'Strain ',k,1,2,bi,bj,myThid) |
310 |
|
ENDIF |
311 |
|
#endif |
312 |
|
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 |
352 |
|
|
|
|
|
353 |
C--- Calculate vertical transports (at k+1) below U & V points : |
C--- Calculate vertical transports (at k+1) below U & V points : |
354 |
IF (momAdvection) THEN |
IF (momAdvection) THEN |
355 |
CALL MOM_CALC_RTRANS( k+1, bi, bj, |
CALL MOM_CALC_RTRANS( k+1, bi, bj, |
357 |
I myTime, myIter, myThid) |
I myTime, myIter, myThid) |
358 |
ENDIF |
ENDIF |
359 |
|
|
360 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
361 |
|
IF ( momAdvection .AND. k.LT.Nr ) THEN |
362 |
|
CALL MOM_UV_BOUNDARY( bi, bj, k+1, |
363 |
|
I uVel, vVel, |
364 |
|
O uBnd(1-OLx,1-OLy,k+1,bi,bj), |
365 |
|
O vBnd(1-OLx,1-OLy,k+1,bi,bj), |
366 |
|
I myTime, myIter, myThid ) |
367 |
|
ENDIF |
368 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
369 |
|
|
370 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
371 |
CALL MOM_CALC_VISC( |
DO j=1-OLy,sNy+OLy |
372 |
I bi,bj,k, |
DO i=1-OLx,sNx+OLx |
373 |
O viscAh_Z,viscAh_D,viscA4_Z,viscA4_D, |
viscAh_D(i,j) = viscAhD |
374 |
O harmonic,biharmonic,useVariableViscosity, |
viscAh_Z(i,j) = viscAhZ |
375 |
I hDiv,vort3,tension,strain,KE,hFacZ, |
viscA4_D(i,j) = viscA4D |
376 |
I myThid) |
viscA4_Z(i,j) = viscA4Z |
377 |
|
ENDDO |
378 |
|
ENDDO |
379 |
|
IF ( useVariableVisc ) THEN |
380 |
|
CALL MOM_CALC_VISC( bi, bj, k, |
381 |
|
O viscAh_Z, viscAh_D, viscA4_Z, viscA4_D, |
382 |
|
I hDiv, vort3, tension, strain, KE, hFacZ, |
383 |
|
I myThid ) |
384 |
|
ENDIF |
385 |
ENDIF |
ENDIF |
386 |
|
|
387 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
391 |
IF (momAdvection) THEN |
IF (momAdvection) THEN |
392 |
C--- Calculate mean fluxes (advection) between cells for zonal flow. |
C--- Calculate mean fluxes (advection) between cells for zonal flow. |
393 |
|
|
394 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
395 |
|
CALL MOM_U_ADV_UU( bi,bj,k,uTrans,uBnd(1-OLx,1-OLy,k,bi,bj), |
396 |
|
O fZon,myThid ) |
397 |
|
CALL MOM_U_ADV_VU( bi,bj,k,vTrans,uBnd(1-OLx,1-OLy,k,bi,bj), |
398 |
|
O fMer,myThid ) |
399 |
|
CALL MOM_U_ADV_WU( |
400 |
|
I bi,bj,k+1,uBnd,wVel,rTransU, |
401 |
|
O fVerUkp, myThid ) |
402 |
|
#else /* MOM_BOUNDARY_CONSERVE */ |
403 |
C-- Zonal flux (fZon is at east face of "u" cell) |
C-- Zonal flux (fZon is at east face of "u" cell) |
404 |
C Mean flow component of zonal flux -> fZon |
C Mean flow component of zonal flux -> fZon |
405 |
CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid) |
CALL MOM_U_ADV_UU(bi,bj,k,uTrans,uFld,fZon,myThid) |
412 |
C Mean flow component of vertical flux (at k+1) -> fVer |
C Mean flow component of vertical flux (at k+1) -> fVer |
413 |
CALL MOM_U_ADV_WU( |
CALL MOM_U_ADV_WU( |
414 |
I bi,bj,k+1,uVel,wVel,rTransU, |
I bi,bj,k+1,uVel,wVel,rTransU, |
415 |
O fVerU(1-OLx,1-OLy,kDown), myThid ) |
O fVerUkp, myThid ) |
416 |
|
#endif /* MOM_BOUNDARY_CONSERVE */ |
417 |
|
|
418 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
419 |
DO j=jMin,jMax |
DO j=jMin,jMax |
424 |
& ( 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)) ) |
425 |
#else |
#else |
426 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
427 |
& *recip_rAw(i,j,bi,bj) |
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k) |
428 |
#endif |
#endif |
429 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac |
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac |
430 |
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac |
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac |
431 |
& +(fVerU(i,j,kDown) - fVerU(i,j,kUp))*rkSign*rVelDudrFac |
& +( fVerUkp(i,j) - fVerUkm(i,j) )*rkSign*rVelDudrFac |
432 |
& ) |
& ) |
433 |
ENDDO |
ENDDO |
434 |
ENDDO |
ENDDO |
435 |
|
|
436 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
437 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
438 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Um ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Um ',k,1,2,bi,bj,myThid) |
439 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Um ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Um ',k,1,2,bi,bj,myThid) |
440 |
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) |
|
441 |
ENDIF |
ENDIF |
442 |
#endif |
#endif |
443 |
|
|
444 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
445 |
C-- account for 3.D divergence of the flow in rStar coordinate: |
C-- account for 3.D divergence of the flow in rStar coordinate: |
446 |
|
# ifndef DISABLE_RSTAR_CODE |
447 |
IF ( select_rStar.GT.0 ) THEN |
IF ( select_rStar.GT.0 ) THEN |
448 |
DO j=jMin,jMax |
DO j=jMin,jMax |
449 |
DO i=iMin,iMax |
DO i=iMin,iMax |
461 |
ENDDO |
ENDDO |
462 |
ENDDO |
ENDDO |
463 |
ENDIF |
ENDIF |
464 |
|
# endif /* DISABLE_RSTAR_CODE */ |
465 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
466 |
|
|
467 |
|
#ifdef ALLOW_ADDFLUID |
468 |
|
IF ( selectAddFluid.GE.1 ) THEN |
469 |
|
DO j=jMin,jMax |
470 |
|
DO i=iMin,iMax |
471 |
|
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj) |
472 |
|
& + uVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0 |
473 |
|
& *( addMass(i-1,j,k,bi,bj) + addMass(i,j,k,bi,bj) ) |
474 |
|
& *_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k) |
475 |
|
& * recip_rAw(i,j,bi,bj)*recip_deepFac2C(k) |
476 |
|
ENDDO |
477 |
|
ENDDO |
478 |
|
ENDIF |
479 |
|
#endif /* ALLOW_ADDFLUID */ |
480 |
|
|
481 |
ELSE |
ELSE |
482 |
C- if momAdvection / else |
C- if momAdvection / else |
483 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
493 |
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow. |
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow. |
494 |
|
|
495 |
C Bi-harmonic term del^2 U -> v4F |
C Bi-harmonic term del^2 U -> v4F |
496 |
IF (biharmonic) |
IF ( useBiharmonicVisc ) |
497 |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
& CALL MOM_U_DEL2U(bi,bj,k,uFld,hFacZ,v4f,myThid) |
498 |
|
|
499 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
511 |
ENDIF |
ENDIF |
512 |
|
|
513 |
C-- Tendency is minus divergence of the fluxes |
C-- Tendency is minus divergence of the fluxes |
514 |
|
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is) |
515 |
DO j=jMin,jMax |
DO j=jMin,jMax |
516 |
DO i=iMin,iMax |
DO i=iMin,iMax |
517 |
guDiss(i,j) = |
guDiss(i,j) = |
520 |
& ( 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)) ) |
521 |
#else |
#else |
522 |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k) |
523 |
& *recip_rAw(i,j,bi,bj) |
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k) |
524 |
#endif |
#endif |
525 |
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac |
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac |
526 |
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac |
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac |
527 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac |
528 |
|
& *recip_rhoFacC(k) |
529 |
& ) |
& ) |
530 |
ENDDO |
ENDDO |
531 |
ENDDO |
ENDDO |
539 |
ENDIF |
ENDIF |
540 |
#endif |
#endif |
541 |
|
|
542 |
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 |
543 |
IF (no_slip_sides) THEN |
IF (no_slip_sides) THEN |
544 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
545 |
CALL MOM_U_SIDEDRAG( |
CALL MOM_U_SIDEDRAG( bi, bj, k, |
|
I bi,bj,k, |
|
546 |
I uFld, v4f, hFacZ, |
I uFld, v4f, hFacZ, |
547 |
I viscAh_Z,viscA4_Z, |
I viscAh_Z, viscA4_Z, |
548 |
I harmonic,biharmonic,useVariableViscosity, |
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc, |
549 |
O vF, |
O vF, |
550 |
I myThid) |
I myThid ) |
551 |
DO j=jMin,jMax |
DO j=jMin,jMax |
552 |
DO i=iMin,iMax |
DO i=iMin,iMax |
553 |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
564 |
ENDDO |
ENDDO |
565 |
ENDIF |
ENDIF |
566 |
|
|
567 |
|
#ifdef ALLOW_SHELFICE |
568 |
|
IF (useShelfIce) THEN |
569 |
|
CALL SHELFICE_U_DRAG(bi,bj,k,uFld,KE,KappaRU,vF,myThid) |
570 |
|
DO j=jMin,jMax |
571 |
|
DO i=iMin,iMax |
572 |
|
gUdiss(i,j) = gUdiss(i,j) + vF(i,j) |
573 |
|
ENDDO |
574 |
|
ENDDO |
575 |
|
ENDIF |
576 |
|
#endif /* ALLOW_SHELFICE */ |
577 |
|
|
578 |
C- endif momViscosity |
C- endif momViscosity |
579 |
ENDIF |
ENDIF |
580 |
|
|
586 |
|
|
587 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
588 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
589 |
C o Non-hydrosatic metric terms |
C o Non-Hydrostatic (spherical) metric terms |
590 |
CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid) |
CALL MOM_U_METRIC_NH(bi,bj,k,uFld,wVel,mT,myThid) |
591 |
DO j=jMin,jMax |
DO j=jMin,jMax |
592 |
DO i=iMin,iMax |
DO i=iMin,iMax |
593 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtNHFacU*mT(i,j) |
594 |
ENDDO |
ENDDO |
595 |
ENDDO |
ENDDO |
596 |
ENDIF |
ENDIF |
597 |
IF (usingSphericalPolarMTerms) THEN |
IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN |
598 |
|
C o Spherical polar grid metric terms |
599 |
CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid) |
CALL MOM_U_METRIC_SPHERE(bi,bj,k,uFld,vFld,mT,myThid) |
600 |
DO j=jMin,jMax |
DO j=jMin,jMax |
601 |
DO i=iMin,iMax |
DO i=iMin,iMax |
602 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j) |
603 |
ENDDO |
ENDDO |
604 |
ENDDO |
ENDDO |
605 |
ENDIF |
ENDIF |
606 |
IF (usingCylindricalGrid) THEN |
IF ( usingCylindricalGrid .AND. metricTerms ) THEN |
607 |
CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
C o Cylindrical grid metric terms |
608 |
DO j=jMin,jMax |
CALL MOM_U_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
609 |
DO i=iMin,iMax |
DO j=jMin,jMax |
610 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mTFacU*mT(i,j) |
DO i=iMin,iMax |
611 |
ENDDO |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j) |
612 |
|
ENDDO |
613 |
ENDDO |
ENDDO |
614 |
ENDIF |
ENDIF |
615 |
|
|
618 |
C---- Meridional momentum equation starts here |
C---- Meridional momentum equation starts here |
619 |
|
|
620 |
IF (momAdvection) THEN |
IF (momAdvection) THEN |
621 |
|
|
622 |
|
#ifdef MOM_BOUNDARY_CONSERVE |
623 |
|
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vBnd(1-OLx,1-OLy,k,bi,bj), |
624 |
|
O fZon,myThid ) |
625 |
|
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vBnd(1-OLx,1-OLy,k,bi,bj), |
626 |
|
O fMer,myThid ) |
627 |
|
CALL MOM_V_ADV_WV( bi,bj,k+1,vBnd,wVel,rTransV, |
628 |
|
O fVerVkp, myThid ) |
629 |
|
#else /* MOM_BOUNDARY_CONSERVE */ |
630 |
C--- Calculate mean fluxes (advection) between cells for meridional flow. |
C--- Calculate mean fluxes (advection) between cells for meridional flow. |
631 |
C Mean flow component of zonal flux -> fZon |
C Mean flow component of zonal flux -> fZon |
632 |
CALL MOM_V_ADV_UV(bi,bj,k,uTrans,vFld,fZon,myThid) |
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vFld,fZon,myThid ) |
633 |
|
|
634 |
C-- Meridional flux (fMer is at north face of "v" cell) |
C-- Meridional flux (fMer is at north face of "v" cell) |
635 |
C Mean flow component of meridional flux -> fMer |
C Mean flow component of meridional flux -> fMer |
636 |
CALL MOM_V_ADV_VV(bi,bj,k,vTrans,vFld,fMer,myThid) |
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vFld,fMer,myThid ) |
637 |
|
|
638 |
C-- Vertical flux (fVer is at upper face of "v" cell) |
C-- Vertical flux (fVer is at upper face of "v" cell) |
639 |
C Mean flow component of vertical flux (at k+1) -> fVerV |
C Mean flow component of vertical flux (at k+1) -> fVerV |
640 |
CALL MOM_V_ADV_WV( |
CALL MOM_V_ADV_WV( bi,bj,k+1,vVel,wVel,rTransV, |
641 |
I bi,bj,k+1,vVel,wVel,rTransV, |
O fVerVkp, myThid ) |
642 |
O fVerV(1-OLx,1-OLy,kDown), myThid ) |
#endif /* MOM_BOUNDARY_CONSERVE */ |
643 |
|
|
644 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
645 |
DO j=jMin,jMax |
DO j=jMin,jMax |
650 |
& ( 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)) ) |
651 |
#else |
#else |
652 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
653 |
& *recip_rAs(i,j,bi,bj) |
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k) |
654 |
#endif |
#endif |
655 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac |
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac |
656 |
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac |
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac |
657 |
& +(fVerV(i,j,kDown) - fVerV(i,j,kUp))*rkSign*rVelDvdrFac |
& +( fVerVkp(i,j) - fVerVkm(i,j) )*rkSign*rVelDvdrFac |
658 |
& ) |
& ) |
659 |
ENDDO |
ENDDO |
660 |
ENDDO |
ENDDO |
661 |
|
|
662 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
663 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
664 |
CALL DIAGNOSTICS_FILL(fZon,'ADVx_Vm ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Vm ',k,1,2,bi,bj,myThid) |
665 |
CALL DIAGNOSTICS_FILL(fMer,'ADVy_Vm ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Vm ',k,1,2,bi,bj,myThid) |
666 |
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) |
|
667 |
ENDIF |
ENDIF |
668 |
#endif |
#endif |
669 |
|
|
670 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
671 |
C-- account for 3.D divergence of the flow in rStar coordinate: |
C-- account for 3.D divergence of the flow in rStar coordinate: |
672 |
|
# ifndef DISABLE_RSTAR_CODE |
673 |
IF ( select_rStar.GT.0 ) THEN |
IF ( select_rStar.GT.0 ) THEN |
674 |
DO j=jMin,jMax |
DO j=jMin,jMax |
675 |
DO i=iMin,iMax |
DO i=iMin,iMax |
687 |
ENDDO |
ENDDO |
688 |
ENDDO |
ENDDO |
689 |
ENDIF |
ENDIF |
690 |
|
# endif /* DISABLE_RSTAR_CODE */ |
691 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
692 |
|
|
693 |
|
#ifdef ALLOW_ADDFLUID |
694 |
|
IF ( selectAddFluid.GE.1 ) THEN |
695 |
|
DO j=jMin,jMax |
696 |
|
DO i=iMin,iMax |
697 |
|
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj) |
698 |
|
& + vVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0 |
699 |
|
& *( addMass(i,j-1,k,bi,bj) + addMass(i,j,k,bi,bj) ) |
700 |
|
& *_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k) |
701 |
|
& * recip_rAs(i,j,bi,bj)*recip_deepFac2C(k) |
702 |
|
ENDDO |
703 |
|
ENDDO |
704 |
|
ENDIF |
705 |
|
#endif /* ALLOW_ADDFLUID */ |
706 |
|
|
707 |
ELSE |
ELSE |
708 |
C- if momAdvection / else |
C- if momAdvection / else |
709 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
718 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
719 |
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow. |
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow. |
720 |
C Bi-harmonic term del^2 V -> v4F |
C Bi-harmonic term del^2 V -> v4F |
721 |
IF (biharmonic) |
IF ( useBiharmonicVisc ) |
722 |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
& CALL MOM_V_DEL2V(bi,bj,k,vFld,hFacZ,v4f,myThid) |
723 |
|
|
724 |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon |
736 |
ENDIF |
ENDIF |
737 |
|
|
738 |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term |
739 |
|
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is) |
740 |
DO j=jMin,jMax |
DO j=jMin,jMax |
741 |
DO i=iMin,iMax |
DO i=iMin,iMax |
742 |
gvDiss(i,j) = |
gvDiss(i,j) = |
745 |
& ( 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)) ) |
746 |
#else |
#else |
747 |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k) |
748 |
& *recip_rAs(i,j,bi,bj) |
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k) |
749 |
#endif |
#endif |
750 |
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac |
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac |
751 |
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac |
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac |
752 |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac |
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac |
753 |
|
& *recip_rhoFacC(k) |
754 |
& ) |
& ) |
755 |
ENDDO |
ENDDO |
756 |
ENDDO |
ENDDO |
764 |
ENDIF |
ENDIF |
765 |
#endif |
#endif |
766 |
|
|
767 |
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 |
768 |
IF (no_slip_sides) THEN |
IF (no_slip_sides) THEN |
769 |
C- No-slip BCs impose a drag at walls... |
C- No-slip BCs impose a drag at walls... |
770 |
CALL MOM_V_SIDEDRAG( |
CALL MOM_V_SIDEDRAG( bi, bj, k, |
|
I bi,bj,k, |
|
771 |
I vFld, v4f, hFacZ, |
I vFld, v4f, hFacZ, |
772 |
I viscAh_Z,viscA4_Z, |
I viscAh_Z,viscA4_Z, |
773 |
I harmonic,biharmonic,useVariableViscosity, |
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc, |
774 |
O vF, |
O vF, |
775 |
I myThid) |
I myThid ) |
776 |
DO j=jMin,jMax |
DO j=jMin,jMax |
777 |
DO i=iMin,iMax |
DO i=iMin,iMax |
778 |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
789 |
ENDDO |
ENDDO |
790 |
ENDIF |
ENDIF |
791 |
|
|
792 |
|
#ifdef ALLOW_SHELFICE |
793 |
|
IF (useShelfIce) THEN |
794 |
|
CALL SHELFICE_V_DRAG(bi,bj,k,vFld,KE,KappaRV,vF,myThid) |
795 |
|
DO j=jMin,jMax |
796 |
|
DO i=iMin,iMax |
797 |
|
gvDiss(i,j) = gvDiss(i,j) + vF(i,j) |
798 |
|
ENDDO |
799 |
|
ENDDO |
800 |
|
ENDIF |
801 |
|
#endif /* ALLOW_SHELFICE */ |
802 |
|
|
803 |
C- endif momViscosity |
C- endif momViscosity |
804 |
ENDIF |
ENDIF |
805 |
|
|
811 |
|
|
812 |
C-- Metric terms for curvilinear grid systems |
C-- Metric terms for curvilinear grid systems |
813 |
IF (useNHMTerms) THEN |
IF (useNHMTerms) THEN |
814 |
C o Spherical polar grid metric terms |
C o Non-Hydrostatic (spherical) metric terms |
815 |
CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid) |
CALL MOM_V_METRIC_NH(bi,bj,k,vFld,wVel,mT,myThid) |
816 |
DO j=jMin,jMax |
DO j=jMin,jMax |
817 |
DO i=iMin,iMax |
DO i=iMin,iMax |
818 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtNHFacV*mT(i,j) |
819 |
ENDDO |
ENDDO |
820 |
ENDDO |
ENDDO |
821 |
ENDIF |
ENDIF |
822 |
IF (usingSphericalPolarMTerms) THEN |
IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN |
823 |
|
C o Spherical polar grid metric terms |
824 |
CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid) |
CALL MOM_V_METRIC_SPHERE(bi,bj,k,uFld,mT,myThid) |
825 |
DO j=jMin,jMax |
DO j=jMin,jMax |
826 |
DO i=iMin,iMax |
DO i=iMin,iMax |
827 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j) |
828 |
ENDDO |
ENDDO |
829 |
ENDDO |
ENDDO |
830 |
ENDIF |
ENDIF |
831 |
IF (usingCylindricalGrid) THEN |
IF ( usingCylindricalGrid .AND. metricTerms ) THEN |
832 |
CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
C o Cylindrical grid metric terms |
833 |
DO j=jMin,jMax |
CALL MOM_V_METRIC_CYLINDER(bi,bj,k,uFld,vFld,mT,myThid) |
834 |
DO i=iMin,iMax |
DO j=jMin,jMax |
835 |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mTFacV*mT(i,j) |
DO i=iMin,iMax |
836 |
ENDDO |
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j) |
837 |
ENDDO |
ENDDO |
838 |
|
ENDDO |
839 |
ENDIF |
ENDIF |
840 |
|
|
841 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
842 |
|
|
843 |
C-- Coriolis term |
C-- Coriolis term (call to CD_CODE_SCHEME has been moved to timestep.F) |
|
C Note. As coded here, coriolis will not work with "thin walls" |
|
|
c IF (useCDscheme) THEN |
|
|
c CALL MOM_CDSCHEME(bi,bj,k,dPhiHydX,dPhiHydY,myThid) |
|
|
c ELSE |
|
844 |
IF (.NOT.useCDscheme) THEN |
IF (.NOT.useCDscheme) THEN |
845 |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
CALL MOM_U_CORIOLIS(bi,bj,k,vFld,cf,myThid) |
846 |
DO j=jMin,jMax |
DO j=jMin,jMax |
864 |
#endif |
#endif |
865 |
ENDIF |
ENDIF |
866 |
|
|
867 |
IF (nonHydrostatic.OR.quasiHydrostatic) THEN |
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -fprime*w) |
868 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
IF ( use3dCoriolis ) THEN |
869 |
DO j=jMin,jMax |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
870 |
DO i=iMin,iMax |
DO j=jMin,jMax |
871 |
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
DO i=iMin,iMax |
872 |
|
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j) |
873 |
|
ENDDO |
874 |
ENDDO |
ENDDO |
875 |
ENDDO |
IF ( usingCurvilinearGrid ) THEN |
876 |
|
C- presently, non zero angleSinC array only supported with Curvilinear-Grid |
877 |
|
CALL MOM_V_CORIOLIS_NH(bi,bj,k,wVel,cf,myThid) |
878 |
|
DO j=jMin,jMax |
879 |
|
DO i=iMin,iMax |
880 |
|
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j) |
881 |
|
ENDDO |
882 |
|
ENDDO |
883 |
|
ENDIF |
884 |
ENDIF |
ENDIF |
885 |
|
|
886 |
C-- Set du/dt & dv/dt on boundaries to zero |
C-- Set du/dt & dv/dt on boundaries to zero |
895 |
|
|
896 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
897 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
898 |
IF (bottomDragTerms) |
CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid) |
899 |
& CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL(gU(1-OLx,1-OLy,k,bi,bj), |
|
CALL DIAGNOSTICS_FILL(gU(1-Olx,1-Oly,k,bi,bj), |
|
900 |
& 'Um_Advec',k,1,2,bi,bj,myThid) |
& 'Um_Advec',k,1,2,bi,bj,myThid) |
901 |
CALL DIAGNOSTICS_FILL(gV(1-Olx,1-Oly,k,bi,bj), |
CALL DIAGNOSTICS_FILL(gV(1-OLx,1-OLy,k,bi,bj), |
902 |
& 'Vm_Advec',k,1,2,bi,bj,myThid) |
& 'Vm_Advec',k,1,2,bi,bj,myThid) |
903 |
IF (momViscosity) THEN |
IF (momViscosity) THEN |
904 |
CALL DIAGNOSTICS_FILL(guDiss,'Um_Diss ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL(guDiss,'Um_Diss ',k,1,2,bi,bj,myThid) |