ROMS
Loading...
Searching...
No Matches
def_info_mod::def_info Interface Reference

Public Member Functions

subroutine def_info_nf90 (ng, model, ncid, ncname, dimids)
 
subroutine def_info_pio (ng, model, piofile, ncname, dimids)
 

Detailed Description

Definition at line 72 of file def_info.F.

Member Function/Subroutine Documentation

◆ def_info_nf90()

subroutine def_info_mod::def_info::def_info_nf90 ( integer, intent(in) ng,
integer, intent(in) model,
integer, intent(in) ncid,
character (*), intent(in) ncname,
integer, dimension(ndimid), intent(in) dimids )

Definition at line 82 of file def_info.F.

83!***********************************************************************
84! !
85! This routine defines information variables for the requested NetCDF !
86! file using the standard NetCDF-3 or NetCDF-4 library. !
87! !
88! On Input: !
89! !
90! ng Nested grid number (integer) !
91! model Calling model identifier (integer) !
92! ncid NetCDF file ID (integer) !
93! ncname NetCDF filename (character) !
94! DimIDs NetCDF dimensions IDs (integer vector of size nDimID) !
95! !
96! On Output: !
97! !
98! exit_flag Error flag (integer) stored in MOD_SCALARS !
99! ioerror NetCDF return code (integer) stored in MOD_IOUNITS !
100! !
101!***********************************************************************
102!
103 USE mod_netcdf
104!
105#if !defined PARALLEL_IO && defined DISTRIBUTE
106 USE distribute_mod, ONLY : mp_bcasti
107#endif
108!
109! Imported variable declarations.
110!
111 integer, intent(in) :: ng, model, ncid
112 integer, intent(in) :: DimIDs(nDimID)
113!
114 character (*), intent(in) :: ncname
115!
116! Local variable declarations.
117!
118 integer, parameter :: Natt = 25
119
120 integer :: brydim, i, ie, is, j, lstr, varid
121 integer :: srdim, stadim, status, swdim, trcdim, usrdim
122#ifdef SEDIMENT
123 integer :: seddim
124#endif
125#ifdef FOUR_DVAR
126 integer :: statedim
127#endif
128#if defined BIOLOGY && defined ECOSIM
129 integer :: bacdim, domdim, fecdim, lightdim, phydim
130
131 integer :: biodim(2)
132#endif
133#if !defined PARALLEL_IO && defined DISTRIBUTE
134 integer :: ibuffer(2)
135#endif
136 integer :: p2dgrd(2), tbrydim(2)
137 integer :: t2dgrd(3), u2dgrd(3), v2dgrd(3)
138!
139 real(r8) :: Aval(6)
140!
141 character (len=11 ) :: bryatt, clmatt, frcatt
142 character (len=50 ) :: tiling
143 character (len=80 ) :: type
144#ifdef FOUR_DVAR
145 character (len=512) :: state_vector
146#endif
147#ifdef BIOLOGY
148 character (len=512) :: bio_file
149#endif
150 character (len=4096) :: string
151 character (len=MaxLen) :: Vinfo(Natt)
152
153 character (len=*), parameter :: MyFile = &
154 & __FILE__//", def_info_nf90"
155!
156 sourcefile=myfile
157!
158!-----------------------------------------------------------------------
159! Set dimension variables.
160!-----------------------------------------------------------------------
161!
162 p2dgrd(1)=dimids(4)
163 p2dgrd(2)=dimids(8)
164 t2dgrd(1)=dimids(1)
165 t2dgrd(2)=dimids(5)
166 u2dgrd(1)=dimids(2)
167 u2dgrd(2)=dimids(6)
168 v2dgrd(1)=dimids(3)
169 v2dgrd(2)=dimids(7)
170 srdim=dimids(9)
171 swdim=dimids(10)
172 trcdim=dimids(11)
173#ifdef SEDIMENT
174 seddim=dimids(32)
175#endif
176 stadim=dimids(13)
177 brydim=dimids(14)
178#ifdef FOUR_DVAR
179 statedim=dimids(29)
180#endif
181 tbrydim(1)=dimids(11)
182 tbrydim(2)=dimids(14)
183#if defined ECOSIM && defined SOLVE3D
184 phydim=dimids(25)
185 bacdim=dimids(26)
186 domdim=dimids(27)
187 fecdim=dimids(28)
188 biodim(1)=phydim
189 biodim(2)=fecdim
190 lightdim=dimids(33)
191#endif
192!
193! Set dimension for generic user parameters.
194!
195 IF ((nuser.gt.0).and.(ncid.ne.gst(ng)%ncid)) THEN
196 status=def_dim(ng, model, ncid, ncname, 'Nuser', &
197 & nuser, usrdim)
198 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
199 END IF
200!
201! Initialize local information variable arrays.
202!
203 DO i=1,natt
204 DO j=1,len(vinfo(1))
205 vinfo(i)(j:j)=' '
206 END DO
207 END DO
208 DO i=1,6
209 aval(i)=0.0_r8
210 END DO
211!
212!-----------------------------------------------------------------------
213! Define global attributes.
214!-----------------------------------------------------------------------
215!
216 IF (outthread) THEN
217!
218! Define history global attribute.
219!
220 IF (len_trim(date_str).gt.0) THEN
221 WRITE (history,'(a,1x,a,", ",a)') 'ROMS, Version', &
222 & trim( version), &
223 & trim(date_str)
224 ELSE
225 WRITE (history,'(a,1x,a)') 'ROMS, Version', &
226 & trim(version)
227 END IF
228!
229! Set tile decomposition global attribute.
230!
231 WRITE (tiling,10) ntilei(ng), ntilej(ng)
232!
233! Define file name global attribute.
234!
235 IF (exit_flag.eq.noerror) THEN
236 status=nf90_put_att(ncid, nf90_global, 'file', &
237 & trim(ncname))
238 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
239 IF (master) WRITE (stdout,20) 'file', trim(ncname)
240 exit_flag=3
241 ioerror=status
242 END IF
243 END IF
244
245#ifndef DEBUGGING
246!
247! Define NetCDF format type.
248!
249 IF (exit_flag.eq.noerror) THEN
250# ifdef HDF5
251 status=nf90_put_att(ncid, nf90_global, 'format', &
252 & 'netCDF-4/HDF5 file')
253# else
254 status=nf90_put_att(ncid, nf90_global, 'format', &
255 & 'netCDF-3 64bit offset file')
256# endif
257 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
258 IF (master) WRITE (stdout,20) 'format', trim(ncname)
259 exit_flag=3
260 ioerror=status
261 END IF
262 END IF
263
264#endif
265!
266! Define file climate and forecast metadata convention global
267! attribute.
268!
269 type='CF-1.4, SGRID-0.3'
270 IF (exit_flag.eq.noerror) THEN
271 status=nf90_put_att(ncid, nf90_global, 'Conventions', &
272 & trim(type))
273 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
274 IF (master) WRITE (stdout,20) 'Conventions', trim(ncname)
275 exit_flag=3
276 ioerror=status
277 END IF
278 END IF
279!
280! Define file type global attribute.
281!
282 IF (ncid.eq.adm(ng)%ncid) THEN
283 type='ROMS adjoint history file'
284 ELSE IF (ncid.eq.avg(ng)%ncid) THEN
285#if defined AD_AVERAGES && defined ADJOINT
286 type='ROMS adjoint model averages file'
287#elif defined RP_AVERAGES && defined TL_IOMS
288 type='ROMS representer model averages file'
289#elif defined TL_AVERAGES && defined TANGENT
290 type='ROMS tangent linear model averages file'
291#else
292 type='ROMS nonlinear model averages file'
293#endif
294 ELSE IF (ncid.eq.dia(ng)%ncid) THEN
295 type='ROMS diagnostics file'
296 ELSE IF (ncid.eq.flt(ng)%ncid) THEN
297 type='ROMS floats file'
298 ELSE IF (ncid.eq.err(ng)%ncid) THEN
299 type='ROMS posterior analysis error covariance matrix'
300 ELSE IF (ncid.eq.gst(ng)%ncid) THEN
301 type='ROMS GST check pointing restart file'
302 ELSE IF (ncid.eq.har(ng)%ncid) THEN
303 type='ROMS Least-squared Detiding Harmonics file'
304 ELSE IF (ncid.eq.hss(ng)%ncid) THEN
305 type='ROMS 4D-Var Hessian eigenvectors file'
306 ELSE IF (ncid.eq.his(ng)%ncid) THEN
307 type='ROMS history file'
308 ELSE IF (ncid.eq.itl(ng)%ncid) THEN
309 type='ROMS tangent linear model initial file'
310 ELSE IF (ncid.eq.lcz(ng)%ncid) THEN
311 type='ROMS 4D-Var Lanczos vectors file'
312 ELSE IF (ncid.eq.lze(ng)%ncid) THEN
313 type='ROMS 4D-Var Evolved Lanczos vectors file'
314 ELSE IF (ncid.eq.nrm(1,ng)%ncid) THEN
315 type='ROMS initial conditions error covariance norm file'
316 ELSE IF (ncid.eq.nrm(2,ng)%ncid) THEN
317 type='ROMS model error covariance norm file'
318 ELSE IF (ncid.eq.nrm(3,ng)%ncid) THEN
319 type='ROMS boundary conditions error covariance norm file'
320 ELSE IF (ncid.eq.nrm(4,ng)%ncid) THEN
321 type='ROMS surface forcing error covariance norm file'
322 ELSE IF (ncid.eq.qck(ng)%ncid) THEN
323 type='ROMS quicksave file'
324 ELSE IF (ncid.eq.rst(ng)%ncid) THEN
325 type='ROMS restart file'
326# ifdef SP4DVAR
327 ELSE IF (ncid.eq.sca(ng)%ncid) THEN
328 type='ROMS AD scratch file'
329 ELSE IF (ncid.eq.sct(ng)%ncid) THEN
330 type='ROMS TL scratch file'
331 ELSE IF (ncid.eq.spa(ng)%ncid) THEN
332 type='ROMS AD Arnoldi file'
333 ELSE IF (ncid.eq.spt(ng)%ncid) THEN
334 type='ROMS TL Arnoldi file'
335# endif
336 ELSE IF (ncid.eq.sta(ng)%ncid) THEN
337 type='ROMS station file'
338 ELSE IF (ncid.eq.tlf(ng)%ncid) THEN
339 type='ROMS tangent linear impulse forcing file'
340 ELSE IF (ncid.eq.tlm(ng)%ncid) THEN
341 type='ROMS tangent linear history file'
342 END IF
343 IF (exit_flag.eq.noerror) THEN
344 status=nf90_put_att(ncid, nf90_global, 'type', &
345 & trim(type))
346 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
347 IF (master) WRITE (stdout,20) 'type', trim(ncname)
348 exit_flag=3
349 ioerror=status
350 END IF
351 END IF
352
353#ifdef FOUR_DVAR
354!
355! Set state vector variables.
356!
357 is=1
358 state_vector=' '
359 DO i=1,nstatevar(ng)
360 lstr=len_trim(vname(1,idsvar(i)))
361 ie=is+lstr
362 state_vector(is:ie)=trim(vname(1,idsvar(i)))//', '
363 is=ie+2
364 END DO
365#endif
366!
367! Define other global attributes to NetCDF file.
368!
369 IF (exit_flag.eq.noerror) THEN
370 status=nf90_put_att(ncid, nf90_global, 'title', &
371 & trim(title))
372 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
373 IF (master) WRITE (stdout,20) 'title', trim(ncname)
374 exit_flag=3
375 ioerror=status
376 END IF
377 END IF
378
379 IF (exit_flag.eq.noerror) THEN
380 status=nf90_put_att(ncid, nf90_global, 'var_info', &
381 & trim(varname))
382 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
383 IF (master) WRITE (stdout,20) 'var_info', trim(ncname)
384 exit_flag=3
385 ioerror=status
386 END IF
387 END IF
388
389#ifdef FOUR_DVAR
390 IF (exit_flag.eq.noerror) THEN
391 lstr=len_trim(state_vector)-1
392 status=nf90_put_att(ncid, nf90_global, 'state_vector', &
393 & state_vector(1:lstr))
394 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
395 IF (master) WRITE (stdout,20) 'state_vector', trim(ncname)
396 exit_flag=3
397 ioerror=status
398 END IF
399 END IF
400#endif
401
402#ifdef PROPAGATOR
403 IF (exit_flag.eq.noerror) THEN
404 status=nf90_put_att(ncid, nf90_global, 'gst_file', &
405 & trim(gst(ng)%name))
406 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
407 IF (master) WRITE (stdout,20) 'gst_file', trim(ncname)
408 exit_flag=3
409 ioerror=status
410 END IF
411 END IF
412#endif
413
414 IF (exit_flag.eq.noerror) THEN
415 status=nf90_put_att(ncid, nf90_global, 'rst_file', &
416 & trim(rst(ng)%name))
417 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
418 IF (master) WRITE (stdout,20) 'rst_file', trim(ncname)
419 exit_flag=3
420 ioerror=status
421 END IF
422 END IF
423
424 IF (exit_flag.eq.noerror) THEN
425 IF (ldefhis(ng)) THEN
426 IF (ndefhis(ng).gt.0) THEN
427 status=nf90_put_att(ncid, nf90_global, 'his_base', &
428 & trim(his(ng)%base))
429 ELSE
430 status=nf90_put_att(ncid, nf90_global, 'his_file', &
431 & trim(his(ng)%name))
432 END IF
433 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
434 IF (master) WRITE (stdout,20) 'his_file', trim(ncname)
435 exit_flag=3
436 ioerror=status
437 END IF
438 END IF
439 END IF
440
441#ifdef GRID_EXTRACT
442 IF (exit_flag.eq.noerror) THEN
443 status=nf90_put_att(ncid, nf90_global, 'extract_grid', &
444 & trim(grx(ng)%name))
445 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
446 IF (master) WRITE (stdout,20) 'extract_grid', trim(ncname)
447 exit_flag=3
448 ioerror=status
449 END IF
450 END IF
451
452 IF (exit_flag.eq.noerror) THEN
453 IF (ldefxtr(ng)) THEN
454 IF (ndefxtr(ng).gt.0) THEN
455 status=nf90_put_att(ncid, nf90_global, 'extract_base', &
456 & trim(xtr(ng)%base))
457 ELSE
458 status=nf90_put_att(ncid, nf90_global, 'extract_file', &
459 & trim(xtr(ng)%name))
460 END IF
461 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
462 IF (master) WRITE (stdout,20) 'extract_file', trim(ncname)
463 exit_flag=3
464 ioerror=status
465 END IF
466 END IF
467 END IF
468#endif
469
470#if defined AVERAGES || \
471 (defined ad_averages && defined adjoint) || \
472 (defined rp_averages && defined tl_ioms) || \
473 (defined tl_averages && defined tangent)
474 IF (exit_flag.eq.noerror) THEN
475 IF (ndefavg(ng).gt.0) THEN
476 status=nf90_put_att(ncid, nf90_global, 'avg_base', &
477 & trim(avg(ng)%base))
478 ELSE
479 status=nf90_put_att(ncid, nf90_global, 'avg_file', &
480 & trim(avg(ng)%name))
481 END IF
482 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
483 IF (master) WRITE (stdout,20) 'avg_file', trim(ncname)
484 exit_flag=3
485 ioerror=status
486 END IF
487 END IF
488#endif
489
490#if defined AVERAGES && defined AVERAGES_DETIDE && \
491 (defined ssh_tides || defined uv_tides)
492 IF (exit_flag.eq.noerror) THEN
493 status=nf90_put_att(ncid, nf90_global, 'har_file', &
494 & trim(har(ng)%name))
495 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
496 IF (master) WRITE (stdout,20) 'har_file', trim(ncname)
497 exit_flag=3
498 ioerror=status
499 END IF
500 END IF
501#endif
502
503#ifdef DIAGNOSTICS
504 IF (exit_flag.eq.noerror) THEN
505 IF (ndefdia(ng).gt.0) THEN
506 status=nf90_put_att(ncid,nf90_global, 'dia_base', &
507 & trim(dia(ng)%base))
508 ELSE
509 status=nf90_put_att(ncid, nf90_global, 'dia_file', &
510 & trim(dia(ng)%name))
511 END IF
512 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
513 IF (master) WRITE (stdout,20) 'dia_file', trim(ncname)
514 exit_flag=3
515 ioerror=status
516 END IF
517 END IF
518#endif
519
520#if defined WEAK_CONSTRAINT && \
521 (defined posterior_error_f || defined posterior_error_i)
522 IF (exit_flag.eq.noerror) THEN
523 status=nf90_put_att(ncid, nf90_global, 'err_file', &
524 & trim(err(ng)%name))
525 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
526 IF (master) WRITE (stdout,20) 'err_file', trim(ncname)
527 exit_flag=3
528 ioerror=status
529 END IF
530 END IF
531#endif
532
533#ifdef STATIONS
534 IF (exit_flag.eq.noerror) THEN
535 status=nf90_put_att(ncid, nf90_global, 'sta_file', &
536 & trim(sta(ng)%name))
537 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
538 IF (master) WRITE (stdout,20) 'sta_file', trim(ncname)
539 exit_flag=3
540 ioerror=status
541 END IF
542 END IF
543#endif
544
545#ifdef FLOATS
546 IF (exit_flag.eq.noerror) THEN
547 status=nf90_put_att(ncid, nf90_global, 'flt_file', &
548 & trim(flt(ng)%name))
549 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
550 IF (master) WRITE (stdout,20) 'flt_file', trim(ncname)
551 exit_flag=3
552 ioerror=status
553 END IF
554 END IF
555#endif
556
557#ifndef ANA_GRID
558 IF (exit_flag.eq.noerror) THEN
559 status=nf90_put_att(ncid, nf90_global, 'grd_file', &
560 & trim(grd(ng)%name))
561 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
562 IF (master) WRITE (stdout,20) 'grd_file', trim(ncname)
563 exit_flag=3
564 ioerror=status
565 END IF
566 END IF
567#endif
568
569#ifdef INI_FILE
570# ifdef NONLINEAR
571 IF (exit_flag.eq.noerror) THEN
572 status=nf90_put_att(ncid, nf90_global, 'ini_file', &
573 & trim(ini(ng)%name))
574 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
575 IF (master) WRITE (stdout,20) 'ini_file', trim(ncname)
576 exit_flag=3
577 ioerror=status
578 END IF
579 END IF
580# endif
581
582# ifdef TANGENT
583 IF (exit_flag.eq.noerror) THEN
584 status=nf90_put_att(ncid,nf90_global, 'itl_file', &
585 & trim(itl(ng)%name))
586 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
587 IF (master) WRITE (stdout,20) 'itl_file', trim(ncname)
588 exit_flag=3
589 ioerror=status
590 END IF
591 END IF
592# endif
593
594# if defined ADJOINT && \
595 !(defined AD_SENSITIVITY || defined FOUR_DVAR || \
596 defined i4dvar_ana_sensitivity || defined opt_observations || \
597 defined sensitivity_4dvar || defined so_semi || \
598 defined stochastic_opt )
599 IF (exit_flag.eq.noerror) THEN
600 status=nf90_put_att(ncid, nf90_global, 'iad_file', &
601 & trim(iad(ng)%name))
602 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
603 IF (master) WRITE (stdout,20) 'iad_file', trim(ncname)
604 exit_flag=3
605 ioerror=status
606 END IF
607 END IF
608# endif
609#endif
610
611#if defined I4DVAR || defined OPT_OBSERVATIONS || \
612 defined weak_constraint
613 IF (exit_flag.eq.noerror) THEN
614 status=nf90_put_att(ncid, nf90_global, 'nrm_file', &
615 & trim(nrm(1,ng)%name))
616 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
617 IF (master) WRITE (stdout,20) 'nrm_file', trim(ncname)
618 exit_flag=3
619 ioerror=status
620 END IF
621 END IF
622#endif
623
624#ifdef WEAK_CONSTRAINT
625 IF (exit_flag.eq.noerror) THEN
626 status=nf90_put_att(ncid, nf90_global, 'tlf_file', &
627 & trim(tlf(ng)%name))
628 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
629 IF (master) WRITE (stdout,20) 'tlf_file', trim(ncname)
630 exit_flag=3
631 ioerror=status
632 END IF
633 END IF
634#endif
635
636#ifdef FOUR_DVAR
637 IF (exit_flag.eq.noerror) THEN
638 status=nf90_put_att(ncid, nf90_global, 'obs_file', &
639 & trim(obs(ng)%name))
640 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
641 IF (master) WRITE (stdout,20) 'obs_file', trim(ncname)
642 exit_flag=3
643 ioerror=status
644 END IF
645 END IF
646#endif
647
648#ifdef RBL4DVAR_FCT_SENSITIVITY
649 IF (exit_flag.eq.noerror) THEN
650 status=nf90_put_att(ncid, nf90_global, 'fcta_file', &
651 & trim(fcta(ng)%name))
652 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
653 IF (master) WRITE (stdout,20) 'fcta_file', trim(ncname)
654 exit_flag=3
655 ioerror=status
656 END IF
657 END IF
658
659 IF (exit_flag.eq.noerror) THEN
660 status=nf90_put_att(ncid, nf90_global, 'fctb_file', &
661 & trim(fctb(ng)%name))
662 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
663 IF (master) WRITE (stdout,20) 'fctb_file', trim(ncname)
664 exit_flag=3
665 ioerror=status
666 END IF
667 END IF
668
669# ifdef OBS_SPACE
670 IF (exit_flag.eq.noerror) THEN
671 status=nf90_put_att(ncid, nf90_global, 'oifa_file', &
672 & trim(oifa(ng)%name))
673 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
674 IF (master) WRITE (stdout,20) 'oifa_file', trim(ncname)
675 exit_flag=3
676 ioerror=status
677 END IF
678 END IF
679
680 IF (exit_flag.eq.noerror) THEN
681 status=nf90_put_att(ncid, nf90_global, 'oifb_file', &
682 & trim(oifb(ng)%name))
683 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
684 IF (master) WRITE (stdout,20) 'oifb_file', trim(ncname)
685 exit_flag=3
686 ioerror=status
687 END IF
688 END IF
689# else
690 IF (exit_flag.eq.noerror) THEN
691 status=nf90_put_att(ncid, nf90_global, 'foia_file', &
692 & trim(foia(ng)%name))
693 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
694 IF (master) WRITE (stdout,20) 'foia_file', trim(ncname)
695 exit_flag=3
696 ioerror=status
697 END IF
698 END IF
699
700 IF (exit_flag.eq.noerror) THEN
701 status=nf90_put_att(ncid, nf90_global, 'foib_file', &
702 & trim(foib(ng)%name))
703 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
704 IF (master) WRITE (stdout,20) 'foib_file', trim(ncname)
705 exit_flag=3
706 ioerror=status
707 END IF
708 END IF
709# endif
710#endif
711
712#ifndef ANA_PSOURCE
713 IF (exit_flag.eq.noerror) THEN
714 IF (luvsrc(ng).or.lwsrc(ng).or.(any(ltracersrc(:,ng)))) THEN
715 status=nf90_put_att(ncid, nf90_global, 'river_file', &
716 & trim(ssf(ng)%name))
717 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
718 IF (master) WRITE (stdout,20) 'river_file', trim(ncname)
719 exit_flag=3
720 ioerror=status
721 END IF
722 END IF
723 END IF
724#endif
725
726#if defined SSH_TIDES || defined UV_TIDES
727 IF (exit_flag.eq.noerror) THEN
728 IF (lprocesstides(ng)) THEN
729 status=nf90_put_att(ncid, nf90_global, 'tide_file', &
730 & trim(tide(ng)%name))
731 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
732 IF (master) WRITE (stdout,20) 'tide_file', trim(ncname)
733 exit_flag=3
734 ioerror=status
735 END IF
736 END IF
737 END IF
738#endif
739
740#ifdef FRC_FILE
741 IF (exit_flag.eq.noerror) THEN
742 DO i=1,nffiles(ng)
743 CALL join_string (frc(i,ng)%files, frc(i,ng)%Nfiles, &
744 & string, lstr)
745 WRITE (frcatt,30) 'frc_file_', i
746 status=nf90_put_att(ncid, nf90_global, frcatt, &
747 & string(1:lstr))
748 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
749 IF (master) WRITE (stdout,20) trim(frcatt), trim(ncname)
750 exit_flag=3
751 ioerror=status
752 EXIT
753 END IF
754 END DO
755 END IF
756#endif
757
758 IF (obcdata(ng)) THEN
759 DO i=1,nbcfiles(ng)
760 IF (exit_flag.eq.noerror) THEN
761 CALL join_string (bry(i,ng)%files, bry(i,ng)%Nfiles, &
762 & string, lstr)
763 WRITE (bryatt,30) 'bry_file_', i
764 status=nf90_put_att(ncid, nf90_global, bryatt, &
765 & string(1:lstr))
766 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
767 IF (master) WRITE (stdout,20) trim(bryatt), trim(ncname)
768 exit_flag=3
769 ioerror=status
770 END IF
771 END IF
772 END DO
773 END IF
774
775#if !(defined ANA_SSH || defined ANA_M2CLIMA || \
776 defined ana_m3clima || defined ana_tclima)
777 IF (lclimatology(ng)) THEN
778 DO i=1,nclmfiles(ng)
779 IF (exit_flag.eq.noerror) THEN
780 CALL join_string (clm(i,ng)%files, clm(i,ng)%Nfiles, &
781 & string, lstr)
782 WRITE (clmatt,30) 'clm_file_', i
783 status=nf90_put_att(ncid, nf90_global, clmatt, &
784 & string(1:lstr))
785 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
786 IF (master) WRITE (stdout,20) trim(clmatt), trim(ncname)
787 exit_flag=3
788 ioerror=status
789 END IF
790 END IF
791 END DO
792 END IF
793#endif
794
795#ifndef ANA_NUDGCOEF
796 IF (lnudging(ng)) THEN
797 IF (exit_flag.eq.noerror) THEN
798 status=nf90_put_att(ncid, nf90_global, 'nud_file', &
799 & trim(nud(ng)%name))
800 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
801 IF (master) WRITE (stdout,20) 'nud_file', trim(ncname)
802 exit_flag=3
803 ioerror=status
804 END IF
805 END IF
806 END IF
807#endif
808
809#ifdef FORWARD_READ
810 IF (exit_flag.eq.noerror) THEN
811 status=nf90_put_att(ncid, nf90_global, 'fwd_file', &
812 & trim(fwd(ng)%name))
813 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
814 IF (master) WRITE (stdout,20) 'fwd_file', trim(ncname)
815 exit_flag=3
816 ioerror=status
817 END IF
818 END IF
819#endif
820
821#if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
822 defined opt_observations || defined sensitivity_4dvar || \
823 defined so_semi
824 IF (exit_flag.eq.noerror) THEN
825 status=nf90_put_att(ncid, nf90_global, 'ads_file', &
826 & trim(ads(ng)%name))
827 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
828 IF (master) WRITE (stdout,20) 'ads_file', trim(ncname)
829 exit_flag=3
830 ioerror=status
831 END IF
832 END IF
833#endif
834
835#if !defined DEBUGGING && defined DISTRIBUTE
836 IF (exit_flag.eq.noerror) THEN
837 status=nf90_put_att(ncid, nf90_global, 'script_file', &
838 & trim(iname))
839 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
840 IF (master) WRITE (stdout,20) 'script_file', trim(ncname)
841 exit_flag=3
842 ioerror=status
843 END IF
844 END IF
845#endif
846
847#ifdef FOUR_DVAR
848 IF (exit_flag.eq.noerror) THEN
849 status=nf90_put_att(ncid, nf90_global, 'apar_file', &
850 & trim(aparnam))
851 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
852 IF (master) WRITE (stdout,20) 'apar_file', trim(ncname)
853 exit_flag=3
854 ioerror=status
855 END IF
856 END IF
857#endif
858
859#ifdef BIOLOGY
860 IF (exit_flag.eq.noerror) THEN
861 status=nf90_put_att(ncid, nf90_global, 'bpar_file', &
862 & trim(bparnam))
863 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
864 IF (master) WRITE (stdout,20) 'bpar_file', trim(ncname)
865 exit_flag=3
866 ioerror=status
867 END IF
868 END IF
869#endif
870
871#ifdef FLOATS
872 IF (exit_flag.eq.noerror) THEN
873 status=nf90_put_att(ncid, nf90_global, 'fpos_file', &
874 & trim(fposnam))
875 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
876 IF (master) WRITE (stdout,20) 'fpos_file', trim(ncname)
877 exit_flag=3
878 ioerror=status
879 END IF
880 END IF
881#endif
882
883#ifdef STATIONS
884 IF (exit_flag.eq.noerror) THEN
885 status=nf90_put_att(ncid, nf90_global, 'spos_file', &
886 & trim(sposnam))
887 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
888 IF (master) WRITE (stdout,20) 'spos_file', trim(ncname)
889 exit_flag=3
890 ioerror=status
891 END IF
892 END IF
893#endif
894
895#ifndef DEBUGGING
896# ifdef SOLVE3D
897!
898! NLM tracer advection scheme.
899!
900 IF (exit_flag.eq.noerror) THEN
901 CALL tadv_putatt (ng, ncid, ncname, 'NLM_TADV', &
902 & hadvection, vadvection, status)
903 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
904 IF (master) WRITE (stdout,20) 'NLM_TADV', trim(ncname)
905 exit_flag=3
906 ioerror=status
907 END IF
908 END IF
909
910# if defined ADJOINT || defined TANGENT || defined TL_IOMS
911 IF (exit_flag.eq.noerror) THEN
912 CALL tadv_putatt (ng, ncid, ncname, 'ADM_TADV', &
913 & ad_hadvection, ad_vadvection, status)
914 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
915 IF (master) WRITE (stdout,20) 'NLM_TADV', trim(ncname)
916 exit_flag=3
917 ioerror=status
918 END IF
919 END IF
920# endif
921# endif
922!
923! NLM Lateral boundary conditions.
924!
925 IF (exit_flag.eq.noerror) THEN
926 CALL lbc_putatt (ng, ncid, ncname, 'NLM_LBC', lbc, status)
927 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
928 IF (master) WRITE (stdout,20) 'NLM_LBC', trim(ncname)
929 exit_flag=3
930 ioerror=status
931 END IF
932 END IF
933
934# if defined ADJOINT || defined TANGENT || defined TL_IOMS
935!
936! Adjoint-based lateral boundary conditions.
937!
938 IF (exit_flag.eq.noerror) THEN
939 CALL lbc_putatt (ng, ncid, ncname, 'ADM_LBC', ad_lbc, status)
940 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
941 IF (master) WRITE (stdout,20) 'ADM_LBC', trim(ncname)
942 exit_flag=3
943 ioerror=status
944 END IF
945 END IF
946# endif
947#endif
948#ifdef GIT_URL
949!
950! GIT repository information.
951!
952 IF (exit_flag.eq.noerror) THEN
953 status=nf90_put_att(ncid, nf90_global, 'git_url', &
954 & trim(git_url))
955 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
956 IF (master) WRITE (stdout,20) 'git_url', trim(ncname)
957 exit_flag=3
958 ioerror=status
959 END IF
960 END IF
961#endif
962#if !defined DEBUGGING && defined GIT_REV
963 IF (exit_flag.eq.noerror) THEN
964 status=nf90_put_att(ncid, nf90_global, 'git_rev', &
965 & trim(git_rev))
966 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
967 IF (master) WRITE (stdout,20) 'git_rev', trim(ncname)
968 exit_flag=3
969 ioerror=status
970 END IF
971 END IF
972#endif
973!
974! SVN repository information.
975!
976 IF (exit_flag.eq.noerror) THEN
977 status=nf90_put_att(ncid, nf90_global, 'svn_url', &
978 & trim(svn_url))
979 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
980 IF (master) WRITE (stdout,20) 'svn_url', trim(ncname)
981 exit_flag=3
982 ioerror=status
983 END IF
984 END IF
985
986#if !defined DEBUGGING && defined SVN_REV
987 IF (exit_flag.eq.noerror) THEN
988 status=nf90_put_att(ncid, nf90_global, 'svn_rev', &
989 & trim(svn_rev))
990 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
991 IF (master) WRITE (stdout,20) 'svn_rev', trim(ncname)
992 exit_flag=3
993 ioerror=status
994 END IF
995 END IF
996#endif
997#ifndef DEBUGGING
998!
999! Local root directory, cpp header directory and file, and analytical
1000! directory
1001!
1002# ifdef ROOT_DIR
1003 IF (exit_flag.eq.noerror) THEN
1004 status=nf90_put_att(ncid, nf90_global, 'code_dir', &
1005 & trim(rdir))
1006 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1007 IF (master) WRITE (stdout,20) 'code_dir', trim(ncname)
1008 exit_flag=3
1009 ioerror=status
1010 END IF
1011 END IF
1012# endif
1013
1014# ifdef HEADER_DIR
1015 IF (exit_flag.eq.noerror) THEN
1016 status=nf90_put_att(ncid, nf90_global, 'header_dir', &
1017 & trim(hdir))
1018 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1019 IF (master) WRITE (stdout,20) 'header_dir', trim(ncname)
1020 exit_flag=3
1021 ioerror=status
1022 END IF
1023 END IF
1024# endif
1025
1026# ifdef ROMS_HEADER
1027 IF (exit_flag.eq.noerror) THEN
1028 status=nf90_put_att(ncid, nf90_global, 'header_file', &
1029 & trim(hfile))
1030 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1031 IF (master) WRITE (stdout,20) 'header_file', trim(ncname)
1032 exit_flag=3
1033 ioerror=status
1034 END IF
1035 END IF
1036# endif
1037#endif
1038#ifndef DEBUGGING
1039!
1040! Attributes describing platform and compiler
1041!
1042 IF (exit_flag.eq.noerror) THEN
1043 status=nf90_put_att(ncid, nf90_global, 'os', &
1044 & trim(my_os))
1045 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1046 IF (master) WRITE (stdout,20) 'os', trim(ncname)
1047 exit_flag=3
1048 ioerror=status
1049 END IF
1050 END IF
1051
1052 IF (exit_flag.eq.noerror) THEN
1053 status=nf90_put_att(ncid, nf90_global, 'cpu', &
1054 & trim(my_cpu))
1055 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1056 IF (master) WRITE (stdout,20) 'cpu', trim(ncname)
1057 exit_flag=3
1058 ioerror=status
1059 END IF
1060 END IF
1061
1062 IF (exit_flag.eq.noerror) THEN
1063 status=nf90_put_att(ncid, nf90_global, 'compiler_system', &
1064 & trim(my_fort))
1065 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1066 IF (master) WRITE (stdout,20) 'compiler_system', &
1067 & trim(ncname)
1068 exit_flag=3
1069 ioerror=status
1070 END IF
1071 END IF
1072
1073 IF (exit_flag.eq.noerror) THEN
1074 status=nf90_put_att(ncid, nf90_global, 'compiler_command', &
1075 & trim(my_fc))
1076 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1077 IF (master) WRITE (stdout,20) 'compiler_command', &
1078 & trim(ncname)
1079 exit_flag=3
1080 ioerror=status
1081 END IF
1082 END IF
1083
1084 IF (exit_flag.eq.noerror) THEN
1085 lstr=index(my_fflags, 'free')-2
1086 IF (lstr.le.0) lstr=len_trim(my_fflags)
1087 status=nf90_put_att(ncid, nf90_global, 'compiler_flags', &
1088 & my_fflags(1:lstr))
1089 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1090 IF (master) WRITE (stdout,20) 'compiler_flags', trim(ncname)
1091 exit_flag=3
1092 ioerror=status
1093 END IF
1094 END IF
1095!
1096! Tiling and history attributes.
1097!
1098 IF (exit_flag.eq.noerror) THEN
1099 status=nf90_put_att(ncid, nf90_global, 'tiling', &
1100 & trim(tiling))
1101 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1102 IF (master) WRITE (stdout,20) 'tiling', trim(ncname)
1103 exit_flag=3
1104 ioerror=status
1105 END IF
1106 END IF
1107
1108 IF (exit_flag.eq.noerror) THEN
1109 status=nf90_put_att(ncid, nf90_global, 'history', &
1110 & trim(history))
1111 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1112 IF (master) WRITE (stdout,20) 'history', trim(ncname)
1113 exit_flag=3
1114 ioerror=status
1115 END IF
1116 END IF
1117!
1118! Analytical header files used.
1119!
1120 IF (exit_flag.eq.noerror) THEN
1121 CALL join_string (ananame, SIZE(ananame), string, lstr)
1122 IF (lstr.gt.0) THEN
1123 status=nf90_put_att(ncid, nf90_global, 'ana_file', &
1124 & string(1:lstr))
1125 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1126 IF (master) WRITE (stdout,20) 'ana_file', trim(ncname)
1127 exit_flag=3
1128 ioerror=status
1129 END IF
1130 END IF
1131 END IF
1132#endif
1133
1134#ifdef BIOLOGY
1135!
1136! Biology model header file used.
1137!
1138 IF (exit_flag.eq.noerror) THEN
1139 DO i=1,512
1140 bio_file(i:i)='-'
1141 END DO
1142 status=nf90_put_att(ncid, nf90_global, 'bio_file', &
1143 & bio_file)
1144 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1145 IF (master) WRITE (stdout,20) 'bio_file', trim(ncname)
1146 exit_flag=3
1147 ioerror=status
1148 END IF
1149 END IF
1150#endif
1151
1152#ifndef DEBUGGING
1153!
1154! Activated CPP options.
1155!
1156 IF (exit_flag.eq.noerror) THEN
1157 lstr=len_trim(coptions)-1
1158 status=nf90_put_att(ncid, nf90_global, 'CPP_options', &
1159 & trim(coptions(1:lstr)))
1160 IF (founderror(status, nf90_noerr, __line__, myfile)) THEN
1161 IF (master) WRITE (stdout,20) 'CPP_options', trim(ncname)
1162 exit_flag=3
1163 ioerror=status
1164 END IF
1165 END IF
1166#endif
1167 END IF
1168
1169#if !defined PARALLEL_IO && defined DISTRIBUTE
1170 ibuffer(1)=exit_flag
1171 ibuffer(2)=ioerror
1172 CALL mp_bcasti (ng, model, ibuffer)
1173 exit_flag=ibuffer(1)
1174 ioerror=ibuffer(2)
1175#endif
1176 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1177
1178#ifdef PROPAGATOR
1179!
1180! Avoid writing other information variables if GST check pointing
1181! NetCDF file.
1182!
1183 IF (ncid.eq.gst(ng)%ncid) RETURN
1184#endif
1185!
1186!-----------------------------------------------------------------------
1187! Define running parameters.
1188!-----------------------------------------------------------------------
1189!
1190! Time stepping parameters.
1191!
1192 vinfo( 1)='ntimes'
1193 vinfo( 2)='number of long time-steps'
1194 status=def_var(ng, model, ncid, varid, nf90_int, &
1195 & 1, (/0/), aval, vinfo, ncname, &
1196 & setparaccess = .false.)
1197 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1198
1199 vinfo( 1)='ndtfast'
1200 vinfo( 2)='number of short time-steps'
1201 status=def_var(ng, model, ncid, varid, nf90_int, &
1202 & 1, (/0/), aval, vinfo, ncname, &
1203 & setparaccess = .false.)
1204 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1205
1206 vinfo( 1)='dt'
1207 vinfo( 2)='size of long time-steps'
1208 vinfo( 3)='second'
1209 status=def_var(ng, model, ncid, varid, nf_tout, &
1210 & 1, (/0/), aval, vinfo, ncname, &
1211 & setparaccess = .false.)
1212 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1213
1214 vinfo( 1)='dtfast'
1215 vinfo( 2)='size of short time-steps'
1216 vinfo( 3)='second'
1217 status=def_var(ng, model, ncid, varid, nf_tout, &
1218 & 1, (/0/), aval, vinfo, ncname, &
1219 & setparaccess = .false.)
1220 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1221
1222 vinfo( 1)='dstart'
1223 vinfo( 2)='time stamp assigned to model initilization'
1224 WRITE (vinfo( 3),'(a,a)') 'days since ', trim(rclock%string)
1225 vinfo( 4)=trim(rclock%calendar)
1226 status=def_var(ng, model, ncid, varid, nf_tout, &
1227 & 1, (/0/), aval, vinfo, ncname, &
1228 & setparaccess = .false.)
1229 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1230
1231#ifdef RBL4DVAR_FCT_SENSITIVITY
1232 vinfo( 1)='ntimes_ana'
1233 vinfo( 2)='number of time-steps for observation impacts, '// &
1234 & 'analysis interval'
1235 status=def_var(ng, model, ncid, varid, nf90_int, &
1236 & 1, (/0/), aval, vinfo, ncname, &
1237 & setparaccess = .false.)
1238 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1239
1240 vinfo( 1)='ntimes_fct'
1241 vinfo( 2)='number of time-steps for observation impacts, '// &
1242 & 'forecast interval'
1243 status=def_var(ng, model, ncid, varid, nf90_int, &
1244 & 1, (/0/), aval, vinfo, ncname, &
1245 & setparaccess = .false.)
1246 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1247#endif
1248
1249#if defined HDF5 && defined DEFLATE
1250 vinfo( 1)='shuffle'
1251 vinfo( 2)='NetCDF-4/HDF5 file format shuffle filer flag'
1252 status=def_var(ng, model, ncid, varid, nf90_int, &
1253 & 1, (/0/), aval, vinfo, ncname, &
1254 & setparaccess = .false.)
1255 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1256
1257 vinfo( 1)='deflate'
1258 vinfo( 2)='NetCDF-4/HDF5 file format deflate filer flag'
1259 status=def_var(ng, model, ncid, varid, nf90_int, &
1260 & 1, (/0/), aval, vinfo, ncname, &
1261 & setparaccess = .false.)
1262 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1263
1264 vinfo( 1)='deflate_level'
1265 vinfo( 2)='NetCDF-4/HDF5 file format deflate level parameter'
1266 status=def_var(ng, model, ncid, varid, nf90_int, &
1267 & 1, (/0/), aval, vinfo, ncname, &
1268 & setparaccess = .false.)
1269 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1270#endif
1271
1272 vinfo( 1)='nHIS'
1273 vinfo( 2)='number of time-steps between history records'
1274 status=def_var(ng, model, ncid, varid, nf90_int, &
1275 & 1, (/0/), aval, vinfo, ncname, &
1276 & setparaccess = .false.)
1277 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1278
1279 vinfo( 1)='ndefHIS'
1280 vinfo( 2)= &
1281 & 'number of time-steps between the creation of history files'
1282 status=def_var(ng, model, ncid, varid, nf90_int, &
1283 & 1, (/0/), aval, vinfo, ncname, &
1284 & setparaccess = .false.)
1285 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1286
1287#ifdef GRID_EXTRACT
1288 vinfo( 1)='nXTR'
1289 vinfo( 2)='number of time-steps between extract history records'
1290 status=def_var(ng, model, ncid, varid, nf90_int, &
1291 & 1, (/0/), aval, vinfo, ncname, &
1292 & setparaccess = .false.)
1293 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1294
1295 vinfo( 1)='ndefXTR'
1296 vinfo( 2)='number of time-steps between the creation of '// &
1297 & 'extract history files'
1298 status=def_var(ng, model, ncid, varid, nf90_int, &
1299 & 1, (/0/), aval, vinfo, ncname, &
1300 & setparaccess = .false.)
1301 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1302
1303 vinfo( 1)='ExtractFlag'
1304 vinfo( 2)='field extraction flag to interpolate or decimate'
1305 status=def_var(ng, model, ncid, varid, nf90_int, &
1306 & 1, (/0/), aval, vinfo, ncname, &
1307 & setparaccess = .false.)
1308 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1309#endif
1310
1311 vinfo( 1)='nRST'
1312 vinfo( 2)='number of time-steps between restart records'
1313 IF (lcyclerst(ng)) THEN
1314 vinfo(13)='only latest two records are maintained'
1315 END IF
1316 status=def_var(ng, model, ncid, varid, nf90_int, &
1317 & 1, (/0/), aval, vinfo, ncname, &
1318 & setparaccess = .false.)
1319 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1320
1321#if defined AVERAGES || \
1322 (defined ad_averages && defined adjoint) || \
1323 (defined rp_averages && defined tl_ioms) || \
1324 (defined tl_averages && defined tangent)
1325 vinfo( 1)='ntsAVG'
1326 vinfo( 2)= &
1327 & 'starting time-step for accumulation of time-averaged fields'
1328 status=def_var(ng, model, ncid, varid, nf90_int, &
1329 & 1, (/0/), aval, vinfo, ncname, &
1330 & setparaccess = .false.)
1331 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1332
1333 vinfo( 1)='nAVG'
1334 vinfo( 2)='number of time-steps between time-averaged records'
1335 status=def_var(ng, model, ncid, varid, nf90_int, &
1336 & 1, (/0/), aval, vinfo, ncname, &
1337 & setparaccess = .false.)
1338 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1339
1340 vinfo( 1)='ndefAVG'
1341 vinfo( 2)= &
1342 & 'number of time-steps between the creation of average files'
1343 status=def_var(ng, model, ncid, varid, nf90_int, &
1344 & 1, (/0/), aval, vinfo, ncname, &
1345 & setparaccess = .false.)
1346 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1347#endif
1348
1349#ifdef ADJOINT
1350 vinfo( 1)='nADJ'
1351 vinfo( 2)='number of time-steps between adjoint history records'
1352 status=def_var(ng, model, ncid, varid, nf90_int, &
1353 & 1, (/0/), aval, vinfo, ncname, &
1354 & setparaccess = .false.)
1355 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1356
1357 vinfo( 1)='ndefADJ'
1358 vinfo( 2)= &
1359 & 'number of time-steps between the creation of adjoint files'
1360 status=def_var(ng, model, ncid, varid, nf90_int, &
1361 & 1, (/0/), aval, vinfo, ncname, &
1362 & setparaccess = .false.)
1363 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1364#endif
1365
1366#ifdef TANGENT
1367 vinfo( 1)='nTLM'
1368 vinfo( 2)='number of time-steps between tangent history records'
1369 status=def_var(ng, model, ncid, varid, nf90_int, &
1370 & 1, (/0/), aval, vinfo, ncname, &
1371 & setparaccess = .false.)
1372 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1373
1374 vinfo( 1)='ndefTLM'
1375 vinfo( 2)= &
1376 & 'number of time-steps between the creation of tanget files'
1377 status=def_var(ng, model, ncid, varid, nf90_int, &
1378 & 1, (/0/), aval, vinfo, ncname, &
1379 & setparaccess = .false.)
1380 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1381#endif
1382
1383#ifdef ADJUST_BOUNDARY
1384 vinfo( 1)='nOBC'
1385 vinfo( 2)= &
1386 & 'number of time-steps between 4D-Var open boundary adjustment'
1387 status=def_var(ng, model, ncid, varid, nf90_int, &
1388 & 1, (/0/), aval, vinfo, ncname, &
1389 & setparaccess = .false.)
1390 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1391#endif
1392
1393#if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
1394 vinfo( 1)='nSFF'
1395 vinfo( 2)= &
1396 & 'number of time-steps between 4D-Var surface forcing adjustment'
1397 status=def_var(ng, model, ncid, varid, nf90_int, &
1398 & 1, (/0/), aval, vinfo, ncname, &
1399 & setparaccess = .false.)
1400 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1401#endif
1402
1403#ifdef PROPAGATOR
1404 vinfo( 1)='LmultiGST'
1405 vinfo( 2)='Switch to write one GST eigenvector per file'
1406 vinfo( 9)='.FALSE.'
1407 vinfo(10)='.TRUE.'
1408 status=def_var(ng, model, ncid, varid, nf90_int, &
1409 & 1, (/0/), aval, vinfo, ncname, &
1410 & setparaccess = .false.)
1411 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1412
1413 vinfo( 1)='LrstGST'
1414 vinfo( 2)='Switch to restart GST analysis'
1415 vinfo( 9)='.FALSE.'
1416 vinfo(10)='.TRUE.'
1417 status=def_var(ng, model, ncid, varid, nf90_int, &
1418 & 1, (/0/), aval, vinfo, ncname, &
1419 & setparaccess = .false.)
1420 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1421
1422 vinfo( 1)='MaxIterGST'
1423 vinfo( 2)='maximum number of GST algorithm iterations'
1424 status=def_var(ng, model, ncid, varid, nf90_int, &
1425 & 1, (/0/), aval, vinfo, ncname, &
1426 & setparaccess = .false.)
1427 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1428
1429 vinfo( 1)='nGST'
1430 vinfo( 2)='number GST iterations between check pointing'
1431 status=def_var(ng, model, ncid, varid, nf90_int, &
1432 & 1, (/0/), aval, vinfo, ncname, &
1433 & setparaccess = .false.)
1434 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1435
1436 vinfo( 1)='NEV'
1437 vinfo( 2)='number Ritz eigenvalues'
1438 status=def_var(ng, model, ncid, varid, nf90_int, &
1439 & 1, (/0/), aval, vinfo, ncname, &
1440 & setparaccess = .false.)
1441 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1442
1443 vinfo( 1)='NCV'
1444 vinfo( 2)='number Ritz eigenvectors generated'
1445 status=def_var(ng, model, ncid, varid, nf90_int, &
1446 & 1, (/0/), aval, vinfo, ncname, &
1447 & setparaccess = .false.)
1448 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1449
1450 vinfo( 1)='Ritz_tol'
1451 vinfo( 2)='relative accuracy of Ritz values'
1452 status=def_var(ng, model, ncid, varid, nf_tout, &
1453 & 1, (/0/), aval, vinfo, ncname, &
1454 & setparaccess = .false.)
1455 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1456#endif
1457
1458#ifdef DIAGNOSTICS
1459 vinfo( 1)='ntsDIA'
1460 vinfo( 2)= &
1461 & 'starting time-step for accumulation of diagnostic fields'
1462 status=def_var(ng, model, ncid, varid, nf90_int, &
1463 & 1, (/0/), aval, vinfo, ncname, &
1464 & setparaccess = .false.)
1465 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1466
1467 vinfo( 1)='nDIA'
1468 vinfo( 2)='number of time-steps between diagnostic records'
1469 status=def_var(ng, model, ncid, varid, nf90_int, &
1470 & 1, (/0/), aval, vinfo, ncname, &
1471 & setparaccess = .false.)
1472 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1473
1474 vinfo( 1)='ndefDIA'
1475 vinfo( 2)= &
1476 & 'number of time-steps between the creation of diagnostic files'
1477 status=def_var(ng, model, ncid, varid, nf90_int, &
1478 & 1, (/0/), aval, vinfo, ncname, &
1479 & setparaccess = .false.)
1480 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1481#endif
1482
1483#ifdef STATIONS
1484 vinfo( 1)='nSTA'
1485 vinfo( 2)='number of time-steps between stations records'
1486 status=def_var(ng, model, ncid, varid, nf90_int, &
1487 & 1, (/0/), aval, vinfo, ncname, &
1488 & setparaccess = .false.)
1489 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1490#endif
1491
1492#ifdef FOUR_DVAR
1493 vinfo( 1)='Nouter'
1494 vinfo( 2)='number of minimization outer loops'
1495 status=def_var(ng, model, ncid, varid, nf90_int, &
1496 & 1, (/0/), aval, vinfo, ncname, &
1497 & setparaccess = .false.)
1498 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1499
1500 vinfo( 1)='Ninner'
1501 vinfo( 2)='number of minimization inner loops'
1502 status=def_var(ng, model, ncid, varid, nf90_int, &
1503 & 1, (/0/), aval, vinfo, ncname, &
1504 & setparaccess = .false.)
1505 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1506#endif
1507
1508#if defined POWER_LAW && defined SOLVE3D
1509!
1510! Power-law shape filter parameters for time-averaging of barotropic
1511! fields.
1512!
1513 vinfo( 1)='Falpha'
1514 vinfo( 2)='Power-law shape barotropic filter parameter'
1515 status=def_var(ng, model, ncid, varid, nf_tout, &
1516 & 1, (/0/), aval, vinfo, ncname, &
1517 & setparaccess = .false.)
1518 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1519
1520 vinfo( 1)='Fbeta'
1521 vinfo( 2)='Power-law shape barotropic filter parameter'
1522 status=def_var(ng, model, ncid, varid, nf_tout, &
1523 & 1, (/0/), aval, vinfo, ncname, &
1524 & setparaccess = .false.)
1525 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1526
1527 vinfo( 1)='Fgamma'
1528 vinfo( 2)='Power-law shape barotropic filter parameter'
1529 status=def_var(ng, model, ncid, varid, nf_tout, &
1530 & 1, (/0/), aval, vinfo, ncname, &
1531 & setparaccess = .false.)
1532 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1533#endif
1534!
1535! Horizontal mixing coefficients.
1536!
1537#if defined SOLVE3D && defined TS_DIF2
1538 vinfo( 1)='nl_tnu2'
1539 vinfo( 2)='nonlinear model Laplacian mixing coefficient '// &
1540 & 'for tracers'
1541 vinfo( 3)='meter2 second-1'
1542 status=def_var(ng, model, ncid, varid, nf_type, &
1543 & 1, (/trcdim/), aval, vinfo, ncname, &
1544 & setparaccess = .false.)
1545 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1546
1547# ifdef ADJOINT
1548 vinfo( 1)='ad_tnu2'
1549 vinfo( 2)='adjoint model Laplacian mixing coefficient '// &
1550 & 'for tracers'
1551 vinfo( 3)='meter2 second-1'
1552 status=def_var(ng, model, ncid, varid, nf_type, &
1553 & 1, (/trcdim/), aval, vinfo, ncname, &
1554 & setparaccess = .false.)
1555 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1556# endif
1557
1558# if defined TANGENT || defined TL_IOMS
1559 vinfo( 1)='tl_tnu2'
1560 vinfo( 2)='tangent linear model Laplacian mixing coefficient '// &
1561 & 'for tracers'
1562 vinfo( 3)='meter2 second-1'
1563 status=def_var(ng, model, ncid, varid, nf_type, &
1564 & 1, (/trcdim/), aval, vinfo, ncname, &
1565 & setparaccess = .false.)
1566 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1567# endif
1568#endif
1569
1570#if defined SOLVE3D && defined TS_DIF4
1571 vinfo( 1)='nl_tnu4'
1572 vinfo( 2)='nonlinear model biharmonic mixing coefficient '// &
1573 & 'for tracers'
1574 vinfo( 3)='meter4 second-1'
1575 status=def_var(ng, model, ncid, varid, nf_type, &
1576 & 1, (/trcdim/), aval, vinfo, ncname, &
1577 & setparaccess = .false.)
1578 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1579
1580# ifdef ADJOINT
1581 vinfo( 1)='ad_tnu4'
1582 vinfo( 2)='adjoint model biharmonic mixing coefficient '// &
1583 & 'for tracers'
1584 vinfo( 3)='meter4 second-1'
1585 status=def_var(ng, model, ncid, varid, nf_type, &
1586 & 1, (/trcdim/), aval, vinfo, ncname, &
1587 & setparaccess = .false.)
1588 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1589# endif
1590
1591# if defined TANGENT || defined TL_IOMS
1592 vinfo( 1)='tl_tnu4'
1593 vinfo( 2)='tangent linear model biharmonic mixing coefficient '// &
1594 & 'for tracers'
1595 vinfo( 3)='meter4 second-1'
1596 status=def_var(ng, model, ncid, varid, nf_type, &
1597 & 1, (/trcdim/), aval, vinfo, ncname, &
1598 & setparaccess = .false.)
1599 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1600# endif
1601#endif
1602
1603#ifdef UV_VIS2
1604 vinfo( 1)='nl_visc2'
1605 vinfo( 2)='nonlinear model Laplacian mixing coefficient '// &
1606 & 'for momentum'
1607 vinfo( 3)='meter2 second-1'
1608 status=def_var(ng, model, ncid, varid, nf_type, &
1609 & 1, (/0/), aval, vinfo, ncname, &
1610 & setparaccess = .false.)
1611 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1612
1613# ifdef ADJOINT
1614 vinfo( 1)='ad_visc2'
1615 vinfo( 2)='adjoint model Laplacian mixing coefficient '// &
1616 & 'for momentum'
1617 vinfo( 3)='meter2 second-1'
1618 status=def_var(ng, model, ncid, varid, nf_type, &
1619 & 1, (/0/), aval, vinfo, ncname, &
1620 & setparaccess = .false.)
1621 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1622# endif
1623
1624# if defined TANGENT || defined TL_IOMS
1625 vinfo( 1)='tl_visc2'
1626 vinfo( 2)='tangent linear model Laplacian mixing coefficient '// &
1627 & 'for momentum'
1628 vinfo( 3)='meter2 second-1'
1629 status=def_var(ng, model, ncid, varid, nf_type, &
1630 & 1, (/0/), aval, vinfo, ncname, &
1631 & setparaccess = .false.)
1632 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1633# endif
1634#endif
1635
1636#ifdef UV_VIS4
1637 vinfo( 1)='nl_visc4'
1638 vinfo( 2)='nonlinear model biharmonic mixing coefficient '// &
1639 & 'for momentum'
1640 vinfo( 3)='meter4 second-1'
1641 status=def_var(ng, model, ncid, varid, nf_type, &
1642 & 1, (/0/), aval, vinfo, ncname, &
1643 & setparaccess = .false.)
1644 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1645
1646# ifdef ADJOINT
1647 vinfo( 1)='ad_visc4'
1648 vinfo( 2)='adjoint model biharmonic mixing coefficient '// &
1649 & 'for momentum'
1650 vinfo( 3)='meter4 second-1'
1651 status=def_var(ng, model, ncid, varid, nf_type, &
1652 & 1, (/0/), aval, vinfo, ncname, &
1653 & setparaccess = .false.)
1654 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1655# endif
1656
1657# if defined TANGENT || defined TL_IOMS
1658 vinfo( 1)='tl_visc4'
1659 vinfo( 2)='tangent linear model biharmonic mixing coefficient '// &
1660 & 'for momentum'
1661 vinfo( 3)='meter4 second-1'
1662 status=def_var(ng, model, ncid, varid, nf_type, &
1663 & 1, (/0/), aval, vinfo, ncname, &
1664 & setparaccess = .false.)
1665 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1666# endif
1667#endif
1668
1669#if defined SOLVE3D && (defined MY25_MIXING || defined GLS_MIXING)
1670# ifdef TKE_DIF2
1671 vinfo( 1)='tkenu2'
1672 vinfo( 2)='harmonic mixing coefficient for turbulent energy'
1673 vinfo( 3)='meter2 second-1'
1674 status=def_var(ng, model, ncid, varid, nf_type, &
1675 & 1, (/0/), aval, vinfo, ncname, &
1676 & setparaccess = .false.)
1677 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1678# endif
1679# ifdef TKE_DIF4
1680 vinfo( 1)='tkenu4'
1681 vinfo( 2)='biharmonic mixing coefficient for turbulent energy'
1682 vinfo( 3)='meter4 second-1'
1683 status=def_var(ng, model, ncid,varid, nf_type, &
1684 & 1, (/0/), aval, vinfo, ncname, &
1685 & setparaccess = .false.)
1686 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1687# endif
1688#endif
1689#if defined UV_VIS2 || defined UV_VIS4
1690 vinfo( 1)='LuvSponge'
1691 vinfo( 2)='horizontal viscosity sponge activation switch'
1692 vinfo( 9)='.FALSE.'
1693 vinfo(10)='.TRUE.'
1694 status=def_var(ng, model, ncid, varid, nf90_int, &
1695 & 1, (/0/), aval, vinfo, ncname, &
1696 & setparaccess = .false.)
1697 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1698#endif
1699#if (defined TS_DIF2 || defined TS_DIF4) && defined SOLVE3D
1700 vinfo( 1)='LtracerSponge'
1701 vinfo( 2)='horizontal diffusivity sponge activation switch'
1702 vinfo( 9)='.FALSE.'
1703 vinfo(10)='.TRUE.'
1704 status=def_var(ng, model, ncid, varid, nf90_int, &
1705 & 1, (/trcdim/), aval, vinfo, ncname, &
1706 & setparaccess = .false.)
1707 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1708#endif
1709#ifdef SOLVE3D
1710!
1711! Background vertical mixing coefficients.
1712!
1713 vinfo( 1)='Akt_bak'
1714 vinfo( 2)='background vertical mixing coefficient for tracers'
1715 vinfo( 3)='meter2 second-1'
1716 status=def_var(ng, model, ncid, varid, nf_type, &
1717 & 1, (/trcdim/), aval, vinfo, ncname, &
1718 & setparaccess = .false.)
1719 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1720
1721 vinfo( 1)='Akv_bak'
1722 vinfo( 2)='background vertical mixing coefficient for momentum'
1723 vinfo( 3)='meter2 second-1'
1724 status=def_var(ng, model, ncid, varid, nf_type, &
1725 & 1, (/0/), aval, vinfo, ncname, &
1726 & setparaccess = .false.)
1727 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1728
1729# if defined MY25_MIXING || defined GLS_MIXING
1730 vinfo( 1)='Akk_bak'
1731 vinfo( 2)= &
1732 & 'background vertical mixing coefficient for turbulent energy'
1733 vinfo( 3)='meter2 second-1'
1734 status=def_var(ng, model, ncid, varid, nf_type, &
1735 & 1, (/0/), aval, vinfo, ncname, &
1736 & setparaccess = .false.)
1737 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1738
1739 vinfo( 1)='Akp_bak'
1740 vinfo( 2)= &
1741 & 'background vertical mixing coefficient for length scale'
1742 vinfo( 3)='meter2 second-1'
1743 status=def_var(ng, model, ncid, varid, nf_type, &
1744 & 1, (/0/), aval, vinfo, ncname, &
1745 & setparaccess = .false.)
1746 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1747# endif
1748
1749# ifdef FORWARD_MIXING
1750!
1751! Basic state vertical mixing scale used in adjoint-based applications.
1752!
1753# ifdef ADJOINT
1754 vinfo( 1)='ad_Akt_fac'
1755 vinfo( 2)='adjoint model basic state vertical mixing '// &
1756 & 'scale for tracers'
1757 status=def_var(ng, model, ncid, varid, nf_type, &
1758 & 1, (/trcdim/), aval, vinfo, ncname, &
1759 & setparaccess = .false.)
1760 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1761# endif
1762
1763# if defined TANGENT || defined TL_IOMS
1764 vinfo( 1)='tl_Akt_fac'
1765 vinfo( 2)='tangent linear model basic state vertical mixing '// &
1766 & 'scale for tracers'
1767 status=def_var(ng, model, ncid, varid, nf_type, &
1768 & 1, (/trcdim/), aval, vinfo, ncname, &
1769 & setparaccess = .false.)
1770 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1771# endif
1772
1773# ifdef ADJOINT
1774 vinfo( 1)='ad_Akv_fac'
1775 vinfo( 2)='adjoint model basic state vertical mixing '// &
1776 & 'scale for momentum'
1777 status=def_var(ng, model, ncid, varid, nf_type, &
1778 & 1, (/0/), aval, vinfo, ncname, &
1779 & setparaccess = .false.)
1780 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1781# endif
1782
1783# if defined TANGENT || defined TL_IOMS
1784 vinfo( 1)='tl_Akv_fac'
1785 vinfo( 2)='tangent linear model basic state vertical mixing '// &
1786 & 'scale for momentum'
1787 status=def_var(ng, model, ncid, varid, nf_type, &
1788 & 1, (/0/), aval, vinfo, ncname, &
1789 & setparaccess = .false.)
1790 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1791# endif
1792# endif
1793#endif
1794!
1795! Drag coefficients.
1796!
1797 vinfo( 1)='rdrg'
1798 vinfo( 2)='linear drag coefficient'
1799 vinfo( 3)='meter second-1'
1800 status=def_var(ng, model, ncid, varid, nf_type, &
1801 & 1, (/0/), aval, vinfo, ncname, &
1802 & setparaccess = .false.)
1803 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1804
1805 vinfo( 1)='rdrg2'
1806 vinfo( 2)='quadratic drag coefficient'
1807 status=def_var(ng, model, ncid, varid, nf_type, &
1808 & 1, (/0/), aval, vinfo ,ncname, &
1809 & setparaccess = .false.)
1810 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1811
1812#ifdef SOLVE3D
1813 vinfo( 1)='Zob'
1814 vinfo( 2)='bottom roughness'
1815 vinfo( 3)='meter'
1816 status=def_var(ng, model, ncid, varid, nf_type, &
1817 & 1, (/0/), aval, vinfo, ncname, &
1818 & setparaccess = .false.)
1819 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1820
1821 vinfo( 1)='Zos'
1822 vinfo( 2)='surface roughness'
1823 vinfo( 3)='meter'
1824 status=def_var(ng, model, ncid, varid, nf_type, &
1825 & 1, (/0/), aval, vinfo, ncname, &
1826 & setparaccess = .false.)
1827 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1828#endif
1829#if defined SOLVE3D && defined GLS_MIXING
1830!
1831! Generic length-scale parameters.
1832!
1833 vinfo( 1)='gls_p'
1834 vinfo( 2)='stability exponent'
1835 status=def_var(ng, model, ncid, varid, nf_type, &
1836 & 1, (/0/), aval, vinfo, ncname, &
1837 & setparaccess = .false.)
1838 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1839
1840 vinfo( 1)='gls_m'
1841 vinfo( 2)='turbulent kinetic energy exponent'
1842 status=def_var(ng, model, ncid, varid, nf_type, &
1843 & 1, (/0/), aval, vinfo, ncname, &
1844 & setparaccess = .false.)
1845 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1846
1847 vinfo( 1)='gls_n'
1848 vinfo( 2)='turbulent length scale exponent'
1849 status=def_var(ng, model, ncid, varid, nf_type, &
1850 & 1, (/0/), aval, vinfo, ncname, &
1851 & setparaccess = .false.)
1852 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1853
1854 vinfo( 1)='gls_cmu0'
1855 vinfo( 2)='stability coefficient'
1856 status=def_var(ng, model, ncid, varid, nf_type, &
1857 & 1, (/0/), aval, vinfo, ncname, &
1858 & setparaccess = .false.)
1859 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1860
1861 vinfo( 1)='gls_c1'
1862 vinfo( 2)='shear production coefficient'
1863 status=def_var(ng, model, ncid, varid, nf_type, &
1864 & 1, (/0/), aval, vinfo, ncname, &
1865 & setparaccess = .false.)
1866 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1867
1868 vinfo( 1)='gls_c2'
1869 vinfo( 2)='dissipation coefficient'
1870 status=def_var(ng, model, ncid, varid, nf_type, &
1871 & 1, (/0/), aval, vinfo, ncname, &
1872 & setparaccess = .false.)
1873 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1874
1875 vinfo( 1)='gls_c3m'
1876 vinfo( 2)='buoyancy production coefficient (minus)'
1877 status=def_var(ng, model, ncid, varid, nf_type, &
1878 & 1, (/0/), aval, vinfo, ncname, &
1879 & setparaccess = .false.)
1880 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1881
1882 vinfo( 1)='gls_c3p'
1883 vinfo( 2)='buoyancy production coefficient (plus)'
1884 status=def_var(ng, model, ncid, varid, nf_type, &
1885 & 1, (/0/), aval, vinfo, ncname, &
1886 & setparaccess = .false.)
1887 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1888
1889 vinfo( 1)='gls_sigk'
1890 vinfo( 2)='constant Schmidt number for TKE'
1891 status=def_var(ng, model, ncid, varid, nf_type, &
1892 & 1, (/0/), aval, vinfo, ncname, &
1893 & setparaccess = .false.)
1894 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1895
1896 vinfo( 1)='gls_sigp'
1897 vinfo( 2)='constant Schmidt number for PSI'
1898 status=def_var(ng, model, ncid, varid, nf_type, &
1899 & 1, (/0/), aval, vinfo, ncname, &
1900 & setparaccess = .false.)
1901 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1902
1903 vinfo( 1)='gls_Kmin'
1904 vinfo( 2)='minimum value of specific turbulent kinetic energy'
1905 status=def_var(ng, model, ncid, varid, nf_type, &
1906 & 1, (/0/), aval, vinfo, ncname, &
1907 & setparaccess = .false.)
1908 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1909
1910 vinfo( 1)='gls_Pmin'
1911 vinfo( 2)='minimum Value of dissipation'
1912 status=def_var(ng, model, ncid, varid, nf_type, &
1913 & 1, (/0/), aval, vinfo, ncname, &
1914 & setparaccess = .false.)
1915 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1916
1917 vinfo( 1)='Charnok_alpha'
1918 vinfo( 2)='Charnock factor for surface roughness'
1919 status=def_var(ng, model, ncid, varid, nf_type, &
1920 & 1, (/0/), aval, vinfo, ncname, &
1921 & setparaccess = .false.)
1922 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1923
1924 vinfo( 1)='Zos_hsig_alpha'
1925 vinfo( 2)='wave amplitude factor for surface roughness'
1926 status=def_var(ng, model, ncid, varid, nf_type, &
1927 & 1, (/0/), aval, vinfo, ncname, &
1928 & setparaccess = .false.)
1929 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1930
1931 vinfo( 1)='sz_alpha'
1932 vinfo( 2)='surface flux from wave dissipation'
1933 status=def_var(ng, model, ncid, varid, nf_type, &
1934 & 1, (/0/), aval, vinfo, ncname, &
1935 & setparaccess = .false.)
1936 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1937
1938 vinfo( 1)='CrgBan_cw'
1939 vinfo( 2)='surface flux due to Craig and Banner wave breaking'
1940 status=def_var(ng, model, ncid, varid, nf_type, &
1941 & 1, (/0/), aval, vinfo, ncname, &
1942 & setparaccess = .false.)
1943 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1944#endif
1945#ifdef WEC
1946 vinfo( 1)='wec_alpha'
1947 vinfo( 2)='WEC wave dissipation action scale'
1948 vinfo( 9)='all goes to breaking and none to roller'
1949 vinfo(10)='all goes to roller and none to breaking'
1950 status=def_var(ng, model, ncid, varid, nf_type, &
1951 & 1, (/0/), aval, vinfo, ncname, &
1952 & setparaccess = .false.)
1953 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1954#endif
1955!
1956! Nudging inverse time scales used in various tasks.
1957!
1958 vinfo( 1)='Znudg'
1959 vinfo( 2)='free-surface nudging/relaxation inverse time scale'
1960 vinfo( 3)='day-1'
1961 status=def_var(ng, model, ncid, varid, nf_tout, &
1962 & 1, (/0/), aval, vinfo, ncname, &
1963 & setparaccess = .false.)
1964 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1965
1966 vinfo( 1)='M2nudg'
1967 vinfo( 2)='2D momentum nudging/relaxation inverse time scale'
1968 vinfo( 3)='day-1'
1969 status=def_var(ng, model, ncid, varid, nf_tout, &
1970 & 1, (/0/), aval, vinfo, ncname, &
1971 & setparaccess = .false.)
1972 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1973
1974#ifdef SOLVE3D
1975 vinfo( 1)='M3nudg'
1976 vinfo( 2)='3D momentum nudging/relaxation inverse time scale'
1977 vinfo( 3)='day-1'
1978 status=def_var(ng, model, ncid, varid, nf_tout, &
1979 & 1, (/0/), aval, vinfo, ncname, &
1980 & setparaccess = .false.)
1981 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1982
1983 vinfo( 1)='Tnudg'
1984 vinfo( 2)='Tracers nudging/relaxation inverse time scale'
1985 vinfo( 3)='day-1'
1986 status=def_var(ng, model, ncid, varid, nf_tout, &
1987 & 1, (/trcdim/), aval, vinfo, ncname, &
1988 & setparaccess = .false.)
1989 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
1990#endif
1991
1992#ifndef DEBUGGING
1993!
1994! Open boundary nudging, inverse time scales.
1995!
1996 IF (nudgingcoeff(ng)) THEN
1997 vinfo( 1)='FSobc_in'
1998 vinfo( 2)='free-surface inflow, nudging inverse time scale'
1999 vinfo( 3)='second-1'
2000 status=def_var(ng, model, ncid, varid, nf_tout, &
2001 & 1, (/brydim/), aval, vinfo, ncname, &
2002 & setparaccess = .false.)
2003 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2004
2005 vinfo( 1)='FSobc_out'
2006 vinfo( 2)='free-surface outflow, nudging inverse time scale'
2007 vinfo( 3)='second-1'
2008 status=def_var(ng, model, ncid, varid, nf_tout, &
2009 & 1, (/brydim/), aval, vinfo, ncname, &
2010 & setparaccess = .false.)
2011 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2012
2013 vinfo( 1)='M2obc_in'
2014 vinfo( 2)='2D momentum inflow, nudging inverse time scale'
2015 vinfo( 3)='second-1'
2016 status=def_var(ng, model, ncid, varid, nf_tout, &
2017 & 1, (/brydim/), aval, vinfo, ncname, &
2018 & setparaccess = .false.)
2019 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2020
2021 vinfo( 1)='M2obc_out'
2022 vinfo( 2)='2D momentum outflow, nudging inverse time scale'
2023 vinfo( 3)='second-1'
2024 status=def_var(ng, model, ncid, varid, nf_tout, &
2025 & 1, (/brydim/), aval, vinfo, ncname, &
2026 & setparaccess = .false.)
2027 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2028
2029# ifdef SOLVE3D
2030 vinfo( 1)='Tobc_in'
2031 vinfo( 2)='tracers inflow, nudging inverse time scale'
2032 vinfo( 3)='second-1'
2033 status=def_var(ng, model, ncid, varid, nf_tout, &
2034 & 2, tbrydim, aval, vinfo, ncname, &
2035 & setparaccess = .false.)
2036 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2037
2038 vinfo( 1)='Tobc_out'
2039 vinfo( 2)='tracers outflow, nudging inverse time scale'
2040 vinfo( 3)='second-1'
2041 status=def_var(ng, model, ncid, varid, nf_tout, &
2042 & 2, tbrydim, aval, vinfo, ncname, &
2043 & setparaccess = .false.)
2044 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2045
2046 vinfo( 1)='M3obc_in'
2047 vinfo( 2)='3D momentum inflow, nudging inverse time scale'
2048 vinfo( 3)='second-1'
2049 status=def_var(ng, model, ncid, varid, nf_tout, &
2050 & 1, (/brydim/), aval, vinfo, ncname, &
2051 & setparaccess = .false.)
2052 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2053
2054 vinfo( 1)='M3obc_out'
2055 vinfo( 2)='3D momentum outflow, nudging inverse time scale'
2056 vinfo( 3)='second-1'
2057 status=def_var(ng, model, ncid, varid, nf_tout, &
2058 & 1, (/brydim/), aval, vinfo, ncname, &
2059 & setparaccess = .false.)
2060 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2061# endif
2062 END IF
2063#endif
2064!
2065! Equation of State parameters.
2066!
2067 vinfo( 1)='rho0'
2068 vinfo( 2)='mean density used in Boussinesq approximation'
2069 vinfo( 3)='kilogram meter-3'
2070 status=def_var(ng, model, ncid, varid, nf_type, &
2071 & 1, (/0/), aval, vinfo, ncname, &
2072 & setparaccess = .false.)
2073 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2074
2075#if defined SOLVE3D && defined PROPAGATOR
2076 vinfo( 1)='bvf_bak'
2077 vinfo( 2)='background Brunt-Vaisala frequency'
2078 vinfo( 3)='second-2'
2079 status=def_var(ng, model, ncid, varid, nf_type, &
2080 & 1, (/0/), aval, vinfo, ncname, &
2081 & setparaccess = .false.)
2082 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2083#endif
2084
2085#if defined SOLVE3D && \
2086 (!defined NONLIN_EOS || defined FOUR_DVAR || defined PROPAGATOR)
2087 vinfo( 1)='R0'
2088 vinfo( 2)='background density used in linear equation of state'
2089 vinfo( 3)='kilogram meter-3'
2090 status=def_var(ng, model, ncid, varid, nf_type, &
2091 & 1, (/0/), aval, vinfo, ncname, &
2092 & setparaccess = .false.)
2093 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2094
2095 vinfo( 1)='Tcoef'
2096 vinfo( 2)='thermal expansion coefficient'
2097 vinfo( 3)='Celsius-1'
2098 status=def_var(ng, model, ncid, varid, nf_type, &
2099 & 1, (/0/), aval, vinfo, ncname, &
2100 & setparaccess = .false.)
2101 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2102
2103 vinfo( 1)='Scoef'
2104 vinfo( 2)='Saline contraction coefficient'
2105 status=def_var(ng, model, ncid, varid, nf_type, &
2106 & 1, (/0/), aval, vinfo, ncname, &
2107 & setparaccess = .false.)
2108 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2109#endif
2110#ifdef SOLVE3D
2111!
2112! Various parameters.
2113!
2114# ifdef BODYFORCE
2115 vinfo( 1)='levsfrc'
2116 vinfo( 2)='shallowest level for body-force stress'
2117 status=def_var(ng, model, ncid, varid, nf90_int, &
2118 & 1, (/0/), aval, vinfo, ncname, &
2119 & setparaccess = .false.)
2120 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2121
2122 vinfo( 1)='levbfrc'
2123 vinfo( 2)='deepest level for body-force stress'
2124 status=def_var(ng, model, ncid, varid, nf90_int, &
2125 & 1, (/0/), aval, vinfo, ncname, &
2126 & setparaccess = .false.)
2127 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2128# endif
2129#endif
2130!
2131! Slipperiness parameters.
2132!
2133 vinfo( 1)='gamma2'
2134 vinfo( 2)='slipperiness parameter'
2135 status=def_var(ng, model, ncid, varid, nf_type, &
2136 & 1, (/0/), aval, vinfo, ncname, &
2137 & setparaccess = .false.)
2138 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2139!
2140! Logical switches to activate horizontal momentum transport
2141! point Sources/Sinks (like river runoff transport) and mass point
2142! Sources/Sinks (like volume vertical influx).
2143!
2144 vinfo( 1)='LuvSrc'
2145 vinfo( 2)='momentum point sources and sink activation switch'
2146 vinfo( 9)='.FALSE.'
2147 vinfo(10)='.TRUE.'
2148 status=def_var(ng, model, ncid, varid, nf90_int, &
2149 & 1, (/0/), aval, vinfo, ncname, &
2150 & setparaccess = .false.)
2151 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2152
2153 vinfo( 1)='LwSrc'
2154 vinfo( 2)='mass point sources and sink activation switch'
2155 vinfo( 9)='.FALSE.'
2156 vinfo(10)='.TRUE.'
2157 status=def_var(ng, model, ncid, varid, nf90_int, &
2158 & 1, (/0/), aval, vinfo, ncname, &
2159 & setparaccess = .false.)
2160 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2161
2162#ifdef SOLVE3D
2163!
2164! Logical switches indicating which tracer variables are processed
2165! during point Sources/Sinks.
2166!
2167 vinfo( 1)='LtracerSrc'
2168 vinfo( 2)='tracer point sources and sink activation switch'
2169 vinfo( 9)='.FALSE.'
2170 vinfo(10)='.TRUE.'
2171 status=def_var(ng, model, ncid, varid, nf90_int, &
2172 & 1, (/trcdim/), aval, vinfo, ncname, &
2173 & setparaccess = .false.)
2174 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2175#endif
2176!
2177! Logical switches to process climatology fields.
2178!
2179 vinfo( 1)='LsshCLM'
2180 vinfo( 2)='sea surface height climatology processing switch'
2181 vinfo( 9)='.FALSE.'
2182 vinfo(10)='.TRUE.'
2183 status=def_var(ng, model, ncid, varid, nf90_int, &
2184 & 1, (/0/), aval, vinfo, ncname, &
2185 & setparaccess = .false.)
2186 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2187
2188 vinfo( 1)='Lm2CLM'
2189 vinfo( 2)='2D momentum climatology processing switch'
2190 vinfo( 9)='.FALSE.'
2191 vinfo(10)='.TRUE.'
2192 status=def_var(ng, model, ncid, varid, nf90_int, &
2193 & 1, (/0/), aval, vinfo, ncname, &
2194 & setparaccess = .false.)
2195 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2196
2197#ifdef SOLVE3D
2198 vinfo( 1)='Lm3CLM'
2199 vinfo( 2)='3D momentum climatology processing switch'
2200 vinfo( 9)='.FALSE.'
2201 vinfo(10)='.TRUE.'
2202 status=def_var(ng, model, ncid, varid, nf90_int, &
2203 & 1, (/0/), aval, vinfo, ncname, &
2204 & setparaccess = .false.)
2205 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2206
2207 vinfo( 1)='LtracerCLM'
2208 vinfo( 2)='tracer climatology processing switch'
2209 vinfo( 9)='.FALSE.'
2210 vinfo(10)='.TRUE.'
2211 status=def_var(ng, model, ncid, varid, nf90_int, &
2212 & 1, (/trcdim/), aval, vinfo, ncname, &
2213 & setparaccess = .false.)
2214 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2215#endif
2216!
2217! Logical switches for nudging of climatology fields.
2218!
2219 vinfo( 1)='LnudgeM2CLM'
2220 vinfo( 2)='2D momentum climatology nudging activation switch'
2221 vinfo( 9)='.FALSE.'
2222 vinfo(10)='.TRUE.'
2223 status=def_var(ng, model, ncid, varid, nf90_int, &
2224 & 1, (/0/), aval, vinfo, ncname, &
2225 & setparaccess = .false.)
2226 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2227#ifdef SOLVE3D
2228!
2229 vinfo( 1)='LnudgeM3CLM'
2230 vinfo( 2)='3D momentum climatology nudging activation switch'
2231 vinfo( 9)='.FALSE.'
2232 vinfo(10)='.TRUE.'
2233 status=def_var(ng, model, ncid, varid, nf90_int, &
2234 & 1, (/0/), aval, vinfo, ncname, &
2235 & setparaccess = .false.)
2236 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2237!
2238 vinfo( 1)='LnudgeTCLM'
2239 vinfo( 2)='tracer climatology nudging activation switch'
2240 vinfo( 9)='.FALSE.'
2241 vinfo(10)='.TRUE.'
2242 status=def_var(ng, model, ncid, varid, nf90_int, &
2243 & 1, (/trcdim/), aval, vinfo, ncname, &
2244 & setparaccess = .false.)
2245 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2246#endif
2247#ifdef FOUR_DVAR
2248!
2249! 4D-Var assimilation parameters.
2250!
2251# ifdef ADJUST_STFLUX
2252 vinfo( 1)='Lstflux'
2253 vinfo( 2)='surface tracer fluxes adjustment switch'
2254 vinfo( 9)='.FALSE.'
2255 vinfo(10)='.TRUE.'
2256 status=def_var(ng, model, ncid, varid, nf90_int, &
2257 & 1, (/trcdim/), aval, vinfo, ncname, &
2258 & setparaccess = .false.)
2259 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2260# endif
2261# ifdef ADJUST_BOUNDARY
2262 vinfo( 1)='Lobc'
2263 vinfo( 2)='open boundary conditions adjustment switch'
2264 vinfo( 9)='.FALSE.'
2265 vinfo(10)='.TRUE.'
2266 status=def_var(ng, model, ncid, varid, nf90_int, &
2267 & 2, (/brydim, statedim/), aval, vinfo, ncname, &
2268 & setparaccess = .false.)
2269 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2270# endif
2271# ifndef I4DVAR_ANA_SENSITIVITY
2272 vinfo( 1)='LhessianEV'
2273 vinfo( 2)='switch to compute Hessian eigenvectors'
2274 vinfo( 9)='.FALSE.'
2275 vinfo(10)='.TRUE.'
2276 status=def_var(ng, model, ncid, varid, nf90_int, &
2277 & 1, (/0/), aval, vinfo, ncname, &
2278 & setparaccess = .false.)
2279 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2280
2281# ifdef WEAK_CONSTRAINT
2282 vinfo( 1)='LhotStart'
2283 vinfo( 2)='switch for hot start of subsequent outer loops'
2284 vinfo( 9)='.FALSE.'
2285 vinfo(10)='.TRUE.'
2286 status=def_var(ng, model, ncid, varid, nf90_int, &
2287 & 1, (/0/), aval, vinfo, ncname, &
2288 & setparaccess = .false.)
2289 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2290# endif
2291
2292 vinfo( 1)='Lprecond'
2293 vinfo( 2)='switch for conjugate gradient preconditioning'
2294 vinfo( 9)='.FALSE.'
2295 vinfo(10)='.TRUE.'
2296 status=def_var(ng, model, ncid, varid, nf90_int, &
2297 & 1, (/0/), aval, vinfo, ncname, &
2298 & setparaccess = .false.)
2299 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2300
2301 vinfo( 1)='Lritz'
2302 vinfo( 2)='switch for Ritz limited-memory preconditioning'
2303 vinfo( 9)='.FALSE.'
2304 vinfo(10)='.TRUE.'
2305 status=def_var(ng, model, ncid, varid, nf90_int, &
2306 & 1, (/0/), aval, vinfo, ncname, &
2307 & setparaccess = .false.)
2308 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2309
2310# ifdef WEAK_CONSTRAINT
2311 IF (lprecond.and.(nritzev.gt.0)) THEN
2312 vinfo( 1)='NritzEV'
2313 vinfo( 2)='number of preconditioning eigenpairs to use'
2314 status=def_var(ng, model, ncid, varid, nf90_int, &
2315 & 1, (/0/), aval, vinfo, ncname, &
2316 & setparaccess = .false.)
2317 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2318 END IF
2319# endif
2320# endif
2321# if defined POSTERIOR_EOFS && defined WEAK_CONSTRAINT
2322 vinfo( 1)='NpostI'
2323 vinfo( 2)='number of Lanczos iterations in posterior analysis'
2324 status=def_var(ng, model, ncid, varid, nf90_int, &
2325 & 1, (/0/), aval, vinfo, ncname, &
2326 & setparaccess = .false.)
2327 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2328# endif
2329# if defined ARRAY_MODES || \
2330 defined i4dvar_ana_sensitivity || \
2331 defined rbl4dvar_ana_sensitivity || \
2332 defined rbl4dvar_fct_sensitivity || \
2333 defined r4dvar_ana_sensitivity
2334 vinfo( 1)='Nimpact'
2335 vinfo( 2)='Observations impact/sensitivity outer loop to use'
2336 status=def_var(ng, model, ncid, varid, nf90_int, &
2337 & 1, (/0/), aval, vinfo, ncname, &
2338 & setparaccess = .false.)
2339 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2340# endif
2341# ifndef I4DVAR_ANA_SENSITIVITY
2342 vinfo( 1)='GradErr'
2343 vinfo( 2)='Upper bound on relative error of the gradient'
2344 status=def_var(ng, model, ncid, varid, nf_type, &
2345 & 1, (/0/), aval, vinfo, ncname, &
2346 & setparaccess = .false.)
2347 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2348
2349 vinfo( 1)='HevecErr'
2350 vinfo( 2)='Accuracy required for Hessian eigenvectors'
2351 status=def_var(ng, model, ncid, varid, nf_type, &
2352 & 1, (/0/), aval, vinfo, ncname, &
2353 & setparaccess = .false.)
2354 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2355# endif
2356
2357 vinfo( 1)='Nmethod'
2358 vinfo( 2)='background error covariance normalization method'
2359 vinfo( 9)='exact'
2360 vinfo(10)='randomization'
2361 status=def_var(ng, model, ncid, varid, nf90_int, &
2362 & 1, (/0/), aval, vinfo, ncname, &
2363 & setparaccess = .false.)
2364 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2365
2366 vinfo( 1)='Rscheme'
2367 vinfo( 2)='Random number generation scheme'
2368 vinfo( 9)='intrisic_randon_number'
2369 vinfo(10)='Gaussian_distributed_deviates'
2370 status=def_var(ng, model, ncid, varid, nf90_int, &
2371 & 1, (/0/), aval, vinfo, ncname, &
2372 & setparaccess = .false.)
2373 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2374
2375 vinfo( 1)='Nrandom'
2376 vinfo( 2)='number of randomization iterations'
2377 status=def_var(ng, model, ncid, varid, nf90_int, &
2378 & 1, (/0/), aval, vinfo, ncname, &
2379 & setparaccess = .false.)
2380 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2381
2382 vinfo( 1)='Hgamma'
2383 vinfo( 2)='initial conditions error covariance '// &
2384 & 'horizontal convolution time-step stability factor'
2385 status=def_var(ng, model, ncid, varid, nf_type, &
2386 & 1, (/0/), aval, vinfo, ncname, &
2387 & setparaccess = .false.)
2388 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2389
2390# ifdef WEAK_CONSTRAINT
2391 vinfo( 1)='HgammaM'
2392 vinfo( 2)='model error covariance '// &
2393 & 'horizontal convolution time-step stability factor'
2394 status=def_var(ng, model, ncid, varid, nf_type, &
2395 & 1, (/0/), aval, vinfo, ncname, &
2396 & setparaccess = .false.)
2397 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2398# endif
2399
2400# ifdef ADJUST_BOUNDARY
2401 vinfo( 1)='HgammaB'
2402 vinfo( 2)='open boundary conditions error covariance '// &
2403 & 'horizontal convolution time-step stability factor'
2404 status=def_var(ng, model, ncid, varid, nf_type, &
2405 & 1, (/0/), aval, vinfo, ncname, &
2406 & setparaccess = .false.)
2407 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2408# endif
2409
2410# ifdef ADJUST_STFLUX
2411 vinfo( 1)='HgammaF'
2412 vinfo( 2)='surface forcing error covariance '// &
2413 & 'horizontal convolution time-step stability factor'
2414 status=def_var(ng, model, ncid, varid, nf_type, &
2415 & 1, (/0/), aval, vinfo, ncname, &
2416 & setparaccess = .false.)
2417 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2418# endif
2419
2420# ifdef SOLVE3D
2421 vinfo( 1)='Vgamma'
2422 vinfo( 2)='initial conditions error covariance '// &
2423 & 'vertical convolution time-step stability factor'
2424 status=def_var(ng, model, ncid, varid, nf_type, &
2425 & 1, (/0/), aval, vinfo, ncname, &
2426 & setparaccess = .false.)
2427 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2428
2429# ifdef WEAK_CONSTRAINT
2430 vinfo( 1)='VgammaM'
2431 vinfo( 2)='model error covariance '// &
2432 & 'vertical convolution time-step stability factor'
2433 status=def_var(ng, model, ncid, varid, nf_type, &
2434 & 1, (/0/), aval, vinfo, ncname, &
2435 & setparaccess = .false.)
2436 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2437# endif
2438
2439# ifdef ADJUST_BOUNDARY
2440 vinfo( 1)='VgammaB'
2441 vinfo( 2)='open boundary conditions error covariance '// &
2442 & 'vertical convolution time-step stability factor'
2443 status=def_var(ng, model, ncid, varid, nf_type, &
2444 & 1, (/0/), aval, vinfo, ncname, &
2445 & setparaccess = .false.)
2446 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2447# endif
2448# endif
2449
2450 vinfo( 1)='Hdecay'
2451 vinfo( 2)='initial conditions error covariance '// &
2452 & 'horizontal decorrelation scale'
2453 vinfo( 3)='meter'
2454 status=def_var(ng, model, ncid, varid, nf_type, &
2455 & 1, (/statedim/), aval, vinfo, ncname, &
2456 & setparaccess = .false.)
2457 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2458
2459# ifdef SOLVE3D
2460 vinfo( 1)='Vdecay'
2461 vinfo( 2)='initial conditions error covariance '// &
2462 & 'vertical decorrelation scale'
2463 vinfo( 3)='meter'
2464 status=def_var(ng, model, ncid, varid, nf_type, &
2465 & 1, (/statedim/), aval, vinfo, ncname, &
2466 & setparaccess = .false.)
2467 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2468# endif
2469
2470 IF (nsa.eq.2) THEN
2471 vinfo( 1)='HdecayM'
2472 vinfo( 2)='model error covariance ' // &
2473 & 'horizontal decorrelation scale'
2474 vinfo( 3)='meter'
2475 status=def_var(ng, model, ncid, varid, nf_type, &
2476 & 1, (/statedim/), aval, vinfo, ncname, &
2477 & setparaccess = .false.)
2478 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2479
2480# ifdef SOLVE3D
2481 vinfo( 1)='VdecayM'
2482 vinfo( 2)='model error covariance '// &
2483 & 'vertical decorrelation scale'
2484 vinfo( 3)='meter'
2485 status=def_var(ng, model, ncid, varid, nf_type, &
2486 & 1, (/statedim/), aval, vinfo, ncname, &
2487 & setparaccess = .false.)
2488 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2489# endif
2490 END IF
2491
2492# ifdef ADJUST_BOUNDARY
2493 vinfo( 1)='HdecayB'
2494 vinfo( 2)='open boundary conditions error covariance '// &
2495 & 'horizontal decorrelation scale'
2496 vinfo( 3)='meter'
2497 status=def_var(ng, model, ncid, varid, nf_type, &
2498 & 2, (/statedim, brydim/), aval, vinfo, ncname, &
2499 & setparaccess = .false.)
2500 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2501
2502# ifdef SOLVE3D
2503 vinfo( 1)='VdecayB'
2504 vinfo( 2)='open boundary conditions error covariance '// &
2505 & 'vertical decorrelation scale'
2506 vinfo( 3)='meter'
2507 status=def_var(ng, model, ncid, varid, nf_type, &
2508 & 2, (/statedim, brydim/), aval, vinfo, ncname, &
2509 & setparaccess = .false.)
2510 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2511# endif
2512# endif
2513
2514# ifdef RPM_RELAXATION
2515 vinfo( 1)='tl_M2diff'
2516 vinfo( 2)='RPM 2D momentum diffusive relaxation coefficient'
2517 vinfo( 3)='meter2 second-1'
2518 status=def_var(ng, model, ncid, varid, nf_type, &
2519 & 1, (/0/), aval, vinfo, ncname, &
2520 & setparaccess = .false.)
2521 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2522
2523# ifdef SOLVE3D
2524 vinfo( 1)='tl_M3diff'
2525 vinfo( 2)='RPM 3D momentum diffusive relaxation coefficient'
2526 vinfo( 3)='meter2 second-1'
2527 status=def_var(ng, model, ncid, varid, nf_type, &
2528 & 1, (/0/), aval, vinfo, ncname, &
2529 & setparaccess = .false.)
2530 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2531
2532 vinfo( 1)='tl_Tdiff'
2533 vinfo( 2)='RPM tracers diffusive relaxation coefficients'
2534 vinfo( 3)='meter2 second-1'
2535 status=def_var(ng, model, ncid, varid, nf_type, &
2536 & 1, (/trcdim/), aval, vinfo, ncname, &
2537 & setparaccess = .false.)
2538 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2539# endif
2540# endif
2541
2542# ifdef BALANCE_OPERATOR
2543# ifdef ZETA_ELLIPTIC
2544 vinfo( 1)='Nbico'
2545 vinfo( 2)='number of iterations in SSH elliptic equation'
2546 status=def_var(ng, model, ncid, varid, nf90_int, &
2547 & 1, (/0/), aval, vinfo, ncname, &
2548 & setparaccess = .false.)
2549 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2550# endif
2551
2552 vinfo( 1)='Lbalance'
2553 vinfo( 2)='switches for state variables included as '// &
2554 'constraint in the error covariance balance operator'
2555 vinfo( 9)='.FALSE.'
2556 vinfo(10)='.TRUE.'
2557 status=def_var(ng, model, ncid, varid, nf90_int, &
2558 & 1, (/statedim/), aval, vinfo, ncname, &
2559 & setparaccess = .false.)
2560 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2561
2562 vinfo( 1)='LNM_flag'
2563 vinfo( 2)='balance operator level of no motion flag'
2564 vinfo( 9)='integrate from bottom to surface,'
2565 vinfo(10)='integrate from LNM_depth to surface'
2566 status=def_var(ng, model, ncid, varid, nf90_int, &
2567 & 1, (/0/), aval, vinfo, ncname, &
2568 & setparaccess = .false.)
2569 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2570
2571 vinfo( 1)='LNM_depth'
2572 vinfo( 2)='balance operator level of no motion depth'
2573 vinfo( 3)='meter'
2574 status=def_var(ng, model, ncid, varid, nf_type, &
2575 & 1, (/0/), aval, vinfo, ncname, &
2576 & setparaccess = .false.)
2577 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2578
2579 vinfo( 1)='dTdz_min'
2580 vinfo( 2)='minimum dT/dz value used in balaced salinity'
2581 vinfo( 3)='Celsius meter-1'
2582 status=def_var(ng, model, ncid, varid, nf_type, &
2583 & 1, (/0/), aval, vinfo, ncname, &
2584 & setparaccess = .false.)
2585 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2586
2587 vinfo( 1)='ml_depth'
2588 vinfo( 2)='mixed layer depth used in balanced salinity'
2589 vinfo( 3)='meter'
2590 status=def_var(ng, model, ncid, varid, nf_type, &
2591 & 1, (/0/), aval, vinfo, ncname, &
2592 & setparaccess = .false.)
2593 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2594# endif
2595
2596# ifdef STD_MODEL
2597!
2598! Background error covariance standard deviation modeling parameters.
2599!
2600 vinfo( 1)='Sigma_max'
2601 vinfo( 2)='background standard deviation, '// &
2602 & 'maximum value'
2603 vinfo( 3)='state variable units'
2604 status=def_var(ng, model, ncid, varid, nf_type, &
2605 & 1, (/statedim/), aval, vinfo, ncname, &
2606 & setparaccess = .false.)
2607 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2608
2609 vinfo( 1)='Sigma_ml'
2610 vinfo( 2)='background standard deviation, '// &
2611 & 'maximum value at mixed layer'
2612 vinfo( 3)='state variable units'
2613 status=def_var(ng, model, ncid, varid, nf_type, &
2614 & 1, (/statedim/), aval, vinfo, ncname, &
2615 & setparaccess = .false.)
2616 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2617
2618 vinfo( 1)='Sigma_do'
2619 vinfo( 2)='background standard deviation, '// &
2620 & 'maximum value in deep ocean'
2621 vinfo( 3)='state variable units'
2622 status=def_var(ng, model, ncid, varid, nf_type, &
2623 & 1, (/statedim/), aval, vinfo, ncname, &
2624 & setparaccess = .false.)
2625 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2626
2627 vinfo( 1)='Sigma_dz'
2628 vinfo( 2)='background standard deviation, '// &
2629 & 'profile vertical displacement'
2630 vinfo( 3)='meter'
2631 status=def_var(ng, model, ncid, varid, nf_type, &
2632 & 1, (/statedim/), aval, vinfo, ncname, &
2633 & setparaccess = .false.)
2634 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2635
2636# ifndef COMPUTE_MLD
2637 vinfo( 1)='mld_uniform'
2638 vinfo( 2)='constast mixed-layer depth value'
2639 vinfo( 3)='meter'
2640 status=def_var(ng, model, ncid, varid, nf_type, &
2641 & 1, (/0/), aval, vinfo, ncname, &
2642 & setparaccess = .false.)
2643 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2644# endif
2645# endif
2646#endif
2647
2648#if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
2649 defined opt_observations || defined sensitivity_4dvar || \
2650 defined so_semi
2651!
2652! Adjoint sensitivity parameters.
2653!
2654 vinfo( 1)='Lzeta'
2655 vinfo( 2)='adjoint sensitivity on free-surface'
2656 vinfo( 9)='off'
2657 vinfo(10)='on'
2658 status=def_var(ng, model, ncid, varid, nf90_int, &
2659 & 1, (/0/), aval, vinfo, ncname, &
2660 & setparaccess = .false.)
2661 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2662
2663 vinfo( 1)='Lubar'
2664 vinfo( 2)='adjoint sensitivity on 2D U-momentum'
2665 vinfo( 9)='off'
2666 vinfo(10)='on'
2667 status=def_var(ng, model, ncid, varid, nf90_int, &
2668 & 1, (/0/), aval, vinfo, ncname, &
2669 & setparaccess = .false.)
2670 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2671
2672 vinfo( 1)='Lvbar'
2673 vinfo( 2)='adjoint sensitivity on 2D V-momentum'
2674 vinfo( 9)='off'
2675 vinfo(10)='on'
2676 status=def_var(ng, model, ncid, varid, nf90_int, &
2677 & 1, (/0/), aval, vinfo, ncname, &
2678 & setparaccess = .false.)
2679 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2680
2681# ifdef SOLVE3D
2682 vinfo( 1)='Luvel'
2683 vinfo( 2)='adjoint sensitivity on 3D U-momentum'
2684 vinfo( 9)='off'
2685 vinfo(10)='on'
2686 status=def_var(ng, model, ncid, varid, nf90_int, &
2687 & 1, (/0/), aval, vinfo, ncname, &
2688 & setparaccess = .false.)
2689 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2690
2691 vinfo( 1)='Lvvel'
2692 vinfo( 2)='adjoint sensitivity on 3D V-momentum'
2693 vinfo( 9)='off'
2694 vinfo(10)='on'
2695 status=def_var(ng, model, ncid, varid, nf90_int, &
2696 & 1, (/0/), aval, vinfo, ncname, &
2697 & setparaccess = .false.)
2698 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2699
2700 vinfo( 1)='Ltracer'
2701 vinfo( 2)='adjoint sensitivity on tracer variables'
2702 vinfo( 9)='off'
2703 vinfo(10)='on'
2704 status=def_var(ng, model, ncid, varid, nf90_int, &
2705 & 1, (/trcdim/), aval, vinfo, ncname, &
2706 & setparaccess = .false.)
2707 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2708
2709 vinfo( 1)='KstrS'
2710 vinfo( 2)='deepest level for adjoint sensitivity analysis'
2711 status=def_var(ng, model, ncid, varid, nf90_int, &
2712 & 1, (/0/), aval, vinfo, ncname, &
2713 & setparaccess = .false.)
2714 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2715
2716 vinfo( 1)='KendS'
2717 vinfo( 2)='shallowest level for adjoint sensitivity analysis'
2718 status=def_var(ng, model, ncid, varid, nf90_int, &
2719 & 1, (/0/), aval, vinfo, ncname, &
2720 & setparaccess = .false.)
2721 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2722# endif
2723#endif
2724
2725#if defined FORCING_SV || defined SO_SEMI || defined STOCHASTIC_OPT
2726!
2727! Singular Forcing Vectors or Stochastic Optimals state switches.
2728!
2729 vinfo( 1)='Fzeta'
2730# ifdef FORCING_SV
2731 vinfo( 2)='forcing singular vectors for free-surface'
2732# else
2733 vinfo( 2)='stochastic optimals for free-surface'
2734# endif
2735 vinfo( 9)='off'
2736 vinfo(10)='on'
2737 status=def_var(ng, model, ncid, varid, nf90_int, &
2738 & 1, (/0/), aval, vinfo, ncname, &
2739 & setparaccess = .false.)
2740 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2741
2742# ifndef SOLVE3D
2743 vinfo( 1)='Fubar'
2744# ifdef FORCING_SV
2745 vinfo( 2)='forcing singular vectors for 2D U-momentum'
2746# else
2747 vinfo( 2)='stochastic optimals for 2D U-momentum'
2748# endif
2749 vinfo( 9)='off'
2750 vinfo(10)='on'
2751 status=def_var(ng, model, ncid, varid, nf90_int, &
2752 & 1, (/0/), aval, vinfo, ncname, &
2753 & setparaccess = .false.)
2754 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2755
2756 vinfo( 1)='Fvbar'
2757# ifdef FORCING_SV
2758 vinfo( 2)='forcing singular vectors for 2D V-momentum'
2759# else
2760 vinfo( 2)='stochastic optimals for 2D V-momentum'
2761# endif
2762 vinfo( 9)='off'
2763 vinfo(10)='on'
2764 status=def_var(ng, model, ncid, varid, nf90_int, &
2765 & 1, (/0/), aval, vinfo, ncname, &
2766 & setparaccess = .false.)
2767 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2768
2769# else
2770
2771 vinfo( 1)='Fuvel'
2772# ifdef FORCING_SV
2773 vinfo( 2)='forcing singular vectors for 3D U-momentum'
2774# else
2775 vinfo( 2)='stochastic optimals for 3D U-momentum'
2776# endif
2777 vinfo( 9)='off'
2778 vinfo(10)='on'
2779 status=def_var(ng, model, ncid, varid, nf90_int, &
2780 & 1, (/0/), aval, vinfo, ncname, &
2781 & setparaccess = .false.)
2782 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2783
2784 vinfo( 1)='Fvvel'
2785# ifdef FORCING_SV
2786 vinfo( 2)='forcing singular vectors for 3D V-momentum'
2787# else
2788 vinfo( 2)='stochastic optimals for 3D V-momentum'
2789# endif
2790 vinfo( 9)='off'
2791 vinfo(10)='on'
2792 status=def_var(ng, model, ncid, varid, nf90_int, &
2793 & 1, (/0/), aval, vinfo, ncname, &
2794 & setparaccess = .false.)
2795 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2796
2797 vinfo( 1)='Ftracer'
2798# ifdef FORCING_SV
2799 vinfo( 2)='forcing singular vectors for tracer variables'
2800# else
2801 vinfo( 2)='stochastic optimals for tracer variables'
2802# endif
2803 vinfo( 9)='off'
2804 vinfo(10)='on'
2805 status=def_var(ng, model, ncid, varid, nf90_int, &
2806 & 1, (/trcdim/), aval, vinfo, ncname, &
2807 & setparaccess = .false.)
2808 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2809# endif
2810
2811 vinfo( 1)='Fsustr'
2812# ifdef FORCING_SV
2813 vinfo( 2)='forcing singular vectors for surface U-stress'
2814# else
2815 vinfo( 2)='stochastic optimals for surface U-stress'
2816# endif
2817 vinfo( 9)='off'
2818 vinfo(10)='on'
2819 status=def_var(ng, model, ncid, varid, nf90_int, &
2820 & 1, (/0/), aval, vinfo, ncname, &
2821 & setparaccess = .false.)
2822 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2823
2824 vinfo( 1)='Fsvstr'
2825# ifdef FORCING_SV
2826 vinfo( 2)='forcing singular vectors for surface V-stress'
2827# else
2828 vinfo( 2)='stochastic optimals for surface V-stress'
2829# endif
2830 vinfo( 9)='off'
2831 vinfo(10)='on'
2832 status=def_var(ng, model, ncid, varid, nf90_int, &
2833 & 1, (/0/), aval, vinfo, ncname, &
2834 & setparaccess = .false.)
2835 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2836
2837# ifdef SOLVE3D
2838 vinfo( 1)='Fstflx'
2839# ifdef FORCING_SV
2840 vinfo( 2)='forcing singular vectors for surface tracer flux'
2841# else
2842 vinfo( 2)='stochastic optimals for surface tracer flux'
2843# endif
2844 vinfo( 9)='off'
2845 vinfo(10)='on'
2846 status=def_var(ng, model, ncid, varid, nf90_int, &
2847 & 1, (/trcdim/), aval, vinfo, ncname, &
2848 & setparaccess = .false.)
2849 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2850# endif
2851#endif
2852
2853#ifdef SO_SEMI
2854!
2855! Define Stochatic optimals parameters.
2856!
2857# ifndef SO_SEMI_WHITE
2858 vinfo( 1)='SO_decay'
2859 vinfo( 2)='red noise stochastic optimals time decorrelation'
2860 vinfo( 3)='day'
2861 status=def_var(ng, model, ncid, varid, nf_type, &
2862 & 1, (/0/), aval, vinfo, ncname, &
2863 & setparaccess = .false.)
2864 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2865# endif
2866
2867 vinfo( 1)='SO_trace'
2868 vinfo( 2)='trace of stochastic optimals matrix'
2869 status=def_var(ng, model, ncid, varid, nf_type, &
2870 & 1, (/0/), aval, vinfo, ncname, &
2871 & setparaccess = .false.)
2872 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2873
2874 vinfo( 1)='SOsdev_zeta'
2875 vinfo( 2)='stochastic optimals scale, free-surface'
2876 status=def_var(ng, model, ncid, varid, nf_type, &
2877 & 1, (/0/), aval, vinfo, ncname, &
2878 & setparaccess = .false.)
2879 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2880
2881# ifndef SOLVE3D
2882 vinfo( 1)='SOsdev_ubar'
2883 vinfo( 2)='stochastic optimals scale, 2D U-momentum'
2884 status=def_var(ng, model, ncid, varid, nf_type, &
2885 & 1, (/0/), aval, vinfo, ncname, &
2886 & setparaccess = .false.)
2887 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2888
2889 vinfo( 1)='SOsdev_vbar'
2890 vinfo( 2)='stochastic optimals scale, 2D V-momentum'
2891 status=def_var(ng, model, ncid, varid, nf_type, &
2892 & 1, (/0/), aval, vinfo, ncname, &
2893 & setparaccess = .false.)
2894 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2895
2896# else
2897
2898 vinfo( 1)='SOsdev_uvel'
2899 vinfo( 2)='stochastic optimals scale, 3D U-momentum'
2900 status=def_var(ng, model, ncid, varid, nf_type, &
2901 & 1, (/0/), aval, vinfo, ncname, &
2902 & setparaccess = .false.)
2903 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2904
2905 vinfo( 1)='SOsdev_vvel'
2906 vinfo( 2)='stochastic optimals scale, 3D V-momentum'
2907 status=def_var(ng, model, ncid, varid, nf_type, &
2908 & 1, (/0/), aval, vinfo, ncname, &
2909 & setparaccess = .false.)
2910 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2911
2912 vinfo( 1)='SOsdev_tracer'
2913 vinfo( 2)='stochastic optimals scale, tracer variables'
2914 status=def_var(ng, model, ncid, varid, nf_type, &
2915 & 1, (/trcdim/), aval, vinfo, ncname, &
2916 & setparaccess = .false.)
2917 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2918# endif
2919
2920 vinfo( 1)='SOsdev_sustr'
2921 vinfo( 2)='stochastic optimals scale, surface U-stress'
2922 status=def_var(ng, model, ncid, varid, nf_type, &
2923 & 1, (/0/), aval, vinfo, ncname, &
2924 & setparaccess = .false.)
2925 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2926
2927 vinfo( 1)='SOsdev_svstr'
2928 vinfo( 2)='stochastic optimals scale, surface V-stress'
2929 status=def_var(ng, model, ncid, varid, nf_type, &
2930 & 1, (/0/), aval, vinfo, ncname, &
2931 & setparaccess = .false.)
2932 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2933
2934# ifdef SOLVE3D
2935 vinfo( 1)='SOsdev_stflx'
2936 vinfo( 2)='stochastic optimals scale, surface tracer flux'
2937 status=def_var(ng, model, ncid, varid, nf_type, &
2938 & 1, (/trcdim/), aval, vinfo, ncname, &
2939 & setparaccess = .false.)
2940 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2941# endif
2942#endif
2943
2944#if defined BIOLOGY && defined SOLVE3D
2945# if defined BIO_FENNEL
2946# include <fennel_def.h>
2947# elif defined ECOSIM
2948# include <ecosim_def.h>
2949# elif defined HYPOXIA_SRM
2950# include <hypoxia_srm_def.h>
2951# elif defined NEMURO
2952# include <nemuro_def.h>
2953# elif defined NPZD_FRANKS
2954# include <npzd_Franks_def.h>
2955# elif defined NPZD_IRON
2956# include <npzd_iron_def.h>
2957# elif defined NPZD_POWELL
2958# include <npzd_Powell_def.h>
2959# elif defined RED_TIDE
2960# include <red_tide_def.h>
2961# endif
2962#endif
2963
2964#if defined FLOATS && defined FLOAT_BIOLOGY
2965# if defined FLOAT_OYSTER
2966# include <oyster_floats_def.h>
2967# endif
2968#endif
2969
2970#ifdef SEDIMENT
2971# include <sediment_def.h>
2972#endif
2973!
2974!-----------------------------------------------------------------------
2975! Define grid variables.
2976!-----------------------------------------------------------------------
2977!
2978! Grid type switch: Spherical or Cartesian. Writing characters in
2979! parallel I/O is extremely inefficient. It is better to write
2980! this as an integer switch: 0=Cartesian, 1=spherical.
2981!
2982 vinfo( 1)='spherical'
2983 vinfo( 2)='grid type logical switch'
2984 vinfo( 9)='Cartesian'
2985 vinfo(10)='spherical'
2986 status=def_var(ng, model, ncid, varid, nf90_int, &
2987 & 1, (/0/), aval, vinfo, ncname, &
2988 & setparaccess = .false.)
2989 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2990!
2991! Domain Length.
2992!
2993 vinfo( 1)='xl'
2994 vinfo( 2)='domain length in the XI-direction'
2995 vinfo( 3)='meter'
2996 status=def_var(ng, model, ncid, varid, nf_type, &
2997 & 1, (/0/), aval, vinfo, ncname, &
2998 & setparaccess = .false.)
2999 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3000
3001 vinfo( 1)='el'
3002 vinfo( 2)='domain length in the ETA-direction'
3003 vinfo( 3)='meter'
3004 status=def_var(ng, model, ncid, varid, nf_type, &
3005 & 1, (/0/), aval, vinfo, ncname, &
3006 & setparaccess = .false.)
3007 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3008#ifdef SOLVE3D
3009!
3010! S-coordinate parameters.
3011!
3012 vinfo( 1)='Vtransform'
3013 vinfo( 2)='vertical terrain-following transformation equation'
3014 status=def_var(ng, model, ncid, varid, nf90_int, &
3015 & 1, (/0/), aval, vinfo, ncname, &
3016 & setparaccess = .false.)
3017 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3018
3019 vinfo( 1)='Vstretching'
3020 vinfo( 2)='vertical terrain-following stretching function'
3021 status=def_var(ng, model, ncid, varid, nf90_int, &
3022 & 1, (/0/), aval, vinfo, ncname, &
3023 & setparaccess = .false.)
3024 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3025
3026 vinfo( 1)='theta_s'
3027 vinfo( 2)='S-coordinate surface control parameter'
3028 status=def_var(ng, model, ncid, varid, nf_tout, &
3029 & 1, (/0/), aval, vinfo, ncname, &
3030 & setparaccess = .false.)
3031 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3032
3033 vinfo( 1)='theta_b'
3034 vinfo( 2)='S-coordinate bottom control parameter'
3035 status=def_var(ng, model, ncid, varid, nf_tout, &
3036 & 1, (/0/), aval, vinfo, ncname, &
3037 & setparaccess = .false.)
3038 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3039
3040 vinfo( 1)='Tcline'
3041 vinfo( 2)='S-coordinate surface/bottom layer width'
3042 vinfo( 3)='meter'
3043 status=def_var(ng, model, ncid, varid, nf_tout, &
3044 & 1, (/0/), aval, vinfo, ncname, &
3045 & setparaccess = .false.)
3046 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3047
3048 vinfo( 1)='hc'
3049 vinfo( 2)='S-coordinate parameter, critical depth'
3050 vinfo( 3)='meter'
3051 status=def_var(ng, model, ncid, varid, nf_tout, &
3052 & 1, (/0/), aval, vinfo, ncname, &
3053 & setparaccess = .false.)
3054 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3055!
3056! SGRID conventions for staggered data on structured grids.
3057!
3058 vinfo( 1)='grid'
3059 status=def_var(ng, model, ncid, varid, nf90_int, &
3060 & 1, (/0/), aval, vinfo, ncname, &
3061 & setparaccess = .false.)
3062 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3063!
3064! S-coordinate non-dimensional independent variable at RHO-points.
3065!
3066 vinfo( 1)='s_rho'
3067 vinfo( 2)='S-coordinate at RHO-points'
3068 vinfo( 5)='valid_min'
3069 vinfo( 6)='valid_max'
3070 IF (vtransform(ng).eq.1) THEN
3071 vinfo(21)='ocean_s_coordinate_g1'
3072 ELSE IF (vtransform(ng).eq.2) THEN
3073 vinfo(21)='ocean_s_coordinate_g2'
3074 END IF
3075# if defined SEDIMENT && defined SED_MORPH
3076 vinfo(23)='s: s_rho C: Cs_r eta: zeta depth: bath depth_c: hc'
3077# else
3078 vinfo(23)='s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc'
3079# endif
3080 vinfo(25)='up'
3081 aval(2)=-1.0_r8
3082 aval(3)=0.0_r8
3083 status=def_var(ng, model, ncid, varid, nf_tout, &
3084 & 1, (/srdim/), aval, vinfo, ncname, &
3085 & setparaccess = .false.)
3086 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3087!
3088! S-coordinate non-dimensional independent variable at W-points.
3089!
3090 vinfo( 1)='s_w'
3091 vinfo( 2)='S-coordinate at W-points'
3092 vinfo( 5)='valid_min'
3093 vinfo( 6)='valid_max'
3094 vinfo(21)='ocean_s_coordinate'
3095 IF (vtransform(ng).eq.1) THEN
3096 vinfo(21)='ocean_s_coordinate_g1'
3097 ELSE IF (vtransform(ng).eq.2) THEN
3098 vinfo(21)='ocean_s_coordinate_g2'
3099 END IF
3100# if defined SEDIMENT && defined SED_MORPH
3101 vinfo(23)='s: s_w C: Cs_w eta: zeta depth: bath depth_c: hc'
3102# else
3103 vinfo(23)='s: s_w C: Cs_w eta: zeta depth: h depth_c: hc'
3104# endif
3105 vinfo(25)='up'
3106 aval(2)=-1.0_r8
3107 aval(3)=0.0_r8
3108 status=def_var(ng, model, ncid, varid, nf_tout, &
3109 & 1, (/swdim/), aval, vinfo, ncname, &
3110 & setparaccess = .false.)
3111 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3112!
3113! S-coordinate non-dimensional stretching curves at RHO-points.
3114!
3115 vinfo( 1)='Cs_r'
3116 vinfo( 2)='S-coordinate stretching curves at RHO-points'
3117 vinfo( 5)='valid_min'
3118 vinfo( 6)='valid_max'
3119 aval(2)=-1.0_r8
3120 aval(3)=0.0_r8
3121 status=def_var(ng, model, ncid, varid, nf_tout, &
3122 & 1, (/srdim/), aval, vinfo, ncname, &
3123 & setparaccess = .false.)
3124 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3125!
3126! S-coordinate non-dimensional stretching curves at W-points.
3127!
3128 vinfo( 1)='Cs_w'
3129 vinfo( 2)='S-coordinate stretching curves at W-points'
3130 vinfo( 5)='valid_min'
3131 vinfo( 6)='valid_max'
3132 aval(2)=-1.0_r8
3133 aval(3)=0.0_r8
3134 status=def_var(ng, model, ncid, varid, nf_tout, &
3135 & 1, (/swdim/), aval, vinfo, ncname, &
3136 & setparaccess = .false.)
3137 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3138#endif
3139!
3140! User generic parameters.
3141!
3142 IF (nuser.gt.0) THEN
3143 vinfo( 1)='user'
3144 vinfo( 2)='user generic parameters'
3145 vinfo(24)='_FillValue'
3146 aval(6)=spval
3147 status=def_var(ng, model, ncid, varid, nf_type, &
3148 & 1, (/usrdim/), aval, vinfo, ncname, &
3149 & setparaccess = .false.)
3150 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3151 END IF
3152#ifdef STATIONS
3153!
3154! Station positions.
3155!
3156 IF (ncid.eq.sta(ng)%ncid) THEN
3157 vinfo( 1)='Ipos'
3158 vinfo( 2)='stations I-direction positions'
3159 status=def_var(ng, model, ncid, varid, nf_type, &
3160 & 1, (/stadim/), aval, vinfo, ncname, &
3161 & setparaccess = .false.)
3162 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3163
3164 vinfo( 1)='Jpos'
3165 vinfo( 2)='stations J-direction positions'
3166 status=def_var(ng, model, ncid, varid, nf_type, &
3167 & 1, (/stadim/), aval, vinfo, ncname, &
3168 & setparaccess = .false.)
3169 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3170 END IF
3171#endif
3172#ifdef NO_WRITE_GRID
3173 IF (ncid.eq.sta(ng)%ncid) THEN
3174#else
3175 IF (ncid.ne.flt(ng)%ncid) THEN
3176#endif
3177#if !(defined SED_MORPH && defined SEDIMENT)
3178!
3179! Bathymetry.
3180!
3181 vinfo( 1)=vname(1,idtopo)
3182 vinfo( 2)=vname(2,idtopo)
3183 vinfo( 3)=vname(3,idtopo)
3184 vinfo(14)=vname(4,idtopo)
3185 vinfo(21)=vname(6,idtopo)
3186 vinfo(22)='coordinates'
3187 aval(5)=real(iinfo(1,idtopo,ng),r8)
3188 IF (ncid.eq.sta(ng)%ncid) THEN
3189 status=def_var(ng, model, ncid, varid, nf_type, &
3190 & 1, (/stadim/), aval, vinfo, ncname)
3191 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3192 ELSE
3193 status=def_var(ng, model, ncid, varid, nf_type, &
3194 & 2, t2dgrd, aval, vinfo, ncname)
3195 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3196 END IF
3197#endif
3198!
3199! Coriolis Parameter.
3200!
3201 IF (ncid.ne.sta(ng)%ncid) THEN
3202 vinfo( 1)=vname(1,idfcor)
3203 vinfo( 2)=vname(2,idfcor)
3204 vinfo( 3)=vname(3,idfcor)
3205 vinfo(14)=vname(4,idfcor)
3206 vinfo(21)=vname(6,idfcor)
3207 vinfo(22)='coordinates'
3208 aval(5)=real(iinfo(1,idfcor,ng),r8)
3209 status=def_var(ng, model, ncid, varid, nf_type, &
3210 & 2, t2dgrd, aval, vinfo, ncname)
3211 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3212 END IF
3213!
3214! Curvilinear coordinate metrics.
3215!
3216 IF (ncid.ne.sta(ng)%ncid) THEN
3217 vinfo( 1)=vname(1,idpmdx)
3218 vinfo( 2)=vname(2,idpmdx)
3219 vinfo( 3)=vname(3,idpmdx)
3220 vinfo(14)=vname(4,idpmdx)
3221 vinfo(21)=vname(6,idpmdx)
3222 vinfo(22)='coordinates'
3223 aval(5)=real(iinfo(1,idpmdx,ng),r8)
3224 status=def_var(ng, model, ncid, varid, nf_type, &
3225 & 2, t2dgrd, aval, vinfo, ncname)
3226 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3227!
3228 vinfo( 1)=vname(1,idpndy)
3229 vinfo( 2)=vname(2,idpndy)
3230 vinfo( 3)=vname(3,idpndy)
3231 vinfo(14)=vname(4,idpndy)
3232 vinfo(21)=vname(6,idpndy)
3233 vinfo(22)='coordinates'
3234 aval(5)=real(iinfo(1,idpndy,ng),r8)
3235 status=def_var(ng, model, ncid, varid, nf_type, &
3236 & 2, t2dgrd, aval, vinfo, ncname)
3237 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3238 END IF
3239!
3240! Grid coordinates of RHO-points.
3241!
3242 IF (spherical) THEN
3243 vinfo( 1)=vname(1,idlonr)
3244 vinfo( 2)=vname(2,idlonr)
3245 vinfo( 3)=vname(3,idlonr)
3246 vinfo(14)=vname(4,idlonr)
3247 vinfo(21)=vname(6,idlonr)
3248 IF (ncid.eq.sta(ng)%ncid) THEN
3249 status=def_var(ng, model, ncid, varid, nf_type, &
3250 & 1, (/stadim/), aval, vinfo, ncname)
3251 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3252 ELSE
3253 status=def_var(ng, model, ncid, varid, nf_type, &
3254 & 2, t2dgrd, aval, vinfo, ncname)
3255 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3256 END IF
3257!
3258 vinfo( 1)=vname(1,idlatr)
3259 vinfo( 2)=vname(2,idlatr)
3260 vinfo( 3)=vname(3,idlatr)
3261 vinfo(14)=vname(4,idlatr)
3262 vinfo(21)=vname(6,idlatr)
3263 IF (ncid.eq.sta(ng)%ncid) THEN
3264 status=def_var(ng, model, ncid, varid, nf_type, &
3265 & 1, (/stadim/), aval, vinfo, ncname)
3266 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3267 ELSE
3268 status=def_var(ng, model, ncid, varid, nf_type, &
3269 & 2, t2dgrd, aval, vinfo, ncname)
3270 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3271 END IF
3272 ELSE
3273 vinfo( 1)=vname(1,idxgrr)
3274 vinfo( 2)=vname(2,idxgrr)
3275 vinfo( 3)=vname(3,idxgrr)
3276 vinfo(14)=vname(4,idxgrr)
3277 vinfo(21)=vname(6,idxgrr)
3278 IF (ncid.eq.sta(ng)%ncid) THEN
3279 status=def_var(ng, model, ncid, varid, nf_type, &
3280 & 1, (/stadim/), aval, vinfo, ncname)
3281 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3282 ELSE
3283 status=def_var(ng, model, ncid, varid, nf_type, &
3284 & 2, t2dgrd, aval, vinfo, ncname)
3285 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3286 END IF
3287!
3288 vinfo( 1)=vname(1,idygrr)
3289 vinfo( 2)=vname(2,idygrr)
3290 vinfo( 3)=vname(3,idygrr)
3291 vinfo(14)=vname(4,idygrr)
3292 vinfo(21)=vname(6,idygrr)
3293 IF (ncid.eq.sta(ng)%ncid) THEN
3294 status=def_var(ng, model, ncid, varid, nf_type, &
3295 & 1, (/stadim/), aval, vinfo, ncname)
3296 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3297 ELSE
3298 status=def_var(ng, model, ncid, varid, nf_type, &
3299 & 2, t2dgrd, aval, vinfo, ncname)
3300 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3301 END IF
3302 END IF
3303!
3304! Grid coordinates of U-points.
3305!
3306 IF (spherical) THEN
3307 vinfo( 1)=vname(1,idlonu)
3308 vinfo( 2)=vname(2,idlonu)
3309 vinfo( 3)=vname(3,idlonu)
3310 vinfo(14)=vname(4,idlonu)
3311 vinfo(21)=vname(6,idlonu)
3312 IF (ncid.ne.sta(ng)%ncid) THEN
3313 status=def_var(ng, model, ncid, varid, nf_type, &
3314 & 2, u2dgrd, aval, vinfo, ncname)
3315 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3316 END IF
3317!
3318 vinfo( 1)=vname(1,idlatu)
3319 vinfo( 2)=vname(2,idlatu)
3320 vinfo( 3)=vname(3,idlatu)
3321 vinfo(14)=vname(4,idlatu)
3322 vinfo(21)=vname(6,idlatu)
3323 IF (ncid.ne.sta(ng)%ncid) THEN
3324 status=def_var(ng, model, ncid, varid, nf_type, &
3325 & 2, u2dgrd, aval, vinfo, ncname)
3326 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3327 END IF
3328 ELSE
3329 vinfo( 1)=vname(1,idxgru)
3330 vinfo( 2)=vname(2,idxgru)
3331 vinfo( 3)=vname(3,idxgru)
3332 vinfo(14)=vname(4,idxgru)
3333 vinfo(21)=vname(6,idxgru)
3334 IF (ncid.ne.sta(ng)%ncid) THEN
3335 status=def_var(ng, model, ncid, varid, nf_type, &
3336 & 2, u2dgrd, aval, vinfo, ncname)
3337 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3338 END IF
3339!
3340 vinfo( 1)=vname(1,idygru)
3341 vinfo( 2)=vname(2,idygru)
3342 vinfo( 3)=vname(3,idygru)
3343 vinfo(14)=vname(4,idygru)
3344 vinfo(21)=vname(6,idygru)
3345 IF (ncid.ne.sta(ng)%ncid) THEN
3346 status=def_var(ng, model, ncid, varid, nf_type, &
3347 & 2, u2dgrd, aval, vinfo, ncname)
3348 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3349 END IF
3350 END IF
3351!
3352! Grid coordinates of V-points.
3353!
3354 IF (spherical) THEN
3355 vinfo( 1)=vname(1,idlonv)
3356 vinfo( 2)=vname(2,idlonv)
3357 vinfo( 3)=vname(3,idlonv)
3358 vinfo(14)=vname(4,idlonv)
3359 vinfo(21)=vname(6,idlonv)
3360 IF (ncid.ne.sta(ng)%ncid) THEN
3361 status=def_var(ng, model, ncid, varid, nf_type, &
3362 & 2, v2dgrd, aval, vinfo, ncname)
3363 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3364 END IF
3365!
3366 vinfo( 1)=vname(1,idlatv)
3367 vinfo( 2)=vname(2,idlatv)
3368 vinfo( 3)=vname(3,idlatv)
3369 vinfo(14)=vname(4,idlatv)
3370 vinfo(21)=vname(6,idlatv)
3371 IF (ncid.ne.sta(ng)%ncid) THEN
3372 status=def_var(ng, model, ncid, varid, nf_type, &
3373 & 2, v2dgrd, aval, vinfo, ncname)
3374 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3375 END IF
3376 ELSE
3377 vinfo( 1)=vname(1,idxgrv)
3378 vinfo( 2)=vname(2,idxgrv)
3379 vinfo( 3)=vname(3,idxgrv)
3380 vinfo(14)=vname(4,idxgrv)
3381 vinfo(21)=vname(6,idxgrv)
3382 IF (ncid.ne.sta(ng)%ncid) THEN
3383 status=def_var(ng, model, ncid, varid, nf_type, &
3384 & 2, v2dgrd, aval, vinfo, ncname)
3385 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3386 END IF
3387!
3388 vinfo( 1)=vname(1,idygrv)
3389 vinfo( 2)=vname(2,idygrv)
3390 vinfo( 3)=vname(3,idygrv)
3391 vinfo(14)=vname(4,idygrv)
3392 vinfo(21)=vname(6,idygrv)
3393 IF (ncid.ne.sta(ng)%ncid) THEN
3394 status=def_var(ng, model, ncid, varid, nf_type, &
3395 & 2, v2dgrd, aval, vinfo, ncname)
3396 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3397 END IF
3398 END IF
3399!
3400! Grid coordinates of PSI-points.
3401!
3402 IF (spherical) THEN
3403 vinfo( 1)=vname(1,idlonp)
3404 vinfo( 2)=vname(2,idlonp)
3405 vinfo( 3)=vname(3,idlonp)
3406 vinfo(14)=vname(4,idlonp)
3407 vinfo(21)=vname(6,idlonp)
3408 IF (ncid.ne.sta(ng)%ncid) THEN
3409 status=def_var(ng, model, ncid, varid, nf_type, &
3410 & 2, p2dgrd, aval, vinfo, ncname)
3411 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3412 END IF
3413!
3414 vinfo( 1)=vname(1,idlatp)
3415 vinfo( 2)=vname(2,idlatp)
3416 vinfo( 3)=vname(3,idlatp)
3417 vinfo(14)=vname(4,idlatp)
3418 vinfo(21)=vname(6,idlatp)
3419 IF (ncid.ne.sta(ng)%ncid) THEN
3420 status=def_var(ng, model, ncid, varid, nf_type, &
3421 & 2, p2dgrd, aval, vinfo, ncname)
3422 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3423 END IF
3424 ELSE
3425 vinfo( 1)=vname(1,idxgrp)
3426 vinfo( 2)=vname(2,idxgrp)
3427 vinfo( 3)=vname(3,idxgrp)
3428 vinfo(14)=vname(4,idxgrp)
3429 vinfo(21)=vname(6,idxgrp)
3430 IF (ncid.ne.sta(ng)%ncid) THEN
3431 status=def_var(ng, model, ncid, varid, nf_type, &
3432 & 2, p2dgrd, aval, vinfo, ncname)
3433 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3434 END IF
3435!
3436 vinfo( 1)=vname(1,idygrp)
3437 vinfo( 2)=vname(2,idygrp)
3438 vinfo( 3)=vname(3,idygrp)
3439 vinfo(14)=vname(4,idygrp)
3440 vinfo(21)=vname(6,idygrp)
3441 IF (ncid.ne.sta(ng)%ncid) THEN
3442 status=def_var(ng, model, ncid, varid, nf_type, &
3443 & 2, p2dgrd, aval, vinfo, ncname)
3444 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3445 END IF
3446 END IF
3447
3448#ifdef CURVGRID
3449!
3450! Angle between XI-axis and EAST at RHO-points.
3451!
3452 vinfo( 1)=vname(1,idangr)
3453 vinfo( 2)=vname(2,idangr)
3454 vinfo( 3)=vname(3,idangr)
3455 vinfo(14)=vname(4,idangr)
3456 vinfo(21)=vname(6,idangr)
3457 vinfo(22)='coordinates'
3458 aval(5)=real(iinfo(1,idangr,ng),r8)
3459 IF (ncid.eq.sta(ng)%ncid) THEN
3460 status=def_var(ng, model, ncid, varid, nf_type, &
3461 & 1, (/stadim/), aval, vinfo, ncname)
3462 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3463 ELSE
3464 status=def_var(ng, model, ncid, varid, nf_type, &
3465 & 2, t2dgrd, aval, vinfo, ncname)
3466 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3467 END IF
3468#endif
3469#ifdef MASKING
3470!
3471! Masking fields at RHO-, U-, V-points, and PSI-points.
3472!
3473 IF (ncid.ne.sta(ng)%ncid) THEN
3474 vinfo( 1)=vname(1,idmskr)
3475 vinfo( 2)=vname(2,idmskr)
3476 vinfo( 9)='land'
3477 vinfo(10)='water'
3478 vinfo(21)=vname(6,idmskr)
3479 vinfo(22)='coordinates'
3480 aval(5)=real(iinfo(1,idmskr,ng),r8)
3481 status=def_var(ng, model, ncid, varid, nf_type, &
3482 & 2, t2dgrd, aval, vinfo, ncname)
3483 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3484!
3485 vinfo( 1)=vname(1,idmsku)
3486 vinfo( 2)=vname(2,idmsku)
3487 vinfo( 9)='land'
3488 vinfo(10)='water'
3489 vinfo(21)=vname(6,idmsku)
3490 vinfo(22)='coordinates'
3491 aval(5)=real(iinfo(1,idmsku,ng),r8)
3492 status=def_var(ng, model, ncid, varid, nf_type, &
3493 & 2, u2dgrd, aval, vinfo, ncname)
3494 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3495!
3496 vinfo( 1)=vname(1,idmskv)
3497 vinfo( 2)=vname(2,idmskv)
3498 vinfo( 9)='land'
3499 vinfo(10)='water'
3500 vinfo(21)=vname(6,idmskv)
3501 vinfo(22)='coordinates'
3502 aval(5)=real(iinfo(1,idmskv,ng),r8)
3503 status=def_var(ng, model, ncid, varid, nf_type, &
3504 & 2, v2dgrd, aval, vinfo, ncname)
3505 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3506!
3507 vinfo( 1)=vname(1,idmskp)
3508 vinfo( 2)=vname(2,idmskp)
3509 vinfo( 9)='land'
3510 vinfo(10)='water'
3511 vinfo(21)=vname(6,idmskp)
3512 vinfo(22)='coordinates'
3513 aval(5)=real(iinfo(1,idmskp,ng),r8)
3514 status=def_var(ng, model, ncid, varid, nf_type, &
3515 & 2, p2dgrd, aval, vinfo, ncname)
3516 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3517 END IF
3518#endif
3519#if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
3520 defined opt_observations || defined sensitivity_4dvar || \
3521 defined so_semi
3522!
3523! Adjoint sensitivity spatial scope mask at RHO-, U-, and V-points.
3524!
3525 IF (ncid.ne.sta(ng)%ncid) THEN
3526 vinfo( 1)=vname(1,idscor)
3527 vinfo( 2)=vname(2,idscor)
3528 vinfo( 9)='inactive'
3529 vinfo(10)='active'
3530 vinfo(21)=vname(6,idscor)
3531 vinfo(22)='coordinates'
3532 aval(5)=real(iinfo(1,idscor,ng),r8)
3533 status=def_var(ng, model, ncid, varid, nf_type, &
3534 & 2, t2dgrd, aval, vinfo, ncname)
3535 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3536!
3537 vinfo( 1)=vname(1,idscou)
3538 vinfo( 2)=vname(2,idscou)
3539 vinfo( 9)='inactive'
3540 vinfo(10)='active'
3541 vinfo(21)=vname(6,idscou)
3542 vinfo(22)='coordinates'
3543 aval(5)=real(iinfo(1,idscou,ng),r8)
3544 status=def_var(ng, model, ncid, varid, nf_type, &
3545 & 2, u2dgrd, aval, vinfo, ncname)
3546 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3547!
3548 vinfo( 1)=vname(1,idscov)
3549 vinfo( 2)=vname(2,idscov)
3550 vinfo( 9)='inactive'
3551 vinfo(10)='active'
3552 vinfo(21)=vname(6,idscov)
3553 vinfo(22)='coordinates'
3554 aval(5)=real(iinfo(1,idscov,ng),r8)
3555 status=def_var(ng, model, ncid, varid, nf_type, &
3556 & 2, v2dgrd, aval, vinfo, ncname)
3557 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3558 END IF
3559#endif
3560#ifdef UV_DRAG_GRID
3561!
3562! Spatially varying bottom friction parameter.
3563!
3564 IF (ncid.ne.sta(ng)%ncid) THEN
3565# if defined UV_LOGDRAG || defined BBL_MODEL
3566 vinfo( 1)=vname(1,idzobl)
3567 vinfo( 2)=vname(2,idzobl)
3568 vinfo( 3)=vname(3,idzobl)
3569 vinfo(14)=vname(4,idzobl)
3570 vinfo(21)=vname(6,idzobl)
3571 vinfo(22)='coordinates'
3572 aval(5)=real(iinfo(1,idzobl,ng),r8)
3573 status=def_var(ng, model, ncid, varid, nf_type, &
3574 & 2, t2dgrd, aval, vinfo, ncname)
3575 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3576# endif
3577# ifdef UV_LDRAG
3578 vinfo( 1)=vname(1,idragl)
3579 vinfo( 2)=vname(2,idragl)
3580 vinfo( 3)=vname(3,idragl)
3581 vinfo(14)=vname(4,idragl)
3582 vinfo(21)=vname(6,idragl)
3583 vinfo(22)='coordinates'
3584 aval(5)=real(iinfo(1,idragl,ng),r8)
3585 status=def_var(ng, model, ncid, varid, nf_type, &
3586 & 2, t2dgrd, aval, vinfo, ncname)
3587 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3588# endif
3589# ifdef UV_QDRAG
3590 vinfo( 1)=vname(1,idragq)
3591 vinfo( 2)=vname(2,idragq)
3592 vinfo( 3)=vname(3,idragq)
3593 vinfo(14)=vname(4,idragq)
3594 vinfo(21)=vname(6,idragq)
3595 vinfo(22)='coordinates'
3596 aval(5)=real(iinfo(1,idragq,ng),r8)
3597 status=def_var(ng, model, ncid, varid, nf_type, &
3598 & 2, t2dgrd, aval, vinfo, ncname)
3599 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3600# endif
3601 END IF
3602#endif
3603 END IF
3604!
3605 10 FORMAT (i0,'x',i0)
3606 20 FORMAT (/,' DEF_INFO_NF90 - error while creating global', &
3607 & ' attribute: ',a,/,17x,a)
3608 30 FORMAT (a,i2.2)
3609!
3610 RETURN
integer, parameter nf_tout
Definition mod_netcdf.F:207
integer, parameter nf_type
Definition mod_netcdf.F:198

