38 |
#ifdef ALLOW_TIMEAVE |
#ifdef ALLOW_TIMEAVE |
39 |
#include "TIMEAVE_STATV.h" |
#include "TIMEAVE_STATV.h" |
40 |
#endif |
#endif |
41 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
42 |
|
# include "tamc.h" |
43 |
|
# include "tamc_keys.h" |
44 |
|
#endif |
45 |
|
|
46 |
C == Routine arguments == |
C == Routine arguments == |
47 |
C fVerU :: Flux of momentum in the vertical direction, out of the upper |
C fVerU :: Flux of momentum in the vertical direction, out of the upper |
102 |
LOGICAL bottomDragTerms |
LOGICAL bottomDragTerms |
103 |
LOGICAL writeDiag |
LOGICAL writeDiag |
104 |
LOGICAL harmonic,biharmonic,useVariableViscosity |
LOGICAL harmonic,biharmonic,useVariableViscosity |
105 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
106 |
|
INTEGER imomkey |
107 |
|
#endif |
108 |
|
|
109 |
#ifdef ALLOW_MNC |
#ifdef ALLOW_MNC |
110 |
INTEGER offsets(9) |
INTEGER offsets(9) |
120 |
fVerV(1,1,kUp) = fVerV(1,1,kUp) |
fVerV(1,1,kUp) = fVerV(1,1,kUp) |
121 |
#endif |
#endif |
122 |
|
|
123 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
124 |
|
act0 = k - 1 |
125 |
|
max0 = Nr |
126 |
|
act1 = bi - myBxLo(myThid) |
127 |
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
128 |
|
act2 = bj - myByLo(myThid) |
129 |
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
130 |
|
act3 = myThid - 1 |
131 |
|
max3 = nTx*nTy |
132 |
|
act4 = ikey_dynamics - 1 |
133 |
|
imomkey = (act0 + 1) |
134 |
|
& + act1*max0 |
135 |
|
& + act2*max0*max1 |
136 |
|
& + act3*max0*max1*max2 |
137 |
|
& + act4*max0*max1*max2*max3 |
138 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
139 |
|
|
140 |
writeDiag = DIFFERENT_MULTIPLE(diagFreq, myTime, deltaTClock) |
writeDiag = DIFFERENT_MULTIPLE(diagFreq, myTime, deltaTClock) |
141 |
|
|
142 |
#ifdef ALLOW_MNC |
#ifdef ALLOW_MNC |
156 |
offsets(i) = 0 |
offsets(i) = 0 |
157 |
ENDDO |
ENDDO |
158 |
offsets(3) = k |
offsets(3) = k |
159 |
C write(*,*) 'offsets = ',(offsets(i),i=1,9) |
c write(*,*) 'offsets = ',(offsets(i),i=1,9) |
160 |
ENDIF |
ENDIF |
161 |
#endif /* ALLOW_MNC */ |
#endif /* ALLOW_MNC */ |
162 |
|
|
163 |
C Initialise intermediate terms |
C-- Initialise intermediate terms |
164 |
DO J=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
165 |
DO I=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
166 |
vF(i,j) = 0. |
vF(i,j) = 0. |
167 |
vrF(i,j) = 0. |
vrF(i,j) = 0. |
168 |
uCf(i,j) = 0. |
uCf(i,j) = 0. |
176 |
vort3(i,j) = 0. |
vort3(i,j) = 0. |
177 |
omega3(i,j)= 0. |
omega3(i,j)= 0. |
178 |
KE(i,j) = 0. |
KE(i,j) = 0. |
179 |
|
C- need to initialise hDiv for MOM_VI_DEL2UV(call FILL_CS_CORNER_TR_RL) |
180 |
|
hDiv(i,j) = 0. |
181 |
viscAh_Z(i,j) = 0. |
viscAh_Z(i,j) = 0. |
182 |
viscAh_D(i,j) = 0. |
viscAh_D(i,j) = 0. |
183 |
viscA4_Z(i,j) = 0. |
viscA4_Z(i,j) = 0. |
184 |
viscA4_D(i,j) = 0. |
viscA4_D(i,j) = 0. |
185 |
|
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
|
186 |
strain(i,j) = 0. _d 0 |
strain(i,j) = 0. _d 0 |
187 |
tension(i,j) = 0. _d 0 |
tension(i,j) = 0. _d 0 |
188 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
189 |
hFacZ(i,j) = 0. _d 0 |
hFacZ(i,j) = 0. _d 0 |
190 |
#endif |
#endif |
191 |
ENDDO |
ENDDO |
236 |
C-- For viscous term, compute horizontal divergence, tension & strain |
C-- For viscous term, compute horizontal divergence, tension & strain |
237 |
C and mask relative vorticity (free-slip case): |
C and mask relative vorticity (free-slip case): |
238 |
|
|
239 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
240 |
|
CADJ STORE vort3(:,:) = |
241 |
|
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte |
242 |
|
#endif |
243 |
|
|
244 |
CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid) |
CALL MOM_CALC_HDIV(bi,bj,k,2,uFld,vFld,hDiv,myThid) |
245 |
|
|
246 |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
CALL MOM_CALC_TENSION(bi,bj,k,uFld,vFld,tension,myThid) |
658 |
ENDIF |
ENDIF |
659 |
|
|
660 |
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -f'*w) |
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -f'*w) |
661 |
IF ( nonHydrostatic.OR.quasiHydrostatic ) THEN |
IF ( use3dCoriolis ) THEN |
662 |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,uCf,myThid) |
CALL MOM_U_CORIOLIS_NH(bi,bj,k,wVel,uCf,myThid) |
663 |
DO j=jMin,jMax |
DO j=jMin,jMax |
664 |
DO i=iMin,iMax |
DO i=iMin,iMax |