207 |
ENDIF |
ENDIF |
208 |
|
|
209 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
210 |
DO j=1-Oly,sNy+Oly |
IF ( calcLeith .OR. calcSmag ) THEN |
211 |
|
STOP 'calcLeith or calcSmag not implemented for ADJOINT' |
212 |
|
ENDIF |
213 |
|
DO j=1-Oly,sNy+Oly |
214 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
215 |
viscAh_D(i,j)=viscAhD |
viscAh_D(i,j)=viscAhD |
216 |
viscAh_Z(i,j)=viscAhZ |
viscAh_Z(i,j)=viscAhZ |
233 |
viscAh_ZLthD(i,j)= 0. _d 0 |
viscAh_ZLthD(i,j)= 0. _d 0 |
234 |
viscA4_ZLthD(i,j)= 0. _d 0 |
viscA4_ZLthD(i,j)= 0. _d 0 |
235 |
ENDDO |
ENDDO |
236 |
ENDDO |
ENDDO |
237 |
#endif |
#endif |
238 |
|
|
239 |
|
|
240 |
|
|
241 |
C - Viscosity |
C - Viscosity |
242 |
IF (useVariableViscosity) THEN |
IF (useVariableViscosity) THEN |
|
cph( |
|
|
#ifndef ALLOW_AUTODIFF_TAMC |
|
|
cph) |
|
243 |
|
|
244 |
C- Initialise to zero gradient of vorticity & divergence: |
C- Initialise to zero gradient of vorticity & divergence: |
245 |
DO j=1-Oly,sNy+Oly |
DO j=1-Oly,sNy+Oly |
337 |
U4scl=0. |
U4scl=0. |
338 |
ENDIF |
ENDIF |
339 |
|
|
340 |
|
#ifndef ALLOW_AUTODIFF_TAMC |
341 |
IF (useFullLeith.and.calcleith) THEN |
IF (useFullLeith.and.calcleith) THEN |
342 |
C This is the vector magnitude of the vorticity gradient squared |
C This is the vector magnitude of the vorticity gradient squared |
343 |
grdVrt=0.25 _d 0*( (vrtDx(i,j+1)*vrtDx(i,j+1) |
grdVrt=0.25 _d 0*( (vrtDx(i,j+1)*vrtDx(i,j+1) |
383 |
viscA4_DlthD(i,j)=0. _d 0 |
viscA4_DlthD(i,j)=0. _d 0 |
384 |
ENDIF |
ENDIF |
385 |
|
|
|
|
|
386 |
IF (calcsmag) THEN |
IF (calcsmag) THEN |
387 |
viscAh_DSmg(i,j)=L2 |
viscAh_DSmg(i,j)=L2 |
388 |
& *sqrt(tension(i,j)**2 |
& *sqrt(tension(i,j)**2 |
394 |
viscAh_DSmg(i,j)=0. _d 0 |
viscAh_DSmg(i,j)=0. _d 0 |
395 |
viscA4_DSmg(i,j)=0. _d 0 |
viscA4_DSmg(i,j)=0. _d 0 |
396 |
ENDIF |
ENDIF |
397 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
398 |
|
|
399 |
C Harmonic on Div.u points |
C Harmonic on Div.u points |
400 |
Alin=viscAhD+viscAhGrid*L2rdt |
Alin=viscAhD+viscAhGrid*L2rdt |
449 |
U4scl=0. |
U4scl=0. |
450 |
ENDIF |
ENDIF |
451 |
|
|
452 |
|
#ifndef ALLOW_AUTODIFF_TAMC |
453 |
C This is the vector magnitude of the vorticity gradient squared |
C This is the vector magnitude of the vorticity gradient squared |
454 |
IF (useFullLeith.and.calcleith) THEN |
IF (useFullLeith.and.calcleith) THEN |
455 |
grdVrt=0.25 _d 0*( (vrtDx(i-1,j)*vrtDx(i-1,j) |
grdVrt=0.25 _d 0*( (vrtDx(i-1,j)*vrtDx(i-1,j) |
501 |
viscA4_ZSmg(i,j)=smag4fac*L2*viscAh_ZSmg(i,j) |
viscA4_ZSmg(i,j)=smag4fac*L2*viscAh_ZSmg(i,j) |
502 |
viscAh_ZSmg(i,j)=smag2fac*viscAh_ZSmg(i,j) |
viscAh_ZSmg(i,j)=smag2fac*viscAh_ZSmg(i,j) |
503 |
ENDIF |
ENDIF |
504 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
505 |
|
|
506 |
C Harmonic on Zeta points |
C Harmonic on Zeta points |
507 |
Alin=viscAhZ+viscAhGrid*L2rdt |
Alin=viscAhZ+viscAhGrid*L2rdt |
520 |
viscA4_Z(i,j)=min(viscA4_ZMax(i,j),viscA4_Z(i,j)) |
viscA4_Z(i,j)=min(viscA4_ZMax(i,j),viscA4_Z(i,j)) |
521 |
ENDDO |
ENDDO |
522 |
ENDDO |
ENDDO |
|
cph( |
|
|
#else |
|
|
STOP 'useVariableViscosity not implemented for ADJOINT' |
|
|
#endif /* ndef ALLOW_AUTODIFF_TAMC */ |
|
|
cph) |
|
523 |
ELSE |
ELSE |
524 |
DO j=1-Oly,sNy+Oly |
DO j=1-Oly,sNy+Oly |
525 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
531 |
ENDDO |
ENDDO |
532 |
ENDIF |
ENDIF |
533 |
|
|
534 |
|
|
535 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
536 |
IF (useDiagnostics) THEN |
IF (useDiagnostics) THEN |
537 |
CALL DIAGNOSTICS_FILL(viscAh_D,'VISCAHD ',k,1,2,bi,bj,myThid) |
CALL DIAGNOSTICS_FILL(viscAh_D,'VISCAHD ',k,1,2,bi,bj,myThid) |