References mod_param::ad_hadvection, mod_param::ad_lbc, mod_param::ad_vadvection, mod_iounits::adm, mod_iounits::ads, mod_ncparam::ananame, mod_iounits::aparnam, mod_iounits::avg, mod_iounits::bparnam, mod_iounits::bry, mod_iounits::clm, mod_strings::coptions, mod_ncparam::date_str, mod_iounits::dia, mod_iounits::err, mod_scalars::exit_flag, mod_iounits::fcta, mod_iounits::fctb, mod_iounits::flt, strings_mod::founderror(), mod_iounits::fposnam, mod_iounits::frc, mod_iounits::fwd, mod_ncparam::git_rev, mod_ncparam::git_url, mod_iounits::grd, mod_iounits::grx, mod_iounits::gst, mod_param::hadvection, mod_iounits::har, mod_strings::hdir, mod_strings::hfile, mod_iounits::his, mod_ncparam::history, mod_iounits::hss, mod_iounits::iad, mod_ncparam::idangr, mod_ncparam::idfcor, mod_ncparam::idlatp, mod_ncparam::idlatr, mod_ncparam::idlatu, mod_ncparam::idlatv, mod_ncparam::idlonp, mod_ncparam::idlonr, mod_ncparam::idlonu, mod_ncparam::idlonv, mod_ncparam::idmskp, mod_ncparam::idmskr, mod_ncparam::idmsku, mod_ncparam::idmskv, mod_ncparam::idpmdx, mod_ncparam::idpndy, mod_ncparam::idragl, mod_ncparam::idragq, mod_ncparam::idscor, mod_ncparam::idscou, mod_ncparam::idscov, mod_ncparam::idsvar, mod_ncparam::idtopo, mod_ncparam::idxgrp, mod_ncparam::idxgrr, mod_ncparam::idxgru, mod_ncparam::idxgrv, mod_ncparam::idygrp, mod_ncparam::idygrr, mod_ncparam::idygru, mod_ncparam::idygrv, mod_ncparam::idzobl, mod_ncparam::iinfo, mod_iounits::iname, mod_iounits::ini, mod_iounits::ioerror, mod_iounits::itl, strings_mod::join_string(), mod_param::lbc, mod_scalars::lclimatology, mod_scalars::lcyclerst, mod_iounits::lcz, mod_scalars::ldefhis, mod_scalars::ldefxtr, mod_scalars::lnudging, mod_fourdvar::lprecond, mod_scalars::lprocesstides, mod_scalars::ltracersrc, mod_scalars::luvsrc, mod_scalars::lwsrc, mod_iounits::lze, mod_parallel::master, mod_strings::my_cpu, mod_strings::my_fc, mod_strings::my_fflags, mod_strings::my_fort, mod_strings::my_os, mod_iounits::nbcfiles, mod_iounits::nclmfiles, mod_scalars::ndefavg, mod_scalars::ndefdia, mod_scalars::ndefhis, mod_scalars::ndefxtr, mod_netcdf::nf_tout, mod_netcdf::nf_type, mod_iounits::nffiles, mod_scalars::noerror, mod_fourdvar::nritzev, mod_iounits::nrm, mod_param::nsa, mod_fourdvar::nstatevar, mod_param::ntilei, mod_param::ntilej, mod_iounits::nud, mod_scalars::nudgingcoeff, mod_scalars::nuser, mod_scalars::obcdata, mod_iounits::obs, mod_iounits::oifa, mod_iounits::oifb, mod_parallel::outthread, mod_iounits::qck, mod_scalars::rclock, mod_strings::rdir, mod_iounits::rst, mod_iounits::sca, mod_iounits::sct, mod_iounits::sourcefile, mod_iounits::spa, mod_scalars::spherical, mod_iounits::sposnam, mod_iounits::spt, mod_scalars::spval, mod_iounits::ssf, mod_iounits::sta, mod_iounits::stdout, mod_ncparam::svn_rev, mod_ncparam::svn_url, mod_iounits::tide, mod_strings::title, mod_iounits::tlf, mod_iounits::tlm, mod_param::vadvection, mod_iounits::varname, mod_ncparam::version, mod_ncparam::vname, mod_scalars::vtransform, and mod_iounits::xtr.

