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