-
Notifications
You must be signed in to change notification settings - Fork 0
/
swanout1.ftn
5727 lines (5725 loc) · 259 KB
/
swanout1.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 1 of 2
!
! Contents of this file:
! SWOUTP
! SWORDC
! SWODDC
! SWOEXC
! SWOEXD
! SWIPOL
! SWOEXA
! SWOINA
! SWOEXF
!
! main output routine and computation of output quantities
!
!***********************************************************************
! *
SUBROUTINE SWOUTP (AC2 , 40.31 30.90
& SPCSIG ,SPCDIR , 30.72
& COMPDA ,XYTST ,
& KGRPNT ,XCGRID , 30.72
& YCGRID ,OURQT ) 40.51 40.30
! *
!***********************************************************************
!
USE TIMECOMM 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM2 40.80
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE OUTP_DATA 40.31
USE M_PARALL 40.31
USE SwanGriddata 40.80
USE SwanIEM, ONLY: ntf, dfiem, Ebig 41.85
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering and Geosciences |
! | 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-2024 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 3 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.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
!
! 0. Authors
!
! 30.72: IJsbrand Haagsma
! 30.74: IJsbrand Haagsma (Include version)
! 30.81: Annette Kieftenburg
! 30.82: IJsbrand Haagsma
! 30.90: IJsbrand Haagsma (Equivalence version)
! 34.01: Jeroen Adema
! 40.00, 40.13: Nico Booij
! 40.02: IJsbrand Haagsma
! 40.30: Marcel Zijlema
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
! 40.51: Marcel Zijlema
! 40.80: Marcel Zijlema
! 40.86: Nico Booij
! 40.90: Nico Booij
! 41.85: Ad Reniers
!
! 1. Updates
!
! 10.10, Aug. 94: computation of force is added (subr. SWOEXF)
! arrays NE and NED added
! 30.72, Oct. 97: changed floating point comparison to avoid equality
! comparisons
! 30.74, Nov. 97: Prepared for version with INCLUDE statements
! 30.72, Feb. 98: Introduced generic names XCGRID, YCGRID and SPCSIG for SWAN
! 40.00, June 98: argument KGRBND added, call SWPLOT and SWOEXC
! modified
! 30.90, Oct. 98: Introduced EQUIVALENCE POOL-arrays
! 30.82, Oct. 98: Updated description of several variables
! 30.81, Jan. 99: Replaced variable STATUS by IERR (because STATUS is a
! reserved word)
! 40.00, Jan. 99: argument RTYPE added in call SWODDC
! 34.01, Feb. 99: Introducing STPNOW
! 40.02, Oct. 00: Made TYPE of several equivalenced arrays correct
! 40.02, Oct. 00: Modified argument list of SWPLOT to avoid int/real conflict
! 40.13, Oct. 01: Forces always computed by post-processing procedure
! 40.30, Jan. 03: introduction distributed-memory approach using MPI
! 40.31, Nov. 03: removing POOL construction and HPGL-functionality
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 40.51, Feb. 05: optimization output process in parallel mode
! 40.80, Feb. 08: computation of wave-induced force on unstructured grid added
! 40.86, Feb. 08: arguments added to calls of subroutines
! to prevent interpolation over obstacles
! 40.90, June 08: arguments added to call of subroutine SWSPEC
! to prevent interpolation over obstacles
! 41.85, June 19: implementation of IEM (surfbeat model)
!
! 2. Purpose
!
! Processing of the output requests
!
! 3. Method
!
! ---
!
! 4. Argument variables
!
! i OURQT : array indicating at what time requested output 40.51
! is processed 40.51
! i SPCDIR: (*,1); spectral directions (radians) 30.82
! (*,2); cosine of spectral directions 30.82
! (*,3); sine of spectral directions 30.82
! (*,4); cosine^2 of spectral directions 30.82
! (*,5); cosine*sine of spectral directions 30.82
! (*,6); sine^2 of spectral directions 30.82
! i SPCSIG: Relative frequencies in computational domain in sigma-space 30.72
! i XCGRID: Coordinates of computational grid in x-direction 30.72
! i YCGRID: Coordinates of computational grid in y-direction 30.72
!
REAL*8 OURQT(MAX_OUTP_REQ) 40.51 40.30
REAL SPCDIR(MDC,6) 30.82
REAL SPCSIG(MSC) 30.72
REAL XCGRID(MXC,MYC), YCGRID(MXC,MYC) 30.72
!
! AC2 real arr input action density in all computational points
! SPCDIR real arr input spectral directions, cosines and sines
! UX2 real arr input current velocity x-comp.
! UY2 real arr input current velocity y-comp.
! UBOT real arr input orbital velocities at bottom
! WX2 real arr input wind velocity x-comp.
! WY2 real arr input wind velocity y-comp.
!
! 8. Subroutines used
!
! SWBLOK
! SWTABP
! SWSPEC
! FOR
!
LOGICAL STPNOW 34.01
!
! 9. Subroutines calling
!
! MAIN program
!
! 10. Error messages
!
! If an output request is of an unknown type, an error message
! is printed.
!
! 11. Remarks
!
! Data:
!
! output requests are encoded in array OUTREQ; these are set by
! commands TABLE, BLOCK, SPEC, etc. (see subr SWREOQ in file SWANPRE2)
! each output request refers to one set of output locations,
! and to one or more output quantities.
! 1st value in OUTREQ: time of next output, 2nd value: interval between
! outputs, 3d value: type of output request RTYPE (encoded as integer),
! 4&5: PSNAME (name of point set),
! 6: file unit number, 7..10: output filename,
! other: dependent on type of output.
!
! data on output locations are in array OUTDA; these are set by
! commands FRAME, POINTS, CURVE etc. (see subr SWREPS in file SWANPRE2)
! each set is characterized by its name (SNAME in the code)
! STYPE is the type of set (i.e. 'F' for Frame etc.)
!
! properties of output quantities are in arrays OVSNAM, OVLNAM,
! OVUNIT, OVSVTY etc.; these are set in subr SWINIT (file SWANMAIN)
! each output quantity is assigned a fixed number; i.e. 1=Xp, 2=Yp,
! 7=Dissip, 10=Hs, 11=Tm01 etc.
! subr SVARTP determines the above number from the name of the
! quantity as it appears in the user command; this is compared with
! OVKEYW.
!
! Procedure:
!
! After the coordinates of all output locations have been determined,
! values of all output quantities are calculated, and written into
! 2d array VOQ (one or two columns for each output quantity, one line
! for each location). array VOQR shows with quantity is written in
! each column.
! After array VOQ is filled, the actual output starts; which subroutine
! is called depends on RTYPE (see structure scheme below).
!
! 12. Structure
!
! ----------------------------------------------------------------
! For all output requests do
! Call SWORDC (analyzes output req.; gives name of output
! point set, type of output RTYPE
! and number of quantities per point)
! Call SWODDC (analyzes output data; gives number of output
! points)
! ------------------------------------------------------------
! Call SWOEXC (compute coordinates of output points)
! Call SWOEXD (compute depth, current vel. dissipation etc.)
! Call SWOEXA (compute action density and related quant.)
! Call SWOEXF (compute wave-driven force)
! ------------------------------------------------------------
! If RTYPE = 'BLKP', 'BLKD' or 'BLKV' then
! call SWBLOK for block output
! If RTYPE = 'TABP' or 'TABD' then call SWTABP for output in
! table
! If RTYPE = 'SPEC' then call SWSPEC for spectral output
! ----------------------------------------------------------------
! If program is run in stationary mode 40.00
! Then Close all opened files 40.00
! ----------------------------------------------------------------
!
! 13. Source text
!
INTEGER VOQR(NMOVAR) ,BKC , 40.31
& XYTST(*) ,KGRPNT(MXC,MYC),IERR 30.81 30.21
!
REAL AC2(MDC,MSC,MCGRD) ,
& COMPDA(MCGRD,MCMVAR)
LOGICAL, ALLOCATABLE :: CROSS(:,:) ! true if obstacle is between 40.86
! output point and computational 40.86
! grid point 40.86
!
INTEGER INDX, ID, IS, ITMP1, ISTAT
REAL DF, FREQS(ntf)
REAL, ALLOCATABLE :: EBLOC(:,:,:)
!
INTEGER, ALLOCATABLE :: IONOD(:) 40.51
REAL, ALLOCATABLE :: ACLOC(:), AUX1(:), VOQ(:) 40.31
REAL, ALLOCATABLE :: FORCE(:,:) 40.80
REAL :: KNUM(MSC), CG(MSC), NE(MSC), NED(MSC) 40.31
TYPE(OPSDAT), POINTER :: CUOPS 40.31
TYPE(ORQDAT), POINTER :: CORQ 40.31
!
LOGICAL OQPROC(NMOVAR) , LOGACT 30.00
CHARACTER RTYPE *4, STYPE *1, PNAME *8, PTYPE *1
SAVE IENT
DATA IENT /0/
CALL STRACE (IENT, 'SWOUTP')
!
! processing of output requests
!
IF (NPTST.GT.0) CALL AC2TST (XYTST, AC2 ,KGRPNT) 30.21
!
IF (NREOQ.EQ.0) THEN
CALL MSGERR (1, 'no output requested') 40.31
RETURN
ENDIF
IF (ITEST.GE.10) WRITE (PRINTF, 12) NREOQ
12 FORMAT (1X, I3, ' output requests')
!
IF (LSRFB) THEN
IF (.NOT.ALLOCATED(EBLOC)) THEN
ALLOCATE(EBLOC(MDC,ntf,MCGRD),STAT=ISTAT)
END IF
IF ( ISTAT.NE.0 ) THEN
CALL MSGERR ( 4, 'Allocation problem: array EBLOC' )
WRITE(PRINTF,*) 'return code is ',ISTAT
RETURN
END IF
EBLOC = 0.
ELSE
IF(.NOT.ALLOCATED(EBLOC)) ALLOCATE(EBLOC(0,0,0))
ENDIF
!
! Repeat for all output requests:
!
CORQ => FORQ 40.31
DO 70 IRQ = 1, NREOQ
!
! ***** processing of output instructions *****
!
BKC = 0
NVOQP = 0
!
! call SWORDC to analyse output request encoded in array OUTREQ
! NVOQP (number of output quantities)
!
RTYPE = CORQ%RQTYPE 40.31
SNAME = CORQ%PSNAME 40.31
CALL SWORDC (CORQ%OQI, CORQ%OQR, CORQ%IVTYP, RTYPE, 40.31 30.90
& SNAME, NVOQP, OQPROC, BKC, VOQR, OURQT(IRQ), 40.51
& LOGACT) 30.00
IF (.NOT.LOGACT) THEN 40.31 30.00
CORQ => CORQ%NEXTORQ 40.31
GOTO 70 40.31 30.00
END IF
!
IF (SCREEN.NE.PRINTF.AND.IAMMASTER) WRITE (SCREEN, 15) IRQ 40.30
15 FORMAT ('+SWAN is processing output request ', I4) 40.41 30.00
IF (ITEST.GE.10) WRITE(PRINTF,16) IRQ
16 FORMAT (' SWAN is processing output request ', I4) 40.41
!
CUOPS => FOPS 40.31
DO 40.31
IF (CUOPS%PSNAME.EQ.SNAME) EXIT 40.31
IF (.NOT.ASSOCIATED(CUOPS%NEXTOPS)) THEN 40.31
CALL MSGERR (3, 'Output requested for non-existing points') 10.21
WRITE (PRINTF, 18) SNAME 40.31 30.81 30.00
18 FORMAT (' Point set: ', A) 40.31 30.00
GOTO 68 40.00
END IF 40.31
CUOPS => CUOPS%NEXTOPS 40.31
END DO 40.31
!
IF (ITEST.GE.80 .OR. IOUTES .GE. 10)
& WRITE (PRTEST, 22) IRQ, NVOQP, RTYPE, SNAME
22 FORMAT (' Test SWOUTP ', 2I6, 2X, A4, 2X, A16)
!
! call SWODDC to analyse output data; results: STYPE (type of output
! point set), MIP (number of output locations) etc.
!
STYPE = CUOPS%PSTYPE 40.31
MIP = CUOPS%MIP 40.31
CALL SWODDC (CUOPS%OPI, CUOPS%OPR, SNAME, STYPE, MIP, MXK, 40.31
& MYK, XNLEN, YNLEN, MXN, MYN, XPCN, YPCN, ALPCN,
& XCGRID,YCGRID,RTYPE) 40.00
!
! assign memory to array VOQ (contains output quantities for all
! output points)
ALLOCATE(VOQ(MIP*NVOQP)) 40.31
VOQ = 0.
!
! assign memory to array CROSS (indicates crossing of obstacles 40.86
! in between output and grid points) 40.86
ALLOCATE(CROSS(4,MIP)) 40.86
CROSS = .FALSE. 42.05
!
! assign memory to array IONOD (indicates in which subdomain 40.51
! output points are located) 40.51
ALLOCATE(IONOD(MIP)) 40.51
IF (.NOT.PARLL) THEN 41.95
IONOD = MASTER 41.95
ELSE 41.95
IONOD = -999 40.51
ENDIF 41.95
!
! call SWOEXC to calculate quantities dependent only on coordinates
!
CALL SWOEXC (STYPE , 40.31
& CUOPS%OPI ,CUOPS%OPR , 40.31
& CUOPS%XP ,CUOPS%YP , 40.31
& MIP ,VOQ(1) , 40.31 30.90
& VOQ(1+MIP) ,VOQ(1+2*MIP) , 40.31 30.90
& VOQ(1+3*MIP) ,KGRPNT , 40.31 30.90
& XCGRID ,YCGRID , 30.21
& CROSS ) 40.86 40.00
!
! Compute wave-induced force on unstructured grid 40.80
!
IF (OQPROC(20) .AND. OPTG.EQ.5) THEN 40.80
ALLOCATE(FORCE(nverts,2)) 40.80
CALL SwanComputeForce ( FORCE(1,1), FORCE(1,2), AC2, 40.80
& COMPDA(1,JDP2), COMPDA(1,JHS), 40.80
& SPCSIG, SPCDIR ) 40.80
ELSE 40.80
ALLOCATE(FORCE(0,0)) 40.80
ENDIF 40.80
!
! call SWOEXD to interpolate quantities which are computed during the
! SWAN computation, such as Qb, Dissipation, Ursell etc.
!
CALL SWOEXD (RTYPE, OQPROC, MIP, VOQ(1+2*MIP), 41.95 40.31 30.90
& VOQ(1+3*MIP), VOQR, VOQ(1), 40.31 30.90
& COMPDA, KGRPNT, FORCE, CROSS, IONOD 40.86 40.80 40.31
& ,IRQ 41.36
& )
IF (STPNOW()) RETURN
!
DEALLOCATE(FORCE) 40.80
!
IF (BKC .GT. 0) THEN
!
! assign memory to array ACLOC (contains spectrum for one output point)
!
ALLOCATE(ACLOC(MDC*MSC)) 40.31
!
! call SWOEXA to compute quantities for which spectrum is needed
! (except wave-induced force)
!
CALL SWOEXA (OQPROC ,BKC ,
& MIP ,VOQ(1+2*MIP) , 40.31 30.90
& VOQ(1+3*MIP) ,VOQR , 40.31 30.90
& VOQ(1) ,AC2 , 40.31 30.90
& ACLOC ,SPCSIG , 40.31 30.90
& KNUM ,CG , 40.31 30.90
& SPCDIR ,NE , 40.31 30.90
& NED ,KGRPNT , 40.31 30.90
& COMPDA(1,JDP2) ,CROSS ) 40.86
!
! call SWOEXF to compute wave-driven force on regular grid
!
IF (OQPROC(20) .AND. OPTG.NE.5) 40.80 40.13
& CALL SWOEXF (MIP ,VOQ(1+2*MIP) , 40.31 30.90
& VOQ(1+3*MIP) ,VOQR , 40.31 30.90
& VOQ(1) ,AC2 , 40.31 30.90
& COMPDA(1,JDP2) ,SPCSIG , 30.72
& KNUM ,CG , 40.31 30.90
& SPCDIR ,NE , 40.31 30.90
& NED ,KGRPNT , 40.31 30.90
& XCGRID ,YCGRID , 30.72
& COMPDA(1,JHS) ,IONOD 40.31
& )
!
DEALLOCATE(ACLOC) 40.31
ENDIF
!
IF (ITEST.GE.100 ) THEN
WRITE (PRTEST, 23) (VOQR(II), II=1, NMOVAR)
23 FORMAT (' arrays VOQR and VOQ:', 30I3)
DO 25 IP=1, MIN(MIP,20)
WRITE (PRTEST, 24) (VOQ(IP+(JJ-1)*MIP),
& JJ=1, NVOQP)
24 FORMAT (12(1X,E10.4))
25 CONTINUE
ENDIF
!
! ***** block output *****
IF (RTYPE(1:3) .EQ. 'BLK') THEN
IF (RTYPE.EQ.'BLKV') THEN 41.95
CALL SWBLKV ( CORQ%OQI, CORQ%OQR, CORQ%IVTYP, 41.95
& MXK, MYK, VOQR, VOQ(1), STYPE, 41.95
& SNAME, IONOD ) 41.95
ELSE IF (PARLL) THEN 40.31
CALL SWBLKP ( CORQ%OQI, CORQ%IVTYP, MXK, MYK, VOQR, 40.31
& VOQ(1), IONOD ) 40.51 40.31
ELSE 40.31
CALL SWBLOK ( RTYPE, CORQ%OQI, CORQ%OQR, CORQ%IVTYP, 41.40 40.31
& CORQ%FAC, SNAME, MXK, MYK, IRQ, VOQR, 40.51 40.31
& VOQ(1) ) 40.51 40.31
END IF 40.31
IF (STPNOW()) RETURN 34.01
GOTO 68 40.00
ENDIF
!
! ***** table output *****
IF (RTYPE(1:3) .EQ. 'TAB') THEN
!NCF IF (PARLL.AND.(RTYPE.EQ.'TABC')) THEN
!NCF! --- use "block" intermediate file facility to pass data between cores
!NCF CALL SWBLKP ( CORQ%OQI, CORQ%IVTYP, MIP, 1, VOQR,
!NCF & VOQ(1), IONOD )
!NCF ELSE
!NCF CALL SWTABP ( RTYPE, CORQ%OQI, CORQ%OQR, CORQ%IVTYP, SNAME,
!NNCF CALL SWTABP ( RTYPE, CORQ%OQI, CORQ%IVTYP, SNAME, 40.31
& MIP, VOQR, VOQ(1), IONOD ) 40.51 40.31
!NCF ENDIF
IF (STPNOW()) RETURN 34.01
GOTO 68 40.00
ENDIF
!
! ***** spectral output *****
IF (RTYPE(1:2) .EQ. 'SP') THEN 20.28
IF ( .NOT.LSRFB .OR.
& (RTYPE(3:3).NE.'L' .AND. RTYPE(3:3).NE.'B') ) THEN
IF (RTYPE(4:4).EQ.'C') THEN
ALLOCATE(AUX1(MSC*MDC)) 40.31
ELSE
ALLOCATE(AUX1(3*MSC)) 40.31
ENDIF
CALL SWSPEC ( RTYPE, CORQ%OQI, CORQ%OQR, MIP, VOQR, VOQ(1), 41.40 40.31
& AC2, AUX1, SPCSIG, SPCDIR, COMPDA(1,JDP2), 40.90 40.31
& KGRPNT, CROSS, IONOD ) 40.31
ELSE
ITMP1 = MSC
MSC = ntf
IF (RTYPE(4:4).EQ.'C') THEN
ALLOCATE(AUX1(MSC*MDC))
ELSE
ALLOCATE(AUX1(3*MSC))
ENDIF
DF = PI2 * dfiem
FREQS(1) = DF
DO IS = 2, MSC
FREQS(IS) = FREQS(IS-1) + DF
ENDDO
DO INDX = 1, MCGRD
DO ID = 1, MDC
DO IS = 1, MSC
EBLOC(ID,IS,INDX) = Ebig(ID,IS,INDX) / FREQS(IS) /
& ( DF * DDIR )
ENDDO
ENDDO
ENDDO
CALL SWSPEC ( RTYPE, CORQ%OQI, CORQ%OQR, MIP, VOQR, VOQ(1),
& EBLOC, AUX1, FREQS, SPCDIR, COMPDA(1,JDP2),
& KGRPNT, CROSS, IONOD )
MSC = ITMP1
ENDIF
IF (STPNOW()) RETURN 34.01
DEALLOCATE(AUX1) 40.31
GOTO 68 40.00
ENDIF
!
60 WRITE (PRINTF, 62) IRQ, NVOQP, RTYPE, SNAME, MIP
62 FORMAT (' Error in output request ', 2I6, 2X, A4, 2X, A16, I6)
!
68 CONTINUE 40.31
DEALLOCATE(VOQ,CROSS,IONOD) 40.86 40.51 40.31
CORQ => CORQ%NEXTORQ 40.31
70 CONTINUE
IF (ALLOCATED(EBLOC)) DEALLOCATE(EBLOC)
!
! Termination of output
!
200 RETURN
END SUBROUTINE SWOUTP
!***********************************************************************
! *
SUBROUTINE SWORDC (OUTI, OUTR, IVTYP, RTYPE, PSNAME, NVOQP, 40.31
& OQPROC, BKC, 40.31
& VOQR, OURQT, LOGACT) 40.51 30.00
! *
!***********************************************************************
!
USE TIMECOMM 40.41
!NCF USE OCPCOMM2 41.40
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM3 40.41
USE SWCOMM4 40.41
!NCF USE OUTP_DATA 41.40
USE M_PARALL 40.31
USE OUTP_DATA, ONLY: NTVTK 41.95
!
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering and Geosciences |
! | 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-2024 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 3 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.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
!
! 0. Authors
!
! 30.61: Roberto Padilla
! 30.74: IJsbrand Haagsma (Include version)
! 30.81: Annette Kieftenburg
! 40.30: Marcel Zijlema
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
! 41.62: Andre van der Westhuysen
!
! 1. Update
!
! 10.33, Jan. 95: computation of wind added in polar plot
! 30.61, Summ 97: give values for array VOQR when OQPROC = .TRUE.
! in case of 'nest'
! 30.74, Nov. 97: Prepared for version with INCLUDE statements
! 30.81, Jan. 99: Replaced variable FROM by FROM_ (because FROM
! is a reserved word)
! 40.30, May 03: introduction distributed-memory approach using MPI
! 40.31, Nov. 03: removing HPGL-functionality
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 41.62, Nov. 15: included fields required for partitioning output
!
! 2. Purpose
!
! Decodes output requests
!
! 3. Method
!
! ---
!
! 4. Argument list
!
! OUTR Real input Code for one output request
! RTYPE Char outp type of output
! PSNAME Char outp name of output point set referred to
! NVOQP Int outp number of data per output point
! OQPROC logic outp whether or not an output quantity must
! be processed
! VOQR Int ar outp place of each output quantity
! (subscript: IVTYP)
! OURQT Int ar input array indicating at what time requested 40.51
! output is processed 40.51
!
! 8. Subroutines used
!
! SPSET
! SUVIPL
! SBLKPT
! SCUNIT
! SFLFUN (all SWAN/OUTP)
! TABHED
! MSGERR
! FOR
!
! 9. Subroutines calling
!
! SWOUTP (SWAN/OUTP)
!
! 10. Error messages
!
! If the point set is not of the type frame, an error message
! is printed and control returns to subroutine OUTPUT
!
! 11. Remarks
!
! output interval negative means that output is made only at end
! of computation 40.00
!
! 12. Structure
!
! ----------------------------------------------------------------- 40.00
! If dynamic mode
! Then determine TNEXT (time of next requested output)
! determine DIF (interval between end time and present time)
! If DIF is less than half time step and output interval is
! negative
! Then enable output (by making LOGACT = true)
! Else If time of computation >= TNEXT and output interval is
! positive
! Then enable output
! Else disable output (by making LOGACT = false)
! Return
! ------------------------------------------------------------ 40.00
! Else enable output
! ----------------------------------------------------------------- 40.00
! Set all OQPROC = false (if OQPROC is true corresponding quantity
! must be computed)
! Make OQPROC true for quantities Xp, Yp, Xc and Yc
! Set all values of VOQR = 0 (VOQR indicates where value of a
! quantity is stored in array VOQ)
! Make VOQR nonzero for quantities Xp, Yp, Xc and Yc
! Assign value to NVAR depending on type of output request
! ----------------------------------------------------------------- 40.00
!
! 13. Source text
!
INTEGER VOQR(*), OUTI(*), BKC 30.00
INTEGER IVTYP(*) 40.31
REAL*8 OUTR(*) 30.00
REAL*8 OURQT 40.51
REAL*8 DIF, TNEXT
LOGICAL OQPROC(NMOVAR), LOGACT 30.00
!NCF LOGICAL NCF 41.40
CHARACTER PSNAME *(*), RTYPE *(*) 40.31 30.81
SAVE IENT
DATA IENT /0/ 40.31 30.81
CALL STRACE (IENT, 'SWORDC')
!
! check time of output action: 30.00
IF (NSTATM.EQ.1) THEN 40.00
! check time of output action: 40.00
! DIF in case that timco is not a fraction of the
! computational period and the user do not ask for a periodic plots
DIF = TFINC - TIMCO
IF (OUTR(1).LT.TINIC) THEN
TNEXT = TINIC
ELSE
TNEXT = OUTR(1)
ENDIF
IF ( PARLL.AND.OURQT.EQ.-9999.) OURQT = OUTR(1) 40.51 40.30
IF (ITEST.GE.60) WRITE (PRTEST, *) ' output times ', TNEXT,
& OUTR(2), DT, TFINC, TIMCO
IF (ABS(DIF).LT.0.5*DT .AND. OUTR(2).LT.0.) THEN 40.00
OUTR(1) = TIMCO
LOGACT = .TRUE.
ELSE IF (OUTR(2).GT.0. .AND. TIMCO.GE.TNEXT) THEN 40.00
OUTR(1) = TNEXT + OUTR(2) 40.00
LOGACT = .TRUE.
ELSE
LOGACT = .FALSE.
RETURN
ENDIF
IF (LOGACT) NTVTK(OUTI(2)) = NTVTK(OUTI(2)) + 1 41.95
ELSE
LOGACT = .TRUE. 30.00
ENDIF 30.00
!
! action is taken, proceed with analysing output request
!
! Ivtype 1 and 2 are Xp and Yp
!
OQPROC(1) = .TRUE.
VOQR(1) = 1
OQPROC(2) = .TRUE.
VOQR(2) = 2
!
! clear VOQR and OQPROC from old information
!
DO 10 IVT = 3, NMOVAR
VOQR(IVT) = 0
OQPROC(IVT) = .FALSE.
10 CONTINUE
!
! Ivtype 24 and 25 are Xc and Yc
!
OQPROC(24) = .TRUE.
VOQR(24) = 3
OQPROC(25) = .TRUE.
VOQR(25) = 4
NVOQP = 4
!
NVAR = OUTI(3) 40.31
!
DO 20 IVAR = 1, NVAR
IVTYPE = IVTYP(IVAR) 40.31
!
IF (IVTYPE.LT.1 .OR. IVTYPE.GT.NMOVAR) THEN
CALL MSGERR (2, 'wrong value for IVTYPE')
WRITE (PRINTF, 17) RTYPE, PSNAME, IVTYPE, NVAR
17 FORMAT (' type, points, var: ', A4, 2X, A8, 2X, 2I8)
GOTO 20
ENDIF
!
IF (OVSVTY(IVTYPE).LE.2 .AND. .NOT.OQPROC(IVTYPE)) THEN
! output quantity is a scalar
NVOQP = NVOQP + 1
VOQR(IVTYPE) = NVOQP
ELSE IF (OVSVTY(IVTYPE).EQ.3 .AND. .NOT.OQPROC(IVTYPE)) THEN
! output quantity is a vector
NVOQP = NVOQP + 2
VOQR(IVTYPE) = NVOQP-1
ENDIF
OQPROC(IVTYPE) = .TRUE.
IF (ITEST.GE.80 .OR. IOUTES .GE. 20) WRITE (PRTEST, 22)
& IVAR, IVTYPE, VOQR(IVTYPE) 10.09
22 FORMAT (' SWORDC, output quantity:', 3I6)
!
! for spectral width add Tm02 as output quantity 20.61
!
IF (IVTYPE.EQ.33) THEN
IF (.NOT.OQPROC(32)) THEN
NVOQP = NVOQP + 1
VOQR(32) = NVOQP
OQPROC(32) = .TRUE.
ENDIF
ENDIF
!
! for BFI add steepness and Qp as output quantities 40.64
!
IF (IVTYPE.EQ.59) THEN
IF (.NOT.OQPROC(18)) THEN
NVOQP = NVOQP + 1
VOQR(18) = NVOQP
OQPROC(18) = .TRUE.
ENDIF
IF (.NOT.OQPROC(58)) THEN
NVOQP = NVOQP + 1
VOQR(58) = NVOQP
OQPROC(58) = .TRUE.
ENDIF
ENDIF
!
! include depth and wind required for partitioning output 41.62
!
IF ((IVTYPE.EQ.100).OR.(IVTYPE.EQ.110).OR. 41.62
& (IVTYPE.EQ.120).OR.(IVTYPE.EQ.130).OR. 41.62
& (IVTYPE.EQ.140).OR.(IVTYPE.EQ.150).OR. 41.62
& (IVTYPE.EQ.160)) THEN 41.62
IF (.NOT.OQPROC(4)) THEN 41.62
NVOQP = NVOQP + 1 41.62
VOQR(4) = NVOQP 41.62
OQPROC(4) = .TRUE. 41.62
ENDIF 41.62
IF (.NOT.OQPROC(26)) THEN 41.62
! increment by two because wind is a vector
NVOQP = NVOQP + 2 41.62
VOQR(26) = NVOQP-1 41.62
OQPROC(26) = .TRUE. 41.62
ENDIF 41.62
ENDIF 41.62
!
! for some quantities compute action densities
!
IF (IVTYPE.EQ.10 .OR. IVTYPE.EQ.11 .OR. IVTYPE.EQ.12 .OR.
& IVTYPE.EQ.13 .OR. IVTYPE.EQ.14 .OR. IVTYPE.EQ.16 .OR.
& IVTYPE.EQ.21 .OR. IVTYPE.EQ.22 .OR. IVTYPE.EQ.43 .OR.
& IVTYPE.EQ.44 .OR. IVTYPE.EQ.48 .OR. IVTYPE.EQ.53 .OR.
& IVTYPE.EQ.58 ) 40.64 40.61 40.51 40.41 40.00
& BKC = MAX (1, BKC)
!
! for some quantities also compute Depth, current, K and Cg
!
IF (IVTYPE.EQ.15 .OR. IVTYPE.EQ.17 .OR. IVTYPE.EQ.18 .OR.
& IVTYPE.EQ.19 .OR. IVTYPE.EQ.20 .OR. IVTYPE.EQ.28 .OR. 10.10
& IVTYPE.EQ.32 .OR. IVTYPE.EQ.33 .OR. IVTYPE.EQ.42 .OR.
& IVTYPE.EQ.47 .OR. IVTYPE.EQ.59 .OR. IVTYPE.EQ.71 ) 41.15 40.64 40.41 40.00
& BKC = 2
!
IF (IVTYPE.EQ.11 .AND. ICUR.GT.0) BKC = 2 20.36
IF (BKC.GT.0) THEN
! depth must be computed
IF (.NOT.OQPROC(4)) THEN
NVOQP = NVOQP + 1
VOQR(4) = NVOQP
OQPROC(4)=.TRUE.
ENDIF
! current velocity must be computed
IF (.NOT.OQPROC(5) .AND. ICUR.GT.0) THEN
NVOQP = NVOQP + 2
VOQR(5) = NVOQP-1
OQPROC(5)=.TRUE.
ENDIF
ENDIF
!
! for partitioning output compute A, depth, current, K and Cg
!
IF (IVTYPE.EQ.100 .OR. IVTYPE.EQ.110 .OR. IVTYPE.EQ.120 .OR. 41.62
& IVTYPE.EQ.130 .OR. IVTYPE.EQ.140 .OR. IVTYPE.EQ.150 .OR. 41.62
& IVTYPE.EQ.160) 41.62
& BKC = 2 41.62
!
20 CONTINUE
!
! in case of print of spectrum Ux and Uy have to be computed 20.28
!
IF ( RTYPE(1:2) .EQ. 'SP' 40.31
& .OR. RTYPE(1:2) .EQ. 'NE') THEN 30.61
OQPROC(4) = .TRUE.
VOQR(4) = NVOQP+1
NVOQP = NVOQP+1
BKC = 1
IF (ICUR.GT.0) THEN
BKC = 2
OQPROC(5) = .TRUE.
VOQR(5) = NVOQP+1
NVOQP = NVOQP+2
ENDIF
ENDIF 20.28
!NCF!
!NCF! add significant wave height and wind to any netCDF file 41.40
!NCF!
!NCF FILENM = OUTP_FILES(OUTI(2)) 41.40
!NCF NCF = INDEX( FILENM, '.NC' ).NE.0 .OR.
!NCF & INDEX (FILENM, '.nc' ).NE.0
!NCF IF ( NCF ) THEN 41.40
!NCF! significant wave height must be added
!NCF IF (.NOT.OQPROC(10)) THEN
!NCF NVOQP = NVOQP + 1
!NCF VOQR(10) = NVOQP
!NCF OQPROC(10)=.TRUE.
!NCF ENDIF
!NCF! wind must be added
!NCF IF (.NOT.OQPROC(26)) THEN
!NCF NVOQP = NVOQP + 2
!NCF VOQR(26) = NVOQP-1
!NCF OQPROC(26)=.TRUE.
!NCF ENDIF
!NCF ENDIF
!
RETURN
!* end of subroutine SWORDC **
END
!***********************************************************************
! *
SUBROUTINE SWODDC (OPI, OPR, PSNAME, PSTYPE, MIP, MXK, MYK, 40.31
& XNLEN, YNLEN, MXN, MYN, XPCN, YPCN, ALPCN,
& XCGRID,YCGRID,RTYPE) 40.00
! *
!***********************************************************************
!
USE OCPCOMM3 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE OUTP_DATA
!
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering and Geosciences |
! | 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-2024 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 3 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.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
!
! 0. Authors
!
! 30.72: IJsbrand Haagsma
! 40.22: John Cazes and Tim Campbell
! 40.31: Marcel Zijlema
! 40.41: Marcel Zijlema
!
! 1. Updates
!
! Oct. 95: New subroutine
! 30.72, Sept 97: Replaced DO-block with one CONTINUE to DO-block with
! two CONTINUE's
! 30.72, Feb. 98: Introduced generic names XCGRID, YCGRID and SPCSIG for SWAN
! 40.00, Jan. 99: argument RTYPE added, computation of ALCQ changed if
! output type (indicated by RTYPE) is PLOT
! 40.22, Sep. 01: small corrections
! 40.31, Nov. 03: removing HPGL-functionality
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
!
! 2. Purpose
!
! Decodes output point set data
!
! 3. Method
!
! ---
!
! 4. Argument variables
!
! XCGRID: input Coordinates of computational grid in x-direction 30.72
! YCGRID: input Coordinates of computational grid in y-direction 30.72
!
REAL XCGRID(MXC,MYC), YCGRID(MXC,MYC) 30.72
!
! PSNAME Char input name of output point set referred to
! PSTYPE Char input type of output point set
! MIP Int outp number of output points
! MXK Int outp number of output points in X-direction (Frame)
! MYK Int outp number of output points in Y-direction (Frame)
! XNLEN,YNLEN real outp (X,Y)lenght of the nested grid
! MXN, MYN int outp number of meshes in X, Y direction for
! the nested grid
! XPCN, YPCN real outp location of the origin of the nested grid
! ALPCN real outp angle of the nested grid with the positive
! x-axis, counterclockwise measured
! RTYPE char input indicates type of output; "PLOT" means that
! a spatial plot is made
CHARACTER RTYPE *(*)
INTEGER OPI(2) 40.31
REAL OPR(5) 40.31
!
! 5. SUBROUTINES CALLING
!
! SWOUTP (SWAN/OUTP)
!
! 6. SUBROUTINES USED
!
! 7. ERROR MESSAGES
!
! If the point set is not of a known type an error message 40.00
! is printed and control returns to subroutine SWOUTP
! If the point set is not of the type frame or ngrid an error message
! is printed and control returns to subroutine SWOUTP
!
! 8. REMARKS
!
! ---
!
! 9. STRUCTURE
!
! ----------------------------------------------------------------
! Depending on type of set of output points 40.00
! determine name, type and number of output points of