-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw3odatmd.F90
1877 lines (1874 loc) · 67.6 KB
/
w3odatmd.F90
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 W3ODATMD
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 22-Mar-2021 |
!/ +-----------------------------------+
!/
!/ 13-Dec-2004 : Origination. ( version 3.06 )
!/ 20-Jul-2005 : Adding output fields. ( version 3.07 )
!/ 29-Sep-2005 : Second storage for input bound. sp. ( version 3.08 )
!/ Add FILED for the dump of data.
!/ 26-Jun-2006 : Add output type 6, wave field sep. ( version 3.09 )
!/ Wiring of code only.
!/ 27-Jun-2006 : Adding file name preamble. ( version 3.09 )
!/ 24-Jul-2006 : Adding unified point output storage.( version 3.10 )
!/ 25-Jul-2006 : Originating grid ID for points. ( version 3.10 )
!/ 04-Oct-2006 : Add filter to array pointers. ( version 3.10 )
!/ 30-Oct-2006 : Add pars for partitioning. ( version 3.10 )
!/ 26-Mar-2007 : Add pars for partitioning. ( version 3.11 )
!/ 17-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
!/ 21-Jun-2007 : Dedicated output processes. ( version 3.11 )
!/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
!/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
!/ (W. E. Rogers & T. J. Campbell, NRL)
!/ 14-Jul-2010 : Fix VAAUX declaration bug. ( version 3.14.2 )
!/ 27-Jul-2010 : Add NKI, NTHI, XFRI, FR1I, TH1I. ( version 3.14.3 )
!/ 08-Nov-2010 : Implementing unstructured grids ( version 3.14.4 )
!/ (A. Roland and F. Ardhuin)
!/ 18-Dec-2012 : New 2D field output structure, ( version 4.11 )
!/ reducing memory footprint for fields.
!/ 19-Dec-2012 : Move NOSWLL to data structure. ( version 4.11 )
!/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
!/ 27-Aug-2015 : Adding interpolated ICEF (mean ice ( version 5.10 )
!/ floe diameter), ICEH (ice thickness)
!/ and ICE (ice concentration).
!/ 01-Mar-2018 : Include UNDEF from constants.ftn to ( version 6.02 )
!/ avoid circular referencing in w3servmd
!/ 05-Jun-2018 : Add SETUP ( version 6.04 )
!/ 27-Jul-2018 : Added PTMETH and PTFCUT variables ( version 6.05 )
!/ for alternative partition methods.
!/ (C. Bunney, UKMO)
!/ 25-Sep-2020 : Flags for coupling restart ( version 7.10 )
!/ 15-Jan-2020 : Added TP based on existing FP ( version 7.12 )
!/ internal fields. (C. Bunney, UKMO)
!/ 22-Mar-2021 : Add extra coupling variables ( version 7.13 )
!/ 07-Jun-2021 : S_{nl} GKE NL5 (Q. Liu) ( version 7.13 )
!/ 19-Jul-2021 : Momentum and air density support ( version 7.14 )
!/
!/ Copyright 2009-2012 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 :
!
! Define data structures to set up wave model grids and aliases
! to use individual grids transparently. Also includes subroutines
! to manage data structure and pointing to individual models.
! This module considers the parameters required for model output.
!
! 2. Variables and types :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! NOUTP Int. Public Number of models in array dim.
! IOUTP Int. Public Selected model for output, init. at -1.
! IOSTYP Int. Public Output data server type.
! NOGRP I.P. Public Number of output field groups
! NGRPP I.P. Public Max numb of parameters per output group
! NOGE I.P. Public Number of output group elements
! NOTYPE I.P. Public Number of output types
! NOEXTR I.P. Public Number of extra (user available)
! output fields.
! DIMP I.P. Public Number of parameters in partition
! output group
! IDOUT C.A. Public ID strings for output fields.
! FNMPRE Char Public File name preamble.
! UNDEF Real Public Value for undefined parameters in
! gridded output fields.
! UNIPTS Log. Public Flag for unified point output (output
! to single file).
! UPPROC Log. Public FLag for dedicated point output proc.
! OUTPUT TYPE Public Data structure defining output.
! OUTPTS GRID Public Array of output for models.
! ----------------------------------------------------------------
!
! Elements of OUTPUT are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! NDSO Int. Public General output unit number ("log
! file").
! NDSE Int. Public Error output unit number.
! NDST Int. Public Test output unit number.
! SCREEN Int. Public Unit for 'direct' output.
! NTPROC Int. Public Number of processors.
! NAPROC Int. Public Number of processors for computation.
! IAPROC Int. Public Actual processor number (base 1),
! NAPLOG Int. Public Proc. dealing with log output.
! NAPOUT Int. Public Proc. dealing with standard output.
! NAPERR Int. Public Proc. dealing with error output.
! NAPFLD Int. Public Proc. dealing with raw field output.
! NAPPNT Int. Public Proc. dealing with raw point output.
! NAPTRK Int. Public Proc. dealing with track output.
! NAPRST Int. Public Proc. dealing with restart output.
! NAPBPT Int. Public Proc. dealing with boundary output.
! NAPPRT Int. Public Proc. dealing with partition output.
! NOSWLL I.P. Public Number of swell fields from part.
! to be used in field output.
! TOSNL5 I.A. Public Times for point ouput (!/NL5)
! TOFRST I.A. Public Times for first output.
! TONEXT I.A. Public Times for next output.
! TOLAST I.A. Public Times for last output.
! TBPI0 I.A Public Time of first set of input boundary
! spectra.
! TBPIN I.A Public Id. second set.
! NDS I.A. Public Data set numbers (see W3INIT).
! DTOUT R.A. Public Output intervals.
! FLOUT L.A. Public Output flags.
! OUT1 TYPE Public Data structure of type OTYPE1 with
! suppl. data for output type 1.
! OUT2 TYPE Public Data structure of type OTYPE2 with
! suppl. data for output type 2.
! OUT3 TYPE Public Data structure of type OTYPE3 with
! suppl. data for output type 3.
! OUT4 TYPE Public Data structure of type OTYPE4 with
! suppl. data for output type 4.
! OUT5 TYPE Public Data structure of type OTYPE5 with
! suppl. data for output type 5.
! OUT6 TYPE Public Data structure of type OTYPE6 with
! suppl. data for output type 6.
! OFILES I.A. Public Output in one or several files.
! ----------------------------------------------------------------
!
! Elements of OUT1 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! IPASS1 Int. Public Pass counter for file management,
! renamed to IPASS in routine.
! WRITE1 Int. Public Write flag for file management,
! renamed to WRITE in routine.
! NRQGO(2) Int. Public Number of MPI handles W3IOGO.
! IRQGO I.A. Public Array with MPI handles W3IOGO.
! FLOGRD L.A. Public FLags for output fields.
! FLOGR2 L.A. Public FLags for coupling fields.
! FLOGRR L.A. Public FLags for optional coupling restart (2D).
! FLOGD L.A. Public Flags for output groups
! FLOG2 L.A. Public Flags for coupling groups
! FLOGR L.A. Public FLags for optional coupling restart (1D).
! ----------------------------------------------------------------
!
! Elements of OUT2 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! IPASS2 Int. Public Pass counter for file management,
! renamed to IPASS in routine.
! NOPTS Int. Public Number of output points.
! NRQPO(2) Int. Public Number of MPI handles IRQPOn. (!/MPI)
! IPTINT I.A. Public (I,J)-indices of enclosing cell corner points
! IL I.A. Public Number of land points in interpola-
! tion box for output point.
! IW I.A. Public Id. water.
! II I.A. Public Id. ice.
! IRQPO1/2 I.A. Public Array with MPI handles. (!/MPI)
! PTLOC R.A. Public Output locations.
! PTIFAC R.A. Public Interpolation weights.
! DPO R.A. Public Interpolated depths.
! WAO R.A. Public Interpolated wind speeds.
! WDO R.A. Public Interpolated wind directions.
! ASO R.A. Public Interpolated air-sea temp. diff.
! TAUAO R.A. Public Interpolated atm. stresses.
! TAUDO R.A. Public Interpolated atm. stres directions.
! DAIRO R.A. Public Interpolated rho atmosphere.
! CAO R.A. Public Interpolated current speeds.
! CDO R.A. Public Interpolated current directions.
! SPCO R.A. Public Output spectra.
! ICEO R.A. Public Interpolated ice concentration.
! ICEHO R.A. Public Interpolated ice thickness.
! ICEFO R.A. Public Interpolated ice floe.
! PTNME C.A. Public Name of output locations.
! GRDID C.A. Public Originating grid ID.
! O2INIT Log. Public Flag for array initialization.
! O2IRQI Log. Public Flag for array initialization.
! ----------------------------------------------------------------
!
! Elements of OUT3 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! IPASS3 Int. Public Pass counter for file management,
! renamed to IPASS in routine.
! IT0PNT Int. Public Base tag number of MPI communication.
! IT0TRK Int. Public Base tag number of MPI communication.
! IT0PRT Int. Public Base tag number of MPI communication.
! NRQTR Int. Public Number of handles in IRQTR.
! IRQTR I.A. Public Array with MPI handles.
! O3INIT Log. Public Flag for array initialization.
! STOP Log. Public Flag for end of output.
! MASKn L.A. Public Mask arrays for internal use.
! ----------------------------------------------------------------
!
! Elements of OUT4 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! IFILE4 Int. Public File number for output files.
! NBLKRS Int. Public Number of blocks in communication of
! spectra.
! RSBLKS Int. Public Corresponding block size.
! NRQSR Int. Public Number of MPI handles.
! IRQRS I.A. Public Array with MPI handles.
! IRQRSS I.A. Public Array with MPI handles.
! VAAUX R.A. Public Aux. spectra storage.
! ----------------------------------------------------------------
!
! Elements of OUT5 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! NBI(2) Int. Public Number of input bound. points.
! NFBPO Int. Public Number of files for output bound. data.
! NRQBP(2) Int. Public Number of MPI handles.
! NKI,NTHI Int. Public Size of input spectra
! NBO(2) I.A. Public Number of output bound. pts. per file.
! NDSL I.A. Public Array with unit numbers.
! IPBPI I.A. Public Interpolation data input b.p.
! ISBPI I.A. Public Sea point counters for input b.p.
! IRQBP1/2 I.A. Public Array with MPI handles.
! XFRI, FR1I, TH1I
! Real Public Definition of input spectra.
! X/YBPI R.A. Public Location of input boundary points.
! RDBPI R.A. Public Interpolation factors input b.p.
! ABPI0/N R.A. Public Storage of spectra from which to
! interpolate b.d.
! BBPI0/N R.A. Public idem, secondary storage.
! ABPOS R.A. Public Temporarily storage for output b.d.
! IPBPO, ISBPO, X/YBPO, RDBPO
! Misc. Public Id. for output b.p.
! FLBPI Log. Public Flag for input of boundary data.
! FLBPO Log. Public Flag for output of boundary data.
! FILER/W/D Log. Public Read/write flags for file management.
! SPCONV Log. Public Flag for change of spectral res.
! O5INIn Log. Public Flag for array initializations.
! ----------------------------------------------------------------
!
! Elements of OUT6 are aliased to pointers with the same
! name. These pointers are defined as :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! IPASS6 Int. Public Pass counter for file management,
! renamed to IPASS in routine.
! IHMAX Int. Public Number of discrete spectral levels.
! IX0/N/S Int. Public First-last-step IX counters.
! IY0/N/S Int. Public Idem IY counters.
! HSPMIN Real Public Minimum significant height per part.
! WSMULT Real Public Multiplier for wind sea boundary.
! WSCUT Real Public Cut-off wind factor for wind seas.
! ICPRT I.A. Public Counters for partitions.
! DTPRT R.A. Public Data from partitions.
! FLCOMB Log. Public Flag for combining wind seas.
! FLFORM Log. Public Flag for (un)formatted output
! O6INIT Log. Public Flag for array initializations.
! ----------------------------------------------------------------
!
! 3. Subroutines and functions :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! W3NOUT Subr. Public Set number of grids.
! W3DMO2 Subr. Public Allocate arrays output type 2.
! W3DMO3 Subr. Public Allocate arrays output type 3.
! W3DMO5 Subr. Public Allocate arrays output type 5.
! W3SETO Subr. Public Point to selected grid / model.
! ----------------------------------------------------------------
!
! 4. Subroutines and functions used :
!
! Name Type Module Description
! ----------------------------------------------------------------
! W3SETG Subr. W3GDATMD Point to proper model grid.
! STRACE Subr. W3SERVMD Subroutine tracing.
! EXTCDE Subr. W3SERVMD Abort program with exit code.
! ----------------------------------------------------------------
!
! 5. Remarks :
!
! - The number of grids is taken from W3GDATMD, and needs to be
! set first with W3DIMG.
!
! 6. Switches :
!
! !/MPI MPI specific calls.
! !/S Enable subroutine tracing.
! !/T Enable test output
!
! 7. Source code :
!
!/ ------------------------------------------------------------------- /
USE CONSTANTS, ONLY : UNDEF
! module default
IMPLICIT NONE
PUBLIC
!/
!/ Module private variable for checking error returns
!/
INTEGER, PRIVATE :: ISTAT
!/
!/ Conventional declarations
!/
INTEGER :: NOUTP = -1, IOUTP = -1, IOSTYP = 1
!
INTEGER, PARAMETER :: NOGRP = 10
INTEGER, PARAMETER :: NGRPP = 20
INTEGER, PARAMETER :: DIMP = 15
INTEGER :: NOGE(NOGRP)
INTEGER :: NOTYPE
INTEGER, PARAMETER :: NOEXTR= 2
CHARACTER(LEN=20) :: IDOUT(NOGRP,NGRPP)
CHARACTER(LEN=80) :: FNMPRE = './'
!Moved UNDEF to constants and included above
!REAL :: UNDEF = -999.9
LOGICAL :: UNIPTS = .FALSE., UPPROC = .FALSE.
!/
!/ Set NOGE and IDOUT identifiers in W3NOUT
!/
!/ Data structures
!/
TYPE OTYPE1
INTEGER :: IPASS1
#ifdef W3_MPI
INTEGER :: NRQGO, NRQGO2
INTEGER, POINTER :: IRQGO(:), IRQGO2(:)
#endif
LOGICAL :: FLOGRD(NOGRP,NGRPP), FLOGD(NOGRP), &
FLOGR2(NOGRP,NGRPP), FLOG2(NOGRP), &
FLOGRR(NOGRP,NGRPP), FLOGR(NOGRP), &
WRITE1
END TYPE OTYPE1
!/
TYPE OTYPE2
INTEGER :: IPASS2, NOPTS
#ifdef W3_MPI
INTEGER :: NRQPO, NRQPO2
#endif
INTEGER, POINTER :: IPTINT(:,:,:), IL(:), IW(:), II(:)
#ifdef W3_MPI
INTEGER, POINTER :: IRQPO1(:), IRQPO2(:)
#endif
REAL, POINTER :: PTLOC(:,:), PTIFAC(:,:), &
DPO(:), WAO(:), WDO(:), ASO(:), &
#ifdef W3_FLX5
TAUAO(:), TAUDO(:), DAIRO(:), &
#endif
CAO(:), CDO(:), ICEO(:), ICEHO(:), &
ICEFO(:), SPCO(:,:)
REAL, POINTER :: ZET_SETO(:) ! For the wave setup.
CHARACTER(LEN=40), POINTER :: PTNME(:)
CHARACTER(LEN=13), POINTER :: GRDID(:)
LOGICAL :: O2INIT
#ifdef W3_MPI
LOGICAL :: O2IRQI
#endif
END TYPE OTYPE2
!/
TYPE OTYPE3
INTEGER :: IPASS3
#ifdef W3_MPI
INTEGER :: IT0PNT, IT0TRK, IT0PRT, NRQTR
INTEGER, POINTER :: IRQTR(:)
#endif
LOGICAL :: O3INIT, STOP
LOGICAL, POINTER :: MASK1(:,:), MASK2(:,:)
CHARACTER(LEN=32), POINTER :: TRCKID(:,:)
END TYPE OTYPE3
!/
TYPE OTYPE4
INTEGER :: IFILE4
#ifdef W3_MPI
INTEGER :: NRQRS, NBLKRS, RSBLKS
INTEGER, POINTER :: IRQRS(:), IRQRSS(:)
REAL, POINTER :: VAAUX(:,:,:)
#endif
END TYPE OTYPE4
!/
TYPE OTYPE5
INTEGER :: NBI, NBI2, NFBPO, NBO(0:9), &
NBO2(0:9), NDSL(9), NKI, NTHI
#ifdef W3_MPI
INTEGER :: NRQBP = 0, NRQBP2 = 0
#endif
INTEGER, POINTER :: IPBPI(:,:), ISBPI(:), &
IPBPO(:,:), ISBPO(:)
#ifdef W3_MPI
INTEGER, POINTER :: IRQBP1(:), IRQBP2(:)
#endif
REAL :: XFRI, FR1I, TH1I
REAL, POINTER :: XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPI0(:,:), ABPIN(:,:), ABPOS(:,:), &
BBPI0(:,:), BBPIN(:,:)
LOGICAL :: O5INI1, O5INI2, O5INI3, O5INI4
LOGICAL :: FLBPI, FLBPO, FILER, FILEW, FILED, &
SPCONV
END TYPE OTYPE5
!/
TYPE OTYPE6
INTEGER :: IPASS6, IHMAX, IX0, IXN, IXS, &
IY0, IYN, IYS
INTEGER, POINTER :: ICPRT(:,:)
REAL :: HSPMIN, WSMULT, WSCUT
REAL, POINTER :: DTPRT(:,:)
LOGICAL :: FLFORM, FLCOMB, O6INIT
INTEGER :: PTMETH ! C. Bunney; Partitioning method
REAL :: PTFCUT ! C. Bunney; Part. 5 freq cut
END TYPE OTYPE6
!/
TYPE OUTPUT
INTEGER :: NDSO, NDSE, NDST, SCREEN
INTEGER :: NTPROC, NAPROC, IAPROC, NAPLOG, &
NAPOUT, NAPERR, NAPFLD, NAPPNT, &
NAPTRK, NAPRST, NAPBPT, NAPPRT
INTEGER :: NOSWLL
#ifdef W3_NL5
INTEGER :: TOSNL5(2)
#endif
INTEGER :: TOFRST(2), TONEXT(2,8), TOLAST(2,8), &
TBPI0(2), TBPIN(2), NDS(13), OFILES(7)
REAL :: DTOUT(8)
LOGICAL :: FLOUT(8)
TYPE(OTYPE1) :: OUT1
TYPE(OTYPE2) :: OUT2
TYPE(OTYPE3) :: OUT3
TYPE(OTYPE4) :: OUT4
TYPE(OTYPE5) :: OUT5
TYPE(OTYPE6) :: OUT6
END TYPE OUTPUT
!/
!/ Data storage
!/
TYPE(OUTPUT), TARGET, ALLOCATABLE :: OUTPTS(:)
!/
!/ Data aliasses for structure OUTPUT
!/
INTEGER, POINTER :: NDSO, NDSE, NDST, SCREEN
INTEGER, POINTER :: NTPROC, NAPROC, IAPROC, NAPLOG, &
NAPOUT, NAPERR, NAPFLD, NAPPNT, &
NAPTRK, NAPRST, NAPBPT, NAPPRT
INTEGER, POINTER :: NOSWLL
#ifdef W3_NL5
INTEGER, POINTER :: TOSNL5(:)
#endif
INTEGER, POINTER :: TOFRST(:), TONEXT(:,:), TOLAST(:,:), &
TBPI0(:), TBPIN(:), NDS(:)
INTEGER, POINTER :: OFILES(:)
REAL, POINTER :: DTOUT(:)
LOGICAL, POINTER :: FLOUT(:)
!/
!/ Data aliasses for substructures for output types
!/ Type 1 ...
!/
INTEGER, POINTER :: IPASS1
#ifdef W3_MPI
INTEGER, POINTER :: NRQGO, NRQGO2
INTEGER, POINTER :: IRQGO(:), IRQGO2(:)
#endif
LOGICAL, POINTER :: FLOGRD(:,:), FLOGR2(:,:), &
FLOGRR(:,:),FLOGD(:), FLOG2(:), &
FLOGR(:), WRITE1
!/
!/ Type 2 ...
!/
INTEGER, POINTER :: IPASS2, NOPTS
#ifdef W3_MPI
INTEGER, POINTER :: NRQPO, NRQPO2
#endif
INTEGER, POINTER :: IPTINT(:,:,:), IL(:), IW(:), II(:)
#ifdef W3_MPI
INTEGER, POINTER :: IRQPO1(:), IRQPO2(:)
#endif
REAL, POINTER :: PTLOC(:,:), PTIFAC(:,:), &
DPO(:), WAO(:), WDO(:), ASO(:), &
#ifdef W3_FLX5
TAUAO(:), TAUDO(:), DAIRO(:), &
#endif
CAO(:), CDO(:), ICEO(:), ICEHO(:), &
ICEFO(:), SPCO(:,:)
REAL, POINTER :: ZET_SETO(:)
!
CHARACTER(LEN=40), POINTER :: PTNME(:)
CHARACTER(LEN=13), POINTER :: GRDID(:)
LOGICAL, POINTER :: O2INIT
#ifdef W3_MPI
LOGICAL, POINTER :: O2IRQI
#endif
!/
!/ Type 3 ...
!/
INTEGER, POINTER :: IPASS3
#ifdef W3_MPI
INTEGER, POINTER :: IT0PNT, IT0TRK, IT0PRT, NRQTR
INTEGER, POINTER :: IRQTR(:)
#endif
LOGICAL, POINTER :: O3INIT, STOP
LOGICAL, POINTER :: MASK1(:,:), MASK2(:,:)
CHARACTER(LEN=32), POINTER :: TRCKID(:,:)
!/
!/ Type 4 ...
!/
INTEGER, POINTER :: IFILE4
#ifdef W3_MPI
INTEGER, POINTER :: NRQRS, NBLKRS, RSBLKS
INTEGER, POINTER :: IRQRS(:), IRQRSS(:)
REAL, POINTER :: VAAUX(:,:,:)
#endif
!/
!/ Type 5 ...
!/
INTEGER, POINTER :: NBI, NBI2, NFBPO, NKI, NTHI
INTEGER, POINTER :: NBO(:), NBO2(:), NDSL(:)
#ifdef W3_MPI
INTEGER, POINTER :: NRQBP, NRQBP2
#endif
INTEGER, POINTER :: IPBPI(:,:), ISBPI(:), &
IPBPO(:,:), ISBPO(:)
#ifdef W3_MPI
INTEGER, POINTER :: IRQBP1(:), IRQBP2(:)
#endif
REAL, POINTER :: XFRI, FR1I, TH1I
REAL, POINTER :: XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPI0(:,:), ABPIN(:,:), ABPOS(:,:), &
BBPI0(:,:), BBPIN(:,:)
LOGICAL, POINTER :: O5INI1, O5INI2, O5INI3, O5INI4
LOGICAL, POINTER :: FLBPI, FLBPO, FILER, FILEW, FILED, &
SPCONV
!/
!/ Type 6 ...
!/
INTEGER, POINTER :: IPASS6, IHMAX, IX0, IXN, IXS, &
IY0, IYN, IYS, ICPRT(:,:)
REAL, POINTER :: HSPMIN, WSMULT, WSCUT, DTPRT(:,:)
LOGICAL, POINTER :: FLFORM, FLCOMB, O6INIT
INTEGER, POINTER :: PTMETH ! C. Bunney; Partitioning method
REAL, POINTER :: PTFCUT ! C. Bunney; Part. 5 freq cut
character(len=8) :: runtype = '' !< @public the run type (startup,branch,continue)
character(len=256) :: initfile = '' !< @public name of wave initial condition file
!! if runtype is startup or branch run, then initfile is used
character(len=512) :: user_histfname = '' !< @public user history filename prefix, timestring
!! YYYY-MM-DD-SSSSS will be appended
character(len=512) :: user_restfname = '' !< @public user restart filename prefix, timestring
!! YYYY-MM-DD-SSSSS will be appended
logical :: histwr = .false. !< @public logical to trigger history write
!! if true => write history file (snapshot)
logical :: rstwr = .false. !< @public logical to trigger restart write
!! if true => write restart
logical :: use_historync = .false. !< @public logical flag to use netCDF for gridded
!! field output
logical :: use_restartnc = .false. !< @public logical flag to read and write netCDF restarts
logical :: restart_from_binary = .false. !< @public logical flag for restarting from binary restart
! when use_restartnc is true
logical :: logfile_is_assigned = .false. !< @public logical flag for assignment of nds(1) to specified
!! log file in mesh cap
logical :: verboselog = .true. !< @public logical flag to enable verbose WW3 native logging
logical :: slow_coupling = .true. !< @public logical flag for WW3 slow loop coupling
character(len= 36) :: time_origin = '' !< @public the time_origin used for netCDF output
character(len= 36) :: calendar_name = '' !< @public the calendar used for netCDF output
integer(kind=8) :: elapsed_secs = 0 !< @public the time in seconds from the time_origin
!/
CONTAINS
!/ ------------------------------------------------------------------- /
SUBROUTINE W3NOUT ( NDSERR, NDSTST )
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 22-Mar-2021 |
!/ +-----------------------------------+
!/
!/ 13-Dec-2004 : Origination. ( version 3.06 )
!/ 27-Jun-2006 : Adding file name preamble ( version 3.09 )
!/ 24-Jul-2006 : Adding unified point output storage.( version 3.10 )
!/ 04-Oct-2006 : Add filter to array pointers. ( version 3.10 )
!/ 30-Oct-2006 : Add pars for partitioning. ( version 3.10 )
!/ 26-Mar-2007 : Add pars for partitioning. ( version 3.11 )
!/ 17-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
!/ 18-Dec-2012 : Moving IDOUT initialization here. ( version 4.11 )
!/ 19-Dec-2012 : Move NOSWLL to data structure. ( version 4.11 )
!/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
!/ 22-Mar-2021 : Add extra coupling variables ( version 7.13 )
!/
! 1. Purpose :
!
! Set up the number of grids to be used.
!
! 2. Method :
!
! Use data stored in NGRIDS in W3GDATMD.
!
! 3. Parameters :
!
! Parameter list
! ----------------------------------------------------------------
! NDSERR Int. I Error output unit number.
! NDSTST Int. I Test output unit number.
! ----------------------------------------------------------------
!
! 4. Subroutines used :
!
! See module documentation below.
!
! 5. Called by :
!
! Any main program that uses this grid structure.
!
! 6. Error messages :
!
! - Error checks on previous setting of variable NGRIDS.
!
! 7. Remarks :
!
! 8. Structure :
!
! 9. Switches :
!
! !/S Enable subroutine tracing.
! !/T Enable test output
!
! 10. Source code :
!
!/ ------------------------------------------------------------------- /
USE W3GDATMD, ONLY: NGRIDS, NAUXGR
USE W3SERVMD, ONLY: EXTCDE
#ifdef W3_S
USE W3SERVMD, ONLY: STRACE
#endif
!
!/
!/ ------------------------------------------------------------------- /
!/ Parameter list
!/
INTEGER, INTENT(IN) :: NDSERR, NDSTST
!/
!/ ------------------------------------------------------------------- /
!/ Local parameters
!/
INTEGER :: I, NLOW, J
#ifdef W3_S
INTEGER, SAVE :: IENT = 0
#endif
CHARACTER(LEN=20) :: STRING
!/
#ifdef W3_S
CALL STRACE (IENT, 'W3NOUT')
#endif
!
! -------------------------------------------------------------------- /
! 1. Test input and module status
!
IF ( NGRIDS .EQ. -1 ) THEN
WRITE (NDSERR,1001) NGRIDS
CALL EXTCDE (1)
END IF
!
! -------------------------------------------------------------------- /
! 2. Set variable and allocate arrays
!
NLOW = MIN ( 0 , -NAUXGR )
ALLOCATE ( OUTPTS(NLOW:NGRIDS), STAT=ISTAT )
CHECK_ALLOC_STATUS ( ISTAT )
NOUTP = NGRIDS
!
! -------------------------------------------------------------------- /
! 3. Initialize parameters
!
DO I=NLOW, NGRIDS
!
OUTPTS(I)%NDSO = 6
OUTPTS(I)%NDSE = 6
OUTPTS(I)%NDST = 6
OUTPTS(I)%SCREEN = 6
!
OUTPTS(I)%NTPROC = 1
OUTPTS(I)%NAPROC = 1
OUTPTS(I)%IAPROC = 1
OUTPTS(I)%NAPLOG = 1
OUTPTS(I)%NAPOUT = 1
OUTPTS(I)%NAPERR = 1
OUTPTS(I)%NAPFLD = 1
OUTPTS(I)%NAPPNT = 1
OUTPTS(I)%NAPTRK = 1
OUTPTS(I)%NAPRST = 1
OUTPTS(I)%NAPBPT = 1
OUTPTS(I)%NAPPRT = 1
!
OUTPTS(I)%NOSWLL = -1
!
OUTPTS(I)%TBPI0 = (-1,0)
OUTPTS(I)%TBPIN = (-1,0)
!
OUTPTS(I)%OUT1%IPASS1 = 0
#ifdef W3_MPI
OUTPTS(I)%OUT1%NRQGO = 0
OUTPTS(I)%OUT1%NRQGO2 = 0
#endif
!
OUTPTS(I)%OUT2%IPASS2 = 0
OUTPTS(I)%OUT2%NOPTS = 0
OUTPTS(I)%OUT2%O2INIT = .FALSE.
#ifdef W3_MPI
OUTPTS(I)%OUT2%O2IRQI = .FALSE.
#endif
!
OUTPTS(I)%OUT3%IPASS3 = 0
OUTPTS(I)%OUT3%O3INIT = .FALSE.
OUTPTS(I)%OUT3%STOP = .FALSE.
#ifdef W3_MPI
OUTPTS(I)%OUT3%NRQTR = 0
#endif
!
OUTPTS(I)%OUT4%IFILE4 = 0
#ifdef W3_MPI
OUTPTS(I)%OUT4%NRQRS = 0
#endif
!
OUTPTS(I)%OUT5%O5INI1 = .FALSE.
OUTPTS(I)%OUT5%O5INI2 = .FALSE.
OUTPTS(I)%OUT5%O5INI3 = .FALSE.
OUTPTS(I)%OUT5%O5INI4 = .FALSE.
OUTPTS(I)%OUT5%FILER = .TRUE.
OUTPTS(I)%OUT5%FILEW = .TRUE.
OUTPTS(I)%OUT5%FILED = .TRUE.
!
OUTPTS(I)%OUT6%IPASS6 = 0
OUTPTS(I)%OUT6%O6INIT = .FALSE.
!
END DO
!
! Set IDOUT
! Commented outlines represent reserved slots.
!
DO I=1, NOGRP
DO J=1, NGRPP
IDOUT(I,J) = 'Undefined / Not Used'
END DO
END DO
!
! 1) Forcing fields
!
NOGE(1) = 9
#ifdef W3_BT4
NOGE(1) = 10
#endif
#ifdef W3_IS2
NOGE(1) = 12 ! CB
#endif
#ifdef W3_SETUP
NOGE(1) = 13 ! CB
#endif
!
IDOUT( 1, 1) = 'Water depth '
IDOUT( 1, 2) = 'Current vel. '
IDOUT( 1, 3) = 'Wind speed '
IDOUT( 1, 4) = 'Air-sea temp. dif. '
IDOUT( 1, 5) = 'Water level '
IDOUT( 1, 6) = 'Ice concentration '
IDOUT( 1, 7) = 'Iceberg damp coeffic'
IDOUT( 1, 8) = 'Atmospheric momentum'
IDOUT( 1, 9) = 'Air density '
#ifdef W3_BT4
IDOUT( 1, 10) = 'Sediment diam D50 '
#endif
#ifdef W3_IS2
IDOUT( 1, 11) = 'ice thickness '
IDOUT( 1, 12) = 'Avg. ice floe diam. '
#endif
#ifdef W3_SETUP
IDOUT( 1, 13) = 'wave induced setup'
#endif
!
! 2) Standard mean wave parameters
!
NOGE(2) = 19
#ifdef W3_OASOCM
NOGE(2) = 20
#endif
!
IDOUT( 2, 1) = 'Wave height '
IDOUT( 2, 2) = 'Mean wave length '
IDOUT( 2, 3) = 'Mean wave period(+2)'
IDOUT( 2, 4) = 'Mean wave period(-1)'
IDOUT( 2, 5) = 'Mean wave period(+1)'
IDOUT( 2, 6) = 'Peak frequency '
IDOUT( 2, 7) = 'Mean wave dir. a1b1 '
IDOUT( 2, 8) = 'Mean dir. spr. a1b1 '
IDOUT( 2, 9) = 'Peak direction '
IDOUT( 2, 10) = 'Infragravity height'
IDOUT( 2, 11) = 'Space-Time Max E '
IDOUT( 2, 12) = 'Space-Time Max Std '
IDOUT( 2, 13) = 'Space-Time Hmax '
IDOUT( 2, 14) = 'Spc-Time Hmax^crest'
IDOUT( 2, 15) = 'STD Space-Time Hmax'
IDOUT( 2, 16) = 'STD ST Hmax^crest '
IDOUT( 2, 17) = 'Dominant wave bT '
IDOUT( 2, 18) = 'Peak prd. (from fp)'
IDOUT( 2, 19) = 'Mean wave number '
#ifdef W3_OASOCM
IDOUT( 2, 20) = 'Mean wave dir. norot'
#endif
! IDOUT( 2,10) = 'Mean wave dir. a2b2'
! IDOUT( 2,11) = 'Mean dir. spr. a2b2'
! IDOUT( 2,12) = 'Windsea height(Sin)'
! IDOUT( 2,13) = 'Windsea peak f(Sin)'
! IDOUT( 2,14) = 'Subrange waveheight'
!
! 3) Frequency-dependent standard parameters
!
NOGE(3) = 6
!
IDOUT( 3, 1) = '1D Freq. Spectrum '
IDOUT( 3, 2) = 'Mean wave dir. a1b1 '
IDOUT( 3, 3) = 'Mean dir. spr. a1b1 '
IDOUT( 3, 4) = 'Mean wave dir. a2b2 '
IDOUT( 3, 5) = 'Mean dir. spr. a2b2 '
IDOUT( 3, 6) = 'Wavenumber array '
!
! 4) Spectral Partitions parameters
!
NOGE(4) = 17
!
IDOUT( 4, 1) = 'Part. wave height '
IDOUT( 4, 2) = 'Part. peak period '
IDOUT( 4, 3) = 'Part. peak wave len.'
IDOUT( 4, 4) = 'Part. mean direction'
IDOUT( 4, 5) = 'Part. dir. spread '
IDOUT( 4, 6) = 'Part. wind sea frac.'
IDOUT( 4, 7) = 'Part. peak direction'
IDOUT( 4, 8) = 'Part. peakedness '
IDOUT( 4, 9) = 'Part. peak enh. fac.'
IDOUT( 4,10) = 'Part. gaussian width'
IDOUT( 4,11) = 'Part. spectral width'
IDOUT( 4,12) = 'Part. mean per. (-1)'
IDOUT( 4,13) = 'Part. mean per. (+1)'
IDOUT( 4,14) = 'Part. mean per. (+2)'
IDOUT( 4,15) = 'Part. peak density '
IDOUT( 4,16) = 'Total wind sea frac.'
IDOUT( 4,17) = 'Number of partitions'
!
! 5) Atmosphere-waves layer
!
NOGE(5) = 11
!
IDOUT( 5, 1) = 'Friction velocity '
IDOUT( 5, 2) = 'Charnock parameter '
IDOUT( 5, 3) = 'Energy flux '
IDOUT( 5, 4) = 'Wind-wave enrgy flux'
IDOUT( 5, 5) = 'Wind-wave net mom. f'
IDOUT( 5, 6) = 'Wind-wave neg.mom.f.'
IDOUT( 5, 7) = 'Whitecap coverage '
IDOUT( 5, 8) = 'Whitecap mean thick.'
IDOUT( 5, 9) = 'Mean breaking height'
IDOUT( 5,10) = 'Dominant break prob '
IDOUT( 5,11) = 'Wind sea period' ! C.Bunney - reinstated this as is used in ww3_ounf
! Is it suposed to be defunct? It is not in ww3_outf...
!
! 6) Wave-ocean layer
!
NOGE(6) = 14
!
IDOUT( 6, 1) = 'Radiation stresses '
IDOUT( 6, 2) = 'Wave-ocean mom. flux'
IDOUT( 6, 3) = 'wave ind p Bern Head'
IDOUT( 6, 4) = 'Wave-ocean TKE flux'
IDOUT( 6, 5) = 'Stokes transport '
IDOUT( 6, 6) = 'Stokes drift at z=0 '
IDOUT( 6, 7) = '2nd order pressure '
IDOUT( 6, 8) = 'Stokes drft spectrum'
IDOUT( 6, 9) = '2nd ord press spectr'
IDOUT( 6,10) = 'Wave-ice mom. flux '
IDOUT( 6,11) = 'Wave-ice energy flux'
IDOUT( 6,12) = 'Split Surface Stokes'
IDOUT( 6,13) = 'Tot wav-ocn mom flux'
IDOUT( 6,14) = 'Stokes drift sfc ave'
!
! 7) Wave-bottom layer
!
NOGE(7) = 5
!
IDOUT( 7, 1) = 'Bottom rms ampl. '
IDOUT( 7, 2) = 'Bottom rms velocity '
IDOUT( 7, 3) = 'Bedform parameters '
IDOUT( 7, 4) = 'Energy diss. in WBBL'
IDOUT( 7, 5) = 'Moment. loss in WBBL'
! IDOUT( 7, 6) = 'Bottom mean period '
! IDOUT( 7, 7) = 'Bottom mean direct '
! IDOUT( 7, 8) = 'Bottom direct spread'
! IDOUT( 7, 9) = 'Calc grain rough K_N'
!
! 8) Spectrum parameters
!
NOGE(8) = 5
!
IDOUT( 8, 1) = 'Mean square slopes '
IDOUT( 8, 2) = 'Phillips tail const'
IDOUT( 8, 3) = 'Slope direction '
IDOUT( 8, 4) = 'Tail slope direction'
IDOUT( 8, 5) = 'Goda peakedness parm'
! IDOUT( 8, 3) = 'Lx-Ly mean wvlength'
! IDOUT( 8, 4) = 'Surf grad correl XT'
! IDOUT( 8, 5) = 'Surf grad correl YT'
! IDOUT( 8, 6) = 'Surf grad correl XY'
! IDOUT( 8, 7) = 'Surface crest param'
! IDOUT( 8, 3) = '3rd spectral moment '
! IDOUT( 8, 4) = '4th spectral moment '
! IDOUT( 8, 6) = 'Kurtosis '
! IDOUT( 8, 7) = 'Skewness '
!
! 9) Numerical diagnostics
!
NOGE(9) = 5
!
IDOUT( 9, 1) = 'Avg. time step. '
IDOUT( 9, 2) = 'Cut-off freq. '
IDOUT( 9, 3) = 'Maximum spatial CFL '
IDOUT( 9, 4) = 'Maximum angular CFL '
IDOUT( 9, 5) = 'Maximum k advect CFL'
! IDOUT( 9, 6) = 'Avg intrsp proptstep'
!
! 10) User defined
!
NOGE(10) = NOEXTR
!
DO I=1, MIN ( 20 , NOEXTR )
WRITE (STRING,'(A14,I2.2,A4)') 'User defined #', I, ' '
IDOUT(10, I) = STRING
END DO
!
#ifdef W3_T
WRITE (NDSTST,9000) NGRIDS
#endif
!
RETURN
!
! Formats
!
1001 FORMAT (/' *** ERROR W3NOUT : NGRIDS NOT YET SET *** '/ &
' NGRIDS = ',I10/ &
' RUN W3NMOD FIRST'/)
!
#ifdef W3_T
9000 FORMAT (' TEST W3NOUT : SETTING UP FOR ',I4,' GRIDS')
#endif
!/
!/ End of W3NOUT ----------------------------------------------------- /
!/
END SUBROUTINE W3NOUT
!/ ------------------------------------------------------------------- /
SUBROUTINE W3DMO2 ( IMOD, NDSE, NDST, NPT )
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 10-Dec-2014 |
!/ +-----------------------------------+
!/
!/ 10-Nov-2004 : Origination. ( version 3.06 )
!/ 24-Jul-2006 : Adding unified point output storage.( version 3.10 )
!/ 25-Jul-2006 : Originating grid ID for points. ( version 3.10 )
!/ 04-Oct-2006 : Add filter to array pointers. ( version 3.10 )
!/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
!/ (W. E. Rogers & T. J. Campbell, NRL)
!/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
!/
! 1. Purpose :
!
! Initialize an individual data storage for point output.
!
! 2. Method :
!
! Allocate directly into the structure array. Note that
! this cannot be done through the pointer alias!
!
! 3. Parameters :