#include "w3macros.h" !/ ------------------------------------------------------------------- / MODULE W3ODATMD !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | !/ | Last update : 27-Jul-2018 | !/ +-----------------------------------+ !/ !/ 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) !/ !/ 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. ! 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. ! ---------------------------------------------------------------- ! ! 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. ! FLOGD L.A. Public Flags for output groups ! FLOG2 L.A. Public Flags for coupling groups ! ---------------------------------------------------------------- ! ! 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 Name of 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. ! 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 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 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 !/MPI INTEGER :: NRQGO, NRQGO2 !/MPI INTEGER, POINTER :: IRQGO(:), IRQGO2(:) LOGICAL :: FLOGRD(NOGRP,NGRPP), FLOGD(NOGRP), & FLOGR2(NOGRP,NGRPP), FLOG2(NOGRP), & WRITE1 END TYPE OTYPE1 !/ TYPE OTYPE2 INTEGER :: IPASS2, NOPTS !/MPI INTEGER :: NRQPO, NRQPO2 INTEGER, POINTER :: IPTINT(:,:,:), IL(:), IW(:), II(:) !/MPI INTEGER, POINTER :: IRQPO1(:), IRQPO2(:) REAL, POINTER :: PTLOC(:,:), PTIFAC(:,:), & DPO(:), WAO(:), WDO(:), ASO(:), & CAO(:), CDO(:), ICEO(:), ICEHO(:), & ICEFO(:), SPCO(:,:) REAL, POINTER :: ZET_SETO(:) ! For the wave setup. CHARACTER(LEN=10), POINTER :: PTNME(:), GRDID(:) LOGICAL :: O2INIT !/MPI LOGICAL :: O2IRQI END TYPE OTYPE2 !/ TYPE OTYPE3 INTEGER :: IPASS3 !/MPI INTEGER :: IT0PNT, IT0TRK, IT0PRT, NRQTR !/MPI INTEGER, POINTER :: IRQTR(:) LOGICAL :: O3INIT, STOP LOGICAL, POINTER :: MASK1(:,:), MASK2(:,:) CHARACTER(LEN=32), POINTER :: TRCKID(:,:) END TYPE OTYPE3 !/ TYPE OTYPE4 INTEGER :: IFILE4 !/MPI INTEGER :: NRQRS, NBLKRS, RSBLKS !/MPI INTEGER, POINTER :: IRQRS(:), IRQRSS(:) !/MPI REAL, POINTER :: VAAUX(:,:,:) END TYPE OTYPE4 !/ TYPE OTYPE5 INTEGER :: NBI, NBI2, NFBPO, NBO(0:9), & NBO2(0:9), NDSL(9), NKI, NTHI !/MPI INTEGER :: NRQBP = 0, NRQBP2 = 0 INTEGER, POINTER :: IPBPI(:,:), ISBPI(:), & IPBPO(:,:), ISBPO(:) !/MPI INTEGER, POINTER :: IRQBP1(:), IRQBP2(:) 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 INTEGER :: TOFRST(2), TONEXT(2,7), TOLAST(2,7), & TBPI0(2), TBPIN(2), NDS(13) REAL :: DTOUT(7) LOGICAL :: FLOUT(7) 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 INTEGER, POINTER :: TOFRST(:), TONEXT(:,:), TOLAST(:,:), & TBPI0(:), TBPIN(:), NDS(:) REAL, POINTER :: DTOUT(:) LOGICAL, POINTER :: FLOUT(:) !/ !/ Data aliasses for substructures for output types !/ Type 1 ... !/ INTEGER, POINTER :: IPASS1 !/MPI INTEGER, POINTER :: NRQGO, NRQGO2 !/MPI INTEGER, POINTER :: IRQGO(:), IRQGO2(:) LOGICAL, POINTER :: FLOGRD(:,:), FLOGR2(:,:), FLOGD(:), & FLOG2(:), WRITE1 !/ !/ Type 2 ... !/ INTEGER, POINTER :: IPASS2, NOPTS !/MPI INTEGER, POINTER :: NRQPO, NRQPO2 INTEGER, POINTER :: IPTINT(:,:,:), IL(:), IW(:), II(:) !/MPI INTEGER, POINTER :: IRQPO1(:), IRQPO2(:) REAL, POINTER :: PTLOC(:,:), PTIFAC(:,:), & DPO(:), WAO(:), WDO(:), ASO(:), & CAO(:), CDO(:), ICEO(:), ICEHO(:), & ICEFO(:), SPCO(:,:) REAL, POINTER :: ZET_SETO(:) ! CHARACTER(LEN=10), POINTER :: PTNME(:), GRDID(:) LOGICAL, POINTER :: O2INIT !/MPI LOGICAL, POINTER :: O2IRQI !/ !/ Type 3 ... !/ INTEGER, POINTER :: IPASS3 !/MPI INTEGER, POINTER :: IT0PNT, IT0TRK, IT0PRT, NRQTR !/MPI INTEGER, POINTER :: IRQTR(:) LOGICAL, POINTER :: O3INIT, STOP LOGICAL, POINTER :: MASK1(:,:), MASK2(:,:) CHARACTER(LEN=32), POINTER :: TRCKID(:,:) !/ !/ Type 4 ... !/ INTEGER, POINTER :: IFILE4 !/MPI INTEGER, POINTER :: NRQRS, NBLKRS, RSBLKS !/MPI INTEGER, POINTER :: IRQRS(:), IRQRSS(:) !/MPI REAL, POINTER :: VAAUX(:,:,:) !/ !/ Type 5 ... !/ INTEGER, POINTER :: NBI, NBI2, NFBPO, NKI, NTHI INTEGER, POINTER :: NBO(:), NBO2(:), NDSL(:) !/MPI INTEGER, POINTER :: NRQBP, NRQBP2 INTEGER, POINTER :: IPBPI(:,:), ISBPI(:), & IPBPO(:,:), ISBPO(:) !/MPI INTEGER, POINTER :: IRQBP1(:), IRQBP2(:) 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 !/ CONTAINS !/ ------------------------------------------------------------------- / SUBROUTINE W3NOUT ( NDSERR, NDSTST ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | !/ | Last update : 10-Dec-2014 | !/ +-----------------------------------+ !/ !/ 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 ) !/ ! 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 !/S USE W3SERVMD, ONLY: STRACE ! IMPLICIT NONE !/ !/ ------------------------------------------------------------------- / !/ Parameter list !/ INTEGER, INTENT(IN) :: NDSERR, NDSTST !/ !/ ------------------------------------------------------------------- / !/ Local parameters !/ INTEGER :: I, NLOW, J !/S INTEGER, SAVE :: IENT = 0 CHARACTER(LEN=20) :: STRING !/ !/S CALL STRACE (IENT, 'W3NOUT') ! ! -------------------------------------------------------------------- / ! 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 !/MPI OUTPTS(I)%OUT1%NRQGO = 0 !/MPI OUTPTS(I)%OUT1%NRQGO2 = 0 ! OUTPTS(I)%OUT2%IPASS2 = 0 OUTPTS(I)%OUT2%NOPTS = 0 OUTPTS(I)%OUT2%O2INIT = .FALSE. !/MPI OUTPTS(I)%OUT2%O2IRQI = .FALSE. ! OUTPTS(I)%OUT3%IPASS3 = 0 OUTPTS(I)%OUT3%O3INIT = .FALSE. OUTPTS(I)%OUT3%STOP = .FALSE. !/MPI OUTPTS(I)%OUT3%NRQTR = 0 ! OUTPTS(I)%OUT4%IFILE4 = 0 !/MPI OUTPTS(I)%OUT4%NRQRS = 0 ! 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) = 7 !/BT4 NOGE(1) = 8 ! 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' !/BT4 IDOUT( 1, 8) = 'Sediment diam D50 ' !/IS2 IDOUT( 1, 9) = 'ice thickness ' !/IS2 IDOUT( 1, 10) = 'Avg. ice floe diam. ' !/SETUP IDOUT( 1, 11) = 'wave induced setup' ! ! 2) Standard mean wave parameters ! NOGE(2) = 17 !/OASOCM NOGE(2) = 18 ! 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 ' !/OASOCM IDOUT( 2, 18) = 'Mean wave dir. norot' ! 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) = 10 ! 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) = 'Breaker passage rate' ! ! 6) Wave-ocean layer ! NOGE(6) = 12 ! 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' ! ! 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 ! !/T WRITE (NDSTST,9000) NGRIDS ! RETURN ! ! Formats ! 1001 FORMAT (/' *** ERROR W3NOUT : NGRIDS NOT YET SET *** '/ & ' NGRIDS = ',I10/ & ' RUN W3NMOD FIRST'/) ! !/T 9000 FORMAT (' TEST W3NOUT : SETTING UP FOR ',I4,' GRIDS') !/ !/ 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 : ! ! Parameter list ! ---------------------------------------------------------------- ! IMOD Int. I Model number to point to. ! NDSE Int. I Error output unit number. ! NDST Int. I Test output unit number. ! NPT Int. I Array size. ! ---------------------------------------------------------------- ! ! 4. Subroutines used : ! ! See module documentation below. ! ! 5. Called by : ! ! Name Type Module Description ! ---------------------------------------------------------------- ! W3IOPO Subr. W3IOPOMD Point output module. ! ---------------------------------------------------------------- ! ! 6. Error messages : ! ! - Check on input parameters. ! - Check on previous allocation. ! ! 7. Remarks : ! ! - W3SETO needs to be called after allocation to point to ! proper allocated arrays. ! - Note that NOPTS is overwritten in W3IOPP. ! ! 8. Structure : ! ! See source code. ! ! 9. Switches : ! ! !/S Enable subroutine tracing. ! !/T Enable test output ! ! 10. Source code : ! !/ ------------------------------------------------------------------- / USE W3GDATMD, ONLY: W3SETG, NGRIDS, NAUXGR, IGRID, NSPEC USE W3SERVMD, ONLY: EXTCDE !/S USE W3SERVMD, ONLY: STRACE ! IMPLICIT NONE !/ !/ ------------------------------------------------------------------- / !/ Parameter list !/ INTEGER, INTENT(IN) :: IMOD, NDSE, NDST, NPT !/ !/ ------------------------------------------------------------------- / !/ Local parameters !/ INTEGER :: JGRID, NLOW !/S INTEGER, SAVE :: IENT = 0 !/ !/S CALL STRACE (IENT, 'W3DMO2') ! ! -------------------------------------------------------------------- / ! 1. Test input and module status ! IF ( NGRIDS .EQ. -1 ) THEN WRITE (NDSE,1001) CALL EXTCDE (1) END IF ! NLOW = MIN ( 0 , -NAUXGR ) IF ( IMOD.LT.NLOW .OR. IMOD.GT.NOUTP ) THEN WRITE (NDSE,1002) IMOD, NLOW, NOUTP CALL EXTCDE (2) END IF ! IF ( OUTPTS(IMOD)%OUT2%O2INIT ) THEN WRITE (NDSE,1003) CALL EXTCDE (3) END IF ! !/T WRITE (NDST,9000) IMOD ! JGRID = IGRID IF ( JGRID .NE. IMOD ) CALL W3SETG ( IMOD, NDSE, NDST ) ! ! -------------------------------------------------------------------- / ! 2. Allocate arrays ! ALLOCATE ( OUTPTS(IMOD)%OUT2%IPTINT(2,4,NPT) , & OUTPTS(IMOD)%OUT2%IL(NPT) , & OUTPTS(IMOD)%OUT2%IW(NPT) , & OUTPTS(IMOD)%OUT2%II(NPT) , & OUTPTS(IMOD)%OUT2%PTIFAC(4,NPT) , & OUTPTS(IMOD)%OUT2%PTNME(NPT) , & OUTPTS(IMOD)%OUT2%GRDID(NPT) , & OUTPTS(IMOD)%OUT2%DPO(NPT) , & OUTPTS(IMOD)%OUT2%WAO(NPT) , & OUTPTS(IMOD)%OUT2%ZET_SETO(NPT) , & OUTPTS(IMOD)%OUT2%WDO(NPT) , & OUTPTS(IMOD)%OUT2%ASO(NPT) , & OUTPTS(IMOD)%OUT2%CAO(NPT) , & OUTPTS(IMOD)%OUT2%CDO(NPT) , & OUTPTS(IMOD)%OUT2%ICEO(NPT) , & OUTPTS(IMOD)%OUT2%ICEHO(NPT) , & OUTPTS(IMOD)%OUT2%ICEFO(NPT) , & OUTPTS(IMOD)%OUT2%SPCO(NSPEC,NPT) , & OUTPTS(IMOD)%OUT2%PTLOC(2,NPT) , STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! OUTPTS(IMOD)%OUT2%O2INIT = .TRUE. ! !/T WRITE (NDST,9001) ! ! -------------------------------------------------------------------- / ! 3. Point to allocated arrays ! CALL W3SETO ( IMOD, NDSE, NDST ) ! !/T WRITE (NDST,9002) ! ! -------------------------------------------------------------------- / ! 4. Update counters in grid ! NOPTS = NPT ! !/T WRITE (NDST,9003) ! ! -------------------------------------------------------------------- / ! 5. Restore previous grid setting if necessary ! IF ( JGRID .NE. IMOD ) CALL W3SETG ( JGRID, NDSE, NDST ) ! RETURN ! ! Formats ! 1001 FORMAT (/' *** ERROR W3DMO2 : GRIDS NOT INITIALIZED *** '/ & ' RUN W3NMOD FIRST '/) 1002 FORMAT (/' *** ERROR W3DMO2 : ILLEGAL MODEL NUMBER *** '/ & ' IMOD = ',I10/ & ' NLOW = ',I10/ & ' NOUTP = ',I10/) 1003 FORMAT (/' *** ERROR W3DMO2 : ARRAY(S) ALREADY ALLOCATED *** ') ! !/T 9000 FORMAT (' TEST W3DMO2 : MODEL ',I4) !/T 9001 FORMAT (' TEST W3DMO2 : ARRAYS ALLOCATED') !/T 9002 FORMAT (' TEST W3DMO2 : POINTERS RESET') !/T 9003 FORMAT (' TEST W3DMO2 : DIMENSIONS STORED') !/ !/ End of W3DMO2 ----------------------------------------------------- / !/ END SUBROUTINE W3DMO2 !/ ------------------------------------------------------------------- / SUBROUTINE W3DMO3 ( IMOD, NDSE, NDST ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | !/ | Last update : 10-Dec-2014 ! !/ +-----------------------------------+ !/ !/ 24-Nov-2004 : Origination. ( version 3.06 ) !/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 ) !/ ! 1. Purpose : ! ! Initialize an individual data storage for track output. ! ! 2. Method : ! ! Allocate directly into the structure array. Note that ! this cannot be done through the pointer alias! ! ! 3. Parameters : ! ! Parameter list ! ---------------------------------------------------------------- ! IMOD Int. I Model number to point to. ! NDSE Int. I Error output unit number. ! NDST Int. I Test output unit number. ! ---------------------------------------------------------------- ! ! 4. Subroutines used : ! ! See module documentation below. ! ! 5. Called by : ! ! Name Type Module Description ! ---------------------------------------------------------------- ! W3IOTR Subr. W3IOTRMD Track output module. ! ---------------------------------------------------------------- ! ! 6. Error messages : ! ! - Check on input parameters. ! - Check on previous allocation. ! ! 7. Remarks : ! ! - W3SETO needs to be called after allocation to point to ! proper allocated arrays. ! ! 8. Structure : ! ! See source code. ! ! 9. Switches : ! ! !/SHRD, !/DIST, !/MPI ! Shared / distributed memory model ! ! !/S Enable subroutine tracing. ! !/T Enable test output ! ! 10. Source code : ! !/ ------------------------------------------------------------------- / USE W3GDATMD, ONLY: W3SETG, NGRIDS, IGRID, NX, NY USE W3SERVMD, ONLY: EXTCDE !/S USE W3SERVMD, ONLY: STRACE ! IMPLICIT NONE !/ !/ ------------------------------------------------------------------- / !/ Parameter list !/ INTEGER, INTENT(IN) :: IMOD, NDSE, NDST !/ !/ ------------------------------------------------------------------- / !/ Local parameters !/ INTEGER :: JGRID !/S INTEGER, SAVE :: IENT = 0 !/ !/S CALL STRACE (IENT, 'W3DMO3') ! ! -------------------------------------------------------------------- / ! 1. Test input and module status ! IF ( NGRIDS .EQ. -1 ) THEN WRITE (NDSE,1001) CALL EXTCDE (1) END IF ! IF ( IMOD.LT.1 .OR. IMOD.GT.NOUTP ) THEN WRITE (NDSE,1002) IMOD, NOUTP CALL EXTCDE (2) END IF ! IF ( OUTPTS(IMOD)%OUT3%O3INIT ) THEN WRITE (NDSE,1003) CALL EXTCDE (3) END IF ! !/T WRITE (NDST,9000) IMOD ! JGRID = IGRID IF ( JGRID .NE. IMOD ) CALL W3SETG ( IMOD, NDSE, NDST ) ! ! -------------------------------------------------------------------- / ! 2. Allocate arrays ! ALLOCATE ( OUTPTS(IMOD)%OUT3%MASK1(NY,NX) , & OUTPTS(IMOD)%OUT3%MASK2(NY,NX) , & OUTPTS(IMOD)%OUT3%TRCKID(NY,NX), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! OUTPTS(IMOD)%OUT3%O3INIT = .TRUE. ! !/T WRITE (NDST,9001) ! ! -------------------------------------------------------------------- / ! 3. Point to allocated arrays ! CALL W3SETO ( IMOD, NDSE, NDST ) ! !/T WRITE (NDST,9002) ! ! -------------------------------------------------------------------- / ! 4. Update counters in grid ! !/T WRITE (NDST,9003) ! ! -------------------------------------------------------------------- / ! 5. Restore previous grid setting if necessary ! IF ( JGRID .NE. IMOD ) CALL W3SETG ( JGRID, NDSE, NDST ) ! RETURN ! ! Formats ! 1001 FORMAT (/' *** ERROR W3DMO3 : GRIDS NOT INITIALIZED *** '/ & ' RUN W3NMOD FIRST '/) 1002 FORMAT (/' *** ERROR W3DMO3 : ILLEGAL MODEL NUMBER *** '/ & ' IMOD = ',I10/ & ' NOUTP = ',I10/) 1003 FORMAT (/' *** ERROR W3DMO3 : ARRAY(S) ALREADY ALLOCATED *** ') ! !/T 9000 FORMAT (' TEST W3DMO3 : MODEL ',I4) !/T 9001 FORMAT (' TEST W3DMO3 : ARRAYS ALLOCATED') !/T 9002 FORMAT (' TEST W3DMO3 : POINTERS RESET') !/T 9003 FORMAT (' TEST W3DMO3 : DIMENSIONS STORED') !/ !/ End of W3DMO3 ----------------------------------------------------- / !/ END SUBROUTINE W3DMO3 !/ ------------------------------------------------------------------- / SUBROUTINE W3DMO5 ( IMOD, NDSE, NDST, IBLOCK ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | !/ | Last update : 10-Dec-2014 ! !/ +-----------------------------------+ !/ !/ 13-Dec-2004 : Origination. ( version 3.06 ) !/ 06-Sep-2005 : Second storage for input bound. sp. ( version 3.08 ) !/ 10-Dec-2014 : Add checks for allocate status ( version 5.04 ) !/ ! 1. Purpose : ! ! Initialize an individual data storage for boundary data. ! ! 2. Method : ! ! Allocate directly into the structure array. Note that ! this cannot be done through the pointer alias! ! ! 3. Parameters : ! ! Parameter list ! ---------------------------------------------------------------- ! IMOD Int. I Model number to point to. ! NDSE Int. I Error output unit number. ! NDST Int. I Test output unit number. ! IBLOCK Int. I Select block to allocate. ! ---------------------------------------------------------------- ! ! 4. Subroutines used : ! ! See module documentation below. ! ! 5. Called by : ! ! Name Type Module Description ! ---------------------------------------------------------------- ! W3IOBC Subr. W3IOBCMD Boundary data output module. ! W3IOGR Subr. W3IOGRMD Grid data output module. ! W3WAVE Subr. W3WAVEMD Actual wave model routine. ! WW3_GRID Prog. N/A Grid preprocessing program. ! ---------------------------------------------------------------- ! ! 6. Error messages : ! ! - Check on input parameters. ! - Check on previous allocation. ! ! 7. Remarks : ! ! 8. Structure : ! ! See source code. ! ! 9. Switches : ! ! !/S Enable subroutine tracing. ! !/T Enable test output ! ! 10. Source code : ! !/ ------------------------------------------------------------------- / USE W3GDATMD, ONLY: W3SETG, NGRIDS, IGRID, NX, NY, NSPEC USE W3SERVMD, ONLY: EXTCDE !/S USE W3SERVMD, ONLY: STRACE ! IMPLICIT NONE !/ !/ ------------------------------------------------------------------- / !/ Parameter list !/ INTEGER, INTENT(IN) :: IMOD, NDSE, NDST, IBLOCK !/ !/ ------------------------------------------------------------------- / !/ Local parameters !/ INTEGER :: JGRID !/S INTEGER, SAVE :: IENT = 0 !/ !/S CALL STRACE (IENT, 'W3DMO5') ! ! -------------------------------------------------------------------- / ! 1. Test input and module status ! IF ( NGRIDS .EQ. -1 ) THEN WRITE (NDSE,1001) CALL EXTCDE (1) END IF ! IF ( IMOD.LT.1 .OR. IMOD.GT.NOUTP ) THEN WRITE (NDSE,1002) IMOD, NOUTP CALL EXTCDE (2) END IF ! !/T WRITE (NDST,9000) IMOD, IBLOCK ! ! -------------------------------------------------------------------- / ! 2. Allocate arrays and reset pointers ! SELECT CASE (IBLOCK) ! CASE (1) ! ALLOCATE ( OUTPTS(IMOD)%OUT5%IPBPI(NBI,4), & OUTPTS(IMOD)%OUT5%ISBPI(NBI) , & OUTPTS(IMOD)%OUT5%XBPI(NBI) , & OUTPTS(IMOD)%OUT5%YBPI(NBI) , & OUTPTS(IMOD)%OUT5%RDBPI(NBI,4), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! IPBPI => OUTPTS(IMOD)%OUT5%IPBPI ISBPI => OUTPTS(IMOD)%OUT5%ISBPI XBPI => OUTPTS(IMOD)%OUT5%XBPI YBPI => OUTPTS(IMOD)%OUT5%YBPI RDBPI => OUTPTS(IMOD)%OUT5%RDBPI ! OUTPTS(IMOD)%OUT5%O5INI1 = .TRUE. ! CASE (2) ! ALLOCATE ( OUTPTS(IMOD)%OUT5%IPBPO(NBO(NFBPO),4), & OUTPTS(IMOD)%OUT5%ISBPO(4*NBO(NFBPO)), & OUTPTS(IMOD)%OUT5%XBPO(NBO(NFBPO)) , & OUTPTS(IMOD)%OUT5%YBPO(NBO(NFBPO)) , & OUTPTS(IMOD)%OUT5%RDBPO(NBO(NFBPO),4), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! IPBPO => OUTPTS(IMOD)%OUT5%IPBPO ISBPO => OUTPTS(IMOD)%OUT5%ISBPO XBPO => OUTPTS(IMOD)%OUT5%XBPO YBPO => OUTPTS(IMOD)%OUT5%YBPO RDBPO => OUTPTS(IMOD)%OUT5%RDBPO ! OUTPTS(IMOD)%OUT5%O5INI2 = .TRUE. ! CASE (3) ! ALLOCATE ( OUTPTS(IMOD)%OUT5%ABPI0(NSPEC,0:NBI2), & OUTPTS(IMOD)%OUT5%ABPIN(NSPEC,0:NBI2), & OUTPTS(IMOD)%OUT5%BBPI0(NSPEC,0:NBI), & OUTPTS(IMOD)%OUT5%BBPIN(NSPEC,0:NBI), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! ABPI0 => OUTPTS(IMOD)%OUT5%ABPI0 ABPIN => OUTPTS(IMOD)%OUT5%ABPIN BBPI0 => OUTPTS(IMOD)%OUT5%BBPI0 BBPIN => OUTPTS(IMOD)%OUT5%BBPIN BBPI0 = -1. ! OUTPTS(IMOD)%OUT5%O5INI3 = .TRUE. ! CASE (4) ! ALLOCATE ( OUTPTS(IMOD)%OUT5%ABPOS(NSPEC,0:NBO2(NFBPO)), STAT=ISTAT ) CHECK_ALLOC_STATUS ( ISTAT ) ! ABPOS => OUTPTS(IMOD)%OUT5%ABPOS ! OUTPTS(IMOD)%OUT5%O5INI4 = .TRUE. ! CASE DEFAULT WRITE (NDSE,1010) CALL EXTCDE (10) ! END SELECT ! !/T WRITE (NDST,9001) ! ! -------------------------------------------------------------------- / ! RETURN ! ! Formats ! 1001 FORMAT (/' *** ERROR W3DMO5 : GRIDS NOT INITIALIZED *** '/ & ' RUN W3NMOD FIRST '/) 1002 FORMAT (/' *** ERROR W3DMO5 : ILLEGAL MODEL NUMBER *** '/ & ' IMOD = ',I10/ & ' NOUTP = ',I10/) 1010 FORMAT (/' *** ERROR W3DMO5 : ILLEGAL BLOCK NUMBER *** '/ & ' IBLOCK = ',I10/) ! !/T 9000 FORMAT (' TEST W3DMO5 : MODEL AND BLOCK ',2I4) !/T 9001 FORMAT (' TEST W3DMO5 : ARRAYS ALLOCATED') !/ !/ End of W3DMO5 ----------------------------------------------------- / !/ END SUBROUTINE W3DMO5 !/ ------------------------------------------------------------------- / SUBROUTINE W3SETO ( IMOD, NDSERR, NDSTST ) !/ !/ +-----------------------------------+ !/ | WAVEWATCH III NOAA/NCEP | !/ | H. L. Tolman | !/ | FORTRAN 90 | !/ | Last update : 12-Dec-2014 | !/ +-----------------------------------+ !/ !/ 13-Dec-2004 : Origination. ( version 3.06 ) !/ 06-Sep-2005 : Second storage for input bound. sp. ( version 3.08 ) !/ 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 ) !/ 27-Jul-2010 : Add NKI, NTHI, XFRI, FR1I, TH1I. ( version 3.14.3 ) !/ 19-Dec-2012 : Move NOSWLL to data structure. ( version 4.11 ) !/ 12-Dec-2014 : Modify instanciation of NRQTR ( version 5.04 ) !/ ! 1. Purpose : ! ! Select one of the WAVEWATCH III grids / models. ! ! 2. Method : ! ! Point pointers to the proper variables in the proper element of ! the GRIDS array. ! ! 3. Parameters : ! ! Parameter list ! ---------------------------------------------------------------- ! IMOD Int. I Model number to point to. ! NDSERR Int. I Error output unit number. ! NDSTST Int. I Test output unit number. ! ---------------------------------------------------------------- ! ! 4. Subroutines used : ! ! See module documentation below. ! ! 5. Called by : ! ! Many subroutines in the WAVEWATCH system. ! ! 6. Error messages : ! ! Checks on parameter list IMOD. ! ! 7. Remarks : ! ! 8. Structure : ! ! 9. Switches : ! ! !/MPI MPI specific calls. ! !/S Enable subroutine tracing. ! !/T Enable test output ! ! 10. Source code : ! !/ ------------------------------------------------------------------- / USE W3GDATMD, ONLY: NAUXGR USE W3SERVMD, ONLY: EXTCDE !/S USE W3SERVMD, ONLY: STRACE ! IMPLICIT NONE ! !/ !/ ------------------------------------------------------------------- / !/ Parameter list !/ INTEGER, INTENT(IN) :: IMOD, NDSERR, NDSTST !/ !/ ------------------------------------------------------------------- / !/ Local parameters !/ INTEGER :: NLOW !/S INTEGER, SAVE :: IENT = 0 !/ !/S CALL STRACE (IENT, 'W3SETO') ! ! -------------------------------------------------------------------- / ! 1. Test input and module status ! IF ( NOUTP .EQ. -1 ) THEN WRITE (NDSERR,1001) CALL EXTCDE (1) END IF ! NLOW = MIN ( 0 , -NAUXGR ) IF ( IMOD.LT.NLOW .OR. IMOD.GT.NOUTP ) THEN WRITE (NDSERR,1002) IMOD, NLOW, NOUTP CALL EXTCDE (2) END IF ! !/T WRITE (NDSTST,9000) IMOD ! ! -------------------------------------------------------------------- / ! 2. Set model number ! IOUTP = IMOD ! ! -------------------------------------------------------------------- / ! 3. Set pointers in structure OUTPUT ! NDSO => OUTPTS(IMOD)%NDSO NDSE => OUTPTS(IMOD)%NDSE NDST => OUTPTS(IMOD)%NDST SCREEN => OUTPTS(IMOD)%SCREEN ! NTPROC => OUTPTS(IMOD)%NTPROC NAPROC => OUTPTS(IMOD)%NAPROC IAPROC => OUTPTS(IMOD)%IAPROC NAPLOG => OUTPTS(IMOD)%NAPLOG NAPOUT => OUTPTS(IMOD)%NAPOUT NAPERR => OUTPTS(IMOD)%NAPERR NAPFLD => OUTPTS(IMOD)%NAPFLD NAPPNT => OUTPTS(IMOD)%NAPPNT NAPTRK => OUTPTS(IMOD)%NAPTRK NAPRST => OUTPTS(IMOD)%NAPRST NAPBPT => OUTPTS(IMOD)%NAPBPT NAPPRT => OUTPTS(IMOD)%NAPPRT ! NOSWLL => OUTPTS(IMOD)%NOSWLL ! TOFRST => OUTPTS(IMOD)%TOFRST TONEXT => OUTPTS(IMOD)%TONEXT TOLAST => OUTPTS(IMOD)%TOLAST TBPI0 => OUTPTS(IMOD)%TBPI0 TBPIN => OUTPTS(IMOD)%TBPIN NDS => OUTPTS(IMOD)%NDS ! DTOUT => OUTPTS(IMOD)%DTOUT FLOUT => OUTPTS(IMOD)%FLOUT ! IPASS1 => OUTPTS(IMOD)%OUT1%IPASS1 WRITE1 => OUTPTS(IMOD)%OUT1%WRITE1 !/MPI NRQGO => OUTPTS(IMOD)%OUT1%NRQGO !/MPI NRQGO2 => OUTPTS(IMOD)%OUT1%NRQGO2 !/MPI IF ( NRQGO .NE. 0 ) IRQGO => OUTPTS(IMOD)%OUT1%IRQGO !/MPI IF ( NRQGO2 .NE. 0 ) IRQGO2 => OUTPTS(IMOD)%OUT1%IRQGO2 FLOGRD => OUTPTS(IMOD)%OUT1%FLOGRD FLOGR2 => OUTPTS(IMOD)%OUT1%FLOGR2 FLOGD => OUTPTS(IMOD)%OUT1%FLOGD FLOG2 => OUTPTS(IMOD)%OUT1%FLOG2 ! IPASS2 => OUTPTS(IMOD)%OUT2%IPASS2 NOPTS => OUTPTS(IMOD)%OUT2%NOPTS !/MPI NRQPO => OUTPTS(IMOD)%OUT2%NRQPO !/MPI NRQPO2 => OUTPTS(IMOD)%OUT2%NRQPO2 O2INIT => OUTPTS(IMOD)%OUT2%O2INIT !/MPI O2IRQI => OUTPTS(IMOD)%OUT2%O2IRQI ! IF ( O2INIT ) THEN IPTINT => OUTPTS(IMOD)%OUT2%IPTINT IL => OUTPTS(IMOD)%OUT2%IL IW => OUTPTS(IMOD)%OUT2%IW II => OUTPTS(IMOD)%OUT2%II PTLOC => OUTPTS(IMOD)%OUT2%PTLOC PTIFAC => OUTPTS(IMOD)%OUT2%PTIFAC DPO => OUTPTS(IMOD)%OUT2%DPO WAO => OUTPTS(IMOD)%OUT2%WAO ZET_SETO => OUTPTS(IMOD)%OUT2%ZET_SETO WDO => OUTPTS(IMOD)%OUT2%WDO ASO => OUTPTS(IMOD)%OUT2%ASO CAO => OUTPTS(IMOD)%OUT2%CAO CDO => OUTPTS(IMOD)%OUT2%CDO ICEO => OUTPTS(IMOD)%OUT2%ICEO ICEHO => OUTPTS(IMOD)%OUT2%ICEHO ICEFO => OUTPTS(IMOD)%OUT2%ICEFO SPCO => OUTPTS(IMOD)%OUT2%SPCO PTNME => OUTPTS(IMOD)%OUT2%PTNME GRDID => OUTPTS(IMOD)%OUT2%GRDID END IF ! !/MPI IF ( O2IRQI ) THEN !/MPI IRQPO1 => OUTPTS(IMOD)%OUT2%IRQPO1 !/MPI IRQPO2 => OUTPTS(IMOD)%OUT2%IRQPO2 !/MPI END IF ! IPASS3 => OUTPTS(IMOD)%OUT3%IPASS3 !/MPI IT0PNT => OUTPTS(IMOD)%OUT3%IT0PNT !/MPI IT0TRK => OUTPTS(IMOD)%OUT3%IT0TRK !/MPI IT0PRT => OUTPTS(IMOD)%OUT3%IT0PRT !/MPI NRQTR => OUTPTS(IMOD)%OUT3%NRQTR !/MPI IF ( NRQTR .NE. 0 ) IRQTR => OUTPTS(IMOD)%OUT3%IRQTR O3INIT => OUTPTS(IMOD)%OUT3%O3INIT STOP => OUTPTS(IMOD)%OUT3%STOP ! IF ( O3INIT ) THEN MASK1 => OUTPTS(IMOD)%OUT3%MASK1 MASK2 => OUTPTS(IMOD)%OUT3%MASK2 TRCKID => OUTPTS(IMOD)%OUT3%TRCKID END IF ! IFILE4 => OUTPTS(IMOD)%OUT4%IFILE4 !/MPI NRQRS => OUTPTS(IMOD)%OUT4%NRQRS !/MPI NBLKRS => OUTPTS(IMOD)%OUT4%NBLKRS !/MPI RSBLKS => OUTPTS(IMOD)%OUT4%RSBLKS !/MPI IF ( NRQRS .NE. 0 ) THEN !/MPI IRQRS => OUTPTS(IMOD)%OUT4%IRQRS !/MPI IRQRSS => OUTPTS(IMOD)%OUT4%IRQRSS !/MPI VAAUX => OUTPTS(IMOD)%OUT4%VAAUX !/MPI END IF ! NBI => OUTPTS(IMOD)%OUT5%NBI NBI2 => OUTPTS(IMOD)%OUT5%NBI2 NFBPO => OUTPTS(IMOD)%OUT5%NFBPO !/MPI NRQBP => OUTPTS(IMOD)%OUT5%NRQBP !/MPI NRQBP2 => OUTPTS(IMOD)%OUT5%NRQBP2 NBO => OUTPTS(IMOD)%OUT5%NBO NBO2 => OUTPTS(IMOD)%OUT5%NBO2 NDSL => OUTPTS(IMOD)%OUT5%NDSL NKI => OUTPTS(IMOD)%OUT5%NKI NTHI => OUTPTS(IMOD)%OUT5%NTHI XFRI => OUTPTS(IMOD)%OUT5%XFRI FR1I => OUTPTS(IMOD)%OUT5%FR1I TH1I => OUTPTS(IMOD)%OUT5%TH1I FLBPI => OUTPTS(IMOD)%OUT5%FLBPI FLBPO => OUTPTS(IMOD)%OUT5%FLBPO FILER => OUTPTS(IMOD)%OUT5%FILER FILEW => OUTPTS(IMOD)%OUT5%FILEW FILED => OUTPTS(IMOD)%OUT5%FILED SPCONV => OUTPTS(IMOD)%OUT5%SPCONV O5INI1 => OUTPTS(IMOD)%OUT5%O5INI1 O5INI2 => OUTPTS(IMOD)%OUT5%O5INI2 O5INI3 => OUTPTS(IMOD)%OUT5%O5INI3 O5INI4 => OUTPTS(IMOD)%OUT5%O5INI4 ! IF ( O5INI1 ) THEN IPBPI => OUTPTS(IMOD)%OUT5%IPBPI ISBPI => OUTPTS(IMOD)%OUT5%ISBPI XBPI => OUTPTS(IMOD)%OUT5%XBPI YBPI => OUTPTS(IMOD)%OUT5%YBPI RDBPI => OUTPTS(IMOD)%OUT5%RDBPI END IF ! IF ( O5INI2 ) THEN IPBPO => OUTPTS(IMOD)%OUT5%IPBPO ISBPO => OUTPTS(IMOD)%OUT5%ISBPO XBPO => OUTPTS(IMOD)%OUT5%XBPO YBPO => OUTPTS(IMOD)%OUT5%YBPO RDBPO => OUTPTS(IMOD)%OUT5%RDBPO END IF ! IF ( O5INI3 ) THEN ABPI0 => OUTPTS(IMOD)%OUT5%ABPI0 ABPIN => OUTPTS(IMOD)%OUT5%ABPIN BBPI0 => OUTPTS(IMOD)%OUT5%BBPI0 BBPIN => OUTPTS(IMOD)%OUT5%BBPIN END IF ! IF ( O5INI4 ) THEN ABPOS => OUTPTS(IMOD)%OUT5%ABPOS END IF ! !/MPI IF ( NRQBP .NE. 0 ) IRQBP1 => OUTPTS(IMOD)%OUT5%IRQBP1 !/MPI IF ( NRQBP2 .NE. 0 ) IRQBP2 => OUTPTS(IMOD)%OUT5%IRQBP2 ! IPASS6 => OUTPTS(IMOD)%OUT6%IPASS6 IHMAX => OUTPTS(IMOD)%OUT6%IHMAX HSPMIN => OUTPTS(IMOD)%OUT6%HSPMIN WSMULT => OUTPTS(IMOD)%OUT6%WSMULT WSCUT => OUTPTS(IMOD)%OUT6%WSCUT IX0 => OUTPTS(IMOD)%OUT6%IX0 IXN => OUTPTS(IMOD)%OUT6%IXN IXS => OUTPTS(IMOD)%OUT6%IXS IY0 => OUTPTS(IMOD)%OUT6%IY0 IYN => OUTPTS(IMOD)%OUT6%IYN IYS => OUTPTS(IMOD)%OUT6%IYS ICPRT => OUTPTS(IMOD)%OUT6%ICPRT DTPRT => OUTPTS(IMOD)%OUT6%DTPRT FLCOMB => OUTPTS(IMOD)%OUT6%FLCOMB PTMETH => OUTPTS(IMOD)%OUT6%PTMETH PTFCUT => OUTPTS(IMOD)%OUT6%PTFCUT FLFORM => OUTPTS(IMOD)%OUT6%FLFORM O6INIT => OUTPTS(IMOD)%OUT6%O6INIT ! RETURN ! ! Formats ! 1001 FORMAT (/' *** ERROR W3SETO : GRIDS NOT INITIALIZED *** '/ & ' RUN W3NMOD FIRST '/) 1002 FORMAT (/' *** ERROR W3SETO : ILLEGAL MODEL NUMBER *** '/ & ' IMOD = ',I10/ & ' NLOW = ',I10/ & ' NOUTP = ',I10/) ! !/T 9000 FORMAT (' TEST W3SETO : MODEL ',I4,' SELECTED') !/ !/ End of W3SETO ----------------------------------------------------- / !/ END SUBROUTINE W3SETO !/ !/ End of module W3ODATMD -------------------------------------------- / !/ END MODULE W3ODATMD