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

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

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


Revision 1.15 - (hide annotations) (download)
Tue Jan 26 01:09:02 2010 UTC (14 years, 4 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint63g, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint65o, checkpoint62b, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, HEAD
Changes since 1.14: +66 -31 lines
change back mon_printstats_rl.F & mon_stats_rl.F and add a stop
 (in case someone forgot to update customized pieces of code)

1 jmc 1.15 C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_stats_rl.F,v 1.13 2009/04/28 18:16:53 jmc Exp $
2 adcroft 1.2 C $Name: $
3 adcroft 1.1
4 adcroft 1.5 #include "MONITOR_OPTIONS.h"
5 adcroft 1.1
6 edhill 1.10 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7     CBOP
8     C !ROUTINE: MON_STATS_RL
9    
10     C !INTERFACE:
11 adcroft 1.1 SUBROUTINE MON_STATS_RL(
12 jmc 1.15 I myNr, arr, arrMask,arrhFac, arrArea, arrDr,
13     O theMin,theMax,theMean,theSD,theDel2,theVol,
14 edhill 1.10 I myThid )
15    
16     C Calculate bare statistics of global array ``\_RL arr''.
17    
18     C !USES:
19 adcroft 1.1 IMPLICIT NONE
20     #include "SIZE.h"
21     #include "EEPARAMS.h"
22    
23 edhill 1.10 C !INPUT PARAMETERS:
24 adcroft 1.1 INTEGER myNr
25     _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
26 jmc 1.15 _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)
28     _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
29     _RS arrDr(myNr)
30     _RL theMin, theMax, theMean, theSD, theDel2, theVol
31 adcroft 1.1 INTEGER myThid
32 edhill 1.10 CEOP
33 adcroft 1.1
34 edhill 1.10 C !LOCAL VARIABLES:
35 adcroft 1.1 INTEGER bi,bj,I,J,K
36     INTEGER numPnts
37     LOGICAL noPnts
38     _RL tmpVal,rNumPnts
39 jmc 1.12 _RL theVar
40 jmc 1.15 _RL tmpVol
41 jmc 1.12 _RL tileMean(nSx,nSy)
42     _RL tileVar (nSx,nSy)
43     _RL tileSD (nSx,nSy)
44 jmc 1.15 _RL tileDel2(nSx,nSy)
45     _RL tileVol (nSx,nSy)
46 adcroft 1.1
47 jmc 1.15 C Since 2009/12/21 MON_CALC_STATS_RL replaces MON_STATS_RL
48     C which is now disabled
49     STOP 'ABNORMAL END: S/R MON_STATS_RL no longer maintained'
50    
51     theMin=0.
52     theMax=0.
53     theMean=0.
54     theSD=0.
55     theVar=0.
56     theDel2=0.
57     theVol=0.
58     numPnts=0
59     noPnts=.TRUE.
60 adcroft 1.1
61     DO bj=myByLo(myThid),myByHi(myThid)
62     DO bi=myBxLo(myThid),myBxHi(myThid)
63 jmc 1.15 tileDel2(bi,bj) = 0.
64     tileVol (bi,bj) = 0.
65 jmc 1.12 tileMean(bi,bj) = 0.
66     tileVar (bi,bj) = 0.
67 adcroft 1.1 DO K=1,myNr
68     DO J=1,sNy
69     DO I=1,sNx
70     tmpVal=arr(I,J,K,bi,bj)
71 jmc 1.15 IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
72     theMin=tmpVal
73     theMax=tmpVal
74     noPnts=.FALSE.
75 adcroft 1.1 ENDIF
76 jmc 1.15 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
77     theMin=min(theMin,tmpVal)
78     theMax=max(theMax,tmpVal)
79     tileDel2(bi,bj) = tileDel2(bi,bj)
80     & + 0.25*ABS(
81     & (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj)
82     & +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj)
83     & +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj)
84     & +(arr(I,J-1,K,bi,bj)-tmpVal)*arrMask(I,J-1,K,bi,bj)
85     & )
86 adcroft 1.1 numPnts=numPnts+1
87 jmc 1.15 tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
88     & *arrMask(I,J,K,bi,bj)
89     tileVol (bi,bj) = tileVol (bi,bj) + tmpVol
90     tileMean(bi,bj) = tileMean(bi,bj) + tmpVol*tmpVal
91     tileVar (bi,bj) = tileVar (bi,bj) + tmpVol*tmpVal*tmpVal
92     ENDIF
93 adcroft 1.1 ENDDO
94     ENDDO
95     ENDDO
96 jmc 1.15 c theDel2 = theDel2 + tileDel2(bi,bj)
97     c theVol = theVol + tileVol(bi,bj)
98     c theMean = theMean + tileMean(bi,bj)
99     c theVar = theVar + tileVar (bi,bj)
100 adcroft 1.1 ENDDO
101     ENDDO
102    
103 jmc 1.15 c _GLOBAL_SUM_RL(theDel2,myThid)
104     c _GLOBAL_SUM_RL(theVol,myThid)
105 jmc 1.13 c _GLOBAL_SUM_RL(theMean,myThid)
106     c _GLOBAL_SUM_RL(theVar,myThid)
107 jmc 1.15 CALL GLOBAL_SUM_TILE_RL( tileDel2, theDel2, myThid )
108     CALL GLOBAL_SUM_TILE_RL( tileVol , theVol , myThid )
109 jmc 1.12 CALL GLOBAL_SUM_TILE_RL( tileMean, theMean, myThid )
110     CALL GLOBAL_SUM_TILE_RL( tileVar , theVar , myThid )
111 adcroft 1.1 tmpVal=FLOAT(numPnts)
112 jmc 1.13 _GLOBAL_SUM_RL(tmpVal,myThid)
113 jmc 1.9 numPnts=NINT(tmpVal)
114 adcroft 1.1
115     IF (tmpVal.GT.0.) THEN
116 jmc 1.11 rNumPnts=1. _d 0/tmpVal
117 jmc 1.15 theDel2=theDel2*rNumPnts
118     ENDIF
119    
120     IF (theVol.GT.0.) THEN
121     theMean=theMean/theVol
122     theVar=theVar/theVol
123 jmc 1.9 IF ( noPnts ) theMin = theMean
124     theMin=-theMin
125 jmc 1.13 _GLOBAL_MAX_RL(theMin,myThid)
126 jmc 1.9 theMin=-theMin
127     IF ( noPnts ) theMax = theMean
128 jmc 1.13 _GLOBAL_MAX_RL(theMax,myThid)
129 adcroft 1.1
130     DO bj=myByLo(myThid),myByHi(myThid)
131     DO bi=myBxLo(myThid),myBxHi(myThid)
132 jmc 1.12 tileSD(bi,bj)=0.
133 adcroft 1.1 DO K=1,myNr
134     DO J=1,sNy
135     DO I=1,sNx
136     tmpVal=arr(I,J,K,bi,bj)
137 jmc 1.15 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
138     tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
139     & *arrMask(I,J,K,bi,bj)
140 jmc 1.12 tileSD(bi,bj) = tileSD(bi,bj)
141 jmc 1.15 & + tmpVol*(tmpVal-theMean)*(tmpVal-theMean)
142     ENDIF
143 adcroft 1.1 ENDDO
144     ENDDO
145     ENDDO
146 jmc 1.12 c theSD = theSD + tileSD(bi,bj)
147 adcroft 1.1 ENDDO
148     ENDDO
149    
150 jmc 1.13 c _GLOBAL_SUM_RL(theSD,myThid)
151 jmc 1.12 CALL GLOBAL_SUM_TILE_RL( tileSD, theSD, myThid )
152 adcroft 1.1
153 jmc 1.15 theSD = SQRT(theSD/theVol)
154 jmc 1.12 c theSD = SQRT(theVar-theMean*theMean)
155 adcroft 1.1 ENDIF
156    
157     RETURN
158     END

  ViewVC Help
Powered by ViewVC 1.1.22