/[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.5 - (show annotations) (download)
Tue May 13 18:18:05 2003 UTC (21 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint51o_pre, checkpoint51l_post, checkpoint51, checkpoint52, checkpoint51f_post, checkpoint51d_post, checkpoint51t_post, checkpoint51n_post, checkpoint51s_post, checkpoint51j_post, checkpoint51n_pre, checkpoint51l_pre, checkpoint51q_post, checkpoint51b_pre, checkpoint51h_pre, checkpoint50f_post, checkpoint50f_pre, branchpoint-genmake2, checkpoint51r_post, checkpoint51i_post, checkpoint51b_post, checkpoint51c_post, checkpoint50g_post, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint50e_post, checkpoint51e_post, checkpoint51o_post, checkpoint51f_pre, checkpoint51g_post, ecco_c52_e35, checkpoint51m_post, checkpoint51a_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-genmake2, branch-nonh, tg2-branch, checkpoint51n_branch
Changes since 1.4: +2 -2 lines
 o split mon_set.F into mon_set_iounit.F and mon_set_pref.F
 o replaced ref's to CPP_OPTIONS with MONITOR_OPTIONS
 o added new s/r monitor_solution.F that checks that model state
   and if unlikely lets the model die cleanly
   - this is to reduce the number of hanging processes we encounter
     if the model dies due to FPEs

1 C $Header: /u/gcmpack/models/MITgcmUV/pkg/monitor/mon_stats_rl.F,v 1.4 2002/06/15 03:14:53 jmc Exp $
2 C $Name: $
3
4 #include "MONITOR_OPTIONS.h"
5
6 SUBROUTINE MON_STATS_RL(
7 I myNr, arr, arrMask,arrhFac, arrArea, arrDr,
8 O theMin,theMax,theMean,theSD,theDel2,theVol,
9 I myThid )
10 C /==========================================================\
11 C | SUBROUTINE MON_STATS_RL |
12 C | o Calculate bare statistics of global array "_RL arr" |
13 C |==========================================================|
14 C \==========================================================/
15 IMPLICIT NONE
16
17 C === Global data ===
18 #include "SIZE.h"
19 #include "EEPARAMS.h"
20
21 C === Routine arguments ===
22 INTEGER myNr
23 _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
29 _RL theMax
30 _RL theMean
31 _RL theSD
32 _RL theDel2
33 _RL theVol
34 INTEGER myThid
35
36 C === Local variables ====
37 INTEGER bi,bj,I,J,K
38 INTEGER numPnts
39 LOGICAL noPnts
40 _RL tmpVal,rNumPnts
41 _RL theVar
42 _RL tmpVol
43
44 theMin=0.
45 theMax=0.
46 theMean=0.
47 theSD=0.
48 theVar=0.
49 theDel2=0.
50 theVol=0.
51 numPnts=0
52 noPnts=.TRUE.
53
54 DO bj=myByLo(myThid),myByHi(myThid)
55 DO bi=myBxLo(myThid),myBxHi(myThid)
56 DO K=1,myNr
57 DO J=1,sNy
58 DO I=1,sNx
59 tmpVal=arr(I,J,K,bi,bj)
60 c IF (tmpVal.NE.0. .AND. noPnts) THEN
61 IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
62 theMin=tmpVal
63 theMax=tmpVal
64 noPnts=.FALSE.
65 ENDIF
66 c IF (tmpVal.NE.0.) THEN
67 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
68 theMin=min(theMin,tmpVal)
69 theMax=max(theMax,tmpVal)
70 theDel2 = theDel2+0.25*ABS(
71 & (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
77 tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
78 theVol = theVol + tmpVol
79 theMean = theMean + tmpVol*tmpVal
80 theVar = theVar + tmpVol*tmpVal**2
81 ENDIF
82 ENDDO
83 ENDDO
84 ENDDO
85 ENDDO
86 ENDDO
87
88 theMin=-theMin
89 _GLOBAL_MAX_R8(theMin,myThid)
90 theMin=-theMin
91 _GLOBAL_MAX_R8(theMax,myThid)
92 _GLOBAL_SUM_R8(theDel2,myThid)
93 _GLOBAL_SUM_R8(theVol,myThid)
94 _GLOBAL_SUM_R8(theMean,myThid)
95 _GLOBAL_SUM_R8(theVar,myThid)
96 tmpVal=FLOAT(numPnts)
97 _GLOBAL_SUM_R8(tmpVal,myThid)
98 numPnts=INT(tmpVal+0.5)
99
100 IF (tmpVal.GT.0.) THEN
101 rNumPnts=1./tmpVal
102 theDel2=theDel2*rNumPnts
103 ENDIF
104
105 IF (theVol.GT.0.) THEN
106 theMean=theMean/theVol
107 theVar=theVar/theVol
108
109 DO bj=myByLo(myThid),myByHi(myThid)
110 DO bi=myBxLo(myThid),myBxHi(myThid)
111 DO K=1,myNr
112 DO J=1,sNy
113 DO I=1,sNx
114 tmpVal=arr(I,J,K,bi,bj)
115 c IF (tmpVal.NE.0.) THEN
116 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
117 tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
118 theSD = theSD + tmpVol*(tmpVal-theMean)**2
119 ENDIF
120 ENDDO
121 ENDDO
122 ENDDO
123 ENDDO
124 ENDDO
125
126 _GLOBAL_SUM_R8(theSD,myThid)
127
128 theSD=sqrt(theSD/theVol)
129 c theSD=sqrt(theVar-theMean**2)
130 ENDIF
131
132 RETURN
133 END

  ViewVC Help
Powered by ViewVC 1.1.22