-
Notifications
You must be signed in to change notification settings - Fork 0
/
swanout2.ftn
2825 lines (2810 loc) · 113 KB
/
swanout2.ftn
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
!
! SWAN/OUTPUT file 2 of 2
!
! Contents of this file:
! SWBLOK
! SBLKPT
! SWBLKP
! SRAWPT
! SWTABP
! SUHEAD
! SWSPEC
! SWCMSP
! SWRMAT
!
!***********************************************************************
! *
SUBROUTINE SWBLOK ( RTYPE, OQI , OQR , IVTYP, FAC, PSNAME, 41.40
& MXK , MYK , IRQ , VOQR , VOQ ) 40.51 40.31
! *
!***********************************************************************
!
USE OCPCOMM2 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM3, ONLY: NSTATM 41.62
USE SWCOMM4, ONLY: KSPHER 41.62
USE OUTP_DATA 40.13
!NCF USE swn_outnc 41.40
!
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmers: The SWAN team |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2016 Delft University of Technology
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! A copy of the GNU General Public License is available at
! http://www.gnu.org/copyleft/gpl.html#SEC3
! or by writing to the Free Software Foundation, Inc.,
! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! 0. Authors
!
! 30.81: Annette Kieftenburg
! 34.01: Jeroen Adema
! 40.03: Nico Booij
! 40.30: Marcel Zijlema
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
! 41.62: Andre van der Westhuysen
!
! 1. UPDATE
!
! 30.81, Jan. 99: Replaced variable FROM by FROM_ (because FROM is
! a reserved word)
! 34.01, Feb. 99: Introducing STPNOW
! 40.03, Nov. 99: NVAR in write statement replaced by OREQ(18)
! 40.13, Oct. 01: longer output filenames now obtained from array
! OUTP_FILES (in module OUTP_DATA)
! 40.30, May 03: extension to write block output to Matlab files
! 40.31, Jul. 03: small correction w.r.t. length of OVSNAM in
! call SWRMAT
! 40.31, Dec. 03: removing POOL construction
! 40.41, Jun. 04: some improvements with respect to MATLAB
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 41.62, Nov. 15: included wave partitioning output (raw partition file)
!
! 2. PURPOSE
!
! Preparing output in the form of a block that is printed by
! subroutine SBLKPT
!
! 3. METHOD
!
! ---
!
! 4. PARAMETERLIST
!
! RTYPE ch*4 input type of output request:
! 'BLKP' for output on paper,
! 'BLKD' and 'BLKL' for output to datafile
! PSNAME ch*8 input name of outpu frame
! MXK int input number of grid points in x-direction
! MYK int input number of grid points in y-direction
! VOQR
! VOQ
!
! 5. SUBROUTINES CALLING
!
! SWOUTP (SWAN/OUTP)
!
! 6. SUBROUTINES USED
!
! SBLKPT, SCUNIT, SFLFUN (all SWAN/OUTP), TABHED,
! MSGERR, COPYCH, FOR
! SWRMAT, TXPBLA
!
LOGICAL STPNOW 34.01
!
! 7. ERROR MESSAGES
!
! If the point set is not of the type frame, an error message
! is printed and control returns to subroutine OUTPUT
!
! 8. REMARKS
!
! ---
!
! 9. STRUCTURE
!
! ----------------------------------------------------------------
! If output is on paper then
! Call TABHED to print heading
! Else
! Call FOR to open file
! ----------------------------------------------------------------
! For each required variable do
! Determine type of variable and factor of multiplication
! Call SBLKPT to write block output to printer or datafile
! ----------------------------------------------------------------
!
! 10. SOURCE TEXT
! 30.81
CHARACTER (LEN=8) :: PSNAME ! name of output locations 40.13
CHARACTER (LEN=4) :: RTYPE ! output type 40.13
INTEGER VOQR(*), IPD
INTEGER OQI(4), IVTYP(OQI(3)) 40.31
REAL OQR(2), VOQ(MXK*MYK,*), FAC(OQI(3)) 41.40 40.31
INTEGER IF, IL 40.41 40.30
INTEGER, SAVE :: IREC(MAX_OUTP_REQ)=0 40.51 40.41
LOGICAL, SAVE :: MATLAB=.FALSE. 40.41 40.30
!NCF LOGICAL, SAVE :: NCF =.FALSE. 41.40
!NCF LOGICAL :: EXIST = .FALSE. 41.43
LOGICAL, SAVE :: RAWPRT=.FALSE. 41.62
CHARACTER (LEN=20) :: CTIM 40.41
CHARACTER (LEN=30) :: NAMVAR 40.41
CHARACTER (LEN=80) :: HTXT(3) 41.62
INTEGER, SAVE :: IENT=0 40.13
IF (LTRACE) CALL STRACE (IENT,'SWBLOK')
!
! **** obtain destination and number of variables from array OUTR ***
NREF = OQI(1) 40.31
IF (RTYPE .EQ. 'BLKP') THEN
! printer type output with header
IPD = 1
IF (NREF.EQ.PRINTF) CALL TABHED ('SWAN', PRINTF) 30.20
ELSE IF (RTYPE .EQ. 'BLKD') THEN
! output to datafile without header
IPD = 2
ELSE
IPD = 3
ENDIF
IF (ITEST.GE.90) WRITE (PRTEST, 21) RTYPE,NREF, OQI(3) 40.31 40.03
21 FORMAT (' Test SWBLOK: RTYPE NREF NVAR ',A4,2(1X,I6))
FILENM = OUTP_FILES(OQI(2)) 40.31 40.13
MATLAB = INDEX( FILENM, '.MAT' ).NE.0 .OR. 40.41 40.30
& INDEX (FILENM, '.mat' ).NE.0 40.41 40.30
!NCF NCF = INDEX( FILENM, '.NC' ).NE.0 .OR. 41.40
!NCF & INDEX (FILENM, '.nc' ).NE.0 41.40
RAWPRT = INDEX( FILENM, '.RAW' ).NE.0 .OR. 41.62
& INDEX (FILENM, '.raw' ).NE.0 41.62
!NNCF IF (NREF.EQ.0) THEN
!NCF IF (.NOT.NCF .AND. NREF.EQ.0) THEN 41.40
IOSTAT = -1 20.75
CALL FOR (NREF, FILENM, 'UF', IOSTAT)
IF (STPNOW()) RETURN 34.01
OQI(1) = NREF 40.31 30.00
OUTP_FILES(OQI(2)) = FILENM 40.41
IF (MATLAB) THEN 40.30
CLOSE(NREF) 40.30
OPEN(UNIT=NREF, FILE=FILENM, FORM='UNFORMATTED', 40.30
& STATUS='REPLACE',
!MatL4 & ACCESS='DIRECT', RECL=1) 40.30
!MatL5 & ACCESS='DIRECT', RECL=4) 41.08 40.30
IREC(IRQ) = 1 40.51
END IF
IF (RAWPRT.AND.IPD.EQ.1) THEN 41.62
IF (NSTATM.EQ.1) THEN
WRITE (HTXT(1),'(a)') ' yyyymmdd hhmmss'
ELSE
WRITE (HTXT(1),'(a)') ''
ENDIF
IF (KSPHER.EQ.0) THEN
WRITE (HTXT(2),'(a)') ' x y'
ELSE
WRITE (HTXT(2),'(a)') ' lat lon'
ENDIF
WRITE (HTXT(3),'(a)')
& ' name nprt depth uabs udir cabs cdir'
!
WRITE(NREF,'(A26)') 'SWAN PARTITIONED DATA FILE'
WRITE(NREF,'(A16,A24,A50)') TRIM(HTXT(1)), TRIM(HTXT(2)),
& TRIM(HTXT(3))
WRITE(NREF,'(A31,A20)') ' hs tp lp ',
& 'theta sp wf'
END IF
!NCF ELSE IF (NCF .AND. NREF.EQ.0) THEN 41.40
!NCF ! reserve free unit number
!NCF IOSTAT = -1
!NCF INQUIRE(FILE=FILENM, EXIST=EXIST) 41.43
!NCF CALL FOR (NREF, FILENM, 'UU', IOSTAT)
!NCF IF (STPNOW()) RETURN
!NCF IF (.NOT.EXIST) CLOSE(NREF, STATUS='DELETE') 41.43
!NCF OQI(1) = NREF
!NCF CALL swn_outnc_openblockfile(FILENM, MYK, MXK,
!NCF & OVLNAM, VOQ(:,VOQR(1)),
!NCF & VOQ(:,VOQR(2)),
!NCF & OQI, OQR, IVTYP, IRQ)
ENDIF
IDLA = OQI(4) 40.31 30.00
NVAR = OQI(3) 40.31 30.00
!
IF (ITEST.GE.90) WRITE (PRTEST, 22) NREF, FILENM
22 FORMAT (' Test SWBLOK: NREF FILENM ', I6, A40)
!
CTIM = CHTIME 40.41
CALL TXPBLA(CTIM,IF,IL) 40.41
CTIM(9:9)='_' 40.41
!
IF (RAWPRT) THEN 41.62
! generate a dump of the raw partition data
CALL SRAWPT ( NREF, VOQR, VOQ, MXK, MYK )
GOTO 900
END IF
!
DO JVAR = 1, NVAR
IVTYPE = IVTYP(JVAR) 40.31 30.00
DFAC = FAC(JVAR) 40.31 30.00
!
IF (IPD.EQ.1) THEN
IF (DFAC.LE.0.) THEN
! determine default factor for print output
IF (OVHEXP(IVTYPE) .LT. 0.5E10) THEN
IFAC = INT (10.+LOG10(OVHEXP(IVTYPE))) - 13 30.20
ELSE
IF (OVSVTY(IVTYPE).EQ.1) THEN
FMAX = 1.E-8
DO 10 IP = 1, MXK*MYK
FTIP = ABS(VOQ(IP,VOQR(IVTYPE)))
FMAX = MAX (FMAX, FTIP)
10 CONTINUE
ELSE IF (OVSVTY(IVTYPE).EQ.2) THEN
FMAX = 1000.
ELSE IF (OVSVTY(IVTYPE).EQ.3) THEN
FMAX = 1.E-8
DO 11 IP = 1, MXK*MYK
FTIP1 = ABS(VOQ(IP,VOQR(IVTYPE)))
FTIP2 = ABS(VOQ(IP,VOQR(IVTYPE)+1))
FMAX = MAX (FMAX, FTIP1, FTIP2)
11 CONTINUE
ENDIF
IFAC = INT (10.+LOG10(FMAX)) - 13
ENDIF
DFAC = 10.**IFAC
ENDIF
ELSE
IF (DFAC.LE.0.) DFAC = 1.
ENDIF
!
IF (ITEST .GE. 80) WRITE(PRTEST, 6020) JVAR, IVTYPE, DFAC,
& COSCQ, SINCQ
6020 FORMAT(' Test SWBLOK: jvar, ivtype, dfac, coscq, sincq',
& 2I10,3E12.5)
!
IF (OVSVTY(IVTYPE) .LT. 3) THEN
! scalar quantities
IF (MATLAB) THEN 40.30
IF (IL.EQ.1 .OR. IVTYPE.LT.3 .OR. IVTYPE.EQ.52) THEN 40.94 40.41
NAMVAR = OVSNAM(IVTYPE) 40.41
ELSE 40.41
NAMVAR = OVSNAM(IVTYPE)(1:LEN_TRIM(OVSNAM(IVTYPE)))// 40.41
& '_'//CTIM 40.41
END IF 40.41
CALL SWRMAT( MYK, MXK, NAMVAR, 40.41
& VOQ(1,VOQR(IVTYPE)), NREF, IREC(IRQ), 40.51
& IDLA, OVEXCV(IVTYPE) )
!NCF ELSE IF (NCF) THEN 41.40
!NCF IF (IVTYPE.GT.2.AND.IVTYPE.NE.40) THEN
!NCF CALL swn_outnc_appendblock(MYK, MXK, IVTYPE, OQI(1),
!NCF & IRQ, VOQ(1,VOQR(IVTYPE)),
!NCF & OVEXCV(IVTYPE), 1)
!NCF END IF
ELSE
CALL SBLKPT(IPD, NREF, DFAC, PSNAME, OVUNIT(IVTYPE),
& MXK, MYK, IDLA, OVLNAM(IVTYPE), VOQ(1,VOQR(IVTYPE)))
END IF
ELSE
! vectorial quantities
IF (MATLAB) THEN 40.30
IF (IL.EQ.1) THEN 40.41
NAMVAR = OVSNAM(IVTYPE)(1:LEN_TRIM(OVSNAM(IVTYPE)))// 40.41
& '_x' 40.41
ELSE 40.41
NAMVAR = OVSNAM(IVTYPE)(1:LEN_TRIM(OVSNAM(IVTYPE)))// 40.41
& '_x_'//CTIM 40.41
END IF 40.41
CALL SWRMAT( MYK, MXK, NAMVAR, 40.41
& VOQ(1,VOQR(IVTYPE)), NREF, IREC(IRQ), 40.51
& IDLA, OVEXCV(IVTYPE))
IF (IL.EQ.1) THEN 40.41
NAMVAR = OVSNAM(IVTYPE)(1:LEN_TRIM(OVSNAM(IVTYPE)))// 40.41
& '_y' 40.41
ELSE 40.41
NAMVAR = OVSNAM(IVTYPE)(1:LEN_TRIM(OVSNAM(IVTYPE)))// 40.41
& '_y_'//CTIM 40.41
END IF 40.41
CALL SWRMAT( MYK, MXK, NAMVAR, 40.41
& VOQ(1,VOQR(IVTYPE)+1), NREF, IREC(IRQ), 40.51
& IDLA, OVEXCV(IVTYPE))
!NCF ELSE IF (NCF) THEN 41.40
!NCF IF ( IVTYPE.GT.3 ) THEN
!NCF CALL swn_outnc_appendblock(MYK, MXK, IVTYPE, OQI(1),
!NCF & IRQ, VOQ(1,VOQR(IVTYPE)),
!NCF & OVEXCV(IVTYPE), 1)
!NCF CALL swn_outnc_appendblock(MYK, MXK, IVTYPE, OQI(1),
!NCF & IRQ, VOQ(1,VOQR(IVTYPE)+1),
!NCF & OVEXCV(IVTYPE), 2)
!NCF END IF
ELSE
CALL SBLKPT(IPD, NREF, DFAC, PSNAME, OVUNIT(IVTYPE),
& MXK, MYK, IDLA, OVLNAM(IVTYPE)//'X-comp',
& VOQ(1,VOQR(IVTYPE)))
CALL SBLKPT(IPD, NREF, DFAC, PSNAME, OVUNIT(IVTYPE),
& MXK, MYK, IDLA, OVLNAM(IVTYPE)//'Y-comp',
& VOQ(1,VOQR(IVTYPE)+1))
END IF
ENDIF
!
END DO
900 CONTINUE
!NCF IF ( NCF ) CALL swn_outnc_close_on_end(OQI(1), IRQ) 41.40
IF (IPD.EQ.1 .AND. NREF.EQ.PRINTF) WRITE (PRINTF, 6030)
6030 FORMAT (///)
!
RETURN
! * end of subroutine SWBLOK *
END
!***********************************************************************
! *
SUBROUTINE SBLKPT (IPD, NREF, DFAC, PSNAME, QUNIT,
& MXK, MYK, IDLA, STRING, OQVALS)
! *
!***********************************************************************
USE OCPCOMM2 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM3 40.41
USE OUTP_DATA 40.13
USE TIMECOMM 40.41
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmers: The SWAN team |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2016 Delft University of Technology
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! A copy of the GNU General Public License is available at
! http://www.gnu.org/copyleft/gpl.html#SEC3
! or by writing to the Free Software Foundation, Inc.,
! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! 0. Authors
!
! 30.72: IJsbrand Haagsma
! 30.74: IJsbrand Haagsma (Include version)
! 30.82: IJsbrand Haagsma
! 40.13: Nico Booij
! 40.41: Marcel Zijlema
!
! 1. Updates
!
! 00.00, Mar. 87: subroutine heading added, some variable names
! line numbers changed, layout modified
! 00.04, Feb. 90: lay-out of output changed according to IDLA=1
! 30.72, Sept 97: Changed DO-block with one CONTINUE to DO-block with
! two CONTINUE's
! 30.74, Nov. 97: Prepared for version with INCLUDE statements
! 30.82, Nov. 98: Corrected syntax format statement
! 40.13, July 01: variable formats introduced, using module OUTP_DATA
! 40.13, Oct. 01: longer output filenames now obtained from array
! OUTP_FILES (in module OUTP_DATA)
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
!
! 2. Purpose
!
! Writing the block output either on paper or to datafile
!
! 3. Method
!
! ---
!
! 4. PARAMETERLIST
!
! IPD INT input switch for printing on paper (IPD=1)
! or writing to datafile (IPD = 2 or 3)
! NREF INT input unit reference number of output file
! DFAC REAL input multiplication factor of block output
! IVTYPE INT input type of the output quantity
! Note: IVTYPE=0 for Y-component of a
! vectorial quantity
! PSNAME CH*8 input name of output point set (frame)
! QUNIT CH*6 input physical unit (dimension) of variable
! MXK int input number of points in x-direction of frame
! MYK int input number of points in y-direction of frame
! IDLA INT input controls lay-out of output (see user manual)
! STRING CH*(*) input description of output variable
!
! 8. Subroutines used
!
! ---
!
! 9. Subroutines calling
!
! SWBLOK (SWAN/OUTP)
!
! 10. Error messages
!
! ---
!
! 11. Remarks
!
! ---
!
! 12. Structure
!
! ----------------------------------------------------------------
! If IPD = 1 (output on paper) then
! If DFAC < 0 (DFAC not given by the user) then
! Compute maximum value of output variable
! Compute multiplication factor DFAC
! ------------------------------------------------------------
! Print block heading
! For each IX of the output frame do
! Print IX and for every IY the value of the outputvariable
! ------------------------------------------------------------
! Else
! If DFAC < 0 then DFAC = 1.
! Write output variable line by line to datafile
! ----------------------------------------------------------------
!
! 13. Source text
!
CHARACTER (LEN=20) :: WFORM1 = '(A1, 2X, 151(I6))' 40.13
CHARACTER (LEN=21) :: WFORM2 = '(1X,I4,1X, 151(F6.0))' 41.41 40.13
CHARACTER (LEN=20) :: WFORM3 = '(5X, 151(F6.0))' 40.13
CHARACTER PSNAME*8, STRING*(*), QUNIT*(*) 40.00
REAL DFAC, OQVALS(*)
INTEGER NREF, MXK, MYK, IPD
LOGICAL BPRN
SAVE IENT
DATA IENT /0/
IF (LTRACE) CALL STRACE (IENT,'SBLKPT')
!
IF (ITEST.GE.150) WRITE (PRTEST, 10) NREF,IPD,MXK,MYK
10 FORMAT (' SBLKPT', 4(I6)) 30.82
!
!
! divide all output values by the given factor (DFAC)
!
IF (ABS(DFAC-1.) .GT. 0.001) THEN
RPDFAC=1./DFAC
DO 15 IP = 1, MXK*MYK
OQVALS(IP) = OQVALS(IP)*RPDFAC
15 CONTINUE
ENDIF
!
!
! IFF = VOQR(IVTYPE)
!
IF (IPD.EQ.1) THEN
!
! ***** output on paper *****
!
WRITE (NREF, 20) OUT_COMMENT 40.13
WRITE (NREF, 20) OUT_COMMENT 40.13
20 FORMAT (A)
WRITE (NREF, 22) OUT_COMMENT, PROJNR, PSNAME, STRING, 40.13
& DFAC, QUNIT 40.13
22 FORMAT (A,' Run:', A4, ' Frame: ',A8,' ** ',A,', Unit:', 40.13
& E12.4, 1X, A) 40.13
IF (NSTATM .GT. 0) THEN
WRITE (NREF, 24) OUT_COMMENT, CHTIME 40.13
24 FORMAT (A,' Time:', A) 40.13
ELSE
WRITE (NREF, 20) OUT_COMMENT 40.13
ENDIF 40.13
WRITE (NREF, 20) OUT_COMMENT 40.13
ISP = 151 30.21
DO 31 IXP1 = 1, MXK, ISP 30.72
IXP2 = IXP1+ISP-1
IF (IXP2.GT.MXK) IXP2=MXK
WRITE (WFORM1(15:15), '(I1)') DEC_BLOCK 40.13
WRITE (WFORM2(17:17), '(I1)') DEC_BLOCK 40.13
WRITE (WFORM3(11:11), '(I1)') DEC_BLOCK 40.13
IF (ITEST.GE.80) WRITE (PRTEST, 25) WFORM1, WFORM2, WFORM3 40.13
25 FORMAT (' SBLKPT Formats: ', A, /, 17X, A, /, 17X, A) 40.13
WRITE (NREF, 26) OUT_COMMENT 40.13
26 FORMAT (A1,' X --->') 40.13
WRITE (NREF, 20) OUT_COMMENT 40.13
WRITE (NREF, WFORM1) OUT_COMMENT, (II-1,II=IXP1,IXP2) 40.13
WRITE (NREF, 99030) OUT_COMMENT 40.13
99030 FORMAT (A1, 'Y') 40.13
BPRN = .TRUE.
DO 30 IYK = MYK, 1, -1
IP = (IYK-1)*MXK
IF (BPRN) THEN
WRITE (NREF, WFORM2) IYK-1,
& (OQVALS(IP+IXK), IXK=IXP1,IXP2)
ELSE
WRITE (NREF, WFORM3)
& (OQVALS(IP+IXK), IXK=IXP1,IXP2)
ENDIF
!!! BPRN = .NOT. BPRN
30 CONTINUE 30.72
31 CONTINUE 30.72
ELSE
!
! ***** output to datafile *****
!
ISP=6
IF (IDLA.EQ.4) THEN
WRITE (NREF, FLT_BLOCK) (OQVALS(IP), IP=1, MXK*MYK) 40.13
ELSE
DO 50 IYK = 1, MYK 13/FEB
IF (IDLA.EQ.3) THEN
IP = (IYK-1)*MXK
ELSE
IP = (MYK-IYK)*MXK
ENDIF
WRITE (NREF, FLT_BLOCK) (OQVALS(IP+IXK), IXK=1,MXK) 40.13
50 CONTINUE
ENDIF
ENDIF
!
RETURN
! * end of subroutine SBLKPT *
END
!****************************************************************
!
SUBROUTINE SWBLKP ( OQI , IVTYP, MXK , MYK, VOQR, VOQ,
& IONOD ) 40.51
!
!****************************************************************
!
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE OUTP_DATA
USE M_PARALL 40.51
!PUN USE SIZES, ONLY: MYPROC
!
IMPLICIT NONE
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering and Geosciences |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmer: Marcel Zijlema |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2016 Delft University of Technology
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! A copy of the GNU General Public License is available at
! http://www.gnu.org/copyleft/gpl.html#SEC3
! or by writing to the Free Software Foundation, Inc.,
! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! 0. Authors
!
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
! 40.51: Agnieszka Herman
!
! 1. Updates
!
! 40.31, Dec. 03: New subroutine
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 40.51, Feb. 05: further optimization
!
! 2. Purpose
!
! Write block data to process output file
!
! 3. Method
!
! Write data without header using the format FLT_BLKP
!
! 4. Argument variables
!
! IONOD array indicating in which subdomain output points 40.51
! are located 40.51
! IVTYP type of variable output
! MXK number of points in x-direction of output frame
! MYK number of points in y-direction of output frame
! OQI array containing output request data
! VOQ output variables
! VOQR array containing information for output
!
INTEGER MXK, MYK, OQI(4), IVTYP(OQI(3)), VOQR(*)
INTEGER IONOD(*) 40.51
REAL VOQ(MXK*MYK,*)
!
! 6. Local variables
!
! IENT : number of entries
! IOSTAT: status of input/output
! IP : pointer
! IPROC : processor number
! IVTYPE: type number output variable
! IXK : loop counter
! IYK : loop counter
! JVAR : loop counter
! NREF : unit reference number
! NVAR : number of variables
!
INTEGER IENT, IOSTAT, IP, IPROC,IVTYPE, IXK, IYK, JVAR, NREF, NVAR
!
! 8. Subroutines used
!
! FOR General open file routine
! STPNOW Logical indicating whether program must
! terminated or not
! STRACE Tracing routine for debugging
!
LOGICAL STPNOW
!
! 9. Subroutines calling
!
! SWOUTP
!
! 13. Source text
!
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'SWBLKP')
NREF = OQI(1)
IF (NREF.EQ.0) THEN
FILENM = OUTP_FILES(OQI(2))
IOSTAT = -1
CALL FOR (NREF, FILENM, 'UU', IOSTAT)
IF (STPNOW()) RETURN
OQI(1) = NREF
OUTP_FILES(OQI(2)) = FILENM 40.41
END IF
NVAR = OQI(3)
!NPUN IPROC = INODE
!PUN IPROC = MYPROC
DO JVAR = 1, NVAR
IVTYPE = IVTYP(JVAR)
DO IYK = 1, MYK 40.51
IP = (IYK-1)*MXK 40.51
DO IXK = 1, MXK 40.51
IF ( IONOD(IP+IXK).EQ.IPROC ) 40.51
& WRITE (NREF) VOQ(IP+IXK,VOQR(IVTYPE)) 40.51
END DO 40.51
END DO 40.51
IF ( OVSVTY(IVTYPE).GE.3 ) THEN
DO IYK = 1, MYK 40.51
IP = (IYK-1)*MXK 40.51
DO IXK = 1, MXK 40.51
IF ( IONOD(IP+IXK).EQ.IPROC ) 40.51
& WRITE (NREF) VOQ(IP+IXK,VOQR(IVTYPE)+1) 40.51
END DO 40.51
END DO 40.51
END IF
END DO
RETURN
END
!****************************************************************
!
SUBROUTINE SRAWPT ( NREF, VOQR, VOQ, MXK, MYK )
!
!****************************************************************
!
USE SWCOMM1
USE SWCOMM3, ONLY: BNAUT, NSTATM, PI
USE SWCOMM4, ONLY: KSPHER
USE OCPCOMM4
!
IMPLICIT NONE
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmers: The SWAN team |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2016 Delft University of Technology
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! A copy of the GNU General Public License is available at
! http://www.gnu.org/copyleft/gpl.html#SEC3
! or by writing to the Free Software Foundation, Inc.,
! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! 0. Authors
!
! 41.62: Andre van der Westhuysen
!
! 1. Updates
!
! 41.62, Nov. 15: New subroutine
!
! 2. Purpose
!
! Generates a dump of the raw partition data at all grid points
!
! 4. Argument variables
!
! MXK int input number of points in x-direction of frame
! MYK int input number of points in y-direction of frame
! NREF int input unit reference number of output file
! VOQR
! VOQ
!
INTEGER NREF, MXK, MYK
INTEGER VOQR(*)
REAL VOQ(MXK*MYK,*)
!
! 6. Local variables
!
! CABS : magnitude of current
! CDIR : direction of current
! IP : pointer
! IXK : counter in x-direction
! IYK : counter in y-direction
! NPT : actual number of partitions
! UABS : magnitude of wind
! UDIR : direction of wind
!
INTEGER IENT, II, IP, IXK, IYK
INTEGER NPT
REAL UABS, UDIR, CABS, CDIR
REAL HS, TP, DIR, XP, YP, DEP, DSPR, WL
!
REAL HSPT(10), TPPT(10), WLPT(10), DIRPT(10),
& DSPT(10), WFPT(10), STPT(10)
!
REAL DEGCNV
!
! 9. Subroutines calling
!
! SWBLOK
!
! 13. Source text
!
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'SRAWPT')
!
DO IYK = MYK, 1, -1
DO IXK = 1, MXK
IP = (IYK-1)*MXK+IXK
!
HS = VOQ(IP,VOQR(10))
TP = VOQ(IP,VOQR(12))
DIR = VOQ(IP,VOQR(13))
!
! --- if not an exception value of wave height, peak period
! and wave direction, write values to file
!
IF ( (HS .NE. OVEXCV(10)) .AND.
& (TP .NE. OVEXCV(12)) .AND.
& (DIR .NE. OVEXCV(13)) ) THEN
!
XP = VOQ(IP,VOQR(1))
YP = VOQ(IP,VOQR(2))
DEP = VOQ(IP,VOQR(4))
DSPR = VOQ(IP,VOQR(16))
WL = VOQ(IP,VOQR(17))
!
NPT = INT(VOQ(IP,VOQR(171)))
!
! --- compute magnitude and direction of wind and ambient current
!
UABS = SQRT(VOQ(IP,VOQR(26))**2+VOQ(IP,VOQR(26)+1)**2)
UDIR = ATAN2(VOQ(IP,VOQR(26)+1),VOQ(IP,VOQR(26)))*180./PI
IF (.NOT.BNAUT) UDIR = UDIR + ALCQ * 180./PI
IF (UDIR.LT.0.) UDIR = UDIR + 360.
UDIR = DEGCNV(UDIR)
!
CABS = SQRT(VOQ(IP,VOQR(5))**2+VOQ(IP,VOQR(5)+1)**2)
CDIR = ATAN2(VOQ(IP,VOQR(5)+1),VOQ(IP,VOQR(5)))*180./PI
IF (CDIR.GT.360.) CDIR = CDIR - 360.
IF (CDIR.LT.0. ) CDIR = CDIR + 360.
!
! store partition parameters per grid point
!
DO II = 0, 9
HSPT (II+1) = VOQ(IP,VOQR(100+II))
TPPT (II+1) = VOQ(IP,VOQR(110+II))
WLPT (II+1) = VOQ(IP,VOQR(120+II))
DIRPT(II+1) = VOQ(IP,VOQR(130+II))
DSPT (II+1) = VOQ(IP,VOQR(140+II))
WFPT (II+1) = VOQ(IP,VOQR(150+II))
! STPT (II+1) = VOQ(IP,VOQR(160+II))
END DO
!
! write the partition data
!
IF (NSTATM.EQ.1) THEN
IF (KSPHER.EQ.0) THEN
WRITE(NREF,'(A9,X,A6,2F14.4,A14,I3,F7.1,
& F5.1,F6.1,F5.1,F6.1)')
& CHTIME(1:8),CHTIME(10:16),YP,XP,'''grid_point''',
& NPT, DEP, UABS, UDIR, CABS, CDIR
ELSE
WRITE(NREF,'(A9,X,A6,2F12.6,A14,I3,F7.1,
& F5.1,F6.1,F5.1,F6.1)')
& CHTIME(1:8),CHTIME(10:16),YP,XP,'''grid_point''',
& NPT, DEP, UABS, UDIR, CABS, CDIR
ENDIF
ELSE
IF (KSPHER.EQ.0) THEN
WRITE(NREF,'(16X,2F14.4,A14,I3,F7.1,
& F5.1,F6.1,F5.1,F6.1)')
& YP,XP,'''grid_point''',
& NPT, DEP, UABS, UDIR, CABS, CDIR
ELSE
WRITE(NREF,'(16X,2F12.6,A14,I3,F7.1,
& F5.1,F6.1,F5.1,F6.1)')
& YP,XP,'''grid_point''',
& NPT, DEP, UABS, UDIR, CABS, CDIR
ENDIF
ENDIF
!
WRITE(NREF,'(I3,F8.2,F8.2,F8.2,F9.2,F9.2,F7.2)')
& 0, HS, TP, WL, DIR, DSPR, 999.99
!
DO II = 1, NPT
WRITE(NREF,'(I3,F8.2,F8.2,F8.2,F9.2,F9.2,F7.2)')
& II , HSPT(II), TPPT(II), WLPT(II),
& DIRPT(II), DSPT(II), WFPT(II)
END DO
!
END IF
!
END DO
END DO
!
RETURN
END
!***********************************************************************
! *
!NCF SUBROUTINE SWTABP (RTYPE , OQI , OQR , IVTYP, PSNAME, MIP, VOQR,
!NNCF SUBROUTINE SWTABP (RTYPE , OQI , IVTYP, PSNAME, MIP, VOQR, 40.31
& VOQ, IONOD) 40.51
! *
!***********************************************************************
USE OCPCOMM2 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM2 40.41
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE OUTP_DATA 40.13
USE TIMECOMM 40.41
USE M_PARALL 40.51
!NCF USE swn_outnc, only: swn_outnc_openblockfile,
!NCF & swn_outnc_appendblock,
!NCF & swn_outnc_close_on_end
!PUN USE SIZES, ONLY: MYPROC, MNPROC
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmers: The SWAN team |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2016 Delft University of Technology
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation; either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! A copy of the GNU General Public License is available at
! http://www.gnu.org/copyleft/gpl.html#SEC3
! or by writing to the Free Software Foundation, Inc.,
! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! 0. Authors
!
! 30.62: IJsbrand Haagsma
! 30.74: IJsbrand Haagsma (Include version)
! 30.80: Nico Booij
! 30.81: Annette Kieftenburg
! 30.82: IJsbrand Haagsma
! 32.01: Roeland Ris & Cor van der Schelde
! 34.01: Jeroen Adema
! 40.00: Nico Booij (Non-stationary boundary conditions)
! 40.03, 40.13: Nico Booij
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
! 40.51: Agnieszka Herman
!
! 1. Updates
!
! 30.50, Sep. 96: option TABI (indexed file) added
! 30.62, Jul. 97: corrected initialisation of table output
! 30.74, Nov. 97: Prepared for version with INCLUDE statements
! 32.01, Jan. 98: Extended initialisation of NUMDEC for SETUP
! 30.80, Apr. 98: number of decimals for setup from 2 to 3
! 40.00, June 98: severely revised
! 30.82, Oct. 98: Header information is now also printed in PRINT file
! 30.81, Jan. 99: Replaced variable FROM by FROM_ (because FROM is