-
Notifications
You must be signed in to change notification settings - Fork 0
/
w3sic3md.ftn
3072 lines (2970 loc) · 109 KB
/
w3sic3md.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
#include "w3macros.h"
!/ ------------------------------------------------------------------- /
MODULE W3SIC3MD
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | E. Rogers |
!/ | S. Zieger |
!/ | X. Zhao |
!/ | S. Cheng |
!/ | FORTRAN 90 |
!/ | Last update : 04-Jan-2016 |
!/ +-----------------------------------+
!/
!/ Updates:
!/ 29-May-2014 : Generalization with turbulent BL
!/ (F.A. method imported from IC2 by E.R.) ( version 5.01 )
!/ 04-Jan-2016 : Importing code provided by S. Cheng
!/ (improved solution methods for Wang and Shen model)
!/
! 1. Purpose :
!
! Calculate ice source term S_{ice} according to a viscoelastic sea
! ice model (Wang and Shen 2010).
!
! Reference: Wang, R., and H. H. Shen (2010), Gravity waves
! propagating into an ice‐covered ocean: A viscoelastic model, J.
! Geophys. Res., 115, C06024, doi:10.1029/2009JC005591 .
!
! 2. Variables and types :
! Name Type Scope Description
! ------------------------------------------------------------------
! IC3TABLE_CHENG Int. Public Table of wave number k_r,
! attenuation k_i and group
! velocity cg
! IC3_DITK R.A. Private Ice thickness increment
! IC3_MAXITK R.A. Private Maximum ice thickness, the code
! may fail for situation with ice
! thickness larger than this value
!
! 3. Subroutines and functions :
!
! Name Type Scope Description
! ------------------------------------------------------------------
! W3SIC3 Subr. Public Ice source term.
! BSDET Func. Private Calculate the determinant for
! the dispersion relation.
! WN_CMPLX_V1 Func. Private Calculate complex wavenumber in
! ice
! WN_PRECALC_CHENG Subr. Private Calculate complex wavenumber in
! ice
! WN_CMPLX_HF Func. Private Like above, but for h-f waves
! CMPLX_ROOT_MULLER_CHENG Func. Private Find root for complex
! numbers
! FUN_ZHAO Func. Private Wrapper function for FUNC0/FUNC1
! FUNC0_ZHAO Func. Private
! FUNC1_ZHAO Func. Private
! W3IC3WNCG Subr. Public Calculate kr,ki and cg for all
! frequency at each grid point
! IC3PRECALC_CHENG Subr. Private Calculate kr,ki and cg table for
! all frequencies and ice
! thickness from 0~IC3_MAXITK
! CGinIC3_CHENG func. Private Calculate group velocity
! related to IC3 model
! F_ZHAO Func. Private Wrapper function for double/
! quadruple precision
! ------------------------------------------------------------------
!
! 4. Subroutines and functions used :
!
! See subroutine documentation.
!
! 5. Remarks :
!
! 6. Switches :
!
! See subroutine documentation.
!
! 7. Source code :
!/
!/ ------------------------------------------------------------------- /
!/
PUBLIC :: W3SIC3, W3IC3WNCG_V1, W3IC3WNCG_CHENG
PRIVATE :: WN_CMPLX_V1, WN_CMPLX_HF
PRIVATE :: CMPLX_ROOT_MULLER_V1, CMPLX_ROOT_MULLER_CHENG
PRIVATE :: F_ZHAO_V1, F_ZHAO_CHENG
PRIVATE :: FUNC1_ZHAO, FUNC0_ZHAO, BSDET
INTEGER,SAVE :: CALLEDIC3TABLE = 0
REAL,PRIVATE,PARAMETER :: IC3_DITK = 0.01, IC3_MAXITK = 3.
PUBLIC :: IC3TABLE_CHENG
PRIVATE :: IC3PRECALC_CHENG, CGINIC3_CHENG
CONTAINS
!/ ------------------------------------------------------------------- /
!/
SUBROUTINE W3SIC3 (A, DEPTH, CG, WN, IX, IY, S, D)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | E. Rogers |
!/ | S. Zieger |
!/ | FORTRAN 90 |
!/ | Last update : 11-Oct-2013 |
!/ +-----------------------------------+
!/
!/ 06-May-2013 : Origination (copied from SICE1) ( version 4.10 )
!/ (E. Rogers)
!/ 09-Oct-2013 : Update to meet WW3 coding standard (S. Zieger)
!/
!/ FIXME : Move field input to W3SRCE and provide
!/ (S.Zieger) input parameter to W3SIC1 to make the subroutine
!/ : versatile for point output processors ww3_outp
!/ and ww3_ounp.
!/
!/ Copyright 2009 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
!/ reserved. WAVEWATCH III is a trademark of the NWS.
!/ No unauthorized use without permission.
!/
! 1. Purpose :
!
! Calculate ice source term S_{ice} according to a viscoelastic sea
! ice model (Wang and Shen 2010).
!
! Reference: Wang, R., and H. H. Shen (2010), Gravity waves
! propagating into an ice‐covered ocean: A viscoelastic model, J.
! Geophys. Res., 115, C06024, doi:10.1029/2009JC005591 .
!
!/ ------------------------------------------------------------------- /
!
! 2. Method :
!
! Regarding i/o (general to all Sice modules): S_{ice} source term
! is calculated using up to 5 parameters read from input files.
! These parameters are allowed to vary in space and time.
! The parameters control the exponential decay rate k_i
! Since there are 5 parameters, this permits description of
! dependence of k_i on frequency or wavenumber.
!
! Sea ice affects the wavenumber k of wind-generated ocean waves.
! The ice-modified wavenumber can be expressed as a complex number
! k = k_r + i*k_i, with the real part k_r representing impact of
! the sea ice on the physical wavelength and propagation speeds,
! producing something analogous to shoaling and refraction by
! bathymetry, whereas the imaginary part of the complex
! wavenumber, k_i, is an exponential decay coefficient
! k_i(x,y,t,sigma) (depending on location, time and frequency,
! respectively), representing wave attenuation, and can be
! introduced in a wave model such as WW3 as S_ice/E=-2*Cg*k_i,
! where S_ice is one of several dissipation mechanisms, along
! with whitecapping, for example, S_ds=S_wc+S_ice+⋯. The k_r -
! modified by ice would enter the model via the C calculations
! on the left-hand side of the governing equation.The fundamentals
! are straightforward, e.g. Rogers and Holland (2009 and
! subsequent unpublished work) modified a similar model, SWAN
! (Booij et al. 1999) to include the effects of a viscous mud
! layer using the same approach (k = k_r + i*k_i) previously.
!
! General approach is analogous to Rogers and Holland (2009)
! approach for mud.
! See text near their eq. 1 :
! k = k_r + i * k_i
! eta(x,t) = Real( a * exp( i * ( k * x - sigma * t ) ) )
! a = a0 * exp( -k_i * x )
! S / E = -2 * Cg * k_i (see also Komen et al. (1994, pg. 170)
!
! Following W3SBT1 as a guide, equation 1 of W3SBT1 says:
! S = D * E
! However, the code of W3SBT1 has
! S = D * A
! This leads me to believe that the calling routine is
! expecting "S/sigma" not "S"
! Thus we will use D = S/E = -2 * Cg * k_i
!
! The calling routine is expecting "S/sigma" not "S"
! Thus we will use D = S/E = -2 * Cg * k_i
! (see also documentation of W3SIC1)
!
! Notes regarding numerics:
!
! Experiments with constant k_i values suggest that results may be
! dependent on resolution if insufficient resolution is used.
! For detailed information, see documentation of W3SIC1.
!
! Note regarding applicability/validity:
!
! The Wang and Shen model is intended as a generalized model for
! various types of ice cover. It is a "continuum" model for
! which the same model is used from the ice edge to the ice
! interior. Though the ice types are expected to be very different
! from the edge to the interior, this is accomodated by the relative
! importance of the "effective viscosity" and the "modulus of
! elasticity". At the ice edge, where one finds frazil ice, pancake
! ice, or ice floes much smaller than the wave length, the "viscous"
! component of the model is believed to be most appropriate. At the
! interior, where one finds a continuous ice sheet, the "elastic
! model" component of the generalized visco-elastic model is
! expected to be appropriate. In addition to the case of continuous
! ice, Wang and Shen argue that the elastic model is also applicable
! to ice floes when the floe sizes are large relative to the
! wavelength. So to summarize,
! * frazil ice, pancake ice, and floes smaller than wavelength :
! viscosity dominates
! * continuous ice, and floes larger than wavelength :
! elasticity dominates
! * intermediate conditions: neither dominates
! All this is accomodated in WW3 by using non-uniform specification
! of viscosity and elasticity.
!
! In the case where a user wishes to utilize only the "viscous
! model" aspect of Wang and Shen, and use an alternative scheme for
! continous ice and large ice floes, we allow this through the use
! of a user-defined namelist parameter "IC3MAXTHK". Floe size is
! not (at time of writing) an output available from ice model CICE,
! so we use the ice thickness as a way to anticipate the floe size.
! When ice thickness exceeds IC3MAXTHK, WW3 will use another model
! in place of the Wang and Shen formulation :
!
! S_ice by F.A., an estimation of dissipation by turbulence
! at the ice-water interface. It uses only namelists for input, and
! no space/time varying input (though of course ice concentration is
! space/time varying). Unlike Liu et al. (IC2), it does not use
! ice thickness and does not yield a new C|Cg|k (i.e. it is non-
! dispersive), but it has the very nice feature of not requiring
! an eddy viscosity, which is a major drawback of the Liu et al.
! model. That is why we use it here, vs. Liu et al.
! (S_ice by Liu et al. and S_ice by F.A. are the two options
! available in IC2, i.e. w3sic2md.ftn)
!
! At time of writing (March 23 2015), there may be some problems
! with the root-selection of IC3. For example with these settings:
! hice=1 ; rho_ice=917.0 ; emod=4.9e+12 ; visc=5e+7 ;
! h_water=deep (without using the IC3MAXTHK feature) the solution
! is rather irregular:
! T=11.11 k_i = 215.0e-5
! T=10 k_i = 266.0e-5
! T=9 k_i = 1.4e-5
! T=8.1 k_i = 1.7e-5
! With hice=0.1, ki is monotonically increasing in that range:
! T=11.11 k_i = 0.97e-5
! T=10 k_i = 2.64e-5
! T=9 k_i = 3.90e-5
! T=8.1 k_i = 4.47e-5
! Of course, when using IC3MAXTHK=0.1, the first example (hice=1)
! would switch to the "S_ice by F.A." model, and so this problem
! is circumvented.
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! A R.A. I Action density spectrum (1-D).
! DEPTH Real I Local water depth.
! CG R.A. I Group velocities.
! WN R.A. I Wavenumbers.
! IX,IY I.S. I Grid indices.
! S R.A. O Source term (1-D version).
! D R.A. O Diagonal term of derivative (1-D version).
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! STRACE Subr. W3SERVMD Subroutine tracing (!/S switch).
! PRT2DS Subr. W3ARRYMD Print plot output (!/T1 switch).
! OUTMAT Subr. W3ARRYMD Matrix output (!/T2 switch).
! ----------------------------------------------------------------
!
! 5. Called by :
!
! Name Type Module Description
! ----------------------------------------------------------------
! W3SRCE Subr. W3SRCEMD Source term integration.
! W3EXPO Subr. N/A ASCII Point output post-processor.
! W3EXNC Subr. N/A NetCDF Point output post-processor.
! GXEXPO Subr. N/A GrADS point output post-processor.
! ----------------------------------------------------------------
!
! 6. Error messages :
!
! None.
!
! 7. Remarks :
!
! If ice parameter 1 is zero, no calculations are made.
!
! Code by S. Cheng sets NOICE=.TRUE. if ISNAN(ICECOEF1).
! Comments are "maps may not be compatible"
! This feature is not understood by me (ER) and so omitted.
!
!/ ------------------------------------------------------------------- /
! On array size, S. Cheng says:
! Upon checking the origin of CG, I would say CG = CG_IC3, this is
! the topic ‘call W3IC3WNCG twice’. Recently I find they are not
! exactly the same due to calculation and smoothing of cg using
! several neighbor points. For different input array size, results
! are slightly different. In subr. w3wave, the size of input arrays
! is 0:NK+1, while in w3sic3, the size of all input arrays is 1:NK.
! This array size difference is reflected in the resulting cg. The
! small difference in cg between calling IC3 twice or just calling
! once produces small difference in SWH. To eliminate this small
! difference, I suggest to keep CG instead of CG_IC3, as well as WN,
! WN_I, because other source terms use CG. I confirmed this change
! would make results of ICE the same whether calling twice or once
! by defining dimension WN_R, WN_I, CG_IC3 as 0:NK+1 instead of
! 1:NK. Then CG_IC3 = CG.
!/ ------------------------------------------------------------------- /
! On optimization, S. Cheng says:
! For Wang and Shen’s model, D does not change in the loop
! corresponding to NSTEPS in subr. W3SRCE. I find the most efficient
! and easy way to speed up is that Add D and NSTEPS as inputs of
! W3SIC3
! If NSTEPS==1
! Current Wang and Shen’s model code above.
! ELSE
! S = D*A
! Endif
!/ ------------------------------------------------------------------- /
!
! 8. Structure :
!
! See source code.
!
! 9. Switches :
!
! !/S Enable subroutine tracing.
! !/T Enable general test output.
! !/T0 2-D print plot of source term.
! !/T1 Print arrays.
!
! 10. Source code :
!
!/ ------------------------------------------------------------------- /
USE CONSTANTS, ONLY: TPI, DWAT, ABMIN, DELAB, SIZEFWTABLE, &
FWTABLE, GRAV
USE W3ODATMD, ONLY: NDSE, IAPROC, NAPROC, NAPERR
! USE WMMDATMD, ONLY: IMPROC, NMPERR ! WMMDATMD unavailable to outp
USE W3SERVMD, ONLY: EXTCDE
USE W3GDATMD, ONLY: NK, NTH, NSPEC, SIG, MAPWN, IC3PARS, DDEN, &
FLAGLL, YGRD, GTYPE, RLGTYPE
USE W3IDATMD, ONLY: ICEP1, ICEP2, ICEP3, ICEP4, ICEP5, ICEI, &
INFLAGS2
!/T USE W3ODATMD, ONLY: NDST
!/S USE W3SERVMD, ONLY: STRACE
!/T0 USE W3ARRYMD, ONLY: PRT2DS
!/T1 USE W3ARRYMD, ONLY: OUTMAT
!
IMPLICIT NONE
!/
!/ ------------------------------------------------------------------- /
!/ Parameter list
!/
REAL, INTENT(IN) :: CG(NK), WN(NK), A(NSPEC), DEPTH
REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
INTEGER, INTENT(IN) :: IX, IY
!/
!/ ------------------------------------------------------------------- /
!/ Local parameters
!/
!/S INTEGER, SAVE :: IENT = 0
INTEGER :: ITH
!/T0 REAL :: DOUT(NK,NTH)
INTEGER :: IKTH, IK
REAL :: ICECOEF1, ICECOEF2, ICECOEF3, &
ICECOEF4, ICECOEF5, ICECONC
REAL, DIMENSION(NK) :: D1D, WN_I, WN_R, CG_IC3, CG_TMP
LOGICAL :: NOICE
REAL :: VISCM=1.83E-6
REAL :: FREQ
! ............VISCM=1.83E-6 : molecular viscosity of water at freezing
REAL :: PTURB, PVISC, DTURB, DVISC, &
SMOOTH, RE, UORB, AORB, EB, &
DELI1, DELI2, FW, XI, FTURB, &
MAXTHK, MAXCNC, USE_CHENG, &
USE_CGICE, FIXEDHICE, &
FIXEDVISC,FIXEDDENS,FIXEDELAS
INTEGER :: IND, IS, NUMIN
!
!/
!/ ------------------------------------------------------------------- /
!/
!/S CALL STRACE (IENT, 'W3SIC3')
!
! 0. Initializations ------------------------------------------------ /
!
!
D = 0.0
D1D = 0.0
!
WN_R = WN
WN_I = 0.0
CG_IC3 = 0.0
CG_TMP = 0.0
!
ICECOEF1 = 0.0
ICECOEF2 = 0.0
ICECOEF3 = 0.0
ICECOEF4 = 0.0
ICECOEF5 = 0.0
ICECONC = 0.0
!
! Rename variables to make code easier to read.
MAXTHK=IC3PARS(1)
MAXCNC=IC3PARS(8)
USE_CHENG=IC3PARS(9)
USE_CGICE=IC3PARS(12)
FIXEDHICE=IC3PARS(13)
FIXEDVISC=IC3PARS(14)
FIXEDDENS=IC3PARS(15)
FIXEDELAS=IC3PARS(16)
! --- Error checking for input ----------------------------------- /
! --- Allow one and only one input option for each variable ------ /
NUMIN=0
IF (INFLAGS2(-7)) NUMIN=NUMIN+1
IF (FIXEDHICE.GE.0.0) NUMIN=NUMIN+1
IF (NUMIN.NE.1) THEN
IF ( IAPROC .EQ. NAPERR ) &
WRITE (NDSE,1001) 'ICE PARAMETER 1 (HICE)',NUMIN
CALL EXTCDE(2)
ENDIF
NUMIN=0
IF (INFLAGS2(-6)) NUMIN=NUMIN+1
IF (FIXEDVISC.GE.0.0) NUMIN=NUMIN+1
IF (NUMIN.NE.1) THEN
IF ( IAPROC .EQ. NAPERR ) &
WRITE (NDSE,1001) 'ICE PARAMETER 2 (VISC)',NUMIN
CALL EXTCDE(2)
ENDIF
NUMIN=0
IF (INFLAGS2(-5)) NUMIN=NUMIN+1
IF (FIXEDDENS.GE.0.0) NUMIN=NUMIN+1
IF (NUMIN.NE.1) THEN
IF ( IAPROC .EQ. NAPERR ) &
WRITE (NDSE,1001) 'ICE PARAMETER 3 (DENS)',NUMIN
CALL EXTCDE(2)
ENDIF
NUMIN=0
IF (INFLAGS2(-4)) NUMIN=NUMIN+1
IF (FIXEDELAS.GE.0.0) NUMIN=NUMIN+1
IF (NUMIN.NE.1) THEN
IF ( IAPROC .EQ. NAPERR ) &
WRITE (NDSE,1001) 'ICE PARAMETER 4 (ELAS)',NUMIN
CALL EXTCDE(2)
ENDIF
! --- Set local value to be used subsequently (ICEPx variables
! are not used beyond this point). --------------------------- /
IF (INFLAGS2(-7)) THEN
ICECOEF1 = ICEP1(IX,IY) ! ice thickness
ELSE
ICECOEF1 = FIXEDHICE
ENDIF
IF (INFLAGS2(-6)) THEN
ICECOEF2 = ICEP2(IX,IY) ! effective viscosity of ice cover
ELSE
ICECOEF2 = FIXEDVISC
ENDIF
IF (INFLAGS2(-5)) THEN
ICECOEF3 = ICEP3(IX,IY) ! density of ice
ELSE
ICECOEF3 = FIXEDDENS
ENDIF
IF (INFLAGS2(-4)) THEN
ICECOEF4 = ICEP4(IX,IY) ! effective shear modulus of ice
ELSE
ICECOEF4 = FIXEDELAS
ENDIF
! ICECOEF5 = ICEP5(IX,IY) ! ICEP5 is inactive in W3SIC3
IF (INFLAGS2(4)) ICECONC = ICEI(IX,IY)
!
! 1. No ice --------------------------------------------------------- /
!
NOICE=.FALSE.
IF (ICECOEF1==0.0) NOICE=.TRUE.
IF (INFLAGS2(4).AND.(ICECONC==0.0)) NOICE=.TRUE.
IF ( NOICE ) THEN
D1D=0.0
!
! 2. Ice ------------------------------------------------------------ /
ELSEIF ( USE_CHENG==1.0 .AND. &
((ICECOEF1.LE.MAXTHK).OR.(ICECONC.LE.MAXCNC)) ) THEN
! 2.a Write test output ---------------------------------------------- /
!/T38 WRITE (NDST,9000) DEPTH,ICECOEF1,ICECOEF2,ICECOEF3,ICECOEF4
! 2.b Make calculations using Cheng routines ------------------------- /
! --- Input to routine (part 1): 6 ice parameters from single
! precision variables. ---------------------------------------
CALL W3IC3WNCG_CHENG(WN_R, WN_I, CG_IC3, ICECOEF1, ICECOEF2, &
ICECOEF3, ICECOEF4, DEPTH)
!
! --- calculate source term --------------------------------------- /
! --- see Remarks section re: array size -------------------------- /
IF ( USE_CGICE==1.0 ) THEN
CG_TMP=CG_IC3
ELSE
CG_TMP=CG
ENDIF
DO IK=1, NK
! recall that D=S/E=-2*Cg*k_i
D1D(IK)= -2.0 * CG_TMP(IK) * WN_I(IK)
END DO
ELSEIF ( (ICECOEF1 .LE. MAXTHK) .OR. (ICECONC .LE. MAXCNC) ) THEN
!.......... e.g. if ice thickness is .le. 10 cm
!...............or concentration is .le. 1.0
!
! 2.a Write test output ---------------------------------------------- /
!/T38 WRITE (NDST,9000) DEPTH,ICECOEF1,ICECOEF2,ICECOEF3,ICECOEF4
!
! 2.b Make calculations using original routines ---------------------- /
! --- Input to routine (part 1): 6 ice parameters from single
! precision variables. ---------------------------------------
CALL W3IC3WNCG_V1(WN_R, WN_I, CG_IC3, ICECOEF1, ICECOEF2, &
ICECOEF3, ICECOEF4, DEPTH )
!
! --- calculate source term --------------------------------------- /
IF ( USE_CGICE==1.0 ) THEN
CG_TMP=CG_IC3
ELSE
CG_TMP=CG
ENDIF
DO IK=1, NK
! recall that D=S/E=-2*Cg*k_i
D1D(IK)= -2.0 * CG_TMP(IK) * WN_I(IK)
END DO
!
ELSE ! .. e.g. if ice thickness is .gt. 10 cm
! Alternative by F.A., see Remarks section.
IF (IC3PARS(2).GT.0.) THEN
UORB=0.
AORB=0.
FTURB = IC3PARS(2)
IF (IC3PARS(7).GT.0) THEN
IF (YGRD(IY,IX).LT.0.AND.GTYPE.EQ.RLGTYPE.AND.FLAGLL) &
FTURB = IC3PARS(7)
END IF
DO IK=1, NK
EB = 0.
DO ITH=1, NTH
IS=ITH+(IK-1)*NTH
EB = EB + A(IS)
END DO
!
! UORB and AORB are the variances of the orbital
! velocity and surface elevation
!
UORB = UORB + EB *SIG(IK)**2 * DDEN(IK) / CG(IK)
AORB = AORB + EB * DDEN(IK) / CG(IK)
!deep water only
END DO
!
AORB = 2*SQRT(AORB) ! significant amplitude
UORB = 2*SQRT(UORB) ! significant amplitude
RE = UORB*AORB / VISCM
SMOOTH = 0.5*TANH((RE-IC3PARS(4))/IC3PARS(5))
PTURB=(0.5+SMOOTH)
PVISC=(0.5-SMOOTH)
XI=(ALOG10(MAX(AORB/IC3PARS(3),3.))-ABMIN)/DELAB
IND = MIN (SIZEFWTABLE-1, INT(XI))
DELI1= MIN (1. ,XI-FLOAT(IND))
DELI2= 1. - DELI1
FW =FWTABLE(IND)*DELI2+FWTABLE(IND+1)*DELI1
DTURB=-1.* FTURB*FW*UORB/GRAV
ELSE ! so case of IC3PARS(2).LE.0.
DTURB = 0.
END IF ! IF (IC3PARS(2).GT.0.)
DO IK=1, NK
DVISC = -1. *IC3PARS(6) * WN(IK) * SQRT(VISCM* SIG(IK) / 2.)
D1D(IK) = PTURB*DTURB*SIG(IK)**2 + PVISC*DVISC
END DO
END IF ! IF ( NOICE ) THEN
! 2.c Fill diagional matrix ------------------------------------------ /
!
DO IKTH=1, NSPEC
D(IKTH) = D1D(MAPWN(IKTH))
END DO
!
! sign convention (example):
! S is from -10e-3 to 0
! A is from 0 to 10
! See Remarks section re: optimization
S = D * A
!
! ... Test output of arrays
!
!/T0 DO IK=1, NK
!/T0 DO ITH=1, NTH
!/T0 DOUT(IK,ITH) = D(ITH+(IK-1)*NTH)
!/T0 END DO
!/T0 END DO
!
!/T0 CALL PRT2DS (NDST, NK, NK, NTH, DOUT, SIG(1:), ' ', 1., &
!/T0 0.0, 0.001, 'Diag Sice', ' ', 'NONAME')
!
!/T1 CALL OUTMAT (NDST, D, NTH, NTH, NK, 'diag Sice')
!
! Formats
!
1001 FORMAT (/' *** WAVEWATCH III ERROR IN W3SIC3 : '/ &
' ',A,' REQUIRED ONCE, BUT WAS PROVIDED BY USER '/ &
' ',I4,' TIMES.'/)
!
!/T 9000 FORMAT (' TEST W3SIC3 : depth and 4 ice coef. : ',5E10.3)
!/
!/ End of W3SIC3 ----------------------------------------------------- /
!/
END SUBROUTINE W3SIC3
!/ ------------------------------------------------------------------- /
!/
SUBROUTINE W3IC3WNCG_V1(WN_R,WN_I,CG,ICE1,ICE2,ICE3,ICE4,DPT)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | E. Rogers |
!/ | S. Zieger |
!/ | FORTRAN 90 |
!/ | Last update : 25-Oct-2013 |
!/ +-----------------------------------+
!/
!/ 06-May-2013 : Origination (port from Clarkson.f90)( version 4.10 )
!/ (E. Rogers)
!/ 09-Oct-2013 : Update to meet WW3 coding standard (S. Zieger)
!/
! 1. Purpose :
!
! Calculation of complex wavenumber for waves in ice. Outsourced
! from W3SIC3 to allow update on wavenumbers and group
! velocities at each time step an ice parameter is updated.
!
! 2. Method :
!
! <text here>
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! WN_R R. A. I/O Wave number (real part)
! WN_I R. A. I/O Wave number (imag. part=wave attenuation)
! CG R. A. I/O Group velocity
! ICE1 REAL I Thickness of ice [in m]
! ICE2 REAL I Effective viscosity of ice [in m2/s]
! ICE3 REAL I Density of ice [in kg/m3]
! ICE4 REAL I Effective shear modulus of ice [in Pa]
! DPT REAL I Water depth [in m]
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! WAVNU1 Subr. W3DISPMD Wavenumber for waves in open water.
! WN_CMPLX Func. W3SIC3MD Complex wavenumber for waves in ice.
! WN_CMPLX_HF Func. W3SIC3MD Like WN_CMPLX, but for h-f
! ----------------------------------------------------------------
!
! 5. Called by :
!
! Name Type Module Description
! ----------------------------------------------------------------
! W3SIC3 Subr. W3SIC3MD Ice source term.
! ----------------------------------------------------------------
!
! 6. Error messages :
!
! See FORMAT 900.
!
! 7. Remarks :
!
! Optional: Cap WN_I at 2.0E-4, since in simple tests with "normal
! resolution" (not finer than 1 km), WW3 has trouble resolving the
! dissipation if k_i>2e-4. Also, very large values of dissipation
! (e.g. k_i=100e-4) with IC3 occurs more in the higher frequencies
! which makes WW3 slow down quite a bit. This is done via ICEKILIM
! in the namelists.
!
! This function does not get used in update by S. Cheng.
! It should be removed if/when "V1" routines are removed.
!
! 8. Structure :
!
! See source code.
!
! 9. Source code :
!/
!/ ------------------------------------------------------------------- /
!/
USE W3GDATMD, ONLY: NK, SIG, IC3PARS
USE W3DISPMD, ONLY: WAVNU1
USE W3ODATMD, ONLY: NDSE
USE W3SERVMD, ONLY: EXTCDE
USE CONSTANTS, ONLY: TPI
!/
IMPLICIT NONE
!/
REAL, INTENT(INOUT):: WN_R(:),WN_I(:),CG(:)
REAL, INTENT(IN) :: ICE1, ICE2, ICE3, ICE4, DPT
INTEGER :: IK, KL,KU
REAL, ALLOCATABLE :: SIGMA(:),CG_IC3(:)
REAL :: K_OCEAN, CG_OCEAN
DOUBLE PRECISION :: KH, K_NOICE, HWAT, HICE, NU, DICE, ES_MOD
DOUBLE PRECISION,PARAMETER :: KHMAX = 18.0D0 ! 18=OK, 19=fails
DOUBLE COMPLEX :: WNCOMPLEX,WNCOMPLEX_OLD
REAL :: STENSEC
REAL :: IC3HILIM,IC3KILIM
!
ALLOCATE( CG_IC3( SIZE(CG) ) )
ALLOCATE( SIGMA( SIZE(CG) ) )
CG_IC3 = 0.
SIGMA = 0.
STENSEC=TPI/10.0 ! sigma for T=10 sec
IC3HILIM=IC3PARS(10)
IC3KILIM=IC3PARS(11)
!
! --- Input to routine (part 1): set 6 double precision variables
! using single precision variables. -------------------------- /
HWAT = DBLE(DPT) ! water depth
HICE = DBLE(ICE1) ! ice thickness
NU = DBLE(ICE2) ! "effective viscosity" parameter
DICE = DBLE(ICE3) ! density of ice
ES_MOD = DBLE(ICE4) ! effective shear modulus of ice
! Optional: limit ice thickness
HICE=MIN(DBLE(IC3HILIM),HICE)
IF (SIZE(WN_R,1).EQ.NK) THEN
KL = 1
KU = NK
SIGMA = SIG(1:NK)
ELSE IF (SIZE(WN_R,1).EQ.NK+2) THEN
KL = 1
KU = NK+2
SIGMA = SIG(0:NK+1)
ELSE
WRITE(NDSE,900)
CALL EXTCDE(3)
END IF
!
WNCOMPLEX_OLD=CMPLX(0.0D0,0.0D0)
DO IK = KL,KU
! --- Input to routine (part 2): set 2 double precision variables
! using single precision variable. --------------------------- /
CALL WAVNU1(SIGMA(IK),DPT,K_OCEAN,CG_OCEAN)
K_NOICE = DBLE(K_OCEAN)
!
! --- Muller Method fails for deep water: workaround follows ----- /
KH = K_NOICE * HWAT ! kh w/out ice
IF (KH.GT.KHMAX) THEN
HWAT = KHMAX / K_NOICE
ENDIF
! --- Calculate complex wavenumber ------------------------------- /
IF((IK.GT.KL).AND.(SIGMA(IK).GT.STENSEC))THEN
WNCOMPLEX = WN_CMPLX_HF(DBLE(SIGMA(IK)),K_NOICE,ES_MOD,NU, &
DICE,HICE,HWAT,DBLE(SIGMA(IK-1)),WNCOMPLEX_OLD)
WNCOMPLEX_OLD=WNCOMPLEX
ELSE
WNCOMPLEX = WN_CMPLX_V1(DBLE(SIGMA(IK)),K_NOICE,ES_MOD,NU, &
DICE,HICE,HWAT)
WNCOMPLEX_OLD=WNCOMPLEX
ENDIF
! --- Output from function is type of DOUBLE COMPLEX. Set
! precision of imaginary to single precision array element --- /
WN_I(IK) = REAL(AIMAG(WNCOMPLEX))
! Optional : limit ki
WN_I(IK) = MIN(WN_I(IK),IC3KILIM) ! see Remarks above
WN_R(IK) = REAL(WNCOMPLEX)
END DO
! --- Update group velocitiy ----
CG_IC3 = DELTA(SIGMA) / DELTA(WN_R)
CG = CG_IC3
DEALLOCATE(CG_IC3)
!
900 FORMAT (/' *** WAVEWATCH III ERROR IN W3SIC3_W3IC3WNCG : '/&
' CANNOT DETERMINE BOUNDS OF WAVENUMBER ARRAY.')
!
!/
END SUBROUTINE W3IC3WNCG_V1
!/ ------------------------------------------------------------------- /
!/
FUNCTION WN_CMPLX_V1(SIGMA,WN_O,ES,NU,DICE,HICE,DEPTH) RESULT(WN)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | E. Rogers |
!/ | S. Zieger |
!/ | FORTRAN 90 |
!/ | Last update : 30-Oct-2013 |
!/ +-----------------------------------+
!/
!/ 06-May-2013 : Origination (port from Clarkson.f90)( version 4.10 )
!/ (E. Rogers)
!/ 09-Oct-2013 : Update to meet WW3 coding standard (S. Zieger)
!/ 30-Oct-2013 : Clarkson.f90 update added (S. Zieger)
!/
! 1. Purpose :
!
! Calculate complex wavenumber for waves in ice.
!
! 2. Method :
!
! Wang and Shen (JGR 2010)
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! WN CMPLX DBL O Wave number (imag. part=wave attenuation)
! SIGMA REAL DBL I Wave angular frequency [in rad]
! WN_O REAL DBL I Wave number (open water)
! ES REAL DBL I Effective shear modulus of ice [in Pa]
! NU REAL DBL I Effective viscosity of ice [in m2/s]
! DICE REAL DBL I Density of ice [in kg/m3]
! HICE REAL DBL I Thickness of ice [in m]
! DEPTH REAL DBL I Water depth [in m]
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! CMPLX_ROOT_MULLER_CHENG Func. W3SIC3MD Find root for complex
! wavenumbers for waves in ice.
! ----------------------------------------------------------------
!
! 5. Called by :
!
! Name Type Module Description
! ----------------------------------------------------------------
! W3IC3WNCG_V1 Subr. W3SIC3MD Ice source term.
! ----------------------------------------------------------------
!
! 6. Error messages :
!
! 7. Remarks :
!
! Original authors: Zhao and Shen.
! This code is based on Fortran code provided by Hayley Shen (Clarkson
! University) to Erick Rogers (NRL) on April 19 2013.
!
! Hayley Shen says,
! We have determined that it may not be necessary to use curve
! fitting or lookup tables to get the group velocity and the
! attenuation coefficient. Attached is a short report with some
! sample numerical solutions. To implement the viscoelastic model,
! there are 4 fortran programs. According to Xin Zhao, the graduate
! student, it is very fast to find roots. I suggest that perhaps you
! try the pure viscous case by setting G=0 to start with. nu can be
! set at 0.05*ice concentration (m^2/s) to begin with, because for
! grease ice Newyear's data showed nu to be about 0.02-0.03 m^2/s.
! By setting G=0 in you get exactly the Keller model for pure
! viscous layer.
!
! This routine provides the initial guess according to the parameters
! of the present case. T>10s use open water, T<10s cases, calculate
! T=10s first using open water as the initial guess.
!
! 8. Structure :
!
! See source code.
!
! 9. Switches :
!
! 10. Source code :
!
!/ ------------------------------------------------------------------- /
USE CONSTANTS, ONLY: TPI
!/
IMPLICIT NONE
!/
!/ ------------------------------------------------------------------- /
!/ Parameter list
!/
DOUBLE PRECISION, INTENT(IN) :: SIGMA,WN_O,ES,NU,DICE,HICE,DEPTH
DOUBLE COMPLEX :: WN ! RESULT
!/
!/ ------------------------------------------------------------------- /
!/ Local parameters
!/
INTEGER :: I, NSUB
DOUBLE PRECISION :: TT, TS, T
DOUBLE COMPLEX :: X0, X1, X2, WN0
!/
!/ ------------------------------------------------------------------- /
T = DBLE(TPI) / SIGMA
TS = 10.
NSUB = INT((TS-T) * 10.)
!/
IF (HICE<0.001) THEN
WN = CMPLX(WN_O,0.)
ELSE IF (T.LT.TS) THEN
X0 = 0.01
X1 = 0.1
X2 = 1.0
WN0 = CMPLX_ROOT_MULLER_V1(X0,X1,X2,0,DBLE(TPI)/TS, &
ES,NU,DICE,HICE,DEPTH )
X0 = 0.90 * WN0
X1 = WN0
X2 = 1.1*WN0
WN = CMPLX_ROOT_MULLER_V1(X0,X1,X2,1,DBLE(TPI)/TS, &
ES,NU,DICE,HICE,DEPTH )
DO I=1,NSUB
X0 = 0.90 * WN
X1 = WN
X2 = 1.1 * WN
TT = TS - (TS-T) / REAL(NSUB) * REAL(I)
WN = CMPLX_ROOT_MULLER_V1(X0,X1,X2,1,DBLE(TPI)/TT, &
ES,NU,DICE,HICE,DEPTH )
ENDDO
ELSE
X0 = 0.01
X1 = 0.1
X2 = 1.0
WN0 = CMPLX_ROOT_MULLER_V1(X0,X1,X2,0,SIGMA, &
ES,NU,DICE,HICE,DEPTH )
X0 = 0.8 * WN0
X1 = WN0
X2 = 1.2 * WN0
WN = CMPLX_ROOT_MULLER_V1(X0,X1,X2,1,SIGMA, &
ES,NU,DICE,HICE,DEPTH )
ENDIF
!/
END FUNCTION WN_CMPLX_V1
!/ ------------------------------------------------------------------- /
!/
FUNCTION WN_CMPLX_HF(SIGMA,WN_O,ES,NU,DICE,HICE,DEPTH,SIGMA_LAST, &
WN_LAST) RESULT(WN)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. Shen |
!/ | E. Rogers |
!/ | FORTRAN 90 |
!/ | Last update : 17-Apr-2014 |
!/ +-----------------------------------+
!/
!/ 15-Jan-2014 : Origination (from WN_CMPLXA.f90) (H. Shen)
!/ 17-Apr-2014 : Import to WW3 (E. Rogers)
!/
! 1. Purpose :
!
! Calculate complex wavenumber for waves in ice.
!
! 2. Method :
!
! Wang and Shen (JGR 2010)
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! WN CMPLX DBL O Wave number (imag. part=wave attenuation)
! SIGMA REAL DBL I Wave angular frequency [in rad]
! WN_O REAL DBL I Wave number (open water)
! ES REAL DBL I Effective shear modulus of ice [in Pa]
! NU REAL DBL I Effective viscosity of ice [in m2/s]
! DICE REAL DBL I Density of ice [in kg/m3]
! HICE REAL DBL I Thickness of ice [in m]
! DEPTH REAL DBL I Water depth [in m]
! SIGMA_LAST REAL DBL I : Like SIGMA, but of last IK
! WN_LAST REAL DBL I : WN_O of last IK
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!