1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
subroutine getdiag (myThid,lev,ipoint,undef,qtmp) |
5 |
C*********************************************************************** |
6 |
C PURPOSE |
7 |
C Retrieve averaged model diagnostic |
8 |
C INPUT: |
9 |
C lev ..... Diagnostic LEVEL |
10 |
C ipoint ..... DIAGNOSTIC NUMBER FROM MENU |
11 |
C undef ..... UNDEFINED VALUE |
12 |
C bi ..... X-direction process(or) number |
13 |
C bj ..... Y-direction process(or) number |
14 |
C |
15 |
C OUTPUT: |
16 |
C qtmp ..... AVERAGED DIAGNOSTIC QUANTITY |
17 |
C |
18 |
C*********************************************************************** |
19 |
implicit none |
20 |
|
21 |
#include "PACKAGES_CONFIG.h" |
22 |
#include "EEPARAMS.h" |
23 |
#include "CPP_OPTIONS.h" |
24 |
#include "SIZE.h" |
25 |
|
26 |
#ifdef ALLOW_FIZHI |
27 |
#include "fizhi_SIZE.h" |
28 |
#else |
29 |
integer Nrphys |
30 |
parameter (Nrphys=0) |
31 |
#endif |
32 |
|
33 |
#include "diagnostics_SIZE.h" |
34 |
#include "diagnostics.h" |
35 |
|
36 |
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 |
integer bi,bj |
43 |
|
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 |
|
55 |
do j = 1,sNy |
56 |
do i = 1,sNx |
57 |
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 |
enddo |
63 |
enddo |
64 |
|
65 |
enddo |
66 |
enddo |
67 |
|
68 |
endif |
69 |
|
70 |
999 return |
71 |
end |
72 |
|
73 |
subroutine getdiag2 (myThid,lev,ipoint,undef,qtmp) |
74 |
C*********************************************************************** |
75 |
C PURPOSE |
76 |
C Retrieve averaged model diagnostic |
77 |
C INPUT: |
78 |
C lev ..... Diagnostic LEVEL |
79 |
C ipoint ..... DIAGNOSTIC NUMBER FROM MENU |
80 |
C undef ..... UNDEFINED VALUE |
81 |
C |
82 |
C OUTPUT: |
83 |
C qtmp ..... AVERAGED DIAGNOSTIC QUANTITY |
84 |
C |
85 |
C*********************************************************************** |
86 |
implicit none |
87 |
|
88 |
#include "EEPARAMS.h" |
89 |
#include "CPP_OPTIONS.h" |
90 |
#include "SIZE.h" |
91 |
|
92 |
#ifdef ALLOW_FIZHI |
93 |
#include "fizhi_SIZE.h" |
94 |
#else |
95 |
integer Nrphys |
96 |
parameter (Nrphys=0) |
97 |
#endif |
98 |
|
99 |
#include "diagnostics_SIZE.h" |
100 |
#include "diagnostics.h" |
101 |
|
102 |
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 |
integer bi,bj |
108 |
|
109 |
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 |
|
118 |
do j = 1,sNy |
119 |
do i = 1,sNx |
120 |
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 |
enddo |
126 |
enddo |
127 |
|
128 |
enddo |
129 |
enddo |
130 |
|
131 |
endif |
132 |
|
133 |
999 return |
134 |
end |
135 |
subroutine clrindx (myThid,listnum) |
136 |
C*********************************************************************** |
137 |
C |
138 |
C PURPOSE |
139 |
C DRIVER TO CLEAR DIAGNOSTICS SPECIFIED IN DIAGNOSTIC INDEX LIST |
140 |
C |
141 |
C ARGUMENT DESCRIPTION |
142 |
C listnum .... diagnostics list number |
143 |
C |
144 |
C*********************************************************************** |
145 |
|
146 |
implicit none |
147 |
#include "EEPARAMS.h" |
148 |
#include "CPP_OPTIONS.h" |
149 |
#include "SIZE.h" |
150 |
#include "diagnostics_SIZE.h" |
151 |
#include "diagnostics.h" |
152 |
|
153 |
integer myThid, listnum |
154 |
|
155 |
integer m, n |
156 |
character*8 parms1 |
157 |
character*1 parse1(8) |
158 |
character*3 mate_index |
159 |
integer mate |
160 |
|
161 |
equivalence ( parms1 , parse1(1) ) |
162 |
equivalence ( mate_index , parse1(6) ) |
163 |
|
164 |
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 |
|
169 |
c Check for Counter Diagnostic |
170 |
c ---------------------------- |
171 |
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 |
|
180 |
100 format(i3) |
181 |
RETURN |
182 |
END |
183 |
|
184 |
|
185 |
subroutine clrdiag (myThid,index) |
186 |
C*********************************************************************** |
187 |
C PURPOSE |
188 |
C ZERO OUT MODEL DIAGNOSTIC ARRAY ELEMENTS |
189 |
C*********************************************************************** |
190 |
|
191 |
implicit none |
192 |
#include "EEPARAMS.h" |
193 |
#include "CPP_OPTIONS.h" |
194 |
#include "SIZE.h" |
195 |
#include "diagnostics_SIZE.h" |
196 |
#include "diagnostics.h" |
197 |
|
198 |
integer myThid, index |
199 |
|
200 |
integer bi,bj |
201 |
integer i,j,k |
202 |
|
203 |
C ********************************************************************** |
204 |
C **** SET DIAGNOSTIC AND COUNTER TO ZERO **** |
205 |
C ********************************************************************** |
206 |
|
207 |
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 |
enddo |
214 |
enddo |
215 |
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 |
if(myThid.eq.1) WRITE(6,2000)KDIAG(NUM),NUM,CDIAG(NUM),ndiagmx |
265 |
endif |
266 |
ELSE |
267 |
if(myThid.eq.1) WRITE(6,3000) NUM, CDIAG(NUM) |
268 |
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 |
if(myThid.eq.1)WRITE(6,2000)KDIAG(mate),mate,CDIAG(mate),ndiagmx |
283 |
endif |
284 |
ELSE |
285 |
if(myThid.eq.1) WRITE(6,3000) mate, CDIAG(mate) |
286 |
ENDIF |
287 |
endif |
288 |
|
289 |
RETURN |
290 |
|
291 |
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 |