Here is the call graph for this function:

◆ def_info_pio()

subroutine def_info_mod::def_info::def_info_pio ( integer, intent(in) ng,
integer, intent(in) model,
type (file_desc_t), intent(in) piofile,
character (*), intent(in) ncname,
integer, dimension(ndimid), intent(in) dimids )

Definition at line 3616 of file def_info.F.

3617!***********************************************************************
3618! !
3619! This routine defines information variables for the requested NetCDF !
3620! file using the NCAR Parallel-IO library. !
3621! !
3622! On Input: !
3623! !
3624! ng Nested grid number (integer) !
3625! model Calling model identifier (integer) !
3626! pioFile PIO file descriptor structure, TYPE(file_desc_t) !
3627! pioFile%fh file handler !
3628! pioFile%iosystem IO system descriptor (struct) !
3629! ncname PIO filename (character) !
3630! DimIDs PIO dimensions IDs (integer vector of size nDimID) !
3631! !
3632! On Output: !
3633! !
3634! exit_flag Error flag (integer) stored in MOD_SCALARS !
3635! ioerror NetCDF return code (integer) stored in MOD_IOUNITS !
3636! !
3637!***********************************************************************
3638!
3639 USE mod_pio_netcdf
3640!
3641! Imported variable declarations.
3642!
3643 integer, intent(in) :: ng, model
3644 integer, intent(in) :: DimIDs(nDimID)
3645!
3646 character (*), intent(in) :: ncname
3647!
3648 TYPE (file_desc_t), intent(in) :: pioFile
3649!
3650! Local variable declarations.
3651!
3652 integer, parameter :: Natt = 25
3653
3654 integer :: brydim, FileH, i, ie, is, j, lstr
3655 integer :: srdim, stadim, status, swdim, trcdim, usrdim
3656# ifdef SEDIMENT
3657 integer :: seddim
3658# endif
3659# ifdef FOUR_DVAR
3660 integer :: statedim
3661# endif
3662# if defined BIOLOGY && defined ECOSIM
3663 integer :: bacdim, domdim, fecdim, lightdim, phydim
3664
3665 integer :: biodim(2)
3666# endif
3667# if !defined PARALLEL_IO && defined DISTRIBUTE
3668 integer :: ibuffer(2)
3669# endif
3670 integer :: p2dgrd(2), tbrydim(2)
3671 integer :: t2dgrd(3), u2dgrd(3), v2dgrd(3)
3672!
3673 real(r8) :: Aval(6)
3674!
3675 character (len=11 ) :: bryatt, clmatt, frcatt
3676 character (len=50 ) :: tiling
3677 character (len=80 ) :: type
3678# ifdef FOUR_DVAR
3679 character (len=512) :: state_vector
3680# endif
3681# ifdef BIOLOGY
3682 character (len=512) :: bio_file
3683# endif
3684 character (len=4096) :: string
3685 character (len=MaxLen) :: Vinfo(Natt)
3686
3687 character (len=*), parameter :: MyFile = &
3688 & __FILE__//", def_info_pio"
3689!
3690 TYPE (Var_desc_t) :: pioVar
3691!
3692 sourcefile=myfile
3693!
3694!-----------------------------------------------------------------------
3695! Set dimension variables.
3696!-----------------------------------------------------------------------
3697!
3698 p2dgrd(1)=dimids(4)
3699 p2dgrd(2)=dimids(8)
3700 t2dgrd(1)=dimids(1)
3701 t2dgrd(2)=dimids(5)
3702 u2dgrd(1)=dimids(2)
3703 u2dgrd(2)=dimids(6)
3704 v2dgrd(1)=dimids(3)
3705 v2dgrd(2)=dimids(7)
3706 srdim=dimids(9)
3707 swdim=dimids(10)
3708 trcdim=dimids(11)
3709# ifdef SEDIMENT
3710 seddim=dimids(32)
3711# endif
3712 stadim=dimids(13)
3713 brydim=dimids(14)
3714# ifdef FOUR_DVAR
3715 statedim=dimids(29)
3716# endif
3717 tbrydim(1)=dimids(11)
3718 tbrydim(2)=dimids(14)
3719# if defined ECOSIM && defined SOLVE3D
3720 phydim=dimids(25)
3721 bacdim=dimids(26)
3722 domdim=dimids(27)
3723 fecdim=dimids(28)
3724 biodim(1)=phydim
3725 biodim(2)=fecdim
3726 lightdim=dimids(33)
3727# endif
3728!
3729! Get NetCDF file handle from descriptor.
3730!
3731 fileh=abs(piofile%fh)
3732!
3733! Set dimension for generic user parameters.
3734!
3735 IF ((nuser.gt.0).and.(fileh.ne.abs(gst(ng)%pioFile%fh))) THEN
3736 status=def_dim(ng, model, piofile, ncname, 'Nuser', &
3737 & nuser, usrdim)
3738 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
3739 END IF
3740!
3741! Initialize local information variable arrays.
3742!
3743 DO i=1,natt
3744 DO j=1,len(vinfo(1))
3745 vinfo(i)(j:j)=' '
3746 END DO
3747 END DO
3748 DO i=1,6
3749 aval(i)=0.0_r8
3750 END DO
3751!
3752!-----------------------------------------------------------------------
3753! Define global attributes.
3754!-----------------------------------------------------------------------
3755!
3756! Define history global attribute.
3757!
3758 IF (len_trim(date_str).gt.0) THEN
3759 WRITE (history,'(a,1x,a,", ",a)') 'ROMS, Version', &
3760 & trim( version), &
3761 & trim(date_str)
3762 ELSE
3763 WRITE (history,'(a,1x,a)') 'ROMS, Version', &
3764 & trim(version)
3765 END IF
3766!
3767! Set tile decomposition global attribute.
3768!
3769 WRITE (tiling,10) ntilei(ng), ntilej(ng)
3770!
3771! Define file name global attribute.
3772!
3773 IF (exit_flag.eq.noerror) THEN
3774 status=pio_put_att(piofile, pio_global, 'file', &
3775 & trim(ncname))
3776 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3777 IF (master) WRITE (stdout,20) 'file', trim(ncname)
3778 exit_flag=3
3779 ioerror=status
3780 END IF
3781 END IF
3782
3783# ifndef DEBUGGING
3784!
3785! Define NetCDF format type.
3786!
3787 IF (exit_flag.eq.noerror) THEN
3788# ifdef HDF5
3789 status=pio_put_att(piofile, pio_global, 'format', &
3790 & 'netCDF-4/HDF5 file')
3791# else
3792 status=pio_put_att(piofile, pio_global, 'format', &
3793 & 'netCDF-3 64bit offset file')
3794# endif
3795 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3796 IF (master) WRITE (stdout,20) 'format', trim(ncname)
3797 exit_flag=3
3798 ioerror=status
3799 END IF
3800 END IF
3801
3802# endif
3803!
3804! Define file climate and forecast metadata convention global
3805! attribute.
3806!
3807 type='CF-1.4, SGRID-0.3'
3808 IF (exit_flag.eq.noerror) THEN
3809 status=pio_put_att(piofile, pio_global, 'Conventions', &
3810 & trim(type))
3811 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3812 IF (master) WRITE (stdout,20) 'Conventions', trim(ncname)
3813 exit_flag=3
3814 ioerror=status
3815 END IF
3816 END IF
3817!
3818! Define file type global attribute.
3819!
3820 IF (fileh.eq.abs(adm(ng)%pioFile%fh)) THEN
3821 type='ROMS adjoint history file'
3822 ELSE IF (fileh.eq.abs(avg(ng)%pioFile%fh)) THEN
3823# if defined AD_AVERAGES && defined ADJOINT
3824 type='ROMS adjoint model averages file'
3825# elif defined RP_AVERAGES && defined TL_IOMS
3826 type='ROMS representer model averages file'
3827# elif defined TL_AVERAGES && defined TANGENT
3828 type='ROMS tangent linear model averages file'
3829# else
3830 type='ROMS nonlinear model averages file'
3831# endif
3832 ELSE IF (fileh.eq.abs(dia(ng)%pioFile%fh)) THEN
3833 type='ROMS diagnostics file'
3834 ELSE IF (fileh.eq.abs(flt(ng)%pioFile%fh)) THEN
3835 type='ROMS floats file'
3836 ELSE IF (fileh.eq.abs(err(ng)%pioFile%fh)) THEN
3837 type='ROMS posterior analysis error covariance matrix'
3838 ELSE IF (fileh.eq.abs(gst(ng)%pioFile%fh)) THEN
3839 type='ROMS GST check pointing restart file'
3840 ELSE IF (fileh.eq.abs(har(ng)%pioFile%fh)) THEN
3841 type='ROMS Least-squared Detiding Harmonics file'
3842 ELSE IF (fileh.eq.abs(hss(ng)%pioFile%fh)) THEN
3843 type='ROMS 4D-Var Hessian eigenvectors file'
3844 ELSE IF (fileh.eq.abs(his(ng)%pioFile%fh)) THEN
3845 type='ROMS history file'
3846 ELSE IF (fileh.eq.abs(itl(ng)%pioFile%fh)) THEN
3847 type='ROMS tangent linear model initial file'
3848 ELSE IF (fileh.eq.abs(lcz(ng)%pioFile%fh)) THEN
3849 type='ROMS 4D-Var Lanczos vectors file'
3850 ELSE IF (fileh.eq.abs(lze(ng)%pioFile%fh)) THEN
3851 type='ROMS 4D-Var Evolved Lanczos vectors file'
3852 ELSE IF (fileh.eq.abs(nrm(1,ng)%pioFile%fh)) THEN
3853 type='ROMS initial conditions error covariance norm file'
3854 ELSE IF (fileh.eq.abs(nrm(2,ng)%pioFile%fh)) THEN
3855 type='ROMS model error covariance norm file'
3856 ELSE IF (fileh.eq.abs(nrm(3,ng)%pioFile%fh)) THEN
3857 type='ROMS boundary conditions error covariance norm file'
3858 ELSE IF (fileh.eq.abs(nrm(4,ng)%pioFile%fh)) THEN
3859 type='ROMS surface forcing error covariance norm file'
3860 ELSE IF (fileh.eq.abs(qck(ng)%pioFile%fh)) THEN
3861 type='ROMS quicksave file'
3862 ELSE IF (fileh.eq.abs(rst(ng)%pioFile%fh)) THEN
3863 type='ROMS restart file'
3864# ifdef SP4DVAR
3865 ELSE IF (fileh.eq.abs(sca(ng)%pioFile%fh)) THEN
3866 type='ROMS AD scratch file'
3867 ELSE IF (fileh.eq.abs(sct(ng)%pioFile%fh)) THEN
3868 type='ROMS TL scratch file'
3869 ELSE IF (fileh.eq.abs(spa(ng)%pioFile%fh)) THEN
3870 type='ROMS AD Arnoldi file'
3871 ELSE IF (fileh.eq.abs(spt(ng)%pioFile%fh)) THEN
3872 type='ROMS TL Arnoldi file'
3873# endif
3874 ELSE IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
3875 type='ROMS station file'
3876 ELSE IF (fileh.eq.abs(tlf(ng)%pioFile%fh)) THEN
3877 type='ROMS tangent linear impulse forcing file'
3878 ELSE IF (fileh.eq.abs(tlm(ng)%pioFile%fh)) THEN
3879 type='ROMS tangent linear history file'
3880 END IF
3881 IF (exit_flag.eq.noerror) THEN
3882 status=pio_put_att(piofile, pio_global, 'type', &
3883 & trim(type))
3884 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3885 IF (master) WRITE (stdout,20) 'type', trim(ncname)
3886 exit_flag=3
3887 ioerror=status
3888 END IF
3889 END IF
3890
3891# ifdef FOUR_DVAR
3892!
3893! Set state vector variables.
3894!
3895 is=1
3896 state_vector=' '
3897 DO i=1,nstatevar(ng)
3898 lstr=len_trim(vname(1,idsvar(i)))
3899 ie=is+lstr
3900 state_vector(is:ie)=trim(vname(1,idsvar(i)))//', '
3901 is=ie+2
3902 END DO
3903# endif
3904!
3905! Define other global attributes to NetCDF file.
3906!
3907 IF (exit_flag.eq.noerror) THEN
3908 status=pio_put_att(piofile, pio_global, 'title', &
3909 & trim(title))
3910 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3911 IF (master) WRITE (stdout,20) 'title', trim(ncname)
3912 exit_flag=3
3913 ioerror=status
3914 END IF
3915 END IF
3916
3917 IF (exit_flag.eq.noerror) THEN
3918 status=pio_put_att(piofile, pio_global, 'var_info', &
3919 & trim(varname))
3920 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3921 IF (master) WRITE (stdout,20) 'var_info', trim(ncname)
3922 exit_flag=3
3923 ioerror=status
3924 END IF
3925 END IF
3926
3927# ifdef FOUR_DVAR
3928 IF (exit_flag.eq.noerror) THEN
3929 lstr=len_trim(state_vector)-1
3930 status=pio_put_att(piofile, pio_global, 'state_vector', &
3931 & state_vector(1:lstr))
3932 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3933 IF (master) WRITE (stdout,20) 'state_vector', trim(ncname)
3934 exit_flag=3
3935 ioerror=status
3936 END IF
3937 END IF
3938# endif
3939
3940# ifdef PROPAGATOR
3941 IF (exit_flag.eq.noerror) THEN
3942 status=pio_put_att(piofile, pio_global, 'gst_file', &
3943 & trim(gst(ng)%name))
3944 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3945 IF (master) WRITE (stdout,20) 'gst_file', trim(ncname)
3946 exit_flag=3
3947 ioerror=status
3948 END IF
3949 END IF
3950# endif
3951
3952 IF (exit_flag.eq.noerror) THEN
3953 status=pio_put_att(piofile, pio_global, 'rst_file', &
3954 & trim(rst(ng)%name))
3955 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3956 IF (master) WRITE (stdout,20) 'rst_file', trim(ncname)
3957 exit_flag=3
3958 ioerror=status
3959 END IF
3960 END IF
3961
3962 IF (exit_flag.eq.noerror) THEN
3963 IF (ldefhis(ng)) THEN
3964 IF (ndefhis(ng).gt.0) THEN
3965 status=pio_put_att(piofile, pio_global, 'his_base', &
3966 & trim(his(ng)%base))
3967 ELSE
3968 status=pio_put_att(piofile, pio_global, 'his_file', &
3969 & trim(his(ng)%name))
3970 END IF
3971 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3972 IF (master) WRITE (stdout,20) 'his_file', trim(ncname)
3973 exit_flag=3
3974 ioerror=status
3975 END IF
3976 END IF
3977 END IF
3978
3979# if defined AVERAGES || \
3980 (defined ad_averages && defined adjoint) || \
3981 (defined rp_averages && defined tl_ioms) || \
3982 (defined tl_averages && defined tangent)
3983 IF (exit_flag.eq.noerror) THEN
3984 IF (ndefavg(ng).gt.0) THEN
3985 status=pio_put_att(piofile, pio_global, 'avg_base', &
3986 & trim(avg(ng)%base))
3987 ELSE
3988 status=pio_put_att(piofile, pio_global, 'avg_file', &
3989 & trim(avg(ng)%name))
3990 END IF
3991 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
3992 IF (master) WRITE (stdout,20) 'avg_file', trim(ncname)
3993 exit_flag=3
3994 ioerror=status
3995 END IF
3996 END IF
3997# endif
3998
3999# if defined AVERAGES && defined AVERAGES_DETIDE && \
4000 (defined ssh_tides || defined uv_tides)
4001 IF (exit_flag.eq.noerror) THEN
4002 status=pio_put_att(piofile, pio_global, 'har_file', &
4003 & trim(har(ng)%name))
4004 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4005 IF (master) WRITE (stdout,20) 'har_file', trim(ncname)
4006 exit_flag=3
4007 ioerror=status
4008 END IF
4009 END IF
4010# endif
4011
4012# ifdef DIAGNOSTICS
4013 IF (exit_flag.eq.noerror) THEN
4014 IF (ndefdia(ng).gt.0) THEN
4015 status=pio_put_att(piofile,pio_global, 'dia_base', &
4016 & trim(dia(ng)%base))
4017 ELSE
4018 status=pio_put_att(piofile, pio_global, 'dia_file', &
4019 & trim(dia(ng)%name))
4020 END IF
4021 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4022 IF (master) WRITE (stdout,20) 'dia_file', trim(ncname)
4023 exit_flag=3
4024 ioerror=status
4025 END IF
4026 END IF
4027# endif
4028
4029# if defined WEAK_CONSTRAINT && \
4030 (defined posterior_error_f || defined posterior_error_i)
4031 IF (exit_flag.eq.noerror) THEN
4032 status=pio_put_att(piofile, pio_global, 'err_file', &
4033 & trim(err(ng)%name))
4034 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4035 IF (master) WRITE (stdout,20) 'err_file', trim(ncname)
4036 exit_flag=3
4037 ioerror=status
4038 END IF
4039 END IF
4040# endif
4041
4042# ifdef STATIONS
4043 IF (exit_flag.eq.noerror) THEN
4044 status=pio_put_att(piofile, pio_global, 'sta_file', &
4045 & trim(sta(ng)%name))
4046 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4047 IF (master) WRITE (stdout,20) 'sta_file', trim(ncname)
4048 exit_flag=3
4049 ioerror=status
4050 END IF
4051 END IF
4052# endif
4053
4054# ifdef FLOATS
4055 IF (exit_flag.eq.noerror) THEN
4056 status=pio_put_att(piofile, pio_global, 'flt_file', &
4057 & trim(flt(ng)%name))
4058 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4059 IF (master) WRITE (stdout,20) 'flt_file', trim(ncname)
4060 exit_flag=3
4061 ioerror=status
4062 END IF
4063 END IF
4064# endif
4065
4066# ifndef ANA_GRID
4067 IF (exit_flag.eq.noerror) THEN
4068 status=pio_put_att(piofile, pio_global, 'grd_file', &
4069 & trim(grd(ng)%name))
4070 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4071 IF (master) WRITE (stdout,20) 'grd_file', trim(ncname)
4072 exit_flag=3
4073 ioerror=status
4074 END IF
4075 END IF
4076# endif
4077
4078# ifdef INI_FILE
4079# ifdef NONLINEAR
4080 IF (exit_flag.eq.noerror) THEN
4081 status=pio_put_att(piofile, pio_global, 'ini_file', &
4082 & trim(ini(ng)%name))
4083 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4084 IF (master) WRITE (stdout,20) 'ini_file', trim(ncname)
4085 exit_flag=3
4086 ioerror=status
4087 END IF
4088 END IF
4089# endif
4090
4091# ifdef TANGENT
4092 IF (exit_flag.eq.noerror) THEN
4093 status=pio_put_att(piofile,pio_global, 'itl_file', &
4094 & trim(itl(ng)%name))
4095 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4096 IF (master) WRITE (stdout,20) 'itl_file', trim(ncname)
4097 exit_flag=3
4098 ioerror=status
4099 END IF
4100 END IF
4101# endif
4102
4103# if defined ADJOINT && \
4104 !(defined AD_SENSITIVITY || defined FOUR_DVAR || \
4105 defined i4dvar_ana_sensitivity || defined opt_observations || \
4106 defined sensitivity_4dvar || defined so_semi || \
4107 defined stochastic_opt )
4108 IF (exit_flag.eq.noerror) THEN
4109 status=pio_put_att(piofile, pio_global, 'iad_file', &
4110 & trim(iad(ng)%name))
4111 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4112 IF (master) WRITE (stdout,20) 'iad_file', trim(ncname)
4113 exit_flag=3
4114 ioerror=status
4115 END IF
4116 END IF
4117# endif
4118# endif
4119
4120# if defined I4DVAR || defined OPT_OBSERVATIONS || \
4121 defined weak_constraint
4122 IF (exit_flag.eq.noerror) THEN
4123 status=pio_put_att(piofile, pio_global, 'nrm_file', &
4124 & trim(nrm(1,ng)%name))
4125 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4126 IF (master) WRITE (stdout,20) 'nrm_file', trim(ncname)
4127 exit_flag=3
4128 ioerror=status
4129 END IF
4130 END IF
4131# endif
4132
4133# ifdef WEAK_CONSTRAINT
4134 IF (exit_flag.eq.noerror) THEN
4135 status=pio_put_att(piofile, pio_global, 'tlf_file', &
4136 & trim(tlf(ng)%name))
4137 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4138 IF (master) WRITE (stdout,20) 'tlf_file', trim(ncname)
4139 exit_flag=3
4140 ioerror=status
4141 END IF
4142 END IF
4143# endif
4144
4145# ifdef FOUR_DVAR
4146 IF (exit_flag.eq.noerror) THEN
4147 status=pio_put_att(piofile, pio_global, 'obs_file', &
4148 & trim(obs(ng)%name))
4149 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4150 IF (master) WRITE (stdout,20) 'obs_file', trim(ncname)
4151 exit_flag=3
4152 ioerror=status
4153 END IF
4154 END IF
4155# endif
4156
4157# ifdef RBL4DVAR_FCT_SENSITIVITY
4158 IF (exit_flag.eq.noerror) THEN
4159 status=pio_put_att(piofile, pio_global, 'fcta_file', &
4160 & trim(fcta(ng)%name))
4161 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4162 IF (master) WRITE (stdout,20) 'fcta_file', trim(ncname)
4163 exit_flag=3
4164 ioerror=status
4165 END IF
4166 END IF
4167
4168 IF (exit_flag.eq.noerror) THEN
4169 status=pio_put_att(piofile, pio_global, 'fctb_file', &
4170 & trim(fctb(ng)%name))
4171 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4172 IF (master) WRITE (stdout,20) 'fctb_file', trim(ncname)
4173 exit_flag=3
4174 ioerror=status
4175 END IF
4176 END IF
4177
4178# ifdef OBS_SPACE
4179 IF (exit_flag.eq.noerror) THEN
4180 status=pio_put_att(piofile, pio_global, 'oifa_file', &
4181 & trim(oifa(ng)%name))
4182 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4183 IF (master) WRITE (stdout,20) 'oifa_file', trim(ncname)
4184 exit_flag=3
4185 ioerror=status
4186 END IF
4187 END IF
4188
4189 IF (exit_flag.eq.noerror) THEN
4190 status=pio_put_att(piofile, pio_global, 'oifb_file', &
4191 & trim(oifb(ng)%name))
4192 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4193 IF (master) WRITE (stdout,20) 'oifb_file', trim(ncname)
4194 exit_flag=3
4195 ioerror=status
4196 END IF
4197 END IF
4198# else
4199 IF (exit_flag.eq.noerror) THEN
4200 status=pio_put_att(piofile, pio_global, 'foia_file', &
4201 & trim(foia(ng)%name))
4202 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4203 IF (master) WRITE (stdout,20) 'foia_file', trim(ncname)
4204 exit_flag=3
4205 ioerror=status
4206 END IF
4207 END IF
4208
4209 IF (exit_flag.eq.noerror) THEN
4210 status=pio_put_att(piofile, pio_global, 'foib_file', &
4211 & trim(foib(ng)%name))
4212 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4213 IF (master) WRITE (stdout,20) 'foib_file', trim(ncname)
4214 exit_flag=3
4215 ioerror=status
4216 END IF
4217 END IF
4218# endif
4219# endif
4220
4221# ifndef ANA_PSOURCE
4222 IF (exit_flag.eq.noerror) THEN
4223 IF (luvsrc(ng).or.lwsrc(ng).or.(any(ltracersrc(:,ng)))) THEN
4224 status=pio_put_att(piofile, pio_global, 'river_file', &
4225 & trim(ssf(ng)%name))
4226 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4227 IF (master) WRITE (stdout,20) 'river_file', trim(ncname)
4228 exit_flag=3
4229 ioerror=status
4230 END IF
4231 END IF
4232 END IF
4233# endif
4234
4235# if defined SSH_TIDES || defined UV_TIDES
4236 IF (exit_flag.eq.noerror) THEN
4237 IF (lprocesstides(ng)) THEN
4238 status=pio_put_att(piofile, pio_global, 'tide_file', &
4239 & trim(tide(ng)%name))
4240 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4241 IF (master) WRITE (stdout,20) 'tide_file', trim(ncname)
4242 exit_flag=3
4243 ioerror=status
4244 END IF
4245 END IF
4246 END IF
4247# endif
4248
4249# ifdef FRC_FILE
4250 IF (exit_flag.eq.noerror) THEN
4251 DO i=1,nffiles(ng)
4252 CALL join_string (frc(i,ng)%files, frc(i,ng)%Nfiles, &
4253 & string, lstr)
4254 WRITE (frcatt,30) 'frc_file_', i
4255 status=pio_put_att(piofile, pio_global, frcatt, &
4256 & string(1:lstr))
4257 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4258 IF (master) WRITE (stdout,20) trim(frcatt), trim(ncname)
4259 exit_flag=3
4260 ioerror=status
4261 EXIT
4262 END IF
4263 END DO
4264 END IF
4265# endif
4266
4267 IF (obcdata(ng)) THEN
4268 DO i=1,nbcfiles(ng)
4269 IF (exit_flag.eq.noerror) THEN
4270 CALL join_string (bry(i,ng)%files, bry(i,ng)%Nfiles, &
4271 & string, lstr)
4272 WRITE (bryatt,30) 'bry_file_', i
4273 status=pio_put_att(piofile, pio_global, bryatt, &
4274 & string(1:lstr))
4275 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4276 IF (master) WRITE (stdout,20) trim(bryatt), trim(ncname)
4277 exit_flag=3
4278 ioerror=status
4279 END IF
4280 END IF
4281 END DO
4282 END IF
4283
4284# if !(defined ANA_SSH || defined ANA_M2CLIMA || \
4285 defined ana_m3clima || defined ana_tclima)
4286 IF (lclimatology(ng)) THEN
4287 DO i=1,nclmfiles(ng)
4288 IF (exit_flag.eq.noerror) THEN
4289 CALL join_string (clm(i,ng)%files, clm(i,ng)%Nfiles, &
4290 & string, lstr)
4291 WRITE (clmatt,30) 'clm_file_', i
4292 status=pio_put_att(piofile, pio_global, clmatt, &
4293 & string(1:lstr))
4294 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4295 IF (master) WRITE (stdout,20) trim(clmatt), trim(ncname)
4296 exit_flag=3
4297 ioerror=status
4298 END IF
4299 END IF
4300 END DO
4301 END IF
4302# endif
4303
4304# ifndef ANA_NUDGCOEF
4305 IF (lnudging(ng)) THEN
4306 IF (exit_flag.eq.noerror) THEN
4307 status=pio_put_att(piofile, pio_global, 'nud_file', &
4308 & trim(nud(ng)%name))
4309 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4310 IF (master) WRITE (stdout,20) 'nud_file', trim(ncname)
4311 exit_flag=3
4312 ioerror=status
4313 END IF
4314 END IF
4315 END IF
4316# endif
4317
4318# ifdef FORWARD_READ
4319 IF (exit_flag.eq.noerror) THEN
4320 status=pio_put_att(piofile, pio_global, 'fwd_file', &
4321 & trim(fwd(ng)%name))
4322 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4323 IF (master) WRITE (stdout,20) 'fwd_file', trim(ncname)
4324 exit_flag=3
4325 ioerror=status
4326 END IF
4327 END IF
4328# endif
4329
4330# if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
4331 defined opt_observations || defined sensitivity_4dvar || \
4332 defined so_semi
4333 IF (exit_flag.eq.noerror) THEN
4334 status=pio_put_att(piofile, pio_global, 'ads_file', &
4335 & trim(ads(ng)%name))
4336 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4337 IF (master) WRITE (stdout,20) 'ads_file', trim(ncname)
4338 exit_flag=3
4339 ioerror=status
4340 END IF
4341 END IF
4342# endif
4343
4344# if !defined DEBUGGING && defined DISTRIBUTE
4345 IF (exit_flag.eq.noerror) THEN
4346 status=pio_put_att(piofile, pio_global, 'script_file', &
4347 & trim(iname))
4348 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4349 IF (master) WRITE (stdout,20) 'script_file', trim(ncname)
4350 exit_flag=3
4351 ioerror=status
4352 END IF
4353 END IF
4354# endif
4355
4356# ifdef FOUR_DVAR
4357 IF (exit_flag.eq.noerror) THEN
4358 status=pio_put_att(piofile, pio_global, 'apar_file', &
4359 & trim(aparnam))
4360 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4361 IF (master) WRITE (stdout,20) 'apar_file', trim(ncname)
4362 exit_flag=3
4363 ioerror=status
4364 END IF
4365 END IF
4366# endif
4367
4368# ifdef BIOLOGY
4369 IF (exit_flag.eq.noerror) THEN
4370 status=pio_put_att(piofile, pio_global, 'bpar_file', &
4371 & trim(bparnam))
4372 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4373 IF (master) WRITE (stdout,20) 'bpar_file', trim(ncname)
4374 exit_flag=3
4375 ioerror=status
4376 END IF
4377 END IF
4378# endif
4379
4380# ifdef FLOATS
4381 IF (exit_flag.eq.noerror) THEN
4382 status=pio_put_att(piofile, pio_global, 'fpos_file', &
4383 & trim(fposnam))
4384 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4385 IF (master) WRITE (stdout,20) 'fpos_file', trim(ncname)
4386 exit_flag=3
4387 ioerror=status
4388 END IF
4389 END IF
4390# endif
4391
4392# ifdef STATIONS
4393 IF (exit_flag.eq.noerror) THEN
4394 status=pio_put_att(piofile, pio_global, 'spos_file', &
4395 & trim(sposnam))
4396 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4397 IF (master) WRITE (stdout,20) 'spos_file', trim(ncname)
4398 exit_flag=3
4399 ioerror=status
4400 END IF
4401 END IF
4402# endif
4403
4404# ifndef DEBUGGING
4405# ifdef SOLVE3D
4406!
4407! NLM tracer advection scheme.
4408!
4409 IF (exit_flag.eq.noerror) THEN
4410 CALL tadv_putatt (ng, piofile, ncname, 'NLM_TADV', &
4411 & hadvection, vadvection, status)
4412 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4413 IF (master) WRITE (stdout,20) 'NLM_TADV', trim(ncname)
4414 exit_flag=3
4415 ioerror=status
4416 END IF
4417 END IF
4418
4419# if defined ADJOINT || defined TANGENT || defined TL_IOMS
4420 IF (exit_flag.eq.noerror) THEN
4421 CALL tadv_putatt (ng, piofile, ncname, 'ADM_TADV', &
4422 & ad_hadvection, ad_vadvection, status)
4423 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4424 IF (master) WRITE (stdout,20) 'NLM_TADV', trim(ncname)
4425 exit_flag=3
4426 ioerror=status
4427 END IF
4428 END IF
4429# endif
4430# endif
4431!
4432! NLM Lateral boundary conditions.
4433!
4434 IF (exit_flag.eq.noerror) THEN
4435 CALL lbc_putatt (ng, piofile, ncname, 'NLM_LBC', lbc, status)
4436 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4437 IF (master) WRITE (stdout,20) 'NLM_LBC', trim(ncname)
4438 exit_flag=3
4439 ioerror=status
4440 END IF
4441 END IF
4442
4443# if defined ADJOINT || defined TANGENT || defined TL_IOMS
4444!
4445! Adjoint-based lateral boundary conditions.
4446!
4447 IF (exit_flag.eq.noerror) THEN
4448 CALL lbc_putatt (ng, piofile, ncname, 'ADM_LBC', ad_lbc, status)
4449 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4450 IF (master) WRITE (stdout,20) 'ADM_LBC', trim(ncname)
4451 exit_flag=3
4452 ioerror=status
4453 END IF
4454 END IF
4455# endif
4456# endif
4457# ifdef GIT_URL
4458!
4459! GIT repository information.
4460!
4461 IF (exit_flag.eq.noerror) THEN
4462 status=pio_put_att(piofile, pio_global, 'git_url', &
4463 & trim(git_url))
4464 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4465 IF (master) WRITE (stdout,20) 'git_url', trim(ncname)
4466 exit_flag=3
4467 ioerror=status
4468 END IF
4469 END IF
4470# endif
4471# if !defined DEBUGGING && defined GIT_REV
4472 IF (exit_flag.eq.noerror) THEN
4473 status=pio_put_att(piofile, pio_global, 'git_rev', &
4474 & trim(git_rev))
4475 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4476 IF (master) WRITE (stdout,20) 'git_rev', trim(ncname)
4477 exit_flag=3
4478 ioerror=status
4479 END IF
4480 END IF
4481# endif
4482!
4483! SVN repository information.
4484!
4485 IF (exit_flag.eq.noerror) THEN
4486 status=pio_put_att(piofile, pio_global, 'svn_url', &
4487 & trim(svn_url))
4488 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4489 IF (master) WRITE (stdout,20) 'svn_url', trim(ncname)
4490 exit_flag=3
4491 ioerror=status
4492 END IF
4493 END IF
4494
4495# if !defined DEBUGGING && defined SVN_REV
4496 IF (exit_flag.eq.noerror) THEN
4497 status=pio_put_att(piofile, pio_global, 'svn_rev', &
4498 & trim(svn_rev))
4499 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4500 IF (master) WRITE (stdout,20) 'svn_rev', trim(ncname)
4501 exit_flag=3
4502 ioerror=status
4503 END IF
4504 END IF
4505# endif
4506# ifndef DEBUGGING
4507!
4508! Local root directory, cpp header directory and file, and analytical
4509! directory
4510!
4511# ifdef ROOT_DIR
4512 IF (exit_flag.eq.noerror) THEN
4513 status=pio_put_att(piofile, pio_global, 'code_dir', &
4514 & trim(rdir))
4515 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4516 IF (master) WRITE (stdout,20) 'code_dir', trim(ncname)
4517 exit_flag=3
4518 ioerror=status
4519 END IF
4520 END IF
4521# endif
4522
4523# ifdef HEADER_DIR
4524 IF (exit_flag.eq.noerror) THEN
4525 status=pio_put_att(piofile, pio_global, 'header_dir', &
4526 & trim(hdir))
4527 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4528 IF (master) WRITE (stdout,20) 'header_dir', trim(ncname)
4529 exit_flag=3
4530 ioerror=status
4531 END IF
4532 END IF
4533# endif
4534
4535# ifdef ROMS_HEADER
4536 IF (exit_flag.eq.noerror) THEN
4537 status=pio_put_att(piofile, pio_global, 'header_file', &
4538 & trim(hfile))
4539 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4540 IF (master) WRITE (stdout,20) 'header_file', trim(ncname)
4541 exit_flag=3
4542 ioerror=status
4543 END IF
4544 END IF
4545# endif
4546# endif
4547# ifndef DEBUGGING
4548!
4549! Attributes describing platform and compiler
4550!
4551 IF (exit_flag.eq.noerror) THEN
4552 status=pio_put_att(piofile, pio_global, 'os', &
4553 & trim(my_os))
4554 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4555 IF (master) WRITE (stdout,20) 'os', trim(ncname)
4556 exit_flag=3
4557 ioerror=status
4558 END IF
4559 END IF
4560
4561 IF (exit_flag.eq.noerror) THEN
4562 status=pio_put_att(piofile, pio_global, 'cpu', &
4563 & trim(my_cpu))
4564 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4565 IF (master) WRITE (stdout,20) 'cpu', trim(ncname)
4566 exit_flag=3
4567 ioerror=status
4568 END IF
4569 END IF
4570
4571 IF (exit_flag.eq.noerror) THEN
4572 status=pio_put_att(piofile, pio_global, 'compiler_system', &
4573 & trim(my_fort))
4574 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4575 IF (master) WRITE (stdout,20) 'compiler_system', &
4576 & trim(ncname)
4577 exit_flag=3
4578 ioerror=status
4579 END IF
4580 END IF
4581
4582 IF (exit_flag.eq.noerror) THEN
4583 status=pio_put_att(piofile, pio_global, 'compiler_command', &
4584 & trim(my_fc))
4585 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4586 IF (master) WRITE (stdout,20) 'compiler_command', &
4587 & trim(ncname)
4588 exit_flag=3
4589 ioerror=status
4590 END IF
4591 END IF
4592
4593 IF (exit_flag.eq.noerror) THEN
4594 lstr=index(my_fflags, 'free')-2
4595 IF (lstr.le.0) lstr=len_trim(my_fflags)
4596 status=pio_put_att(piofile, pio_global, 'compiler_flags', &
4597 & my_fflags(1:lstr))
4598 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4599 IF (master) WRITE (stdout,20) 'compiler_flags', trim(ncname)
4600 exit_flag=3
4601 ioerror=status
4602 END IF
4603 END IF
4604!
4605! Tiling and history attributes.
4606!
4607 IF (exit_flag.eq.noerror) THEN
4608 status=pio_put_att(piofile, pio_global, 'tiling', &
4609 & trim(tiling))
4610 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4611 IF (master) WRITE (stdout,20) 'tiling', trim(ncname)
4612 exit_flag=3
4613 ioerror=status
4614 END IF
4615 END IF
4616
4617 IF (exit_flag.eq.noerror) THEN
4618 status=pio_put_att(piofile, pio_global, 'history', &
4619 & trim(history))
4620 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4621 IF (master) WRITE (stdout,20) 'history', trim(ncname)
4622 exit_flag=3
4623 ioerror=status
4624 END IF
4625 END IF
4626!
4627! Analytical header files used.
4628!
4629 IF (exit_flag.eq.noerror) THEN
4630 CALL join_string (ananame, SIZE(ananame), string, lstr)
4631 IF (lstr.gt.0) THEN
4632 status=pio_put_att(piofile, pio_global, 'ana_file', &
4633 & string(1:lstr))
4634 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4635 IF (master) WRITE (stdout,20) 'ana_file', trim(ncname)
4636 exit_flag=3
4637 ioerror=status
4638 END IF
4639 END IF
4640 END IF
4641# endif
4642
4643# ifdef BIOLOGY
4644!
4645! Biology model header file used.
4646!
4647 IF (exit_flag.eq.noerror) THEN
4648 DO i=1,512
4649 bio_file(i:i)='-'
4650 END DO
4651 status=pio_put_att(piofile, pio_global, 'bio_file', &
4652 & bio_file)
4653 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4654 IF (master) WRITE (stdout,20) 'bio_file', trim(ncname)
4655 exit_flag=3
4656 ioerror=status
4657 END IF
4658 END IF
4659# endif
4660
4661# ifndef DEBUGGING
4662!
4663! Activated CPP options.
4664!
4665 IF (exit_flag.eq.noerror) THEN
4666 lstr=len_trim(coptions)-1
4667 status=pio_put_att(piofile, pio_global, 'CPP_options', &
4668 & trim(coptions(1:lstr)))
4669 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
4670 IF (master) WRITE (stdout,20) 'CPP_options', trim(ncname)
4671 exit_flag=3
4672 ioerror=status
4673 END IF
4674 END IF
4675# endif
4676# ifdef PROPAGATOR
4677!
4678! Avoid writing other information variables if GST check pointing
4679! NetCDF file.
4680!
4681 IF (fileh.eq.abs(gst(ng)%pioFile%fh)) RETURN
4682# endif
4683!
4684!-----------------------------------------------------------------------
4685! Define running parameters.
4686!-----------------------------------------------------------------------
4687!
4688! Time stepping parameters.
4689!
4690 vinfo( 1)='ntimes'
4691 vinfo( 2)='number of long time-steps'
4692 status=def_var(ng, model, piofile, piovar, pio_int, &
4693 & 1, (/0/), aval, vinfo, ncname, &
4694 & setparaccess = .false.)
4695 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4696
4697 vinfo( 1)='ndtfast'
4698 vinfo( 2)='number of short time-steps'
4699 status=def_var(ng, model, piofile, piovar, pio_int, &
4700 & 1, (/0/), aval, vinfo, ncname, &
4701 & setparaccess = .false.)
4702 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4703
4704 vinfo( 1)='dt'
4705 vinfo( 2)='size of long time-steps'
4706 vinfo( 3)='second'
4707 status=def_var(ng, model, piofile, piovar, pio_tout, &
4708 & 1, (/0/), aval, vinfo, ncname, &
4709 & setparaccess = .false.)
4710 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4711
4712 vinfo( 1)='dtfast'
4713 vinfo( 2)='size of short time-steps'
4714 vinfo( 3)='second'
4715 status=def_var(ng, model, piofile, piovar, pio_tout, &
4716 & 1, (/0/), aval, vinfo, ncname, &
4717 & setparaccess = .false.)
4718 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4719
4720 vinfo( 1)='dstart'
4721 vinfo( 2)='time stamp assigned to model initilization'
4722 WRITE (vinfo( 3),'(a,a)') 'days since ', trim(rclock%string)
4723 vinfo( 4)=trim(rclock%calendar)
4724 status=def_var(ng, model, piofile, piovar, pio_tout, &
4725 & 1, (/0/), aval, vinfo, ncname, &
4726 & setparaccess = .false.)
4727 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4728
4729# ifdef RBL4DVAR_FCT_SENSITIVITY
4730 vinfo( 1)='ntimes_ana'
4731 vinfo( 2)='number of time-steps for observation impacts, '// &
4732 & 'analysis interval'
4733 status=def_var(ng, model, piofile, piovar, pio_int, &
4734 & 1, (/0/), aval, vinfo, ncname, &
4735 & setparaccess = .false.)
4736 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4737
4738 vinfo( 1)='ntimes_fct'
4739 vinfo( 2)='number of time-steps for observation impacts, '// &
4740 & 'forecast interval'
4741 status=def_var(ng, model, piofile, piovar, pio_int, &
4742 & 1, (/0/), aval, vinfo, ncname, &
4743 & setparaccess = .false.)
4744 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4745# endif
4746
4747# if defined HDF5 && defined DEFLATE
4748 vinfo( 1)='shuffle'
4749 vinfo( 2)='NetCDF-4/HDF5 file format shuffle filer flag'
4750 status=def_var(ng, model, piofile, piovar, pio_int, &
4751 & 1, (/0/), aval, vinfo, ncname, &
4752 & setparaccess = .false.)
4753 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4754
4755 vinfo( 1)='deflate'
4756 vinfo( 2)='NetCDF-4/HDF5 file format deflate filer flag'
4757 status=def_var(ng, model, piofile, piovar, pio_int, &
4758 & 1, (/0/), aval, vinfo, ncname, &
4759 & setparaccess = .false.)
4760 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4761
4762 vinfo( 1)='deflate_level'
4763 vinfo( 2)='NetCDF-4/HDF5 file format deflate level parameter'
4764 status=def_var(ng, model, piofile, piovar, pio_int, &
4765 & 1, (/0/), aval, vinfo, ncname, &
4766 & setparaccess = .false.)
4767 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4768# endif
4769
4770 vinfo( 1)='nHIS'
4771 vinfo( 2)='number of time-steps between history records'
4772 status=def_var(ng, model, piofile, piovar, pio_int, &
4773 & 1, (/0/), aval, vinfo, ncname, &
4774 & setparaccess = .false.)
4775 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4776
4777 vinfo( 1)='ndefHIS'
4778 vinfo( 2)= &
4779 & 'number of time-steps between the creation of history files'
4780 status=def_var(ng, model, piofile, piovar, pio_int, &
4781 & 1, (/0/), aval, vinfo, ncname, &
4782 & setparaccess = .false.)
4783 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4784
4785 vinfo( 1)='nRST'
4786 vinfo( 2)='number of time-steps between restart records'
4787 IF (lcyclerst(ng)) THEN
4788 vinfo(13)='only latest two records are maintained'
4789 END IF
4790 status=def_var(ng, model, piofile, piovar, pio_int, &
4791 & 1, (/0/), aval, vinfo, ncname, &
4792 & setparaccess = .false.)
4793 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4794
4795# if defined AVERAGES || \
4796 (defined ad_averages && defined adjoint) || \
4797 (defined rp_averages && defined tl_ioms) || \
4798 (defined tl_averages && defined tangent)
4799 vinfo( 1)='ntsAVG'
4800 vinfo( 2)= &
4801 & 'starting time-step for accumulation of time-averaged fields'
4802 status=def_var(ng, model, piofile, piovar, pio_int, &
4803 & 1, (/0/), aval, vinfo, ncname, &
4804 & setparaccess = .false.)
4805 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4806
4807 vinfo( 1)='nAVG'
4808 vinfo( 2)='number of time-steps between time-averaged records'
4809 status=def_var(ng, model, piofile, piovar, pio_int, &
4810 & 1, (/0/), aval, vinfo, ncname, &
4811 & setparaccess = .false.)
4812 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4813
4814 vinfo( 1)='ndefAVG'
4815 vinfo( 2)= &
4816 & 'number of time-steps between the creation of average files'
4817 status=def_var(ng, model, piofile, piovar, pio_int, &
4818 & 1, (/0/), aval, vinfo, ncname, &
4819 & setparaccess = .false.)
4820 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4821# endif
4822
4823# ifdef ADJOINT
4824 vinfo( 1)='nADJ'
4825 vinfo( 2)='number of time-steps between adjoint history records'
4826 status=def_var(ng, model, piofile, piovar, pio_int, &
4827 & 1, (/0/), aval, vinfo, ncname, &
4828 & setparaccess = .false.)
4829 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4830
4831 vinfo( 1)='ndefADJ'
4832 vinfo( 2)= &
4833 & 'number of time-steps between the creation of adjoint files'
4834 status=def_var(ng, model, piofile, piovar, pio_int, &
4835 & 1, (/0/), aval, vinfo, ncname, &
4836 & setparaccess = .false.)
4837 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4838# endif
4839
4840# ifdef TANGENT
4841 vinfo( 1)='nTLM'
4842 vinfo( 2)='number of time-steps between tangent history records'
4843 status=def_var(ng, model, piofile, piovar, pio_int, &
4844 & 1, (/0/), aval, vinfo, ncname, &
4845 & setparaccess = .false.)
4846 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4847
4848 vinfo( 1)='ndefTLM'
4849 vinfo( 2)= &
4850 & 'number of time-steps between the creation of tanget files'
4851 status=def_var(ng, model, piofile, piovar, pio_int, &
4852 & 1, (/0/), aval, vinfo, ncname, &
4853 & setparaccess = .false.)
4854 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4855# endif
4856
4857# ifdef ADJUST_BOUNDARY
4858 vinfo( 1)='nOBC'
4859 vinfo( 2)= &
4860 & 'number of time-steps between 4D-Var open boundary adjustment'
4861 status=def_var(ng, model, piofile, piovar, pio_int, &
4862 & 1, (/0/), aval, vinfo, ncname, &
4863 & setparaccess = .false.)
4864 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4865# endif
4866
4867# if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
4868 vinfo( 1)='nSFF'
4869 vinfo( 2)= &
4870 & 'number of time-steps between 4D-Var surface forcing adjustment'
4871 status=def_var(ng, model, piofile, piovar, pio_int, &
4872 & 1, (/0/), aval, vinfo, ncname, &
4873 & setparaccess = .false.)
4874 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4875# endif
4876
4877# ifdef PROPAGATOR
4878 vinfo( 1)='LmultiGST'
4879 vinfo( 2)='Switch to write one GST eigenvector per file'
4880 vinfo( 9)='.FALSE.'
4881 vinfo(10)='.TRUE.'
4882 status=def_var(ng, model, piofile, piovar, pio_int, &
4883 & 1, (/0/), aval, vinfo, ncname, &
4884 & setparaccess = .false.)
4885 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4886
4887 vinfo( 1)='LrstGST'
4888 vinfo( 2)='Switch to restart GST analysis'
4889 vinfo( 9)='.FALSE.'
4890 vinfo(10)='.TRUE.'
4891 status=def_var(ng, model, piofile, piovar, pio_int, &
4892 & 1, (/0/), aval, vinfo, ncname, &
4893 & setparaccess = .false.)
4894 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4895
4896 vinfo( 1)='MaxIterGST'
4897 vinfo( 2)='maximum number of GST algorithm iterations'
4898 status=def_var(ng, model, piofile, piovar, pio_int, &
4899 & 1, (/0/), aval, vinfo, ncname, &
4900 & setparaccess = .false.)
4901 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4902
4903 vinfo( 1)='nGST'
4904 vinfo( 2)='number GST iterations between check pointing'
4905 status=def_var(ng, model, piofile, piovar, pio_int, &
4906 & 1, (/0/), aval, vinfo, ncname, &
4907 & setparaccess = .false.)
4908 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4909
4910 vinfo( 1)='NEV'
4911 vinfo( 2)='number Ritz eigenvalues'
4912 status=def_var(ng, model, piofile, piovar, pio_int, &
4913 & 1, (/0/), aval, vinfo, ncname, &
4914 & setparaccess = .false.)
4915 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4916
4917 vinfo( 1)='NCV'
4918 vinfo( 2)='number Ritz eigenvectors generated'
4919 status=def_var(ng, model, piofile, piovar, pio_int, &
4920 & 1, (/0/), aval, vinfo, ncname, &
4921 & setparaccess = .false.)
4922 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4923
4924 vinfo( 1)='Ritz_tol'
4925 vinfo( 2)='relative accuracy of Ritz values'
4926 status=def_var(ng, model, piofile, piovar, pio_tout, &
4927 & 1, (/0/), aval, vinfo, ncname, &
4928 & setparaccess = .false.)
4929 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4930# endif
4931
4932# ifdef DIAGNOSTICS
4933 vinfo( 1)='ntsDIA'
4934 vinfo( 2)= &
4935 & 'starting time-step for accumulation of diagnostic fields'
4936 status=def_var(ng, model, piofile, piovar, pio_int, &
4937 & 1, (/0/), aval, vinfo, ncname, &
4938 & setparaccess = .false.)
4939 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4940
4941 vinfo( 1)='nDIA'
4942 vinfo( 2)='number of time-steps between diagnostic records'
4943 status=def_var(ng, model, piofile, piovar, pio_int, &
4944 & 1, (/0/), aval, vinfo, ncname, &
4945 & setparaccess = .false.)
4946 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4947
4948 vinfo( 1)='ndefDIA'
4949 vinfo( 2)= &
4950 & 'number of time-steps between the creation of diagnostic files'
4951 status=def_var(ng, model, piofile, piovar, pio_int, &
4952 & 1, (/0/), aval, vinfo, ncname, &
4953 & setparaccess = .false.)
4954 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4955# endif
4956
4957# ifdef STATIONS
4958 vinfo( 1)='nSTA'
4959 vinfo( 2)='number of time-steps between stations records'
4960 status=def_var(ng, model, piofile, piovar, pio_int, &
4961 & 1, (/0/), aval, vinfo, ncname, &
4962 & setparaccess = .false.)
4963 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4964# endif
4965
4966# ifdef FOUR_DVAR
4967 vinfo( 1)='Nouter'
4968 vinfo( 2)='number of minimization outer loops'
4969 status=def_var(ng, model, piofile, piovar, pio_int, &
4970 & 1, (/0/), aval, vinfo, ncname, &
4971 & setparaccess = .false.)
4972 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4973
4974 vinfo( 1)='Ninner'
4975 vinfo( 2)='number of minimization inner loops'
4976 status=def_var(ng, model, piofile, piovar, pio_int, &
4977 & 1, (/0/), aval, vinfo, ncname, &
4978 & setparaccess = .false.)
4979 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4980# endif
4981
4982# if defined POWER_LAW && defined SOLVE3D
4983!
4984! Power-law shape filter parameters for time-averaging of barotropic
4985! fields.
4986!
4987 vinfo( 1)='Falpha'
4988 vinfo( 2)='Power-law shape barotropic filter parameter'
4989 status=def_var(ng, model, piofile, piovar, pio_tout, &
4990 & 1, (/0/), aval, vinfo, ncname, &
4991 & setparaccess = .false.)
4992 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
4993
4994 vinfo( 1)='Fbeta'
4995 vinfo( 2)='Power-law shape barotropic filter parameter'
4996 status=def_var(ng, model, piofile, piovar, pio_tout, &
4997 & 1, (/0/), aval, vinfo, ncname, &
4998 & setparaccess = .false.)
4999 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5000
5001 vinfo( 1)='Fgamma'
5002 vinfo( 2)='Power-law shape barotropic filter parameter'
5003 status=def_var(ng, model, piofile, piovar, pio_tout, &
5004 & 1, (/0/), aval, vinfo, ncname, &
5005 & setparaccess = .false.)
5006 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5007# endif
5008!
5009! Horizontal mixing coefficients.
5010!
5011# if defined SOLVE3D && defined TS_DIF2
5012 vinfo( 1)='nl_tnu2'
5013 vinfo( 2)='nonlinear model Laplacian mixing coefficient '// &
5014 & 'for tracers'
5015 vinfo( 3)='meter2 second-1'
5016 status=def_var(ng, model, piofile, piovar, pio_type, &
5017 & 1, (/trcdim/), aval, vinfo, ncname, &
5018 & setparaccess = .false.)
5019 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5020
5021# ifdef ADJOINT
5022 vinfo( 1)='ad_tnu2'
5023 vinfo( 2)='adjoint model Laplacian mixing coefficient '// &
5024 & 'for tracers'
5025 vinfo( 3)='meter2 second-1'
5026 status=def_var(ng, model, piofile, piovar, pio_type, &
5027 & 1, (/trcdim/), aval, vinfo, ncname, &
5028 & setparaccess = .false.)
5029 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5030# endif
5031
5032# if defined TANGENT || defined TL_IOMS
5033 vinfo( 1)='tl_tnu2'
5034 vinfo( 2)='tangent linear model Laplacian mixing coefficient '// &
5035 & 'for tracers'
5036 vinfo( 3)='meter2 second-1'
5037 status=def_var(ng, model, piofile, piovar, pio_type, &
5038 & 1, (/trcdim/), aval, vinfo, ncname, &
5039 & setparaccess = .false.)
5040 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5041# endif
5042# endif
5043
5044# if defined SOLVE3D && defined TS_DIF4
5045 vinfo( 1)='nl_tnu4'
5046 vinfo( 2)='nonlinear model biharmonic mixing coefficient '// &
5047 & 'for tracers'
5048 vinfo( 3)='meter4 second-1'
5049 status=def_var(ng, model, piofile, piovar, pio_type, &
5050 & 1, (/trcdim/), aval, vinfo, ncname, &
5051 & setparaccess = .false.)
5052 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5053
5054# ifdef ADJOINT
5055 vinfo( 1)='ad_tnu4'
5056 vinfo( 2)='adjoint model biharmonic mixing coefficient '// &
5057 & 'for tracers'
5058 vinfo( 3)='meter4 second-1'
5059 status=def_var(ng, model, piofile, piovar, pio_type, &
5060 & 1, (/trcdim/), aval, vinfo, ncname, &
5061 & setparaccess = .false.)
5062 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5063# endif
5064
5065# if defined TANGENT || defined TL_IOMS
5066 vinfo( 1)='tl_tnu4'
5067 vinfo( 2)='tangent linear model biharmonic mixing coefficient '// &
5068 & 'for tracers'
5069 vinfo( 3)='meter4 second-1'
5070 status=def_var(ng, model, piofile, piovar, pio_type, &
5071 & 1, (/trcdim/), aval, vinfo, ncname, &
5072 & setparaccess = .false.)
5073 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5074# endif
5075# endif
5076
5077# ifdef UV_VIS2
5078 vinfo( 1)='nl_visc2'
5079 vinfo( 2)='nonlinear model Laplacian mixing coefficient '// &
5080 & 'for momentum'
5081 vinfo( 3)='meter2 second-1'
5082 status=def_var(ng, model, piofile, piovar, pio_type, &
5083 & 1, (/0/), aval, vinfo, ncname, &
5084 & setparaccess = .false.)
5085 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5086
5087# ifdef ADJOINT
5088 vinfo( 1)='ad_visc2'
5089 vinfo( 2)='adjoint model Laplacian mixing coefficient '// &
5090 & 'for momentum'
5091 vinfo( 3)='meter2 second-1'
5092 status=def_var(ng, model, piofile, piovar, pio_type, &
5093 & 1, (/0/), aval, vinfo, ncname, &
5094 & setparaccess = .false.)
5095 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5096# endif
5097
5098# if defined TANGENT || defined TL_IOMS
5099 vinfo( 1)='tl_visc2'
5100 vinfo( 2)='tangent linear model Laplacian mixing coefficient '// &
5101 & 'for momentum'
5102 vinfo( 3)='meter2 second-1'
5103 status=def_var(ng, model, piofile, piovar, pio_type, &
5104 & 1, (/0/), aval, vinfo, ncname, &
5105 & setparaccess = .false.)
5106 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5107# endif
5108# endif
5109
5110# ifdef UV_VIS4
5111 vinfo( 1)='nl_visc4'
5112 vinfo( 2)='nonlinear model biharmonic mixing coefficient '// &
5113 & 'for momentum'
5114 vinfo( 3)='meter4 second-1'
5115 status=def_var(ng, model, piofile, piovar, pio_type, &
5116 & 1, (/0/), aval, vinfo, ncname, &
5117 & setparaccess = .false.)
5118 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5119
5120# ifdef ADJOINT
5121 vinfo( 1)='ad_visc4'
5122 vinfo( 2)='adjoint model biharmonic mixing coefficient '// &
5123 & 'for momentum'
5124 vinfo( 3)='meter4 second-1'
5125 status=def_var(ng, model, piofile, piovar, pio_type, &
5126 & 1, (/0/), aval, vinfo, ncname, &
5127 & setparaccess = .false.)
5128 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5129# endif
5130
5131# if defined TANGENT || defined TL_IOMS
5132 vinfo( 1)='tl_visc4'
5133 vinfo( 2)='tangent linear model biharmonic mixing coefficient '// &
5134 & 'for momentum'
5135 vinfo( 3)='meter4 second-1'
5136 status=def_var(ng, model, piofile, piovar, pio_type, &
5137 & 1, (/0/), aval, vinfo, ncname, &
5138 & setparaccess = .false.)
5139 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5140# endif
5141# endif
5142
5143# if defined SOLVE3D && (defined MY25_MIXING || defined GLS_MIXING)
5144# ifdef TKE_DIF2
5145 vinfo( 1)='tkenu2'
5146 vinfo( 2)='harmonic mixing coefficient for turbulent energy'
5147 vinfo( 3)='meter2 second-1'
5148 status=def_var(ng, model, piofile, piovar, pio_type, &
5149 & 1, (/0/), aval, vinfo, ncname, &
5150 & setparaccess = .false.)
5151 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5152# endif
5153# ifdef TKE_DIF4
5154 vinfo( 1)='tkenu4'
5155 vinfo( 2)='biharmonic mixing coefficient for turbulent energy'
5156 vinfo( 3)='meter4 second-1'
5157 status=def_var(ng, model, piofile,piovar, pio_type, &
5158 & 1, (/0/), aval, vinfo, ncname, &
5159 & setparaccess = .false.)
5160 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5161# endif
5162# endif
5163# if defined UV_VIS2 || defined UV_VIS4
5164 vinfo( 1)='LuvSponge'
5165 vinfo( 2)='horizontal viscosity sponge activation switch'
5166 vinfo( 9)='.FALSE.'
5167 vinfo(10)='.TRUE.'
5168 status=def_var(ng, model, piofile, piovar, pio_int, &
5169 & 1, (/0/), aval, vinfo, ncname, &
5170 & setparaccess = .false.)
5171 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5172# endif
5173# if (defined TS_DIF2 || defined TS_DIF4) && defined SOLVE3D
5174 vinfo( 1)='LtracerSponge'
5175 vinfo( 2)='horizontal diffusivity sponge activation switch'
5176 vinfo( 9)='.FALSE.'
5177 vinfo(10)='.TRUE.'
5178 status=def_var(ng, model, piofile, piovar, pio_int, &
5179 & 1, (/trcdim/), aval, vinfo, ncname, &
5180 & setparaccess = .false.)
5181 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5182# endif
5183# ifdef SOLVE3D
5184!
5185! Background vertical mixing coefficients.
5186!
5187 vinfo( 1)='Akt_bak'
5188 vinfo( 2)='background vertical mixing coefficient for tracers'
5189 vinfo( 3)='meter2 second-1'
5190 status=def_var(ng, model, piofile, piovar, pio_type, &
5191 & 1, (/trcdim/), aval, vinfo, ncname, &
5192 & setparaccess = .false.)
5193 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5194
5195 vinfo( 1)='Akv_bak'
5196 vinfo( 2)='background vertical mixing coefficient for momentum'
5197 vinfo( 3)='meter2 second-1'
5198 status=def_var(ng, model, piofile, piovar, pio_type, &
5199 & 1, (/0/), aval, vinfo, ncname, &
5200 & setparaccess = .false.)
5201 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5202
5203# if defined MY25_MIXING || defined GLS_MIXING
5204 vinfo( 1)='Akk_bak'
5205 vinfo( 2)= &
5206 & 'background vertical mixing coefficient for turbulent energy'
5207 vinfo( 3)='meter2 second-1'
5208 status=def_var(ng, model, piofile, piovar, pio_type, &
5209 & 1, (/0/), aval, vinfo, ncname, &
5210 & setparaccess = .false.)
5211 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5212
5213 vinfo( 1)='Akp_bak'
5214 vinfo( 2)= &
5215 & 'background vertical mixing coefficient for length scale'
5216 vinfo( 3)='meter2 second-1'
5217 status=def_var(ng, model, piofile, piovar, pio_type, &
5218 & 1, (/0/), aval, vinfo, ncname, &
5219 & setparaccess = .false.)
5220 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5221# endif
5222
5223# ifdef FORWARD_MIXING
5224!
5225! Basic state vertical mixing scale used in adjoint-based applications.
5226!
5227# ifdef ADJOINT
5228 vinfo( 1)='ad_Akt_fac'
5229 vinfo( 2)='adjoint model basic state vertical mixing '// &
5230 & 'scale for tracers'
5231 status=def_var(ng, model, piofile, piovar, pio_type, &
5232 & 1, (/trcdim/), aval, vinfo, ncname, &
5233 & setparaccess = .false.)
5234 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5235# endif
5236
5237# if defined TANGENT || defined TL_IOMS
5238 vinfo( 1)='tl_Akt_fac'
5239 vinfo( 2)='tangent linear model basic state vertical mixing '// &
5240 & 'scale for tracers'
5241 status=def_var(ng, model, piofile, piovar, pio_type, &
5242 & 1, (/trcdim/), aval, vinfo, ncname, &
5243 & setparaccess = .false.)
5244 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5245# endif
5246
5247# ifdef ADJOINT
5248 vinfo( 1)='ad_Akv_fac'
5249 vinfo( 2)='adjoint model basic state vertical mixing '// &
5250 & 'scale for momentum'
5251 status=def_var(ng, model, piofile, piovar, pio_type, &
5252 & 1, (/0/), aval, vinfo, ncname, &
5253 & setparaccess = .false.)
5254 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5255# endif
5256
5257# if defined TANGENT || defined TL_IOMS
5258 vinfo( 1)='tl_Akv_fac'
5259 vinfo( 2)='tangent linear model basic state vertical mixing '// &
5260 & 'scale for momentum'
5261 status=def_var(ng, model, piofile, piovar, pio_type, &
5262 & 1, (/0/), aval, vinfo, ncname, &
5263 & setparaccess = .false.)
5264 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5265# endif
5266# endif
5267# endif
5268!
5269! Drag coefficients.
5270!
5271 vinfo( 1)='rdrg'
5272 vinfo( 2)='linear drag coefficient'
5273 vinfo( 3)='meter second-1'
5274 status=def_var(ng, model, piofile, piovar, pio_type, &
5275 & 1, (/0/), aval, vinfo, ncname, &
5276 & setparaccess = .false.)
5277 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5278
5279 vinfo( 1)='rdrg2'
5280 vinfo( 2)='quadratic drag coefficient'
5281 status=def_var(ng, model, piofile, piovar, pio_type, &
5282 & 1, (/0/), aval, vinfo ,ncname, &
5283 & setparaccess = .false.)
5284 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5285
5286# ifdef SOLVE3D
5287 vinfo( 1)='Zob'
5288 vinfo( 2)='bottom roughness'
5289 vinfo( 3)='meter'
5290 status=def_var(ng, model, piofile, piovar, pio_type, &
5291 & 1, (/0/), aval, vinfo, ncname, &
5292 & setparaccess = .false.)
5293 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5294
5295 vinfo( 1)='Zos'
5296 vinfo( 2)='surface roughness'
5297 vinfo( 3)='meter'
5298 status=def_var(ng, model, piofile, piovar, pio_type, &
5299 & 1, (/0/), aval, vinfo, ncname, &
5300 & setparaccess = .false.)
5301 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5302# endif
5303# if defined SOLVE3D && defined GLS_MIXING
5304!
5305! Generic length-scale parameters.
5306!
5307 vinfo( 1)='gls_p'
5308 vinfo( 2)='stability exponent'
5309 status=def_var(ng, model, piofile, piovar, pio_type, &
5310 & 1, (/0/), aval, vinfo, ncname, &
5311 & setparaccess = .false.)
5312 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5313
5314 vinfo( 1)='gls_m'
5315 vinfo( 2)='turbulent kinetic energy exponent'
5316 status=def_var(ng, model, piofile, piovar, pio_type, &
5317 & 1, (/0/), aval, vinfo, ncname, &
5318 & setparaccess = .false.)
5319 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5320
5321 vinfo( 1)='gls_n'
5322 vinfo( 2)='turbulent length scale exponent'
5323 status=def_var(ng, model, piofile, piovar, pio_type, &
5324 & 1, (/0/), aval, vinfo, ncname, &
5325 & setparaccess = .false.)
5326 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5327
5328 vinfo( 1)='gls_cmu0'
5329 vinfo( 2)='stability coefficient'
5330 status=def_var(ng, model, piofile, piovar, pio_type, &
5331 & 1, (/0/), aval, vinfo, ncname, &
5332 & setparaccess = .false.)
5333 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5334
5335 vinfo( 1)='gls_c1'
5336 vinfo( 2)='shear production coefficient'
5337 status=def_var(ng, model, piofile, piovar, pio_type, &
5338 & 1, (/0/), aval, vinfo, ncname, &
5339 & setparaccess = .false.)
5340 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5341
5342 vinfo( 1)='gls_c2'
5343 vinfo( 2)='dissipation coefficient'
5344 status=def_var(ng, model, piofile, piovar, pio_type, &
5345 & 1, (/0/), aval, vinfo, ncname, &
5346 & setparaccess = .false.)
5347 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5348
5349 vinfo( 1)='gls_c3m'
5350 vinfo( 2)='buoyancy production coefficient (minus)'
5351 status=def_var(ng, model, piofile, piovar, pio_type, &
5352 & 1, (/0/), aval, vinfo, ncname, &
5353 & setparaccess = .false.)
5354 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5355
5356 vinfo( 1)='gls_c3p'
5357 vinfo( 2)='buoyancy production coefficient (plus)'
5358 status=def_var(ng, model, piofile, piovar, pio_type, &
5359 & 1, (/0/), aval, vinfo, ncname, &
5360 & setparaccess = .false.)
5361 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5362
5363 vinfo( 1)='gls_sigk'
5364 vinfo( 2)='constant Schmidt number for TKE'
5365 status=def_var(ng, model, piofile, piovar, pio_type, &
5366 & 1, (/0/), aval, vinfo, ncname, &
5367 & setparaccess = .false.)
5368 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5369
5370 vinfo( 1)='gls_sigp'
5371 vinfo( 2)='constant Schmidt number for PSI'
5372 status=def_var(ng, model, piofile, piovar, pio_type, &
5373 & 1, (/0/), aval, vinfo, ncname, &
5374 & setparaccess = .false.)
5375 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5376
5377 vinfo( 1)='gls_Kmin'
5378 vinfo( 2)='minimum value of specific turbulent kinetic energy'
5379 status=def_var(ng, model, piofile, piovar, pio_type, &
5380 & 1, (/0/), aval, vinfo, ncname, &
5381 & setparaccess = .false.)
5382 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5383
5384 vinfo( 1)='gls_Pmin'
5385 vinfo( 2)='minimum Value of dissipation'
5386 status=def_var(ng, model, piofile, piovar, pio_type, &
5387 & 1, (/0/), aval, vinfo, ncname, &
5388 & setparaccess = .false.)
5389 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5390
5391 vinfo( 1)='Charnok_alpha'
5392 vinfo( 2)='Charnock factor for surface roughness'
5393 status=def_var(ng, model, piofile, piovar, pio_type, &
5394 & 1, (/0/), aval, vinfo, ncname, &
5395 & setparaccess = .false.)
5396 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5397
5398 vinfo( 1)='Zos_hsig_alpha'
5399 vinfo( 2)='wave amplitude factor for surface roughness'
5400 status=def_var(ng, model, piofile, piovar, pio_type, &
5401 & 1, (/0/), aval, vinfo, ncname, &
5402 & setparaccess = .false.)
5403 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5404
5405 vinfo( 1)='sz_alpha'
5406 vinfo( 2)='surface flux from wave dissipation'
5407 status=def_var(ng, model, piofile, piovar, pio_type, &
5408 & 1, (/0/), aval, vinfo, ncname, &
5409 & setparaccess = .false.)
5410 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5411
5412 vinfo( 1)='CrgBan_cw'
5413 vinfo( 2)='surface flux due to Craig and Banner wave breaking'
5414 status=def_var(ng, model, piofile, piovar, pio_type, &
5415 & 1, (/0/), aval, vinfo, ncname, &
5416 & setparaccess = .false.)
5417 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5418# endif
5419# ifdef WEC
5420 vinfo( 1)='wec_alpha'
5421 vinfo( 2)='WEC wave dissipation action scale'
5422 vinfo( 9)='all goes to breaking and none to roller'
5423 vinfo(10)='all goes to roller and none to breaking'
5424 status=def_var(ng, model, piofile, piovar, nf_type, &
5425 & 1, (/0/), aval, vinfo, ncname, &
5426 & setparaccess = .false.)
5427 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5428# endif
5429!
5430! Nudging inverse time scales used in various tasks.
5431!
5432 vinfo( 1)='Znudg'
5433 vinfo( 2)='free-surface nudging/relaxation inverse time scale'
5434 vinfo( 3)='day-1'
5435 status=def_var(ng, model, piofile, piovar, pio_tout, &
5436 & 1, (/0/), aval, vinfo, ncname, &
5437 & setparaccess = .false.)
5438 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5439
5440 vinfo( 1)='M2nudg'
5441 vinfo( 2)='2D momentum nudging/relaxation inverse time scale'
5442 vinfo( 3)='day-1'
5443 status=def_var(ng, model, piofile, piovar, pio_tout, &
5444 & 1, (/0/), aval, vinfo, ncname, &
5445 & setparaccess = .false.)
5446 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5447
5448# ifdef SOLVE3D
5449 vinfo( 1)='M3nudg'
5450 vinfo( 2)='3D momentum nudging/relaxation inverse time scale'
5451 vinfo( 3)='day-1'
5452 status=def_var(ng, model, piofile, piovar, pio_tout, &
5453 & 1, (/0/), aval, vinfo, ncname, &
5454 & setparaccess = .false.)
5455 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5456
5457 vinfo( 1)='Tnudg'
5458 vinfo( 2)='Tracers nudging/relaxation inverse time scale'
5459 vinfo( 3)='day-1'
5460 status=def_var(ng, model, piofile, piovar, pio_tout, &
5461 & 1, (/trcdim/), aval, vinfo, ncname, &
5462 & setparaccess = .false.)
5463 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5464# endif
5465
5466# ifndef DEBUGGING
5467!
5468! Open boundary nudging, inverse time scales.
5469!
5470 IF (nudgingcoeff(ng)) THEN
5471 vinfo( 1)='FSobc_in'
5472 vinfo( 2)='free-surface inflow, nudging inverse time scale'
5473 vinfo( 3)='second-1'
5474 status=def_var(ng, model, piofile, piovar, pio_tout, &
5475 & 1, (/brydim/), aval, vinfo, ncname, &
5476 & setparaccess = .false.)
5477 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5478
5479 vinfo( 1)='FSobc_out'
5480 vinfo( 2)='free-surface outflow, nudging inverse time scale'
5481 vinfo( 3)='second-1'
5482 status=def_var(ng, model, piofile, piovar, pio_tout, &
5483 & 1, (/brydim/), aval, vinfo, ncname, &
5484 & setparaccess = .false.)
5485 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5486
5487 vinfo( 1)='M2obc_in'
5488 vinfo( 2)='2D momentum inflow, nudging inverse time scale'
5489 vinfo( 3)='second-1'
5490 status=def_var(ng, model, piofile, piovar, pio_tout, &
5491 & 1, (/brydim/), aval, vinfo, ncname, &
5492 & setparaccess = .false.)
5493 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5494
5495 vinfo( 1)='M2obc_out'
5496 vinfo( 2)='2D momentum outflow, nudging inverse time scale'
5497 vinfo( 3)='second-1'
5498 status=def_var(ng, model, piofile, piovar, pio_tout, &
5499 & 1, (/brydim/), aval, vinfo, ncname, &
5500 & setparaccess = .false.)
5501 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5502
5503# ifdef SOLVE3D
5504 vinfo( 1)='Tobc_in'
5505 vinfo( 2)='tracers inflow, nudging inverse time scale'
5506 vinfo( 3)='second-1'
5507 status=def_var(ng, model, piofile, piovar, pio_tout, &
5508 & 2, tbrydim, aval, vinfo, ncname, &
5509 & setparaccess = .false.)
5510 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5511
5512 vinfo( 1)='Tobc_out'
5513 vinfo( 2)='tracers outflow, nudging inverse time scale'
5514 vinfo( 3)='second-1'
5515 status=def_var(ng, model, piofile, piovar, pio_tout, &
5516 & 2, tbrydim, aval, vinfo, ncname, &
5517 & setparaccess = .false.)
5518 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5519
5520 vinfo( 1)='M3obc_in'
5521 vinfo( 2)='3D momentum inflow, nudging inverse time scale'
5522 vinfo( 3)='second-1'
5523 status=def_var(ng, model, piofile, piovar, pio_tout, &
5524 & 1, (/brydim/), aval, vinfo, ncname, &
5525 & setparaccess = .false.)
5526 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5527
5528 vinfo( 1)='M3obc_out'
5529 vinfo( 2)='3D momentum outflow, nudging inverse time scale'
5530 vinfo( 3)='second-1'
5531 status=def_var(ng, model, piofile, piovar, pio_tout, &
5532 & 1, (/brydim/), aval, vinfo, ncname, &
5533 & setparaccess = .false.)
5534 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5535# endif
5536 END IF
5537# endif
5538!
5539! Equation of State parameters.
5540!
5541 vinfo( 1)='rho0'
5542 vinfo( 2)='mean density used in Boussinesq approximation'
5543 vinfo( 3)='kilogram meter-3'
5544 status=def_var(ng, model, piofile, piovar, pio_type, &
5545 & 1, (/0/), aval, vinfo, ncname, &
5546 & setparaccess = .false.)
5547 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5548
5549# if defined SOLVE3D && defined PROPAGATOR
5550 vinfo( 1)='bvf_bak'
5551 vinfo( 2)='background Brunt-Vaisala frequency'
5552 vinfo( 3)='second-2'
5553 status=def_var(ng, model, piofile, piovar, pio_type, &
5554 & 1, (/0/), aval, vinfo, ncname, &
5555 & setparaccess = .false.)
5556 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5557# endif
5558
5559# if defined SOLVE3D && \
5560 (!defined NONLIN_EOS || defined FOUR_DVAR || defined PROPAGATOR)
5561 vinfo( 1)='R0'
5562 vinfo( 2)='background density used in linear equation of state'
5563 vinfo( 3)='kilogram meter-3'
5564 status=def_var(ng, model, piofile, piovar, pio_type, &
5565 & 1, (/0/), aval, vinfo, ncname, &
5566 & setparaccess = .false.)
5567 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5568
5569 vinfo( 1)='Tcoef'
5570 vinfo( 2)='thermal expansion coefficient'
5571 vinfo( 3)='Celsius-1'
5572 status=def_var(ng, model, piofile, piovar, pio_type, &
5573 & 1, (/0/), aval, vinfo, ncname, &
5574 & setparaccess = .false.)
5575 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5576
5577 vinfo( 1)='Scoef'
5578 vinfo( 2)='Saline contraction coefficient'
5579 status=def_var(ng, model, piofile, piovar, pio_type, &
5580 & 1, (/0/), aval, vinfo, ncname, &
5581 & setparaccess = .false.)
5582 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5583# endif
5584# ifdef SOLVE3D
5585!
5586! Various parameters.
5587!
5588# ifdef BODYFORCE
5589 vinfo( 1)='levsfrc'
5590 vinfo( 2)='shallowest level for body-force stress'
5591 status=def_var(ng, model, piofile, piovar, pio_int, &
5592 & 1, (/0/), aval, vinfo, ncname, &
5593 & setparaccess = .false.)
5594 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5595
5596 vinfo( 1)='levbfrc'
5597 vinfo( 2)='deepest level for body-force stress'
5598 status=def_var(ng, model, piofile, piovar, pio_int, &
5599 & 1, (/0/), aval, vinfo, ncname, &
5600 & setparaccess = .false.)
5601 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5602# endif
5603# endif
5604!
5605! Slipperiness parameters.
5606!
5607 vinfo( 1)='gamma2'
5608 vinfo( 2)='slipperiness parameter'
5609 status=def_var(ng, model, piofile, piovar, pio_type, &
5610 & 1, (/0/), aval, vinfo, ncname, &
5611 & setparaccess = .false.)
5612 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5613!
5614! Logical switches to activate horizontal momentum transport
5615! point Sources/Sinks (like river runoff transport) and mass point
5616! Sources/Sinks (like volume vertical influx).
5617!
5618 vinfo( 1)='LuvSrc'
5619 vinfo( 2)='momentum point sources and sink activation switch'
5620 vinfo( 9)='.FALSE.'
5621 vinfo(10)='.TRUE.'
5622 status=def_var(ng, model, piofile, piovar, pio_int, &
5623 & 1, (/0/), aval, vinfo, ncname, &
5624 & setparaccess = .false.)
5625 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5626
5627 vinfo( 1)='LwSrc'
5628 vinfo( 2)='mass point sources and sink activation switch'
5629 vinfo( 9)='.FALSE.'
5630 vinfo(10)='.TRUE.'
5631 status=def_var(ng, model, piofile, piovar, pio_int, &
5632 & 1, (/0/), aval, vinfo, ncname, &
5633 & setparaccess = .false.)
5634 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5635
5636# ifdef SOLVE3D
5637!
5638! Logical switches indicating which tracer variables are processed
5639! during point Sources/Sinks.
5640!
5641 vinfo( 1)='LtracerSrc'
5642 vinfo( 2)='tracer point sources and sink activation switch'
5643 vinfo( 9)='.FALSE.'
5644 vinfo(10)='.TRUE.'
5645 status=def_var(ng, model, piofile, piovar, pio_int, &
5646 & 1, (/trcdim/), aval, vinfo, ncname, &
5647 & setparaccess = .false.)
5648 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5649# endif
5650!
5651! Logical switches to process climatology fields.
5652!
5653 vinfo( 1)='LsshCLM'
5654 vinfo( 2)='sea surface height climatology processing switch'
5655 vinfo( 9)='.FALSE.'
5656 vinfo(10)='.TRUE.'
5657 status=def_var(ng, model, piofile, piovar, pio_int, &
5658 & 1, (/0/), aval, vinfo, ncname, &
5659 & setparaccess = .false.)
5660 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5661
5662 vinfo( 1)='Lm2CLM'
5663 vinfo( 2)='2D momentum climatology processing switch'
5664 vinfo( 9)='.FALSE.'
5665 vinfo(10)='.TRUE.'
5666 status=def_var(ng, model, piofile, piovar, pio_int, &
5667 & 1, (/0/), aval, vinfo, ncname, &
5668 & setparaccess = .false.)
5669 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5670
5671# ifdef SOLVE3D
5672 vinfo( 1)='Lm3CLM'
5673 vinfo( 2)='3D momentum climatology processing switch'
5674 vinfo( 9)='.FALSE.'
5675 vinfo(10)='.TRUE.'
5676 status=def_var(ng, model, piofile, piovar, pio_int, &
5677 & 1, (/0/), aval, vinfo, ncname, &
5678 & setparaccess = .false.)
5679 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5680
5681 vinfo( 1)='LtracerCLM'
5682 vinfo( 2)='tracer climatology processing switch'
5683 vinfo( 9)='.FALSE.'
5684 vinfo(10)='.TRUE.'
5685 status=def_var(ng, model, piofile, piovar, pio_int, &
5686 & 1, (/trcdim/), aval, vinfo, ncname, &
5687 & setparaccess = .false.)
5688 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5689# endif
5690!
5691! Logical switches for nudging of climatology fields.
5692!
5693 vinfo( 1)='LnudgeM2CLM'
5694 vinfo( 2)='2D momentum climatology nudging activation switch'
5695 vinfo( 9)='.FALSE.'
5696 vinfo(10)='.TRUE.'
5697 status=def_var(ng, model, piofile, piovar, pio_int, &
5698 & 1, (/0/), aval, vinfo, ncname, &
5699 & setparaccess = .false.)
5700 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5701# ifdef SOLVE3D
5702!
5703 vinfo( 1)='LnudgeM3CLM'
5704 vinfo( 2)='3D momentum climatology nudging activation switch'
5705 vinfo( 9)='.FALSE.'
5706 vinfo(10)='.TRUE.'
5707 status=def_var(ng, model, piofile, piovar, pio_int, &
5708 & 1, (/0/), aval, vinfo, ncname, &
5709 & setparaccess = .false.)
5710 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5711!
5712 vinfo( 1)='LnudgeTCLM'
5713 vinfo( 2)='tracer climatology nudging activation switch'
5714 vinfo( 9)='.FALSE.'
5715 vinfo(10)='.TRUE.'
5716 status=def_var(ng, model, piofile, piovar, pio_int, &
5717 & 1, (/trcdim/), aval, vinfo, ncname, &
5718 & setparaccess = .false.)
5719 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5720# endif
5721# ifdef FOUR_DVAR
5722!
5723! 4D-Var assimilation parameters.
5724!
5725# ifdef ADJUST_STFLUX
5726 vinfo( 1)='Lstflux'
5727 vinfo( 2)='surface tracer fluxes adjustment switch'
5728 vinfo( 9)='.FALSE.'
5729 vinfo(10)='.TRUE.'
5730 status=def_var(ng, model, piofile, piovar, pio_int, &
5731 & 1, (/trcdim/), aval, vinfo, ncname, &
5732 & setparaccess = .false.)
5733 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5734# endif
5735# ifdef ADJUST_BOUNDARY
5736 vinfo( 1)='Lobc'
5737 vinfo( 2)='open boundary conditions adjustment switch'
5738 vinfo( 9)='.FALSE.'
5739 vinfo(10)='.TRUE.'
5740 status=def_var(ng, model, piofile, piovar, pio_int, &
5741 & 2, (/brydim, statedim/), aval, vinfo, ncname, &
5742 & setparaccess = .false.)
5743 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5744# endif
5745# ifndef I4DVAR_ANA_SENSITIVITY
5746 vinfo( 1)='LhessianEV'
5747 vinfo( 2)='switch to compute Hessian eigenvectors'
5748 vinfo( 9)='.FALSE.'
5749 vinfo(10)='.TRUE.'
5750 status=def_var(ng, model, piofile, piovar, pio_int, &
5751 & 1, (/0/), aval, vinfo, ncname, &
5752 & setparaccess = .false.)
5753 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5754
5755# ifdef WEAK_CONSTRAINT
5756 vinfo( 1)='LhotStart'
5757 vinfo( 2)='switch for hot start of subsequent outer loops'
5758 vinfo( 9)='.FALSE.'
5759 vinfo(10)='.TRUE.'
5760 status=def_var(ng, model, piofile, piovar, pio_int, &
5761 & 1, (/0/), aval, vinfo, ncname, &
5762 & setparaccess = .false.)
5763 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5764# endif
5765
5766 vinfo( 1)='Lprecond'
5767 vinfo( 2)='switch for conjugate gradient preconditioning'
5768 vinfo( 9)='.FALSE.'
5769 vinfo(10)='.TRUE.'
5770 status=def_var(ng, model, piofile, piovar, pio_int, &
5771 & 1, (/0/), aval, vinfo, ncname, &
5772 & setparaccess = .false.)
5773 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5774
5775 vinfo( 1)='Lritz'
5776 vinfo( 2)='switch for Ritz limited-memory preconditioning'
5777 vinfo( 9)='.FALSE.'
5778 vinfo(10)='.TRUE.'
5779 status=def_var(ng, model, piofile, piovar, pio_int, &
5780 & 1, (/0/), aval, vinfo, ncname, &
5781 & setparaccess = .false.)
5782 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5783
5784# ifdef WEAK_CONSTRAINT
5785 IF (lprecond.and.(nritzev.gt.0)) THEN
5786 vinfo( 1)='NritzEV'
5787 vinfo( 2)='number of preconditioning eigenpairs to use'
5788 status=def_var(ng, model, piofile, piovar, pio_int, &
5789 & 1, (/0/), aval, vinfo, ncname, &
5790 & setparaccess = .false.)
5791 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5792 END IF
5793# endif
5794# endif
5795# if defined POSTERIOR_EOFS && defined WEAK_CONSTRAINT
5796 vinfo( 1)='NpostI'
5797 vinfo( 2)='number of Lanczos iterations in posterior analysis'
5798 status=def_var(ng, model, piofile, piovar, pio_int, &
5799 & 1, (/0/), aval, vinfo, ncname, &
5800 & setparaccess = .false.)
5801 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5802# endif
5803# if defined ARRAY_MODES || \
5804 defined i4dvar_ana_sensitivity || \
5805 defined rbl4dvar_ana_sensitivity || \
5806 defined rbl4dvar_fct_sensitivity || \
5807 defined r4dvar_ana_sensitivity
5808 vinfo( 1)='Nimpact'
5809 vinfo( 2)='Observations impact/sensitivity outer loop to use'
5810 status=def_var(ng, model, piofile, piovar, pio_int, &
5811 & 1, (/0/), aval, vinfo, ncname, &
5812 & setparaccess = .false.)
5813 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5814# endif
5815# ifndef I4DVAR_ANA_SENSITIVITY
5816 vinfo( 1)='GradErr'
5817 vinfo( 2)='Upper bound on relative error of the gradient'
5818 status=def_var(ng, model, piofile, piovar, pio_type, &
5819 & 1, (/0/), aval, vinfo, ncname, &
5820 & setparaccess = .false.)
5821 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5822
5823 vinfo( 1)='HevecErr'
5824 vinfo( 2)='Accuracy required for Hessian eigenvectors'
5825 status=def_var(ng, model, piofile, piovar, pio_type, &
5826 & 1, (/0/), aval, vinfo, ncname, &
5827 & setparaccess = .false.)
5828 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5829# endif
5830
5831 vinfo( 1)='Nmethod'
5832 vinfo( 2)='background error covariance normalization method'
5833 vinfo( 9)='exact'
5834 vinfo(10)='randomization'
5835 status=def_var(ng, model, piofile, piovar, pio_int, &
5836 & 1, (/0/), aval, vinfo, ncname, &
5837 & setparaccess = .false.)
5838 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5839
5840 vinfo( 1)='Rscheme'
5841 vinfo( 2)='Random number generation scheme'
5842 vinfo( 9)='intrisic_randon_number'
5843 vinfo(10)='Gaussian_distributed_deviates'
5844 status=def_var(ng, model, piofile, piovar, pio_int, &
5845 & 1, (/0/), aval, vinfo, ncname, &
5846 & setparaccess = .false.)
5847 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5848
5849 vinfo( 1)='Nrandom'
5850 vinfo( 2)='number of randomization iterations'
5851 status=def_var(ng, model, piofile, piovar, pio_int, &
5852 & 1, (/0/), aval, vinfo, ncname, &
5853 & setparaccess = .false.)
5854 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5855
5856 vinfo( 1)='Hgamma'
5857 vinfo( 2)='initial conditions error covariance '// &
5858 & 'horizontal convolution time-step stability factor'
5859 status=def_var(ng, model, piofile, piovar, pio_type, &
5860 & 1, (/0/), aval, vinfo, ncname, &
5861 & setparaccess = .false.)
5862 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5863
5864# ifdef WEAK_CONSTRAINT
5865 vinfo( 1)='HgammaM'
5866 vinfo( 2)='model error covariance '// &
5867 & 'horizontal convolution time-step stability factor'
5868 status=def_var(ng, model, piofile, piovar, pio_type, &
5869 & 1, (/0/), aval, vinfo, ncname, &
5870 & setparaccess = .false.)
5871 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5872# endif
5873
5874# ifdef ADJUST_BOUNDARY
5875 vinfo( 1)='HgammaB'
5876 vinfo( 2)='open boundary conditions error covariance '// &
5877 & 'horizontal convolution time-step stability factor'
5878 status=def_var(ng, model, piofile, piovar, pio_type, &
5879 & 1, (/0/), aval, vinfo, ncname, &
5880 & setparaccess = .false.)
5881 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5882# endif
5883
5884# ifdef ADJUST_STFLUX
5885 vinfo( 1)='HgammaF'
5886 vinfo( 2)='surface forcing error covariance '// &
5887 & 'horizontal convolution time-step stability factor'
5888 status=def_var(ng, model, piofile, piovar, pio_type, &
5889 & 1, (/0/), aval, vinfo, ncname, &
5890 & setparaccess = .false.)
5891 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5892# endif
5893
5894# ifdef SOLVE3D
5895 vinfo( 1)='Vgamma'
5896 vinfo( 2)='initial conditions error covariance '// &
5897 & 'vertical convolution time-step stability factor'
5898 status=def_var(ng, model, piofile, piovar, pio_type, &
5899 & 1, (/0/), aval, vinfo, ncname, &
5900 & setparaccess = .false.)
5901 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5902
5903# ifdef WEAK_CONSTRAINT
5904 vinfo( 1)='VgammaM'
5905 vinfo( 2)='model error covariance '// &
5906 & 'vertical convolution time-step stability factor'
5907 status=def_var(ng, model, piofile, piovar, pio_type, &
5908 & 1, (/0/), aval, vinfo, ncname, &
5909 & setparaccess = .false.)
5910 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5911# endif
5912
5913# ifdef ADJUST_BOUNDARY
5914 vinfo( 1)='VgammaB'
5915 vinfo( 2)='open boundary conditions error covariance '// &
5916 & 'vertical convolution time-step stability factor'
5917 status=def_var(ng, model, piofile, piovar, pio_type, &
5918 & 1, (/0/), aval, vinfo, ncname, &
5919 & setparaccess = .false.)
5920 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5921# endif
5922# endif
5923
5924 vinfo( 1)='Hdecay'
5925 vinfo( 2)='initial conditions error covariance '// &
5926 & 'horizontal decorrelation scale'
5927 vinfo( 3)='meter'
5928 status=def_var(ng, model, piofile, piovar, pio_type, &
5929 & 1, (/statedim/), aval, vinfo, ncname, &
5930 & setparaccess = .false.)
5931 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5932
5933# ifdef SOLVE3D
5934 vinfo( 1)='Vdecay'
5935 vinfo( 2)='initial conditions error covariance '// &
5936 & 'vertical decorrelation scale'
5937 vinfo( 3)='meter'
5938 status=def_var(ng, model, piofile, piovar, pio_type, &
5939 & 1, (/statedim/), aval, vinfo, ncname, &
5940 & setparaccess = .false.)
5941 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5942# endif
5943
5944 IF (nsa.eq.2) THEN
5945 vinfo( 1)='HdecayM'
5946 vinfo( 2)='model error covariance ' // &
5947 & 'horizontal decorrelation scale'
5948 vinfo( 3)='meter'
5949 status=def_var(ng, model, piofile, piovar, pio_type, &
5950 & 1, (/statedim/), aval, vinfo, ncname, &
5951 & setparaccess = .false.)
5952 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5953
5954# ifdef SOLVE3D
5955 vinfo( 1)='VdecayM'
5956 vinfo( 2)='model error covariance '// &
5957 & 'vertical decorrelation scale'
5958 vinfo( 3)='meter'
5959 status=def_var(ng, model, piofile, piovar, pio_type, &
5960 & 1, (/statedim/), aval, vinfo, ncname, &
5961 & setparaccess = .false.)
5962 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5963# endif
5964 END IF
5965
5966# ifdef ADJUST_BOUNDARY
5967 vinfo( 1)='HdecayB'
5968 vinfo( 2)='open boundary conditions error covariance '// &
5969 & 'horizontal decorrelation scale'
5970 vinfo( 3)='meter'
5971 status=def_var(ng, model, piofile, piovar, pio_type, &
5972 & 2, (/statedim, brydim/), aval, vinfo, ncname, &
5973 & setparaccess = .false.)
5974 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5975
5976# ifdef SOLVE3D
5977 vinfo( 1)='VdecayB'
5978 vinfo( 2)='open boundary conditions error covariance '// &
5979 & 'vertical decorrelation scale'
5980 vinfo( 3)='meter'
5981 status=def_var(ng, model, piofile, piovar, pio_type, &
5982 & 2, (/statedim, brydim/), aval, vinfo, ncname, &
5983 & setparaccess = .false.)
5984 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5985# endif
5986# endif
5987
5988# ifdef RPM_RELAXATION
5989 vinfo( 1)='tl_M2diff'
5990 vinfo( 2)='RPM 2D momentum diffusive relaxation coefficient'
5991 vinfo( 3)='meter2 second-1'
5992 status=def_var(ng, model, piofile, piovar, pio_type, &
5993 & 1, (/0/), aval, vinfo, ncname, &
5994 & setparaccess = .false.)
5995 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5996
5997# ifdef SOLVE3D
5998 vinfo( 1)='tl_M3diff'
5999 vinfo( 2)='RPM 3D momentum diffusive relaxation coefficient'
6000 vinfo( 3)='meter2 second-1'
6001 status=def_var(ng, model, piofile, piovar, pio_type, &
6002 & 1, (/0/), aval, vinfo, ncname, &
6003 & setparaccess = .false.)
6004 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6005
6006 vinfo( 1)='tl_Tdiff'
6007 vinfo( 2)='RPM tracers diffusive relaxation coefficients'
6008 vinfo( 3)='meter2 second-1'
6009 status=def_var(ng, model, piofile, piovar, pio_type, &
6010 & 1, (/trcdim/), aval, vinfo, ncname, &
6011 & setparaccess = .false.)
6012 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6013# endif
6014# endif
6015
6016# ifdef BALANCE_OPERATOR
6017# ifdef ZETA_ELLIPTIC
6018 vinfo( 1)='Nbico'
6019 vinfo( 2)='number of iterations in SSH elliptic equation'
6020 status=def_var(ng, model, piofile, piovar, pio_int, &
6021 & 1, (/0/), aval, vinfo, ncname, &
6022 & setparaccess = .false.)
6023 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6024# endif
6025
6026 vinfo( 1)='Lbalance'
6027 vinfo( 2)='switches for state variables included as '// &
6028 'constraint in the error covariance balance operator'
6029 vinfo( 9)='.FALSE.'
6030 vinfo(10)='.TRUE.'
6031 status=def_var(ng, model, piofile, piovar, pio_int, &
6032 & 1, (/statedim/), aval, vinfo, ncname, &
6033 & setparaccess = .false.)
6034 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6035
6036 vinfo( 1)='LNM_flag'
6037 vinfo( 2)='balance operator level of no motion flag'
6038 vinfo( 9)='integrate from bottom to surface,'
6039 vinfo(10)='integrate from LNM_depth to surface'
6040 status=def_var(ng, model, piofile, piovar, pio_int, &
6041 & 1, (/0/), aval, vinfo, ncname, &
6042 & setparaccess = .false.)
6043 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6044
6045 vinfo( 1)='LNM_depth'
6046 vinfo( 2)='balance operator level of no motion depth'
6047 vinfo( 3)='meter'
6048 status=def_var(ng, model, piofile, piovar, pio_type, &
6049 & 1, (/0/), aval, vinfo, ncname, &
6050 & setparaccess = .false.)
6051 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6052
6053 vinfo( 1)='dTdz_min'
6054 vinfo( 2)='minimum dT/dz value used in balaced salinity'
6055 vinfo( 3)='Celsius meter-1'
6056 status=def_var(ng, model, piofile, piovar, pio_type, &
6057 & 1, (/0/), aval, vinfo, ncname, &
6058 & setparaccess = .false.)
6059 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6060
6061 vinfo( 1)='ml_depth'
6062 vinfo( 2)='mixed layer depth used in balanced salinity'
6063 vinfo( 3)='meter'
6064 status=def_var(ng, model, piofile, piovar, pio_type, &
6065 & 1, (/0/), aval, vinfo, ncname, &
6066 & setparaccess = .false.)
6067 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6068# endif
6069
6070# ifdef STD_MODEL
6071!
6072! Background error covariance standard deviation modeling parameters.
6073!
6074 vinfo( 1)='Sigma_max'
6075 vinfo( 2)='background standard deviation, '// &
6076 & 'maximum value'
6077 vinfo( 3)='state variable units'
6078 status=def_var(ng, model, piofile, piovar, pio_type, &
6079 & 1, (/statedim/), aval, vinfo, ncname, &
6080 & setparaccess = .false.)
6081 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6082
6083 vinfo( 1)='Sigma_ml'
6084 vinfo( 2)='background standard deviation, '// &
6085 & 'maximum value at mixed layer'
6086 vinfo( 3)='state variable units'
6087 status=def_var(ng, model, piofile, piovar, pio_type, &
6088 & 1, (/statedim/), aval, vinfo, ncname, &
6089 & setparaccess = .false.)
6090 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6091
6092 vinfo( 1)='Sigma_do'
6093 vinfo( 2)='background standard deviation, '// &
6094 & 'maximum value in deep ocean'
6095 vinfo( 3)='state variable units'
6096 status=def_var(ng, model, piofile, piovar, pio_type, &
6097 & 1, (/statedim/), aval, vinfo, ncname, &
6098 & setparaccess = .false.)
6099 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6100
6101 vinfo( 1)='Sigma_dz'
6102 vinfo( 2)='background standard deviation, '// &
6103 & 'profile vertical displacement'
6104 vinfo( 3)='meter'
6105 status=def_var(ng, model, piofile, piovar, pio_type, &
6106 & 1, (/statedim/), aval, vinfo, ncname, &
6107 & setparaccess = .false.)
6108 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6109
6110# ifndef COMPUTE_MLD
6111 vinfo( 1)='mld_uniform'
6112 vinfo( 2)='constast mixed-layer depth value'
6113 vinfo( 3)='meter'
6114 status=def_var(ng, model, piofile, piovar, pio_type, &
6115 & 1, (/0/), aval, vinfo, ncname, &
6116 & setparaccess = .false.)
6117 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6118# endif
6119# endif
6120# endif
6121
6122# if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
6123 defined opt_observations || defined sensitivity_4dvar || \
6124 defined so_semi
6125!
6126! Adjoint sensitivity parameters.
6127!
6128 vinfo( 1)='Lzeta'
6129 vinfo( 2)='adjoint sensitivity on free-surface'
6130 vinfo( 9)='off'
6131 vinfo(10)='on'
6132 status=def_var(ng, model, piofile, piovar, pio_int, &
6133 & 1, (/0/), aval, vinfo, ncname, &
6134 & setparaccess = .false.)
6135 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6136
6137 vinfo( 1)='Lubar'
6138 vinfo( 2)='adjoint sensitivity on 2D U-momentum'
6139 vinfo( 9)='off'
6140 vinfo(10)='on'
6141 status=def_var(ng, model, piofile, piovar, pio_int, &
6142 & 1, (/0/), aval, vinfo, ncname, &
6143 & setparaccess = .false.)
6144 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6145
6146 vinfo( 1)='Lvbar'
6147 vinfo( 2)='adjoint sensitivity on 2D V-momentum'
6148 vinfo( 9)='off'
6149 vinfo(10)='on'
6150 status=def_var(ng, model, piofile, piovar, pio_int, &
6151 & 1, (/0/), aval, vinfo, ncname, &
6152 & setparaccess = .false.)
6153 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6154
6155# ifdef SOLVE3D
6156 vinfo( 1)='Luvel'
6157 vinfo( 2)='adjoint sensitivity on 3D U-momentum'
6158 vinfo( 9)='off'
6159 vinfo(10)='on'
6160 status=def_var(ng, model, piofile, piovar, pio_int, &
6161 & 1, (/0/), aval, vinfo, ncname, &
6162 & setparaccess = .false.)
6163 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6164
6165 vinfo( 1)='Lvvel'
6166 vinfo( 2)='adjoint sensitivity on 3D V-momentum'
6167 vinfo( 9)='off'
6168 vinfo(10)='on'
6169 status=def_var(ng, model, piofile, piovar, pio_int, &
6170 & 1, (/0/), aval, vinfo, ncname, &
6171 & setparaccess = .false.)
6172 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6173
6174 vinfo( 1)='Ltracer'
6175 vinfo( 2)='adjoint sensitivity on tracer variables'
6176 vinfo( 9)='off'
6177 vinfo(10)='on'
6178 status=def_var(ng, model, piofile, piovar, pio_int, &
6179 & 1, (/trcdim/), aval, vinfo, ncname, &
6180 & setparaccess = .false.)
6181 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6182
6183 vinfo( 1)='KstrS'
6184 vinfo( 2)='deepest level for adjoint sensitivity analysis'
6185 status=def_var(ng, model, piofile, piovar, pio_int, &
6186 & 1, (/0/), aval, vinfo, ncname, &
6187 & setparaccess = .false.)
6188 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6189
6190 vinfo( 1)='KendS'
6191 vinfo( 2)='shallowest level for adjoint sensitivity analysis'
6192 status=def_var(ng, model, piofile, piovar, pio_int, &
6193 & 1, (/0/), aval, vinfo, ncname, &
6194 & setparaccess = .false.)
6195 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6196# endif
6197# endif
6198
6199# if defined FORCING_SV || defined SO_SEMI || defined STOCHASTIC_OPT
6200!
6201! Singular Forcing Vectors or Stochastic Optimals state switches.
6202!
6203 vinfo( 1)='Fzeta'
6204# ifdef FORCING_SV
6205 vinfo( 2)='forcing singular vectors for free-surface'
6206# else
6207 vinfo( 2)='stochastic optimals for free-surface'
6208# endif
6209 vinfo( 9)='off'
6210 vinfo(10)='on'
6211 status=def_var(ng, model, piofile, piovar, pio_int, &
6212 & 1, (/0/), aval, vinfo, ncname, &
6213 & setparaccess = .false.)
6214 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6215
6216# ifndef SOLVE3D
6217 vinfo( 1)='Fubar'
6218# ifdef FORCING_SV
6219 vinfo( 2)='forcing singular vectors for 2D U-momentum'
6220# else
6221 vinfo( 2)='stochastic optimals for 2D U-momentum'
6222# endif
6223 vinfo( 9)='off'
6224 vinfo(10)='on'
6225 status=def_var(ng, model, piofile, piovar, pio_int, &
6226 & 1, (/0/), aval, vinfo, ncname, &
6227 & setparaccess = .false.)
6228 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6229
6230 vinfo( 1)='Fvbar'
6231# ifdef FORCING_SV
6232 vinfo( 2)='forcing singular vectors for 2D V-momentum'
6233# else
6234 vinfo( 2)='stochastic optimals for 2D V-momentum'
6235# endif
6236 vinfo( 9)='off'
6237 vinfo(10)='on'
6238 status=def_var(ng, model, piofile, piovar, pio_int, &
6239 & 1, (/0/), aval, vinfo, ncname, &
6240 & setparaccess = .false.)
6241 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6242
6243# else
6244
6245 vinfo( 1)='Fuvel'
6246# ifdef FORCING_SV
6247 vinfo( 2)='forcing singular vectors for 3D U-momentum'
6248# else
6249 vinfo( 2)='stochastic optimals for 3D U-momentum'
6250# endif
6251 vinfo( 9)='off'
6252 vinfo(10)='on'
6253 status=def_var(ng, model, piofile, piovar, pio_int, &
6254 & 1, (/0/), aval, vinfo, ncname, &
6255 & setparaccess = .false.)
6256 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6257
6258 vinfo( 1)='Fvvel'
6259# ifdef FORCING_SV
6260 vinfo( 2)='forcing singular vectors for 3D V-momentum'
6261# else
6262 vinfo( 2)='stochastic optimals for 3D V-momentum'
6263# endif
6264 vinfo( 9)='off'
6265 vinfo(10)='on'
6266 status=def_var(ng, model, piofile, piovar, pio_int, &
6267 & 1, (/0/), aval, vinfo, ncname, &
6268 & setparaccess = .false.)
6269 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6270
6271 vinfo( 1)='Ftracer'
6272# ifdef FORCING_SV
6273 vinfo( 2)='forcing singular vectors for tracer variables'
6274# else
6275 vinfo( 2)='stochastic optimals for tracer variables'
6276# endif
6277 vinfo( 9)='off'
6278 vinfo(10)='on'
6279 status=def_var(ng, model, piofile, piovar, pio_int, &
6280 & 1, (/trcdim/), aval, vinfo, ncname, &
6281 & setparaccess = .false.)
6282 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6283# endif
6284
6285 vinfo( 1)='Fsustr'
6286# ifdef FORCING_SV
6287 vinfo( 2)='forcing singular vectors for surface U-stress'
6288# else
6289 vinfo( 2)='stochastic optimals for surface U-stress'
6290# endif
6291 vinfo( 9)='off'
6292 vinfo(10)='on'
6293 status=def_var(ng, model, piofile, piovar, pio_int, &
6294 & 1, (/0/), aval, vinfo, ncname, &
6295 & setparaccess = .false.)
6296 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6297
6298 vinfo( 1)='Fsvstr'
6299# ifdef FORCING_SV
6300 vinfo( 2)='forcing singular vectors for surface V-stress'
6301# else
6302 vinfo( 2)='stochastic optimals for surface V-stress'
6303# endif
6304 vinfo( 9)='off'
6305 vinfo(10)='on'
6306 status=def_var(ng, model, piofile, piovar, pio_int, &
6307 & 1, (/0/), aval, vinfo, ncname, &
6308 & setparaccess = .false.)
6309 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6310
6311# ifdef SOLVE3D
6312 vinfo( 1)='Fstflx'
6313# ifdef FORCING_SV
6314 vinfo( 2)='forcing singular vectors for surface tracer flux'
6315# else
6316 vinfo( 2)='stochastic optimals for surface tracer flux'
6317# endif
6318 vinfo( 9)='off'
6319 vinfo(10)='on'
6320 status=def_var(ng, model, piofile, piovar, pio_int, &
6321 & 1, (/trcdim/), aval, vinfo, ncname, &
6322 & setparaccess = .false.)
6323 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6324# endif
6325# endif
6326
6327# ifdef SO_SEMI
6328!
6329! Define Stochatic optimals parameters.
6330!
6331# ifndef SO_SEMI_WHITE
6332 vinfo( 1)='SO_decay'
6333 vinfo( 2)='red noise stochastic optimals time decorrelation'
6334 vinfo( 3)='day'
6335 status=def_var(ng, model, piofile, piovar, pio_type, &
6336 & 1, (/0/), aval, vinfo, ncname, &
6337 & setparaccess = .false.)
6338 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6339# endif
6340
6341 vinfo( 1)='SO_trace'
6342 vinfo( 2)='trace of stochastic optimals matrix'
6343 status=def_var(ng, model, piofile, piovar, pio_type, &
6344 & 1, (/0/), aval, vinfo, ncname, &
6345 & setparaccess = .false.)
6346 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6347
6348 vinfo( 1)='SOsdev_zeta'
6349 vinfo( 2)='stochastic optimals scale, free-surface'
6350 status=def_var(ng, model, piofile, piovar, pio_type, &
6351 & 1, (/0/), aval, vinfo, ncname, &
6352 & setparaccess = .false.)
6353 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6354
6355# ifndef SOLVE3D
6356 vinfo( 1)='SOsdev_ubar'
6357 vinfo( 2)='stochastic optimals scale, 2D U-momentum'
6358 status=def_var(ng, model, piofile, piovar, pio_type, &
6359 & 1, (/0/), aval, vinfo, ncname, &
6360 & setparaccess = .false.)
6361 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6362
6363 vinfo( 1)='SOsdev_vbar'
6364 vinfo( 2)='stochastic optimals scale, 2D V-momentum'
6365 status=def_var(ng, model, piofile, piovar, pio_type, &
6366 & 1, (/0/), aval, vinfo, ncname, &
6367 & setparaccess = .false.)
6368 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6369
6370# else
6371
6372 vinfo( 1)='SOsdev_uvel'
6373 vinfo( 2)='stochastic optimals scale, 3D U-momentum'
6374 status=def_var(ng, model, piofile, piovar, pio_type, &
6375 & 1, (/0/), aval, vinfo, ncname, &
6376 & setparaccess = .false.)
6377 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6378
6379 vinfo( 1)='SOsdev_vvel'
6380 vinfo( 2)='stochastic optimals scale, 3D V-momentum'
6381 status=def_var(ng, model, piofile, piovar, pio_type, &
6382 & 1, (/0/), aval, vinfo, ncname, &
6383 & setparaccess = .false.)
6384 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6385
6386 vinfo( 1)='SOsdev_tracer'
6387 vinfo( 2)='stochastic optimals scale, tracer variables'
6388 status=def_var(ng, model, piofile, piovar, pio_type, &
6389 & 1, (/trcdim/), aval, vinfo, ncname, &
6390 & setparaccess = .false.)
6391 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6392# endif
6393
6394 vinfo( 1)='SOsdev_sustr'
6395 vinfo( 2)='stochastic optimals scale, surface U-stress'
6396 status=def_var(ng, model, piofile, piovar, pio_type, &
6397 & 1, (/0/), aval, vinfo, ncname, &
6398 & setparaccess = .false.)
6399 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6400
6401 vinfo( 1)='SOsdev_svstr'
6402 vinfo( 2)='stochastic optimals scale, surface V-stress'
6403 status=def_var(ng, model, piofile, piovar, pio_type, &
6404 & 1, (/0/), aval, vinfo, ncname, &
6405 & setparaccess = .false.)
6406 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6407
6408# ifdef SOLVE3D
6409 vinfo( 1)='SOsdev_stflx'
6410 vinfo( 2)='stochastic optimals scale, surface tracer flux'
6411 status=def_var(ng, model, piofile, piovar, pio_type, &
6412 & 1, (/trcdim/), aval, vinfo, ncname, &
6413 & setparaccess = .false.)
6414 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6415# endif
6416# endif
6417
6418# if defined BIOLOGY && defined SOLVE3D
6419# if defined BIO_FENNEL
6420# include <fennel_def_pio.h>
6421# elif defined ECOSIM
6422# include <ecosim_def_pio.h>
6423# elif defined HYPOXIA_SRM
6424# include <hypoxia_srm_def_pio.h>
6425# elif defined NEMURO
6426# include <nemuro_def_pio.h>
6427# elif defined NPZD_FRANKS
6428# include <npzd_Franks_def_pio.h>
6429# elif defined NPZD_IRON
6430# include <npzd_iron_def_pio.h>
6431# elif defined NPZD_POWELL
6432# include <npzd_Powell_def_pio.h>
6433# elif defined RED_TIDE
6434# include <red_tide_def_pio.h>
6435# endif
6436# endif
6437
6438# if defined FLOATS && defined FLOAT_BIOLOGY
6439# if defined FLOAT_OYSTER
6440# include <oyster_floats_def_pio.h>
6441# endif
6442# endif
6443
6444# ifdef SEDIMENT
6445# include <sediment_def_pio.h>
6446# endif
6447!
6448!-----------------------------------------------------------------------
6449! Define grid variables.
6450!-----------------------------------------------------------------------
6451!
6452! Grid type switch: Spherical or Cartesian. Writing characters in
6453! parallel I/O is extremely inefficient. It is better to write
6454! this as an integer switch: 0=Cartesian, 1=spherical.
6455!
6456 vinfo( 1)='spherical'
6457 vinfo( 2)='grid type logical switch'
6458 vinfo( 9)='Cartesian'
6459 vinfo(10)='spherical'
6460 status=def_var(ng, model, piofile, piovar, pio_int, &
6461 & 1, (/0/), aval, vinfo, ncname, &
6462 & setparaccess = .false.)
6463 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6464!
6465! Domain Length.
6466!
6467 vinfo( 1)='xl'
6468 vinfo( 2)='domain length in the XI-direction'
6469 vinfo( 3)='meter'
6470 status=def_var(ng, model, piofile, piovar, pio_type, &
6471 & 1, (/0/), aval, vinfo, ncname, &
6472 & setparaccess = .false.)
6473 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6474
6475 vinfo( 1)='el'
6476 vinfo( 2)='domain length in the ETA-direction'
6477 vinfo( 3)='meter'
6478 status=def_var(ng, model, piofile, piovar, pio_type, &
6479 & 1, (/0/), aval, vinfo, ncname, &
6480 & setparaccess = .false.)
6481 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6482# ifdef SOLVE3D
6483!
6484! S-coordinate parameters.
6485!
6486 vinfo( 1)='Vtransform'
6487 vinfo( 2)='vertical terrain-following transformation equation'
6488 status=def_var(ng, model, piofile, piovar, pio_int, &
6489 & 1, (/0/), aval, vinfo, ncname, &
6490 & setparaccess = .false.)
6491 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6492
6493 vinfo( 1)='Vstretching'
6494 vinfo( 2)='vertical terrain-following stretching function'
6495 status=def_var(ng, model, piofile, piovar, pio_int, &
6496 & 1, (/0/), aval, vinfo, ncname, &
6497 & setparaccess = .false.)
6498 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6499
6500 vinfo( 1)='theta_s'
6501 vinfo( 2)='S-coordinate surface control parameter'
6502 status=def_var(ng, model, piofile, piovar, pio_tout, &
6503 & 1, (/0/), aval, vinfo, ncname, &
6504 & setparaccess = .false.)
6505 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6506
6507 vinfo( 1)='theta_b'
6508 vinfo( 2)='S-coordinate bottom control parameter'
6509 status=def_var(ng, model, piofile, piovar, pio_tout, &
6510 & 1, (/0/), aval, vinfo, ncname, &
6511 & setparaccess = .false.)
6512 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6513
6514 vinfo( 1)='Tcline'
6515 vinfo( 2)='S-coordinate surface/bottom layer width'
6516 vinfo( 3)='meter'
6517 status=def_var(ng, model, piofile, piovar, pio_tout, &
6518 & 1, (/0/), aval, vinfo, ncname, &
6519 & setparaccess = .false.)
6520 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6521
6522 vinfo( 1)='hc'
6523 vinfo( 2)='S-coordinate parameter, critical depth'
6524 vinfo( 3)='meter'
6525 status=def_var(ng, model, piofile, piovar, pio_tout, &
6526 & 1, (/0/), aval, vinfo, ncname, &
6527 & setparaccess = .false.)
6528 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6529!
6530! SGRID conventions for staggered data on structured grids.
6531!
6532 vinfo( 1)='grid'
6533 status=def_var(ng, model, piofile, piovar, pio_int, &
6534 & 1, (/0/), aval, vinfo, ncname, &
6535 & setparaccess = .false.)
6536 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6537!
6538! S-coordinate non-dimensional independent variable at RHO-points.
6539!
6540 vinfo( 1)='s_rho'
6541 vinfo( 2)='S-coordinate at RHO-points'
6542 vinfo( 5)='valid_min'
6543 vinfo( 6)='valid_max'
6544 IF (vtransform(ng).eq.1) THEN
6545 vinfo(21)='ocean_s_coordinate_g1'
6546 ELSE IF (vtransform(ng).eq.2) THEN
6547 vinfo(21)='ocean_s_coordinate_g2'
6548 END IF
6549# if defined SEDIMENT && defined SED_MORPH
6550 vinfo(23)='s: s_rho C: Cs_r eta: zeta depth: bath depth_c: hc'
6551# else
6552 vinfo(23)='s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc'
6553# endif
6554 vinfo(25)='up'
6555 aval(2)=-1.0_r8
6556 aval(3)=0.0_r8
6557 status=def_var(ng, model, piofile, piovar, pio_tout, &
6558 & 1, (/srdim/), aval, vinfo, ncname, &
6559 & setparaccess = .false.)
6560 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6561!
6562! S-coordinate non-dimensional independent variable at W-points.
6563!
6564 vinfo( 1)='s_w'
6565 vinfo( 2)='S-coordinate at W-points'
6566 vinfo( 5)='valid_min'
6567 vinfo( 6)='valid_max'
6568 vinfo(21)='ocean_s_coordinate'
6569 IF (vtransform(ng).eq.1) THEN
6570 vinfo(21)='ocean_s_coordinate_g1'
6571 ELSE IF (vtransform(ng).eq.2) THEN
6572 vinfo(21)='ocean_s_coordinate_g2'
6573 END IF
6574# if defined SEDIMENT && defined SED_MORPH
6575 vinfo(23)='s: s_w C: Cs_w eta: zeta depth: bath depth_c: hc'
6576# else
6577 vinfo(23)='s: s_w C: Cs_w eta: zeta depth: h depth_c: hc'
6578# endif
6579 vinfo(25)='up'
6580 aval(2)=-1.0_r8
6581 aval(3)=0.0_r8
6582 status=def_var(ng, model, piofile, piovar, pio_tout, &
6583 & 1, (/swdim/), aval, vinfo, ncname, &
6584 & setparaccess = .false.)
6585 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6586!
6587! S-coordinate non-dimensional stretching curves at RHO-points.
6588!
6589 vinfo( 1)='Cs_r'
6590 vinfo( 2)='S-coordinate stretching curves at RHO-points'
6591 vinfo( 5)='valid_min'
6592 vinfo( 6)='valid_max'
6593 aval(2)=-1.0_r8
6594 aval(3)=0.0_r8
6595 status=def_var(ng, model, piofile, piovar, pio_tout, &
6596 & 1, (/srdim/), aval, vinfo, ncname, &
6597 & setparaccess = .false.)
6598 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6599!
6600! S-coordinate non-dimensional stretching curves at W-points.
6601!
6602 vinfo( 1)='Cs_w'
6603 vinfo( 2)='S-coordinate stretching curves at W-points'
6604 vinfo( 5)='valid_min'
6605 vinfo( 6)='valid_max'
6606 aval(2)=-1.0_r8
6607 aval(3)=0.0_r8
6608 status=def_var(ng, model, piofile, piovar, pio_tout, &
6609 & 1, (/swdim/), aval, vinfo, ncname, &
6610 & setparaccess = .false.)
6611 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6612# endif
6613!
6614! User generic parameters.
6615!
6616 IF (nuser.gt.0) THEN
6617 vinfo( 1)='user'
6618 vinfo( 2)='user generic parameters'
6619 vinfo(24)='_FillValue'
6620 aval(6)=spval
6621 status=def_var(ng, model, piofile, piovar, pio_type, &
6622 & 1, (/usrdim/), aval, vinfo, ncname, &
6623 & setparaccess = .false.)
6624 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6625 END IF
6626# ifdef STATIONS
6627!
6628! Station positions.
6629!
6630 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6631 vinfo( 1)='Ipos'
6632 vinfo( 2)='stations I-direction positions'
6633 status=def_var(ng, model, piofile, piovar, pio_type, &
6634 & 1, (/stadim/), aval, vinfo, ncname, &
6635 & setparaccess = .false.)
6636 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6637
6638 vinfo( 1)='Jpos'
6639 vinfo( 2)='stations J-direction positions'
6640 status=def_var(ng, model, piofile, piovar, pio_type, &
6641 & 1, (/stadim/), aval, vinfo, ncname, &
6642 & setparaccess = .false.)
6643 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6644 END IF
6645# endif
6646# ifdef NO_WRITE_GRID
6647 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6648# else
6649 IF (fileh.ne.abs(flt(ng)%pioFile%fh)) THEN
6650# endif
6651# if !(defined SED_MORPH && defined SEDIMENT)
6652!
6653! Bathymetry.
6654!
6655 vinfo( 1)=vname(1,idtopo)
6656 vinfo( 2)=vname(2,idtopo)
6657 vinfo( 3)=vname(3,idtopo)
6658 vinfo(14)=vname(4,idtopo)
6659 vinfo(21)=vname(6,idtopo)
6660 vinfo(22)='coordinates'
6661 aval(5)=real(iinfo(1,idtopo,ng),r8)
6662 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6663 status=def_var(ng, model, piofile, piovar, pio_type, &
6664 & 1, (/stadim/), aval, vinfo, ncname)
6665 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6666 ELSE
6667 status=def_var(ng, model, piofile, piovar, pio_type, &
6668 & 2, t2dgrd, aval, vinfo, ncname)
6669 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6670 END IF
6671# endif
6672!
6673! Coriolis Parameter.
6674!
6675 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6676 vinfo( 1)=vname(1,idfcor)
6677 vinfo( 2)=vname(2,idfcor)
6678 vinfo( 3)=vname(3,idfcor)
6679 vinfo(14)=vname(4,idfcor)
6680 vinfo(21)=vname(6,idfcor)
6681 vinfo(22)='coordinates'
6682 aval(5)=real(iinfo(1,idfcor,ng),r8)
6683 status=def_var(ng, model, piofile, piovar, pio_type, &
6684 & 2, t2dgrd, aval, vinfo, ncname)
6685 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6686 END IF
6687!
6688! Curvilinear coordinate metrics.
6689!
6690 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6691 vinfo( 1)=vname(1,idpmdx)
6692 vinfo( 2)=vname(2,idpmdx)
6693 vinfo( 3)=vname(3,idpmdx)
6694 vinfo(14)=vname(4,idpmdx)
6695 vinfo(21)=vname(6,idpmdx)
6696 vinfo(22)='coordinates'
6697 aval(5)=real(iinfo(1,idpmdx,ng),r8)
6698 status=def_var(ng, model, piofile, piovar, pio_type, &
6699 & 2, t2dgrd, aval, vinfo, ncname)
6700 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6701!
6702 vinfo( 1)=vname(1,idpndy)
6703 vinfo( 2)=vname(2,idpndy)
6704 vinfo( 3)=vname(3,idpndy)
6705 vinfo(14)=vname(4,idpndy)
6706 vinfo(21)=vname(6,idpndy)
6707 vinfo(22)='coordinates'
6708 aval(5)=real(iinfo(1,idpndy,ng),r8)
6709 status=def_var(ng, model, piofile, piovar, pio_type, &
6710 & 2, t2dgrd, aval, vinfo, ncname)
6711 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6712 END IF
6713!
6714! Grid coordinates of RHO-points.
6715!
6716 IF (spherical) THEN
6717 vinfo( 1)=vname(1,idlonr)
6718 vinfo( 2)=vname(2,idlonr)
6719 vinfo( 3)=vname(3,idlonr)
6720 vinfo(14)=vname(4,idlonr)
6721 vinfo(21)=vname(6,idlonr)
6722 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6723 status=def_var(ng, model, piofile, piovar, pio_type, &
6724 & 1, (/stadim/), aval, vinfo, ncname)
6725 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6726 ELSE
6727 status=def_var(ng, model, piofile, piovar, pio_type, &
6728 & 2, t2dgrd, aval, vinfo, ncname)
6729 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6730 END IF
6731!
6732 vinfo( 1)=vname(1,idlatr)
6733 vinfo( 2)=vname(2,idlatr)
6734 vinfo( 3)=vname(3,idlatr)
6735 vinfo(14)=vname(4,idlatr)
6736 vinfo(21)=vname(6,idlatr)
6737 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6738 status=def_var(ng, model, piofile, piovar, pio_type, &
6739 & 1, (/stadim/), aval, vinfo, ncname)
6740 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6741 ELSE
6742 status=def_var(ng, model, piofile, piovar, pio_type, &
6743 & 2, t2dgrd, aval, vinfo, ncname)
6744 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6745 END IF
6746 ELSE
6747 vinfo( 1)=vname(1,idxgrr)
6748 vinfo( 2)=vname(2,idxgrr)
6749 vinfo( 3)=vname(3,idxgrr)
6750 vinfo(14)=vname(4,idxgrr)
6751 vinfo(21)=vname(6,idxgrr)
6752 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6753 status=def_var(ng, model, piofile, piovar, pio_type, &
6754 & 1, (/stadim/), aval, vinfo, ncname)
6755 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6756 ELSE
6757 status=def_var(ng, model, piofile, piovar, pio_type, &
6758 & 2, t2dgrd, aval, vinfo, ncname)
6759 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6760 END IF
6761!
6762 vinfo( 1)=vname(1,idygrr)
6763 vinfo( 2)=vname(2,idygrr)
6764 vinfo( 3)=vname(3,idygrr)
6765 vinfo(14)=vname(4,idygrr)
6766 vinfo(21)=vname(6,idygrr)
6767 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6768 status=def_var(ng, model, piofile, piovar, pio_type, &
6769 & 1, (/stadim/), aval, vinfo, ncname)
6770 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6771 ELSE
6772 status=def_var(ng, model, piofile, piovar, pio_type, &
6773 & 2, t2dgrd, aval, vinfo, ncname)
6774 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6775 END IF
6776 END IF
6777!
6778! Grid coordinates of U-points.
6779!
6780 IF (spherical) THEN
6781 vinfo( 1)=vname(1,idlonu)
6782 vinfo( 2)=vname(2,idlonu)
6783 vinfo( 3)=vname(3,idlonu)
6784 vinfo(14)=vname(4,idlonu)
6785 vinfo(21)=vname(6,idlonu)
6786 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6787 status=def_var(ng, model, piofile, piovar, pio_type, &
6788 & 2, u2dgrd, aval, vinfo, ncname)
6789 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6790 END IF
6791!
6792 vinfo( 1)=vname(1,idlatu)
6793 vinfo( 2)=vname(2,idlatu)
6794 vinfo( 3)=vname(3,idlatu)
6795 vinfo(14)=vname(4,idlatu)
6796 vinfo(21)=vname(6,idlatu)
6797 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6798 status=def_var(ng, model, piofile, piovar, pio_type, &
6799 & 2, u2dgrd, aval, vinfo, ncname)
6800 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6801 END IF
6802 ELSE
6803 vinfo( 1)=vname(1,idxgru)
6804 vinfo( 2)=vname(2,idxgru)
6805 vinfo( 3)=vname(3,idxgru)
6806 vinfo(14)=vname(4,idxgru)
6807 vinfo(21)=vname(6,idxgru)
6808 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6809 status=def_var(ng, model, piofile, piovar, pio_type, &
6810 & 2, u2dgrd, aval, vinfo, ncname)
6811 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6812 END IF
6813!
6814 vinfo( 1)=vname(1,idygru)
6815 vinfo( 2)=vname(2,idygru)
6816 vinfo( 3)=vname(3,idygru)
6817 vinfo(14)=vname(4,idygru)
6818 vinfo(21)=vname(6,idygru)
6819 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6820 status=def_var(ng, model, piofile, piovar, pio_type, &
6821 & 2, u2dgrd, aval, vinfo, ncname)
6822 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6823 END IF
6824 END IF
6825!
6826! Grid coordinates of V-points.
6827!
6828 IF (spherical) THEN
6829 vinfo( 1)=vname(1,idlonv)
6830 vinfo( 2)=vname(2,idlonv)
6831 vinfo( 3)=vname(3,idlonv)
6832 vinfo(14)=vname(4,idlonv)
6833 vinfo(21)=vname(6,idlonv)
6834 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6835 status=def_var(ng, model, piofile, piovar, pio_type, &
6836 & 2, v2dgrd, aval, vinfo, ncname)
6837 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6838 END IF
6839!
6840 vinfo( 1)=vname(1,idlatv)
6841 vinfo( 2)=vname(2,idlatv)
6842 vinfo( 3)=vname(3,idlatv)
6843 vinfo(14)=vname(4,idlatv)
6844 vinfo(21)=vname(6,idlatv)
6845 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6846 status=def_var(ng, model, piofile, piovar, pio_type, &
6847 & 2, v2dgrd, aval, vinfo, ncname)
6848 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6849 END IF
6850 ELSE
6851 vinfo( 1)=vname(1,idxgrv)
6852 vinfo( 2)=vname(2,idxgrv)
6853 vinfo( 3)=vname(3,idxgrv)
6854 vinfo(14)=vname(4,idxgrv)
6855 vinfo(21)=vname(6,idxgrv)
6856 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6857 status=def_var(ng, model, piofile, piovar, pio_type, &
6858 & 2, v2dgrd, aval, vinfo, ncname)
6859 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6860 END IF
6861!
6862 vinfo( 1)=vname(1,idygrv)
6863 vinfo( 2)=vname(2,idygrv)
6864 vinfo( 3)=vname(3,idygrv)
6865 vinfo(14)=vname(4,idygrv)
6866 vinfo(21)=vname(6,idygrv)
6867 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6868 status=def_var(ng, model, piofile, piovar, pio_type, &
6869 & 2, v2dgrd, aval, vinfo, ncname)
6870 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6871 END IF
6872 END IF
6873!
6874! Grid coordinates of PSI-points.
6875!
6876 IF (spherical) THEN
6877 vinfo( 1)=vname(1,idlonp)
6878 vinfo( 2)=vname(2,idlonp)
6879 vinfo( 3)=vname(3,idlonp)
6880 vinfo(14)=vname(4,idlonp)
6881 vinfo(21)=vname(6,idlonp)
6882 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6883 status=def_var(ng, model, piofile, piovar, pio_type, &
6884 & 2, p2dgrd, aval, vinfo, ncname)
6885 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6886 END IF
6887!
6888 vinfo( 1)=vname(1,idlatp)
6889 vinfo( 2)=vname(2,idlatp)
6890 vinfo( 3)=vname(3,idlatp)
6891 vinfo(14)=vname(4,idlatp)
6892 vinfo(21)=vname(6,idlatp)
6893 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6894 status=def_var(ng, model, piofile, piovar, pio_type, &
6895 & 2, p2dgrd, aval, vinfo, ncname)
6896 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6897 END IF
6898 ELSE
6899 vinfo( 1)=vname(1,idxgrp)
6900 vinfo( 2)=vname(2,idxgrp)
6901 vinfo( 3)=vname(3,idxgrp)
6902 vinfo(14)=vname(4,idxgrp)
6903 vinfo(21)=vname(6,idxgrp)
6904 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6905 status=def_var(ng, model, piofile, piovar, pio_type, &
6906 & 2, p2dgrd, aval, vinfo, ncname)
6907 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6908 END IF
6909!
6910 vinfo( 1)=vname(1,idygrp)
6911 vinfo( 2)=vname(2,idygrp)
6912 vinfo( 3)=vname(3,idygrp)
6913 vinfo(14)=vname(4,idygrp)
6914 vinfo(21)=vname(6,idygrp)
6915 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6916 status=def_var(ng, model, piofile, piovar, pio_type, &
6917 & 2, p2dgrd, aval, vinfo, ncname)
6918 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6919 END IF
6920 END IF
6921
6922# ifdef CURVGRID
6923!
6924! Angle between XI-axis and EAST at RHO-points.
6925!
6926 vinfo( 1)=vname(1,idangr)
6927 vinfo( 2)=vname(2,idangr)
6928 vinfo( 3)=vname(3,idangr)
6929 vinfo(14)=vname(4,idangr)
6930 vinfo(21)=vname(6,idangr)
6931 vinfo(22)='coordinates'
6932 aval(5)=real(iinfo(1,idangr,ng),r8)
6933 IF (fileh.eq.abs(sta(ng)%pioFile%fh)) THEN
6934 status=def_var(ng, model, piofile, piovar, pio_type, &
6935 & 1, (/stadim/), aval, vinfo, ncname)
6936 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6937 ELSE
6938 status=def_var(ng, model, piofile, piovar, pio_type, &
6939 & 2, t2dgrd, aval, vinfo, ncname)
6940 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6941 END IF
6942# endif
6943# ifdef MASKING
6944!
6945! Masking fields at RHO-, U-, V-points, and PSI-points.
6946!
6947 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6948 vinfo( 1)=vname(1,idmskr)
6949 vinfo( 2)=vname(2,idmskr)
6950 vinfo( 9)='land'
6951 vinfo(10)='water'
6952 vinfo(21)=vname(6,idmskr)
6953 vinfo(22)='coordinates'
6954 aval(5)=real(iinfo(1,idmskr,ng),r8)
6955 status=def_var(ng, model, piofile, piovar, pio_type, &
6956 & 2, t2dgrd, aval, vinfo, ncname)
6957 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6958!
6959 vinfo( 1)=vname(1,idmsku)
6960 vinfo( 2)=vname(2,idmsku)
6961 vinfo( 9)='land'
6962 vinfo(10)='water'
6963 vinfo(21)=vname(6,idmsku)
6964 vinfo(22)='coordinates'
6965 aval(5)=real(iinfo(1,idmsku,ng),r8)
6966 status=def_var(ng, model, piofile, piovar, pio_type, &
6967 & 2, u2dgrd, aval, vinfo, ncname)
6968 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6969!
6970 vinfo( 1)=vname(1,idmskv)
6971 vinfo( 2)=vname(2,idmskv)
6972 vinfo( 9)='land'
6973 vinfo(10)='water'
6974 vinfo(21)=vname(6,idmskv)
6975 status=def_var(ng, model, piofile, piovar, pio_type, &
6976 & 2, v2dgrd, aval, vinfo, ncname)
6977 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6978!
6979 vinfo( 1)=vname(1,idmskp)
6980 vinfo( 2)=vname(2,idmskp)
6981 vinfo( 9)='land'
6982 vinfo(10)='water'
6983 vinfo(21)=vname(6,idmskp)
6984 vinfo(22)='coordinates'
6985 aval(5)=real(iinfo(1,idmskp,ng),r8)
6986 status=def_var(ng, model, piofile, piovar, pio_type, &
6987 & 2, p2dgrd, aval, vinfo, ncname)
6988 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
6989 END IF
6990# endif
6991# if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
6992 defined opt_observations || defined sensitivity_4dvar || \
6993 defined so_semi
6994!
6995! Adjoint sensitivity spatial scope mask at RHO-, U-, and V-points.
6996!
6997 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
6998 vinfo( 1)=vname(1,idscor)
6999 vinfo( 2)=vname(2,idscor)
7000 vinfo( 9)='inactive'
7001 vinfo(10)='active'
7002 vinfo(21)=vname(6,idscor)
7003 vinfo(22)='coordinates'
7004 aval(5)=real(iinfo(1,idscor,ng),r8)
7005 status=def_var(ng, model, piofile, piovar, pio_type, &
7006 & 2, t2dgrd, aval, vinfo, ncname)
7007 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7008!
7009 vinfo( 1)=vname(1,idscou)
7010 vinfo( 2)=vname(2,idscou)
7011 vinfo( 9)='inactive'
7012 vinfo(10)='active'
7013 vinfo(21)=vname(6,idscou)
7014 vinfo(22)='coordinates'
7015 aval(5)=real(iinfo(1,idscou,ng),r8)
7016 status=def_var(ng, model, piofile, piovar, pio_type, &
7017 & 2, u2dgrd, aval, vinfo, ncname)
7018 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7019!
7020 vinfo( 1)=vname(1,idscov)
7021 vinfo( 2)=vname(2,idscov)
7022 vinfo( 9)='inactive'
7023 vinfo(10)='active'
7024 vinfo(21)=vname(6,idscov)
7025 vinfo(22)='coordinates'
7026 aval(5)=real(iinfo(1,idscov,ng),r8)
7027 status=def_var(ng, model, piofile, piovar, pio_type, &
7028 & 2, v2dgrd, aval, vinfo, ncname)
7029 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7030 END IF
7031# endif
7032# ifdef UV_DRAG_GRID
7033!
7034! Spatially varying bottom friction parameter.
7035!
7036 IF (fileh.ne.abs(sta(ng)%pioFile%fh)) THEN
7037# if defined UV_LOGDRAG || defined BBL_MODEL
7038 vinfo( 1)=vname(1,idzobl)
7039 vinfo( 2)=vname(2,idzobl)
7040 vinfo( 3)=vname(3,idzobl)
7041 vinfo(14)=vname(4,idzobl)
7042 vinfo(21)=vname(6,idzobl)
7043 vinfo(22)='coordinates'
7044 aval(5)=real(iinfo(1,idzobl,ng),r8)
7045 status=def_var(ng, model, piofile, piovar, pio_type, &
7046 & 2, t2dgrd, aval, vinfo, ncname)
7047 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7048# endif
7049# ifdef UV_LDRAG
7050 vinfo( 1)=vname(1,idragl)
7051 vinfo( 2)=vname(2,idragl)
7052 vinfo( 3)=vname(3,idragl)
7053 vinfo(14)=vname(4,idragl)
7054 vinfo(21)=vname(6,idragl)
7055 vinfo(22)='coordinates'
7056 aval(5)=real(iinfo(1,idragl,ng),r8)
7057 status=def_var(ng, model, piofile, piovar, pio_type, &
7058 & 2, t2dgrd, aval, vinfo, ncname)
7059 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7060# endif
7061# ifdef UV_QDRAG
7062 vinfo( 1)=vname(1,idragq)
7063 vinfo( 2)=vname(2,idragq)
7064 vinfo( 3)=vname(3,idragq)
7065 vinfo(14)=vname(4,idragq)
7066 vinfo(21)=vname(6,idragq)
7067 vinfo(22)='coordinates'
7068 aval(5)=real(iinfo(1,idragq,ng),r8)
7069 status=def_var(ng, model, piofile, piovar, pio_type, &
7070 & 2, t2dgrd, aval, vinfo, ncname)
7071 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
7072# endif
7073 END IF
7074# endif
7075 END IF
7076!
7077 10 FORMAT (i0,'x',i0)
7078 20 FORMAT (/,' DEF_INFO_PIO - error while creating global', &
7079 & ' attribute: ',a,/,16x,a)
7080 30 FORMAT (a,i2.2)
7081!
7082 RETURN
integer, parameter pio_type
integer, parameter pio_tout

