/[MITgcm]/MITgcm/pkg/monitor/mon_stats_rl.F
ViewVC logotype

Diff of /MITgcm/pkg/monitor/mon_stats_rl.F

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

revision 1.5 by adcroft, Tue May 13 18:18:05 2003 UTC revision 1.11 by jmc, Thu Jan 27 16:36:24 2005 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "MONITOR_OPTIONS.h"  #include "MONITOR_OPTIONS.h"
5    
6    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7    CBOP
8    C     !ROUTINE: MON_STATS_RL
9    
10    C     !INTERFACE:
11        SUBROUTINE MON_STATS_RL(        SUBROUTINE MON_STATS_RL(
12       I                myNr, arr, arrMask,arrhFac, arrArea, arrDr,       I     myNr, arr, arrMask,arrhFac, arrArea, arrDr,
13       O                theMin,theMax,theMean,theSD,theDel2,theVol,       O     theMin,theMax,theMean,theSD,theDel2,theVol,
14       I                myThid )       I     myThid )
 C     /==========================================================\  
 C     | SUBROUTINE MON_STATS_RL                                  |  
 C     | o Calculate bare statistics of global array "_RL arr"    |  
 C     |==========================================================|  
 C     \==========================================================/  
       IMPLICIT NONE  
15    
16  C     === Global data ===  C     Calculate bare statistics of global array ``\_RL arr''.
17    
18    C     !USES:
19          IMPLICIT NONE
20  #include "SIZE.h"  #include "SIZE.h"
21  #include "EEPARAMS.h"  #include "EEPARAMS.h"
22    
23  C     === Routine arguments ===  C     !INPUT PARAMETERS:
24        INTEGER myNr        INTEGER myNr
25        _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)        _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
26        _RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)        _RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
27        _RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)        _RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
28        _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
29        _RS arrDr(myNr)        _RS arrDr(myNr)
30        _RL theMin        _RL theMin, theMax, theMean, theSD, theDel2, theVol
       _RL theMax  
       _RL theMean  
       _RL theSD  
       _RL theDel2  
       _RL theVol  
31        INTEGER myThid        INTEGER myThid
32    CEOP
33    
34  C     === Local variables ====  C     !LOCAL VARIABLES:
35        INTEGER bi,bj,I,J,K        INTEGER bi,bj,I,J,K
36        INTEGER numPnts        INTEGER numPnts
37        LOGICAL noPnts        LOGICAL noPnts
38        _RL tmpVal,rNumPnts        _RL tmpVal,rNumPnts
39        _RL theVar        _RL theVar,theVarTile
40        _RL tmpVol        _RL tmpVol
41          _RL theMeanTile, theSDTile, theDel2Tile, theVolTile
42    
43        theMin=0.        theMin=0.
44        theMax=0.        theMax=0.
# Line 53  C     === Local variables ==== Line 52  C     === Local variables ====
52    
53        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
54         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
55            theDel2Tile = 0.
56            theVolTile = 0.
57            theMeanTile = 0.
58            theVarTile = 0.
59          DO K=1,myNr          DO K=1,myNr
60           DO J=1,sNy           DO J=1,sNy
61            DO I=1,sNx            DO I=1,sNx
62             tmpVal=arr(I,J,K,bi,bj)             tmpVal=arr(I,J,K,bi,bj)
 c          IF (tmpVal.NE.0. .AND. noPnts) THEN  
63             IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN             IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
64              theMin=tmpVal              theMin=tmpVal
65              theMax=tmpVal              theMax=tmpVal
66              noPnts=.FALSE.              noPnts=.FALSE.
67             ENDIF             ENDIF
 c          IF (tmpVal.NE.0.) THEN  
