Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:43:03 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
01111eb599 Jean*0001 #undef STAND_ALONE_IOLABEL_TESTING
                0002 C     to test the S/R above, #define the above C-PreProcessor flag
                0003 C     and compile this fortran source code alone.
                0004 
                0005 #ifdef STAND_ALONE_IOLABEL_TESTING
                0006       PROGRAM MAIN
                0007       INTEGER NLL, I
                0008       PARAMETER (NLL=62*62)
                0009       CHARACTER*2 LL(NLL)
                0010 
                0011       CALL PTRACERS_SET_IOLABEL( LL, NLL, 1 )
                0012       DO I=1, NLL
                0013        PRINT *, LL(I)
                0014       ENDDO
                0015       END
                0016 #endif /* STAND_ALONE_IOLABEL_TESTING */
                0017 
                0018 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0019 
                0020 CBOP
                0021 C !ROUTINE: PTRACERS_SET_IOLABEL
                0022 
                0023 C !INTERFACE: ==========================================================
                0024       SUBROUTINE PTRACERS_SET_IOLABEL(
                0025      O                    ioLbl,
                0026      I                    nbLbl, myThid )
                0027 
                0028 C !DESCRIPTION:
                0029 C   S/R  PTRACERS_SET_IOLABEL
                0030 C   Set pTracers IO & diagnostics label (2 characters long)
                0031 C
                0032 C   Set sequenced label list 00, 02, 03, ... 99, 0a...0Z...9a...9Z,a0...ZZ
                0033 C    to more than 99 TRACERS but without requiring more than two digit labels.
                0034 C   Sequence below allows 3843 (=62**2 -1) tracers.
                0035 C   First 99 are numbered in decimal ;
                0036 C   Then, from 100 to 619, analog to base 52 counting:
                0037 C    0-9 1rst digit , a-z,A-Z (=52 id) 2nd digit ;
                0038 C   And from 620 to 3843, analog to base 62 counting:
                0039 C    a-z,A-Z 1rst digit ; 0-9,a-z,A-Z (=62 id) 2nd digit ;
                0040 C ======================================================================
                0041 
                0042 C !USES:
                0043       IMPLICIT NONE
                0044 
                0045 C !INPUT PARAMETERS: ===================================================
                0046 C     nbLbl       :: number of labels to define
                0047 C     myThid      :: my Thread Id number
                0048       INTEGER     nbLbl
                0049       INTEGER     myThid
                0050 
                0051 C !OUTPUT PARAMETERS: ==================================================
                0052 C     ioLbl       :: io-label
                0053       CHARACTER*2 ioLbl(nbLbl)
                0054 
                0055 C !LOCAL VARIABLES: ====================================================
                0056 C     c1Set1      :: 1rst digit (from left) of 1rst set of labels
                0057 C     c2Set1      ::  2nd digit (from left) of 1rst set of labels
                0058 C     c1Set2      :: 1rst digit (from left) of  2nd set of labels
                0059 C     c2Set2      ::  2nd digit (from left) of  2nd set of labels
                0060 C     c1Set3      :: 1rst digit (from left) of  3rd set of labels
                0061 C     c2Set3      ::  2nd digit (from left) of  3rd set of labels
                0062 C     l1Set       :: length of 1rst digit list
                0063 C     l2Set       :: length of  2nd digit list
                0064 C     i,j,n       :: loop indices
                0065       CHARACTER*10 c1Set1
                0066       CHARACTER*10 c2Set1
                0067       CHARACTER*10 c1Set2
                0068       CHARACTER*52 c2Set2
                0069       CHARACTER*52 c1Set3
                0070       CHARACTER*62 c2Set3
                0071       INTEGER l1Set, l2Set
                0072       INTEGER i,j,n
                0073 CEOP
                0074 
                0075       c1Set1 = '0123456789'
                0076       c2Set1 = c1Set1
                0077 
                0078       c1Set2 = c1Set1
                0079       c2Set2 = 'abcdefghijklmnopqrstuvwxyz'
                0080      &       //'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
                0081 
                0082       c1Set3 = c2Set2
                0083       c2Set3 = c1Set1//c2Set2
                0084 
                0085 C--   Set a default.
88f72205aa Jean*0086 C     This should not show up unless there is a problem
01111eb599 Jean*0087 C     where nbLbl is equal or greater than 10*10 + 10*52 + 52*62 = 62**2
                0088       DO n=1,nbLbl
                0089        ioLbl(n) = '--'
                0090       ENDDO
                0091 
                0092       n = 0
                0093 C--   First set of labels:
                0094       l1Set = LEN(c1Set1)
                0095       l2Set = LEN(c2Set1)
                0096       DO j=1,l1Set
                0097        DO i=1,l2Set
                0098 C-    skip label "00" (since we start tracer numberi from 1)
                0099         IF ( i.NE.1 .OR. j.NE.1 ) THEN
                0100          n=n+1
                0101          IF ( n.LE.nbLbl ) THEN
                0102           ioLbl(n)(1:1) = c1Set1(j:j)
                0103           ioLbl(n)(2:2) = c2Set1(i:i)
                0104          ENDIF
                0105         ENDIF
                0106        ENDDO
                0107       ENDDO
                0108 
                0109 C--   2nd set of labels:
                0110       l1Set = LEN(c1Set2)
                0111       l2Set = LEN(c2Set2)
                0112       DO j=1,l1Set
                0113        DO i=1,l2Set
                0114         n=n+1
                0115         IF ( n.LE.nbLbl ) THEN
                0116           ioLbl(n)(1:1) = c1Set2(j:j)
                0117           ioLbl(n)(2:2) = c2Set2(i:i)
                0118         ENDIF
                0119        ENDDO
                0120       ENDDO
                0121 
                0122 C--   3rd set of labels:
                0123       l1Set = LEN(c1Set3)
                0124       l2Set = LEN(c2Set3)
                0125       DO j=1,l1Set
                0126        DO i=1,l2Set
                0127         n=n+1
                0128         IF ( n.LE.nbLbl ) THEN
                0129           ioLbl(n)(1:1) = c1Set3(j:j)
                0130           ioLbl(n)(2:2) = c2Set3(i:i)
                0131         ENDIF
                0132        ENDDO
                0133       ENDDO
                0134 
                0135       RETURN
                0136       END