-
Notifications
You must be signed in to change notification settings - Fork 0
/
swancom3.ftn
2929 lines (2920 loc) · 115 KB
/
swancom3.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/COMPU file 3 of 5
!
! PROGRAM SWANCOM3.FOR
!
! This file SWANCOM3 of the main program SWAN program
! includes the next subroutines (mainly subroutines for
! the source terms for generation of wave energy ) :
!
! WNDPAR (DOLPHIN-B formulations for the SWAN model for a
! first- or a second generation first guess of the spectrum)
! WINDP1 (computation of variables derived from the wind such as
! mean wind velocity, mean wind direction, minimum counter
! for the wind, maximum counter for the wind, wind friction
! velocity and the Pierson Moskowitz frequency )
! WINDP2 (computation of wind sea energy spectrum necessary for
! the second generation wind growth model)
! WINDP3 (limit the energy spectrum in the case of a first or
! second generation wind growth model)
! SWIND0 (linear input term Cavaleri and Malanotte Rizolli (1981)
! SWIND3 (third generation wind growth model (Snyder et al. 1981;
! Komen et al., 1984)
! SWIND4 (third generation wind growth model (Janssen, 1989,1991)
! SWIND5 (third generation wind growth model according to the
! expression of Yan (1987) (especially derived for a
! frequency range that extend to the high frequencies
!
!****************************************************************
!
SUBROUTINE WNDPAR (ISSTOP,IDWMIN,IDWMAX,IDCMIN,IDCMAX, 32.06
& DEP2 ,WIND10,GENC0 ,GENC1 , 40.85 32.06
& THETAW,AC2 ,KWAVE ,IMATRA,IMATDA, 32.06
& SPCSIG,CGO ,ALIMW ,GROWW ,ETOTW , 32.06
& PLWNDS,PLWNDD,SPCDIR,ITER,AICELOC ) 41.75 32.06
!
!****************************************************************
!
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE OCPCOMM4 40.41
!
IMPLICIT NONE 30.82
!
!
! --|-----------------------------------------------------------|--
! | 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.70: Nico Booij
! 30.72: IJsbrand Haagsma
! 30.75: IJsbrand Haagsma (bug fix)
! 30.82: IJsbrand Haagsma
! 32.06: Roeland Ris
! 40.00: Nico Booij (Nonstationary boundary conditions)
! 40.41: Marcel Zijlema
! 40.85: Marcel Zijlema
! 41.75: Erick Rogers
!
! 1. Updates
!
! Jan. 97: New subroutine (Roeland Ris)
! 30.72, Feb. 98: Introduced generic names XCGRID, YCGRID and SPCSIG for SWAN
! 30.70, Feb. 98: argument list of WINDP2 changed
! 30.75, Mar. 98: Set FPM=SIGPKD, due to change in argument list of WINDP2
! 40.00, July 98: argument list of WINDP2 changed
! 30.82, Oct. 98: Updated description of several variables
! 30.82, Apr. 99: Dimensioning KCGRD corrected
! 32.06, June 99: Reformulated directional spreading for first guess
! 30.82, June 99: Implicit none added; all variables declared
! 40.41, Aug. 04: COS(THETA-THETAW) replaced by sumrule to make it cheaper
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 40.85, Aug. 08: store wind input for output purposes
! 41.75, Jan. 19: adding sea ice
!
! 2. Purpose
!
! Computation of the wind input source term with formulations
! of a first-generation model (constant porportionality coefficient)
! and a second-generation model (proportionality coefficient depends
! on the energy in the wind sea part of the spectrum). The
! expressions are from Holthuijsen and de Boer (1988) and from
! the DOLPHIN-B model (Holthuijsen and Booij). During the
! implementation of the terms modifications to the code have been
! made after personal communications with Holthuijsen and Booij.
!
! 3. Method
!
! The source term of the following nature:
!
! S = A + B E for E < Elim | t - tw | < pi/2
!
! (Elim-E)
! S = -------- for E > Elim | t - tw | < pi/2
! TAU
!
! S = 0 for E > Elim | t - tw | > pi/2
!
! in which the terms A and B are:
!
! [cf10] 2 2 2 4
! A = ------ pi (1./g) [rhoaw] [cdrag] (U cos(t-tw))
! 2 pi
!
! and:
! U cos(t-tw) s
! B = 5 [cf20] [rhoaw] f { ----------- - [cf30] } ----
! Cph 2 pi
!
! The coefficient TAU in the relaxation model is given by:
! 2
! / 2 pi \ g
! TAU = [cf40] | ----- | ------------
! \ s / U cos(d-dw)
!
! The limiting spectrum is given by:
!
! -3
! ALPHA K s -4 2 2
! Elim = ----------- exp ( -5/4 (----) ) --- cos ( t - tw )
! 2 Cg spm pi
!
! in which:
!
! ALPHA wind sea and/or depth dependent proportionality
! coefficient which controls the energy scale of the
! limiting spectrum.
! * In the first-generation model ALPHA is a constant
! equal to 0.0081 (fully developed)
! * In the second-generation model ALPHA depends on the
! energy in the wind sea part of the spectrum. ALPHA
! is calculated here by:
! [cf60]
! ALPHA = [cf50] * Edml
!
! spm adapted Pierson-Moskowitz (1964) peak frequency
!
! The total non-dimensional energy in the wind sea part of the
! spectrum is calculated by (see subroutine WINDP2):
!
! 2
! grav * ETOTW
! Edml = -------------
! 4
! wind10
!
!
! 4. Argument variables
!
! 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
!
REAL SPCDIR(MDC,6) 30.82
REAL SPCSIG(MSC) 30.72
!
! 6. Local variables
!
! IENT : Number of entries into this subroutine
!
INTEGER IENT
!
REAL :: FPM ! Pierson-Moskowitz frequency
REAL :: SWIND_EXP, SWIND_IMP ! explicit and implicit part of wind source
!
! INTEGERS:
! ---------
! IDWMIN Minimum counter for spectral wind direction
! IDWMAX Maximum counter for spectral wind direction
! IX Counter of gridpoint in x-direction
! IY Counter of gridpoint in y-direction
! IS Counter of frequency bin
! ISSTOP Countrer for the maximum frequency of all directions
! IDDUM Dummy counter
! ID Counter of directional distribution
! IDWMIN/IDWMAX Minimum / maximum counter in wind sector (180 degrees)
!
! REALS:
! ---------
! ALPM Coefficient for overshoot at deep water
! ALPMD Coefficient for overshoot corrected for shallow
! water using expression of Bretschnieder (1973)
! ALIMW limiting spectrum in terms of action density
! ARG1, ARG2 Exponent
! CDRAG Wind drag coefficient
! DND Nondimensional depth
! DTHETA Difference in rad between wave and wind direction
! EDML Dimensionless energy
! ETOTW Total energy of the wind sea part of the spectrum
! RHOAW Density of air devided by the density of water
! SIGPK Peak frequency in terms of rad /s
! SIGPKD Adapted peak frequency for shallow water
! TAU Variable for the wind growth equation
! THETA Spectral direction
! THETAW Mean direction of the relative wind vector
! TWOPI Two times pi
! WIND10 Velocity of the relative wind vector
! AICELOC Local ice fraction
!
! one and more dimensional arrays:
! ---------------------------------
! AC2 4D Action density as function of D,S,X,Y and T
! ALIMW 2D Limiting action density spectrum
! DEP2 1D Depth
! CGO 2D Group velocity
! KWAVE 2D Wave number
! LOGSIG 1D Logaritmic distribution of frequency
! IMATRA 2D Coefficients of right hand side of vector
! IMATDA 2D Coefficients of the diagonal
! PLWNDS 3D Values of explicit part of wind input for test point
! PLWNDD 3D Values of implicit part of wind input for test point
! SPCDIR 1D Spectral direction of wave component
! IDCMIN 1D Minimum counter
! IDCMAX 1D Maximum counter in directional space
! GROWW 2D Aux. array to determine whether there are
! wave generation conditions
!
! PWIND(1) = CF10 188.0
! PWIND(2) = CF20 0.59
! PWIND(3) = CF30 0.12
! PWIND(4) = CF40 250.0
! PWIND(5) = CF50 0.0023
! PWIND(6) = CF60 -0.2233
! PWIND(7) = CF70 0. (not used)
! PWIND(8) = CF80 -0.56 (not used)
! PWIND(9) = RHOAW 0.00125 (density air / density water)
! PWIND(10) = EDMLPM 0.0036 (limit energy Pierson Moskowitz)
! PWIND(11) = CDRAG 0.0012 (drag coefficient)
! PWIND(12) = UMIN 1.0 (minimum wind velocity)
! PWIND(13) = PMLM 0.13 ( )
!
! 7. Common blocks used
!
!
! 5. SUBROUTINES CALLING
!
! SOURCE
!
! 6. SUBROUTINES USED
!
! WINDP2 (compute the total energy in the wind sea part of
! the spectrum). Subroutine WINDP2 is called in
! SWANCOM1 in subroutine SOURCE
!
! 7. ERROR MESSAGES
!
! ---
!
! 8. REMARKS
!
! Regarding ICEWIND variable :
! factor_on_Sin=(1-aice*(1-icewind)) (1)
! This can be re-written as :
! factor_on_Sin=awater+aice*icewind (2)
! where a_water is open water fraction and a_water+aice==1.0 by definition
!
! 9. STRUCTURE
!
! --------------------------------------------------------------
! Calculate the adapted peak frequency
! --------------------------------------------------------------
! If first-generation model
! alpha is constant
! else
! Calculate energy in wind sea part of spectrum ETOTW
! Calculate alpha on the basis of ETOTW
! end
! --------------------------------------------------------------
! Take depth effects into account for alpha
! --------------------------------------------------------------
! For each frequency and direction
! compute limiting spectrum and determine whether there is
! grow or decay
! end
! --------------------------------------------------------------
! Do for each frequency and direction
! If wind-wave generation conditions are present
! calculate A + B E
! else if energy is larger than limiting spectrum
! calculate dissipation rate with relaxation model
! endif
! enddo
! --------------------------------------------------------------
! Store results in matrix (IMATRA or IMATDA)
! --------------------------------------------------------------
! End of the subroutine WNDPAR
! --------------------------------------------------------------
!
! 10. SOURCE
!
!***********************************************************************
!
INTEGER IS ,ID ,ITER ,
& IDWMIN,IDWMAX,IDDUM ,ISSTOP
!
REAL WIND10,THETA ,THETAW,EDML ,ARG1 ,ARG2 ,
& ALPM ,ALPMD ,TEMP1 ,TEMP2 ,FACTA ,FACTB ,
& ADUM ,BDUM ,CINV ,SIGTPI,SIGMA ,TWOPI ,TAUINV,
& SIGPK ,SIGPKD,DND ,ETOTW ,ALIM1D,
& CTW ,STW ,COSDIF, 40.41
& DIRDIS,AC2CEN,DTHETA
REAL, INTENT(IN) :: AICELOC 41.75
!
REAL :: AC2(MDC,MSC,MCGRD)
REAL :: ALIMW(MDC,MSC)
REAL :: IMATDA(MDC,MSC), IMATRA(MDC,MSC)
! Changed ICMAX to MICMAX, since MICMAX doesn't vary over gridpoint 40.22
REAL :: KWAVE(MSC,MICMAX) 40.22
REAL :: PLWNDS(MDC,MSC,NPTST) 40.00
REAL :: PLWNDD(MDC,MSC,NPTST)
REAL :: GENC0(MDC,MSC,MGENR) 40.85
REAL :: GENC1(MDC,MSC,MGENR) 40.85
REAL :: DEP2(MCGRD)
! Changed ICMAX to MICMAX, since MICMAX doesn't vary over gridpoint 40.22
REAL :: CGO(MSC,MICMAX) 40.22
REAL :: FACTOR_ON_SIN ! See remarks. 41.75
!
INTEGER IDCMIN(MSC) ,
& IDCMAX(MSC)
!
LOGICAL GROWW(MDC,MSC)
!
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'WNDPAR')
!
! *** initialization of arrays ***
!
DO IS = 1, MSC
DO ID = 1, MDC
GROWW(ID,IS) = .FALSE.
ALIMW(ID,IS) = 0.
ENDDO
ENDDO
!
! *** calculate the adapted shallow water peak frequency ***
! *** according to Bretschneider (1973) using the nondimensional ***
! *** depth DND ***
!
TWOPI = 2. * PI
DND = MIN( 50. , GRAV * DEP2(KCGRD(1)) / WIND10**2 )
SIGPK = TWOPI * 0.13 * GRAV / WIND10
SIGPKD = SIGPK / TANH(0.833*DND**0.375)
FPM = SIGPKD 30.75
CTW = COS(THETAW) 40.41
STW = SIN(THETAW) 40.41
FACTOR_ON_SIN = (1.-AICELOC*(1.-ICEWIND)) 41.75
!
IF ( IWIND .EQ. 1 ) THEN
!
! *** first generation model ***
!
ALPM = 0.0081
!
ELSE IF (IWIND .EQ. 2 ) THEN
!
! *** second generation model ***
!
! *** Determine the proportionality constant alpha on the basis ***
! *** of the total energy in the wind sea part of the spectrum ***
! *** output of subroutine (WINDP2) is ETOTW ***
!
CALL WINDP2 (IDWMIN ,IDWMAX ,SIGPKD ,FPM ,
& ETOTW ,
& AC2 ,SPCSIG , WIND10 ) 40.00
EDML = MIN ( PWIND(10) , (GRAV**2 * ETOTW) / WIND10**4 )
EDML = MAX ( 1.E-25 , EDML )
!
ARG1 = ABS(PWIND(6))
ALPM = MAX( 0.0081, (PWIND(5) * (1./EDML)**ARG1) )
!
ENDIF
!
! *** Take into account depth effects for proportionality ***
! *** constant alpha through the nondimensional depth DND ***
!
ALPMD = 0.0081 + ( 0.013 - 0.0081 ) * EXP ( -1. * DND )
ALPM = MIN ( 0.155 , MAX ( ALPMD , ALPM ) )
!
! *** Calculate the limiting spectrum in terms of action density ***
! *** for the wind sea part (centered around the local wind ***
! *** direction). For conversion of f^-5 --> k^-3 and coefficients ***
! *** see Kitaigorodskii et al. 1975 ***
!
DO IS = 1, ISSTOP
TEMP1 = ALPM / ( 2. * KWAVE(IS,1)**3 * CGO(IS,1) )
ARG2 = MIN ( 2. , SIGPKD / SPCSIG(IS) ) 30.72
TEMP2 = EXP ( (-5./4.) * ARG2**4 )
ALIM1D = TEMP1 * TEMP2 / SPCSIG(IS) 30.72
DO IDDUM = IDWMIN, IDWMAX
ID = MOD ( IDDUM - 1 + MDC, MDC ) + 1
THETA = SPCDIR(ID,1) 30.82
COSDIF = SPCDIR(ID,2)*CTW + SPCDIR(ID,3)*STW 40.41
!
! For better convergence the first guess of the directional spreading 32.06
! is modified in third generation mode. The new formulation better 32.06
! fits the directional spreading of the deep water growth curves. 32.06
!
IF ((ITER.EQ.1).AND.(IGEN.EQ.3)) THEN 32.06
DIRDIS = 0.434917 * (MAX(0., COSDIF))**0.6 40.41 32.06
ELSE 32.06
DIRDIS = (2./PI) * COSDIF**2 40.41
END IF 32.06
!
ALIMW(ID,IS) = ALIM1D * DIRDIS
AC2CEN = AC2(ID,IS,KCGRD(1))
IF ( AC2CEN .LE. ALIMW(ID,IS) ) THEN
GROWW(ID,IS) = .TRUE.
ELSE
GROWW(ID,IS) = .FALSE.
ENDIF
ENDDO
! *** test output ***
IF ( TESTFL .AND. ITEST .GE. 10 ) THEN
WRITE(PRINTF,2002) IS, SPCSIG(IS), KWAVE(IS,1), CGO(IS,1) 30.72
2002 FORMAT(' WNDPAR: IS SPCSIG KWAVE CGO :',I3,3E12.4) 30.72
WRITE(PRINTF,2003) TEMP1, TEMP2, ARG2
2003 FORMAT(' WNDPAR: TEMP1 TEMP2 ARG2 :',3X,3E12.4)
END IF
ENDDO
!
! *** Calculate the wind input (linear term A and exponential ***
! *** term B) in wave generating conditions or disspation term ***
! *** if energy in bin is larger than limiting spectrum ***
!
!
FACTA = PWIND(1) * PI * PWIND(9)**2 * PWIND(11)**2 / GRAV**2
!
DO IS = 1, ISSTOP
SIGMA = SPCSIG(IS) 30.72
SIGTPI = SIGMA * TWOPI
CINV = KWAVE(IS,1) / SIGMA
FACTB = PWIND(2) * PWIND(9) * SIGMA / TWOPI 34.00
DO IDDUM = IDCMIN(IS), IDCMAX(IS)
ID = MOD ( IDDUM - 1 + MDC, MDC ) + 1
DTHETA = SPCDIR(ID,1) - THETAW 30.82
COSDIF = SPCDIR(ID,2)*CTW + SPCDIR(ID,3)*STW 40.41
AC2CEN = AC2(ID,IS,KCGRD(1))
!
SWIND_EXP = 0. 40.13
SWIND_IMP = 0. 40.13
IF ( GROWW(ID,IS) ) THEN
! *** term A ***
IF ( SIGMA .GE. ( 0.7 * SIGPKD ) ) THEN
ADUM = FACTA * (WIND10 * COSDIF)**4 40.41
ADUM = MAX ( 0. , ADUM / SIGTPI )
ELSE
ADUM = 0.
END IF
! *** term B; Note that BDUM is multiplied with a factor 5 ***
! *** as in the DOLPHIN-B model ***
!
BDUM = MAX( 0., ((WIND10 * CINV) * COSDIF-PWIND(3))) 40.41
BDUM = FACTB * BDUM * 5.
SWIND_EXP = ADUM + BDUM * AC2CEN 40.13
!
ELSE IF ( .NOT. GROWW(ID,IS) .AND. AC2CEN .GT. 0. ) THEN
!
! *** for no energy dissipation outside the wind field ***
! *** TAUINV is set equal zero (as in the DOLPHIN-B model) ***
!
IF ( COSDIF .LT. 0. ) THEN 40.41
TAUINV = 0.
ELSE
TAUINV = ( SIGMA**2 * WIND10 * ABS(COSDIF) ) / 40.41
& ( PWIND(4) * GRAV * TWOPI**2 )
ENDIF
SWIND_EXP = TAUINV * ALIMW(ID,IS)
SWIND_IMP = TAUINV
ADUM = ALIMW(ID,IS)
BDUM = TAUINV
END IF
!
IF ( AICELOC.GT.0. ) THEN 41.75
SWIND_EXP = SWIND_EXP * FACTOR_ON_SIN 41.75
SWIND_IMP = SWIND_IMP * FACTOR_ON_SIN 41.75
ENDIF 41.75
!
! *** store results in IMATDA and IMATRA ***
!
IMATRA(ID,IS) = IMATRA(ID,IS) + SWIND_EXP
IMATDA(ID,IS) = IMATDA(ID,IS) + SWIND_IMP
IF (TESTFL) PLWNDS(ID,IS,IPTST) = SWIND_EXP 40.13
IF (TESTFL) PLWNDD(ID,IS,IPTST) = -1.*SWIND_IMP 40.13
GENC0(ID,IS,1) = GENC0(ID,IS,1) + SWIND_EXP 40.85
GENC1(ID,IS,1) = GENC1(ID,IS,1) - SWIND_IMP 40.85
!
! *** test output ***
!
! Value of ITEST changed from 10 to 110 to reduce test output 40.13
IF ( TESTFL .AND. ITEST .GE. 110 ) THEN 40.13
WRITE(PRINTF,2004) IS, ID, GROWW(ID,IS), ADUM, BDUM 40.13
2004 FORMAT(' WNDPAR: IS ID GROWW ADUM BDUM :', 40.13
& 2I3,2X,L1,2X,2E12.4)
END IF
ENDDO
ENDDO
!
! *** test output ***
!
! Value of ITEST changed from 10 to 60 to reduce test output 40.13
IF ( TESTFL .AND. ITEST .GE. 60 ) THEN 40.13
WRITE(PRINTF,*)
WRITE(PRINTF,6051) IDWMIN, IDWMAX
6051 FORMAT(' WNDPAR : IDWMIN IDWMAX :',2I5)
WRITE(PRINTF,6052) THETAW,WIND10,SIGPK,SIGPKD
6052 FORMAT(' WNDPAR : Tw U10 Spk Spk,d :',4E12.4)
WRITE(PRINTF,7050) ETOTW, EDML, ALPM, ALPMD
7050 FORMAT(' WNDPAR: ETOW EDML ALPM ALPMD:',4E12.4)
ENDIF
!
RETURN
! end of subroutine WNDPAR
END
!
!****************************************************************
!
SUBROUTINE WINDP1 (WIND10 ,THETAW ,
& IDWMIN ,IDWMAX ,
& FPM ,UFRIC ,
& WX2 ,WY2 ,
& ANYWND ,SPCDIR , 40.00
& UX2 ,UY2 ,
& SPCSIG ,AC2 30.70 41.33
!ADC & ,NodeNumber 41.20
& ,GENC0 ,KWAVE 40.88
& )
!
!****************************************************************
!
USE OCPCOMM1 40.41
USE OCPCOMM2 40.41
USE OCPCOMM3 40.41
USE OCPCOMM4 40.41
USE SWCOMM1 40.41
USE SWCOMM2 40.41
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE SDSBABANIN
!ADC USE WIND, ONLY: WindDrag 41.20
!ADC USE Couple2Swan, ONLY: ComputeSwanWindDrag 42.07
!
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 |
! | |
! | 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.70: Nico Booij
! 30.82: IJsbrand Haagsma
! 32.06: Roeland Ris
! 40.00: Nico Booij (Nonstationary boundary conditions)
! 40.41: Marcel Zijlema
! 41.20: Casey Dietrich
! 41.33: Marcel Zijlema
!
! 1. Updates
!
! 20.64, : limited sector is now taken into account
! argument SPCDIR is added
! 30.70, Feb. 98: relative wind velocity is determined
! arguments UX2, UY2, SPCSIG added
! full common introduced
! 40.00, July 98: argument list changed: KCGRD removed
! 30.82, Oct. 98: Updated description of several variables
! 32.06, June 99: Reformulation of wind speed in terms of friction
! velocity for first and second generation
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 41.20, Jun. 10: use ADCIRC's new sector-based wind drag
! 41.33, Mar. 12: extension drag coefficient based on 2nd order polynomial
! 41.33, Aug. 12: extension drag coefficient based on cross swell
!
! 2. Purpose
!
! Computation of parameters derived from the wind for several
! subroutines such as :
! SWIND1, SWIND2 SWIND3
! CUTOFF
!
! Output of this subroutine :
!
! WIND10 , THETAW, IDWMIN, IDWMAX , UFRIC, FPM
!
! 3. METHOD
!
! a. For SWIND1 and SWIND2 :
!
! SIGMA_FPM = 0.13 * GRAV * 2 * PI / WIND10
!
! b. For SWIND3 (wind input according to Snyder (1981) ***
!
! - wind friction velocity according to Wu (1982):
! * -3
! U = UFRIC = wind10 sqrt( (0.8 + 0.065 wind10 ) 10 )
!
! c. For SWIND4 (wind input according to Janssen 1991)
!
! - wind friction velocity:
!
! UFRIC = sqrt ( CDRAG) * U10
!
! for U10 < 7.5 m/s -> CDRAG = 1.2873.e-3
!
! else wind friction velocity according to Wu (1982):
!
! * -3
! U = UFRIC = wind10 sqrt( (0.8 + 0.065 wind10 ) 10 )
!
! d.
! The Pierson Moskowitz radian frequency for a fully developed
! sea state spectrum for all third generation wind input
! models is equal to:
!
! grav
! SIGMA_FPM = ---------
! 28 UFRIC
! -----------------------------------------------------------
!
! 4. Argument variables
!
! 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.82
!
REAL SPCDIR(MDC,6) 30.82
REAL SPCSIG(MSC) 30.82
!
! IDWMIN Minimum counter for spectral wind direction
! IDWMAX Maximum counter for spectral wind direction
! IX Counter of gridpoints in x-direction
! IY Counter of gridpoints in y-direction
! MXC Maximum counter of gridppoints in x-direction
! MYC Maximum counter of gridppoints in y-direction
! KCGRD int, i Point index for grid point 30.21
! MCGRD int, i Maximum counter of gridpoints in space 30.21
! ICMAX int, i Maximum counter for the points of the molecule 30.21
!
! REALS:
! ---------
!
! PI (3,14)
! GRAV Gravitational acceleration
! THETAW Mean direction of the relative wind vector
! WIND10 Velocity of the relative wind vector
! U10 wind velocity from SWANPREn
! WDIC mean wind direction from SWANPREn
! FPM PM frequency
! UFRIC Wind friction velocity
!
! one and more dimensional arrays:
! ---------------------------------
! WX2,WY2 2D Wind velocity array relative to a current
! PWIND 1D coefficients for wind expressions
! ANYWND 1D Indicator if wind input has to be taken into
! account for a bin
!
! 7. Common blocks used
!
!
! 5. SUBROUTINES CALLING
!
! SWOMPU
!
! 6. SUBROUTINES USED
!
! NONE
!
! 7. ERROR MESSAGES
!
! ---
!
! 8. REMARKS
!
!
! 9. STRUCTURE
!
! ------------------------------------------------------------
! If constant wind then
! set parameters WIND10 and WDIC equal U10 and WDIC
! else compute
! wind velocity and mean wind direction
! ----------------------------------------------------------
! compute the minimum and maximum counters for wind source term
! for which the wid input is active
! compute the Pierson Moskowitz frequency for IWIND = 1, 2
! compute the wind friction velocity and PM freq. for IWIND = 3
! ------------------------------------------------------------
! End of the subroutine WINDP1
! ------------------------------------------------------------
!
! 10. SOURCE
!
!***********************************************************************
!
!ADC INTEGER, OPTIONAL :: NodeNumber 41.20
!ADC!
INTEGER IDWMIN ,IDWMAX 30.70
INTEGER IENT ,ID ,IDDUM, IS
!
REAL WIND10 ,THETAW , 30.70
& UFRIC ,FPM ,CDRAG ,SDMEAN 30.70
!
REAL UREF ,UTL ,PP, QQ, RR 41.33
PARAMETER (UREF=31.5, PP=0.55, QQ=2.97, RR=-1.49) 41.33
REAL UREF1, UTL1, NSL1, NSH1, CS, CA,CB,CC, NA,NB,NC, 41.33
& UREF2, UTL2, NSL2, NSH2, CD,CE, ND,NE 41.33
PARAMETER (UREF1=27.5,NA=1.05,NB=1.25,NC=1.4,CA=0.7,CB=1.1,CC=6., 41.33
& NSL1=30.,NSH1=80.,CS=50., 41.33
& UREF2=54.,ND=2.3,NE=10.,CD=8.2,CE=2.5, 41.33
& NSL2=45.,NSH2=55.) 41.33
REAL A, B, C, D, E 41.33
REAL ETOTS ,EEX ,EEY , EAD ,SIGMA1, 41.33
& COSDIR,SINDIR,DETOT , FAC ,DSPR 41.33
!
REAL WX2(MCGRD) ,
& WY2(MCGRD) ,
& UX2(MCGRD) , 30.70
& UY2(MCGRD) 30.70
REAL AC2(MDC,MSC,MCGRD) 41.33
REAL KWAVE(MSC,MICMAX)
REAL GENC0(MDC,MSC,MGENR)
!
LOGICAL ANYWND(MDC)
!
REAL AWX, AWY, RWX, RWY 30.70
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'WINDP1')
!
! compute absolute wind velocity 30.70
IF (VARWI) THEN
AWX = WX2(KCGRD(1))
AWY = WY2(KCGRD(1))
ELSE
AWX = U10 * COS(WDIC)
AWY = U10 * SIN(WDIC)
ENDIF
! compute relative wind velocity 30.70
IF (ICUR.EQ.0) THEN
RWX = AWX
RWY = AWY
ELSE
RWX = AWX - UX2(KCGRD(1))
RWY = AWY - UY2(KCGRD(1))
ENDIF
! compute absolute value of relative wind velocity 30.70
WIND10 = SQRT(RWX**2+RWY**2)
IF (WIND10.GT.0.) THEN
THETAW = ATAN2 (RWY,RWX)
THETAW = MOD ( (THETAW + PI2) , PI2 )
ELSE
THETAW = 0.
ENDIF
!
! *** compute the minimum and maximum counter for the active ***
! *** wind field : ***
! *** . ***
! *** IDWMAX =135 degrees .<--mean wind direction ***
! *** \ o o o | o o o . (THETAW) ***
! *** \ o o | o o . o ***
! *** \ o | o . o o ***
! *** \ | . o o o ***
! *** ----------------\-------------------- ***
! *** | \ o o o o ***
! *** | \ o o o ***
! *** | \ o o ***
! *** IDWMIN = 325 degrees ***
! *** ***
!
! move ThetaW to the right interval, shifting + or - 2*PI 20.64
SDMEAN = 0.5 * (SPCDIR(1,1) + SPCDIR(MDC,1)) 30.82
IF (THETAW .LT. SDMEAN - PI) THETAW = THETAW + 2.*PI
IF (THETAW .GT. SDMEAN + PI) THETAW = THETAW - 2.*PI
!
IF ( (THETAW - 0.5 * PI) .LE. SPCDIR(1,1) ) THEN 30.82
IF ( (THETAW + 1.5 * PI) .GE. SPCDIR(MDC,1) ) THEN
IDWMIN = 1
ELSE
IDWMIN = NINT ( (THETAW + 1.5*PI - SPCDIR(1,1)) / DDIR ) + 1 30.82
ENDIF
ELSE
IDWMIN = NINT ( (THETAW - 0.5*PI - SPCDIR(1,1)) / DDIR ) + 1 30.82
END IF
!
IF ( (THETAW + 0.5 * PI) .GE. SPCDIR(MDC,1) ) THEN 30.82
IF ( (THETAW - 1.5 * PI) .LE. SPCDIR(1,1) ) THEN 30.82
IDWMAX = MDC
ELSE
IDWMAX = NINT ( (THETAW - 1.5 * PI - SPCDIR(1,1)) / DDIR ) + 1 30.82
ENDIF
ELSE
IDWMAX = NINT ( (THETAW + 0.5 * PI - SPCDIR(1,1)) / DDIR ) + 1 30.82
ENDIF
!
IF ( IDWMIN .GT. IDWMAX) IDWMAX = MDC + IDWMAX
!
! *** determine for which bin the wind input is active ***
! *** initialize array for active wind input ***
!
DO ID = 1, MDC
ANYWND(ID) = .FALSE.
ENDDO
!
IF ( TESTFL .AND. ITEST .GE. 30 ) THEN
WRITE(PRINTF,500) IDWMIN, IDWMAX
500 FORMAT(' WINDP1: IDWMIN IDWMAX :',2I15)
ENDIF
!
DO IDDUM = IDWMIN , IDWMAX
ID = MOD ( IDDUM - 1 + MDC, MDC ) + 1
ANYWND(ID) = .TRUE.
!
IF ( TESTFL .AND. ITEST .GE. 40 ) THEN
WRITE(PRINTF,400) IDDUM, ID, ANYWND(ID)
400 FORMAT(' WINDP1: IDDUM ID ANYWND :',2I5,L4)
ENDIF
!
ENDDO
!
! --- determine directional spreading for cross swell
!
IF ( IDRAG.EQ.3 ) THEN
EEX = 0.
EEY = 0.
ETOTS = 0.
DO ID = 1, MDC
EAD = 0.
DO IS = 1, MSC
SIGMA1 = SPCSIG(IS)
DETOT = SIGMA1**2 * AC2(ID,IS,KCGRD(1))
EAD = EAD + DETOT
ENDDO
ETOTS = ETOTS + EAD
EEX = EEX + EAD * SPCDIR(ID,2)
EEY = EEY + EAD * SPCDIR(ID,3)
ENDDO
IF ( ETOTS.GT.0. ) THEN
COSDIR = EEX / ETOTS
SINDIR = EEY / ETOTS
FAC = MIN( 1., SQRT(COSDIR**2+SINDIR**2) )
DSPR = SQRT(2.-2.*FAC)
ELSE
DSPR = 0.
ENDIF
DSPR = DSPR * 180. / PI
ENDIF
!
! *** compute the Pierson Moskowitz frequency ***
!
IF ( IWIND .EQ. 1 .OR. IWIND .EQ. 2 ) THEN
!
! *** first and second generation wind wave model ***
!
IF ( WIND10 .LT. PWIND(12) ) WIND10 = PWIND(12)
FPM = 2. * PI * PWIND(13) * GRAV / WIND10
!
! *** determine U friction in case predictor is obtained ***
! *** with second genaration wave model ***
!
!ADC! added the default option to use the ADCIRC drag formulation
!ADC IF ( IDRAG.EQ.0 ) THEN
!ADC IF ( WIND10 .GT. 7.5 ) THEN
!ADC CDRAG = WindDrag(DBLE(WIND10),NodeNumber)
!ADC ELSE
!ADC CDRAG = 0.0012875
!ADC ENDIF
!ADC ENDIF
IF ( IDRAG.EQ.1 ) THEN
! Wu (1982) drag formulation
IF ( WIND10 .GT. 7.5 ) THEN
CDRAG = ( 0.8 + 0.065 * WIND10 ) * 0.001
CDRAG = MIN ( CDCAP, CDRAG )
ELSE
CDRAG = 0.0012875
ENDIF
ELSE IF ( IDRAG.EQ.2 ) THEN
! Zijlema et al (2012) drag formulation
UTL = WIND10/UREF
CDRAG = ( PP + QQ*UTL + RR*UTL*UTL ) * 0.001
CDRAG = MIN ( CDCAP, CDRAG )
ELSE IF ( IDRAG.EQ.3 ) THEN
! drag based on swell
UTL1 = WIND10/UREF1
UTL2 = WIND10/UREF2
!
IF ( DSPR.NE.CS ) THEN
! no swell, opposing or following swell
A = NA
B = NB
C = NC
D = ND
E = NE
IF ( DSPR.GT.NSL1 .AND. DSPR.LT.CS ) THEN
FAC = (DSPR-NSL1) / (CS-NSL1)
A = A + FAC * (CA-NA)
B = B + FAC * (CB-NB)
C = C + FAC * (CC-NC)
IF ( DSPR.GT.NSL2 ) THEN
FAC = (DSPR-NSL2) / (CS-NSL2)
D = D + FAC * (CD-ND)
E = E + FAC * (CE-NE)
ENDIF
ELSE IF ( DSPR.GT.CS .AND. DSPR.LT.NSH1 ) THEN
FAC = (DSPR-NSH1) / (CS-NSH1)
A = A + FAC * (CA-NA)
B = B + FAC * (CB-NB)
C = C + FAC * (CC-NC)
IF ( DSPR.LT.NSH2 ) THEN
FAC = (DSPR-NSH2) / (CS-NSH2)
D = D + FAC * (CD-ND)
E = E + FAC * (CE-NE)
ENDIF
ENDIF
ELSE
! cross swell
A = CA
B = CB
C = CC
D = CD
E = CE
ENDIF
!
CDRAG = MIN ( A+B*UTL1**C, D*(1-UTL2**E) )
CDRAG = MAX ( 0.7 , CDRAG )
CDRAG = CDRAG * 0.001
CDRAG = MIN ( CDCAP, CDRAG )
ENDIF
!
UFRIC = SQRT ( CDRAG ) * WIND10
!
! Reformulation of the wind speed in terms of friction velocity. 32.06
! This formulation is based on Bouws (1986) and described in Delft 32.06
! Hydraulics report H3515 (1999) 32.06
!
WIND10 = WIND10 * SQRT(((0.8 + 0.065 * WIND10) * 0.001) / 32.06
& ((0.8 + 0.065 * 15. ) * 0.001)) 32.06
!
ELSE IF (IWIND .GE. 3 ) THEN
!