2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "GAD_OPTIONS.h" |
#include "GAD_OPTIONS.h" |
5 |
|
#ifdef ALLOW_PTRACERS |
6 |
|
# include "PTRACERS_OPTIONS.h" |
7 |
|
#endif |
8 |
|
|
9 |
CBOP |
CBOP |
10 |
C !ROUTINE: GAD_CALC_RHS |
C !ROUTINE: GAD_CALC_RHS |
47 |
#include "GRID.h" |
#include "GRID.h" |
48 |
#include "SURFACE.h" |
#include "SURFACE.h" |
49 |
#include "GAD.h" |
#include "GAD.h" |
50 |
|
#ifdef ALLOW_PTRACERS |
51 |
|
# include "PTRACERS_SIZE.h" |
52 |
|
# include "PTRACERS.h" |
53 |
|
#endif |
54 |
|
|
55 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
56 |
#include "tamc.h" |
#include "tamc.h" |
82 |
C advectionScheme :: advection scheme to use (Horizontal plane) |
C advectionScheme :: advection scheme to use (Horizontal plane) |
83 |
C vertAdvecScheme :: advection scheme to use (Vertical direction) |
C vertAdvecScheme :: advection scheme to use (Vertical direction) |
84 |
C calcAdvection :: =False if Advec computed with multiDim scheme |
C calcAdvection :: =False if Advec computed with multiDim scheme |
85 |
|
C--- needs to pass those 2 flags as argument |
86 |
|
C trUseGMRedi :: true if this tracer uses GM-Redi |
87 |
|
C trUseKPP :: true if this tracer uses KPP |
88 |
|
C--- |
89 |
C implicitAdvection:: =True if vertical Advec computed implicitly |
C implicitAdvection:: =True if vertical Advec computed implicitly |
90 |
C applyAB_onTracer :: apply Adams-Bashforth on Tracer (rather than on gTr) |
C applyAB_onTracer :: apply Adams-Bashforth on Tracer (rather than on gTr) |
91 |
C myTime :: current time |
C myTime :: current time |
109 |
_RL TracAB (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
_RL TracAB (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
110 |
INTEGER tracerIdentity |
INTEGER tracerIdentity |
111 |
INTEGER advectionScheme, vertAdvecScheme |
INTEGER advectionScheme, vertAdvecScheme |
112 |
LOGICAL calcAdvection |
LOGICAL calcAdvection, trUseGMRedi, trUseKPP |
113 |
LOGICAL implicitAdvection, applyAB_onTracer |
LOGICAL implicitAdvection, applyAB_onTracer |
114 |
_RL myTime |
_RL myTime |
115 |
INTEGER myIter, myThid |
INTEGER myIter, myThid |
151 |
fVerT(1,1,kDown) = fVerT(1,1,kDown) |
fVerT(1,1,kDown) = fVerT(1,1,kDown) |
152 |
#endif |
#endif |
153 |
|
|
154 |
|
trUseGMRedi = useGMRedi |
155 |
|
trUseKPP = useKPP |
156 |
|
#ifdef ALLOW_PTRACERS |
157 |
|
IF ( usePTRACERS ) THEN |
158 |
|
i = MAX( 1, tracerIdentity - GAD_TR1 + 1 ) |
159 |
|
trUseGMRedi = useGMRedi .AND. ( tracerIdentity.LT.GAD_TR1 |
160 |
|
& .OR. PTRACERS_useGMRedi(i) ) |
161 |
|
trUseKPP = useKPP .AND. ( tracerIdentity.LT.GAD_TR1 |
162 |
|
& .OR. PTRACERS_useKPP(i) ) |
163 |
|
ENDIF |
164 |
|
#endif |
165 |
|
|
166 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
167 |
C-- Set diagnostic suffix for the current tracer |
C-- Set diagnostic suffix for the current tracer |
168 |
IF ( useDiagnostics ) THEN |
IF ( useDiagnostics ) THEN |
301 |
|
|
302 |
#ifdef ALLOW_GMREDI |
#ifdef ALLOW_GMREDI |
303 |
C- GM/Redi flux in X |
C- GM/Redi flux in X |
304 |
IF (useGMRedi) THEN |
IF ( trUseGMRedi ) THEN |
305 |
C *note* should update GMREDI_XTRANSPORT to set df *aja* |
C *note* should update GMREDI_XTRANSPORT to set df *aja* |
306 |
IF ( applyAB_onTracer ) THEN |
IF ( applyAB_onTracer ) THEN |
307 |
CALL GMREDI_XTRANSPORT( |
CALL GMREDI_XTRANSPORT( |
329 |
C- Diagnostics of Tracer flux in X dir (mainly Diffusive term), |
C- Diagnostics of Tracer flux in X dir (mainly Diffusive term), |
330 |
C excluding advective terms: |
C excluding advective terms: |
331 |
IF ( useDiagnostics .AND. |
IF ( useDiagnostics .AND. |
332 |
& (diffKh.NE.0. .OR. diffK4 .NE.0. .OR. useGMRedi) ) THEN |
& (diffKh.NE.0. .OR. diffK4 .NE.0. .OR. trUseGMRedi) ) THEN |
333 |
diagName = 'DFxE'//diagSufx |
diagName = 'DFxE'//diagSufx |
334 |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
335 |
ENDIF |
ENDIF |
416 |
|
|
417 |
#ifdef ALLOW_GMREDI |
#ifdef ALLOW_GMREDI |
418 |
C- GM/Redi flux in Y |
C- GM/Redi flux in Y |
419 |
IF (useGMRedi) THEN |
IF ( trUseGMRedi ) THEN |
420 |
C *note* should update GMREDI_YTRANSPORT to set df *aja* |
C *note* should update GMREDI_YTRANSPORT to set df *aja* |
421 |
IF ( applyAB_onTracer ) THEN |
IF ( applyAB_onTracer ) THEN |
422 |
CALL GMREDI_YTRANSPORT( |
CALL GMREDI_YTRANSPORT( |
444 |
C- Diagnostics of Tracer flux in Y dir (mainly Diffusive terms), |
C- Diagnostics of Tracer flux in Y dir (mainly Diffusive terms), |
445 |
C excluding advective terms: |
C excluding advective terms: |
446 |
IF ( useDiagnostics .AND. |
IF ( useDiagnostics .AND. |
447 |
& (diffKh.NE.0. .OR. diffK4 .NE.0. .OR. useGMRedi) ) THEN |
& (diffKh.NE.0. .OR. diffK4 .NE.0. .OR. trUseGMRedi) ) THEN |
448 |
diagName = 'DFyE'//diagSufx |
diagName = 'DFyE'//diagSufx |
449 |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
450 |
ENDIF |
ENDIF |
538 |
|
|
539 |
#ifdef ALLOW_GMREDI |
#ifdef ALLOW_GMREDI |
540 |
C- GM/Redi flux in R |
C- GM/Redi flux in R |
541 |
IF (useGMRedi) THEN |
IF ( trUseGMRedi ) THEN |
542 |
C *note* should update GMREDI_RTRANSPORT to set df *aja* |
C *note* should update GMREDI_RTRANSPORT to set df *aja* |
543 |
IF ( applyAB_onTracer ) THEN |
IF ( applyAB_onTracer ) THEN |
544 |
CALL GMREDI_RTRANSPORT( |
CALL GMREDI_RTRANSPORT( |
566 |
C- Diagnostics of Tracer flux in R dir (mainly Diffusive terms), |
C- Diagnostics of Tracer flux in R dir (mainly Diffusive terms), |
567 |
C Explicit terms only & excluding advective terms: |
C Explicit terms only & excluding advective terms: |
568 |
IF ( useDiagnostics .AND. |
IF ( useDiagnostics .AND. |
569 |
& (.NOT.implicitDiffusion .OR. useGMRedi) ) THEN |
& (.NOT.implicitDiffusion .OR. trUseGMRedi) ) THEN |
570 |
diagName = 'DFrE'//diagSufx |
diagName = 'DFrE'//diagSufx |
571 |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
CALL DIAGNOSTICS_FILL(df,diagName, k,1, 2,bi,bj, myThid) |
572 |
ENDIF |
ENDIF |
574 |
|
|
575 |
#ifdef ALLOW_KPP |
#ifdef ALLOW_KPP |
576 |
C- Set non local KPP transport term (ghat): |
C- Set non local KPP transport term (ghat): |
577 |
IF ( useKPP .AND. k.GE.2 ) THEN |
IF ( trUseKPP .AND. k.GE.2 ) THEN |
578 |
DO j=1-Oly,sNy+Oly |
DO j=1-Oly,sNy+Oly |
579 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
580 |
df(i,j) = 0. _d 0 |
df(i,j) = 0. _d 0 |