68             IF (arrMask(I,J,K,bi,bj).NE.0.) THEN             IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
69              theMin=min(theMin,tmpVal)              theMin=min(theMin,tmpVal)
70              theMax=max(theMax,tmpVal)              theMax=max(theMax,tmpVal)
71              theDel2 = theDel2+0.25*ABS(              theDel2Tile = theDel2Tile+0.25*ABS(
72       &         (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj)       &         (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj)
73       &        +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj)       &        +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj)
74       &        +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj)       &        +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj)
# Line 75  c          IF (tmpVal.NE.0.) THEN Line 76  c          IF (tmpVal.NE.0.) THEN
76       &                               )       &                               )
77              numPnts=numPnts+1              numPnts=numPnts+1
78              tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)              tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
79              theVol = theVol   + tmpVol       &                                 *arrMask(I,J,K,bi,bj)
80              theMean = theMean + tmpVol*tmpVal              theVolTile = theVolTile   + tmpVol
81              theVar = theVar   + tmpVol*tmpVal**2              theMeanTile = theMeanTile + tmpVol*tmpVal
82                theVarTile = theVarTile   + tmpVol*tmpVal*tmpVal
83             ENDIF             ENDIF
84            ENDDO            ENDDO
85           ENDDO           ENDDO
86          ENDDO          ENDDO
87            theDel2 = theDel2 + theDel2Tile
88            theVol = theVol + theVolTile
89            theMean = theMean + theMeanTile
90            theVar = theVar + theVarTile
91         ENDDO         ENDDO
92        ENDDO        ENDDO
93    
       theMin=-theMin  
       _GLOBAL_MAX_R8(theMin,myThid)  
       theMin=-theMin  
       _GLOBAL_MAX_R8(theMax,myThid)  
94        _GLOBAL_SUM_R8(theDel2,myThid)        _GLOBAL_SUM_R8(theDel2,myThid)
95        _GLOBAL_SUM_R8(theVol,myThid)        _GLOBAL_SUM_R8(theVol,myThid)
96        _GLOBAL_SUM_R8(theMean,myThid)        _GLOBAL_SUM_R8(theMean,myThid)
97        _GLOBAL_SUM_R8(theVar,myThid)        _GLOBAL_SUM_R8(theVar,myThid)
98        tmpVal=FLOAT(numPnts)        tmpVal=FLOAT(numPnts)
99        _GLOBAL_SUM_R8(tmpVal,myThid)        _GLOBAL_SUM_R8(tmpVal,myThid)
100        numPnts=INT(tmpVal+0.5)        numPnts=NINT(tmpVal)
101    
102        IF (tmpVal.GT.0.) THEN        IF (tmpVal.GT.0.) THEN
103         rNumPnts=1./tmpVal         rNumPnts=1. _d 0/tmpVal
104         theDel2=theDel2*rNumPnts         theDel2=theDel2*rNumPnts
105        ENDIF        ENDIF
106    
107        IF (theVol.GT.0.) THEN        IF (theVol.GT.0.) THEN
108         theMean=theMean/theVol         theMean=theMean/theVol
109         theVar=theVar/theVol         theVar=theVar/theVol
110           IF ( noPnts ) theMin = theMean
111           theMin=-theMin
112           _GLOBAL_MAX_R8(theMin,myThid)
113           theMin=-theMin
114           IF ( noPnts ) theMax = theMean
115           _GLOBAL_MAX_R8(theMax,myThid)
116    
117         DO bj=myByLo(myThid),myByHi(myThid)         DO bj=myByLo(myThid),myByHi(myThid)
118          DO bi=myBxLo(myThid),myBxHi(myThid)          DO bi=myBxLo(myThid),myBxHi(myThid)
119             theSDtile=0.
120           DO K=1,myNr           DO K=1,myNr
121            DO J=1,sNy            DO J=1,sNy
122             DO I=1,sNx             DO I=1,sNx
# Line 115  c          IF (tmpVal.NE.0.) THEN Line 124  c          IF (tmpVal.NE.0.) THEN
124  c           IF (tmpVal.NE.0.) THEN  c           IF (tmpVal.NE.0.) THEN
125              IF (arrMask(I,J,K,bi,bj).NE.0.) THEN              IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
126               tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)               tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
127               theSD = theSD + tmpVol*(tmpVal-theMean)**2       &                                *arrMask(I,J,K,bi,bj)
128                 theSDtile = theSDtile + tmpVol*(tmpVal-theMean)**2
129              ENDIF              ENDIF
130             ENDDO             ENDDO
131            ENDDO            ENDDO
132           ENDDO           ENDDO
133             theSD = theSD + theSDtile
134          ENDDO          ENDDO
135         ENDDO         ENDDO
136    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.22