1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "CPP_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, |
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 |
|
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 |
40 |
_RL theVol, tmpVol |
_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 |
theMin=0. |
theMin=0. |
48 |
theMax=0. |
theMax=0. |
56 |
|
|
57 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
58 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
59 |
|
tileDel2(bi,bj) = 0. |
60 |
|
tileVol (bi,bj) = 0. |
61 |
|
tileMean(bi,bj) = 0. |
62 |
|
tileVar (bi,bj) = 0. |
63 |
DO K=1,myNr |
DO K=1,myNr |
64 |
DO J=1,sNy |
DO J=1,sNy |
65 |
DO I=1,sNx |
DO I=1,sNx |
66 |
tmpVal=arr(I,J,K,bi,bj) |
tmpVal=arr(I,J,K,bi,bj) |
|
c IF (tmpVal.NE.0. .AND. noPnts) THEN |
|
67 |
IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN |
IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN |
68 |
theMin=tmpVal |
theMin=tmpVal |
69 |
theMax=tmpVal |
theMax=tmpVal |
70 |
noPnts=.FALSE. |
noPnts=.FALSE. |
71 |
ENDIF |
ENDIF |
|
c IF (tmpVal.NE.0.) THEN |
|
72 |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
73 |
theMin=min(theMin,tmpVal) |
theMin=min(theMin,tmpVal) |
74 |
theMax=max(theMax,tmpVal) |
theMax=max(theMax,tmpVal) |
75 |
theDel2 = theDel2+0.25*ABS( |
tileDel2(bi,bj) = tileDel2(bi,bj) |
76 |
|
& + 0.25*ABS( |
77 |
& (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) |
78 |
& +(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) |
79 |
& +(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) |
80 |
& +(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) |
81 |
& ) |
& ) |
82 |
numPnts=numPnts+1 |
numPnts=numPnts+1 |
83 |
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) |
84 |
theVol = theVol + tmpVol |
& *arrMask(I,J,K,bi,bj) |
85 |
theMean = theMean + tmpVol*tmpVal |
tileVol (bi,bj) = tileVol (bi,bj) + tmpVol |
86 |
theVar = theVar + tmpVol*tmpVal**2 |
tileMean(bi,bj) = tileMean(bi,bj) + tmpVol*tmpVal |
87 |
|
tileVar (bi,bj) = tileVar (bi,bj) + tmpVol*tmpVal*tmpVal |
88 |
ENDIF |
ENDIF |
89 |
ENDDO |
ENDDO |
90 |
ENDDO |
ENDDO |
91 |
ENDDO |
ENDDO |
92 |
|
c theDel2 = theDel2 + tileDel2(bi,bj) |
93 |
|
c theVol = theVol + tileVol(bi,bj) |
94 |
|
c theMean = theMean + tileMean(bi,bj) |
95 |
|
c theVar = theVar + tileVar (bi,bj) |
96 |
ENDDO |
ENDDO |
97 |
ENDDO |
ENDDO |
98 |
|
|
99 |
theMin=-theMin |
c _GLOBAL_SUM_RL(theDel2,myThid) |
100 |
_GLOBAL_MAX_R8(theMin,myThid) |
c _GLOBAL_SUM_RL(theVol,myThid) |
101 |
theMin=-theMin |
c _GLOBAL_SUM_RL(theMean,myThid) |
102 |
_GLOBAL_MAX_R8(theMax,myThid) |
c _GLOBAL_SUM_RL(theVar,myThid) |
103 |
_GLOBAL_SUM_R8(theDel2,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileDel2, theDel2, myThid ) |
104 |
_GLOBAL_SUM_R8(theVol,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileVol , theVol , myThid ) |
105 |
_GLOBAL_SUM_R8(theMean,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileMean, theMean, myThid ) |
106 |
_GLOBAL_SUM_R8(theVar,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileVar , theVar , myThid ) |
107 |
tmpVal=FLOAT(numPnts) |
tmpVal=FLOAT(numPnts) |
108 |
_GLOBAL_SUM_R8(tmpVal,myThid) |
_GLOBAL_SUM_RL(tmpVal,myThid) |
109 |
numPnts=INT(tmpVal+0.5) |
numPnts=NINT(tmpVal) |
110 |
|
|
111 |
IF (tmpVal.GT.0.) THEN |
IF (tmpVal.GT.0.) THEN |
112 |
rNumPnts=1./tmpVal |
rNumPnts=1. _d 0/tmpVal |
113 |
theDel2=theDel2*rNumPnts |
theDel2=theDel2*rNumPnts |
114 |
ENDIF |
ENDIF |
115 |
|
|
116 |
IF (theVol.GT.0.) THEN |
IF (theVol.GT.0.) THEN |
117 |
theMean=theMean/theVol |
theMean=theMean/theVol |
118 |
theVar=theVar/theVol |
theVar=theVar/theVol |
119 |
|
IF ( noPnts ) theMin = theMean |
120 |
|
theMin=-theMin |
121 |
|
_GLOBAL_MAX_RL(theMin,myThid) |
122 |
|
theMin=-theMin |
123 |
|
IF ( noPnts ) theMax = theMean |
124 |
|
_GLOBAL_MAX_RL(theMax,myThid) |
125 |
|
|
126 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
127 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
128 |
|
tileSD(bi,bj)=0. |
129 |
DO K=1,myNr |
DO K=1,myNr |
130 |
DO J=1,sNy |
DO J=1,sNy |
131 |
DO I=1,sNx |
DO I=1,sNx |
132 |
tmpVal=arr(I,J,K,bi,bj) |
tmpVal=arr(I,J,K,bi,bj) |
|
c IF (tmpVal.NE.0.) THEN |
|
133 |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
134 |
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) |
135 |
theSD = theSD + tmpVol*(tmpVal-theMean)**2 |
& *arrMask(I,J,K,bi,bj) |
136 |
|
tileSD(bi,bj) = tileSD(bi,bj) |
137 |
|
& + tmpVol*(tmpVal-theMean)*(tmpVal-theMean) |
138 |
ENDIF |
ENDIF |
139 |
ENDDO |
ENDDO |
140 |
ENDDO |
ENDDO |
141 |
ENDDO |
ENDDO |
142 |
|
c theSD = theSD + tileSD(bi,bj) |
143 |
ENDDO |
ENDDO |
144 |
ENDDO |
ENDDO |
145 |
|
|
146 |
_GLOBAL_SUM_R8(theSD,myThid) |
c _GLOBAL_SUM_RL(theSD,myThid) |
147 |
|
CALL GLOBAL_SUM_TILE_RL( tileSD, theSD, myThid ) |
148 |
|
|
149 |
theSD=sqrt(theSD/theVol) |
theSD = SQRT(theSD/theVol) |
150 |
c theSD=sqrt(theVar-theMean**2) |
c theSD = SQRT(theVar-theMean*theMean) |
151 |
ENDIF |
ENDIF |
152 |
|
|
153 |
RETURN |
RETURN |