-
Notifications
You must be signed in to change notification settings - Fork 0
/
swancom2.ftn
2955 lines (2874 loc) · 105 KB
/
swancom2.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 2 of 5
!
! PROGRAM SWANCOM2.FOR
!
! This file SWANCOM2 of the main program SWAN
! include the next subroutines (mainly subroutines for
! the source terms for dissipation and some general stuff):
!
! DISSIPATION SOURCE TERMS :
!
! SBOT (Bottom friction)
! SVEG (Dissipation due to vegetation) 40.55
! STURBV (dissipation due to turbulent viscosity) 40.35
! SMUD (Fluid mud-induced wave dissipation) 40.59
! FRABRE (Fraction of breaking waves) 30.77
! SSURF (Wave breaking: five formulations)
! SWCAP (White capping: seven formulations) 40.53
! BRKPAR (compute variable gamma for Battjes-Janssen breaking formula)
! CNTAIL (contributions to the spectrum of the high frequency tail)
! PLTSRC (store the values for plot of the source terms and spec.)
!
!****************************************************************
!
SUBROUTINE SBOT (ABRBOT ,DEP2 ,ECOS ,ESIN ,AC2 , 41.04
& IMATDA ,KWAVE ,SPCSIG ,UBOT ,UX2 , 30.72
& UY2 ,IDCMIN ,IDCMAX ,IT ,ITER , 41.51
& SWPDIR ,PLBTFR ,ISSTOP ,DISSC1 ,VARFR , 41.51 40.67
& FRCOEF )
!
!****************************************************************
!
USE SWCOMM3 40.41
USE SWCOMM4 40.41
USE OCPCOMM4 40.41
!
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
!
! 20.68: Nico Booij
! 30.72: IJsbrand Haagsma
! 40.41: Marcel Zijlema
! 40.61: Marcel Zijlema
! 40.67: Nico Booij
! 41.04: Marcel Zijlema
! 41.51: Grant Smith
!
! 1. Updates
!
! 20.68, Jan. 96: subroutine restructured variable friction coefficient
! introduced Putnam model replaced by Collins
! 30.72, Feb. 98: Introduced generic names XCGRID, YCGRID and SPCSIG for SWAN
! 40.41, Oct. 04: common blocks replaced by modules, include files removed
! 40.61, Sep. 06: introduce DISBOT variable for output purposes
! 40.67, Jun. 07: more accurate computation fo dissipation terms
! 41.04, Mar. 09: frequency-dependent JONSWAP formulation
! 41.51, Apr. 14: introduce ripples model
!
! 2. Purpose
!
! Computation of the source terms due to bottom friction
!
! 3. Method
!
! In SWAN several bottom friction dissipation models are computed, i.e.:
!
! IBOT = 1 Jonswap bottom friction model
! IBOT = 2 Collins bottom friction model
! IBOT = 3 Madsen bottom friction model (see Tolman)
! IBOT = 5 ripples model (see Smith et al, 2011)
!
! Both methods are implemented in SWAN and the user has to make
! a choice in the input file.
!
! 1. Jonswap model:
! -----------------
!
! The bottom interaction term SEbf(s,d) is supposed to take the
! Jonswap form (Hasselman et al. 1973):
! 2
! sigma E(s,d)
! SEbf = -GAMMA ----------------
! 2 2
! g sinh (kD)
! 2 -3
! where GAMMA is the decay parameter, (default GAMMA = 0.038 m s ).
! In the Jonswap form the current velocities are not taken into
! account.
! Note that the value of 0.038 must be combined with second order 41.49
! polynomial wind drag 41.49
!
! 2. COLLINS model:
! -----------------
!
! The energy dissipation due to bottom friction is modelled
! according the quadratic friction law:
! 2
! SE = Tau * |U|
!
! which for a spectrum can be written as:
! 2
! sigma
! SE(s,d)= - ---------------- * (Cfw.Ub + Cfc.Uc) * E(s,d)
! 2
! g sinh (K(s) * D)
!
! Ub is the velocity due to the wave at the bottom
!
! The current velocity is Uc
!
! 3. MADSEN formulation:
! ----------------------
!
! The bottom friction dissipation applying Madsen formulation is as
! follows:
!
! fw [n - 1/2] UBR E(s,d)
! [1] Sdsb(s,d) = - ------------------------
! D
!
! in which :
! 2
! s * D
! [1a] (n - 1/2) = -------------
! 2
! 2 g sinh (kD)
!
! UBOT(IX,IY) is computed in the subroutine SINTGRL. The friction
! factor fw is estimated using the formulation of Jonsson (1963,
! 1966a):
!
! 1 1 Ab,r
! [2] -------- + log { ---------- } = mf + log { ----- }
! 4 sqrt(fw) 10 4 sqrt(fw) 10 Kn
!
! with:
!
! 2 // 1
! [3] Ab,r = 2 * // -------------- E(s,d) ds dd
! // 2
! sinh (kD)
!
! with: Ab,r is the representative near bottom excursion
! amplitude
! Kn equivalent roughness
! mf constant ( mf = -0.08) (determined by Jonsson
! and Carlssen 1976 )
!
! [2] is only valid for Ab,r/Kn larger than approximately 1.
! For smaller values a constant value of fw is used (fw = 0.3
! for Ab,r/Kn < 1.57 )
!
! 4. RIPPLES model:
! -----------------
!
! Friction depends on the formation process of bottom ripples and on
! the grain size of the sediment.
!
! Details can be found in
!
! Smith, Babanin, Riedel and Young (2011)
! Introduction of a new friction routine into the SWAN model that
! evaluates roughness due to bedform and sediment size changes
! Coastal Engineering, 58, 317-326
!
! 4. Argument variables
!
! SPCSIG: Relative frequencies in computational domain in sigma-space 30.72
!
REAL SPCSIG(MSC) 30.72
!
! INTEGERS :
! --------
!
! IX Counter of gridpoints in x-direction
! IY Counter of gridpoints in y-direction
! IS Counter of relative frequency band
! ID Counter of the spectral direction
! IBOT Indicator if bottom friction is on
! ICUR Indicator if a current is present
! IT current time step
! MBOT Maximum array size for the array PBOT
! MXC Maximum counter of gridppoints in x-direction
! MYC Maximum counter of gridppoints in y-direction
! MSC Maximum counter of relative frequency
! MDC Maximum counter of directional distribution
! ISSTOP Maximum counter of wave component in frequency
! space that is propagated
!
! REALS:
! ---------
!
! ABRBOT Near bottom excursion amplitude
! FACB an auxiliary factor contributing to bottom friction
! FW Friction factor
! GRAV Gravitational acceleration
! KD Wavenumber * Depth
! SBOTEO Sourceterm for the bottom friction to be stored
! in the array IMATDA
! CURR Main current velocity
! UC Absolute value of the current
! AKN Nikuradse bottom roughness
! S specific gravity of sediment
! D grain size of sediment
! PHI mobility number for determination of ripple geometry
! THETA Shields entrainment parameter
! DAST dimensionless sediment parameter
! THETAC critical Shields parameter where sediment becomes mobile
! RIPH ripple height
! RIPW ripple wavelength
!
! one and more dimensional arrays:
! ---------------------------------
!
! AC2 2D Action density
! DEP2 2D Depth
! ESIN 1D Sin per spectral direction (id)
! ECOS 1D Cos per spectral direction (id)
! IMATDA 2D Coefficients of diagonal of matrix
! KWAVE 2D Wavenumber function of frequency and IC
! PBOT 1D Coefficient for bottom friction models
! UBOT 2D Near bottom velocity as function of X,Y
! UX2 2D Current velocity in y direction as function of X,Y
! UY2 2D Current velocity in y direction as function of X,Y
! DISSC1 2D Dissipation coefficient, function of sigma and theta
! FRCOEF 2D Spatially variable friction coefficient 20.68
!
! 7. Common blocks used
!
!
! 8. Subroutines used
!
! ---
!
! 9. Subroutines calling
!
! SOURCE
!
! 10. Error Messages
!
! ---
!
! 11. Remarks
!
! ---
!
! 12. Structure
!
! ------------------------------------------------------------
! Compute CFBOT according to friction model
! For every spectral frequency do
! compute SBOTEO = CFBOT * (sigma/sinh(kd))**2
! For every spectral direction do
! add SBOTEO to matrix (IMATDA)
! -------------------------------------------------------------
!
! 13. Source text
!
INTEGER IENT, ID ,IDDUM, IS ,ISSTOP, IT, ITER, J, SWPDIR
!
REAL AKN ,XDUM ,KD ,SBOTEO,FACB ,
& CFW ,FW ,CURR ,UC ,ABRBOT,
& ADUM ,CDUM ,DDUM
REAL CFBOT(MSC)
REAL DSP ,ETOT ,EEX ,EEY ,EAD
REAL S ,D ,PHI ,THETA , 41.51
& DAST ,THETAC ,RIPH ,RIPW 41.51
!
LOGICAL VARFR
!
REAL AC2(MDC,MSC,MCGRD) , 41.04
& DEP2(MCGRD) ,
& ECOS(MDC) ,
& ESIN(MDC) ,
& IMATDA(MDC,MSC) ,
& KWAVE(MSC,ICMAX) ,
& PLBTFR(MDC,MSC,NPTST) , 40.00
& UBOT(MCGRD) ,
& UX2(MCGRD) ,
& UY2(MCGRD) ,
& DISSC1(MDC,MSC,1:MDISP) , 40.67
& FRCOEF(MCGRD) 20.68
!
INTEGER IDCMIN(MSC) ,
& IDCMAX(MSC)
!
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'SBOT')
!
IF ( IBOT .GE. 1 .AND. DEP2(KCGRD(1)) .GT. 0.) THEN
IF (IBOT.EQ.1) THEN
!
! *** Jonswap model ***
!
! PBOT(3) = GAMMA (a) in the Jonswap formulation
!
CFBOT = PBOT(3) / GRAV**2
ELSEIF (IBOT.EQ.2) THEN
!
! *** Collins model ***
!
! PBOT(2) = [cfw]
!
IF (VARFR) THEN 20.68
CFW = FRCOEF(KCGRD(1))
ELSE
CFW = PBOT(2)
ENDIF
CFBOT = CFW * UBOT(KCGRD(1)) / GRAV
ELSEIF (IBOT.EQ.3) THEN
!
! *** Madsen model ***
!
IF (VARFR) THEN 20.68
AKN = FRCOEF(KCGRD(1))
ELSE
AKN = PBOT(5)
ENDIF
!
! *** PBOT(4) = Mf ***
! *** AKN = PBOT(5) = [kn] (roughness) ***
!
IF ( (ABRBOT / AKN ) .GT. 1.57 ) THEN
XDUM = PBOT(4) + LOG10 ( ABRBOT / AKN )
!
! *** solving the implicit equation using a Newton ***
! *** Rapshon iteration proces : a + log a = b ***
! *** the start value for ADUM = 0.3 because 0.3626 ***
! *** is the minimum value of ADUM with b=-0.08. ***
!
ADUM = 0.3
DO 28 J = 1, 50
CDUM = ADUM
DDUM = ( ADUM + LOG10(ADUM) - XDUM ) /
& ( 1.+ ( 1. / ADUM) )
ADUM = ADUM - DDUM
IF ( ABS(CDUM - ADUM) .LT. 1.E-4 ) GOTO 29
28 CONTINUE
WRITE(*,*) ' error in iteration fw: Madsen formulation'
29 CONTINUE
! 1 1
! *** computation of FW --> A = ----- --> FW = -----
! 4 uFW 16 A**2
FW = 1. / (16. * ADUM**2)
ELSE
FW = 0.3
ENDIF
CFBOT = UBOT(KCGRD(1)) * FW / (SQRT(2.) * GRAV)
ELSEIF ( IBOT.EQ.4 ) THEN
!
! *** Jonswap model with variable friction coefficient ***
! *** as function of frequency-dependent directional ***
! spreading (varies linearly between 0.038 - 0.067) ***
!
DO IS = 1, MSC
ETOT = 0.
EEX = 0.
EEY = 0.
DO ID = 1, MDC
EAD = SPCSIG(IS)*AC2(ID,IS,KCGRD(1))
ETOT = ETOT + EAD
EEX = EEX + EAD * ECOS(ID)
EEY = EEY + EAD * ESIN(ID)
ENDDO
IF ( ETOT.GT.0. ) THEN
XDUM = 1.-MIN(1.,SQRT(EEX*EEX+EEY*EEY)/ETOT)
DSP = SQRT(2.*XDUM) *180./PI
ELSE
DSP = 0.
ENDIF
IF ( DSP.LT.PBOT(8) ) THEN
CFBOT(IS) = PBOT(6)
ELSEIF ( DSP.GT.PBOT(9) ) THEN
CFBOT(IS) = PBOT(7)
ELSE
CFBOT(IS) = PBOT(6) + (PBOT(7)-PBOT(6))*(DSP-PBOT(8))/
& (PBOT(9)-PBOT(8))
ENDIF
CFBOT(IS) = CFBOT(IS) / GRAV**2
ENDDO
ELSEIF ( IBOT.EQ.5 ) THEN
!
! *** ripples model ***
!
! set some constants
S = PBOT(6)
D = PBOT(7)
IF ( NSTATC.EQ.1 .AND. IT.EQ.1 ) THEN
! if nonstationary and first time step, roughness is based on grain size (assumes no ripples)
AKN = 2.5*D
IF ( (AKN/ABRBOT).LT.0.63 ) THEN
! friction factor based on Swart formula
FW = EXP(5.213*((AKN/ABRBOT)**0.194)-5.977)
ELSE
FW = 0.3
ENDIF
ELSEIF ( NSTATC.EQ.0 .AND. ITER.EQ.1 ) THEN
! if stationary and first iteration, roughness is based on grain size (assumes no ripples)
AKN = 2.5*D
IF ( (AKN/ABRBOT).LT.0.63 ) THEN
! friction factor based on Swart formula
FW = EXP(5.213*((AKN/ABRBOT)**0.194)-5.977)
ELSE
FW = 0.3
ENDIF
ELSE
! set friction factor obtained from previous time step or iteration
FW = FRCOEF(KCGRD(1))
ENDIF
! mobility number
PHI = ((UBOT(KCGRD(1)))**2)/((S-1.)*GRAV*D)
! Shields entrainment parameter
THETA = 0.5 * FW * PHI
! dimensionless sediment size parameter
DAST = (((GRAV*(S-1.))/((1.36E-6)**2))**(1./3.))*D
! critical Shields parameter where sediment begins to move
THETAC = 0.3/(1.+(1.2*DAST))+0.055*(1-(2.718**(-0.02*DAST)))
IF ( THETA.LE.1. .AND. THETA.GE.THETAC ) THEN
! case for mobile seabed where ripples are likely to occur
! calculation of ripple height
IF ( PHI.GT.10 ) THEN
RIPH = ABRBOT*(21.*PHI**(-1.85))
ELSE
RIPH = ABRBOT*(0.275-0.022*(PHI**0.5))
ENDIF
! calculation of ripple wavelength
RIPW = RIPH/(0.342-0.34*THETA**0.25)
! roughness coefficient calculation incorporating ripple height and wavelength
AKN = ((8.*RIPH**2)/RIPW)+(170.*D*(THETA-0.05)**0.5)
ELSEIF ( THETA.GT.1. ) THEN
! case of sheet flow, ripples are flattened
AKN = 170.*D*((THETA-0.05)**0.5)
ELSE
! immobile seabed case: zero concentration and friction based on grain size
AKN = 2.5*D
ENDIF
! final friction factor calculation from Swart formula
IF ( (AKN/ABRBOT).LT.0.63 ) THEN
FW = EXP(5.213*((AKN/ABRBOT)**0.194)-5.977)
ELSE
FW = 0.3
ENDIF
! bottom friction coefficient based on friction factor
CFBOT = UBOT(KCGRD(1)) * FW / (SQRT(2.) * GRAV)
! save friction factor to FRCOEF for next time step or iteration
IF (( SWPDIR .EQ. 1) .OR.
& ( SWPDIR .EQ. 2 .AND. IXCGRD(1) .EQ. 1) .OR.
& ( SWPDIR .EQ. 3 .AND. IYCGRD(1) .EQ. 1) .OR.
& ( SWPDIR .EQ. 4 .AND.
& (IXCGRD(1).EQ.MXC .AND. IYCGRD(1).EQ.1) )) THEN
! save only for first encounter in a sweep
FRCOEF(KCGRD(1)) = FW
ENDIF
ENDIF
!
! *** test output ***
!
IF (TESTFL .AND. ITEST.GE.60) THEN
WRITE (PRTEST, 910) IBOT, KCGRD(1), DEP2(KCGRD(1)), CFBOT(1)
910 FORMAT (' SBOT :IBOT INDX DEP CFBOT:', 2I5, 2E12.4)
ENDIF
!
DO 700 IS = 1, ISSTOP
KD = KWAVE(IS,1) * DEP2(KCGRD(1))
IF ( KD .LT. 10. ) THEN
FACB = CFBOT(IS) * (SPCSIG(IS) / SINH(KD)) **2 41.04 40.57 30.72
!
DO 690 IDDUM = IDCMIN(IS) , IDCMAX(IS)
ID = MOD ( IDDUM - 1 + MDC , MDC ) + 1
!
SBOTEO = FACB 40.57
IF (IBOT.EQ.2 .AND. ICUR.EQ.1 .AND. PBOT(1).GT.0.) THEN
! additional dissipation due to current, seldom used
CURR = UX2(KCGRD(1))*ECOS(ID) + UY2(KCGRD(1))*ESIN(ID)
UC = ABS(CURR)
! PBOT(1) = [cfc]
SBOTEO = FACB + PBOT(1) * UC * 40.57
& (SPCSIG(IS) / SINH(KD)) **2 30.72
ENDIF
!
! *** store the results in the array IMATDA ***
! *** if testfl store results in array for isoline plot ***
!
IMATDA(ID,IS) = IMATDA(ID,IS) + SBOTEO
IF (TESTFL) PLBTFR(ID,IS,IPTST) = -1.* SBOTEO 40.00
DISSC1(ID,IS,3) = DISSC1(ID,IS,3) + SBOTEO 40.67
690 CONTINUE
ENDIF
700 CONTINUE
!
ENDIF
!
! End of subroutine SBOT
RETURN
END
!
!****************************************************************
!
SUBROUTINE SVEG ( DEP2 ,IMATDA ,ETOT ,SMEBRK ,
& KMESPC ,PLVEGT ,
& IDCMIN ,IDCMAX ,ISSTOP ,DISSC1 ,
& NPLA2 )
!
!****************************************************************
!
USE SWCOMM2
USE SWCOMM3
USE SWCOMM4
USE OCPCOMM4
USE M_GENARR
!
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
!
! 40.55: Bastiaan Burger, Martijn Meijer
! 40.61: Marcel Zijlema
! 40.58: Tomo Suzuki, Marcel Zijlema
!
! 1. Updates
!
! 40.55, May. 05: implementation of vegetation dissipation formula
! 40.61, Sep. 06: introduce DISVEG variable for output purposes
! 40.58, Nov. 08: some modifications and corrections
!
! 2. Purpose
!
! Computation of the source term due to vegetation dissipation
!
! 3. Method
!
! The energy dissipation due to vegetation is described by a
! Morrison type equation, modelling the plants as vertical,
! noncompliant cylinders, neclecting swaying motions induced by
! waves. Vegetation characteristics that are used as input are
! drag coefficient, vegetation height, plant density and diameter.
!
! The formula used in SWAN is due to Dalrymple (1984)
! (see Mendez and Losada, 2004):
!
! d(Cg E)
! ------- = -epsv
! dx
!
! with dissipation due to vegetation:
!
! epsv = 1/2 * 1/sqrt(pi) * rho * Cd * bv * Nv *
! 3
! (gk/2sigma)^3 * ((A + B)/C) * Hrms
!
! where
!
! rho = water density
! k = wave number
! sigma = angular frequency
! Cd = drag coefficient
! bv = stem thickness
! Nv = vegetation density
! Hrms = rms wave height
!
! and the coefficients
!
! A = sinh^3 k*ah
! B = 3*sinh k*ah
! C = 3k*cosh^3 kh
!
! with ah the vegetation height
!
! The source term to be used in SWAN is based on the
! corresponding dissipation rate and reads
!
! Dtot = -epsv / rho / g
!
! In the formulation, the mean average wavenumber according
! to the WAM-formulation and the mean frequency will be employed
!
! Now, the source term is:
!
! E
! Sveg = Dtot * ------ = factor * sqrt(Etot) * E
! Etot
!
! and is linearized by means of the Picard iteration
!
!
! 4. Argument variables
!
! DEP2 water depth
! DISSC1 dissipation coefficient
! ETOT total energy per spatial gridpoint
! IDCMIN frequency dependent counter in directional space
! IDCMAX frequency dependent counter in directional space
! IMATDA coefficients of diagonal of matrix
! ISSTOP maximum counter of wave component in frequency
! space that is propagated
! KMESPC mean average wavenumber according to the WAM-formulation
! NPLA2 number of plants per square meter (depth-averaged)
! PLVEGT array containing the vegetation source term for test-output
! SMEBRK mean frequency according to first order moment
!
INTEGER ISSTOP, IDCMIN(MSC), IDCMAX(MSC)
REAL DEP2(MCGRD) ,
& IMATDA(MDC,MSC) ,
& DISSC1(MDC,MSC,MDISP),
& PLVEGT(MDC,MSC,NPTST),
& NPLA2 (MCGRD)
REAL ETOT, SMEBRK, KMESPC
!
! 6. Local variables
!
! A : auxiliary variable
! B : auxiliary variable
! C : auxiliary variable
! D : auxiliary variable
! ID : counter of the spectral direction
! IDDUM : counter
! IENT : number of entries
! IK : counter
! IL : counter
! IS : counter of relative frequency band
! KD : wavenumber times water depth
! KVEGH : wavenumber times plant height
! LAYPRT: part of layer below water level
! SINHK : sinh(kh)
! SLAYH : total sum of layer thicknesses
! SLAYH1: sum of layer thicknesses below water level
! SLAYH2: sum of layer thicknesses below water level
! SVEG1 : layer-independent dissipation factor
! SVEG2 : total sum of dissipation factor over layers
! SVEGET: source term containing dissipation due to vegetation
! to be stored in the array IMATDA
!
INTEGER ID, IDDUM, IENT, IK, IL, IS
REAL A, B, C, D, KD, KVEGH, LAYPRT, SINHK, SLAYH,
& SLAYH1, SLAYH2, SVEG1, SVEG2, SVEGET
!
! 9. Subroutines calling
!
! SOURCE
!
! 12. Structure
!
! Vegetation parameters are given per layer thickness, so for
! each layer the contribution to wave damping is calculated
!
! This routine checks in which layer the water level is present
!
! -----------
! ILMAX
! -----------
! _ d 2
! --|--------
! | 1
! --|--------
!
! d = waterdepth
! ILMAX = number of layers in grid point
!
! Subsequently, the vegetation parameters up to the layer where the
! water level is in, are used to calculate dissipation for each layer
!
! Thereafter, the contributions to disspation are summed up
!
! With this summation the total dissipation due to vertical varying
! vegetation is calculated
!
! 13. Source text
!
SAVE IENT
DATA IENT/0/
IF (LTRACE) CALL STRACE (IENT,'SVEG')
! --- compute layer-independent vegetation dissipation factor
KD = KMESPC * DEP2(KCGRD(1))
IF ( KD.GT.10. ) RETURN
C = 3.*KMESPC*(COSH(KD))**3
SVEG1 = SQRT(2./PI) * GRAV**2 * (KMESPC/SMEBRK)**3 * SQRT(ETOT)/ C
IF ( VARNPL ) SVEG1 = SVEG1 * NPLA2(KCGRD(1))
! --- compute dissipation factor for each layer and summed up
SLAYH = 0.
DO IL = 1, ILMAX
SLAYH = SLAYH + LAYH(IL)
ENDDO
KVEGH = 0.
C = 0.
D = 0.
SVEG2 = 0.
IF ( DEP2(KCGRD(1)).GT.SLAYH ) THEN
DO IL = 1, ILMAX
KVEGH = KVEGH + KMESPC * LAYH(IL)
SINHK = SINH(KVEGH)
A = C
B = D
C = SINHK**3
D = 3.*SINHK
A = C - A
B = D - B
SVEG2 = SVEG2 + VEGDRL(IL)*VEGDIL(IL)*VEGNSL(IL)*(A + B)
END DO
ELSE IF ( DEP2(KCGRD(1)).LT.LAYH(1) ) THEN
SINHK = SINH(KD)
A = SINHK**3
B = 3.*SINHK
SVEG2 = VEGDRL(1)*VEGDIL(1)*VEGNSL(1)*(A + B)
ELSE
SLAYH1 = 0.
SLAYH2 = 0.
LAYPRT = 0.
VGLOOP : DO IL = 1, ILMAX
SLAYH1 = SLAYH1 + LAYH(IL)
IF (DEP2(KCGRD(1)).LE.SLAYH1) THEN
DO IK = 1, IL-1
SLAYH2 = SLAYH2 + LAYH(IK)
END DO
LAYPRT = DEP2(KCGRD(1)) - SLAYH2
DO IK = 1, IL-1
KVEGH = KVEGH + KMESPC * LAYH(IK)
SINHK = SINH(KVEGH)
A = C
B = D
C = SINHK**3
D = 3.*SINHK
A = C - A
B = D - B
SVEG2 = SVEG2+VEGDRL(IK)*VEGDIL(IK)*VEGNSL(IK)*(A + B)
END DO
KVEGH = KVEGH + KMESPC * LAYPRT
SINHK = SINH(KVEGH)
A = C
B = D
C = SINHK**3
D = 3.*SINHK
A = C - A
B = D - B
SVEG2 = SVEG2 + VEGDRL(IL)*VEGDIL(IL)*VEGNSL(IL)*(A + B)
EXIT VGLOOP
END IF
END DO VGLOOP
END IF
! --- compute total dissipation
SVEGET = SVEG1 * SVEG2
!
! *** test output ***
!
IF (TESTFL .AND. ITEST.GE.60) THEN
WRITE (PRTEST, 110) IVEG, KCGRD(1), DEP2(KCGRD(1)), SVEGET
110 FORMAT (' SVEG :IVEG INDX DEP VEGFAC:', 2I5, 2E12.4)
END IF
DO IS = 1, ISSTOP
DO IDDUM = IDCMIN(IS), IDCMAX(IS)
ID = MOD ( IDDUM - 1 + MDC , MDC ) + 1
! *** store the results in the array IMATDA ***
! *** if testfl store results in array for isoline plot ***
IMATDA(ID,IS) = IMATDA(ID,IS) + SVEGET
IF (TESTFL) PLVEGT(ID,IS,IPTST) = -1.* SVEGET
DISSC1(ID,IS,5) = DISSC1(ID,IS,5) + SVEGET
END DO
END DO
RETURN
END
!
!****************************************************************
!
SUBROUTINE STURBV (TURBV2 ,DEP2 ,IMATDA ,
& IDCMIN ,IDCMAX ,ISSTOP ,
& KWAVE ,DISSC1 ,PLTURB )
!
!****************************************************************
!
USE SWCOMM3
USE SWCOMM4
USE OCPCOMM4
USE M_WCAP, ONLY: SIGPOW
!
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
! 40.35: Nico Booij
! 1. Updates
! 40.35, July 04: new subroutine
! 2. Purpose
! Computation of the dissipation term due to turbulent viscosity
! 3. Method
! ITURBV=1: see Tolman
! 4. Argument variables
REAL :: IMATDA(1:MDC,1:MSC) ! main diagonal of matrix
REAL, INTENT(IN) :: KWAVE(1:MSC,1:ICMAX) ! wave number
REAL :: DISSC1(1:MDC,1:MSC,1:MDISP) ! total dissipation in spectral domain
REAL, INTENT(IN) :: TURBV2(1:MCGRD) ! turbulent viscosity at current time
REAL, INTENT(IN) :: DEP2(1:MCGRD) ! water depth
REAL :: PLTURB(MDC,MSC,NPTST)
INTEGER :: IDCMIN(1:MSC), IDCMAX(1:MSC)
INTEGER :: ISSTOP
! 5. Local variables
INTEGER :: ID, IDDUM, IS ! counters in spectral space
REAL :: CVISC ! dissipation coefficient
REAL :: VISCLOC ! local turbulent viscosity
REAL :: XKD ! dimensionless depth
! 8. Subroutines used
! ---
! 9. Subroutines calling
! SOURCE
! 10. Error Messages
! ---
! 11. Remarks
! ---
! 12. Structure
! ------------------------------------------------------------
! If local turbulent viscosity is >0
! Then For all spectral frequencies do
! compute dissipation coefficient CVISC
! For every spectral direction do
! add CVISC to matrix diagonal (IMATDA)
! -------------------------------------------------------------
! 13. Source text
INTEGER, SAVE :: IENT = 0
IF (LTRACE) CALL STRACE (IENT,'STURBV')
VISCLOC = TURBV2(KCGRD(1))
IF (TESTFL .AND. ITEST.GE.60) WRITE (PRTEST, 20)
& IXCGRD(1)-1, IYCGRD(1)-1, VISCLOC,
& PTURBV(1)
20 FORMAT ( 'test STURBV, point ', 2I3, 3X, 2E12.4)
IF (VISCLOC .GT. 0.) THEN
IF (ITURBV.EQ.1) THEN
! *** Tolman's model ***
DO IS = 1, ISSTOP
! expression: Pt * K * k * sigma^2 / g * (tanh(kd) - kd/(cosh(kd)^2))
XKD = KWAVE(IS,1) * DEP2(KCGRD(1))
CVISC = PTURBV(1) * VISCLOC * KWAVE(IS,1) *
& SIGPOW(IS,2) / GRAV *
& (TANH(MIN(30.,XKD)) - XKD/((COSH(MIN(30.,XKD)))**2))
DO IDDUM = IDCMIN(IS) , IDCMAX(IS)
ID = MOD ( IDDUM - 1 + MDC , MDC ) + 1
! *** store the results in the array IMATDA ***
! *** if testfl store results in array for isoline plot ***
IMATDA(ID,IS) = IMATDA(ID,IS) + CVISC
IF (TESTFL) PLTURB(ID,IS,IPTST) = -1.* CVISC
DISSC1(ID,IS,6) = DISSC1(ID,IS,6) + CVISC
!
ENDDO
ENDDO
ENDIF