WAVEWATCH III  beta 0.0.1
wmmdatmd.F90
Go to the documentation of this file.
1 
6 
7 #include "w3macros.h"
8 !
9 !/ ------------------------------------------------------------------- /
16 MODULE wmmdatmd
17  !/
18  !/ +-----------------------------------+
19  !/ | WAVEWATCH III NOAA/NCEP |
20  !/ | H. L. Tolman |
21  !/ | FORTRAN 90 |
22  !/ | Last update : 22-Mar-2021 |
23  !/ +-----------------------------------+
24  !/
25  !/ 13-Jun-2005 : Origination. ( version 3.07 )
26  !/ 16-Dec-2005 : Add staging of boundary data. ( version 3.08 )
27  !/ Add HGSTGE data. ( version 3.08 )
28  !/ 27-Jan-2006 : Adding static nests. ( version 3.08 )
29  !/ 24-Mar-2006 : Add EQSTGE data. ( version 3.09 )
30  !/ 25-May-2006 : Add STIME in BPSTGE. ( version 3.09 )
31  !/ 29-May-2006 : Adding overlapping grids. ( version 3.09 )
32  !/ Fixing boundary data (buffering).
33  !/ 18-Jul-2006 : Adding input grids. ( version 3.09 )
34  !/ 09-Aug-2006 : Adding unified point output. ( version 3.10 )
35  !/ 06-Oct-2006 : Adding separate input grids. ( version 3.10 )
36  !/ 12-Jan-2007 : Add FLSTI and FLLSTL. ( version 3.10 )
37  !/ 22-Jan-2007 : Add NAVMAX. ( version 3.10 )
38  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
39  !/ 03-Sep-2012 : Add clock parameters (init.). ( version 4.10 )
40  !/ 04-Feb-2014 : Switched to DATE_AND_TIME param. ( version 4.18 )
41  !/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
42  !/ 28-Sep-2016 : Adjust MTAG? values so that MPI tags used fit
43  !/ within allowed bounds. ( version 5.15 )
44  !/ 06-Jun-2018 : add subroutine INIT_GET_JSEA_ISPROC_GLOB/add PDLIB
45  !/ ( version 6.04 )
46  !/ 22-Mar-2021 : Support for air density input ( version 7.13 )
47  !/ 28-Oct-2021 : Add SMC grid group indicator. JGLi ( version 7.13 )
48  !/
49  !/ Copyright 2009-2012 National Weather Service (NWS),
50  !/ National Oceanic and Atmospheric Administration. All rights
51  !/ reserved. WAVEWATCH III is a trademark of the NWS.
52  !/ No unauthorized use without permission.
53  !/
54  ! 1. Purpose :
55  !
56  ! Define data structures to set up wave model dynamic data for
57  ! several models simultaneously.
58  !
59  ! 2. Variables and types :
60  !
61  ! Name Type Scope Description
62  ! ----------------------------------------------------------------
63  ! NMDATA Int. Public Number of models in array dim.
64  ! IMDATA Int. Public Selected model for output, init. at -1.
65  !
66  ! MDSI Int. Public Unit number for input file.
67  ! MDSO Int. Public Unit number for output (log file).
68  ! MDSS Int. Public Unit number for output (screen).
69  ! MDST Int. Public Unit number for test output.
70  ! MDSE Int. Public Unit number for error output.
71  ! These outputs correspond to similar
72  ! unit numbers as defined per grid, but
73  ! are used for multi-grid routines
74  ! only.
75  ! MDSP Int. Public Unit number for profiling.
76  ! MDSUP Int. Public Unit number for unified point output.
77  ! MDSUPA Int. Public Unit number for unified point output.
78  ! ASCII
79  ! MDSF I.A. Public Unit numbers for input files.
80  !
81  ! NMPROC Int. Public Number of processors (for total multi-
82  ! grid model).
83  ! IMPROC Int. Public Corresponding actual processor number.
84  ! NMPLOG, NMPSCR, NMPTST, NMPERR, NMPUPT
85  ! Int. Public Processors in NMPROC designated for
86  ! the above output units numbers.
87  !
88  ! STIME I.A. Public Model run starting time.
89  ! ETIME I.A. Public Model run ending time.
90  ! TSYNC I.A. Public Synchronization time for grids.
91  ! TMAX I.A. Public Maximum next time per grid.
92  ! TOUTP I.A. Public Next output time for grids.
93  ! TDATA I.A. Public Time for which data is available.
94  !
95  ! NRGRD Int. Public Number of grids.
96  ! NRINP Int. Public Number of input grids.
97  ! NRGRP Int. Public Number of groups.
98  ! NGRPSMC Int. Public SMC grid group number, one of 0:NRGRP.
99  ! NMVMAX Int. Public Number of moving grid data.
100  ! GRANK I.A. Public Rank number for grid.
101  ! GRGRP I.A. Public Group number for grid.
102  ! INGRP I.A. Public Grids in group, element 0 is number.
103  ! GRDHGH, GRDEQL, GRDLOW
104  ! I.A. Public Dependent grids with higher, same or
105  ! lower rank number, element 0 is number.
106  ! ALLPRC I.A. Public Map of processors in MPI_COMM_MWAVE for
107  ! all individual grids.
108  ! MODMAP I.A. Public Map which model is running where in
109  ! MPI_COMM_MWAVE each group.
110  ! GRSTAT I.A. Public Grid computation status indicator.
111  ! DTRES R.A. Public Residual of time step.
112  ! NBI2G I.A. Public Map cross-referencing how many spectra
113  ! echo grid provides to boundary cond. for
114  ! other grids.
115  ! RESPEC L.A. Public Map for need to convert spectra between
116  ! grids.
117  ! BCDUMP L.A. Public Flag for dumping internal bound. data.
118  ! INPMAP I.A. Public Map for expternal input grids.
119  ! IDINP C.A. Public Input field identifiers.
120  !
121  ! CLKDT1, CLKDT2, CLKDT3, CLKFIN
122  ! Int. Public Global wall clock parameters,
123  !
124  ! MPI_COMM_MWAVE
125  ! Int. Public MPI communicator. ( !/MPI )
126  ! MTAGn Int. Public "Zero" tag number for MPI ( !/MPI )
127  ! MTAG_UB Int. Public Upper-bound for MPI tags ( !/MPI )
128  ! NBISTA I.A. Public Status for gathering input boundary
129  ! data. ( !/MPI )
130  ! HGHSTA I.A. Public Status for gathering high resolution
131  ! data. ( !/MPI )
132  ! EQLSTA I.A. Public Status for gathering data fro equally
133  ! ranked grids. ( !/MPI )
134  !
135  ! FLGBDI Log. Public Flag for intitialization of boundry
136  ! distance maps.
137  ! FLGHGn Log. Public Flags for using mask for computations
138  ! and output for areas of grid overlap.
139  ! IFLSTI L.A. Public FLags for last ice per grid.
140  ! IFLSTL L.A. Public FLags for last level per grid.
141  ! IFLSTR L.A. Public FLags for last air density per grid.
142  !
143  ! MDATA TYPE Public Data structure for grid dependent data.
144  ! MDATAS MDATA Public Array of data structures.
145  !
146  ! BPST TYPE Public Data structure for staging boundary
147  ! data.
148  ! BPSTGE BPST Public Array of data structures.
149  !
150  ! HGST TYPE Public Data structure for staging 2-way
151  ! nesting data.
152  ! HGSTGE HGST Public Array of data structures.
153  !
154  ! EQST TYPE Public Data structure for staging equal grid
155  ! reconcilliation data.
156  ! EQSTGE EQST Public Array of data structures.
157  ! ----------------------------------------------------------------
158  !
159  ! All elements of MDATA are aliased to pointers with the same
160  ! name. These pointers are defined as :
161  !
162  ! Name Type Scope Description
163  ! ----------------------------------------------------------------
164  ! NBI2S I.A. Public Source information of boundary input
165  ! data (grid number and sea counter).
166  ! MAPBDI R.A. Public Map with distances to boundary.
167  ! MAPODI R.A. Public idem, open edges of grids.
168  ! NRUPTS Int. Public Number of unified output points.
169  ! UPTMAP I.A. Public Mapping of unified points to grids.
170  ! MAPMSK I.A. Public Mask corresponding to FLGHGn above.
171  ! MINIT, MSKINI, FLDATn
172  ! Log. Public Flags for array initializations.
173  ! FLLSTI Log. Public FLag for last ice per grid.
174  ! FLLSTL Log. Public FLag for last level per grid.
175  ! FLLSTR Log. Public FLag for last air density per grid.
176  !
177  ! NMV Int. Public Number of moving grid data.
178  ! TMV I.A. Public Moving grid times.
179  ! AMV R.A. Public Moving grid velocities.
180  ! DMV R.A. Public Moving grid directions.
181  !
182  ! RCLD I.A. Public Record length for data assimilation.
183  ! NDT I.A. Public Number of data for data assimilation.
184  ! DATAn R.A. Public Assimilation data.
185  !
186  ! MPI_COMM_GRD Int. Public Communicator for grid ( !/MPI )
187  ! MPI_COMM_BCT Int. Public Communicator for broadcast ( !/MPI )
188  ! CROOT Int. Public "root" for MPI_COMM_GRD in
189  ! MPI_COMM_MWAVE ( !/MPI )
190  ! FBCAST Log. Public FLag for need of broadcasting data
191  ! to processors that are not in the
192  ! communicator ( !/MPI )
193  ! NRQBPG Int. Public Number of request handles ( !/MPI )
194  ! IRQBPG I.A. Public Request handles. ( !/MPI )
195  ! NRQHGG Int. Public Number of request handles ( !/MPI )
196  ! IRQHGG I.A. Public Request handles. ( !/MPI )
197  ! NRQEQG Int. Public Number of request handles ( !/MPI )
198  ! IRQEQG I.A. Public Request handles. ( !/MPI )
199  ! ----------------------------------------------------------------
200  !
201  ! Elements of the structure BPTS are
202  !
203  ! Name Type Scope Description
204  ! ----------------------------------------------------------------
205  ! NRQBPS Int. Public Number of request handles ( !/MPI )
206  ! IRQBPS I.A. Public Request handles. ( !/MPI )
207  ! VTIME I.A. Public Valid time of data.
208  ! STIME I.A. Public Buffer for time for sending. ( !/MPI )
209  ! SBPI R.A. Public Spectral data storage.
210  ! TSTORE R.A. Public Spectral data buffer. ( !/MPI )
211  ! INIT Log. Public Flag for array allocation.
212  ! ----------------------------------------------------------------
213  !
214  ! Elements of the structure HGST are
215  !
216  ! Name Type Scope Description
217  ! ----------------------------------------------------------------
218  ! NRQHGS Int. Public Number of request handles ( !/MPI )
219  ! IRQHGS I.A. Public Request handles. ( !/MPI )
220  ! NRQOUT Int. Public Number of local spectra. ( !/MPI )
221  ! OUTDAT I.A. Public Corresponding data. ( !/MPI )
222  ! NTOT, NREC, NRC1, NSND, NSN1, NSMX
223  ! Int. Public Counters for total data, send and
224  ! received data with and without
225  ! masking.
226  ! VTIME I.A. Public Valid time of data.
227  ! LJSEA I.A. Public Local sea point counters.
228  ! NRAVG I.A. Public Number of points in averaging.
229  ! IMPSRC I.A. Public Source processor for data,
230  ! ITAG I.A. Public Communication tag.
231  ! ISEND I.A. Public Composite of all deta needed for send.
232  ! WGHT R.A. Public Weihts in averaging.
233  ! SHGH R.A. Public Staging area for spectra.
234  ! TSTORE R.A. Public Staging area for spectra to be send
235  ! out ( !/MPI )
236  ! INIT Log. Public Flag for array allocation.
237  ! ----------------------------------------------------------------
238  !
239  ! Elements of the structure EQST are
240  !
241  ! Name Type Scope Description
242  ! ----------------------------------------------------------------
243  ! NRQEQS Int. Public Number of request handles ( !/MPI )
244  ! IRQEQS I.A. Public Request handles. ( !/MPI )
245  ! NRQOUT Int. Public Number of local spectra. ( !/MPI )
246  ! OUTDAT I.A. Public Corresponding data. ( !/MPI )
247  ! NTOT, NREC, NSND, NAVMAX
248  ! Int. Public Counters for total data, send and
249  ! received data.
250  ! VTIME I.A. Public Valid time of data.
251  ! I/JSEA I.A. Public Sea point counters.
252  ! NAVG I.A. Public Number of spectra in averaging.
253  ! RIP I.A. Public Processor (receiving).
254  ! RTG I.A. Public Tag number (receiving).
255  ! SIS,SJS I.A. Public Sea point counter (sending).
256  ! SI1/2 I.A. Public Storage array counters (sending).
257  ! SIP I.A. Public Processor (sending).
258  ! STG I.A. Public Tag (sending).
259  ! SEQL R.A. Public Staging array.
260  ! WGHT R.A. Public Weight between grids.
261  ! WAVG R.A. Public Weight within grid.
262  ! TSTORE R.A. Public Staging area for spectra to be send
263  ! out ( !/MPI )
264  ! INIT Log. Public Flag for array allocation.
265  ! ----------------------------------------------------------------
266  !
267  ! 3. Subroutines and functions :
268  !
269  ! Name Type Scope Description
270  ! ----------------------------------------------------------------
271  ! WMNDAT Subr. Public Set number of grids/models.
272  ! WMDIMD Subr. Public Set dimensions of arrays (data).
273  ! WMDIMM Subr. Public Set dimensions of arrays.
274  ! WMSETM Subr. Public Point to selected grid / model.
275  ! ----------------------------------------------------------------
276  !
277  ! 4. Subroutines and functions used :
278  !
279  ! Name Type Module Description
280  ! ----------------------------------------------------------------
281  ! W3SETG Subr. W3GDATMD Point to proper model grid.
282  ! STRACE Subr. W3SERVMD Subroutine tracing.
283  ! EXTCDE Subr. Id. Abort program with exit code.
284  ! ----------------------------------------------------------------
285  !
286  ! 5. Remarks :
287  !
288  ! - The number of grids is taken from W3GDATMD, and needs to be
289  ! set first with W3DIMG.
290  !
291  ! 6. Switches :
292  !
293  ! !/S Enable subroutine tracing.
294  ! !/T Enable test output
295  !
296  ! 7. Source code :
297  !
298  !/ ------------------------------------------------------------------- /
299  !/
300  !/ Specify default accessibility
301  !/
302  PUBLIC
303  !/
304  !/ Module private variable for checking error returns
305  !/
306  INTEGER, PRIVATE :: ISTAT
307  !/
308  !/ Conventional declarations
309  !/
310  INTEGER :: nmdata = -1
311  INTEGER :: imdata = -1
312  INTEGER :: mdsi = 8
313  INTEGER :: mdso = 9
314  INTEGER :: mdss = 6
315  INTEGER :: mdst = 6
316  INTEGER :: mdse = 6
317  INTEGER :: mdsup
318 #ifdef W3_ASCII
319  INTEGER :: mdsupa
320 #endif
321  INTEGER :: nmproc = 1
322  INTEGER :: improc = 1
323  INTEGER :: nmplog = 1
324  INTEGER :: nmpscr = 1
325  INTEGER :: nmptst = 1
326  INTEGER :: nmperr = 1
327  INTEGER :: nmpupt = 1
328  INTEGER :: stime(2)
329  INTEGER :: etime(2)
330  INTEGER :: nrgrd
331  INTEGER :: nrinp
332  INTEGER :: nrgrp
333  INTEGER :: nmvmax
334  INTEGER :: ngrpsmc
335 
336  INTEGER :: clkdt1(8)
337  INTEGER :: clkdt2(8)
338  INTEGER :: clkdt3(8)
339 
340 #ifdef W3_MPRF
341  INTEGER :: mdsp
342 #endif
343 #ifdef W3_MPI
344  INTEGER :: mpi_comm_mwave
345  INTEGER, PARAMETER :: mtagb = 0
346  INTEGER, PARAMETER :: mtag0 = 1000
347  INTEGER, PARAMETER :: mtag1 = 40000
348  INTEGER, PARAMETER :: mtag2 = 1000000
349  INTEGER, PARAMETER :: mtag_ub = 2**21-1
350 #endif
351 
352  INTEGER, ALLOCATABLE :: mdsf(:,:)
353  INTEGER, ALLOCATABLE :: grank(:)
354  INTEGER, ALLOCATABLE :: grgrp(:)
355  INTEGER, ALLOCATABLE :: ingrp(:,:)
356  INTEGER, ALLOCATABLE :: grdhgh(:,:)
357  INTEGER, ALLOCATABLE :: grdeql(:,:)
358 
359  INTEGER, ALLOCATABLE :: grdlow(:,:)
360  INTEGER, ALLOCATABLE :: allprc(:,:)
361  INTEGER, ALLOCATABLE :: modmap(:,:)
362  INTEGER, ALLOCATABLE :: tsync(:,:)
363  INTEGER, ALLOCATABLE :: tmax(:,:)
364  INTEGER, ALLOCATABLE :: toutp(:,:)
365  INTEGER, ALLOCATABLE :: tdata(:,:)
366  INTEGER, ALLOCATABLE :: grstat(:)
367  INTEGER, ALLOCATABLE :: nbi2g(:,:)
368  INTEGER, ALLOCATABLE :: inpmap(:,:)
369 
370 #ifdef W3_MPI
371  INTEGER, ALLOCATABLE :: nbista(:)
372  INTEGER, ALLOCATABLE :: hghsta(:)
373  INTEGER, ALLOCATABLE :: eqlsta(:)
374 #endif
375 
376  REAL :: clkfin
377  REAL, ALLOCATABLE :: dtres(:)
378  LOGICAL :: flgbdi=.false.
379  LOGICAL :: flghg1
380  LOGICAL :: flghg2
381  LOGICAL, ALLOCATABLE :: respec(:,:)
382  LOGICAL, ALLOCATABLE :: bcdump(:)
383  LOGICAL, ALLOCATABLE :: iflsti(:)
384  LOGICAL, ALLOCATABLE :: iflstl(:)
385  LOGICAL, ALLOCATABLE :: iflstr(:)
386  CHARACTER(LEN=3), ALLOCATABLE :: idinp(:,:)
387  !/
388  !/ Data structures
389  !/
390  TYPE mdata
391  INTEGER :: rcld(3)
392  INTEGER :: ndt(3)
393  INTEGER :: nmv
394  INTEGER :: nrupts
395 
396 #ifdef W3_MPI
397  INTEGER :: mpi_comm_grd
398  INTEGER :: mpi_comm_bct
399  INTEGER :: croot
400  INTEGER :: nrqbpg
401  INTEGER :: nrqhgg
402  INTEGER :: nrqeqg
403 #endif
404  INTEGER, POINTER :: tmv(:,:,:)
405  INTEGER, POINTER :: nbi2s(:,:)
406  INTEGER, POINTER :: mapmsk(:,:)
407  INTEGER, POINTER :: uptmap(:)
408 
409 #ifdef W3_MPI
410  INTEGER, POINTER :: irqbpg(:)
411  INTEGER, POINTER :: irqhgg(:)
412  INTEGER, POINTER :: irqeqg(:)
413 #endif
414  REAL, POINTER :: data0(:,:)
415  REAL, POINTER :: data1(:,:)
416  REAL, POINTER :: data2(:,:)
417  REAL, POINTER :: amv(:,:)
418  REAL, POINTER :: dmv(:,:)
419 
420  REAL, POINTER :: mapbdi(:,:)
421  REAL, POINTER :: mapodi(:,:)
422 #ifdef W3_PDLIB
423  INTEGER, POINTER :: sea_ipgl(:)
424  INTEGER, POINTER :: sea_ipgl_to_proc(:)
425 #endif
426  LOGICAL :: minit
427  LOGICAL :: mskini
428  LOGICAL :: fllstl
429  LOGICAL :: fllstr
430  LOGICAL :: fllsti
431  LOGICAL :: fldat0
432  LOGICAL :: fldat1
433  LOGICAL :: fldat2
434 
435 #ifdef W3_MPI
436  LOGICAL :: fbcast
437 #endif
438  END TYPE mdata
439 
440  !
441 
442  TYPE bpst
443 #ifdef W3_MPI
444  INTEGER :: nrqbps
445  INTEGER :: stime(2)
446 #endif
447  INTEGER :: vtime(2)
448 #ifdef W3_MPI
449  INTEGER, POINTER :: irqbps(:)
450 #endif
451  REAL, POINTER :: sbpi(:,:)
452 #ifdef W3_MPI
453  REAL, POINTER :: tstore(:,:)
454 #endif
455  LOGICAL :: init
456  END TYPE bpst
457  !
458  TYPE hgst
459  INTEGER :: vtime(2)
460  INTEGER :: ntot
461  INTEGER :: nrec
462  INTEGER :: nrc1
463  INTEGER :: nsnd
464  INTEGER :: nsn1
465  INTEGER :: nsmx
466  INTEGER :: xtime(2)
467 
468 #ifdef W3_MPI
469  INTEGER :: nrqhgs
470  INTEGER :: nrqout
471 #endif
472  INTEGER, POINTER :: ljsea(:)
473  INTEGER, POINTER :: nravg(:)
474  INTEGER, POINTER :: impsrc(:,:)
475  INTEGER, POINTER :: itag(:,:)
476  INTEGER, POINTER :: isend(:,:)
477 #ifdef W3_MPI
478  INTEGER, POINTER :: irqhgs(:)
479  INTEGER, POINTER :: outdat(:,:)
480 #endif
481  REAL, POINTER :: wgth(:,:)
482  REAL, POINTER :: shgh(:,:,:)
483 #ifdef W3_MPI
484  REAL, POINTER :: tstore(:,:)
485 #endif
486  LOGICAL :: init
487  END TYPE hgst
488 
489  !
490 
491  TYPE eqst
492  INTEGER :: vtime(2)
493  INTEGER :: ntot
494  INTEGER :: nrec
495  INTEGER :: nsnd
496  INTEGER :: navmax
497 #ifdef W3_MPI
498  INTEGER :: nrqeqs
499  INTEGER :: nrqout
500 #endif
501  INTEGER, POINTER :: isea(:)
502  INTEGER, POINTER :: jsea(:)
503  INTEGER, POINTER :: navg(:)
504  INTEGER, POINTER :: rip(:,:)
505  INTEGER, POINTER :: rtg(:,:)
506  INTEGER, POINTER :: sis(:)
507  INTEGER, POINTER :: sjs(:)
508  INTEGER, POINTER :: si1(:)
509  INTEGER, POINTER :: si2(:)
510  INTEGER, POINTER :: sip(:)
511  INTEGER, POINTER :: stg(:)
512 
513 #ifdef W3_MPI
514  INTEGER, POINTER :: irqeqs(:)
515  INTEGER, POINTER :: outdat(:,:)
516 #endif
517  REAL, POINTER :: seql(:,:,:)
518  REAL, POINTER :: wght(:)
519  REAL, POINTER :: wavg(:,:)
520 #ifdef W3_MPI
521  REAL, POINTER :: tstore(:,:)
522 #endif
523  LOGICAL :: init
524  END TYPE eqst
525  !/
526  !/ Data storage
527  !/
528  TYPE(mdata), TARGET, ALLOCATABLE :: mdatas(:)
529  TYPE(bpst), TARGET, ALLOCATABLE :: bpstge(:,:)
530  TYPE(hgst), TARGET, ALLOCATABLE :: hgstge(:,:)
531  TYPE(eqst), TARGET, ALLOCATABLE :: eqstge(:,:)
532  !/
533  !/ Data aliasses for structure MDATA(S)
534  !/
535  INTEGER, POINTER :: rcld(:)
536  INTEGER, POINTER :: ndt(:)
537  INTEGER, POINTER :: nmv
538  INTEGER, POINTER :: tmv(:,:,:)
539  INTEGER, POINTER :: nbi2s(:,:)
540  INTEGER, POINTER :: mapmsk(:,:)
541  INTEGER, POINTER :: uptmap(:)
542 #ifdef W3_MPI
543  INTEGER, POINTER :: mpi_comm_grd
544  INTEGER, POINTER :: mpi_comm_bct
545  INTEGER, POINTER :: croot
546 #endif
547  REAL, POINTER :: data0(:,:)
548  REAL, POINTER :: data1(:,:)
549  REAL, POINTER :: data2(:,:)
550  REAL, POINTER :: amv(:,:)
551  REAL, POINTER :: dmv(:,:)
552 
553  REAL, POINTER :: mapbdi(:,:)
554  REAL, POINTER :: mapodi(:,:)
555 #ifdef W3_PDLIB
556  INTEGER, POINTER :: sea_ipgl(:)
557  INTEGER, POINTER :: sea_ipgl_to_proc(:)
558 #endif
559  LOGICAL, POINTER :: minit
560  LOGICAL, POINTER :: fllstl
561  LOGICAL, POINTER :: fllstr
562  LOGICAL, POINTER :: fllsti
563  LOGICAL, POINTER :: fldat0
564  LOGICAL, POINTER :: fldat1
565  LOGICAL, POINTER :: fldat2
566 
567 #ifdef W3_MPI
568  LOGICAL, POINTER :: fbcast
569 #endif
570  !/
571 CONTAINS
572  !/ ------------------------------------------------------------------- /
583  SUBROUTINE wmndat ( NDSE, NDST )
584  !/
585  !/ +-----------------------------------+
586  !/ | WAVEWATCH III NOAA/NCEP |
587  !/ | H. L. Tolman |
588  !/ | FORTRAN 90 |
589  !/ | Last update : 22-Mar-2021 !
590  !/ +-----------------------------------+
591  !/
592  !/ 22-Feb-2005 : Origination. ( version 3.07 )
593  !/ 16-Dec-2005 : Add staging of boundary data. ( version 3.08 )
594  !/ Add HGSTGE data. ( version 3.08 )
595  !/ 24-Mar-2006 : Add EQSTGE data. ( version 3.09 )
596  !/ 25-May-2006 : Add STIME in BPSTGE. ( version 3.09 )
597  !/ 12-Jan-2007 : Add FLSTI and FLLSTL. ( version 3.10 )
598  !/ 22-Jan-2007 : Add NAVMAX. ( version 3.10 )
599  !/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
600  !/ 22-Mar-2021 : Support for air density input ( version 7.13 )
601  !/
602  ! 1. Purpose :
603  !
604  ! Set up the number of grids to be used.
605  !
606  ! 2. Method :
607  !
608  ! Use data stored in NGRIDS in W3GDATMD.
609  !
610  ! 3. Parameters :
611  !
612  ! Parameter list
613  ! ----------------------------------------------------------------
614  ! NDSE Int. I Error output unit number.
615  ! NDST Int. I Test output unit number.
616  ! ----------------------------------------------------------------
617  !
618  ! 4. Subroutines used :
619  !
620  ! See module documentation.
621  !
622  ! 5. Called by :
623  !
624  ! Any program that uses this grid structure.
625  !
626  ! 6. Error messages :
627  !
628  ! - Error checks on previous setting of variable NGRIDS.
629  !
630  ! 7. Remarks :
631  !
632  ! 8. Structure :
633  !
634  ! 9. Switches :
635  !
636  ! !/S Enable subroutine tracing.
637  ! !/T Enable test output
638  !
639  ! 10. Source code :
640  !
641  !/ ------------------------------------------------------------------- /
642  USE w3gdatmd, ONLY: ngrids
643  USE w3servmd, ONLY: extcde
644 #ifdef W3_S
645  USE w3servmd, ONLY: strace
646 #endif
647  !
648  IMPLICIT NONE
649  !/
650  !/ ------------------------------------------------------------------- /
651  !/ Parameter list
652  !/
653  INTEGER, INTENT(IN) :: NDSE, NDST
654  !/
655  !/ ------------------------------------------------------------------- /
656  !/ Local parameters
657  !/
658  INTEGER :: I, J
659 #ifdef W3_S
660  INTEGER, SAVE :: IENT = 0
661 #endif
662  !/
663 #ifdef W3_S
664  CALL strace (ient, 'WMNDAT')
665 #endif
666  !
667  ! -------------------------------------------------------------------- /
668  ! 1. Test input and module status
669  !
670  IF ( ngrids .EQ. -1 ) THEN
671  WRITE (ndse,1001) ngrids
672  CALL extcde (1)
673  END IF
674  !
675  ! -------------------------------------------------------------------- /
676  ! 2. Set variable and allocate arrays
677  !
678  ALLOCATE ( mdatas(ngrids), bpstge(ngrids,ngrids), &
681  iflstr(nrinp), stat=istat )
682  check_alloc_status( istat )
683 #ifdef W3_MPI
684  ALLOCATE ( nbista(ngrids), hghsta(ngrids), eqlsta(ngrids), &
685  stat=istat )
686  check_alloc_status( istat )
687 #endif
688  nmdata = ngrids
689  !
690  ! -------------------------------------------------------------------- /
691  ! 3. Initialize parameters
692  !
693 #ifdef W3_MPI
694  nbista = 0
695  hghsta = 0
696  eqlsta = 0
697 #endif
698  !
699  iflsti = .false.
700  iflstl = .false.
701  iflstr = .false.
702  !
703  DO i=1, ngrids
704  mdatas(i)%MINIT = .false.
705  mdatas(i)%MSKINI = .false.
706  mdatas(i)%FLDAT0 = .false.
707  mdatas(i)%FLDAT1 = .false.
708  mdatas(i)%FLDAT2 = .false.
709 #ifdef W3_MPI
710  mdatas(i)%MPI_COMM_GRD = -99
711  mdatas(i)%MPI_COMM_BCT = -99
712 #endif
713  DO j=1, ngrids
714  bpstge(i,j)%VTIME(1) = -1
715  bpstge(i,j)%VTIME(2) = 0
716 #ifdef W3_MPI
717  bpstge(i,j)%STIME(1) = -1
718  bpstge(i,j)%STIME(2) = 0
719 #endif
720  bpstge(i,j)%INIT = .false.
721 #ifdef W3_MPI
722  bpstge(i,j)%NRQBPS = 0
723 #endif
724  hgstge(i,j)%VTIME(1) = -1
725  hgstge(i,j)%VTIME(2) = 0
726  hgstge(i,j)%XTIME(1) = -1
727  hgstge(i,j)%XTIME(2) = 0
728  hgstge(i,j)%NTOT = 0
729  hgstge(i,j)%NREC = 0
730  hgstge(i,j)%NRC1 = 0
731  hgstge(i,j)%NSND = 0
732  hgstge(i,j)%NSN1 = 0
733  hgstge(i,j)%NSMX = 0
734 #ifdef W3_MPI
735  hgstge(i,j)%NRQHGS = 0
736  hgstge(i,j)%NRQOUT = 0
737 #endif
738  hgstge(i,j)%INIT = .false.
739  eqstge(i,j)%VTIME(1) = -1
740  eqstge(i,j)%VTIME(2) = 0
741  eqstge(i,j)%NTOT = 0
742  eqstge(i,j)%NREC = 0
743  eqstge(i,j)%NSND = 0
744  eqstge(i,j)%NAVMAX = 1
745 #ifdef W3_MPI
746  eqstge(i,j)%NRQEQS = 0
747  eqstge(i,j)%NRQOUT = 0
748 #endif
749  eqstge(i,j)%INIT = .false.
750  END DO
751  END DO
752  !
753 #ifdef W3_T
754  WRITE (ndst,9000) ngrids
755 #endif
756  !
757  RETURN
758  !
759  ! Formats
760  !
761 1001 FORMAT (/' *** ERROR WMNDAT : NGRIDS NOT YET SET *** '/ &
762  ' NGRIDS = ',i10/ &
763  ' RUN W3NMOD FIRST'/)
764  !
765 #ifdef W3_T
766 9000 FORMAT (' TEST WMNDAT : SETTING UP FOR ',i4,' GRIDS')
767 #endif
768  !/
769  !/ End of WMNDAT ----------------------------------------------------- /
770  !/
771  END SUBROUTINE wmndat
772  !/ ------------------------------------------------------------------- /
786  SUBROUTINE wmdimd ( IMOD, NDSE, NDST, J )
787  !/
788  !/ +-----------------------------------+
789  !/ | WAVEWATCH III NOAA/NCEP |
790  !/ | H. L. Tolman |
791  !/ | FORTRAN 90 |
792  !/ | Last update : 10-Dec-2014 !
793  !/ +-----------------------------------+
794  !/
795  !/ 22-Feb-2005 : Origination. ( version 3.07 )
796  !/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 )
797  !/
798  ! 1. Purpose :
799  !
800  ! Initialize an individual data grid at the proper dimensions.
801  !
802  ! 2. Method :
803  !
804  ! Allocate directly into the structure array. Note that
805  ! this cannot be done through the pointer alias!
806  !
807  ! 3. Parameters :
808  !
809  ! Parameter list
810  ! ----------------------------------------------------------------
811  ! IMOD Int. I Model number to point to.
812  ! NDSE Int. I Error output unit number.
813  ! NDST Int. I Test output unit number.
814  ! J Int. I Data set [1,2,3].
815  ! ----------------------------------------------------------------
816  !
817  ! 4. Subroutines used :
818  !
819  ! See module documentation.
820  !
821  ! 5. Called by :
822  !
823  ! Name Type Module Description
824  ! ----------------------------------------------------------------
825  ! ----------------------------------------------------------------
826  !
827  ! 6. Error messages :
828  !
829  ! - Check on input parameters.
830  ! - Check on previous allocation.
831  !
832  ! 7. Remarks :
833  !
834  ! - WMSETM needs to be called after allocation to point to
835  ! proper allocated arrays.
836  !
837  ! 8. Structure :
838  !
839  ! See source code.
840  !
841  ! 9. Switches :
842  !
843  ! !/S Enable subroutine tracing.
844  ! !/T Enable test output
845  !
846  ! 10. Source code :
847  !
848  !/ ------------------------------------------------------------------- /
849  USE w3gdatmd, ONLY: ngrids, igrid, w3setg
850  USE w3odatmd, ONLY: naproc
851  USE w3servmd, ONLY: extcde
852 #ifdef W3_S
853  USE w3servmd, ONLY: strace
854 #endif
855  !
856  IMPLICIT NONE
857  !
858  !/
859  !/ ------------------------------------------------------------------- /
860  !/ Parameter list
861  !/
862  INTEGER, INTENT(IN) :: IMOD, NDSE, NDST, J
863  !/
864  !/ ------------------------------------------------------------------- /
865  !/ Local parameters
866  !/
867  INTEGER :: JGRID
868 #ifdef W3_S
869  INTEGER, SAVE :: IENT = 0
870 #endif
871  !/
872 #ifdef W3_S
873  CALL strace (ient, 'WMDIMD')
874 #endif
875  !
876  ! -------------------------------------------------------------------- /
877  ! 1. Test input and module status
878  !
879  IF ( ngrids .EQ. -1 ) THEN
880  WRITE (ndse,1001)
881  CALL extcde (1)
882  END IF
883  !
884  IF ( imod.LT.1 .OR. imod.GT.nmdata ) THEN
885  WRITE (ndse,1002) imod, nmdata
886  CALL extcde (2)
887  END IF
888  !
889  IF ( mdatas(imod)%MINIT ) THEN
890  WRITE (ndse,1003)
891  CALL extcde (3)
892  END IF
893  !
894 #ifdef W3_T
895  WRITE (ndst,9000) imod
896 #endif
897  !
898  jgrid = igrid
899  IF ( jgrid .NE. imod ) CALL w3setg ( imod, ndse, ndst )
900  !
901  ! -------------------------------------------------------------------- /
902  ! 2. Allocate arrays
903  !
904  IF ( j .EQ. 0 ) THEN
905  ALLOCATE ( mdatas(imod)%TMV(2,-7:4,nmv) , &
906  mdatas(imod)%AMV(nmv,-7:4) , &
907  mdatas(imod)%DMV(nmv,-7:4) , stat=istat )
908  check_alloc_status( istat )
909  END IF
910  !
911  IF ( j .EQ. 1 ) THEN
912  IF ( fldat0 ) DEALLOCATE ( mdatas(imod)%DATA0 )
913  ALLOCATE ( mdatas(imod)%DATA0(rcld(j),ndt(j)), stat=istat )
914  check_alloc_status( istat )
915  fldat0 = .true.
916  END IF
917  !
918  IF ( j .EQ. 2 ) THEN
919  IF ( fldat1 ) DEALLOCATE ( mdatas(imod)%DATA1 )
920  ALLOCATE ( mdatas(imod)%DATA1(rcld(j),ndt(j)), stat=istat )
921  check_alloc_status( istat )
922  fldat1 = .true.
923  END IF
924  !
925  IF ( j .EQ. 3 ) THEN
926  IF ( fldat2 ) DEALLOCATE ( mdatas(imod)%DATA2 )
927  ALLOCATE ( mdatas(imod)%DATA2(rcld(j),ndt(j)), stat=istat )
928  check_alloc_status( istat )
929  fldat2 = .true.
930  END IF
931  !
932 #ifdef W3_T
933  WRITE (ndst,9001)
934 #endif
935  !
936  ! -------------------------------------------------------------------- /
937  ! 3. Point to allocated arrays
938  !
939  CALL wmsetm ( imod, ndse, ndst )
940  !
941  IF ( j .EQ. 0 ) THEN
942  tmv = 0
943  amv = 0.
944  dmv = 0.
945  END IF
946  !
947 #ifdef W3_T
948  WRITE (ndst,9002)
949 #endif
950  !
951  ! -------------------------------------------------------------------- /
952  ! 5. Restore previous grid setting if necessary
953  !
954  IF ( jgrid .NE. imod ) CALL w3setg ( jgrid, ndse, ndst )
955  !
956  RETURN
957  !
958  ! Formats
959  !
960 1001 FORMAT (/' *** ERROR WMDIMD : GRIDS NOT INITIALIZED *** '/ &
961  ' RUN W3NMOD FIRST '/)
962 1002 FORMAT (/' *** ERROR WMDIMD : ILLEGAL MODEL NUMBER *** '/ &
963  ' IMOD = ',i10/ &
964  ' NMDATA = ',i10/)
965 1003 FORMAT (/' *** ERROR WMDIMD : ARRAY(S) ALREADY ALLOCATED *** ')
966  !
967 #ifdef W3_T
968 9000 FORMAT (' TEST WMDIMD : MODEL ',i4,' DIM. AT ',2i5,i7)
969 9001 FORMAT (' TEST WMDIMD : ARRAYS ALLOCATED')
970 9002 FORMAT (' TEST WMDIMD : POINTERS RESET')
971 #endif
972  !/
973  !/ End of WMDIMD ----------------------------------------------------- /
974  !/
975  END SUBROUTINE wmdimd
976  !/ ------------------------------------------------------------------- /
989  SUBROUTINE wmdimm ( IMOD, NDSE, NDST )
990  !/
991  !/ +-----------------------------------+
992  !/ | WAVEWATCH III NOAA/NCEP |
993  !/ | H. L. Tolman |
994  !/ | FORTRAN 90 |
995  !/ | Last update : 22-Feb-2005 !
996  !/ +-----------------------------------+
997  !/
998  !/ 22-Feb-2005 : Origination. ( version 3.07 )
999  !/
1000  ! 1. Purpose :
1001  !
1002  ! Initialize an individual data grid at the proper dimensions.
1003  !
1004  ! 2. Method :
1005  !
1006  ! Allocate directly into the structure array. Note that
1007  ! this cannot be done through the pointer alias!
1008  !
1009  ! 3. Parameters :
1010  !
1011  ! Parameter list
1012  ! ----------------------------------------------------------------
1013  ! IMOD Int. I Model number to point to.
1014  ! NDSE Int. I Error output unit number.
1015  ! NDST Int. I Test output unit number.
1016  ! ----------------------------------------------------------------
1017  !
1018  ! 4. Subroutines used :
1019  !
1020  ! See module documentation.
1021  !
1022  ! 5. Called by :
1023  !
1024  ! Name Type Module Description
1025  ! ----------------------------------------------------------------
1026  ! ----------------------------------------------------------------
1027  !
1028  ! 6. Error messages :
1029  !
1030  ! - Check on input parameters.
1031  ! - Check on previous allocation.
1032  !
1033  ! 7. Remarks :
1034  !
1035  ! - WMSETM needs to be called after allocation to point to
1036  ! proper allocated arrays.
1037  !
1038  ! 8. Structure :
1039  !
1040  ! See source code.
1041  !
1042  ! 9. Switches :
1043  !
1044  ! !/S Enable subroutine tracing.
1045  ! !/T Enable test output
1046  !
1047  ! 10. Source code :
1048  !
1049  !/ ------------------------------------------------------------------- /
1050  USE w3gdatmd, ONLY: ngrids, igrid, w3setg
1051  USE w3odatmd, ONLY: naproc
1052  USE w3servmd, ONLY: extcde
1053 #ifdef W3_S
1054  USE w3servmd, ONLY: strace
1055 #endif
1056  !
1057  IMPLICIT NONE
1058  !
1059  !/
1060  !/ ------------------------------------------------------------------- /
1061  !/ Parameter list
1062  !/
1063  INTEGER, INTENT(IN) :: IMOD, NDSE, NDST
1064  !/
1065  !/ ------------------------------------------------------------------- /
1066  !/ Local parameters
1067  !/
1068  INTEGER :: JGRID
1069 #ifdef W3_S
1070  INTEGER, SAVE :: IENT = 0
1071 #endif
1072  !/
1073 #ifdef W3_S
1074  CALL strace (ient, 'WMDIMM')
1075 #endif
1076  !
1077  ! -------------------------------------------------------------------- /
1078  ! 1. Test input and module status
1079  !
1080  IF ( ngrids .EQ. -1 ) THEN
1081  WRITE (ndse,1001)
1082  CALL extcde (1)
1083  END IF
1084  !
1085  IF ( imod.LT.1 .OR. imod.GT.nmdata ) THEN
1086  WRITE (ndse,1002) imod, nmdata
1087  CALL extcde (2)
1088  END IF
1089  !
1090  IF ( mdatas(imod)%MINIT ) THEN
1091  WRITE (ndse,1003)
1092  CALL extcde (3)
1093  END IF
1094  !
1095 #ifdef W3_T
1096  WRITE (ndst,9000) imod
1097 #endif
1098  !
1099  jgrid = igrid
1100  IF ( jgrid .NE. imod ) CALL w3setg ( imod, ndse, ndst )
1101  !
1102  ! -------------------------------------------------------------------- /
1103  ! 2. Allocate arrays
1104  !
1105  ! ALLOCATE ( MDATAS(IMOD)%...
1106  !
1107 #ifdef W3_T
1108  WRITE (ndst,9001)
1109 #endif
1110  !
1111  ! -------------------------------------------------------------------- /
1112  ! 3. Point to allocated arrays
1113  !
1114  CALL wmsetm ( imod, ndse, ndst )
1115  !
1116 #ifdef W3_T
1117  WRITE (ndst,9002)
1118 #endif
1119  !
1120  ! -------------------------------------------------------------------- /
1121  ! 4. Update flag
1122  !
1123  minit = .true.
1124  !
1125 #ifdef W3_T
1126  WRITE (ndst,9003)
1127 #endif
1128  !
1129  ! -------------------------------------------------------------------- /
1130  ! 5. Restore previous grid setting if necessary
1131  !
1132  IF ( jgrid .NE. imod ) CALL w3setg ( jgrid, ndse, ndst )
1133  !
1134  RETURN
1135  !
1136  ! Formats
1137  !
1138 1001 FORMAT (/' *** ERROR WMDIMM : GRIDS NOT INITIALIZED *** '/ &
1139  ' RUN W3NMOD FIRST '/)
1140 1002 FORMAT (/' *** ERROR WMDIMM : ILLEGAL MODEL NUMBER *** '/ &
1141  ' IMOD = ',i10/ &
1142  ' NMDATA = ',i10/)
1143 1003 FORMAT (/' *** ERROR WMDIMM : ARRAY(S) ALREADY ALLOCATED *** ')
1144  !
1145 #ifdef W3_T
1146 9000 FORMAT (' TEST WMDIMM : MODEL ',i4,' DIM. AT ',2i5,i7)
1147 9001 FORMAT (' TEST WMDIMM : ARRAYS ALLOCATED')
1148 9002 FORMAT (' TEST WMDIMM : POINTERS RESET')
1149 9003 FORMAT (' TEST WMDIMM : FLAGS SET')
1150 #endif
1151  !/
1152  !/ End of WMDIMM ----------------------------------------------------- /
1153  !/
1154  END SUBROUTINE wmdimm
1155  !/ ------------------------------------------------------------------- /
1168  SUBROUTINE wmsetm ( IMOD, NDSE, NDST )
1169  !/
1170  !/ +-----------------------------------+
1171  !/ | WAVEWATCH III NOAA/NCEP |
1172  !/ | H. L. Tolman |
1173  !/ | FORTRAN 90 |
1174  !/ | Last update : 22-Mar-2021 !
1175  !/ +-----------------------------------+
1176  !/
1177  !/ 13-Jun-2005 : Origination. ( version 3.07 )
1178  !/ 22-Mar-2021 : Support for air density input ( version 7.13 )
1179  !/
1180  ! 1. Purpose :
1181  !
1182  ! Select one of the WAVEWATCH III grids / models.
1183  !
1184  ! 2. Method :
1185  !
1186  ! Point pointers to the proper variables in the proper element of
1187  ! the GRIDS array.
1188  !
1189  ! 3. Parameters :
1190  !
1191  ! Parameter list
1192  ! ----------------------------------------------------------------
1193  ! IMOD Int. I Model number to point to.
1194  ! NDSE Int. I Error output unit number.
1195  ! NDST Int. I Test output unit number.
1196  ! ----------------------------------------------------------------
1197  !
1198  ! 4. Subroutines used :
1199  !
1200  ! See module documentation.
1201  !
1202  ! 5. Called by :
1203  !
1204  ! Many subroutines in the WAVEWATCH system.
1205  !
1206  ! 6. Error messages :
1207  !
1208  ! Checks on parameter list IMOD.
1209  !
1210  ! 7. Remarks :
1211  !
1212  ! 8. Structure :
1213  !
1214  ! 9. Switches :
1215  !
1216  ! !/S Enable subroutine tracing.
1217  ! !/T Enable test output
1218  !
1219  ! 10. Source code :
1220  !
1221  !/ ------------------------------------------------------------------- /
1222  USE w3servmd, ONLY: extcde
1223 #ifdef W3_S
1224  USE w3servmd, ONLY: strace
1225 #endif
1226  !
1227  IMPLICIT NONE
1228  !/
1229  !/ ------------------------------------------------------------------- /
1230  !/ Parameter list
1231  !/
1232  INTEGER, INTENT(IN) :: IMOD, NDSE, NDST
1233  !/
1234  !/ ------------------------------------------------------------------- /
1235  !/ Local parameters
1236  !/
1237 #ifdef W3_S
1238  INTEGER, SAVE :: IENT = 0
1239 #endif
1240  !/
1241 #ifdef W3_S
1242  CALL strace (ient, 'WMSETM')
1243 #endif
1244  !
1245  ! -------------------------------------------------------------------- /
1246  ! 1. Test input and module status
1247  !
1248  IF ( nmdata .EQ. -1 ) THEN
1249  WRITE (ndse,1001)
1250  CALL extcde (1)
1251  END IF
1252  !
1253  IF ( imod.LT.1 .OR. imod.GT.nmdata ) THEN
1254  WRITE (ndse,1002) imod, nmdata
1255  CALL extcde (2)
1256  END IF
1257  !
1258 #ifdef W3_T
1259  WRITE (ndst,9000) imod
1260 #endif
1261  !
1262  ! -------------------------------------------------------------------- /
1263  ! 2. Set model numbers
1264  !
1265  imdata = imod
1266  !
1267  ! -------------------------------------------------------------------- /
1268  ! 3. Set pointers
1269  !
1270  !
1271  nmv => mdatas(imod)%NMV
1272  tmv => mdatas(imod)%TMV
1273  amv => mdatas(imod)%AMV
1274  dmv => mdatas(imod)%DMV
1275 #ifdef W3_MPI
1276  mpi_comm_grd => mdatas(imod)%MPI_COMM_GRD
1277  mpi_comm_bct => mdatas(imod)%MPI_COMM_BCT
1278  croot => mdatas(imod)%CROOT
1279  fbcast => mdatas(imod)%FBCAST
1280 #endif
1281  rcld => mdatas(imod)%RCLD
1282  ndt => mdatas(imod)%NDT
1283  data0 => mdatas(imod)%DATA0
1284  data1 => mdatas(imod)%DATA1
1285  data2 => mdatas(imod)%DATA2
1286  nbi2s => mdatas(imod)%NBI2S
1287  mapmsk => mdatas(imod)%MAPMSK
1288  minit => mdatas(imod)%MINIT
1289  fllstl => mdatas(imod)%FLLSTL
1290  fllsti => mdatas(imod)%FLLSTI
1291  fllstr => mdatas(imod)%FLLSTR
1292  mapbdi => mdatas(imod)%MAPBDI
1293  mapodi => mdatas(imod)%MAPODI
1294 #ifdef W3_PDLIB
1295  sea_ipgl => mdatas(imod)%SEA_IPGL
1296  sea_ipgl_to_proc => mdatas(imod)%SEA_IPGL_TO_PROC
1297 #endif
1298  uptmap => mdatas(imod)%UPTMAP
1299  !
1300  RETURN
1301  !
1302  ! Formats
1303  !
1304 1001 FORMAT (/' *** ERROR WMSETM : GRIDS NOT INITIALIZED *** '/ &
1305  ' RUN W3NMOD FIRST '/)
1306 1002 FORMAT (/' *** ERROR WMSETM : ILLEGAL MODEL NUMBER *** '/ &
1307  ' IMOD = ',i10/ &
1308  ' NMDATA = ',i10/)
1309  !
1310 #ifdef W3_T
1311 9000 FORMAT (' TEST WMSETM : MODEL ',i4,' SELECTED')
1312 #endif
1313  !/
1314  !/ End of WMSETM ----------------------------------------------------- /
1315  !/
1316  END SUBROUTINE wmsetm
1317  !**********************************************************************
1318  !* *
1319  !**********************************************************************
1320  !/ ------------------------------------------------------------------- /
1332  SUBROUTINE init_get_jsea_isproc_glob(ISEA, J, JSEA, ISPROC)
1333  !/
1334  !/ +-----------------------------------+
1335  !/ | WAVEWATCH III NOAA/NCEP |
1336  !/ | Aron Roland |
1337  !/ | FORTRAN 90 |
1338  !/ | Last update : 14-Jun-2018 |
1339  !/ +-----------------------------------+
1340  !/
1341  !/ 06-Jun-2018 : Origination. ( version 6.04 )
1342  !/
1343  ! 1. Purpose : Introduce mapping for ISPROC and JSEA when using PDLIB
1344  ! in the Multigrid approach
1345  !
1346  ! 2. Method :
1347  ! 3. Parameters :
1348  !
1349  ! Parameter list
1350  ! ----------------------------------------------------------------
1351  ! ----------------------------------------------------------------
1352  !
1353  ! 4. Subroutines used :
1354  !
1355  ! Name Type Module Description
1356  ! ----------------------------------------------------------------
1357  ! STRACE Subr. W3SERVMD Subroutine tracing.
1358  ! ----------------------------------------------------------------
1359  !
1360  ! 5. Called by :
1361  !
1362  ! Name Type Module Description
1363  ! ----------------------------------------------------------------
1364  ! ----------------------------------------------------------------
1365  !
1366  ! 6. Error messages :
1367  ! 7. Remarks
1368  ! 8. Structure :
1369  ! 9. Switches :
1370  !
1371  ! !/S Enable subroutine tracing.
1372  !
1373  ! 10. Source code :
1374  !
1375  USE constants, ONLY: lpdlib
1376  USE w3odatmd, ONLY: outpts
1377  USE w3gdatmd, ONLY: gtype, grids, ungtype
1378 #ifdef W3_S
1379  USE w3servmd, ONLY: strace
1380 #endif
1381  !/
1382  IMPLICIT NONE
1383  !/ ------------------------------------------------------------------- /
1384  !/ Parameter list
1385  !/
1386  integer, intent(in) :: ISEA, J
1387  integer, intent(out) :: JSEA, ISPROC
1388  integer nb
1389  !/
1390  !/ ------------------------------------------------------------------- /
1391  !/ Local parameters
1392  !/
1393 #ifdef W3_S
1394  INTEGER, SAVE :: IENT = 0
1395 #endif
1396  !/
1397  !/ ------------------------------------------------------------------- /
1398  !/
1399 #ifdef W3_S
1400  CALL strace (ient, 'INIT_GET_JSEA_ISPROC_GLOB')
1401 #endif
1402  IF (.NOT. lpdlib) THEN
1403  nb=outpts(j)%NAPROC
1404  jsea = 1 + (isea-1)/nb
1405  isproc=1
1406 #ifdef W3_DIST
1407  isproc = mdatas(j)%CROOT - 1 + isea - (jsea-1)*nb
1408 #endif
1409  ELSE
1410 #ifdef W3_PDLIB
1411  IF (grids(j)%GTYPE .ne. ungtype) THEN
1412  nb=outpts(j)%NAPROC
1413  jsea = 1 + (isea-1)/nb
1414  isproc = mdatas(j)%CROOT - 1 + isea - (jsea-1)*nb
1415  ELSE
1416  jsea = mdatas(j)%SEA_IPGL(isea)
1417  isproc = mdatas(j)%SEA_IPGL_TO_PROC(isea)
1418  ENDIF
1419 #endif
1420  ENDIF
1421  !/
1422  !/ End of INIT_GET_JSEA_ISPROC_GLOB ---------------------------------- /
1423  !/
1424  END SUBROUTINE init_get_jsea_isproc_glob
1425  !/
1426  !/ End of module WMMDATMD -------------------------------------------- /
1427  !/
1428 END MODULE wmmdatmd
wmmdatmd::tdata
integer, dimension(:,:), allocatable tdata
TDATA.
Definition: wmmdatmd.F90:365
wmmdatmd::wmdimm
subroutine wmdimm(IMOD, NDSE, NDST)
Initialize an individual data grid at the proper dimensions.
Definition: wmmdatmd.F90:990
wmmdatmd::nbi2s
integer, dimension(:,:), pointer nbi2s
NBI2S.
Definition: wmmdatmd.F90:539
wmmdatmd::respec
logical, dimension(:,:), allocatable respec
RESPEC.
Definition: wmmdatmd.F90:381
wmmdatmd::mdse
integer mdse
MDSE.
Definition: wmmdatmd.F90:316
wmmdatmd::clkdt3
integer, dimension(8) clkdt3
CLKDT3.
Definition: wmmdatmd.F90:338
wmmdatmd::mdsi
integer mdsi
MDSI.
Definition: wmmdatmd.F90:312
wmmdatmd::iflstl
logical, dimension(:), allocatable iflstl
IFLSTL.
Definition: wmmdatmd.F90:384
wmmdatmd::iflstr
logical, dimension(:), allocatable iflstr
IFLSTR.
Definition: wmmdatmd.F90:385
wmmdatmd::stime
integer, dimension(2) stime
STIME.
Definition: wmmdatmd.F90:328
wmmdatmd::fllsti
logical, pointer fllsti
FLLSTI.
Definition: wmmdatmd.F90:562
wmmdatmd::dmv
real, dimension(:,:), pointer dmv
DMV.
Definition: wmmdatmd.F90:551
wmmdatmd::mdsupa
integer mdsupa
MDSUPA.
Definition: wmmdatmd.F90:319
wmmdatmd::minit
logical, pointer minit
MINIT.
Definition: wmmdatmd.F90:559
wmmdatmd::clkfin
real clkfin
CLKFIN.
Definition: wmmdatmd.F90:376
wmmdatmd::rcld
integer, dimension(:), pointer rcld
RCLD.
Definition: wmmdatmd.F90:535
w3gdatmd::ungtype
integer, parameter ungtype
Definition: w3gdatmd.F90:626
wmmdatmd::init_get_jsea_isproc_glob
subroutine init_get_jsea_isproc_glob(ISEA, J, JSEA, ISPROC)
Introduce mapping for ISPROC and JSEA when using PDLIB in the Multigrid approach.
Definition: wmmdatmd.F90:1333
wmmdatmd::croot
integer, pointer croot
CROOT.
Definition: wmmdatmd.F90:545
wmmdatmd::nmpscr
integer nmpscr
NMPSCR.
Definition: wmmdatmd.F90:324
wmmdatmd::data2
real, dimension(:,:), pointer data2
DATA2.
Definition: wmmdatmd.F90:549
wmmdatmd::mdso
integer mdso
MDSO.
Definition: wmmdatmd.F90:313
wmmdatmd::tmax
integer, dimension(:,:), allocatable tmax
TMAX.
Definition: wmmdatmd.F90:363
wmmdatmd::fllstl
logical, pointer fllstl
FLLSTL.
Definition: wmmdatmd.F90:560
wmmdatmd::hgstge
type(hgst), dimension(:,:), allocatable, target hgstge
HGSTGE.
Definition: wmmdatmd.F90:530
wmmdatmd::nrgrp
integer nrgrp
NRGRP.
Definition: wmmdatmd.F90:332
wmmdatmd::nmv
integer, pointer nmv
NMV.
Definition: wmmdatmd.F90:537
wmmdatmd::tsync
integer, dimension(:,:), allocatable tsync
TSYNC.
Definition: wmmdatmd.F90:362
wmmdatmd::mdss
integer mdss
MDSS.
Definition: wmmdatmd.F90:314
wmmdatmd::flgbdi
logical flgbdi
FLGBDI.
Definition: wmmdatmd.F90:378
wmmdatmd::nbista
integer, dimension(:), allocatable nbista
NBISTA.
Definition: wmmdatmd.F90:371
w3gdatmd::grids
type(grid), dimension(:), allocatable, target grids
Definition: w3gdatmd.F90:1088
wmmdatmd::uptmap
integer, dimension(:), pointer uptmap
UPTMAP.
Definition: wmmdatmd.F90:541
wmmdatmd::hghsta
integer, dimension(:), allocatable hghsta
HGHSTA.
Definition: wmmdatmd.F90:372
wmmdatmd::mpi_comm_grd
integer, pointer mpi_comm_grd
MPI_COMM_GRD.
Definition: wmmdatmd.F90:543
wmmdatmd::grdeql
integer, dimension(:,:), allocatable grdeql
GRDEQL.
Definition: wmmdatmd.F90:357
wmmdatmd::bcdump
logical, dimension(:), allocatable bcdump
BCDUMP.
Definition: wmmdatmd.F90:382
wmmdatmd::nmplog
integer nmplog
NMPLOG.
Definition: wmmdatmd.F90:323
wmmdatmd::mapbdi
real, dimension(:,:), pointer mapbdi
MAPBDI.
Definition: wmmdatmd.F90:553
wmmdatmd::improc
integer improc
IMPROC.
Definition: wmmdatmd.F90:322
wmmdatmd::mtag2
integer, parameter mtag2
MTAG2.
Definition: wmmdatmd.F90:348
wmmdatmd::bpst
Definition: wmmdatmd.F90:442
w3gdatmd::w3setg
subroutine w3setg(IMOD, NDSE, NDST)
Definition: w3gdatmd.F90:2152
wmmdatmd::grdhgh
integer, dimension(:,:), allocatable grdhgh
GRDHGH.
Definition: wmmdatmd.F90:356
wmmdatmd::ingrp
integer, dimension(:,:), allocatable ingrp
INGRP.
Definition: wmmdatmd.F90:355
wmmdatmd::sea_ipgl
integer, dimension(:), pointer sea_ipgl
SEA_IPGL.
Definition: wmmdatmd.F90:556
wmmdatmd::data1
real, dimension(:,:), pointer data1
DATA1.
Definition: wmmdatmd.F90:548
wmmdatmd::toutp
integer, dimension(:,:), allocatable toutp
TOUTP.
Definition: wmmdatmd.F90:364
wmmdatmd::nmproc
integer nmproc
NMPROC.
Definition: wmmdatmd.F90:321
wmmdatmd::fldat0
logical, pointer fldat0
FLDAT0.
Definition: wmmdatmd.F90:563
wmmdatmd::mdsp
integer mdsp
MDSP.
Definition: wmmdatmd.F90:341
wmmdatmd::flghg1
logical flghg1
FLGHG1.
Definition: wmmdatmd.F90:379
wmmdatmd::mdatas
type(mdata), dimension(:), allocatable, target mdatas
MDATAS.
Definition: wmmdatmd.F90:528
constants::lpdlib
logical lpdlib
LPDLIB Logical for using the PDLIB library.
Definition: constants.F90:101
wmmdatmd::amv
real, dimension(:,:), pointer amv
AMV.
Definition: wmmdatmd.F90:550
wmmdatmd::mapmsk
integer, dimension(:,:), pointer mapmsk
MAPMSK.
Definition: wmmdatmd.F90:540
wmmdatmd::fllstr
logical, pointer fllstr
FLLSTR.
Definition: wmmdatmd.F90:561
wmmdatmd::mpi_comm_bct
integer, pointer mpi_comm_bct
MPI_COMM_BCT.
Definition: wmmdatmd.F90:544
w3servmd
Definition: w3servmd.F90:3
wmmdatmd::fldat2
logical, pointer fldat2
FLDAT2.
Definition: wmmdatmd.F90:565
wmmdatmd::idinp
character(len=3), dimension(:,:), allocatable idinp
IDINP.
Definition: wmmdatmd.F90:386
wmmdatmd::mtagb
integer, parameter mtagb
MTAGB.
Definition: wmmdatmd.F90:345
wmmdatmd::nrgrd
integer nrgrd
NRGRD.
Definition: wmmdatmd.F90:330
wmmdatmd::nbi2g
integer, dimension(:,:), allocatable nbi2g
NBI2G.
Definition: wmmdatmd.F90:367
wmmdatmd::eqst
Definition: wmmdatmd.F90:491
wmmdatmd::tmv
integer, dimension(:,:,:), pointer tmv
TMV.
Definition: wmmdatmd.F90:538
wmmdatmd::ngrpsmc
integer ngrpsmc
NGRPSMC.
Definition: wmmdatmd.F90:334
wmmdatmd::imdata
integer imdata
IMDATA.
Definition: wmmdatmd.F90:311
wmmdatmd::mtag_ub
integer, parameter mtag_ub
MPI_TAG_UB on Cray XC40.
Definition: wmmdatmd.F90:349
wmmdatmd::nmpupt
integer nmpupt
NMPUPT.
Definition: wmmdatmd.F90:327
w3odatmd
Definition: w3odatmd.F90:3
wmmdatmd::grdlow
integer, dimension(:,:), allocatable grdlow
GRDLOW.
Definition: wmmdatmd.F90:359
wmmdatmd::nmdata
integer nmdata
NMDATA.
Definition: wmmdatmd.F90:310
wmmdatmd::eqstge
type(eqst), dimension(:,:), allocatable, target eqstge
EQSTGE.
Definition: wmmdatmd.F90:531
wmmdatmd::hgst
Definition: wmmdatmd.F90:458
wmmdatmd::grstat
integer, dimension(:), allocatable grstat
GRSTAT.
Definition: wmmdatmd.F90:366
w3odatmd::naproc
integer, pointer naproc
Definition: w3odatmd.F90:457
wmmdatmd::allprc
integer, dimension(:,:), allocatable allprc
ALLPRC.
Definition: wmmdatmd.F90:360
wmmdatmd::fbcast
logical, pointer fbcast
FBCAST.
Definition: wmmdatmd.F90:568
wmmdatmd::nmperr
integer nmperr
NMPERR.
Definition: wmmdatmd.F90:326
wmmdatmd::grgrp
integer, dimension(:), allocatable grgrp
GRGRP.
Definition: wmmdatmd.F90:354
wmmdatmd::nrinp
integer nrinp
NRINP.
Definition: wmmdatmd.F90:331
w3gdatmd::igrid
integer igrid
Definition: w3gdatmd.F90:618
wmmdatmd::ndt
integer, dimension(:), pointer ndt
NDT.
Definition: wmmdatmd.F90:536
wmmdatmd::mdst
integer mdst
MDST.
Definition: wmmdatmd.F90:315
wmmdatmd::eqlsta
integer, dimension(:), allocatable eqlsta
EQLSTA.
Definition: wmmdatmd.F90:373
wmmdatmd::mtag0
integer, parameter mtag0
MTAG0.
Definition: wmmdatmd.F90:346
wmmdatmd::nmptst
integer nmptst
NMPTST.
Definition: wmmdatmd.F90:325
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
wmmdatmd::wmsetm
subroutine wmsetm(IMOD, NDSE, NDST)
Select one of the WAVEWATCH III grids / models.
Definition: wmmdatmd.F90:1169
w3gdatmd::gtype
integer, pointer gtype
Definition: w3gdatmd.F90:1094
wmmdatmd::wmndat
subroutine wmndat(NDSE, NDST)
Set up the number of grids to be used.
Definition: wmmdatmd.F90:584
wmmdatmd::wmdimd
subroutine wmdimd(IMOD, NDSE, NDST, J)
Initialize an individual data grid at the proper dimensions.
Definition: wmmdatmd.F90:787
wmmdatmd::mtag1
integer, parameter mtag1
MTAG1.
Definition: wmmdatmd.F90:347
wmmdatmd::grank
integer, dimension(:), allocatable grank
GRANK.
Definition: wmmdatmd.F90:353
wmmdatmd::data0
real, dimension(:,:), pointer data0
DATA0.
Definition: wmmdatmd.F90:547
wmmdatmd::fldat1
logical, pointer fldat1
FLDAT1.
Definition: wmmdatmd.F90:564
wmmdatmd::clkdt2
integer, dimension(8) clkdt2
CLKDT2.
Definition: wmmdatmd.F90:337
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3gdatmd
Definition: w3gdatmd.F90:16
wmmdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: wmmdatmd.F90:16
wmmdatmd::flghg2
logical flghg2
FLGHG2.
Definition: wmmdatmd.F90:380
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
wmmdatmd::bpstge
type(bpst), dimension(:,:), allocatable, target bpstge
BPSTGE.
Definition: wmmdatmd.F90:529
w3odatmd::outpts
type(output), dimension(:), allocatable, target outpts
Definition: w3odatmd.F90:452
wmmdatmd::mdata
Definition: wmmdatmd.F90:390
wmmdatmd::nmvmax
integer nmvmax
NMVMAX.
Definition: wmmdatmd.F90:333
wmmdatmd::inpmap
integer, dimension(:,:), allocatable inpmap
INPMAP.
Definition: wmmdatmd.F90:368
w3gdatmd::ngrids
integer ngrids
Definition: w3gdatmd.F90:618
wmmdatmd::mapodi
real, dimension(:,:), pointer mapodi
MAPODI.
Definition: wmmdatmd.F90:554
wmmdatmd::clkdt1
integer, dimension(8) clkdt1
CLKDT1.
Definition: wmmdatmd.F90:336
wmmdatmd::sea_ipgl_to_proc
integer, dimension(:), pointer sea_ipgl_to_proc
SEA_IPGL_TO_PROC.
Definition: wmmdatmd.F90:557
wmmdatmd::mdsf
integer, dimension(:,:), allocatable mdsf
MDSF.
Definition: wmmdatmd.F90:352
wmmdatmd::dtres
real, dimension(:), allocatable dtres
DTRES.
Definition: wmmdatmd.F90:377
wmmdatmd::modmap
integer, dimension(:,:), allocatable modmap
MODMAP.
Definition: wmmdatmd.F90:361
wmmdatmd::etime
integer, dimension(2) etime
ETIME.
Definition: wmmdatmd.F90:329
wmmdatmd::mpi_comm_mwave
integer mpi_comm_mwave
MPI_COMM_MWAVE.
Definition: wmmdatmd.F90:344
wmmdatmd::mdsup
integer mdsup
MDSUP.
Definition: wmmdatmd.F90:317
wmmdatmd::iflsti
logical, dimension(:), allocatable iflsti
IFLSTI.
Definition: wmmdatmd.F90:383