Back to home page

MITgcm

 
 

    


File indexing completed on 2021-03-16 05:11:58 UTC

view on githubraw file Latest commit a10c595e on 2021-03-16 01:30:05 UTC
2e8121cfc9 Jean*0001 #include "PTRACERS_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C     !ROUTINE: PTRACERS_DIAGNOSTICS_INIT
                0005 C     !INTERFACE:
                0006       SUBROUTINE PTRACERS_DIAGNOSTICS_INIT( myThid )
fd7e65c607 Jean*0007 
2e8121cfc9 Jean*0008 C     !DESCRIPTION:
                0009 C     Routine to initialize pTracers diagnostics
                0010 
                0011 C     !USES:
                0012       IMPLICIT NONE
                0013 C     === Global variables ===
                0014 #include "SIZE.h"
                0015 #include "PTRACERS_SIZE.h"
                0016 #include "EEPARAMS.h"
                0017 #include "PARAMS.h"
0a278985fd Jean*0018 #include "PTRACERS_PARAMS.h"
2e8121cfc9 Jean*0019 #include "GAD.h"
                0020 
                0021 C     !INPUT/OUTPUT PARAMETERS:
                0022 C     === Routine arguments ===
fd7e65c607 Jean*0023 C     myThid :: my Thread Id. number
2e8121cfc9 Jean*0024       INTEGER myThid
                0025 CEOP
                0026 
                0027 #ifdef ALLOW_DIAGNOSTICS
5ee8b47723 Jean*0028 C     !FUNCTIONS:
                0029       INTEGER     ILNBLNK
                0030       EXTERNAL    ILNBLNK
                0031       CHARACTER*4 GAD_DIAG_SUFX
                0032       EXTERNAL    GAD_DIAG_SUFX
                0033       CHARACTER*16 DIAGS_MK_UNITS
                0034       EXTERNAL     DIAGS_MK_UNITS
                0035 
2e8121cfc9 Jean*0036 C     !LOCAL VARIABLES:
                0037 C     === Local variables ===
fd7e65c607 Jean*0038 C     msgBuf      :: Informational/error message buffer
2e8121cfc9 Jean*0039 c     CHARACTER*(MAX_LEN_MBUF) msgBuf
                0040       INTEGER       diagNum
ab84bd527e Jean*0041       INTEGER       diagMate
2e8121cfc9 Jean*0042       CHARACTER*8   diagName
                0043       CHARACTER*16  diagCode
                0044       CHARACTER*16  diagUnits
                0045       CHARACTER*(80) diagTitle
                0046 
5ee8b47723 Jean*0047       INTEGER      iTrc, ilnb, ilng, tracerId
2e8121cfc9 Jean*0048       CHARACTER*7  trcUnits
                0049       CHARACTER*9  flxUnits, wUnits
                0050       CHARACTER*30 locName
5ee8b47723 Jean*0051       CHARACTER*60 longName
2e8121cfc9 Jean*0052       CHARACTER*4  diagSufx
                0053 
                0054 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0055 
                0056 C--   Add diagnostics to the (long) list
                0057 
                0058       IF ( usingPCoords ) THEN
                0059          flxUnits = '.Pa.m^2/s'
                0060          wUnits   = '.Pa/s    '
                0061       ELSE
                0062          flxUnits = '.m^3/s   '
                0063          wUnits   = '.m/s     '
                0064       ENDIF
                0065 
01111eb599 Jean*0066       DO iTrc=1,PTRACERS_num
2e8121cfc9 Jean*0067 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
5ee8b47723 Jean*0068 
2e8121cfc9 Jean*0069 C--    Set default name & tracer Units:
5ee8b47723 Jean*0070        WRITE(locName,'(A,I4.4,A)') 'Tracer ',iTrc
                0071        trcUnits  = 'kg/kg  '
                0072 C-     use units & names from data.ptracers :
2e8121cfc9 Jean*0073        ilnb = ILNBLNK(PTRACERS_units(iTrc))
                0074        IF ( ilnb.GE.1 ) THEN
                0075          ilnb = LEN(trcUnits)
                0076          trcUnits = PTRACERS_units(iTrc)(1:ilnb)
                0077        ENDIF
5ee8b47723 Jean*0078        ilnb = ILNBLNK(PTRACERS_names(iTrc))
2e8121cfc9 Jean*0079        IF ( ilnb.GE.1 ) THEN
                0080          ilnb = MIN(LEN(locName),ilnb)
5ee8b47723 Jean*0081          WRITE(locName,'(A)') PTRACERS_names(iTrc)(1:ilnb)
2e8121cfc9 Jean*0082        ENDIF
                0083        ilnb = MAX(ILNBLNK(locName),1)
