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

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

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


Revision 1.15 - (show 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 C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_stats_rl.F,v 1.13 2009/04/28 18:16:53 jmc Exp $
2 C $Name: $
3
4 #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(
12 I myNr, arr, arrMask,arrhFac, arrArea, arrDr,
13 O theMin,theMax,theMean,theSD,theDel2,theVol,
14 I myThid )
15
16 C Calculate bare statistics of global array ``\_RL arr''.
17
18 C !USES:
19 IMPLICIT NONE
20 #include "SIZE.h"
21 #include "EEPARAMS.h"
22
23 C !INPUT PARAMETERS:
24 INTEGER myNr
25 _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)
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 INTEGER myThid
32 CEOP
33
34 C !LOCAL VARIABLES:
35 INTEGER bi,bj,I,J,K
36 INTEGER numPnts
37 LOGICAL noPnts
38 _RL tmpVal,rNumPnts
39 _RL theVar
40 _RL tmpVol
41 _RL tileMean(nSx,nSy)
42 _RL tileVar (nSx,nSy)
43 _RL tileSD (nSx,nSy)
44 _RL tileDel2(nSx,nSy)
45 _RL tileVol (nSx,nSy)
46
47 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
61 DO bj=myByLo(myThid),myByHi(myThid)
62 DO bi=myBxLo(myThid),myBxHi(myThid)
63 tileDel2(bi,bj) = 0.
64 tileVol (bi,bj) = 0.
65 tileMean(bi,bj) = 0.
66 tileVar (bi,bj) = 0.
67 DO K=1,myNr
68 DO J=1,sNy
69 DO I=1,sNx
70 tmpVal=arr(I,J,K,bi,bj)
71 IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
72 theMin=tmpVal
73 theMax=tmpVal
74 noPnts=.FALSE.
75 ENDIF
76 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 numPnts=numPnts+1
87 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 ENDDO
94 ENDDO
95 ENDDO
96 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 ENDDO
101 ENDDO
102
103 c _GLOBAL_SUM_RL(theDel2,myThid)
104 c _GLOBAL_SUM_RL(theVol,myThid)
105 c _GLOBAL_SUM_RL(theMean,myThid)
106 c _GLOBAL_SUM_RL(theVar,myThid)
107 CALL GLOBAL_SUM_TILE_RL( tileDel2, theDel2, myThid )
108 CALL GLOBAL_SUM_TILE_RL( tileVol , theVol , myThid )
109 CALL GLOBAL_SUM_TILE_RL( tileMean, theMean, myThid )
110 CALL GLOBAL_SUM_TILE_RL( tileVar , theVar , myThid )
111 tmpVal=FLOAT(numPnts)
112 _GLOBAL_SUM_RL(tmpVal,myThid)
113 numPnts=NINT(tmpVal)
114
115 IF (tmpVal.GT.0.) THEN
116 rNumPnts=1. _d 0/tmpVal
117 theDel2=theDel2*rNumPnts
118 ENDIF
119
120 IF (theVol.GT.0.) THEN
121 theMean=theMean/theVol
122 theVar=theVar/theVol
123 IF ( noPnts ) theMin = theMean
124 theMin=-theMin
125 _GLOBAL_MAX_RL(theMin,myThid)
126 theMin=-theMin
127 IF ( noPnts ) theMax = theMean
128 _GLOBAL_MAX_RL(theMax,myThid)
129
130 DO bj=myByLo(myThid),myByHi(myThid)
131 DO bi=myBxLo(myThid),myBxHi(myThid)
132 tileSD(bi,bj)=0.
133 DO K=1,myNr
134 DO J=1,sNy
135 DO I=1,sNx
136 tmpVal=arr(I,J,K,bi,bj)
137 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 tileSD(bi,bj) = tileSD(bi,bj)
141 & + tmpVol*(tmpVal-theMean)*(tmpVal-theMean)
142 ENDIF
143 ENDDO
144 ENDDO
145 ENDDO
146 c theSD = theSD + tileSD(bi,bj)
147 ENDDO
148 ENDDO
149
150 c _GLOBAL_SUM_RL(theSD,myThid)
151 CALL GLOBAL_SUM_TILE_RL( tileSD, theSD, myThid )
152
153 theSD = SQRT(theSD/theVol)
154 c theSD = SQRT(theVar-theMean*theMean)
155 ENDIF
156
157 RETURN
158 END

  ViewVC Help
Powered by ViewVC 1.1.22