1 |
subroutine diagnostics_write ( nymd,nhms,nymd0,nhms0,xlabel, |
2 |
. vars,grid,earth,ocean,land,physics,coupling, |
3 |
. diag,plist,nplist,dlist,ndlist,nrtype ) |
4 |
|
5 |
C*********************************************************************** |
6 |
C Purpose |
7 |
C ------- |
8 |
C Output sequence for the (multiple) diagnostics output files |
9 |
C |
10 |
C Arguments Description |
11 |
C ---------------------- |
12 |
C nymd ..... Current YYMMDD |
13 |
C nhms ..... Current HHMMSS |
14 |
C nymd0 .... Beginning YYMMDD |
15 |
C nhms0 .... Beginning HHMMSS |
16 |
C xlabel ... Character*80 Description of Experiment |
17 |
C jobid .... Character*8 Job Identifier |
18 |
C vars ..... Dynamics State Data Structure |
19 |
C grid ..... Dynamics Grid Data Structure |
20 |
C physics .. Physics State Data Structure |
21 |
C land ..... Land State Data Structure |
22 |
C earth .... Earth Model Data Structure |
23 |
C ocean .... Ocean Model Data Structure |
24 |
C coupling . Coupling Data Structure |
25 |
C diag ..... Diagnostics Data Structure |
26 |
C plist ... Prognostic History List Data Structure |
27 |
C nplist ... Number of distinct Prognostic History Lists |
28 |
C dlist ... Diagnostic History List Data Structure |
29 |
C ndlist ... Number of distinct Diagnostic History Lists |
30 |
C nrtype ... Output Record Type: 0 After Analysis or Straight Forecast |
31 |
C -1 Before Analysis |
32 |
C 1 Assimilation (w/IAU) |
33 |
C |
34 |
C*********************************************************************** |
35 |
c Diagnostics Common |
36 |
c ----------------- |
37 |
#include "SIZE.h" |
38 |
#include "fizhi_SIZE.h" |
39 |
#include "diagnostics_SIZE.h" |
40 |
#include "diagnostics.h" |
41 |
|
42 |
integer nrtype |
43 |
integer ndlist |
44 |
integer nplist |
45 |
integer ndindx (ndiagt) |
46 |
|
47 |
character*80 xlabel |
48 |
character* 8 jobid |
49 |
integer nymd,nhms,nymd0,nhms0 |
50 |
|
51 |
c Local variables |
52 |
c =============== |
53 |
integer nd |
54 |
integer ndsum |
55 |
integer n,rc |
56 |
integer nymdt,nhmst |
57 |
|
58 |
|
59 |
c HHMMSS event timestep counter |
60 |
c ============================= |
61 |
integer alarm, nalarm, mhms |
62 |
alarm( mhms ) = nalarm ( mhms, nymd, nhms, nymd0, 0 ) |
63 |
|
64 |
C*********************************************************************** |
65 |
C* Check for Prognostic Output * |
66 |
C*********************************************************************** |
67 |
do n=1,nplist |
68 |
if( alarm(plist(n)%frequency).eq.0 ) then |
69 |
call progsig (nymd,nhms,nymd0,nhms0,xlabel,jobid,nrtype,plist(n), |
70 |
. vars,grid,earth,ocean,land,physics,coupling ) |
71 |
endif |
72 |
enddo |
73 |
C*********************************************************************** |
74 |
C* Check for Diagnostic Output * |
75 |
C*********************************************************************** |
76 |
do n=1,ndlist |
77 |
call chkdiag(dlist(n),nymd,nhms,nymd0,nhms0,ndindx,ndsum,nymdt, |
78 |
. nhmst) |
79 |
if (ndsum.ne.0) then |
80 |
call diagout( nymdt,nhmst,nymd0,nhms0,xlabel,ndindx,nrtype, |
81 |
. dlist(n),qdiag) |
82 |
endif |
83 |
enddo |
84 |
|
85 |
c Clear Outputed Diagnostics |
86 |
c -------------------------- |
87 |
do n=1,ndlist |
88 |
call chkdiag(n,nymd,nhms,nymd0,nhms0,ndindx,ndsum,nymdt,nhmst) |
89 |
if (ndsum.ne.0) then |
90 |
call clrindx ( diag,ndindx ) |
91 |
endif |
92 |
enddo |
93 |
|
94 |
return |
95 |
end |
96 |
subroutine chkdiag(nl,nymd,nhms,nymd0,nhms0,ndindx,ndsum,nymdt,nhmst) |
97 |
implicit none |
98 |
|
99 |
#include "SIZE.h" |
100 |
#include "fizhi_SIZE.h" |
101 |
#include "diagnostics_SIZE.h" |
102 |
#include "diagnostics.h" |
103 |
|
104 |
integer nymd,nhms,nymd0,nhms0,nymdt,nhmst,ndsum |
105 |
integer ndindx(ndiagt) |
106 |
|
107 |
integer nymdd,nhmsd,ntick,nafreq,n,m,ndum |
108 |
integer nsecf,nalarm |
109 |
|
110 |
nymdt = nymd |
111 |
nhmst = nhms |
112 |
nymdd = nymd0 |
113 |
nhmsd = nhms0 |
114 |
|
115 |
c Initialize Diagnostic Index |
116 |
c --------------------------- |
117 |
do n=1,ndiagt |
118 |
ndindx(n) = 0 |
119 |
enddo |
120 |
|
121 |
c Fill Current Diagnostic Index |
122 |
c ----------------------------- |
123 |
ndsum = 0 |
124 |
nafreq = frequency(nl) |
125 |
if( nalarm( nafreq,nymd,nhms,nymdd,nhmsd ).eq.0 ) then |
126 |
|
127 |
do n=1,nfield(nl) |
128 |
do m=1,ndiagt |
129 |
if( fields(nl,n).eq.cdiag_(m) .and. idiag(m).ne.0 ) then |
130 |
ndsum = ndsum + 1 |
131 |
ndindx (ndsum) = m |
132 |
endif |
133 |
enddo |
134 |
enddo |
135 |
|
136 |
endif |
137 |
return |
138 |
end |
139 |
|
140 |
function chklist (name,list) |
141 |
implicit none |
142 |
#include "SIZE.h" |
143 |
#include "fizhi_SIZE.h" |
144 |
#include "diagnostics_SIZE.h" |
145 |
#include "diagnostics.h" |
146 |
logical chklist |
147 |
character*8 name |
148 |
integer n |
149 |
chklist = .false. |
150 |
do n=1,nfield(nl) |
151 |
if( fields(nl,n).eq.name ) chklist = .true. |
152 |
enddo |
153 |
return |
154 |
end |