References mod_param::ad_hadvection, mod_param::ad_lbc, mod_param::ad_vadvection, mod_iounits::adm, mod_iounits::ads, mod_ncparam::ananame, mod_iounits::aparnam, mod_iounits::avg, mod_iounits::bparnam, mod_iounits::bry, mod_iounits::clm, mod_strings::coptions, mod_ncparam::date_str, mod_iounits::dia, mod_iounits::err, mod_scalars::exit_flag, mod_iounits::fcta, mod_iounits::fctb, mod_iounits::flt, strings_mod::founderror(), mod_iounits::fposnam, mod_iounits::frc, mod_iounits::fwd, mod_ncparam::git_rev, mod_ncparam::git_url, mod_iounits::grd, mod_iounits::gst, mod_param::hadvection, mod_iounits::har, mod_strings::hdir, mod_strings::hfile, mod_iounits::his, mod_ncparam::history, mod_iounits::hss, mod_iounits::iad, mod_ncparam::idangr, mod_ncparam::idfcor, mod_ncparam::idlatp, mod_ncparam::idlatr, mod_ncparam::idlatu, mod_ncparam::idlatv, mod_ncparam::idlonp, mod_ncparam::idlonr, mod_ncparam::idlonu, mod_ncparam::idlonv, mod_ncparam::idmskp, mod_ncparam::idmskr, mod_ncparam::idmsku, mod_ncparam::idmskv, mod_ncparam::idpmdx, mod_ncparam::idpndy, mod_ncparam::idragl, mod_ncparam::idragq, mod_ncparam::idscor, mod_ncparam::idscou, mod_ncparam::idscov, mod_ncparam::idsvar, mod_ncparam::idtopo, mod_ncparam::idxgrp, mod_ncparam::idxgrr, mod_ncparam::idxgru, mod_ncparam::idxgrv, mod_ncparam::idygrp, mod_ncparam::idygrr, mod_ncparam::idygru, mod_ncparam::idygrv, mod_ncparam::idzobl, mod_ncparam::iinfo, mod_iounits::iname, mod_iounits::ini, mod_iounits::ioerror, mod_iounits::itl, strings_mod::join_string(), mod_param::lbc, mod_scalars::lclimatology, mod_scalars::lcyclerst, mod_iounits::lcz, mod_scalars::ldefhis, mod_scalars::lnudging, mod_fourdvar::lprecond, mod_scalars::lprocesstides, mod_scalars::ltracersrc, mod_scalars::luvsrc, mod_scalars::lwsrc, mod_iounits::lze, mod_parallel::master, mod_strings::my_cpu, mod_strings::my_fc, mod_strings::my_fflags, mod_strings::my_fort, mod_strings::my_os, mod_iounits::nbcfiles, mod_iounits::nclmfiles, mod_scalars::ndefavg, mod_scalars::ndefdia, mod_scalars::ndefhis, mod_iounits::nffiles, mod_scalars::noerror, mod_fourdvar::nritzev, mod_iounits::nrm, mod_param::nsa, mod_fourdvar::nstatevar, mod_param::ntilei, mod_param::ntilej, mod_iounits::nud, mod_scalars::nudgingcoeff, mod_scalars::nuser, mod_scalars::obcdata, mod_iounits::obs, mod_iounits::oifa, mod_iounits::oifb, mod_pio_netcdf::pio_tout, mod_pio_netcdf::pio_type, mod_iounits::qck, mod_scalars::rclock, mod_strings::rdir, mod_iounits::rst, mod_iounits::sca, mod_iounits::sct, mod_iounits::sourcefile, mod_iounits::spa, mod_scalars::spherical, mod_iounits::sposnam, mod_iounits::spt, mod_scalars::spval, mod_iounits::ssf, mod_iounits::sta, mod_iounits::stdout, mod_ncparam::svn_rev, mod_ncparam::svn_url, mod_iounits::tide, mod_strings::title, mod_iounits::tlf, mod_iounits::tlm, mod_param::vadvection, mod_iounits::varname, mod_ncparam::version, mod_ncparam::vname, and mod_scalars::vtransform.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: