/[MITgcm]/MITgcm/pkg/diagnostics/diagnostics_fill.F
ViewVC logotype

Diff of /MITgcm/pkg/diagnostics/diagnostics_fill.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8 by jmc, Fri May 20 07:28:49 2005 UTC revision 1.9 by jmc, Sun Jun 26 16:51:49 2005 UTC
# Line 6  C $Name$ Line 6  C $Name$
6  CBOP  CBOP
7  C     !ROUTINE: DIAGNOSTICS_FILL  C     !ROUTINE: DIAGNOSTICS_FILL
8  C     !INTERFACE:  C     !INTERFACE:
9        SUBROUTINE DIAGNOSTICS_FILL (inpfld, chardiag,        SUBROUTINE DIAGNOSTICS_FILL (inpfld, chardiag,
10       I                kLev, nLevs, bibjflg, biArg, bjArg, myThid)       I                kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
11    
12  C     !DESCRIPTION:  C     !DESCRIPTION:
13  C***********************************************************************  C***********************************************************************
# Line 31  C     chardiag ... Character expression Line 31  C     chardiag ... Character expression
31  C     kLev   ..... Integer flag for vertical levels:  C     kLev   ..... Integer flag for vertical levels:
32  C                  > 0 (any integer): WHICH single level to increment in qdiag.  C                  > 0 (any integer): WHICH single level to increment in qdiag.
33  C                  0,-1 to increment "nLevs" levels in qdiag,  C                  0,-1 to increment "nLevs" levels in qdiag,
34  C                  0 : fill-in in the same order as the input array  C                  0 : fill-in in the same order as the input array
35  C                  -1: fill-in in reverse order.  C                  -1: fill-in in reverse order.
36  C     nLevs ...... indicates Number of levels of the input field array  C     nLevs ...... indicates Number of levels of the input field array
37  C                  (whether to fill-in all the levels (kLev<1) or just one (kLev>0))  C                  (whether to fill-in all the levels (kLev<1) or just one (kLev>0))
38  C     bibjflg .... Integer flag to indicate instructions for bi bj loop  C     bibjFlg .... Integer flag to indicate instructions for bi bj loop
39  C                  0 indicates that the bi-bj loop must be done here  C                  0 indicates that the bi-bj loop must be done here
40  C                  1 indicates that the bi-bj loop is done OUTSIDE  C                  1 indicates that the bi-bj loop is done OUTSIDE
41  C                  2 indicates that the bi-bj loop is done OUTSIDE  C                  2 indicates that the bi-bj loop is done OUTSIDE
# Line 43  C                     AND that we have b Line 43  C                     AND that we have b
43  C                  3 indicates that the bi-bj loop is done OUTSIDE  C                  3 indicates that the bi-bj loop is done OUTSIDE
44  C                     AND that we have been sent a local array  C                     AND that we have been sent a local array
45  C                     AND that the array has no overlap region (interior only)  C                     AND that the array has no overlap region (interior only)
46  C                  NOTE - bibjflg can be NEGATIVE to indicate not to increment counter  C                  NOTE - bibjFlg can be NEGATIVE to indicate not to increment counter
47  C     biArg ...... X-direction tile number - used for bibjflg=1-3  C     biArg ...... X-direction tile number - used for bibjFlg=1-3
48  C     bjArg ...... Y-direction tile number - used for bibjflg=1-3  C     bjArg ...... Y-direction tile number - used for bibjFlg=1-3
49  C     myThid     ::  my thread Id number  C     myThid     ::  my thread Id number
50  C***********************************************************************  C***********************************************************************
51  C                  NOTE: User beware! If a local (1 tile only) array  C                  NOTE: User beware! If a local (1 tile only) array
52  C                        is sent here, bibjflg MUST NOT be set to 0  C                        is sent here, bibjFlg MUST NOT be set to 0
53  C                        or there will be out of bounds problems!  C                        or there will be out of bounds problems!
54  C***********************************************************************  C***********************************************************************
55        _RL inpfld(*)        _RL inpfld(*)
56        CHARACTER*8 chardiag        CHARACTER*8 chardiag
57        INTEGER kLev, nLevs, bibjflg, biArg, bjArg        INTEGER kLev, nLevs, bibjFlg, biArg, bjArg
58        INTEGER myThid        INTEGER myThid
59  CEOP  CEOP
60    
61  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
62    C     ndId      :: diagnostic Id number (in available diagnostics list)
63  C ===============  C ===============
64        INTEGER m, n, j        INTEGER m, n, j, k, l, bi, bj
65        INTEGER ndiagnum, ipointer, iSp, jSd        INTEGER ndId, ipt, iSp
66        INTEGER region2fill(0:nRegions)        INTEGER region2fill(0:nRegions)
67    
68          IF ( bibjFlg.EQ.0 ) THEN
69            bi = 1
70            bj = 1
71          ELSE
72            bi = biArg
73            bj = bjArg
74          ENDIF
75  C--   2D/3D Diagnostics :  C--   2D/3D Diagnostics :
76  C Run through list of active diagnostics to make sure  C Run through list of active diagnostics to make sure
77  C we are trying to fill a valid diagnostic  C we are trying to fill a valid diagnostic
   
       ndiagnum = 0  
       ipointer = 0  
78        DO n=1,nlists        DO n=1,nlists
79         DO m=1,nActive(n)         DO m=1,nActive(n)
80          IF ( chardiag.EQ.flds(m,n) ) THEN          IF ( chardiag.EQ.flds(m,n) .AND. idiag(m,n).GT.0 ) THEN
81           ndiagnum = jdiag(m,n)           ipt = idiag(m,n)
82           IF (ndiag(ndiagnum).GE.0) ipointer = idiag(ndiagnum)           IF ( ndiag(ipt,bi,bj).GE.0 ) THEN
83    C diagnostic is valid & active, do the filling:
84               ndId = jdiag(m,n)
85               CALL DIAGNOSTICS_FILL_FIELD( inpfld, ndId, ipt,
86         I                kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
87             ENDIF
88          ENDIF          ENDIF
89         ENDDO         ENDDO
90        ENDDO        ENDDO
91    
 C if we are a valid and an active diagnostic, do the filling:  
       IF ( ipointer.NE.0 ) THEN  
         CALL DIAGNOSTICS_FILL_FIELD( inpfld, ndiagnum, ipointer,  
      I                kLev, nLevs, bibjflg, biArg, bjArg, myThid )  
       ENDIF  
   
92  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
93  C--   Global/Regional Statistics :  C--   Global/Regional Statistics :
94    
95  C Run through list of active statistics-diagnostics to make sure  C Run through list of active statistics-diagnostics to make sure
96  C we are trying to compute & fill a valid diagnostic  C we are trying to compute & fill a valid diagnostic
97    
       ndiagnum = 0  
       iSp = 0  
98        DO n=1,diagSt_nbLists        DO n=1,diagSt_nbLists
99         DO m=1,diagSt_nbActv(n)         DO m=1,diagSt_nbActv(n)
100          IF ( chardiag.EQ.diagSt_Flds(m,n) ) THEN          IF ( chardiag.EQ.diagSt_Flds(m,n) .AND. iSdiag(m,n).GT.0 ) THEN
101           jSd = jSdiag(m,n)           iSp = iSdiag(m,n)
102           iSp = iSdiag(jSd)           IF ( qSdiag(0,0,iSp,bi,bj).GE.0. ) THEN
103           IF ( iSp.NE.0 ) THEN  C-         diagnostics is valid and Active. Find list of regions to fill:
            IF (qSdiag(0,0,iSp,1,1).LT.0.) iSp = 0  
          ENDIF  
          IF ( ndiagnum.EQ.0 ) THEN  
104             DO j=0,nRegions             DO j=0,nRegions
105              region2fill(j) = diagSt_region(j,n)              region2fill(j) = diagSt_region(j,n)
106             ENDDO             ENDDO
107           ELSE  C-         if this diagnostics appears in several lists (with same freq)
108             DO j=0,nRegions  C          then add regions from other lists
109              region2fill(j) = MAX( region2fill(j), diagSt_region(j,n) )             DO l=1,diagSt_nbLists
110                DO k=1,diagSt_nbActv(l)
111                 IF ( iSdiag(k,l).EQ.-iSp ) THEN
112                  DO j=0,nRegions
113                   region2fill(j) = MAX(region2fill(j),diagSt_region(j,l))
114                  ENDDO
115                 ENDIF
116                ENDDO
117             ENDDO             ENDDO
118    C-         Now do the filling :
119               ndId = jSdiag(m,n)
120               CALL DIAGSTATS_FILL( inpfld, ndId, iSp, region2fill,
121         I                kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
122           ENDIF           ENDIF
          ndiagnum = jSd  
123          ENDIF          ENDIF
124         ENDDO         ENDDO
125        ENDDO        ENDDO
126    
127  C if we are a valid and an active diagnostic, do the filling:        RETURN
       IF ( iSp.NE.0 ) THEN  
         CALL DIAGSTATS_FILL( inpfld, ndiagnum, iSp, region2fill,  
      I                kLev, nLevs, bibjflg, biArg, bjArg, myThid )  
       ENDIF  
   
       RETURN  
128        END        END

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22