4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21# ifdef FOUR_DVAR
23# endif
27
29# ifdef RP_AVERAGES
31# endif
32# ifdef DISTRIBUTE
34# endif
35# ifdef OBSERVATIONS
38# endif
41# if defined FOUR_DVAR && !defined WEAK_CONSTRAINT
43# endif
45# ifdef RP_AVERAGES
47# endif
48
49 implicit none
50
51
52
53 integer, intent(in) :: ng
54
55
56
57 logical, save :: First = .true.
58 logical :: Ldefine, Lupdate, NewFile
59
60 integer :: Fcount, ifile, status, tile
61
62 character (len=*), parameter :: MyFile = &
63 & __FILE__
64
66
67# ifdef PROFILE
68
69
70
71
72
74# endif
75
76
77
78
79
80
81
84 END IF
85
86
87
88
89#ifdef BIOLOGY
90 lupdate=.true.
91#else
92 lupdate=.false.
93#endif
94
95
96
97
98
105 END IF
106 END IF
110 ldefine=.false.
111 ELSE
112 ldefine=.true.
113 newfile=.false.
114 END IF
120 END IF
121 ldefine=.true.
122 newfile=.true.
123 ELSE
124 ldefine=.false.
125 END IF
126 IF (ldefine) THEN
129 END IF
131 tlm(ng)%load=
tlm(ng)%load+1
132 IF (
tlm(ng)%load.gt.
tlm(ng)%Nfiles)
THEN
134 WRITE (
stdout,10)
'TLM(ng)%load = ',
tlm(ng)%load, &
135 &
tlm(ng)%Nfiles, trim(
tlm(ng)%base), &
136 & ifile
137 END IF
140 & __line__, myfile)) RETURN
141 END IF
143 tlm(ng)%Nrec(fcount)=0
145 WRITE (
tlm(ng)%name,20) trim(
tlm(ng)%base), ifile
146 END IF
147# ifdef DISTRIBUTE
149# endif
150 tlm(ng)%files(fcount)=trim(
tlm(ng)%name)
154 END IF
157 ELSE
159 END IF
160 ELSE
166 END IF
167 END IF
168 END IF
169
170
171
172
176 & (mod(
iic(ng)-1,
ntlm(ng)).eq.0))
THEN
177# ifdef DISTRIBUTE
179# else
181# endif
183 END IF
184 ELSE
185 IF ((mod(
iic(ng)-1,
ntlm(ng)).eq.0).and. &
187# ifdef DISTRIBUTE
189# else
191# endif
193 END IF
194 END IF
195 END IF
196
197# ifdef RP_AVERAGES
198
199
200
201
202
203
204
205
206
215 END IF
216 END IF
220 ldefine=.false.
221 ELSE
222 newfile=.false.
223 ldefine=.true.
224 END IF
230 END IF
231 ldefine=.true.
232 newfile=.true.
233 ELSE
234 ldefine=.false.
235 END IF
236 IF (ldefine) THEN
239 END IF
242 ELSE
244 END IF
245 avg(ng)%load=
avg(ng)%load+1
246 IF (
avg(ng)%load.gt.
avg(ng)%Nfiles)
THEN
248 WRITE (
stdout,10)
'AVG(ng)%load = ',
avg(ng)%load, &
249 &
avg(ng)%Nfiles, trim(
avg(ng)%base), &
250 & ifile
251 END IF
254 & __line__, myfile)) RETURN
255 END IF
257 avg(ng)%Nrec(fcount)=0
259 WRITE (
avg(ng)%name,20) trim(
avg(ng)%base), ifile
260 END IF
261# ifdef DISTRIBUTE
263# endif
264 avg(ng)%files(fcount)=trim(
avg(ng)%name)
269 END IF
270 ELSE
276 END IF
277 END IF
278 END IF
279
280
281
284 & (mod(
iic(ng)-1,
navg(ng)).eq.0))
THEN
285# ifdef DISTRIBUTE
287# else
289# endif
290
292 END IF
293 END IF
294# endif
295
296# ifdef FOUR_DVAR
297# ifndef WEAK_CONSTRAINT
298
299
300
301
302
303
304
305
306 IF (first) THEN
307 first=.false.
310 END IF
311# endif
312# ifdef OBSERVATIONS
313
314
315
316
317
318
322# ifdef DISTRIBUTE
324# else
325 tile=-1
326# endif
329# if defined R4DVAR || defined R4DVAR_ANA_SENSITIVITY || \
330 defined tl_r4dvar
332# endif
333 ELSE
335 END IF
336# endif
337# endif
338# ifdef PROFILE
339
340
341
342
343
345# endif
346
347 10 FORMAT (/,' RP_OUTPUT - multi-file counter ',a,i0, &
348 & ', is greater than Nfiles = ',i0,1x,'dimension', &
349 & /,13x,'in structure when creating next file: ', &
350 & a,'_',i4.4,'.nc', &
351 & /,13x,'Incorrect OutFiles logic in ''read_phypar''.')
352 20 FORMAT (a,'_',i4.4,'.nc')
353
354 RETURN
subroutine, public close_file(ng, model, s, ncname, lupdate)
subroutine, public def_avg(ng, ldef)
logical, dimension(:), allocatable processobs
type(t_io), dimension(:), allocatable tlm
type(t_io), dimension(:), allocatable avg
character(len=256) sourcefile
integer, dimension(:), allocatable idefavg
integer, dimension(:), allocatable ideftlm
integer, dimension(:), allocatable nrrec
real(dp), dimension(:), allocatable obstime
integer, dimension(:), allocatable iic
integer, dimension(:), allocatable ntlm
real(dp), dimension(:), allocatable dt
integer, dimension(:), allocatable ndeftlm
logical, dimension(:), allocatable ldefavg
integer, dimension(:), allocatable navg
logical, dimension(:), allocatable lwrtavg
integer, dimension(:), allocatable ndefavg
logical, dimension(:), allocatable lwrtper
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable ldefout
real(dp), dimension(:), allocatable time
logical, dimension(:), allocatable ldeftlm
integer, dimension(:), allocatable ntstart
subroutine, public obs_read(ng, model, backward)
subroutine, public obs_write(ng, tile, model)
logical function, public founderror(flag, noerr, line, routine)
subroutine, public tl_def_his(ng, ldef)
subroutine, public tl_def_ini(ng)
subroutine, public tl_wrt_his(ng, tile)
subroutine, public wrt_avg(ng, tile)
subroutine obs_cost(ng, model)
recursive subroutine wclock_off(ng, model, region, line, routine)
recursive subroutine wclock_on(ng, model, region, line, routine)