/[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.1 by adcroft, Wed May 30 19:33:18 2001 UTC revision 1.6 by jmc, Mon Nov 10 23:03:29 2003 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4  #include "CPP_OPTIONS.h"  #include "MONITOR_OPTIONS.h"
5    
6        SUBROUTINE MON_STATS_RL(        SUBROUTINE MON_STATS_RL(
7       I                myNr, arr,       I                myNr, arr, arrMask,arrhFac, arrArea, arrDr,
8       O                theMin,theMax,theMean,theSD,       O                theMin,theMax,theMean,theSD,theDel2,theVol,
9       I                myThid )       I                myThid )
10  C     /==========================================================\  C     /==========================================================\
11  C     | SUBROUTINE MON_STATS_RL                                  |  C     | SUBROUTINE MON_STATS_RL                                  |
# Line 21  C     === Global data === Line 21  C     === Global data ===
21  C     === Routine arguments ===  C     === Routine arguments ===
22        INTEGER myNr        INTEGER myNr
23        _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)
24          _RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
25          _RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
26          _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
27          _RS arrDr(myNr)
28        _RL theMin        _RL theMin
29        _RL theMax        _RL theMax
30        _RL theMean        _RL theMean
31        _RL theSD        _RL theSD
32          _RL theDel2
33          _RL theVol
34        INTEGER myThid        INTEGER myThid
35    
36  C     === Local variables ====  C     === Local variables ====
# Line 33  C     === Local variables ==== Line 39  C     === Local variables ====
39        LOGICAL noPnts        LOGICAL noPnts
40        _RL tmpVal,rNumPnts        _RL tmpVal,rNumPnts
41        _RL theVar        _RL theVar
42          _RL tmpVol
43    
44        theMin=0.        theMin=0.
45        theMax=0.        theMax=0.
46        theMean=0.        theMean=0.
47        theSD=0.        theSD=0.
48        theVar=0.        theVar=0.
49          theDel2=0.
50          theVol=0.
51        numPnts=0        numPnts=0
52        noPnts=.TRUE.        noPnts=.TRUE.
53    
# Line 48  C     === Local variables ==== Line 57  C     === Local variables ====
57           DO J=1,sNy           DO J=1,sNy
58            DO I=1,sNx            DO I=1,sNx
59             tmpVal=arr(I,J,K,bi,bj)             tmpVal=arr(I,J,K,bi,bj)
60             IF (tmpVal.NE.0. .AND. noPnts) THEN  c          IF (tmpVal.NE.0. .AND. noPnts) THEN
61               IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
62              theMin=tmpVal              theMin=tmpVal
63              theMax=tmpVal              theMax=tmpVal
64              noPnts=.FALSE.              noPnts=.FALSE.
65             ENDIF             ENDIF
66             IF (tmpVal.NE.0.) THEN  c          IF (tmpVal.NE.0.) THEN
67               IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
68              theMin=min(theMin,tmpVal)              theMin=min(theMin,tmpVal)
69              theMax=max(theMax,tmpVal)              theMax=max(theMax,tmpVal)
70              theMean=theMean+tmpVal              theDel2 = theDel2+0.25*ABS(
71              theVar=theVar+tmpVal**2       &         (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj)
72         &        +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj)
73         &        +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj)
74         &        +(arr(I,J-1,K,bi,bj)-tmpVal)*arrMask(I,J-1,K,bi,bj)
75         &                               )
76              numPnts=numPnts+1              numPnts=numPnts+1
77                tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
78         &                                 *arrMask(I,J,K,bi,bj)
79                theVol = theVol   + tmpVol
80                theMean = theMean + tmpVol*tmpVal
81                theVar = theVar   + tmpVol*tmpVal**2
82             ENDIF             ENDIF
83            ENDDO            ENDDO
84           ENDDO           ENDDO
# Line 70  C     === Local variables ==== Line 90  C     === Local variables ====
90        _GLOBAL_MAX_R8(theMin,myThid)        _GLOBAL_MAX_R8(theMin,myThid)
91        theMin=-theMin        theMin=-theMin
92        _GLOBAL_MAX_R8(theMax,myThid)        _GLOBAL_MAX_R8(theMax,myThid)
93          _GLOBAL_SUM_R8(theDel2,myThid)
94          _GLOBAL_SUM_R8(theVol,myThid)
95        _GLOBAL_SUM_R8(theMean,myThid)        _GLOBAL_SUM_R8(theMean,myThid)
96        _GLOBAL_SUM_R8(theVar,myThid)        _GLOBAL_SUM_R8(theVar,myThid)
97        tmpVal=FLOAT(numPnts)        tmpVal=FLOAT(numPnts)
# Line 78  C     === Local variables ==== Line 100  C     === Local variables ====
100    
101        IF (tmpVal.GT.0.) THEN        IF (tmpVal.GT.0.) THEN
102         rNumPnts=1./tmpVal         rNumPnts=1./tmpVal
103         theMean=theMean*rNumPnts         theDel2=theDel2*rNumPnts
104         theVar=theVar*rNumPnts        ENDIF
105    
106          IF (theVol.GT.0.) THEN
107           theMean=theMean/theVol
108           theVar=theVar/theVol
109    
110         DO bj=myByLo(myThid),myByHi(myThid)         DO bj=myByLo(myThid),myByHi(myThid)
111          DO bi=myBxLo(myThid),myBxHi(myThid)          DO bi=myBxLo(myThid),myBxHi(myThid)
# Line 87  C     === Local variables ==== Line 113  C     === Local variables ====
113            DO J=1,sNy            DO J=1,sNy
114             DO I=1,sNx             DO I=1,sNx
115              tmpVal=arr(I,J,K,bi,bj)              tmpVal=arr(I,J,K,bi,bj)
116              IF (tmpVal.NE.0.) THEN  c           IF (tmpVal.NE.0.) THEN
117               theSD=theSD+(tmpVal-theMean)**2              IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
118                 tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
119         &                                *arrMask(I,J,K,bi,bj)
120                 theSD = theSD + tmpVol*(tmpVal-theMean)**2
121              ENDIF              ENDIF
122             ENDDO             ENDDO
123            ENDDO            ENDDO
# Line 98  C     === Local variables ==== Line 127  C     === Local variables ====
127    
128         _GLOBAL_SUM_R8(theSD,myThid)         _GLOBAL_SUM_R8(theSD,myThid)
129    
130  c      theSD=sqrt(theSD*rNumPnts)         theSD=sqrt(theSD/theVol)
131         theSD=sqrt(theVar-theMean**2)  c      theSD=sqrt(theVar-theMean**2)
132        ENDIF        ENDIF
133    
134        RETURN        RETURN

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.22