ROMS
Loading...
Searching...
No Matches
mod_iounits.F
Go to the documentation of this file.
1#include "cppdefs.h"
3!
4!git $Id$
5!================================================== Hernan G. Arango ===
6! Copyright (c) 2002-2025 The ROMS Group !
7! Licensed under a MIT/X style license !
8! See License_ROMS.md !
9!=======================================================================
10! !
11! The input and output files information is stored in compact derived !
12! type structure, TYPE(T_IO): !
13! !
14! ADM Output adjoint model history data !
15! ADS Input adjoint sensitivity functional !
16! AVG Output time-averaged data !
17! BLK Input bulk fluxes data in adjoint-based applications !
18! BRY Input open boundary conditions data !
19! CLM Input climatology data !
20! DAI Output data assimilation next cycle initial conditions !
21! (4D-Var analysis) or restart (Ensemble Kalman Filter) !
22! DAV Output 4D-Var data assimilation variables !
23! DIA Output diagnostics fields !
24! ERR Output 4DVar posterior error estimate !
25#ifdef RBL4DVAR_FCT_SENSITIVITY
26! FCTA Input basic state forecast solution !
27! FCTB Input basic state forecast solution !
28#endif
29! FLT Output Lagrangian trajectories data !
30#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
31! FOIA Input Forecast Observation Impacts forcing data when !
32! initialized from the 4D-Var Analysis (red curve) !
33! FOIB Input Forecast Observation Impacts forcing data when !
34! initialized from the 4D-Var Background (blue curve) !
35#endif
36! FRC Input forcing data !
37! FWD Input basic state forward solution !
38! GRD Input grid data !
39! GRX Input grid for extracted history data !
40! GST Input/output GST analysis check pointing data !
41! HAR Output detiding least-squares harmonics coefficients !
42! HIS Output nonlinear model history data !
43! HSS Input/output Hessian eigenvectors !
44! IAD Input adjoint model initial conditions !
45! INI Input nonlinear model initial conditions !
46! IPR Input representer model initial conditions !
47! ITL Input tangent linear model initial conditions !
48! LCZ Input/output Lanczos vectors !
49! LZE Input/output time-evolved Lanczos vectors !
50! NRM Input/output error covariance normalization data !
51! NRM(1,ng) initial conditions !
52! NRM(2,ng) model error !
53! NRM(3,ng) lateral open boundary conditions !
54! NRM(4,ng) surface forcing !
55! NUD Input climatology nudging coefficients !
56! OBS Input/output 4D-Var observations !
57#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
58! OIFA Input Observations Impact Forcing at datum locations if !
59! initialized from the 4D-Var Analysis (red curve) !
60! OIFB Input Observations Impact Forcing at datum locations if !
61! initialized from the 4D-Var Background (blue curve) !
62#endif
63! QCK Output nonlinear model brief snpashots data !
64! RST Output restart data !
65! TIDE Input tide forcing !
66! TLF Input/output tangent linear model impulse forcing !
67! TLM Output tangent linear model history !
68#ifdef SP4DVAR
69! SCA Output adjoint scratch state vector file !
70! SCT Output tangent scratch state vector file !
71! SPA Output adjoint Arnoldi state vector file !
72! SPT Output tangent Arnoldi state vector file !
73#endif
74! SSF Input Sources/Sinks forcing (river runoff) !
75! STA Output station data !
76! STD Error covariance standard deviations !
77! STD(1,ng) initial conditions !
78! STD(2,ng) model error !
79! STD(3,ng) lateral open boundary conditions !
80! STD(4,ng) surface forcing !
81! STD(5,ng) computed from background (output) !
82! XTR Output extracted history fields !
83! !
84! Input/output information files: !
85! !
86! Iname Physical parameters standard input script filename. !
87! NGCname Nested grids contact point information filename. !
88! USRname USER input/output generic filename. !
89! Wname Wave model stadard input filename. !
90! aparnam Input assimilation parameters filename. !
91! bparnam Input biology parameters filename. !
92! fbionam Input floats biological behavior parameters filename. !
93! fposnam Input initial floats positions filename. !
94! iparnam Input ice parameters file name. !
95! sparnam Input sediment transport parameters filename. !
96! sposnam Input station positions file name. !
97! varname Input IO variables information file name. !
98! !
99! stdinp Unit number for standard input (often 5). !
100! stdout Unit number for standard output (often 6). !
101! usrout Unit number for generic USER output. !
102! !
103! Standard NetCDF library input files ID per each field: !
104! !
105! BRYids File ID associated with each boundary field. !
106! CLMids File ID associated with each climatology field. !
107! FRCids File ID associated with each forcing field. !
108! !
109#if defined PIO_LIB && defined DISTRIBUTE
110! Parallel-IO (PIO) library input files descriptors per each field: !
111! !
112! BRYdesc File descriptor associated with each boundary field. !
113! CLMdesc File descriptor associated with each climatology field. !
114! FRCdesc file descriptor associated with each forcing field. !
115! !
116#endif
117! Miscellaneous variables: !
118! !
119! CalledFrom Calling routine in IO operations. !
120! Rerror Running error messages. !
121! SourceFile Current executed file name. It is used for IO error !
122! purposes. !
123! ioerror IO error flag. !
124! ncfile Current NetCDF file name being processed. !
125! nFfiles Number of forcing files. !
126! !
127!=======================================================================
128!
129 USE mod_kinds
130#if defined PIO_LIB && defined DISTRIBUTE
131 USE pio
132#endif
133!
134 implicit none
135!
136 PUBLIC :: allocate_iounits
137 PUBLIC :: deallocate_iounits
138!
139!-----------------------------------------------------------------------
140! Define derived type structure, T_IO, used to store information about
141! the input and output files.
142!-----------------------------------------------------------------------
143
144#if defined PIO_LIB && defined DISTRIBUTE
145!
146! Define derived type structure for ROMS variable descriptors. It is
147! done to include additional information not available in the PIO
148! library TYPE (Var_desc_t) variable descriptor. It includes external
149! data representation "dkind" and C-grid type "gtype".
150!
152 TYPE (var_desc_t) :: vd ! PIO variable descriptor
153 integer :: dkind ! PIO data kind
154 integer :: gtype ! ROMS C-grid variable type
155 END TYPE my_vardesc
156#endif
157!
158! This structure is used to declare the variables associated with
159! input and output files, like TYPE(IO) :: HIS(Ngrids). It is a
160! compact way to store a lot of information. The "Fcount" variable
161! is used during data processing in "check_multifile" and "inquiry"
162! whereas "load" is used storing information in the structure.
163!
164 TYPE t_io
165 integer :: iotype ! file IO type
166 integer :: nfiles ! number of multi-files
167 integer :: fcount ! multi-file counter
168 integer :: load ! filename load counter
169 integer :: rindex ! NetCDF record index
170 integer :: ncid ! NetCDF file ID
171 integer, pointer :: nrec(:) ! NetCDF record size
172 integer, pointer :: vid(:) ! NetCDF variables IDs
173 integer, pointer :: tid(:) ! NetCDF tracers IDs
174 real(dp), pointer :: time_min(:) ! starting time
175 real(dp), pointer :: time_max(:) ! ending time
176 character (len=50 ) :: label ! structure label
177 character (len=256) :: head ! head filename
178 character (len=256) :: base ! base filename
179 character (len=256) :: name ! current name
180 character (len=256), pointer :: files(:) ! multi-file names
181#if defined PIO_LIB && defined DISTRIBUTE
182 TYPE (file_desc_t) :: piofile ! file descriptor
183 TYPE (my_vardesc), pointer :: piovar(:) ! variable descriptor
184 TYPE (my_vardesc), pointer :: piotrc(:) ! tracer descriptor
185#endif
186 END TYPE t_io
187!
188!-----------------------------------------------------------------------
189! Define variables in module.
190!-----------------------------------------------------------------------
191!
192! I/O units.
193!
194 integer :: stdinp = 5 ! standard input
195 integer :: stdout ! standard output, usually 6
196 integer :: usrout = 10 ! generic user unit
197!
198! I/O files management, derived type structures.
199!
200 TYPE(t_io), allocatable :: adm(:) ! ADM history fields
201 TYPE(t_io), allocatable :: ads(:) ! sensitivity functional
202 TYPE(t_io), allocatable :: avg(:) ! time-averaged fields
203 TYPE(t_io), allocatable :: blk(:) ! bulk fluxes fields
204 TYPE(t_io), allocatable :: dai(:) ! Data assilation IC/restart
205 TYPE(t_io), allocatable :: dav(:) ! 4D-Var variables
206 TYPE(t_io), allocatable :: dia(:) ! diagnostics fields
207 TYPE(t_io), allocatable :: err(:) ! 4D-Var posterior error
208 TYPE(t_io), allocatable :: flt(:) ! Lagrangian trajectories
209#ifdef RBL4DVAR_FCT_SENSITIVITY
210 TYPE(t_io), allocatable :: fcta(:) ! forecast for impacts, A
211 TYPE(t_io), allocatable :: fctb(:) ! forecast for impacts, B
212#endif
213#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
214 TYPE(t_io), allocatable :: foia(:) ! observation impacts, A
215 TYPE(t_io), allocatable :: foib(:) ! observation impacts, B
216#endif
217 TYPE(t_io), allocatable :: fwd(:) ! forward solution
218 TYPE(t_io), allocatable :: grd(:) ! grid geometry data
219 TYPE(t_io), allocatable :: grx(:) ! grid for extrated fields
220 TYPE(t_io), allocatable :: gst(:) ! generalized stability
221 TYPE(t_io), allocatable :: har(:) ! detiding harmonics
222 TYPE(t_io), allocatable :: his(:) ! NLM history fields
223 TYPE(t_io), allocatable :: hss(:) ! Hessian eigenvectors
224 TYPE(t_io), allocatable :: iad(:) ! ADM initial conditions
225 TYPE(t_io), allocatable :: ini(:) ! NLM initial conditions
226 TYPE(t_io), allocatable :: irp(:) ! RPM initial conditions
227 TYPE(t_io), allocatable :: itl(:) ! TLM initial conditions
228 TYPE(t_io), allocatable :: lcz(:) ! Lanczos vectors
229 TYPE(t_io), allocatable :: lze(:) ! evolved Lanczos vectors
230 TYPE(t_io), allocatable :: nrm(:,:) ! normalization
231 TYPE(t_io), allocatable :: nud(:) ! nudging coefficients
232 TYPE(t_io), allocatable :: obs(:) ! observations
233#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
234 TYPE(t_io), allocatable :: oifa(:) ! observation impacts, A
235 TYPE(t_io), allocatable :: oifb(:) ! observation impacts, B
236#endif
237 TYPE(t_io), allocatable :: qck(:) ! quicksave fields
238 TYPE(t_io), allocatable :: rst(:) ! restart fields
239#ifdef SP4DVAR
240 TYPE(t_io), allocatable :: sca(:) ! ADM scratch state vector
241 TYPE(t_io), allocatable :: sct(:) ! TLM scratch state vector
242 TYPE(t_io), allocatable :: spa(:) ! ADM Arnoldi state vector
243 TYPE(t_io), allocatable :: spt(:) ! TLM Arnoldi state vector
244#endif
245 TYPE(t_io), allocatable :: ssf(:) ! Sources/Sinks forcing
246 TYPE(t_io), allocatable :: sta(:) ! stations data
247 TYPE(t_io), allocatable :: std(:,:) ! standard deviation
248 TYPE(t_io), allocatable :: tide(:) ! tidal forcing
249 TYPE(t_io), allocatable :: tlf(:) ! TLM impulse fields
250 TYPE(t_io), allocatable :: tlm(:) ! TLM history fields
251 TYPE(t_io), allocatable :: xtr(:) ! extracted history fields
252!
253! Input boundary condition data.
254!
255 integer, allocatable :: nbcfiles(:)
256 integer, allocatable :: bryids(:,:)
257!
258#if defined PIO_LIB && defined DISTRIBUTE
259 TYPE (file_desc_t), allocatable :: brydesc(:,:)
260#endif
261 TYPE(t_io), allocatable :: bry(:,:)
262!
263! Input climatology data.
264!
265 integer, allocatable :: nclmfiles(:)
266 integer, allocatable :: clmids(:,:)
267!
268#if defined PIO_LIB && defined DISTRIBUTE
269 TYPE (file_desc_t), allocatable :: clmdesc(:,:)
270#endif
271 TYPE(t_io), allocatable :: clm(:,:)
272!
273! Input forcing data.
274!
275 integer, allocatable :: nffiles(:)
276 integer, allocatable :: frcids(:,:)
277!
278#if defined PIO_LIB && defined DISTRIBUTE
279 TYPE (file_desc_t), allocatable :: frcdesc(:,:)
280#endif
281 TYPE(t_io), allocatable :: frc(:,:)
282!
283! Error messages.
284!
285 character (len=50), dimension(9) :: rerror = &
286 & (/ ' ROMS - Blows up ................ exit_flag: ', &
287 & ' ROMS - Input error ............. exit_flag: ', &
288 & ' ROMS - Output error ............ exit_flag: ', &
289 & ' ROMS - I/O error ............... exit_flag: ', &
290 & ' ROMS - Configuration error ..... exit_flag: ', &
291 & ' ROMS - Partition error ......... exit_flag: ', &
292 & ' ROMS - Illegal input parameter . exit_flag: ', &
293 & ' ROMS - Fatal algorithm result .. exit_flag: ', &
294 & ' ROMS - Coupling error .......... exit_flag: ' /)
295!
296! Standard input scripts file names.
297!
298 character (len=256) :: iname ! ROMS physical parameters
299 character (len=256) :: wname ! wave model standard input
300 character (len=256) :: ngcname ! contact points filename
301 character (len=256) :: usrname ! use generic filename
302 character (len=256) :: aparnam ! assimilation parameters
303 character (len=256) :: bparnam ! biology model parameters
304 character (len=256) :: fbionam ! floats behavior parameters
305 character (len=256) :: fposnam ! floats positions
306 character (len=256) :: iparnam ! ice model parameters
307 character (len=256) :: sparnam ! sediment model parameters
308 character (len=256) :: sposnam ! station positions
309 character (len=256) :: varname ! I/O metadata
310!
311! Miscelaneous variables.
312!
313 integer :: ioerror = 0 ! I/O error flag
314
315 character (len=256) :: calledfrom ! routine calling IO
316 character (len=256) :: myappcpp ! application CPP flag
317 character (len=256) :: sourcefile ! current executed ROMS file
318 character (len=256) :: ncfile ! current NetCDF file
319!
320 CONTAINS
321!
322 SUBROUTINE allocate_iounits (Ngrids)
323!
324!=======================================================================
325! !
326! This routine allocates several variables in the module that depend !
327! on the number of nested grids. !
328! !
329!=======================================================================
330!
331! Imported variable declarations.
332!
333 integer, intent(in) :: ngrids
334!
335! Local variable declarations.
336!
337 integer :: i, lstr, ng
338
339 character (len=1), parameter :: blank = ' '
340!
341!-----------------------------------------------------------------------
342! Allocate I/O files management, derived type structures.
343!-----------------------------------------------------------------------
344!
345 IF (.not.allocated(adm)) THEN
346 allocate ( adm(ngrids) )
347 END IF
348 IF (.not.allocated(ads)) THEN
349 allocate ( ads(ngrids) )
350 END IF
351 IF (.not.allocated(avg)) THEN
352 allocate ( avg(ngrids) )
353 END IF
354 IF (.not.allocated(blk)) THEN
355 allocate ( blk(ngrids) )
356 END IF
357 IF (.not.allocated(dai)) THEN
358 allocate ( dai(ngrids) )
359 END IF
360 IF (.not.allocated(dav)) THEN
361 allocate ( dav(ngrids) )
362 END IF
363 IF (.not.allocated(dia)) THEN
364 allocate ( dia(ngrids) )
365 END IF
366 IF (.not.allocated(err)) THEN
367 allocate ( err(ngrids) )
368 END IF
369 IF (.not.allocated(flt)) THEN
370 allocate ( flt(ngrids) )
371 END IF
372#ifdef RBL4DVAR_FCT_SENSITIVITY
373 IF (.not.allocated(fcta)) THEN
374 allocate ( fcta(ngrids) )
375 END IF
376 IF (.not.allocated(fctb)) THEN
377 allocate ( fctb(ngrids) )
378 END IF
379#endif
380#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
381 IF (.not.allocated(foia)) THEN
382 allocate ( foia(ngrids) )
383 END IF
384 IF (.not.allocated(foib)) THEN
385 allocate ( foib(ngrids) )
386 END IF
387#endif
388 IF (.not.allocated(fwd)) THEN
389 allocate ( fwd(ngrids) )
390 END IF
391 IF (.not.allocated(grd)) THEN
392 allocate ( grd(ngrids) )
393 END IF
394 IF (.not.allocated(grx)) THEN
395 allocate ( grx(ngrids) )
396 END IF
397 IF (.not.allocated(gst)) THEN
398 allocate ( gst(ngrids) )
399 END IF
400 IF (.not.allocated(har)) THEN
401 allocate ( har(ngrids) )
402 END IF
403 IF (.not.allocated(his)) THEN
404 allocate ( his(ngrids) )
405 END IF
406 IF (.not.allocated(hss)) THEN
407 allocate ( hss(ngrids) )
408 END IF
409 IF (.not.allocated(iad)) THEN
410 allocate ( iad(ngrids) )
411 END IF
412 IF (.not.allocated(ini)) THEN
413 allocate ( ini(ngrids) )
414 END IF
415 IF (.not.allocated(irp)) THEN
416 allocate ( irp(ngrids) )
417 END IF
418 IF (.not.allocated(itl)) THEN
419 allocate ( itl(ngrids) )
420 END IF
421 IF (.not.allocated(lcz)) THEN
422 allocate ( lcz(ngrids) )
423 END IF
424 IF (.not.allocated(lze)) THEN
425 allocate ( lze(ngrids) )
426 END IF
427 IF (.not.allocated(nud)) THEN
428 allocate ( nud(ngrids) )
429 END IF
430 IF (.not.allocated(obs)) THEN
431 allocate ( obs(ngrids) )
432 END IF
433#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
434 IF (.not.allocated(oifa)) THEN
435 allocate ( oifa(ngrids) )
436 END IF
437 IF (.not.allocated(oifb)) THEN
438 allocate ( oifb(ngrids) )
439 END IF
440#endif
441 IF (.not.allocated(qck)) THEN
442 allocate ( qck(ngrids) )
443 END IF
444 IF (.not.allocated(rst)) THEN
445 allocate ( rst(ngrids) )
446 END IF
447#ifdef SP4DVAR
448 IF (.not.allocated(sca)) THEN
449 allocate ( sca(ngrids) )
450 END IF
451 IF (.not.allocated(sct)) THEN
452 allocate ( sct(ngrids) )
453 END IF
454 IF (.not.allocated(spa)) THEN
455 allocate ( spa(ngrids) )
456 END IF
457 IF (.not.allocated(spt)) THEN
458 allocate ( spt(ngrids) )
459 END IF
460#endif
461 IF (.not.allocated(ssf)) THEN
462 allocate ( ssf(ngrids) )
463 END IF
464 IF (.not.allocated(sta)) THEN
465 allocate ( sta(ngrids) )
466 END IF
467 IF (.not.allocated(tide)) THEN
468 allocate ( tide(ngrids) )
469 END IF
470 IF (.not.allocated(tlf)) THEN
471 allocate ( tlf(ngrids) )
472 END IF
473 IF (.not.allocated(tlm)) THEN
474 allocate ( tlm(ngrids) )
475 END IF
476 IF (.not.allocated(xtr)) THEN
477 allocate ( xtr(ngrids) )
478 END IF
479
480 IF (.not.allocated(nrm)) THEN
481 allocate ( nrm(4,ngrids) )
482 END IF
483 IF (.not.allocated(std)) THEN
484 allocate ( std(5,ngrids) )
485 END IF
486!
487!-----------------------------------------------------------------------
488! Allocate variables.
489!-----------------------------------------------------------------------
490!
491 IF (.not.allocated(nbcfiles)) THEN
492 allocate ( nbcfiles(ngrids) )
493 END IF
494 IF (.not.allocated(nclmfiles)) THEN
495 allocate ( nclmfiles(ngrids) )
496 END IF
497 IF (.not.allocated(nffiles)) THEN
498 allocate ( nffiles(ngrids) )
499 END IF
500!
501!-----------------------------------------------------------------------
502! Initialize I/O NetCDF files ID to close state.
503!-----------------------------------------------------------------------
504!
505 DO ng=1,ngrids
506 adm(ng)%ncid=-1
507 ads(ng)%ncid=-1
508 avg(ng)%ncid=-1
509 blk(ng)%ncid=-1
510 dai(ng)%ncid=-1
511 dav(ng)%ncid=-1
512 dia(ng)%ncid=-1
513 err(ng)%ncid=-1
514 flt(ng)%ncid=-1
515#ifdef RBL4DVAR_FCT_SENSITIVITY
516 fcta(ng)%ncid=-1
517 fctb(ng)%ncid=-1
518#endif
519#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
520 foia(ng)%ncid=-1
521 foib(ng)%ncid=-1
522#endif
523 fwd(ng)%ncid=-1
524 grd(ng)%ncid=-1
525 grx(ng)%ncid=-1
526 gst(ng)%ncid=-1
527 har(ng)%ncid=-1
528 his(ng)%ncid=-1
529 hss(ng)%ncid=-1
530 iad(ng)%ncid=-1
531 ini(ng)%ncid=-1
532 irp(ng)%ncid=-1
533 itl(ng)%ncid=-1
534 lcz(ng)%ncid=-1
535 lze(ng)%ncid=-1
536 nud(ng)%ncid=-1
537 obs(ng)%ncid=-1
538#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
539 oifa(ng)%ncid=-1
540 oifb(ng)%ncid=-1
541#endif
542 qck(ng)%ncid=-1
543 rst(ng)%ncid=-1
544 ssf(ng)%ncid=-1
545 sta(ng)%ncid=-1
546 tlf(ng)%ncid=-1
547 tlm(ng)%ncid=-1
548 tide(ng)%ncid=-1
549 xtr(ng)%ncid=-1
550 nrm(1:4,ng)%ncid=-1
551 std(1:5,ng)%ncid=-1
552 nbcfiles(ng)=-1
553 nclmfiles(ng)=-1
554 nffiles(ng)=-1
555 END DO
556!
557!-----------------------------------------------------------------------
558! Initialize file names to blanks.
559!-----------------------------------------------------------------------
560!
561 DO ng=1,ngrids
562 lstr=len(his(ng)%name)
563 DO i=1,lstr
564 adm(ng)%head(i:i)=blank
565 adm(ng)%base(i:i)=blank
566 adm(ng)%name(i:i)=blank
567
568 ads(ng)%head(i:i)=blank
569 ads(ng)%base(i:i)=blank
570 ads(ng)%name(i:i)=blank
571
572 avg(ng)%head(i:i)=blank
573 avg(ng)%base(i:i)=blank
574 avg(ng)%name(i:i)=blank
575
576 blk(ng)%head(i:i)=blank
577 blk(ng)%base(i:i)=blank
578 blk(ng)%name(i:i)=blank
579
580 dai(ng)%head(i:i)=blank
581 dai(ng)%base(i:i)=blank
582 dai(ng)%name(i:i)=blank
583
584 dav(ng)%head(i:i)=blank
585 dav(ng)%base(i:i)=blank
586 dav(ng)%name(i:i)=blank
587
588 dia(ng)%head(i:i)=blank
589 dia(ng)%base(i:i)=blank
590 dia(ng)%name(i:i)=blank
591
592 err(ng)%head(i:i)=blank
593 err(ng)%base(i:i)=blank
594 err(ng)%name(i:i)=blank
595
596 flt(ng)%head(i:i)=blank
597 flt(ng)%base(i:i)=blank
598 flt(ng)%name(i:i)=blank
599
600#ifdef RBL4DVAR_FCT_SENSITIVITY
601 fcta(ng)%head(i:i)=blank
602 fcta(ng)%base(i:i)=blank
603 fcta(ng)%name(i:i)=blank
604
605 fctb(ng)%head(i:i)=blank
606 fctb(ng)%base(i:i)=blank
607 fctb(ng)%name(i:i)=blank
608#endif
609
610#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
611 foia(ng)%head(i:i)=blank
612 foia(ng)%base(i:i)=blank
613 foia(ng)%name(i:i)=blank
614
615 foib(ng)%head(i:i)=blank
616 foib(ng)%base(i:i)=blank
617 foib(ng)%name(i:i)=blank
618#endif
619
620 fwd(ng)%head(i:i)=blank
621 fwd(ng)%base(i:i)=blank
622 fwd(ng)%name(i:i)=blank
623
624 grd(ng)%head(i:i)=blank
625 grd(ng)%base(i:i)=blank
626 grd(ng)%name(i:i)=blank
627
628 grx(ng)%head(i:i)=blank
629 grx(ng)%base(i:i)=blank
630 grx(ng)%name(i:i)=blank
631
632 gst(ng)%head(i:i)=blank
633 gst(ng)%base(i:i)=blank
634 gst(ng)%name(i:i)=blank
635
636 har(ng)%head(i:i)=blank
637 har(ng)%base(i:i)=blank
638 har(ng)%name(i:i)=blank
639
640 his(ng)%head(i:i)=blank
641 his(ng)%base(i:i)=blank
642 his(ng)%name(i:i)=blank
643
644 hss(ng)%head(i:i)=blank
645 hss(ng)%base(i:i)=blank
646 hss(ng)%name(i:i)=blank
647
648 iad(ng)%head(i:i)=blank
649 iad(ng)%base(i:i)=blank
650 iad(ng)%name(i:i)=blank
651
652 ini(ng)%head(i:i)=blank
653 ini(ng)%base(i:i)=blank
654 ini(ng)%name(i:i)=blank
655
656 irp(ng)%head(i:i)=blank
657 irp(ng)%base(i:i)=blank
658 irp(ng)%name(i:i)=blank
659
660 itl(ng)%head(i:i)=blank
661 itl(ng)%base(i:i)=blank
662 itl(ng)%name(i:i)=blank
663
664 lcz(ng)%head(i:i)=blank
665 lcz(ng)%base(i:i)=blank
666 lcz(ng)%name(i:i)=blank
667
668 lze(ng)%head(i:i)=blank
669 lze(ng)%base(i:i)=blank
670 lze(ng)%name(i:i)=blank
671
672 nud(ng)%head(i:i)=blank
673 nud(ng)%base(i:i)=blank
674 nud(ng)%name(i:i)=blank
675
676 obs(ng)%head(i:i)=blank
677 obs(ng)%base(i:i)=blank
678 obs(ng)%name(i:i)=blank
679
680#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
681 oifa(ng)%head(i:i)=blank
682 oifa(ng)%base(i:i)=blank
683 oifa(ng)%name(i:i)=blank
684
685 oifb(ng)%head(i:i)=blank
686 oifb(ng)%base(i:i)=blank
687 oifb(ng)%name(i:i)=blank
688#endif
689
690 qck(ng)%head(i:i)=blank
691 qck(ng)%base(i:i)=blank
692 qck(ng)%name(i:i)=blank
693
694 rst(ng)%head(i:i)=blank
695 rst(ng)%base(i:i)=blank
696 rst(ng)%name(i:i)=blank
697
698 ssf(ng)%head(i:i)=blank
699 ssf(ng)%base(i:i)=blank
700 ssf(ng)%name(i:i)=blank
701
702 sta(ng)%head(i:i)=blank
703 sta(ng)%base(i:i)=blank
704 sta(ng)%name(i:i)=blank
705
706 tlf(ng)%head(i:i)=blank
707 tlf(ng)%base(i:i)=blank
708 tlf(ng)%name(i:i)=blank
709
710 tlm(ng)%head(i:i)=blank
711 tlm(ng)%base(i:i)=blank
712 tlm(ng)%name(i:i)=blank
713
714 tide(ng)%head(i:i)=blank
715 tide(ng)%base(i:i)=blank
716 tide(ng)%name(i:i)=blank
717
718 xtr(ng)%head(i:i)=blank
719 xtr(ng)%base(i:i)=blank
720 xtr(ng)%name(i:i)=blank
721
722 nrm(1:4,ng)%head(i:i)=blank
723 nrm(1:4,ng)%base(i:i)=blank
724 nrm(1:4,ng)%name(i:i)=blank
725
726 std(1:5,ng)%head(i:i)=blank
727 std(1:5,ng)%base(i:i)=blank
728 std(1:5,ng)%name(i:i)=blank
729 END DO
730 END DO
731!
732 DO i=1,len(iname)
733 wname(i:i)=blank
734 ngcname(i:i)=blank
735 usrname(i:i)=blank
736 aparnam(i:i)=blank
737 bparnam(i:i)=blank
738 fbionam(i:i)=blank
739 fposnam(i:i)=blank
740 sparnam(i:i)=blank
741 sposnam(i:i)=blank
742 END DO
743!
744 RETURN
745 END SUBROUTINE allocate_iounits
746!
748!
749!=======================================================================
750! !
751! This routine deallocates variables in module. !
752! !
753!=======================================================================
754!
755!-----------------------------------------------------------------------
756! Deallocate I/O derived type structures.
757!-----------------------------------------------------------------------
758!
759 IF (allocated(adm)) deallocate ( adm )
760 IF (allocated(ads)) deallocate ( ads )
761 IF (allocated(avg)) deallocate ( avg )
762 IF (allocated(blk)) deallocate ( blk )
763 IF (allocated(bry)) deallocate ( bry )
764 IF (allocated(clm)) deallocate ( clm )
765 IF (allocated(dai)) deallocate ( dai )
766 IF (allocated(dav)) deallocate ( dav )
767 IF (allocated(dia)) deallocate ( dia )
768 IF (allocated(err)) deallocate ( err )
769 IF (allocated(flt)) deallocate ( flt )
770 IF (allocated(frc)) deallocate ( frc )
771
772#ifdef RBL4DVAR_FCT_SENSITIVITY
773 IF (allocated(fcta)) deallocate ( fcta )
774 IF (allocated(fctb)) deallocate ( fctb )
775#endif
776
777#if defined RBL4DVAR_FCT_SENSITIVITY && !defined OBS_SPACE
778 IF (allocated(foia)) deallocate ( foia )
779 IF (allocated(foib)) deallocate ( foib )
780#endif
781
782 IF (allocated(fwd)) deallocate ( fwd )
783 IF (allocated(grd)) deallocate ( grd )
784 IF (allocated(grx)) deallocate ( grx )
785 IF (allocated(gst)) deallocate ( gst )
786 IF (allocated(har)) deallocate ( har )
787 IF (allocated(his)) deallocate ( his )
788 IF (allocated(hss)) deallocate ( hss )
789 IF (allocated(iad)) deallocate ( iad )
790 IF (allocated(ini)) deallocate ( ini )
791 IF (allocated(irp)) deallocate ( irp )
792 IF (allocated(itl)) deallocate ( itl )
793 IF (allocated(lcz)) deallocate ( lcz )
794 IF (allocated(lze)) deallocate ( lze )
795 IF (allocated(nud)) deallocate ( nud )
796 IF (allocated(obs)) deallocate ( obs )
797
798#if defined RBL4DVAR_FCT_SENSITIVITY && defined OBS_SPACE
799 IF (allocated(oifa)) deallocate ( oifa )
800 IF (allocated(oifb)) deallocate ( oifb )
801#endif
802
803 IF (allocated(qck)) deallocate ( qck )
804 IF (allocated(rst)) deallocate ( rst )
805
806#ifdef SP4DVAR
807 IF (allocated(sca)) deallocate ( sca )
808 IF (allocated(sct)) deallocate ( sct )
809 IF (allocated(spa)) deallocate ( spa )
810 IF (allocated(spt)) deallocate ( spt )
811#endif
812
813 IF (allocated(ssf)) deallocate ( ssf )
814 IF (allocated(sta)) deallocate ( sta )
815 IF (allocated(tide)) deallocate ( tide )
816 IF (allocated(tlf)) deallocate ( tlf )
817 IF (allocated(tlm)) deallocate ( tlm )
818 IF (allocated(xtr)) deallocate ( xtr )
819
820 IF (allocated(nrm)) deallocate ( nrm )
821 IF (allocated(std)) deallocate ( std )
822!
823!-----------------------------------------------------------------------
824! Deallocate other variables in module.
825!-----------------------------------------------------------------------
826!
827 IF (allocated(bryids)) deallocate ( bryids )
828#if defined PIO_LIB && defined DISTRIBUTE
829 IF (allocated(brydesc)) deallocate ( brydesc )
830#endif
831 IF (allocated(clmids)) deallocate ( clmids )
832#if defined PIO_LIB && defined DISTRIBUTE
833 IF (allocated(clmdesc)) deallocate ( clmdesc )
834#endif
835 IF (allocated(frcids)) deallocate ( frcids )
836#if defined PIO_LIB && defined DISTRIBUTE
837 IF (allocated(frcdesc)) deallocate ( frcdesc )
838#endif
839
840 IF (allocated(nbcfiles)) deallocate ( nbcfiles )
841 IF (allocated(nclmfiles)) deallocate ( nclmfiles )
842 IF (allocated(nffiles)) deallocate ( nffiles )
843!
844 RETURN
845 END SUBROUTINE deallocate_iounits
846
847 END MODULE mod_iounits
type(t_io), dimension(:), allocatable ads
character(len=256) aparnam
type(t_io), dimension(:), allocatable lcz
type(t_io), dimension(:), allocatable spa
type(t_io), dimension(:,:), allocatable std
character(len=50), dimension(9) rerror
character(len=256) calledfrom
integer ioerror
character(len=256) fbionam
type(t_io), dimension(:), allocatable his
type(t_io), dimension(:), allocatable ssf
type(t_io), dimension(:), allocatable oifa
type(t_io), dimension(:,:), allocatable nrm
character(len=256) wname
type(t_io), dimension(:), allocatable grx
type(t_io), dimension(:), allocatable adm
type(t_io), dimension(:), allocatable spt
type(t_io), dimension(:), allocatable iad
type(t_io), dimension(:), allocatable irp
type(t_io), dimension(:), allocatable fcta
integer, dimension(:,:), allocatable clmids
type(t_io), dimension(:), allocatable flt
type(t_io), dimension(:), allocatable obs
type(t_io), dimension(:), allocatable nud
type(t_io), dimension(:), allocatable sct
type(t_io), dimension(:), allocatable oifb
type(t_io), dimension(:), allocatable tlf
type(t_io), dimension(:), allocatable hss
type(t_io), dimension(:), allocatable xtr
character(len=256) myappcpp
integer stdinp
type(t_io), dimension(:), allocatable fctb
integer, dimension(:), allocatable nclmfiles
character(len=256) bparnam
type(t_io), dimension(:), allocatable har
integer usrout
type(t_io), dimension(:), allocatable tlm
type(t_io), dimension(:), allocatable sca
type(t_io), dimension(:), allocatable itl
type(file_desc_t), dimension(:,:), allocatable brydesc
type(t_io), dimension(:), allocatable blk
type(t_io), dimension(:,:), allocatable frc
type(t_io), dimension(:), allocatable lze
character(len=256) ngcname
type(t_io), dimension(:), allocatable dai
integer, dimension(:,:), allocatable bryids
type(t_io), dimension(:), allocatable dav
type(t_io), dimension(:), allocatable tide
type(t_io), dimension(:), allocatable qck
subroutine, public allocate_iounits(ngrids)
type(t_io), dimension(:), allocatable grd
character(len=256) ncfile
type(t_io), dimension(:,:), allocatable bry
type(t_io), dimension(:), allocatable fwd
type(t_io), dimension(:), allocatable rst
integer, dimension(:), allocatable nbcfiles
type(file_desc_t), dimension(:,:), allocatable clmdesc
character(len=256) usrname
type(t_io), dimension(:), allocatable gst
type(t_io), dimension(:), allocatable ini
character(len=256) sparnam
type(t_io), dimension(:,:), allocatable clm
integer, dimension(:,:), allocatable frcids
type(t_io), dimension(:), allocatable avg
type(t_io), dimension(:), allocatable sta
type(t_io), dimension(:), allocatable err
character(len=256) iname
character(len=256) fposnam
type(file_desc_t), dimension(:,:), allocatable frcdesc
integer stdout
character(len=256) varname
character(len=256) sourcefile
type(t_io), dimension(:), allocatable dia
character(len=256) iparnam
character(len=256) sposnam
integer, dimension(:), allocatable nffiles
subroutine, public deallocate_iounits
integer, parameter dp
Definition mod_kinds.F:25