5ee8b47723 Jean*0084 C-     long name:
                0085        WRITE(longName,'(A)') locName
                0086        ilng = ILNBLNK(PTRACERS_long_names(iTrc))
                0087        IF ( ilng.GE.1 ) THEN
                0088          ilng = MIN(LEN(longName),ilng)
                0089          WRITE(longName,'(A)') PTRACERS_long_names(iTrc)(1:ilng)
                0090        ENDIF
                0091        ilng = MAX(ILNBLNK(longName),1)
2e8121cfc9 Jean*0092 
                0093 C--    Add diagnostics of Tracer concentration & u,v,w Transport
01111eb599 Jean*0094        WRITE(diagName,'(A4,A2,A2)') 'TRAC',PTRACERS_ioLabel(iTrc),'  '
5ee8b47723 Jean*0095        WRITE(diagTitle,'(2A)') longName(1:ilng), ' concentration'
                0096        WRITE(diagUnits,'(A)') trcUnits
fd7e65c607 Jean*0097        diagCode  = 'SMR     MR      '
ab84bd527e Jean*0098        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0099      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
2e8121cfc9 Jean*0100 
5ee8b47723 Jean*0101        diagUnits = DIAGS_MK_UNITS( trcUnits//'.m/s', myThid )
01111eb599 Jean*0102        WRITE(diagName,'(A5,A2,A1)') 'UTRAC',PTRACERS_ioLabel(iTrc),' '
2e8121cfc9 Jean*0103        WRITE(diagTitle,'(2A)') 'Zonal Mass-Weighted Transp of ',
                0104      &                 locName(1:ilnb)
fd7e65c607 Jean*0105        diagCode  = 'UUr     MR      '
ab84bd527e Jean*0106        diagMate  = diagNum + 2
                0107        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0108      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
2e8121cfc9 Jean*0109 
01111eb599 Jean*0110        WRITE(diagName,'(A5,A2,A1)') 'VTRAC',PTRACERS_ioLabel(iTrc),' '
2e8121cfc9 Jean*0111        WRITE(diagTitle,'(2A)') 'Merid Mass-Weighted Transp of ',
                0112      &                 locName(1:ilnb)
fd7e65c607 Jean*0113        diagCode  = 'VVr     MR      '
ab84bd527e Jean*0114        diagMate  = diagNum
                0115        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0116      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
2e8121cfc9 Jean*0117 
5ee8b47723 Jean*0118        diagUnits = DIAGS_MK_UNITS( trcUnits//wUnits, myThid )
01111eb599 Jean*0119        WRITE(diagName,'(A5,A2,A1)') 'WTRAC',PTRACERS_ioLabel(iTrc),' '
2e8121cfc9 Jean*0120        WRITE(diagTitle,'(2A)') 'Vert  Mass-Weighted Transp of ',
                0121      &                 locName(1:ilnb)
                0122        diagCode  = 'WM      MR      '
ab84bd527e Jean*0123        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0124      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
2e8121cfc9 Jean*0125 
5ee8b47723 Jean*0126 C--    add diagnostics for Forcing and Adams-Bashforth tendency increment
2e8121cfc9 Jean*0127        tracerId = iTrc + GAD_TR1 - 1
                0128        diagSufx = GAD_DIAG_SUFX( tracerId, myThid )
5ee8b47723 Jean*0129        diagUnits = DIAGS_MK_UNITS( trcUnits//'/s', myThid )
                0130        diagName  = 'Forc'//diagSufx
                0131        WRITE(diagTitle,'(2A)') locName(1:ilnb),
                0132      &                   ' forcing tendency'
                0133        diagCode  = 'SMR     MR      '
                0134        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0135      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0136 
                0137        diagName  = 'AB_g'//diagSufx
                0138        WRITE(diagTitle,'(2A)') locName(1:ilnb),
                0139      &                   ' tendency from Adams-Bashforth'
                0140        diagCode  = 'SMR     MR      '
                0141        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0142      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0143 
1cbab8a41c Oliv*0144        diagName  = 'Tp_g'//diagSufx
                0145        WRITE(diagTitle,'(2A)') locName(1:ilnb),
7863e213e6 Oliv*0146      &         ' total transport tendency (before gchem_forcing_sep)'
1cbab8a41c Oliv*0147        diagCode  = 'SMR     MR      '
                0148        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0149      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0150 
5ee8b47723 Jean*0151 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0152 
                0153 C--    Add diagnostics of advective & diffusive flux:
                0154        diagUnits = DIAGS_MK_UNITS( trcUnits//flxUnits, myThid )
2e8121cfc9 Jean*0155 
                0156 C-     Advective flux:
                0157        diagName  = 'ADVr'//diagSufx
                0158        WRITE(diagTitle,'(2A)') 'Vertical   Advective Flux of ',
                0159      &                 locName(1:ilnb)
                0160        diagCode  = 'WM      LR      '
ab84bd527e Jean*0161        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0162      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
2e8121cfc9 Jean*0163        diagName  = 'ADVx'//diagSufx
                0164        WRITE(diagTitle,'(2A)') 'Zonal      Advective Flux of ',
                0165      &                 locName(1:ilnb)
ab84bd527e Jean*0166        diagCode  = 'UU      MR      '
                0167        diagMate  = diagNum + 2
                0168        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0169      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
2e8121cfc9 Jean*0170        diagName  = 'ADVy'//diagSufx
                0171        WRITE(diagTitle,'(2A)') 'Meridional Advective Flux of ',
                0172      &                 locName(1:ilnb)
ab84bd527e Jean*0173        diagCode  = 'VV      MR      '
                0174        diagMate  = diagNum
                0175        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0176      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
                0177 
2e8121cfc9 Jean*0178 C-     Diffusive flux:
                0179        diagName  = 'DFrE'//diagSufx
                0180        WRITE(diagTitle,'(2A)') 'Vertical Diffusive Flux of ',
                0181      &                 locName(1:ilnb)//' (Explicit part)'
                0182        diagCode  = 'WM      LR      '
ab84bd527e Jean*0183        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0184      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
f68e77b60d Jean*0185        diagName  = 'DFxE'//diagSufx
2e8121cfc9 Jean*0186        WRITE(diagTitle,'(2A)') 'Zonal      Diffusive Flux of ',
                0187      &                 locName(1:ilnb)
ab84bd527e Jean*0188        diagCode  = 'UU      MR      '
                0189        diagMate  = diagNum + 2
                0190        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0191      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
f68e77b60d Jean*0192        diagName  = 'DFyE'//diagSufx
2e8121cfc9 Jean*0193        WRITE(diagTitle,'(2A)') 'Meridional Diffusive Flux of ',
                0194      &                 locName(1:ilnb)
ab84bd527e Jean*0195        diagCode  = 'VV      MR      '
                0196        diagMate  = diagNum
                0197        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0198      I    diagName, diagCode, diagUnits, diagTitle, diagMate, myThid )
2e8121cfc9 Jean*0199 
                0200        diagName  = 'DFrI'//diagSufx
                0201        WRITE(diagTitle,'(2A)') 'Vertical Diffusive Flux of ',
                0202      &                 locName(1:ilnb)//' (Implicit part)'
                0203        diagCode  = 'WM      LR      '
ab84bd527e Jean*0204        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0205      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
2e8121cfc9 Jean*0206 
                0207 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
5ee8b47723 Jean*0208 
                0209 C--    Add diagnostics for other pkg contribution to ptracer solution
f0741b41c6 Jean*0210        IF ( useKPP ) THEN
                0211         diagName  = 'KPPg'//diagSufx
                0212         WRITE(diagTitle,'(2A)') 'KPP non-local Flux of ',
                0213      &                 locName(1:ilnb)
                0214         diagCode  = 'WM      LR      '
5ee8b47723 Jean*0215         diagUnits = DIAGS_MK_UNITS( trcUnits//flxUnits, myThid )
f0741b41c6 Jean*0216         CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0217      I          diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0218        ENDIF
                0219 
1db41719d4 Jean*0220        IF ( useDOWN_SLOPE ) THEN
                0221         diagName  = 'DSLP'//diagSufx
                0222         WRITE(diagTitle,'(2A)') locName(1:ilnb),
                0223      &                   ' tendency from Down-Slope package'
35a30a135f Jean*0224         diagCode  = 'SMR     MR      '
5ee8b47723 Jean*0225         diagUnits = DIAGS_MK_UNITS( trcUnits//'/s', myThid )
1db41719d4 Jean*0226         CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0227      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0228        ENDIF
                0229 
                0230 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
a10c595eb6 Timo*0231 
                0232 #ifdef ALLOW_AUTODIFF
                0233        WRITE(diagName,'(A6,A2)') 'ADJptr',PTRACERS_ioLabel(iTrc)
                0234        WRITE(diagTitle,'(3A)') 'sensitivity to ',
                0235      &                         longName(1:ilng), ' concentration'
                0236        WRITE(diagUnits,'(2A)') 'dJ/',trcUnits
                0237        diagCode  = 'SMRA    MR      '
                0238        CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0239      I           diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0240 #endif
                0241 
                0242 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
2e8121cfc9 Jean*0243       ENDDO
                0244 
c2ced55abd Jean*0245       diagName  = 'Add2EmP '
                0246       diagTitle = 'additional EmP from salt relaxation'
                0247       diagUnits = 'kg/m^2/s        '
                0248       diagCode  = 'SM      U1      '
                0249       CALL DIAGNOSTICS_ADDTOLIST( diagNum,
                0250      I          diagName, diagCode, diagUnits, diagTitle, 0, myThid )
                0251 
2e8121cfc9 Jean*0252 #endif /* ALLOW_DIAGNOSTICS */
                0253 
                0254       RETURN
                0255       END