/[MITgcm]/MITgcm/pkg/diagnostics/diagnostics_utils.F
ViewVC logotype

Annotation of /MITgcm/pkg/diagnostics/diagnostics_utils.F

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


Revision 1.8 - (hide annotations) (download)
Wed May 5 00:39:21 2004 UTC (20 years ago) by edhill
Branch: MAIN
CVS Tags: checkpoint52n_post, checkpoint53d_post, checkpoint54a_pre, checkpoint54a_post, checkpoint53c_post, checkpoint53b_post, checkpoint53b_pre, checkpoint53a_post, checkpoint54, checkpoint53, checkpoint53g_post, checkpoint53f_post, checkpoint53d_pre
Changes since 1.7: +3 -0 lines
 o adding cvs 'Header:' and 'Name:' strings

1 edhill 1.8 C $Header: $
2     C $Name: $
3    
4 molod 1.3 subroutine getdiag (myThid,lev,ipoint,undef,qtmp)
5 molod 1.1 C***********************************************************************
6     C PURPOSE
7     C Retrieve averaged model diagnostic
8     C INPUT:
9 molod 1.2 C lev ..... Diagnostic LEVEL
10 molod 1.1 C ipoint ..... DIAGNOSTIC NUMBER FROM MENU
11     C undef ..... UNDEFINED VALUE
12 molod 1.2 C bi ..... X-direction process(or) number
13     C bj ..... Y-direction process(or) number
14 molod 1.1 C
15     C OUTPUT:
16 molod 1.2 C qtmp ..... AVERAGED DIAGNOSTIC QUANTITY
17 molod 1.1 C
18     C***********************************************************************
19     implicit none
20    
21 molod 1.7 #include "PACKAGES_CONFIG.h"
22 molod 1.3 #include "EEPARAMS.h"
23 molod 1.2 #include "CPP_OPTIONS.h"
24 molod 1.1 #include "SIZE.h"
25 molod 1.3
26     #ifdef ALLOW_FIZHI
27 molod 1.1 #include "fizhi_SIZE.h"
28 molod 1.3 #else
29     integer Nrphys
30 molod 1.6 parameter (Nrphys=0)
31 molod 1.3 #endif
32    
33 molod 1.1 #include "diagnostics_SIZE.h"
34     #include "diagnostics.h"
35    
36 molod 1.3 integer myThid,lev,ipoint
37     _RL undef
38     _RL qtmp(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nr+Nrphys,Nsx,Nsy)
39    
40     _RL factor
41     integer i,j,ipnt,klev
42 molod 1.2 integer bi,bj
43 molod 1.3
44     if (ipoint.lt.1) go to 999
45    
46     klev = kdiag(ipoint)
47     if(klev.ge.lev) then
48     ipnt = idiag(ipoint) + lev - 1
49     factor = 1.0
50     if(ndiag(ipoint).ne.0) factor = 1.0/ndiag(ipoint)
51    
52     do bj=myByLo(myThid), myByHi(myThid)
53     do bi=myBxLo(myThid), myBxHi(myThid)
54 molod 1.1
55 molod 1.2 do j = 1,sNy
56     do i = 1,sNx
57 molod 1.3 if( qdiag(i,j,ipnt,bi,bj).ne.undef ) then
58     qtmp(i,j,lev,bi,bj) = qdiag(i,j,ipnt,bi,bj)*factor
59     else
60     qtmp(i,j,lev,bi,bj) = undef
61     endif
62 molod 1.1 enddo
63     enddo
64    
65     enddo
66     enddo
67    
68 molod 1.3 endif
69 molod 1.1
70 molod 1.3 999 return
71     end
72    
73     subroutine getdiag2 (myThid,lev,ipoint,undef,qtmp)
74 molod 1.1 C***********************************************************************
75     C PURPOSE
76 molod 1.3 C Retrieve averaged model diagnostic
77 molod 1.1 C INPUT:
78 molod 1.3 C lev ..... Diagnostic LEVEL
79 molod 1.1 C ipoint ..... DIAGNOSTIC NUMBER FROM MENU
80     C undef ..... UNDEFINED VALUE
81     C
82     C OUTPUT:
83 molod 1.3 C qtmp ..... AVERAGED DIAGNOSTIC QUANTITY
84 molod 1.1 C
85     C***********************************************************************
86     implicit none
87    
88 molod 1.3 #include "EEPARAMS.h"
89 molod 1.2 #include "CPP_OPTIONS.h"
90 molod 1.1 #include "SIZE.h"
91 molod 1.3
92     #ifdef ALLOW_FIZHI
93 molod 1.1 #include "fizhi_SIZE.h"
94 molod 1.3 #else
95     integer Nrphys
96 molod 1.6 parameter (Nrphys=0)
97 molod 1.3 #endif
98    
99 molod 1.1 #include "diagnostics_SIZE.h"
100     #include "diagnostics.h"
101    
102 molod 1.3 integer myThid,lev,ipoint
103     _RL undef
104     _RL qtmp(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nr+Nrphys,Nsx,Nsy)
105    
106     integer i,j,ipnt,klev
107 molod 1.2 integer bi,bj
108 molod 1.1
109 molod 1.3 if (ipoint.lt.1) go to 999
110    
111     klev = kdiag(ipoint)
112     if(klev.ge.lev) then
113     ipnt = idiag(ipoint) + lev - 1
114    
115     do bj=myByLo(myThid), myByHi(myThid)
116     do bi=myBxLo(myThid), myBxHi(myThid)
117 molod 1.1
118 molod 1.2 do j = 1,sNy
119     do i = 1,sNx
120 molod 1.3 if( qdiag(i,j,ipnt,bi,bj).ne.undef ) then
121     qtmp(i,j,lev,bi,bj) = qdiag(i,j,ipnt,bi,bj)
122     else
123     qtmp(i,j,lev,bi,bj) = undef
124     endif
125 molod 1.1 enddo
126     enddo
127    
128     enddo
129     enddo
130    
131 molod 1.3 endif
132    
133     999 return
134     end
135 molod 1.2 subroutine clrindx (myThid,listnum)
136 molod 1.1 C***********************************************************************
137     C
138     C PURPOSE
139     C DRIVER TO CLEAR DIAGNOSTICS SPECIFIED IN DIAGNOSTIC INDEX LIST
140     C
141     C ARGUMENT DESCRIPTION
142 molod 1.2 C listnum .... diagnostics list number
143 molod 1.1 C
144     C***********************************************************************
145    
146     implicit none
147 molod 1.2 #include "EEPARAMS.h"
148     #include "CPP_OPTIONS.h"
149 molod 1.1 #include "SIZE.h"
150     #include "diagnostics_SIZE.h"
151     #include "diagnostics.h"
152    
153 molod 1.2 integer myThid, listnum
154    
155     integer m, n
156 molod 1.1 character*8 parms1
157     character*1 parse1(8)
158     character*3 mate_index
159 molod 1.2 integer mate
160 molod 1.1
161     equivalence ( parms1 , parse1(1) )
162     equivalence ( mate_index , parse1(6) )
163    
164 molod 1.2 do n=1,nfields(listnum)
165     do m=1,ndiagt
166     if( flds(n,listnum).eq.cdiag(m) .and. idiag(m).ne.0 ) then
167     call clrdiag (myThid,m)
168 molod 1.1
169     c Check for Counter Diagnostic
170     c ----------------------------
171 molod 1.2 parms1 = gdiag(m)
172     if( parse1(5).eq.'C' ) then
173     read (mate_index,100) mate
174     call clrdiag (myThid,mate)
175     endif
176     endif
177     enddo
178     enddo
179 molod 1.1
180     100 format(i3)
181     RETURN
182     END
183    
184    
185 molod 1.2 subroutine clrdiag (myThid,index)
186 molod 1.1 C***********************************************************************
187     C PURPOSE
188 molod 1.2 C ZERO OUT MODEL DIAGNOSTIC ARRAY ELEMENTS
189 molod 1.1 C***********************************************************************
190    
191     implicit none
192 molod 1.2 #include "EEPARAMS.h"
193     #include "CPP_OPTIONS.h"
194 molod 1.1 #include "SIZE.h"
195     #include "diagnostics_SIZE.h"
196     #include "diagnostics.h"
197    
198 molod 1.2 integer myThid, index
199    
200     integer bi,bj
201 molod 1.1 integer i,j,k
202    
203     C **********************************************************************
204     C **** SET DIAGNOSTIC AND COUNTER TO ZERO ****
205     C **********************************************************************
206    
207 molod 1.2 do bj=myByLo(myThid), myByHi(myThid)
208     do bi=myBxLo(myThid), myBxHi(myThid)
209     do k = 1,kdiag(index)
210     do j = 1,sNy
211     do i = 1,sNx
212     qdiag(i,j,idiag(index)+k-1,bi,bj) = 0.0
213 molod 1.1 enddo
214     enddo
215 molod 1.2 enddo
216     enddo
217     enddo
218    
219     ndiag(index) = 0
220    
221     return
222     end
223    
224     subroutine setdiag (myThid,num,ndiagmx)
225     C***********************************************************************
226     C
227     C PURPOSE
228     C SET POINTER LOCATIONS, NAMES, LEVELS and TITLES FOR DIAGNOSTIC NUM
229     C
230     C***********************************************************************
231    
232     implicit none
233     #include "CPP_OPTIONS.h"
234     #include "SIZE.h"
235     #include "diagnostics_SIZE.h"
236     #include "diagnostics.h"
237    
238     integer num,myThid,ndiagmx
239     integer ipointer
240    
241     DATA IPOINTER / 1 /
242    
243     character*8 parms1
244     character*1 parse1(8)
245     character*3 mate_index
246     integer mate
247    
248     equivalence ( parms1 , parse1(1) )
249     equivalence ( mate_index , parse1(6) )
250    
251     C **********************************************************************
252     C **** SET POINTERS FOR DIAGNOSTIC NUM ****
253     C **********************************************************************
254    
255     parms1 = gdiag(num)
256    
257     IF( IDIAG(NUM).EQ.0 ) THEN
258     if(ndiagmx+kdiag(num).gt.numdiags) then
259     write(6,4000)num,cdiag(num)
260     else
261     IDIAG(NUM) = IPOINTER
262     IPOINTER = IPOINTER + KDIAG(NUM)
263     ndiagmx = ndiagmx + KDIAG(NUM)
264 molod 1.4 if(myThid.eq.1) WRITE(6,2000)KDIAG(NUM),NUM,CDIAG(NUM),ndiagmx
265 molod 1.2 endif
266     ELSE
267 molod 1.4 if(myThid.eq.1) WRITE(6,3000) NUM, CDIAG(NUM)
268 molod 1.2 ENDIF
269    
270     c Check for Counter Diagnostic
271     c ----------------------------
272     if( parse1(5).eq.'C') then
273     read (mate_index,100) mate
274    
275     IF( IDIAG(mate).EQ.0 ) THEN
276     if(ndiagmx+kdiag(num).gt.numdiags) then
277     write(6,5000)num,cdiag(num)
278     else
279     IDIAG(mate) = IPOINTER
280     IPOINTER = IPOINTER + KDIAG(mate)
281     ndiagmx = ndiagmx + KDIAG(mate)
282 molod 1.4 if(myThid.eq.1)WRITE(6,2000)KDIAG(mate),mate,CDIAG(mate),ndiagmx
283 molod 1.2 endif
284     ELSE
285 molod 1.4 if(myThid.eq.1) WRITE(6,3000) mate, CDIAG(mate)
286 molod 1.2 ENDIF
287     endif
288    
289     RETURN
290 molod 1.1
291 molod 1.2 100 format(i3)
292     2000 FORMAT(1X,'Allocating ',I2,' Level(s) for Diagnostic # ',I3,
293     . ' (',A8,'), Total Number of Diagnostics: ',I5)
294     3000 FORMAT(1X,'Diagnostic # ',I3,' (',A8,') has already been set')
295     4000 FORMAT(1X,'Unable to allocate space for Diagnostic # ',I3,
296     . ' (',A8,')')
297     5000 FORMAT(1X,'Unable to allocate space for Counter Diagnostic # ',
298     . I3,' (',A8,')',' WARNING - Diag will not accumulate properly')
299     END

  ViewVC Help
Powered by ViewVC 1.1.22