-
Notifications
You must be signed in to change notification settings - Fork 4
/
si3d_utils.f90
4578 lines (3981 loc) · 164 KB
/
si3d_utils.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!************************************************************************
MODULE si3d_utils
!************************************************************************
!
! Purpose: Include routines which are useful for other modules (such
! as computing dates, or input-output routines, allocating
! space for variables,
!
!-------------------------------------------------------------------------
USE omp_lib
USE si3d_Types
USE si3d_ecomod
IMPLICIT NONE
SAVE
CONTAINS
!************************************************************************
SUBROUTINE input
!************************************************************************
!
! Purpose: To read si3d model input parameters.
!
!------------------------------------------------------------------------
!.....Local variables.................................................
CHARACTER(LEN=12) :: input_file = "si3d_inp.txt"
INTEGER :: ios, nn, i, j, istat
!.....Open input parameter file.....
OPEN (UNIT=i5, FILE=input_file, STATUS="OLD", IOSTAT=ios)
IF (ios /= 0) CALL open_error ( "Error opening "//input_file, ios )
!.....Read header record containing comments about run................
READ (UNIT=i5, FMT='(/(A))', IOSTAT=ios) title
IF (ios /= 0) CALL input_error ( ios, 1)
!.....Read & define start date of the run.............................
READ (UNIT=i5,FMT='(///(14X,G20.2))',IOSTAT=ios) iyr0,imon0,iday0,ihr0
IF (ios /= 0) CALL input_error ( ios, 2 )
CALL compute_date (0.0)
!.....Read space-time domains, cell size & time step .................
READ (UNIT=i5,FMT='(///(14X,G20.2))',IOSTAT=ios) xl,yl,zl,tl,idx,idy, &
& idz,dzmin, datadj, zetainit,idt, ibathyf
IF (ios /= 0) CALL input_error ( ios, 3 )
! ... Read parameters controlling solution algorithm .................
READ (UNIT=i5,FMT='(///(14X,G20.2))',IOSTAT=ios) itrap,niter,ismooth, &
& beta, iturb, Av0, Dv0, iadv, itrmom, ihd, Ax0, Ay0, f, theta, &
& ibc,isal, itrsca, cd, ifsurfbc, dtsurfbc, cw, wa, phi, idbg, num_threads
IF (ios /= 0) CALL input_error ( ios, 4 )
!.....Read node numbers for time series output .......................
READ (UNIT=i5, FMT='(///(14X,I20))', IOSTAT=ios) ipt,nnodes
IF (ios /= 0) CALL input_error ( ios, 5 )
IF (nnodes > 0) THEN
IF (ios /= 0) CALL input_error ( ios, 5 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (inode(nn), nn = 1, nnodes)
IF (ios /= 0) CALL input_error ( ios, 5 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jnode(nn), nn = 1, nnodes)
IF (ios /= 0) CALL input_error ( ios, 5 )
ELSE IF (nnodes == 0) THEN
READ (UNIT=i5, FMT='(/)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 5 )
ENDIF
! ... Read nodes for horizontal plane output ...........................
READ (UNIT=i5, FMT='(///(14X,I20))', IOSTAT=ios) iop
IF (ios /= 0) CALL input_error ( ios, 6 )
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) itspfh
IF (ios /= 0) CALL input_error ( ios, 6 )
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) n_planes
IF (ios /= 0) CALL input_error ( ios, 6 )
IF (n_planes > max_planes) THEN
PRINT *,'ERROR: # of planes requested > maximum allowed'
STOP
END IF
IF (n_planes > 0) THEN
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (p_out(nn), nn = 1, n_planes)
IF (ios /= 0) CALL input_error ( ios, 6 )
ELSE IF (n_planes == 0) THEN
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 6 )
END IF
! ... Read nodes for vertical plane output ...........................
READ (UNIT=i5, FMT='(///(14X,I20))', IOSTAT=ios) iox
IF (ios /= 0) CALL input_error ( ios, 7 )
IF (iox /= 0) THEN
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) n_sections
IF (ios /= 0) CALL input_error ( ios, 7 )
IF (n_sections > max_sections) THEN
PRINT *,'ERROR: # of sections requested > maximum allowed'
STOP
END IF
DO j = 1, n_sections
! ... Read number of cells in X-section j
READ (UNIT=i5, FMT='(/14X,I20)' , IOSTAT=ios) n_section_cells(j)
IF (ios /= 0) CALL input_error ( ios, 7 )
! ... Read i coordinates for cells in X-section j
READ (UNIT=i5, FMT='(14X,10I5)', IOSTAT=ios) & ! Changed to I5 12/2010 SWA
& (xinode(j, nn), nn = 1, n_section_cells(j) )
IF (ios /= 0) CALL input_error ( ios, 7 )
! ... Read j coordinates for cells in X-section j
READ (UNIT=i5, FMT='(14X,10I5)', IOSTAT=ios) & ! Changed to I5 12/2010 SWA
& (xjnode(j, nn),nn=1,n_section_cells(j))
IF (ios /= 0) CALL input_error ( ios, 7 )
END DO
ENDIF
!! ... Read toggles for 3D output .....................................
READ (UNIT=i5, FMT='(///(14X,I20))', IOSTAT=ios) ipxml
IF (ios /= 0) CALL input_error ( ios, 7 )
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) itspf
IF (ios /= 0) CALL input_error ( ios, 7 )
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) iTurbVars
IF (ios /= 0) CALL input_error ( ios, 7 )
!.....Read info on open boundaries.....................................
READ (UNIT=i5, FMT='(///14X,I20)', IOSTAT=ios) nopen
IF (ios /= 0) CALL input_error ( ios, 8 )
IF (nopen > 0) THEN
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) dtsecopenbc
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (iside(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (itype(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (isbc(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jsbc(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (iebc(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jebc(nn), nn = 1, nopen)
IF (ios /= 0) CALL input_error ( ios, 8 )
ELSE IF (nopen == 0) THEN
READ (UNIT=i5, FMT='(//////)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 8 )
END IF
!.....Read info to output nested grid boundaries ......................
IF (ioNBTOGGLE > 0 ) THEN
READ (UNIT=i5, FMT='(///14X,I20)', IOSTAT=ios) nxNBO
IF (ios /= 0) CALL input_error ( ios, 8 )
IF (nxNBO > 0) THEN
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) ioNBO
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) xxNBO
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (isdNBO(nn), nn=1, nxNBO)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (isbcNBO(nn), nn=1, nxNBO)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jsbcNBO(nn), nn=1, nxNBO)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (iebcNBO(nn), nn=1, nxNBO)
IF (ios /= 0) CALL input_error ( ios, 8 )
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jebcNBO(nn), nn=1, nxNBO)
IF (ios /= 0) CALL input_error ( ios, 8 )
ELSE IF (nxNBO == 0) THEN
READ (UNIT=i5, FMT='(//////)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 8 )
END IF
END IF
!.... Read info for tracers ...........................................
READ (UNIT=i5, FMT='(///14X,I20)', IOSTAT=ios) ntr
IF (ios /= 0) CALL input_error ( ios, 9 )
iotr = 0; ! Default value
IF (ntr > 0) THEN
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) ecomod
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) iotr
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) itspftr
! ipwq = Time step to run WQ modules. E.g. in idt = 100 s, and want to run WQ every 1 h, ipwq = 36;
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) ipwq
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios) nswq
IF (ios /= 0) CALL input_error ( ios, 9 )
ELSE IF (ntr == 0) THEN
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios)
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios)
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios)
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios)
READ (UNIT=i5, FMT='(14X,I20)', IOSTAT=ios)
ENDIF
!.... Read info for plume models & oxygenation systems ................
READ (UNIT=i5, FMT='(///14X,I20)', IOSTAT=ios) iopss
IF (ios /= 0) CALL input_error ( ios, 10 )
IF (iopss > 0) THEN
! ... Read no. of devices, each with its own inflow/outflow rate
READ (UNIT=i5, FMT='( 14X,I20)', IOSTAT=ios) npssdev
IF (ios /= 0) CALL input_error ( ios, 10 )
IF ( npssdev > iopss .OR. npssdev < 1) THEN
PRINT *, '*** ERROR ***'
PRINT *, 'No. of devices creating point sources & sinks cannot be > '
PRINT *, 'No. of water columns with point sources & sinks'
STOP
ENDIF
! Read time in seconds between consecutive records from time files
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) dtsecpss
! ... Allocate space for arrays holding location
! of point sources and sinks and devices
ALLOCATE ( ipss (iopss), jpss (iopss), &
iodev (iopss), STAT=istat)
IF (istat /= 0) CALL allocate_error ( istat, 100 )
! ... Read in locations & characteristics of diffusers
! At this point, they are pressumed constants in time
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (ipss(nn), nn=1, iopss)
IF (ios/= 0) CALL input_error ( ios, 10)
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (jpss(nn), nn=1, iopss)
IF (ios/= 0) CALL input_error ( ios, 10)
READ (UNIT=i5, FMT='(14X,20I)', IOSTAT=ios) (iodev(nn), nn=1, iopss)
IF (ios/= 0) CALL input_error ( ios, 10)
IF (iodev(npssdev) /= npssdev) THEN ! iodev es el identificador del dispositivo. Nodev es el numero de dispositivos. Entonces, el ultimo valor de iodev debe ser igual al Nodev.
PRINT*, '*** ERROR *** No. of Devices causing point sources'
STOP
END IF
! ... Read sources & sinks specifications -
CALL PointSourceSinkInput
ELSE IF (iopss == 0) THEN
READ (UNIT=i5, FMT='(////)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 10 )
ENDIF
! ... Input instructions & parameters controlling the solution of
! the tracer transport equations.
IF (ntr > 0) THEN
! ... Allocate space for some arrays - they are initialized
! only if ecomod < 0, but used allways in determining
! if the tracer transport equation is used or not in subroutine fd.
!ALLOCATE ( trct0(ntr), trcpk(ntr), trctn(ntr), &
! trcx0(ntr), trcy0(ntr), trcz0(ntr), &
! trcsx(ntr), trcsy(ntr), trcsz(ntr), STAT=istat)
!IF (istat /= 0) CALL allocate_error ( istat, 121 )
! .... Initialize trct0 and trctn to default values
trct0 = 1E7;
trctn = 0;
! .... Define other input variables
SELECT CASE (ecomod)
CASE (-1) ! Tracer Cloud Releases
PRINT *, 'Tracer Cloud Modelling activated'
CALL trcinput
CASE (1) ! Water quality routines
PRINT *, 'Water Quality Model activated'
CALL wqinput
CALL WQinit
CASE (2) ! Size Structure distribution
PRINT *, 'Size Structure Model activated'
CALL szinput
CASE (3) ! Sediment transport routines
PRINT *, 'Sediment transport activated'
CALL sdinput
END SELECT
ENDIF
! ... Read info for interpolation method (Added 12/2010 by SWA)
IF (ifsurfbc >=10) THEN
READ (UNIT=i5, FMT='(///14X,I20)', IOSTAT=ios) iinterp
IF (ios /= 0) CALL input_error ( ios, 10 )
IF (iinterp==2) THEN
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) gammaB
IF (ios /= 0) CALL input_error ( ios, 10 )
READ (UNIT=i5, FMT='(14X,G20.2)', IOSTAT=ios) delNfactor
IF (ios /= 0) CALL input_error ( ios, 10 )
ENDIF
ENDIF
if (ipxml .lt. 0) then
if ((ipxml .ne. iop) .or. (itspfh .ne. itspf)) then
print *, ' Error - si3d_inp.txt file'
print *, ' iop and ipxml must be the same when exporting 3D files'
print *, ' itspfh and itspf must be the same when exporting 3D files'
STOP
end if
if (ntr .gt. 0) then
if ((ipxml .ne. iop) .or. (ipxml .ne. iotr) .or. (iop .ne. iotr) .or. (itspfh .ne. itspf) .or. (itspf .ne. itspftr) .or. (itspfh .ne. itspftr)) then
print *, ' Error - si3d_inp.txt file'
print *, ' iop, ipxml, iotr must be the same when exporting 3D files'
print *, ' itspfh, itspf, itspftr must be the same when exporting 3D files'
STOP
end if
end if
end if
!.....Close input file.....
CLOSE (UNIT=i5)
!.....Define frequently used numerical constants and coefficients.....
dt=idt; dx=idx; dy=idy; ddz=idz; twodt=2.*dt; dtdx=dt/dx; dtdy=dt/dy
gdtdx=g*dtdx; gdtdy=g*dtdy; gdt2dx2=gdtdx*dtdx; gdt2dy2=gdtdy*dtdy
!gthx=gdtdx*theta; gthy=gdtdy*theta; gth1x=gdtdx*2.*(1.-theta)
!gth1y=gdtdy*2.*(1.-theta);
cwind=2.*dt*cw*rhoair*wa*wa; alp4=(1.-alp)/4.
twodx=2.*dx; twody=2.*dy; fourdx=2.*twodx; fourdy=2.*twody
dxdx=dx*dx; dydy=dy*dy; twodxdx=2.*dxdx; twodydy=2.*dydy; dxdy=dx*dy ! Changed 12/2010 SWA
beta2=beta/2.; chi1=1.-chi; twochi1=2.*chi1
im=nint(xl/dx)+1; im1=im+1; i1=2; ndx=im1-i1
jm=nint(yl/dy)+1; jm1=jm+1; j1=2; ndy=jm1-j1
nts=tl/dt+.5; apxml = ABS(ipxml)
isec0=REAL(ihr0)/100.*3600.; !dt_min=idt/60.
! ... Generate grid dimensions in Z-direction
CALL ZGridDimensions
END SUBROUTINE input
!************************************************************************
SUBROUTINE ZGridDimensions
!************************************************************************
!
! Purpose: To read in depths of levels between consecutive layers
!
!------------------------------------------------------------------------
!.....Local variables.................................................
CHARACTER(LEN=14) :: input_file = "si3d_layer.txt"
INTEGER :: ios, k, istat
! ... Variable layer thickness
IF (ibathyf < 0 ) THEN
!.....Open input file.....
OPEN (UNIT=i5, FILE=input_file, STATUS="OLD", IOSTAT=ios)
IF (ios /= 0) CALL open_error ( "Error opening "//input_file, ios )
!.....Read information ...
! Skip over first line (header)
READ (UNIT=i5, FMT='(//)', IOSTAT=ios)
IF (ios /= 0) CALL input_error ( ios, 40 )
! Read number of layers from second header record
READ (UNIT=i5, FMT='(10X,I11)', IOSTAT=ios) km1
IF (ios /= 0) CALL input_error ( ios, 41 )
!..... Allocate space for zlevel array
ALLOCATE (zlevel(1:km1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 0 )
! .... Read array with levels to layer interfaces
DO k = 1, km1
READ (UNIT=i5, FMT='(10X,G11.2)', IOSTAT=ios) zlevel(k)
IF (ios /= 0) CALL input_error ( ios, 42 )
END DO
! ... Generate grid dimensions in z-direction
km = km1 - 1 ;
k1 = 2 ;
ndz = km1 - k1 ;
! ... Constant layer thickness (original si3d)
ELSE
! ... Generate grid dimensions in z-direction
!km=CEILING((zl-dzmin)/ddz)+1
km=CEILING((zl)/ddz)+1
km1=km+1; k1=2; ndz=km1-k1
!..... Allocate space for zlevel array
ALLOCATE (zlevel(1:km1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 0 )
!.....Initialize arrays with levels to layer interfaces
zlevel(k1) = 0.0;
DO k = k1+1, km1
zlevel(k)=zlevel(k-1)+ddz
END DO
zlevel(k1) = -100.
zlevel(1 ) = -100.
ENDIF
END SUBROUTINE ZGridDimensions
!************************************************************************
SUBROUTINE AllocateSpace
!************************************************************************
!
! Purpose: To allocate space for model arrays at a size determined during
! execution. These arrays are 'permanently'
! allocated for the entire duration of a model run.
!
!
! Revisions:
! Date Programmer Description of revision
! ---- ---------- -----------------------
!
!------------------------------------------------------------------------
!.....Local variables.....
INTEGER :: istat, one=1
!..... Allocate geometry arrays
ALLOCATE (kmz (lm1), k1z(lm1), &
k1u (lm1), k1v(lm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 2 )
!.....Allocate matrix solution arrays.....
ALLOCATE ( ubar(1), rparm(16), iparm(25), ip(1), jp(1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 3 )
!.....Allocate other miscellaneous arrays.....Map 2D-l into 3D-(i,j) indexes
ALLOCATE ( ds(km), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 4 )
!.....Allocate arrays with variables at zeta-pts in 3D space &
! arrays used in solution procedures....
ALLOCATE ( s (lm1), sp (lm1), &
& spp (lm1), &
& sx (lm1), sy (lm1), &
& dd (lm1), qq (lm1), &
& eagx(lm1), earx(lm1), &
& eagy(lm1), eary(lm1), &
& rr (lm1), hhs (lm1), &
& hhu (lm1), hhv (lm1), &
& uair(lm1), vair(lm1), &
& cdw (lm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 5 )
! .... Allocate arrays used in model output
ALLOCATE( uout (km1) , vout (km1) , wout(km1), &
& Avout(km1) , Dvout(km1) , sal1(ndz), &
& uhout(km1) , scout(km1), trout(km1,ntrmax), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 7 )
! ... Allocate space for output routines
ALLOCATE ( interior_plane_points ( n_planes ), &
& interior_section_points ( n_sections), STAT = istat )
IF (istat /= 0) CALL allocate_error ( istat, 8 )
! .... Allocate arrays used to store velocity boundary conditions
IF (nopen > 0) THEN
ALLOCATE( uhWB (km1,jm1), uhEB (km1,jm1), &
huWB (km1,jm1), huEB (km1,jm1), &
vhSB (km1,im1), vhNB (km1,im1), &
hvSB (km1,im1), hvNB (km1,im1), &
uhWBpp(km1,jm1), uhEBpp(km1,jm1), &
huWBpp(km1,jm1), huEBpp(km1,jm1), &
vhSBpp(km1,im1), vhNBpp(km1,im1), &
hvSBpp(km1,im1), hvNBpp(km1,im1), &
uhWBp (km1,jm1), uhEBp (km1,jm1), &
huWBp (km1,jm1), huEBp (km1,jm1), &
vhSBp (km1,im1), vhNBp (km1,im1), &
hvSBp (km1,im1), hvNBp (km1,im1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 9 )
ENDIF
END SUBROUTINE AllocateSpace
!************************************************************************
SUBROUTINE AllocateSpace2
!************************************************************************
!
! Purpose: To allocate space for model arrays at a size determined during
! execution. These arrays are 'permanently'
! allocated for the entire duration of a model run.
!
!
! Revisions:
! Date Programmer Description of revision
! ---- ---------- -----------------------
!
!------------------------------------------------------------------------
! ... Local variables
INTEGER:: istat
ALLOCATE ( ij2l(im1,jm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 10 )
ALLOCATE ( l2i(lm1), l2j(lm1), &
& lEC(lm1), lWC(lm1), &
& lNC(lm1), lSC(lm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 11 )
ALLOCATE ( lh(num_threads), lh_aux(num_threads), &
& lhi(num_threads), lhf(num_threads), &
& id_column(lm1+((jm*num_threads*2)-(jm*2)) ), &
& lhiE(num_threads), lhfE(num_threads), &
& lhiW(num_threads), lhfW(num_threads), &
& iauxs(num_threads), iauxe(num_threads), &
& ph(num_threads))
ALLOCATE ( lhiCE(num_threads), lhfCE(num_threads), &
& lhiCN(num_threads), lhfCN(num_threads), &
& id_columnCE(lm1+((jm*num_threads*2)-(jm*2)) ), &
& id_columnCN(lm1+((jm*num_threads*2)-(jm*2)) ), &
& lhiECE(num_threads), lhfECE(num_threads), &
& lhiWCE(num_threads), lhfWCE(num_threads), &
& lhiWCN(num_threads), lhfWCN(num_threads), &
& lhiECN(num_threads), lhfECN(num_threads))
ALLOCATE ( coeffA(lm,5), jcoefA(lm,5), &
& rhs(lm), zeta(lm))
ALLOCATE ( nnH(num_threads,maxnopen), nnHH(num_threads,maxnopen) )
ALLOCATE (isbcH(maxnopen,num_threads),iebcH(maxnopen,num_threads),jsbcH(maxnopen,num_threads), nopenH(num_threads), &
& jebcH(maxnopen,num_threads),noh2no(maxnopen,num_threads),eiptNBI(maxnopen,num_threads),siptNBI(maxnopen,num_threads), thrsNGBp(maxnopen), & !MAC
& eiptNBIH(maxnopen,num_threads),siptNBIH(maxnopen,num_threads),isbcHH(maxnopen,num_threads),iebcHH(maxnopen,num_threads), thrsNGB(maxnopen), & !MAC
& areatot(maxnopen),flag(maxnopen),nopth(maxnopen),cont(maxnopen),noh2noH(maxnopen,num_threads),nopenHH(num_threads),contNG(maxnopen))
!.....Allocate arrays at u-pts.....
ALLOCATE ( uh(km1,lm1), uhp(km1,lm1), uhpp(km1,lm1), kh(km1,lm1), &
& u (km1,lm1), up (km1,lm1), upp (km1,lm1), &
& ex(km1,lm1), agx(km1,lm1), arx (km1,lm1),ex2(km1,lm1), &
& hu(km1,lm1), hup(km1,lm1), hupp(km1,lm1),extr(km1,lm1),STAT=istat)
IF (istat /= 0) CALL allocate_error ( istat, 12 )
!.....Allocate arrays at v-pts.....
ALLOCATE ( vh(km1,lm1), vhp(km1,lm1), vhpp(km1,lm1), &
& v (km1,lm1), vp (km1,lm1), vpp (km1,lm1), &
& agy(km1,lm1), ary (km1,lm1), &
& hv(km1,lm1), hvp(km1,lm1), hvpp(km1,lm1),STAT=istat)
IF (istat /= 0) CALL allocate_error ( istat, 13 )
!.....Allocate arrays at pressure-pts.....
ALLOCATE ( h (km1,lm1), hp (km1,lm1), hpp (km1,lm1), &
& sal (km1,lm1), salp(km1,lm1), salpp (km1,lm1), &
& rhop(km1,lm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 14 )
!.....Allocate arrays at vertical interfaces between pressure-pts.....
ALLOCATE ( Av (km1,lm1), Dv (km1,lm1), Dvm(km1,lm1), &!Andrea PT
wp (km1,lm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 15 )
! ....Allocate arrays at pressure points
ALLOCATE ( QswFr (km1,lm1), &
& HeatSource(km1,lm1), STAT=istat)
IF (istat /= 0) CALL allocate_error ( istat, 16 )
!.....Allocate horizontal diffusion, th, and th1 arrays.....
ALLOCATE (haypp(km1,lm1),haxpp(km1,lm1), &
hdypp(km1,lm1),hdxpp(km1,lm1), &
th (km1,lm1),th1 (km1,lm1),haxpp2(km1,lm1) , &
haypp2(km1,lm1),th2(km1,lm1),th12(km1,lm1), &
hayppsal(km1,lm1),haxpptr(km1,lm1),haxppsal(km1,lm1),STAT=istat)
IF (istat /=0) CALL allocate_error ( istat, 17 )
!.... Allocate space for Higher-Order turbulence models......
IF (iturb > 0) THEN
ALLOCATE ( q2 (km1,lm1), q2p (km1,lm1 ), q2pp (km1,lm1), &
q2l(km1,lm1), q2lp(km1,lm1 ), q2lpp(km1,lm1), &
dsT(km1) , aaT (3, km1+1), sal1T(ndz+1), STAT = istat )
IF (istat /= 0) CALL allocate_error ( istat, 18 )
ELSE IF (iturb < 0) THEN
ALLOCATE ( si3dtke (km1,lm1), &
si3deps (km1,lm1), &
si3dlen (km1,lm1), STAT = istat )
IF (istat /= 0) CALL allocate_error ( istat, 18 )
ENDIF
! .... Allocate arrays used in advection for tracers & plumes &
! when scalar transport is done with flux-limiters ..............
ALLOCATE( fluxX (km1,lm1),fluxY(km1,lm1),fluxZ(km1,lm1), &
fluxXtr (km1,lm1),fluxY2(km1,lm1),fluxZ2(km1,lm1), &
fluxXsal(km1,lm1), STAT = istat )
IF (istat /= 0) CALL allocate_error ( istat, 19 )
! .... Allocate arrays for tracers ...................................
IF (ntr > 0 ) THEN
ALLOCATE( tracer (km1,lm1,ntr), &
tracerpp (km1,lm1,ntr), &
sourcesink (km1,lm1,ntr), &
STAT = istat )
IF (istat /= 0) CALL allocate_error ( istat, 20 )
ENDIF
! .... Allocate arrays used in oxygenation simulations ...............
ALLOCATE(Qpss(km1,iopss), Tpss(km1,iopss), iopssH(num_threads), &
Rpss(km1,iopss,ntr), ioph2iop(iopss,num_threads),STAT=istat)
IF (istat /= 0) CALL allocate_error ( istat, 21 )
! .... Allocate arrays used in STWAVE
if ((iSS == 1) .and. (iSTWAVE == 1)) then
allocate(tau_stwave(im1,jm1))
allocate(uair_tmp(jm1,im1,int(Ti_4_stwave*3600/dt)), udir_tmp(jm1,im1,int(Ti_4_stwave*3600/dt)))
end if
END SUBROUTINE AllocateSpace2
!************************************************************************
SUBROUTINE bathy
!************************************************************************
!
! Purpose: To read the file with bathymetry for the basin. The depths
! are assumed to be defined at the corners of each computational
! cell and stored in the array 'h4'. The average depths along
! each cell face are computed and used to define the 3-D layer
! thickness array hhs of bottom depths from datum at zeta points.
! 2-D logical mask arrays are defined with .TRUE. values for all
! wet cells and .FALSE. values for all dry cells. The 2-D arrays,
! hhu & hhv, of depths at u- & v-points are defined from hhs.
! The depths are in meters below a datum.
! 13/11/08 Input depths at zeta point
!
!-------------------------------------------------------------------------
!.....Local variables.....
CHARACTER(LEN=50) :: bathymetry_file = "si3d_bathy"
INTEGER :: i, j, k, l, c, ios, istat, kb, is, ie, js, je
INTEGER :: imm, jmm, ncols, ncols1, nc, nn, ia, ib
REAL :: hs1, udepth, vdepth, ztop
CHARACTER(LEN=14) :: fmt
REAL, DIMENSION(:,:), POINTER :: h4
!.....Open bathymetry file.....
OPEN (UNIT=i5, FILE=bathymetry_file, STATUS="OLD", IOSTAT=ios)
IF(ios /= 0) CALL open_error ( "Error opening "//bathymetry_file, ios )
!.....Read header information.....
READ (UNIT=i5, FMT='(37X,I5,6X,I5,8X,I5//)', IOSTAT=ios) imm, jmm, ncols ! Changed to I5 12/2010 SWA
IF (ios /= 0) CALL input_error ( ios, 11 )
!.....Check grid dimensions against input parameters.....
IF ((im /= imm+1) .OR. (jm /= jmm+1)) THEN
PRINT *, " ****ERROR -- Grid size computed from input file does not"
PRINT *, " agree with the header in the bathymetry file"
PRINT '(4(A,I5))', " im=", im, " imm+1=", imm+1, " jm=", jm, " jmm+1=", jmm+1
PRINT '(A/)', " "
PRINT *, " ****STOPPING si3d in SUBROUTINE bathy"
STOP
END IF
!.....Write data format to an internal file.....
IF (ibathyf == 1) THEN ! Stockton
WRITE (UNIT=fmt, FMT='("(5X,", I4, "G5.0)")') ncols
ELSE !General case (Deeper lakes > 100 m)
WRITE (UNIT=fmt, FMT='("(5X,", I4, "G5.0)")') ncols
ENDIF
!.....Allocate space for bathymetry array.....
ALLOCATE ( h4(1:im1, 1:jm1), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 15 )
!.....Allocate space for bathymetry array for stwave.....
if ((iSS == 1) .and. (iSTWAVE == 1)) then
allocate (dep_stwave(jm1, im1))
end if
IF (istat /= 0) CALL allocate_error ( istat, 15 )
!.....Allocate logical mask arrays.....
ALLOCATE ( mask2d(im1,jm1 ), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 1 )
!.....Allocate logical mask arrays 1D.....
ALLOCATE ( mask(im1*jm1 ), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 1 )
!.....Read bathymetry.....
ncols1 = ncols - 1;
nc = imm/ncols + 1;
ia = -ncols1 + 1;
DO nn = 1, nc
ia = ia + ncols
ib = ia + ncols1
IF ( ia > im ) EXIT
IF ( ib > im ) ib = im
DO j = jm, j1, -1 ! change 1 to j1
READ (UNIT=i5, FMT=fmt, IOSTAT=ios) (h4(i,j), i = ia, ib)
IF (ios /= 0) CALL input_error ( ios, 12 )
END DO
END DO
!.....Close bathymetry file.....
CLOSE (UNIT=i5)
!.....Change units (from dm to m) and adjust bathymetry datum.....
h4 = h4*0.1 + datadj
!.....Be sure mask is false in the fictitious
! row/column around the outer edge of the grid.....
h4( 1,1:jm1) = 0.0; h4(1:im1,jm1) = 0.0
h4(im1,1:jm1) = 0.0; h4(1:im1, 1) = 0.0
!.....Define mask2d array.....
DO j = 1, jm1
DO i = 1, im1
IF ( h4(i,j) > 0.0 ) THEN
mask2d(i,j) = .TRUE.
ELSE
mask2d(i,j) = .FALSE.
END IF
END DO
END DO
!.....Define mask array.....
cm1=0.0
DO i = 1, im1
DO j = 1, jm1
cm1=cm1+1
IF ( h4(i,j) > 0.0 ) THEN
mask(cm1) = .TRUE.
ELSE
mask(cm1) = .FALSE.
END IF
END DO
END DO
!.....Add fictitious row/column of depths around grid.....
h4(1,j1:jm ) = h4(2,j1:jm ) ! west side
h4(i1:im,jm1) = h4(i1:im,jm) ! north side
h4(im1,j1:jm) = h4(im,j1:jm) ! east side
h4(i1:im,1 ) = h4(i1:im,2 ) ! south side
! Take care of corners
h4( 1, 1) = h4( 2, 2); h4( 1,jm1) = h4( 2,jm)
h4(im1,jm1) = h4(im,jm); h4(im1, 1) = h4(im, 2)
if ((iSS == 1) .and. (iSTWAVE == 1)) then
dep_stwave = transpose(h4)
do j = 1, jm1
do i = 1,im1
if (dep_stwave(j,i) < 0.0) then
dep_stwave(j,i) = -10.
end if
end do
end do
end if
!.....Compute the first and last column and row of grid
! with wet points. Variables used in subr. solver
ifirst = im; ilast = i1; jfirst = jm; jlast = j1
DO j = j1, jm
DO i = i1, im
IF ( .NOT. mask2d(i,j) ) CYCLE ! Ignore dry points
IF ( i < ifirst ) ifirst = i
IF ( i > ilast ) ilast = i
IF ( j < jfirst ) jfirst = j
IF ( j > jlast ) jlast = j
END DO
END DO
!.....Compute the first and last column and row of grid
! with wet points. Variables used in subr. solver
lfirst = cm1; llast = 1;
DO c = 1, cm1
IF ( .NOT. mask(c) ) CYCLE ! Ignore dry points
IF ( c < lfirst ) lfirst = c
IF ( c > llast ) llast = c
END DO
! ... Find dimensions for 2D-lk arrays
l = 0
DO c = 1, cm1
IF ( .NOT. mask(c) ) CYCLE
l = l + 1
END DO
lm = l ; lm1 = lm + 1;
!.....Allocate
ALLOCATE ( c2l(lm1 ), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 1 )
!.....Allocate
ALLOCATE ( l2c(im1*jm1 ), STAT=istat )
IF (istat /= 0) CALL allocate_error ( istat, 1 )
! ... Allocate space for arrays in 2D-lk coordinates
CALL AllocateSpace2
! ... Mapping functions from/to 3D-(i,j)- to/from 2D-l-indexes
l = 0
c2l = cm1
l2c = lm1
c = 0
ij2l = lm1; ! For dry(i,j) the map function ij2l will yield lm1
DO i = 1, im1
DO j = 1, jm1;
c = c + 1
IF(mask2d(i,j)) THEN
l = l + 1
l2i (l ) = i ; ! Goes from ipl to index i in the i,j plane
l2j (l ) = j ; ! Goes from ipl to index j in the i,j plane
ij2l(i,j) = l ; ! Goes from i,j to the ipl index in the ipl line
c2l(l)=c
l2c(c)=l
END IF
END DO
END DO
! ... Assign E,W,N,S colums for each l-column in the 2D-l space
l = 0
DO i = i1, im
DO j = j1, jm
IF(.NOT. mask2d(i,j)) CYCLE
l = l + 1
lEC(l) = ij2l(i+1,j); ! Defines water column East of l
lWC(l) = ij2l(i-1,j); ! Defines water column West of l
lNC(l) = ij2l(i,j+1); ! Defines water column North of l
lSC(l) = ij2l(i,j-1); ! Defines water column South of l
END DO
END DO;
!.....Allocate space for arrays.....
CALL AllocateSpace
!.....Define layer No. for bottom cell (kmz) &
! bottom depth from datum at zeta-points (hhs).....
hhs = ZERO
DO j = 1,jm1
DO i = 1,im1
SELECT CASE (mask2d(i,j))
CASE (.FALSE.) ! Cells with all dry layers
CASE (.TRUE.) ! Cells with wet layers
l=ij2l(i,j)
! ... Take depth at zeta-point as given in bathy file
hs1 = h4(i,j)
! ... Compute No. of wet layers & depths at zeta-points
! --- A. constant layer thickness (ibathyf >= 0)
IF (ibathyf >= 0) THEN
kmz(l) = FLOOR(hs1/ddz)
IF( (hs1-kmz(l)*ddz) > dzmin ) THEN
kmz(l) = kmz(l) + 1;
hhs(l) = hs1
ELSE
hhs(l) = kmz(l)*ddz
ENDIF
! Add the fictitious first layer above the water surface
kmz(l) = kmz(l) + 1
! --- B. Variable layer thickness (ibathyf < 0)
ELSE
DO k = k1, km
IF (zlevel(k+1)>=hs1) THEN
! ... Option 1 - it works
hhs(l) = zlevel(k)+MAX(dzmin,(hs1-zlevel(k)));
kmz(l) = k
EXIT
!! ... Option 2 - preferable from a theoretical stand point
!IF ( hs1-zlevel(k) > dzmin) THEN
! hhs(i,j) = hs1
! kmz(i,j) = k
!ELSE
! hhs(i,j) = zlevel(k)
! kmz(i,j) = k - 1
! IF ( kmz(i,j) == 1 ) THEN
! hhs(i,j) = dzmin
! kmz(i,j) = k1
! ENDIF
!ENDIF
!EXIT
ENDIF
ENDDO
ENDIF
END SELECT
END DO
END DO
kmz(lm1) = km1
!.....Define bottom depths from datum at u- and v- points
hhu = ZERO;
hhv = ZERO;
DO j = 1,jm
DO i = 1,im
IF(mask2d(i+1,j) .AND. mask2d(i,j)) THEN
l=ij2l(i,j)
hhu(l) = MIN(hhs(lEC(l)), hhs(l))
ENDIF
IF(mask2d(i,j+1) .AND. mask2d(i,j)) THEN
l=ij2l(i,j)
hhv(l) = MIN(hhs(lNC(l)), hhs(l))
ENDIF
END DO
END DO
!.....Process and output the bathymetry needed for
! graphics and particle tracking if ioutg=1.....
! IF ( ipxml > 0 ) CALL outg ( h4 )
!.....Deallocate h4 pointer array.....
DEALLOCATE ( h4 )
END SUBROUTINE bathy
!***********************************************************************
FUNCTION parab ( frstpt, x, fx, dx )
!***********************************************************************
!
! Purpose: To interpolate parabolically between the functional values
! within the array fx.
!
!-----------------------------------------------------------------------
REAL, DIMENSION(:), INTENT(IN) :: fx ! Assumed-shape array
REAL, INTENT(IN) :: frstpt, x, dx
REAL :: parab
REAL :: om, theta
INTEGER :: m
m = (x - frstpt)/dx
om = m
theta = (x - frstpt - om*dx) / dx
IF (m == 0) THEN
m = 2
theta = theta - 1.0
ELSE
m = m + 1
END IF
parab=fx(m)+0.5*theta*(fx(m+1)-fx(m-1)+theta*(fx(m+1)+fx(m-1)-2.0*fx(m)))
END FUNCTION parab
!***********************************************************************
FUNCTION linear ( frstpt, x, fx, dx )
!***********************************************************************
!
! Purpose: To interpolate linearly between the functional values
! within the array fx.
!
!-----------------------------------------------------------------------
REAL, DIMENSION(:), INTENT(IN) :: fx ! Assumed-shape array
REAL, INTENT(IN) :: frstpt, x, dx
REAL :: linear
REAL :: om, theta
INTEGER :: m
m = FLOOR((x - frstpt)/dx)
theta = (x - frstpt - m*dx) / dx
linear=(1-theta)*fx(m+1)+theta*fx(m+2)
END FUNCTION linear
!***********************************************************************
SUBROUTINE outr
!***********************************************************************
!
! Purpose: To output model run parameters & performance measures to file.
!
!-----------------------------------------------------------------------
!.....Local variables.....
CHARACTER(LEN=12) :: output_file="si3d_out.txt"
CHARACTER :: date*8, time*10, zone*5
INTEGER, DIMENSION(8) :: values
INTEGER :: ios
!.....Open output file.....
OPEN (UNIT=i6, FILE=output_file, IOSTAT=ios)
IF(ios /= 0) CALL open_error ( "Error opening "//output_file, ios )
!.....Get date and time of run.....
CALL date_and_time ( date, time, zone, values )
!.....Output run parameters.....
WRITE (UNIT=i6, FMT='(A)') title
WRITE (UNIT=i6, FMT='("Run number = ",A8,A4,", Start date of run: ",I2, &
& "/",I2,"/",I4," at ",I4.4," hours")')date,time(1:4),&
& imon,iday,iyr,ihr
!.....Output space-time domains, cell size & time step .................
WRITE (UNIT=i6,FMT=1) xl,yl,zl,idx,idy,idz,tl,idt, dzmin,zetainit
! ... Read parameters controlling solution algorithm .................
WRITE (UNIT=i6,FMT=2) itrap,niter,ismooth, &
& beta, iturb, Av0, Dv0, iadv, itrmom, ihd, Ax0, Ay0, f, theta, &
& ibc,isal, itrsca, nopen, cd, ifsurfbc, dtsurfbc, cw, wa, phi, idbg
1 FORMAT (/ &
&' xl= ' , F9.1,/ &
&' yl= ' , F9.1,/ &
&' zl= ' , F9.3,/ & ! idt real
&' idx= ' , F9.3,/ & ! idt real
&' idy= ' , F9.3,/ & ! idt real
&' idz= ' , F9.3,/ & ! idt real
&' tl= ' , G9.2,/ &
&' idt= ' , G9.2,/ & ! idt real
&' dzmin=' , F9.2,/ &
&' zeta0=' , F9.2 / )
2 FORMAT(/ &
&' itrap= ' , I9,/ &
&' niter= ' , I9,/ &
&' smooth=' , I9,/ &
&' beta= ' ,F9.4,/ &
&' iturb= ' , I9,/ &
&' Av0= ' ,F9.4,/ &
&' Dv0= ' ,F9.4,/ &
&' iadv= ' , I9,/ &
&' trmom= ' , I9,/ &
&' ihd= ' , I9,/ &