WAVEWATCH III  beta 0.0.1
w3gridmd.F90
Go to the documentation of this file.
1 #include "w3macros.h"
2 !/ ------------------------------------------------------------------- /
3 MODULE w3gridmd
4  !/
5  !/ +-----------------------------------+
6  !/ | WAVEWATCH III NOAA/NCEP |
7  !/ | H. L. Tolman |
8  !/ | J. H. Alves |
9  !/ | F. Ardhuin |
10  !/ | FORTRAN 90 |
11  !/ | Last update : 27-May-2021 |
12  !/ +-----------------------------------+
13  !/
14  !/ 14-Jan-1999 : Final FORTRAN 77 ( version 1.18 )
15  !/ 27-Jan-2000 : Upgrade to FORTRAN 90 ( version 2.00 )
16  !/ Add UNFORMATTED bath file option.
17  !/ Read options with namelists.
18  !/ 14-Feb-2000 : Adding exact Snl ( version 2.01 )
19  !/ 04-May-2000 : Non central source term int. ( version 2.03 )
20  !/ 24-Jan-2001 : Flat grid option. ( version 2.06 )
21  !/ 02-Feb-2001 : Xnl version 3.0 ( version 2.07 )
22  !/ 09-Feb-2001 : Third propagation scheme added. ( version 2.08 )
23  !/ 27-Feb-2001 : O0 output switch added. ( version 2.08 )
24  !/ 16-Mar-2001 : Fourth propagation scheme added. ( version 2.09 )
25  !/ 29-Mar-2001 : Sub-grid island treatment. ( version 2.10 )
26  !/ 20-Jul-2001 : Clean up. ( version 2.11 )
27  !/ 12-Sep-2001 : Clean up. ( version 2.13 )
28  !/ 09-Nov-2001 : Clean up. ( version 2.14 )
29  !/ 11-Jan-2002 : Sub-grid ice treatment. ( version 2.15 )
30  !/ 17-Jan-2002 : DSII bug fix. ( version 2.16 )
31  !/ 09-May-2002 : Switch clean up. ( version 2.21 )
32  !/ 26-Nov-2002 : Adding first version of NL-3/4. ( version 3.01 )
33  !/ Removed before distribution in 3.12.
34  !/ 26-Dec-2002 : Relaxing CFL time step. ( version 3.02 )
35  !/ 01-Aug-2003 : Modify GSE correction for moving gr.( version 3.03 )
36  !/ Add offset option for first direction.
37  !/ 24-Dec-2004 : Multiple grid version. ( version 3.06 )
38  !/ 04-May-2005 : Allow active points at edge. ( version 3.07 )
39  !/ 07-Jul-2005 : Add MAPST2 and map processing. ( version 3.07 )
40  !/ 09-Nov-2005 : Remove soft boundary options. ( version 3.08 )
41  !/ 23-Jun-2006 : Adding alternative source terms. ( version 3.09 )
42  !/ Module W3SLN1MD, dummy for others.
43  !/ 28-Jun-2006 : Adding file name preamble. ( version 3.09 )
44  !/ 28-Oct-2006 : Spectral partitioning. ( version 3.09 )
45  !/ 09-Jan-2007 : Correct edges of read mask. ( version 3.10 )
46  !/ 26-Mar-2007 : Add to spectral partitioning. ( version 3.11 )
47  !/ 14-Apr-2007 : Add Miche style limiter. ( version 3.11 )
48  !/ ( J. H. Alves )
49  !/ 25-Apr-2007 : Battjes-Janssen Sdb added. ( version 3.11 )
50  !/ ( J. H. Alves )
51  !/ 18-Sep-2007 : Adding WAM4 physics option. ( version 3.13 )
52  !/ ( F. Ardhuin )
53  !/ 09-Oct-2007 : Adding bottom scattering SBS1. ( version 3.13 )
54  !/ ( F. Ardhuin )
55  !/ 22-Feb-2008 : Initialize TRNX-Y properly. ( version 3.13 )
56  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
57  !/ 23-Jul-2009 : Modification of ST3 namelist . ( version 3.14-SHOM )
58  !/ 31-Mar-2010 : Addition of shoreline reflection ( version 3.14-IFREMER )
59  !/ 29-Jun-2010 : Adding Stokes drift profile output ( version 3.14-IFREMER )
60  !/ 30-Aug-2010 : Adding ST4 option ( version 3.14-IFREMER )
61 
62  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
63  !/ (W. E. Rogers & T. J. Campbell, NRL)
64  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
65  !/ (W. E. Rogers & T. J. Campbell, NRL)
66  !/ 29-Oct-2010 : Clean up of unstructured grids ( version 3.14.4 )
67  !/ (A. Roland and F. Ardhuin)
68  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
69  !/ specify index closure for a grid. Change GLOBAL
70  !/ input in ww3_grid.inp to CSTRG. ( version 3.14 )
71  !/ (T. J. Campbell, NRL)
72  !/ 25-Jun-2011 : Adding movable bed friction ( version 4.01 )
73  !/ 16-Sep-2011 : Clean up. ( version 4.05 )
74  !/ 01-Dec-2011 : New namelist for reflection ( version 4.05 )
75  !/ 01-Mar-2012 : Bug correction for NLPROP in ST2 ( version 4.05 )
76  !/ 12-Jun-2012 : Add /RTD rotated grid option. JGLi ( version 4.06 )
77  !/ 13-Jul-2012 : Move data structures GMD (SNL3) and nonlinear
78  !/ filter (SNLS) from 3.15 (HLT). ( version 4.07 )
79  !/ 02-Sep-2012 : Clean up of reflection and UG grids ( version 4.08 )
80  !/ 12-Dec-2012 : Adding SMC grid. JG_Li ( version 4.08 )
81  !/ 19-Dec-2012 : Add NOSWLL as namelist variable. ( version 4.OF )
82  !/ 05-Mar-2013 : Adjusted default roughness for rocks( version 4.09 )
83  !/ 01-Jun-2013 : Adding namelist for spectral output ( version 4.10 )
84  !/ 12-Sep-2013 : Adding Arctic part for SMC grid. ( version 4.11 )
85  !/ 01-Nov-2013 : Changed UG list name to UNST ( version 4.12 )
86  !/ 11-Nov-2013 : Make SMC and RTD option compatible. ( version 4.13 )
87  !/ 13-Nov-2013 : Moved out reflection to W3UPDTMD ( version 4.12 )
88  !/ 27-Jul-2013 : Adding free infragravity waves ( version 4.15 )
89  !/ 02-Dec-2013 : Update of ST4 ( version 4.16 )
90  !/ 16-Feb-2014 : Adds wind bias correction: WCOR ( version 5.00 )
91  !/ 10-Mar-2014 : Adding namelist for IC2 ( version 5.01 )
92  !/ 29-May-2014 : Adding namelist for IC3 ( version 5.01 )
93  !/ 15 Oct-2015 : Change SMC grid input files. JGLi ( version 5.09 )
94  !/ 10-Jan-2017 : Changes for US3D and USSP ( version 6.01 )
95  !/ 20-Jan-2017 : Bug fix for mask input from file. ( version 6.02 )
96  !/ 01-Mar-2018 : RTD poles info read from namelist ( version 6.02 )
97  !/ 14-Mar-2018 : Option to read UNST boundary file ( version 6.02 )
98  !/ 26-Mar-2018 : Sea-point only Wnd/Cur input. JGLi ( version 6.02 )
99  !/ 15-May-2018 : Dry sea points over zlim ( version 6.04 )
100  !/ 06-Jun-2018 : add Implicit grid parameters for unstructured grids
101  !/ add DEBUGGRID/DEBUGSTP ( version 6.04 )
102  !/ 18-Aug-2018 : S_{ice} IC5 (Q. Liu) ( version 6.06 )
103  !/ 20-Jun-2018 : Update of ST6 (Q. Liu) ( version 6.06 )
104  !/ 26-Aug-2018 : UOST (Mentaschi et al. 2015, 2018) ( version 6.06 )
105  !/ 27-Aug-2018 : Add WBT parameter ( version 6.06 )
106  !/ 22-Jan-2020 : Update default values for IS2 ( version 7.05 )
107  !/ 20-Feb-2020 : Include Romero's dissipation in ST4 ( version 7.06 )
108  !/ 15-Apr-2020 : Adds optional opt-out for CFL on BC ( version 7.08 )
109  !/ 18-Jun-2020 : Adds 360-day calendar option ( version 7.08 )
110  !/ 24-Jun-2020 : RTD output b. c. to rotated grid. ( version 7.11 )
111  !/ 05-Jan-2021 : Update SMC grid for multi-grid. JGLi( version 7.13 )
112  !/ 27-May-2021 : Updates for IC5 (Q. Liu) ( version 7.12 )
113  !/ 27-May-2021 : Moved to a subroutine ( version 7.13 )
114  !/ 07-Jun-2021 : S_{nl} GKE NL5 (Q. Liu) ( version 7.13 )
115  !/ 19-Jul-2021 : Momentum and air density support ( version 7.14 )
116  !/ 28-Feb-2023 : GQM as an alternative for NL1 ( version 7.15 )
117  !/ 11-Jan-2024 : New namelist parameters for IC4 ( version 7.15 )
118  !/ 03-May-2024 : New CAPCHNK parameters for SIN4 ( version 7.15 )
119  !/
120  !/ Copyright 2009-2013 National Weather Service (NWS),
121  !/ National Oceanic and Atmospheric Administration. All rights
122  !/ reserved. WAVEWATCH III is a trademark of the NWS.
123  !/ No unauthorized use without permission.
124  !/
125  ! 1. Purpose :
126  !
127  ! "Grid" preprocessing subroutine, which writes a model definition
128  ! file containing the model parameter settigs and grid data.
129  !
130  ! 2. Method :
131  !
132  ! Information is read from the file ww3_grid.inp (NDSI), or
133  ! preset in this subroutine. A model definition file mod_def.ww3 is
134  ! then produced by W3IOGR. Note that the name of the model
135  ! definition file is set in W3IOGR.
136  !
137  ! 3. Parameters :
138  !
139  ! Local parameters.
140  ! ----------------------------------------------------------------
141  ! NDSI Int. Input unit number ("ww3_grid.inp").
142  ! NDSS Int. Scratch file.
143  ! NDSG Int. Grid unit ( may be NDSI )
144  ! NDSTR Int. Sub-grid unit ( may be NDSI or NDSG )
145  ! VSC Real Scale factor.
146  ! VOF Real Add offset.
147  ! ZLIM Real Limiting bottom depth, used to define land.
148  ! IDLA Int. Layout indicator used by INA2R.
149  ! IDFM Int. Id. FORMAT indicator.
150  ! RFORM C*16 Id. FORMAT.
151  ! FNAME C*60 File name with bottom level data.
152  ! FROM C*4 Test string for open, 'UNIT' or 'FILE'
153  ! ----------------------------------------------------------------
154  !
155  ! 4. Subroutines used :
156  !
157  ! Name Type Module Description
158  ! ----------------------------------------------------------------
159  ! W3NMOD Subr. W3GDATMD Set number of model.
160  ! W3SETG Subr. Id. Point to selected model.
161  ! W3DIMS Subr. Id. Set array dims for a spectral grid.
162  ! W3DIMX Subr. Id. Set array dims for a spatial grid.
163  ! W3GRMP Subr. W3GSRUMD Compute bilinear interpolation for point
164  ! W3NOUT Subr. W3ODATMD Set number of model for output.
165  ! W3SETO Subr. Id. Point to selected model for output.
166  ! W3DMO5 Subr. Id. Set array dims for output type 5.
167  ! ITRACE Subr. W3SERVMD Subroutine tracing initialization.
168  ! STRACE Subr. Id. Subroutine tracing.
169  ! NEXTLN Subr. Id. Get next line from input file
170  ! EXTCDE Subr. Id. Abort program as graceful as possible.
171  ! DISTAB Subr. W3DISPMD Make tables for solution of the
172  ! dispersion relation.
173  ! READNL Subr. Internal Read namelist.
174  ! INAR2R Subr. W3ARRYMD Read in an REAL array.
175  ! PRTBLK Subr. Id. Print plot of array.
176  ! W3IOGR Subr. W3IOGRMD Reading/writing model definition file.
177  ! ----------------------------------------------------------------
178  !
179  ! 5. Called by :
180  !
181  ! ww3_grid program
182  !
183  ! 6. Error messages :
184  !
185  ! 7. Remarks :
186  !
187  ! Physical grid :
188  ! -----------------
189  !
190  ! The physical grid is defined by a grid counter IX defining the
191  ! discrete longitude and IY defining the discrete latitude as shown
192  ! below. For mathemathical convenience, these grid axes will
193  ! generally be denoted as the X and Y axes. Two-dimensional arrays
194  ! describing parameters on this grid are given as A(IY,IX).
195  !
196  ! IY=NY
197  ! ^ | | | | | | ^ N
198  ! | |------|------|------|------|------|---- |
199  ! | | :: | 25 | 26 | 27 | 28 | --|--
200  ! |------|------|------|------|------|---- |
201  ! IY=3 | :: | :: | 9 | 10 | 11 | |
202  ! |------|------|------|------|------|----
203  ! IY=2 | :: | 1 | 2 | :: | 3 |
204  ! |------|------|------|------|------|----
205  ! IY=1 | :: | :: | :: | :: | :: |
206  ! +------+------+------+------+------+----
207  ! IX=1 IX=2 IX=3 IX=4 IX=5 ---> IX=NX
208  !
209  ! :: is a land point.
210  !
211  ! To reduce memory usage of the model, spectra are stored for sea
212  ! points only, in a one-dimensional grid with the length NSEA. This
213  ! grid is called the storage grid. The definition of the counter
214  ! in the storage grid is graphically depicted above. To transfer
215  ! data between the two grids, the maps MAPFS and MAPSF are
216  ! determined. MAPFS gives the counter of the storage grid ISEA
217  ! for every physical grid point (IY,IX), such that
218  !
219  ! MAPFS(IY,IX) = ISEA
220  !
221  ! ISEA = 0 corresponds to land points. The map MAPSF gives the grid
222  ! counters (IY,IX) for a given storage point ISEA.
223  !
224  ! MAPSF(ISEA,1) = IX
225  ! MAPSF(ISEA,2) = IY
226  ! MAPSF(ISEA,3) = IY+(IX-1)*NY ( filled during reading )
227  !
228  ! Finally, a status maps MAPSTA and MAPST2 are determined, where
229  ! the status indicator ISTAT = MAPSTA(IY,IX) determines the type
230  ! of the grid point.
231  !
232  ! ISTAT Means
233  ! ---------------------------------------------------
234  ! 0 Point excluded from grid.
235  ! (-)1 Sea point
236  ! (-)2 "Active" boundary point (data prescribed)
237  !
238  ! For ISTAT=0, the secondary status counter ISTA2 is defined as
239  !
240  ! ISTA2 Means
241  ! ---------------------------------------------------
242  ! 0 Land point.
243  ! 1 Point excluded from grid.
244  !
245  ! Negative values of ISTAT identify points that are temporarily
246  ! taken out of the computation. For these points ISTA2 are
247  ! defined per bit
248  !
249  ! BIT Means
250  ! ---------------------------------------------------
251  ! 1 Ice flag (1 = ice coverage)
252  ! 2 Dry flag (1 = dry point with depth 0)
253  ! 3 Inferred land in multi-grid model.
254  ! 4 Masking in multi-grid model.
255  ! 5 land point flag for relocatable grid.
256  !
257  ! Thus ISTA2=0 for ISTAT<0 is in error, ISTA2=1 means ice cover,
258  ! ISTA2=3 means ice on dry point, etc.
259  !
260  ! Spectral grid :
261  ! -----------------
262  !
263  ! In the spectral grid (and in physical space in general),
264  ! the cartesian convention for directions is used, i.e., the
265  ! direction 0 corresponds to waves propagating in the positive
266  ! X-direction and 90 degr. corresponds to waves propagating in
267  ! the positive Y-direction. Similar definitions are used for the
268  ! internal description of winds and currents. Output can obviously
269  ! be transformed according to any preferred convention.
270  !
271  ! ITH=NTH
272  ! ^ | | | | |
273  ! | |------|------|------|------|----
274  ! | | | | | | TH(3) = DTH*2.
275  ! |------|------|------|------|----
276  ! ITH=2 | | | | | TH(2) = DTH
277  ! |------|------|------|------|----
278  ! ITH=1 | | | | | TH(1) = 0.
279  ! +------+------+------+------+----
280  ! IK=1 IK=2 IK=3 IK=4 ---> IK=NK
281  !
282  ! The spectral grid consists of NK wavenumbers. The first
283  ! wavenumber IK=1 corresponds to the longest wave. The wavenumber
284  ! grid varies in space, as given by an invariant relative freq.
285  ! grid and the local depth. The spectral grid furthermore contains
286  ! NTH directions, equally spaced over a full circle. the first
287  ! direction corresponds to the direction 0, etc.
288  !
289  ! (Begin SMC description)
290  !
291  ! Spherical Multiple-Cell (SMC) grid
292  ! -----------------------------------
293  !
294  ! SMC grid is a multi-resolution grid using cells of multiple times
295  ! of each other. It is similar to the lat-lon grid using rectangular
296  ! cells but only cells at sea points are retained. All land points
297  ! have been removed from the model. At high latitudes, cells are
298  ! merged longitudinally to relax the CFL resctiction on time steps.
299  ! Near coastlines, cells are divided into quarters in a few steps so
300  ! that high resolution is achieved to refine coastlines and resolve
301  ! small islands. At present, three tiers of quarter cells are used.
302  ! For locating purpose, a usual x-y counter is setup by the smallest
303  ! cell size and starting from the south-west corner of the usual
304  ! rectuangular domain. Each sea cell is then given a pair of x-y
305  ! index, plus a pair of increments. These four index are stored in
306  ! the cell array IJKCel(4, NCel), each row holds i, j, di, dj, and
307  ! IJKDep holds ndps, where ndps is an integer depth in metre. If
308  ! precision higher than a metre is required, it may use other unit
309  ! (cm for instance) with a conversion factor.
310  !
311  ! For transport calculation, two face arrays, IJKUFc(7, NUFc) and
312  ! IJKVFc(7, NVFc), are also created to store the neighbouring cell
313  ! sequential numbers and the face location and size. The 3 arrays
314  ! are calculated outside the wave model and input from text files.
315  !
316  ! Boundary condition is added for SMC grid so that it can be used for
317  ! regional model as well. Most of the original boundary settings
318  ! are reclaimed as long as the boundary condition file is provided
319  ! by a lat-lon grid WW3 model, which will set the interpolation
320  ! parameters in the boundary condition file. The NBI number is
321  ! reset with an input value because the NX-Y double loop overcount
322  ! the boundary cells for merged cells in the SMC grid. ISBPI
323  ! boundary cell mapping array is fine as MAPFS uses duplicated cell
324  ! number in any merged cell. From there, all original NBI loops are
325  ! reusable.
326  !
327  ! The whole Arctic can be included in the SMC grid if ARCTC variable
328  ! is set to be .TRUE. within the SMC option. The ARCTC option appends
329  ! the polar Arctic part above 86N to the existing SMC grid and uses
330  ! a map-east reference direction for this extra polar region.
331  ! Because the map-east direction changes with latitude and longitude
332  ! the wave spectra defined to the map-east direction could not be
333  ! mixed up with the conventional spectra defined to the local east
334  ! direction. A rotation sub is provided for convertion from one to
335  ! another. Propagation part will be calculated together, including
336  ! the boundary cells. The boundary cells are then updated by
337  ! assigning the corresponding inner cells to them after conversion.
338  ! Boundary cells are duplicated northmost 4 rows of the global part
339  ! and they can be excluded for source term and output if required.
340  ! For convenience, Arctic cellls are all base level cells and are
341  ! appended to the end of the global cells. If refined cells were
342  ! used in the Arctic part, it would not be kept all together, making
343  ! the sub-loops much more complicated. If refined resolution cells
344  ! are required for a Arctic regional model, users may consider use
345  ! the rotated SMC grid options (RTD and SMC).
346  !
347  ! For more information about the SMC grid, please refer to
348  ! Li, J.G. (2012) Propagation of Ocean Surface Waves on a Spherical
349  ! Multiple-Cell Grid. J. Comput. Phys., 231, 8262-8277. online at
350  ! http://dx.doi.org/10.1016/j.jcp.2012.08.007
351  !
352  ! (End SMC description)
353  !
354  ! ICEWIND is the scale factor for reduction of wind input by ice
355  ! concentration. Value specified corresponds to the fractional
356  ! input for 100% ice concentration. Default is 1.0, meaning that
357  ! 100% ice concentration result in zero wind input.
358  ! Sin_in_ice=Sin_in_open_water * (1-ICE*ICEWIND)
359 
360  ! -----------------------------------------------------------------*
361  ! 8. Structure :
362  !
363  ! ----------------------------------------------------------------
364  ! 1. Set up grid storage structure.
365  ! ( W3NMOD , W3NOUT , W3SETG , W3SETO )
366  ! 2.a I-O setup.
367  ! b Print heading(s).
368  ! 3. Prepare int. table for dispersion relation ( DISTAB )
369  ! 4. Read and process input file up to spectrum.
370  ! a Get comment character
371  ! b Name of grid
372  ! c Define spectrum ( W3DIMS )
373  ! 5. Set-up discrete spectrum.
374  ! a Directions.
375  ! b Frequency for spectrum.
376  ! 6. Read and process input file up to numerical parameters
377  ! a Set model flags and time steps
378  ! b Set / select source term package
379  ! c Pre-process namelists.
380  ! d Wind input source term.
381  ! e Nonlinear interactions.
382  ! f Whitecapping term.
383  ! g Bottom friction source term.
384  ! h Depth indiced breaking source term.
385  ! i Triad interaction source term.
386  ! j Bottom scattering source term.
387  ! k Undefined source term.
388  ! l Set / select propagaton scheme
389  ! m Parameters for propagation scheme.
390  ! n Set misc. parameters (ice, seeding, ...)
391  ! o End of namelist processing
392  ! p Set various other variables
393  ! 7. Read and prepare grid.
394  ! a Layout of grid
395  ! b Storage of grid of grid
396  ! c Read bottom depths
397  ! d Set up temp map
398  ! e Subgrid information
399  ! 1 Info from input file
400  ! 2 Open file and check if necessary
401  ! 3 Read the data
402  ! 4 Limit
403  ! 8 Finalize status maps
404  ! a Determine where to get the data
405  ! Get data in parts from input file
406  ! ----------------------------------------------------
407  ! b Read and update TMPSTA with bound. and excl. points.
408  ! c Finalize excluded points
409  ! ----------------------------------------------------
410  ! Read data from file
411  ! ----------------------------------------------------
412  ! d Read data from file
413  ! ----------------------------------------------------
414  ! e Get NSEA and other counters
415  ! f Set up all maps ( W3DIMX )
416  ! 9. Prepare output boundary points.
417  ! a Read
418  ! b Update
419  ! 10. Write model definition file. ( W3IOGR )
420  ! ----------------------------------------------------------------
421  !
422  ! 9. Switches :
423  !
424  ! !/FLX1 Stresses according to Wu (1980).
425  ! !/FLX2 Stresses according to T&C (1996).
426  ! !/FLX3 Stresses according to T&C (1996) with cap on Cd.
427  ! !/FLX4 Stresses according to Hwang (2011).
428  ! !/FLX5 Direct use of stress from atmospheric model/input file.
429  !
430  ! !/LN0 No linear input source term.
431  ! !/SEED 'Seeding' of lowest frequency for sufficiently strong
432  ! winds. Proxi for linear input.
433  ! !/LN1 Cavaleri and Melanotte-Rizzoli with Tolman filter.
434  !
435  ! !/ST0 No source terms included (input/dissipation)
436  ! !/ST1 WAM-3 physics package.
437  ! !/ST2 Tolman and Chalikov (1996) physics package.
438  ! !/ST3 WAM 4+ source terms from P.A.E.M. Janssen and J-R. Bidlot
439  ! !/ST4 Input and dissipation using saturation following Ardhuin et al. (2009,2010)
440  ! Filipot & Ardhuin (2010) or Romero (2019)
441  ! !/ST6 BYDRZ source term package featuring Donelan et al.
442  ! (2006) input and Babanin et al. (2001,2010) dissipation.
443  !
444  ! !/NL0 No nonlinear interactions.
445  ! !/NL1 Discrete interaction approximation (DIA or GQM).
446  ! !/NL2 Exact interactions (WRT).
447  ! !/NL3 Generalized Multiple DIA (GMD).
448  ! !/NL4 Two Scale Approximation
449  ! !/NL5 Generalized Kinetic Equation (GKE)
450  ! !/NLS Snl based HF filter.
451  !
452  ! !/BT0 No bottom friction included.
453  ! !/BT1 JONSWAP bottom friction package.
454  ! !/BT4 SHOWEX bottom friction using movable bed roughness
455  ! (Tolman 1994, Ardhuin & al. 2003)
456  !
457  ! !/IC1 Sink term for interaction with ice (uniform k_i)
458  ! !/IC2 Sink term for under-ice boundary layer friction
459  ! (Liu et al. 1991: JGR 96 (C3), 4605-4621)
460  ! (Liu and Mollo 1988: JPO 18 1720-1712)
461  ! !/IC3 Sink term for interaction with ice (Wang and Shen method)
462  ! (Wang and Shen JGR 2010)
463  ! !/IC4 Sink term for empirical, frequency-dependent attenuation
464  ! in ice (Wadhams et al. 1988: JGR 93 (C6) 6799-6818)
465  ! !/IC5 Sink term for interaction with ice (effective medium mod.)
466  ! (Mosig et al. 2015, Meylan et al. 2018, Liu et al.
467  ! 2020)
468  !
469  ! !/UOST Unresolved Obstacles Source Term (UOST), Mentaschi et al. 2015
470  !
471  ! !/DB0 No depth-induced breaking included.
472  ! !/DB1 Battjes-Janssen depth-limited breaking.
473  ! !/MLIM Mich-style limiter.
474  !
475  ! !/TR0 No triad interactions included.
476  !
477  ! !/BS0 No bottom scattering included.
478  ! !/BS1 Routines from F. Ardhuin.
479  !
480  ! !/PR1 First order propagation scheme.
481  ! !/PR2 QUICKEST scheme with ULTIMATE limite and diffusion
482  ! correction for swell dispersion.
483  ! !/PR3 Averaging ULTIMATE QUICKEST scheme.
484  !
485  ! !/RTD Rotated regular lat-lon grid. Special case is standard Polat=90.
486  ! !/SMC Spherical Multiple-Cell grid, may includes the whole Arctic.
487  !
488  ! !/MGG GSE correction for moving grid.
489  !
490  ! !/S Enable subroutine tracing.
491  ! !/T Enable test output.
492  ! !/T0 Enable test output tables for boundary output.
493  !
494  ! !/O0 Print equivalent namelist setting to std out.
495  ! !/O1 Print tables with boundary points as part of output.
496  ! !/O2 Print MAPSTA as part of output.
497  ! !/O2a Print land-sea mask in mask.ww3.
498  ! !/O2b Print obstruction data.
499  ! !/O2c Print extended status map.
500  !
501  ! 10. Source code :
502  !
503  !/ ------------------------------------------------------------------- /
504  USE constants
505  !/
506  USE w3triamd
507  USE w3gsrumd, ONLY: w3grmp
508  USE w3odatmd, ONLY: w3nout, w3seto, w3dmo5
509  USE w3iogrmd, ONLY: w3iogr
510  USE w3servmd, ONLY: itrace, nextln, extcde
511 #ifdef W3_RTD
512  USE w3servmd, ONLY: w3eqtoll, w3lltoeq
513 #endif
514 #ifdef W3_SMC
515  USE w3servmd, ONLY: w3lltoeq
516 #endif
517 #ifdef W3_S
518  USE w3servmd, ONLY: strace
519 #endif
520  USE w3arrymd, ONLY: ina2r, ina2i
521 #ifdef W3_T
522  USE w3arrymd, ONLY: prtblk
523 #endif
524  USE w3dispmd, ONLY: distab
525  !/
526  USE w3gdatmd
527  USE w3odatmd, ONLY: ndse, ndst, ndso
528  USE w3odatmd, ONLY: nbi, nbi2, nfbpo, nbo, nbo2, flbpi, flbpo, &
529  ipbpo, isbpo, xbpo, ybpo, rdbpo, fnmpre, &
532  USE w3timemd, ONLY: caltype
533  USE w3nmlgridmd
534 #ifdef W3_SCRIP
535  USE scrip_grids, ONLY: grid1_units, grid1_name, &
539  grid1_imask, &
541  USE scrip_kindsmod
542  USE wmscrpmd
543 #endif
544 #ifdef W3_SCRIPNC
545  USE netcdf
546 #endif
547  !
548 #ifdef W3_NL3
549  USE w3snl3md, ONLY: lammax, delthm
550 #endif
551 #ifdef W3_NLS
552  USE w3snlsmd, ONLY: abmax
553 #endif
554  !
555  IMPLICIT NONE
556  !/
557  !/ ------------------------------------------------------------------- /
558  !/ Local parameters
559  !/
574  TYPE(nml_inbnd_point_t), ALLOCATABLE :: nml_inbnd_point(:)
576  TYPE(nml_excl_point_t), ALLOCATABLE :: nml_excl_point(:)
577  TYPE(nml_excl_body_t), ALLOCATABLE :: nml_excl_body(:)
579  TYPE(nml_outbnd_line_t), ALLOCATABLE :: nml_outbnd_line(:)
580  !
581  INTEGER, PARAMETER :: nfl = 6
582  INTEGER :: ndsi, ndsi2, ndss, ndsm, ndsg, ndstr,&
583  ierr, ndstrc, ntrace, ith, ik, ith0, &
584  isp, iyn(nfl), nrlin, nrsrce, nrnl, &
585  nrbt, nrdb, nrtr, nrbs, nrprop, &
586  idla, idfm, ix0, ixn, ix, iy, isea, &
587  idx, ixo, idy, iyo, iba, nba, iloop, &
588  ifl, nbotot, npo, ip, ix1, ix2, iy1, &
589  iy2, j, jj, ixr(4), iyr(4), iseai(4),&
590  ist, nki, nthi, nric, nris, i, idft, &
592 #ifdef W3_ASCII
593  INTEGER :: ndsma
594 #endif
595 #ifdef W3_NL2
596  INTEGER :: idepth
597 #endif
598 #ifdef W3_O1
599  INTEGER :: ibi, ip0, ipn, iph, ipi
600 #endif
601  INTEGER :: ncol = 78
602 #ifdef W3_SMC
603  !!Li Offset to change Equator index = 0 to regular index JEQT
604  !!Li LvSMC levels of refinded resolutions for SMC grid.
605  !!Li NBISMC number of boundary point for regional SMC grid.
606  !!Li ISHFT for SMC i-index from smc origin to regular grid west edge.
607  !!Li SMC cell only subgrid obstruction array dimensions NCObst, JObs.
608  INTEGER :: jeqt, lvsmc, nbismc, js, ncobst, jobs, ishft
609  INTEGER :: ngui, ngvj, naui, navj
610 #endif
611  !
612 #ifdef W3_O2
613  INTEGER :: nmap, imap
614 #endif
615 #ifdef W3_T
616  INTEGER :: ix3, iy3
617 #endif
618 #ifdef W3_T0
619  INTEGER :: ifile
620 #endif
621 #ifdef W3_S
622  INTEGER, SAVE :: ient = 0
623 #endif
624  !
625  INTEGER, ALLOCATABLE :: tmpsta(:,:), tmpmap(:,:), readmp(:,:)
626 #ifdef W3_T
627  INTEGER, ALLOCATABLE :: mapout(:,:)
628 #endif
629  !
630  REAL :: rxfr, rfr1, sigma, sxfr, fachf, &
631  vsc, vsc0, vof, &
632  zlim, x, y, xp, xo0, yo0, dxo, dyo, &
633  xo, yo, rd(4), rdtot, &
634  factor, rth0, fmiche, rwndc, &
635  wcor1, wcor2
636  !
637  CHARACTER(LEN=4) :: gstrg, cstrg
638  !
639  ! Variables used to allow spectral output on full grid
640  !
641  INTEGER :: p2sf,i1p2sf,i2p2sf
642  INTEGER :: e3d,i1e3d,i2e3d
643  INTEGER :: us3d,i1us3d,i2us3d, &
644  ussp, iussp, &
645  th1mf, i1th1m, i2th1m, &
646  sth1mf, i1sth1m, i2sth1m, &
647  th2mf, i1th2m, i2th2m, &
649  ! STK_WN are the decays for Stokes drift partitions
650  REAL :: stk_wn(25)
651 
652  !
653 #ifdef W3_LN1
654  REAL :: clin, rfpm, rfhf
655 #endif
656 #ifdef W3_ST1
657  REAL :: cinp, cdis, apm
658 #endif
659 #ifdef W3_ST2
660  REAL :: phimin, fpia, fpib, dphid
661 #endif
662 #ifdef W3_NL1
663  REAL :: nlprop
664 #endif
665 #ifdef W3_NL2
666  REAL :: dptfac, depths(100)
667 #endif
668 #ifdef W3_NL3
669  REAL :: qparms(500)
670 #endif
671 #ifdef W3_NLS
672  REAL :: a34, fhfc, dnm, fc1, fc2, fc3
673 #endif
674 #ifdef W3_BT1
675  REAL :: gamma
676 #endif
677 #ifdef W3_PR2
678  REAL :: latmin
679 #endif
680  !
681 #ifdef W3_SMC
682  REAL :: dvsmc
683  REAL :: trnmx, trnmy
684  INTEGER, ALLOCATABLE :: nlvcelsk(:), nlvufcsk(:), nlvvfcsk(:)
685  INTEGER, ALLOCATABLE :: ijkcelin(:,:),ijkufcin(:,:),ijkvfcin(:,:)
686  INTEGER, ALLOCATABLE :: nbicelin(:), ijkobstr(:,:)
687  REAL :: polonac, polatac
688  INTEGER, ALLOCATABLE :: ijkcelac(:,:),ijkufcac(:,:),ijkvfcac(:,:)
689  INTEGER, ALLOCATABLE :: ijkdep(:), ijkvfc8(:)
690  REAL, ALLOCATABLE :: xlonac(:),ylatac(:),elonac(:),elatac(:)
691 #endif
692  !
693 #ifdef W3_RTD
694  REAL, ALLOCATABLE :: angldin(:,:),stdlon(:,:),stdlat(:,:)
695  ! 1-dim boundary sectors
696  REAL, ALLOCATABLE :: bdylon(:), bdylat(:), &
697  elatbdy(:), elonbdy(:), anglbdy(:)
698  ! If the destination grid for an output b.c. is rotated, its pole is:
699  REAL :: bpolat, bpolon
700  !
701 #endif
702  REAL, ALLOCATABLE :: xgrdin(:,:), ygrdin(:,:)
703  REAL, ALLOCATABLE :: zbin(:,:), obsx(:,:), obsy(:,:)
704  REAL, ALLOCATABLE :: refd(:,:), refd2(:,:), refs(:,:)
705 #ifdef W3_BT4
706  REAL, ALLOCATABLE :: sed_d50file(:,:), sed_porofile(:,:)
707  LOGICAL :: sedmapd50
711 #endif
712  !
713  LOGICAL :: fllin, flinds, flnl, flbt, fldb, &
714  fltr, flbs, flprop, flref, &
716  flis, flgnml
717  LOGICAL :: fltc96 = .false.
718  LOGICAL :: flnmlo = .false.
719  LOGICAL :: flstb2 = .false.
720  LOGICAL :: flst4 = .false.
721  LOGICAL :: flst6 = .false.
722 
723  REAL :: facberg, refslope
724 #ifdef W3_IS1
725  REAL :: isc1, isc2
726 #endif
727 #ifdef W3_IS2
734  LOGICAL :: is2break, is2disp, is2dupdate, &
736 #endif
737  !
738 #ifdef W3_REF1
739  REAL :: refcoast, reffreq, refmap, &
743 #endif
744  !
745 #ifdef W3_IG1
747  INTEGER :: igmethod, igaddoutp, igsource, &
751 #endif
752  !
753 #ifdef W3_IC2
754  LOGICAL :: ic2disper
757 #endif
758 
759 #ifdef W3_IC3
762  ic3maxthk, ic3maxcnc, &
763  ic3hilim, ic3kilim, &
765  LOGICAL :: ic3cheng,usecgice
766 #endif
767 
768 #ifdef W3_IC4
769  INTEGER :: ic4method
770  REAL :: ic4ki(nic4), ic4fc(nic4), &
772 #endif
773 
774 #ifdef W3_IC5
775  REAL :: ic5minig, ic5minwt, &
778  ic5vemod
779  CHARACTER(LEN=4) :: ic5mstr(3) = (/' EFS', ' RP ', ' M2 '/)
780 #endif
781 
782  CHARACTER :: comstr*1, pname*30, rform*16, &
783  from*4, fname*60, tname*60, line*80, &
784  status*20,fname2*60, pname2*40
785  CHARACTER(LEN=6) :: yesxno(2)
786 #ifdef W3_FLX3
787  CHARACTER(LEN=18) :: typeid
788 #endif
789 
790 #ifdef W3_SCRIP
791  INTEGER :: ncid
796  INTEGER :: grid_dims_varid
798 #endif
799 
800  !/ ------------------------------------------------------------------- /
801  !/ Namelists
802  !/
803  INTEGER :: flagtr, ihm
804  REAL :: cfltm, cice0, cicen, pmove, xfilt, &
805  lice, xseed, xr, hspm, wsm, wsc, stdx,&
809  !
810  REAL(8) :: gshift ! see notes in WMGHGH
811  LOGICAL :: flc, icedisp, trckcmpr
812  INTEGER :: ptm ! Partitioning method
813  REAL :: ptfc ! Part. cut off freq (for method 5)
814  REAL :: aircmin, airgb
815  CHARACTER :: pmname*45, pmnam2*45 ! Part. method desc.
816 #ifdef W3_FLD1
817  INTEGER :: tailtype
819 #endif
820 #ifdef W3_FLD2
821  INTEGER :: tailtype
822  REAL :: taillev, tailt1, tailt2
823 #endif
824 #ifdef W3_FLX3
825  INTEGER :: ctype
826  REAL :: cdmax
827 #endif
828 #ifdef W3_FLX4
829  REAL :: cdfac
830 #endif
831 #ifdef W3_ST2
832  REAL :: zwnd, swellf, stabsh, stabof, &
833  cneg, cpos, fneg, fpos
834  REAL :: sdsa0, sdsa1, sdsa2, &
836 #endif
837 #ifdef W3_ST3
839  zalp, swellf, fxpm3, fxfm3, &
841  REAL :: stxftftail, sdsc1, &
843 #endif
844  !
845 #ifdef W3_ST4
847  tauwbug
848  REAL :: sdsbchoice
852  swellf6, swellf7, fxpm3, fxfm3, &
854  stxftwn, sinbr, fxfmage, &
857  sdsbr, sdsp, sdsbt, sds4a, sdkof, &
858  sdscos, sdsdth, sdsbck, sdsabk, &
859  sdspbk, sdsbint, sdshck, &
860  sdsbrf1, &
861  sdsbm0, sdsbm1, sdsbm2, sdsbm3, &
864  cumsigp, viscstress, &
866 #endif
867  !
868 #ifdef W3_ST6
869  REAL :: sina0, sinws, sinfc, &
870  sdsa1, sdsa2, swlb1
871  INTEGER :: sdsp1, sdsp2
872  LOGICAL :: sdset, cstb1
873 #endif
874  !
875 #ifdef W3_NL1
876  REAL :: lambda, kdconv, kdmin, &
880 #endif
881 #ifdef W3_NL2
882  INTEGER :: iqtype, ndepth
883  REAL :: tailnl
884 #endif
885 #ifdef W3_NL3
886  INTEGER :: nqdef
887  REAL :: msc, nsc, kdfd, kdfs
888 #endif
889 #ifdef W3_NL4
890  INTEGER :: indtsa, altlp
891 #endif
892 #ifdef W3_NL5
893  REAL :: nl5dpt, nl5oml
894  INTEGER :: nl5dis, nl5kev, nl5ipl, nl5pmx
895 #endif
896 #ifdef W3_DB1
897  REAL :: bjalfa, bjgam
898  LOGICAL :: bjflag
899 #endif
900 #ifdef W3_PR2
901  REAL :: dtime
902 #endif
903  !
904 #ifdef W3_SMC
905  REAL :: dtims, cflsm, rfmaxd, symr, yj0r
906  LOGICAL :: uno3, averg, seawnd, arctic
907  CHARACTER :: pnsmc*30
908 #endif
909  !
910 #ifdef W3_PR3
911  REAL :: wdthcg, wdthth
912 #endif
916  LOGICAL :: jgs_limiter
917  INTEGER :: jgs_limiter_func
919  LOGICAL :: jgs_use_jacobi
921  LOGICAL :: ugobcauto
922  LOGICAL :: ugbccfl
923  LOGICAL :: expfsn
924  LOGICAL :: expfspsi
925  LOGICAL :: expfsfct
926  LOGICAL :: impfsn
927  LOGICAL :: exptotal
928  LOGICAL :: imptotal
929  LOGICAL :: imprefraction
930  LOGICAL :: impfreqshift
931  LOGICAL :: impsource
932  LOGICAL :: setup_apply_wlv
933  INTEGER :: jgs_maxiter
934  INTEGER :: nbsel
935  INTEGER :: unstschemes(6)
936  INTEGER :: unstscheme
937  INTEGER :: jgs_nlevel
938  real*8 :: jgs_pmin
939  real*8 :: jgs_diff_thr
940  real*8 :: jgs_norm_thr
941  real*8 :: solverthr_setup
942  real*8 :: crit_dep_setup
943  !
944  CHARACTER :: ugobcfile*60
945  REAL :: ugobcdepth
946  LOGICAL :: ugobcok
947 
948 #ifdef W3_RTD
949  REAL :: plat, plon
950  LOGICAL :: unrot
951  ! Poles of the output nested grids. May be a mix of rotated and standard
952  REAL, DIMENSION(9) :: bplat, bplon
953 #endif
954  !
955 #ifdef W3_FLD1
956  namelist /fld1/ tailtype, taillev, tailt1, tailt2
957 #endif
958 #ifdef W3_FLD2
959  namelist /fld2/ tailtype, taillev, tailt1, tailt2
960 #endif
961 #ifdef W3_FLX3
962  namelist /flx3/ cdmax, ctype
963 #endif
964 #ifdef W3_FLX4
965  namelist /flx4/ cdfac
966 #endif
967 #ifdef W3_IC2
968  namelist /sic2/ ic2disper, ic2turb, ic2rough, ic2reynolds, &
970 #endif
971 #ifdef W3_IC3
972  namelist /sic3/ ic3maxthk, ic2turb, ic2rough, ic2reynolds, &
976 #endif
977 #ifdef W3_IC4
978  namelist /sic4/ ic4method, ic4ki, ic4fc, ic4cn, ic4fmin, &
979  ic4kibk
980 #endif
981 #ifdef W3_IC5
982  namelist /sic5/ ic5minig, ic5minwt, ic5maxkratio, &
985 #endif
986 #ifdef W3_IG1
987  namelist /sig1/ igmethod, igaddoutp, igsource, igbcoverwrite, &
990 #endif
991 #ifdef W3_LN1
992  namelist /sln1/ clin, rfpm, rfhf
993 #endif
994 #ifdef W3_ST1
995  namelist /sin1/ cinp
996 #endif
997 #ifdef W3_ST2
998  namelist /sin2/ zwnd, swellf, stabsh, stabof, cneg, cpos, fneg
999 #endif
1000 #ifdef W3_ST3
1001  namelist /sin3/ zwnd, alpha0, z0max, betamax, sinthp, zalp, &
1002  swellf
1003 #endif
1004 #ifdef W3_ST4
1005  namelist /sin4/ zwnd, alpha0, z0max, betamax, sinthp, zalp, &
1010 #endif
1011 #ifdef W3_NL1
1012  namelist /snl1/ lambda, nlprop, kdconv, kdmin, &
1013  snlcs1, snlcs2, snlcs3, &
1014  iqtype, tailnl, gqmnf1, gqmnt1, &
1016 #endif
1017 #ifdef W3_NL2
1018  namelist /snl2/ iqtype, tailnl, ndepth
1019  namelist /anl2/ depths
1020 #endif
1021 #ifdef W3_NL3
1022  namelist /snl3/ nqdef, msc, nsc, kdfd, kdfs
1023  namelist /anl3/ qparms
1024 #endif
1025 #ifdef W3_NL4
1026  namelist /snl4/ indtsa, altlp
1027 #endif
1028 #ifdef W3_NL5
1029  namelist /snl5/ nl5dpt, nl5oml, nl5dis, nl5kev, nl5ipl, nl5pmx
1030 #endif
1031 #ifdef W3_NLS
1032  namelist /snls/ a34, fhfc, dnm, fc1, fc2, fc3
1033 #endif
1034 #ifdef W3_ST1
1035  namelist /sds1/ cdis, apm
1036 #endif
1037 #ifdef W3_ST2
1038  namelist /sds2/ sdsa0, sdsa1, sdsa2, sdsb0, sdsb1, phimin
1039 #endif
1040 #ifdef W3_ST3
1041  namelist /sds3/ sdsc1, wnmeanp, fxpm3, fxfm3, sdsdelta1, &
1042  sdsdelta2
1043 #endif
1044 #ifdef W3_ST4
1045  namelist /sds4/ sdsbchoice, wnmeanp, wnmeanptail, fxpm3, fxfm3, &
1048  sdsc5, sdsc6, sdsbr, sdsbt, sdsp, sdsiso, &
1053 #endif
1054 
1055 #ifdef W3_ST6
1056  namelist /sin6/ sina0, sinws, sinfc
1057  namelist /sds6/ sdset, sdsa1, sdsa2, sdsp1, sdsp2
1058  namelist /swl6/ swlb1, cstb1
1059 #endif
1060 #ifdef W3_BT1
1061  namelist /sbt1/ gamma
1062 #endif
1063 #ifdef W3_BT4
1064  namelist /sbt4/ sedmapd50, sed_d50_uniform, ripfac1, &
1067 #endif
1068 #ifdef W3_DB1
1069  namelist /sdb1/ bjalfa, bjgam, bjflag
1070 #endif
1071 #ifdef W3_UOST
1072  namelist /uost/ uostfilelocal, uostfileshadow, &
1074 #endif
1075  !
1076 #ifdef W3_PR1
1077  namelist /pro1/ cfltm
1078 #endif
1079 #ifdef W3_PR2
1080  namelist /pro2/ cfltm, dtime, latmin
1081 #endif
1082 #ifdef W3_SMC
1083  namelist /psmc/ cflsm, dtims, rfmaxd, arctic, averg, uno3, &
1085 #endif
1086  !
1087 #ifdef W3_PR3
1088  namelist /pro3/ cfltm, wdthcg, wdthth
1089 #endif
1090  namelist /unst/ ugobcauto, ugobcdepth, ugobcfile, &
1092  impfsn, imptotal, exptotal, &
1094  impsource, &
1098  jgs_limiter, &
1099  jgs_limiter_func, &
1100  jgs_use_jacobi, &
1102  jgs_maxiter, &
1103  jgs_pmin, &
1104  jgs_diff_thr, &
1105  jgs_norm_thr, &
1106  jgs_nlevel, &
1110  namelist /misc/ cice0, cicen, lice, xseed, flagtr, xp, xr, &
1111  xfilt, pmove, ihm, hspm, wsm, wsc, flc, fmiche, &
1116  trckcmpr, ptm, ptfc, btbet
1117  namelist /outs/ p2sf, i1p2sf, i2p2sf, &
1118  us3d, i1us3d, i2us3d, &
1119  ussp, iussp, stk_wn, &
1120  e3d, i1e3d, i2e3d, &
1121  th1mf, i1th1m, i2th1m, &
1122  sth1mf, i1sth1m, i2sth1m, &
1123  th2mf, i1th2m, i2th2m, &
1125 #ifdef W3_IS1
1126  namelist /sis1/ isc1, isc2
1127 #endif
1128 #ifdef W3_IS2
1129  namelist /sis2/ isc1, is2c2, is2c3, is2backscat, is2isoscat, is2break, &
1134  is2andisn
1135 #endif
1136 #ifdef W3_REF1
1137  namelist /ref1/ refcoast, reffreq, refmap, refmapd, &
1141 #endif
1142  !/
1143 #ifdef W3_RTD
1144  namelist /rotd/ plat, plon, unrot
1145  ! Poles of destination grids for boundary conditions output
1146  namelist /rotb/ bplat, bplon
1147 #endif
1148  !/
1149  !/ ------------------------------------------------------------------- /
1150  !/
1151  DATA yesxno / 'YES/--' , '---/NO' /
1152 
1153 CONTAINS
1154 
1155  SUBROUTINE w3grid()
1157 #ifdef W3_O0
1158  flnmlo = .true.
1159 #endif
1160 #ifdef W3_STAB2
1161  flstb2 = .true.
1162 #endif
1163  !
1164  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1165  ! 1. Set up grid storage structure
1166  !
1167  CALL w3nmod ( 1, 6, 6 )
1168  CALL w3setg ( 1, 6, 6 )
1169  CALL w3nout ( 6, 6 )
1170  CALL w3seto ( 1, 6, 6 )
1171  !
1172  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1173  ! 2. IO set-up.
1174  !
1175  ndsi = 10
1176  ndss = 99
1177  ndsm = 20
1178  !
1179  INQUIRE(file=trim(fnmpre)//"ww3_grid.nml", exist=flgnml)
1180  IF (flgnml) THEN
1181  ! Read namelist
1182  CALL w3nmlgrid (ndsi, trim(fnmpre)//'ww3_grid.nml', nml_spectrum, nml_run, &
1189  ELSE
1190  OPEN (ndsi,file=trim(fnmpre)//'ww3_grid.inp',status='OLD', &
1191  err=2000,iostat=ierr)
1192  END IF
1193  !
1194  ndstrc = 6
1195  ntrace = 10
1196  CALL itrace ( ndstrc, ntrace )
1197  !
1198 #ifdef W3_S
1199  CALL strace (ient, 'W3GRID')
1200 #endif
1201  WRITE (ndso,900)
1202  !
1203  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1204  ! 3.a Interpolation table for dispersion relation.
1205  !
1206  CALL distab
1207  !
1208  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1209  ! 3.b Table for friction factors
1210  !
1211  CALL tabu_fw
1212  !
1213  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1214  ! 4 Read and process input file up to spectrum
1215  !
1216 
1217  IF (flgnml) THEN
1218  ! grid name
1219  gname=trim(nml_grid%NAME)
1220  WRITE (ndso,902) gname
1221 
1222  ! spectrum parameters
1223  rxfr=nml_spectrum%XFR
1224  rfr1=nml_spectrum%FREQ1
1225  nki=nml_spectrum%NK
1226  nthi=nml_spectrum%NTH
1227  rth0=nml_spectrum%THOFF
1228 
1229  ELSE
1230 
1231  READ (ndsi,'(A)',END=2001,ERR=2002,IOSTAT=IERR) comstr
1232  IF (comstr.EQ.' ') comstr = '$'
1233  WRITE (ndso,901) comstr
1234  CALL nextln ( comstr , ndsi , ndse )
1235  !
1236  CALL nextln ( comstr , ndsi , ndse )
1237  READ (ndsi,*,END=2001,ERR=2002) gname
1238  WRITE (ndso,902) gname
1239  !
1240  CALL nextln ( comstr , ndsi , ndse )
1241  READ (ndsi,*,END=2001,ERR=2002) RXFR, RFR1, NKI, NTHI, rth0
1242  END IF
1243 
1244 
1245  nk = nki
1246  nk2 = nki + 2
1247  nth = nthi
1248  nspec = nk * nth
1249  xfr = max( rxfr , 1.00001 )
1250  fr1 = max( rfr1 , 1.e-6 )
1251  dth = tpi / real(nth)
1252  rth0 = max( -0.5 , min( 0.5 , rth0 ) )
1253  WRITE (ndso,903) nth, dth*rade
1254  WRITE (ndso,904) 360./real(nth)*rth0
1255  WRITE (ndso,905) nk, fr1, fr1*xfr**(nk-1), xfr
1256  !
1257  CALL w3dims ( 1, nk, nth, ndse, ndst )
1258  !
1259  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1260  ! 5. Initialize spectral parameters.
1261  ! 5.a Directions :
1262  !
1263  DO ith=1, nth
1264  th(ith) = dth * ( rth0 + real(ith-1) )
1265  esin(ith) = sin( th(ith) )
1266  ecos(ith) = cos( th(ith) )
1267  IF ( abs(esin(ith)) .LT. 1.e-5 ) THEN
1268  esin(ith) = 0.
1269  IF ( ecos(ith) .GT. 0.5 ) THEN
1270  ecos(ith) = 1.
1271  ELSE
1272  ecos(ith) = -1.
1273  END IF
1274  END IF
1275  IF ( abs(ecos(ith)) .LT. 1.e-5 ) THEN
1276  ecos(ith) = 0.
1277  IF ( esin(ith) .GT. 0.5 ) THEN
1278  esin(ith) = 1.
1279  ELSE
1280  esin(ith) = -1.
1281  END IF
1282  END IF
1283  es2(ith) = esin(ith)**2
1284  ec2(ith) = ecos(ith)**2
1285  esc(ith) = esin(ith)*ecos(ith)
1286  END DO
1287  !
1288  DO ik=2, nk+1
1289  ith0 = (ik-1)*nth
1290  DO ith=1, nth
1291  esin(ith0+ith) = esin(ith)
1292  ecos(ith0+ith) = ecos(ith)
1293  es2(ith0+ith) = es2(ith)
1294  ec2(ith0+ith) = ec2(ith)
1295  esc(ith0+ith) = esc(ith)
1296  END DO
1297  END DO
1298  !
1299  ! b Frequencies :
1300  !
1301  sigma = fr1 * tpi / xfr**2
1302  sxfr = 0.5 * (xfr-1./xfr)
1303  !
1304  DO ik=0, nk+1
1305  sigma = sigma * xfr
1306  sig(ik) = sigma
1307  dsip(ik) = sigma * sxfr
1308  END DO
1309  !
1310  dsii( 1) = 0.5 * sig( 1) * (xfr-1.)
1311  DO ik=2, nk-1
1312  dsii(ik) = dsip(ik)
1313  END DO
1314  dsii(nk) = 0.5 * sig(nk) * (xfr-1.) / xfr
1315  !
1316  DO ik=1, nk
1317  dden(ik) = dth * dsii(ik) * sig(ik)
1318  END DO
1319  !
1320  DO isp=1, nspec
1321  ik = 1 + (isp-1)/nth
1322  sig2(isp) = sig(ik)
1323  dden2(isp) = dden(ik)
1324  END DO
1325  !
1326  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1327  ! 6 Read and process input file up to numerical parameters
1328  ! 6.a Set model flags and time steps
1329  !
1330  WRITE (ndso,910)
1331  IF (flgnml) THEN
1332  fldry=nml_run%FLDRY
1333  flcx=nml_run%FLCX
1334  flcy=nml_run%FLCY
1335  flcth=nml_run%FLCTH
1336  flck=nml_run%FLCK
1337  flsou=nml_run%FLSOU
1338  ELSE
1339  CALL nextln ( comstr , ndsi , ndse )
1340  READ (ndsi,*,END=2001,ERR=2002) &
1341  fldry, flcx, flcy, flcth, flck, flsou
1342  END IF
1343  !
1344  iyn = 2
1345  IF ( fldry ) iyn(1) = 1
1346  IF ( flcx ) iyn(2) = 1
1347  IF ( flcy ) iyn(3) = 1
1348  IF ( flcth ) iyn(4) = 1
1349  IF ( flck ) iyn(5) = 1
1350  IF ( flsou ) iyn(6) = 1
1351  !
1352  WRITE (ndso,911) (yesxno(iyn(ifl)),ifl=1,nfl)
1353  !
1354  IF ( .NOT. (fldry.OR.flcx.OR.flcy.OR.flck.OR.flcth.OR.flsou) ) THEN
1355  WRITE (ndse,1010)
1356  CALL extcde ( 2 )
1357  END IF
1358  !
1359  IF (flgnml) THEN
1360  dtmax=nml_timesteps%DTMAX
1361  dtcfl=nml_timesteps%DTXY
1362  dtcfli=nml_timesteps%DTKTH
1363  dtmin=nml_timesteps%DTMIN
1364  ELSE
1365  CALL nextln ( comstr , ndsi , ndse )
1366  READ (ndsi,*,END=2001,ERR=2002) DTMAX, DTCFL, DTCFLI, dtmin
1367  END IF
1368 #ifdef W3_SEC1
1369  IF (dtmax.LT.1.) THEN
1370  nitersec1=ceiling(1./dtmax)
1371  WRITE (ndso,913) nitersec1
1372  ELSE
1373  nitersec1=1
1374  END IF
1375 #endif
1376 
1377  dtmax = max( 1. , dtmax )
1378  !
1379  ! Commented to allow very high resolution zooms
1380  !
1381  ! DTCFL = MAX ( 1. , DTCFL )
1382  ! DTCFLI = MIN ( DTMAX , MAX ( 1. , DTCFLI ) )
1383  dtmin = min( dtmax , max( 0. , dtmin ) )
1384  WRITE (ndso,912) dtmax, dtcfl, dtcfli, dtmin
1385  !
1386  ! 6.b Set / select source term package
1387  !
1388  nrlin = 0
1389  nrsrce = 0
1390  nrnl = 0
1391  nrbt = 0
1392  nric = 0
1393  nris = 0
1394  nrdb = 0
1395  nrtr = 0
1396  nrbs = 0
1397  !
1398  fllin = .true.
1399  flinds = .true.
1400  flnl = .true.
1401  flbt = .true.
1402  flic = .false.
1403  flis = .false.
1404  fldb = .true.
1405  fltr = .true.
1406  flbs = .true.
1407  flref = .false.
1408  !
1409 #ifdef W3_LN0
1410  nrlin = nrlin + 1
1411  fllin = .false.
1412 #endif
1413 #ifdef W3_SEED
1414  nrlin = nrlin + 1
1415 #endif
1416 #ifdef W3_LN1
1417  nrlin = nrlin + 1
1418 #endif
1419  !
1420 #ifdef W3_ST0
1421  nrsrce = nrsrce + 1
1422  flinds = .false.
1423 #endif
1424 #ifdef W3_ST1
1425  nrsrce = nrsrce + 1
1426 #endif
1427 #ifdef W3_ST2
1428  nrsrce = nrsrce + 1
1429  fltc96 = .true.
1430 #endif
1431 #ifdef W3_ST3
1432  nrsrce = nrsrce + 1
1433 #endif
1434 #ifdef W3_ST4
1435  nrsrce = nrsrce + 1
1436  flst4 = .true.
1437 #endif
1438 #ifdef W3_ST6
1439  nrsrce = nrsrce + 1
1440  flst6 = .true.
1441 #endif
1442  !
1443 #ifdef W3_NL0
1444  nrnl = nrnl + 1
1445  flnl = .false.
1446 #endif
1447 #ifdef W3_NL1
1448  nrnl = nrnl + 1
1449 #endif
1450 #ifdef W3_NL2
1451  nrnl = nrnl + 1
1452 #endif
1453 #ifdef W3_NL3
1454  nrnl = nrnl + 1
1455 #endif
1456 #ifdef W3_NL4
1457  nrnl = nrnl + 1
1458 #endif
1459 #ifdef W3_NL5
1460  nrnl = nrnl + 1
1461 #endif
1462  !
1463 #ifdef W3_BT0
1464  nrbt = nrbt + 1
1465  flbt = .false.
1466 #endif
1467 #ifdef W3_BT1
1468  nrbt = nrbt + 1
1469 #endif
1470 #ifdef W3_BT4
1471  nrbt = nrbt + 1
1472 #endif
1473 #ifdef W3_BT8
1474  nrbt = nrbt + 1
1475 #endif
1476 #ifdef W3_BT9
1477  nrbt = nrbt + 1
1478 #endif
1479  !
1480 #ifdef W3_IC1
1481  nric = nric + 1
1482  flic = .true.
1483 #endif
1484 #ifdef W3_IC2
1485  nric = nric + 1
1486  flic = .true.
1487 #endif
1488 #ifdef W3_IC3
1489  nric = nric + 1
1490  flic = .true.
1491 #endif
1492 #ifdef W3_IC4
1493  nric = nric + 1
1494  flic = .true.
1495 #endif
1496 #ifdef W3_IC5
1497  nric = nric + 1
1498  flic = .true.
1499 #endif
1500  !
1501 #ifdef W3_IS1
1502  nris = nris + 1
1503  flis = .true.
1504 #endif
1505 #ifdef W3_IS2
1506  nris = nris + 1
1507  flis = .true.
1508 #endif
1509  !
1510 #ifdef W3_DB0
1511  nrdb = nrdb + 1
1512  fldb = .false.
1513 #endif
1514 #ifdef W3_DB1
1515  nrdb = nrdb + 1
1516 #endif
1517  !
1518 #ifdef W3_TR0
1519  nrtr = nrtr + 1
1520  fltr = .false.
1521 #endif
1522 #ifdef W3_TR1
1523  nrtr = nrtr + 1
1524 #endif
1525  !
1526 #ifdef W3_BS0
1527  nrbs = nrbs + 1
1528  flbs = .false.
1529 #endif
1530 #ifdef W3_BS1
1531  nrbs = nrbs + 1
1532 #endif
1533  !
1534 #ifdef W3_REF1
1535  flref = .true.
1536 #endif
1537  !
1538  IF ( .NOT.fllin .AND. .NOT.flinds .AND. .NOT.flnl .AND. &
1539  .NOT.flbt .AND. .NOT.flic .AND. .NOT.flis .AND. &
1540  .NOT.fldb .AND. .NOT.fltr .AND. .NOT.flbs .AND. &
1541  .NOT.flref .AND. flsou ) THEN
1542  WRITE (ndse,1020)
1543  CALL extcde ( 10 )
1544  END IF
1545  !
1546  IF ( ( fllin .OR. flinds .OR. flnl .OR. flbt .OR. fldb .OR. &
1547  fltr .OR. flbs .OR. flref .OR. flic ) &
1548  .AND. .NOT.flsou ) THEN
1549  WRITE (ndse,1021)
1550  END IF
1551  !
1552  IF ( nrlin .NE. 1 ) THEN
1553  WRITE (ndse,1022) nrlin
1554  CALL extcde ( 11 )
1555  END IF
1556  !
1557  IF ( nrsrce .NE. 1 ) THEN
1558  WRITE (ndse,1023) nrsrce
1559  CALL extcde ( 12 )
1560  END IF
1561  !
1562  IF ( nrnl .NE. 1 ) THEN
1563  WRITE (ndse,1024) nrnl
1564  CALL extcde ( 13 )
1565  END IF
1566  !
1567  IF ( nrbt .NE. 1 ) THEN
1568  WRITE (ndse,1025) nrbt
1569  CALL extcde ( 14 )
1570  END IF
1571  !
1572  IF ( nrdb .NE. 1 ) THEN
1573  WRITE (ndse,1026) nrdb
1574  CALL extcde ( 15 )
1575  END IF
1576  !
1577  IF ( nrtr .NE. 1 ) THEN
1578  WRITE (ndse,1027) nrtr
1579  CALL extcde ( 16 )
1580  END IF
1581  !
1582  IF ( nrbs .NE. 1 ) THEN
1583  WRITE (ndse,1028) nrbs
1584  CALL extcde ( 17 )
1585  END IF
1586  !
1587  IF ( nric .GT. 1 ) THEN
1588  WRITE (ndse,1034) nric
1589  CALL extcde ( 19 )
1590  END IF
1591  !
1592  IF ( nris .GT. 1 ) THEN
1593  WRITE (ndse,1036) nris
1594  CALL extcde ( 26 )
1595  END IF
1596 
1597 
1598  !
1599  ! 6.c Read namelist file or Pre-process namelists into scratch file
1600  !
1601  WRITE (ndso,915)
1602  IF (flgnml) THEN
1603  OPEN (ndss,file=trim(fnmpre)//trim(nml_grid%NML),status='OLD',form='FORMATTED')
1604  ELSE
1605  OPEN (ndss,file=trim(fnmpre)//'ww3_grid.scratch',form='FORMATTED')
1606  DO
1607  CALL nextln ( comstr , ndsi , ndse )
1608  READ (ndsi,'(A)',END=2001,ERR=2002) line
1609  IF ( line(1:16) .EQ. 'END OF NAMELISTS' ) THEN
1610  EXIT
1611  ELSE
1612  WRITE (ndss,'(A)') line
1613  ENDIF
1614  END DO
1615  END IF
1616  WRITE (ndso,916)
1617  !
1618  ! 6.d Define Sin.
1619  ! 6.d.1 Stresses
1620  !
1621 #ifdef W3_FLX1
1622  WRITE (ndso,810)
1623 #endif
1624 #ifdef W3_FLX2
1625  WRITE (ndso,810)
1626  cinxsi = 0.20
1627  nittin = 3
1628 #endif
1629 #ifdef W3_FLX3
1630  cinxsi = 0.20
1631  nittin = 3
1632  cdmax = 2.5e-3
1633  ctype = 0
1634  CALL readnl ( ndss, 'FLX3', status )
1635  WRITE (ndso,810) status
1636  cdmax = max( 0. , cdmax )
1637  IF ( ctype .EQ. 1 ) THEN
1638  typeid = 'hyperbolic tangent'
1639  ELSE
1640  ctype = 0
1641  typeid = 'discontinuous '
1642  END IF
1643  WRITE (ndso,811) cdmax*1.e3, typeid
1644  cd_max = cdmax
1645  cap_id = ctype
1646 #endif
1647  !
1648 #ifdef W3_FLX4
1649  cdfac = 1.0
1650  CALL readnl ( ndss, 'FLX4', status )
1651  WRITE (ndso,810) status
1652  WRITE (ndso,811) cdfac
1653  flx4a0 = cdfac
1654 #endif
1655 #ifdef W3_FLX5
1656  WRITE (ndso,810)
1657 #endif
1658  !
1659  ! 6.d.2 Linear input
1660  !
1661 #ifdef W3_LN0
1662  WRITE (ndso,820)
1663 #endif
1664 #ifdef W3_SEED
1665  WRITE (ndso,820)
1666 #endif
1667  !
1668 #ifdef W3_LN1
1669  clin = 80.
1670  rfpm = 1.
1671  rfhf = 0.5
1672  CALL readnl ( ndss, 'SLN1', status )
1673  WRITE (ndso,820) status
1674  clin = max(0.,clin)
1675  rfpm = max(0.,rfpm)
1676  rfhf = max(0.,min(1.,rfhf))
1677  WRITE (ndso,821) clin, rfpm, rfhf
1678  slnc1 = clin * (dair/dwat)**2 / grav**2
1679  fspm = rfpm
1680  fshf = rfhf
1681 #endif
1682  !
1683  ! 6.d.3 Exponential input
1684  !
1685 #ifdef W3_ST0
1686  WRITE (ndso,920)
1687 #endif
1688  !
1689 #ifdef W3_ST1
1690  cinp = 0.25
1691 #endif
1692 #ifdef W3_ST2
1693  zwnd = 10.
1694  swellf = 0.100
1695  stabsh = 1.38
1696  stabof = -0.01
1697  cneg = -0.1
1698  cpos = 0.1
1699  fneg = 150.
1700 #endif
1701  !
1702 #ifdef W3_ST3
1703  zwnd = 10.
1704  alpha0 = 0.0095
1705  z0max = 0.0
1706  betamax = 1.2 ! default WAM4 / WAM4 + is 1.2 with rhow=1000
1707  sinthp = 2.
1708  swellf = 0.
1709  zalp = 0.0110
1710 #endif
1711  !
1712 #ifdef W3_ST4
1713  zwnd = 10.
1714  alpha0 = 0.0095
1715  z0max = 0.0
1716  z0rat = 0.04
1717  betamax = 1.43
1718  sinthp = 2.
1719  swellf = 0.66
1720  swellfpar = 1
1721  swellf2 = -0.018
1722  swellf3 = 0.022
1723  swellf4 = 1.5e5
1724  swellf5 = 1.2
1725  swellf6 = 0.
1726  swellf7 = 360000.
1727  tauwshelter = 0.3
1728  zalp = 0.006
1729  sinbr = 0.
1730  sintable = 1
1731  sintail1 = 0. ! TAUWSHELTER FOR TAIL (no table)
1732  sintail2 = 0. ! additional peak in capillary range
1733  tauwbug = 1 ! TAUWBUG is 1 is the bug is kept:
1734  ! initializes TAUWX/Y to zero in W3SRCE
1735  viscstress =0
1736  capcha = 0. ! =1 indicates capping of drag is active
1737  chamin = 0.0001 !
1738  cha0 = alpha0 ! initial value for charnock
1739  ucap = 30. ! U10 threshold from which drag capping is applied
1740  sigmaucap = 10. ! Width for reduction of drag beyond UCAP
1741 #endif
1742  !
1743 #ifdef W3_ST6
1744  sina0 = 0.09
1745  sinws = 32.0
1746  sinfc = 6.0
1747 #endif
1748  !
1749 #ifdef W3_ST1
1750  CALL readnl ( ndss, 'SIN1', status )
1751  WRITE (ndso,920) status
1752  WRITE (ndso,921) cinp
1753  sinc1 = 28. * cinp * dair / dwat
1754 #endif
1755  !
1756 #ifdef W3_ST2
1757  CALL readnl ( ndss, 'SIN2', status )
1758  WRITE (ndso,920) status
1759  IF ( swellf.LT.0. .OR. swellf.GT.1. ) swellf = 1.
1760  WRITE (ndso,921) zwnd, swellf
1761  IF ( stabsh .LT. 0.1 ) stabsh = 1.
1762  IF ( cneg*cpos .EQ. 0. ) THEN
1763  cneg = 0.
1764  cpos = 0.
1765  fneg = 0.
1766  fpos = 0.
1767  ELSE
1768  cpos = - abs(cpos) * abs(cneg)/cneg
1769  fneg = - max(1.,abs(fneg))
1770  fpos = fneg * cneg/cpos
1771  END IF
1772 #endif
1773 #ifdef W3_STAB2
1774  WRITE (ndso,1921) stabsh, stabof, cneg, cpos, fneg, fpos
1775 #endif
1776 #ifdef W3_ST2
1777  zwind = zwnd
1778  fswell = swellf
1779  shstab = stabsh
1780  ofstab = stabof
1781  ccng = cneg
1782  ccps = cpos
1783  ffng = fneg
1784  ffps = fpos
1785 #endif
1786  !
1787 #ifdef W3_ST3
1788  CALL readnl ( ndss, 'SIN3', status )
1789  WRITE (ndso,920) status
1790  WRITE (ndso,921) alpha0, betamax, sinthp, z0max, zalp, zwnd, &
1791  swellf
1792  zzwnd = zwnd
1793  aalpha = alpha0
1794  bbeta = betamax
1795  ssinthp = sinthp
1796  zz0max = z0max
1797  zzalp = zalp
1798  sswellf(1) = swellf
1799 #endif
1800  !
1801 #ifdef W3_ST4
1802  CALL readnl ( ndss, 'SIN4', status )
1803  WRITE (ndso,920) status
1804  WRITE (ndso,921) alpha0, betamax, sinthp, z0max, zalp, zwnd, tauwshelter, &
1807  zzwnd = zwnd
1808  aalpha = alpha0
1809  bbeta = betamax
1810  ssinbr = sinbr
1811  ssinthp = sinthp
1812  zz0max = z0max
1813  zz0rat = z0rat
1814  zzalp = zalp
1815  ttauwshelter = tauwshelter
1816  sswellf(1) = swellf
1817  sswellf(2) = swellf2
1818  sswellf(3) = swellf3
1819  sswellf(4) = swellf4
1820  sswellf(5) = swellf5
1821  sswellf(6) = swellf6
1822  sswellf(7) = swellf7
1823  sswellfpar = swellfpar
1824  sintailpar(1) = float(sintable)
1825  sintailpar(2) = sintail1
1826  sintailpar(3) = sintail2
1827  sintailpar(4) = float(tauwbug)
1828  sintailpar(5) = viscstress
1829  capchnk(1) = capcha
1830  capchnk(2) = chamin
1831  capchnk(3) = cha0
1832  capchnk(4) = ucap
1833  capchnk(5) = sigmaucap
1834 #endif
1835  !
1836 #ifdef W3_ST6
1837  CALL readnl ( ndss, 'SIN6', status )
1838  WRITE (ndso,920) status
1839  sin6a0 = sina0
1840  sin6ws = sinws
1841  sin6fc = sinfc
1842  j = 1
1843  IF ( sin6a0.LE.0. ) j = 2
1844  WRITE (ndso,921) yesxno(j), sin6a0, sin6ws, sin6fc
1845 #endif
1846  !
1847  ! 6.e Define Snl.
1848  !
1849 #ifdef W3_NL0
1850  WRITE (ndso,922)
1851 #endif
1852  !
1853 #ifdef W3_NL1
1854  lambda = 0.25
1855  IF ( fltc96 ) THEN
1856  nlprop = 1.00e7
1857  ELSE IF ( flst4 ) THEN
1858  nlprop = 2.50e7
1859  ELSE IF ( flst6 ) THEN
1860  nlprop = 3.00e7
1861  ELSE
1862  nlprop = 2.78e7
1863  END IF
1864  kdconv = 0.75
1865  kdmin = 0.50
1866  snlcs1 = 5.5
1867  snlcs2 = 0.833
1868  snlcs3 = -1.25
1869  ! Additional parameters for GQM
1870  iqtype = 1
1871  tailnl = -fachf
1872  gqmnf1 = 14
1873  gqmnt1 = 8
1874  gqmnq_om2=8
1875  gqmthrsat=0.
1876  gqmthrcou=0.015
1877  gqamp1=1.
1878  gqamp2=0.002
1879  gqamp3=1.
1880  gqamp4=1.
1881  CALL readnl ( ndss, 'SNL1', status )
1882  WRITE (ndso,922) status
1883  WRITE (ndso,923) lambda, nlprop, kdconv, kdmin, &
1884  snlcs1, snlcs2, snlcs3
1885  snlc1 = nlprop / grav**4
1886  lam = lambda
1887  kdcon = kdconv
1888  kdmn = kdmin
1889  snls1 = snlcs1
1890  snls2 = snlcs2
1891  snls3 = snlcs3
1892  ! Additional parameters for GQM
1893  iqtpe = iqtype
1894  gqnf1 = gqmnf1
1895  gqnt1 = gqmnt1
1896  gqnq_om2 = gqmnq_om2
1897  gqthrsat = gqmthrsat
1898  gqthrcou = gqmthrcou
1899  gqamp(1) = gqamp1
1900  gqamp(2) = gqamp2
1901  gqamp(3) = gqamp3
1902  gqamp(4) = gqamp4
1903  nltail = tailnl
1904 #endif
1905  !
1906 #ifdef W3_ST0
1907  fachf = 5.
1908 #endif
1909 #ifdef W3_ST1
1910  fachf = 4.5
1911 #endif
1912 #ifdef W3_ST2
1913  fachf = 5.
1914 #endif
1915 #ifdef W3_ST3
1916  fachf = 5.
1917 #endif
1918 #ifdef W3_ST4
1919  fachf = 5.
1920 #endif
1921 #ifdef W3_ST6
1922  fachf = 5.
1923 #endif
1924 #ifdef W3_NL2
1925  iqtype = 2
1926  tailnl = -fachf
1927  ndepth = 0
1928 #endif
1929 #ifdef W3_NL3
1930  nqdef = 0
1931  msc = 0.
1932  nsc = -3.5
1933  kdfd = 0.20
1934  kdfs = 5.00
1935 #endif
1936 #ifdef W3_NL4
1937  indtsa = 1
1938  altlp = 2
1939 #endif
1940 #ifdef W3_NL5
1941  nl5dpt = 3000.
1942  nl5oml = 0.10
1943  nl5dis = 0
1944  nl5kev = 0
1945  nl5ipl = 1
1946  nl5pmx = 100
1947 #endif
1948 #ifdef W3_NLS
1949  a34 = 0.05
1950  fhfc = 1.e10
1951  dnm = 0.25
1952  fc1 = 1.25
1953  fc2 = 1.50
1954  fc3 = 6.00
1955 #endif
1956  !
1957 #ifdef W3_NL2
1958  CALL readnl ( ndss, 'SNL2', status )
1959  WRITE (ndso,922) status
1960  tailnl = min( max( tailnl, -5. ) , -4. )
1961  IF ( iqtype .EQ. 3 ) THEN
1962  WRITE (ndso,923) 'Shallow water', tailnl
1963  ELSE IF ( iqtype .EQ. 2 ) THEN
1964  WRITE (ndso,923) 'Deep water with scaling', tailnl
1965  ELSE
1966  WRITE (ndso,923) 'Deep water', tailnl
1967  iqtype = 1
1968  END IF
1969  !
1970  IF ( iqtype .NE. 3 ) THEN
1971  ndepth = 1
1972  ALLOCATE ( mpars(1)%SNLPS%DPTHNL(ndepth) )
1973  dpthnl => mpars(1)%SNLPS%DPTHNL
1974  dpthnl = 1000.
1975  ELSE
1976  IF ( ndepth .EQ. 0 ) ndepth = 7
1977  ndepth = max( 1 , ndepth )
1978  ALLOCATE ( mpars(1)%SNLPS%DPTHNL(ndepth) )
1979  dpthnl => mpars(1)%SNLPS%DPTHNL
1980  dpthnl(1) = 640.
1981  dpthnl(ndepth) = 10.
1982  IF ( ndepth .GT. 1 ) THEN
1983  dptfac = (dpthnl(ndepth)/dpthnl(1))**(1./(real(ndepth-1)))
1984  DO idepth=2, ndepth-1
1985  dpthnl(idepth) = dptfac*dpthnl(idepth-1)
1986  END DO
1987  END IF
1988  CALL readnl ( ndss, 'ANL2', status )
1989  WRITE (ndso,1923) ndepth, dpthnl(1:min(5,ndepth))
1990  IF (ndepth .GT. 5 )WRITE (ndso,2923) dpthnl(6:ndepth)
1991  END IF
1992  WRITE (ndst,*)
1993  iqtpe = iqtype
1994  ndpths = ndepth
1995  nltail = tailnl
1996 #endif
1997  !
1998 #ifdef W3_NL3
1999  CALL readnl ( ndss, 'SNL3', status )
2000  WRITE (ndso,922) status
2001  kdfd = max( 0.001 , min( 10. , kdfd ) )
2002  kdfs = max( kdfd , min( 10. , kdfs ) )
2003  WRITE (ndso,923) msc, nsc, kdfd, kdfs
2004  !
2005  nqdef = max( 0 , nqdef )
2006  IF ( nqdef .EQ. 0 ) THEN
2007  nqdef = 1
2008  qparms(1:5) = [ 0.25 , 0.00, -1., 1.e7, 0.00 ]
2009  ELSE
2010  DO j=1, nqdef
2011  qparms((j-1)*5+1:j*5) = [ 0.25, 0.00, -1., 1.e7, 1.e6 ]
2012  END DO
2013  CALL readnl ( ndss, 'ANL3', status )
2014  END IF
2015  DO j=1, nqdef
2016  qparms((j-1)*5+1) = max(0.,min(lammax,qparms((j-1)*5+1)))
2017  qparms((j-1)*5+2) = max(0.,min(qparms((j-1)*5+1), &
2018  qparms((j-1)*5+2)))
2019  qparms((j-1)*5+3) = min(delthm,qparms((j-1)*5+3))
2020  qparms((j-1)*5+4) = max(0.,qparms((j-1)*5+4))
2021  qparms((j-1)*5+5) = max(0.,qparms((j-1)*5+5))
2022  END DO
2023  WRITE (ndso,1923) nqdef
2024  WRITE (ndso,2923) qparms(1:nqdef*5)
2025  WRITE (ndso,*)
2026  snlnq = nqdef
2027  snlmsc = msc
2028  snlnsc = nsc
2029  snlsfd = sqrt( kdfd * tanh(kdfd) )
2030  snlsfs = sqrt( kdfs * tanh(kdfs) )
2031  ALLOCATE ( mpars(1)%SNLPS%SNLL(nqdef), &
2032  mpars(1)%SNLPS%SNLM(nqdef), &
2033  mpars(1)%SNLPS%SNLT(nqdef), &
2034  mpars(1)%SNLPS%SNLCD(nqdef), &
2035  mpars(1)%SNLPS%SNLCS(nqdef) )
2036  snll => mpars(1)%SNLPS%SNLL
2037  snll = qparms(1:nqdef*5:5)
2038  snlm => mpars(1)%SNLPS%SNLM
2039  snlm = qparms(2:nqdef*5:5)
2040  snlt => mpars(1)%SNLPS%SNLT
2041  snlt = qparms(3:nqdef*5:5)
2042  snlcd => mpars(1)%SNLPS%SNLCD
2043  snlcd = qparms(4:nqdef*5:5)
2044  snlcs => mpars(1)%SNLPS%SNLCS
2045  snlcs = qparms(5:nqdef*5:5)
2046 #endif
2047  !
2048 #ifdef W3_NL4
2049  CALL readnl ( ndss, 'SNL4', status )
2050  WRITE (ndso,922) status
2051  WRITE (ndso,923) indtsa, altlp
2052  itsa = indtsa
2053  ialt = altlp
2054 #endif
2055  !
2056 #ifdef W3_NL5
2057  CALL readnl ( ndss, 'SNL5', status )
2058  WRITE (ndso,922) status
2059  nl5dpt = max(0., min(nl5dpt, 3000.))
2060  nl5dis = max(0 , min(nl5dis, 1))
2061  nl5kev = max(0 , min(nl5kev, 1))
2062  nl5ipl = max(0 , min(nl5ipl, 1))
2063  IF (nl5dis .EQ. 1) nl5ipl = 0
2064  IF (nl5pmx .GT. 0) nl5pmx = max(10, nl5pmx)
2065  WRITE (ndso,923) nl5dpt, nl5oml, nl5dis, nl5kev, nl5ipl, nl5pmx
2066  qr5dpt = nl5dpt
2067  qr5oml = nl5oml
2068  qi5dis = nl5dis
2069  qi5kev = nl5kev
2070  qi5ipl = nl5ipl
2071  qi5pmx = nl5pmx
2072 #endif
2073  !
2074 #ifdef W3_NLS
2075  CALL readnl ( ndss, 'SNLS', status )
2076  WRITE (ndso,9922) status
2077  a34 = max( 0. , min( a34 , abmax ) )
2078  fhfc = max( 0. , fhfc )
2079  dnm = max( 0., dnm )
2080  WRITE (ndso,9923) a34, (xfr-1.)*a34, fhfc, dnm, fc1, fc2, fc3
2081  cnlsa = a34
2082  cnlsc = fhfc
2083  cnlsfm = dnm
2084  cnlsc1 = fc1
2085  cnlsc2 = fc2
2086  cnlsc3 = fc3
2087 #endif
2088  !
2089  ! 6.f Define Sds.
2090  !
2091 #ifdef W3_ST0
2092  WRITE (ndso,924)
2093 #endif
2094  !
2095 #ifdef W3_ST1
2096  cdis = -2.36e-5
2097  apm = 3.02e-3
2098 #endif
2099 #ifdef W3_ST2
2100  sdsa0 = 4.8
2101  sdsa1 = 1.7e-4
2102  sdsa2 = 2.0
2103  sdsb0 = 0.3e-3
2104  sdsb1 = 0.47
2105  phimin = 0.003
2106  sdsaln = 0.002
2107  fpimin = 0.009
2108 #endif
2109 #ifdef W3_ST3
2110  sdsc1 = -2.1 !! This is Bidlot et al. 2005, Otherwise WAM4 uses -4.5
2111  wnmeanp = 0.5 !! This is Bidlot et al. 2005, Otherwise WAM4 uses -0.5
2112  fxfm3 = 2.5
2113  fxpm3 = 4.
2114  wnmeanptail = 0.5
2115  sdsdelta1 = 0.4 !! This is Bidlot et al. 2005, Otherwise WAM4 uses 0.5
2116  sdsdelta2 = 0.6 !! This is Bidlot et al. 2005, Otherwise WAM4 uses 0.5
2117 #endif
2118  !
2119 #ifdef W3_ST4
2120  wnmeanp = 0.5 ! taken from Bidlot et al. 2005
2121  fxfm3 = 2.5
2122  fxfmage = 0.
2123  fxpm3 = 4.
2124  wnmeanptail = -0.5
2125  sdsbchoice =1 ! 1: Ardhuin et al., 2: Filipot & Ardhuin, 3: Romero
2126  sdsc2 = -2.2e-5 ! -3.8 for Romero
2127  sdscum = -0.40344
2128  sdsc4 = 1.
2129  sdsc5 = 0.
2130  sdsnuw = 0.
2131  sdsc6 = 0.3
2132  sdsbr = 0.90e-3 ! 0.005 for Romero
2133  sdsbrfdf = 0
2134  sdsbrf1 = 0.5
2135  sdsp = 2. ! this is now fixed in w3sds4, should be cleaned up
2136  sdsdth = 80.
2137  sdscos = 2.
2138  sdsiso = 2
2139  sdsbm0 = 1. ! All these parameters are related to finite depth
2140  sdsbm1 = 0. ! scaling of breaking
2141  sdsbm2 = 0.
2142  sdsbm3 = 0.
2143  sdsbm4 = 0.
2144  sdsbck = 0.
2145  sdsabk = 1.5
2146  sdspbk = 4.
2147  sdsbint = 0.3
2148  sdshck = 1.5
2149  whitecapwidth = 0.3
2150  sdsfacmtf = 400 ! MTF factor for Lambda , Romero (2019)
2151  cumsigp = 0.
2152  sdsstrain = 0.
2153  sdsstraina = 15.
2154  sdsstrain2 = 0.
2155  whitecapdur = 0.56 ! breaking duration factor
2156  ! b (strength of breaking)
2157  sdsbt = 1.100e-3 ! B_T (sturation threshold for dissipation rate b)
2158  ! Lambda parameters
2159  sdsl = 3.5000e-05 ! L scaling
2160  ! MTF
2161  spmss = 0.5 ! cmss^SPMSS
2162  sdsnmtf = 1.5 ! MTF power
2163  sdscump = 2. ! 2 for cumulative mss, 1 for cumulative orb. vel.
2164  ! MW
2165  sdsmwd = .9 ! new AFo
2166  sdsmwpow = 1. ! (k )^pow
2167  sdkof = 3. ! ko factor such that ko= g (SDKOF/(28 us))^2
2168 #endif
2169  !
2170 #ifdef W3_ST6
2171  sdset = .true.
2172  sdsa1 = 4.75e-06
2173  sdsp1 = 4
2174  sdsa2 = 7.00e-05
2175  sdsp2 = 4
2176  cstb1 = .false.
2177  swlb1 = 0.41e-02
2178 #endif
2179  !
2180 #ifdef W3_ST1
2181  CALL readnl ( ndss, 'SDS1', status )
2182  WRITE (ndso,924) status
2183  WRITE (ndso,925) cdis, apm
2184  sdsc1 = tpi * cdis / apm**2
2185 #endif
2186  !
2187 #ifdef W3_ST2
2188  CALL readnl ( ndss, 'SDS2', status )
2189  WRITE (ndso,924) status
2190  IF ( phimin .LE. 0. ) THEN
2191  sdsb2 = 0.
2192  sdsb3 = 0.
2193  phimin = sdsb0 + sdsb1*fpimin
2194  ELSE
2195  fpia = ( phimin - sdsb0 ) / sdsb1
2196  IF ( fpia .LT. fpimin ) THEN
2197  sdsb3 = 4.
2198  sdsb2 = fpimin**sdsb3 * (phimin-sdsb0-sdsb1*fpimin)
2199  ELSE
2200  fpib = max( fpia-0.0025 , fpimin )
2201  dphid = max( phimin - sdsb0 - sdsb1*fpib , 1.e-15 )
2202  sdsb3 = min( 10. , sdsb1*fpib / dphid )
2203  sdsb2 = fpib**sdsb3 * dphid
2204  fpimin = fpib
2205  END IF
2206  END IF
2207  WRITE (ndso,925) sdsa0, sdsa1, sdsa2, &
2208  sdsb0, sdsb1, sdsb2, sdsb3, fpimin, phimin
2209  cdsa0 = sdsa0
2210  cdsa1 = sdsa1
2211  cdsa2 = sdsa2
2212  cdsb0 = sdsb0
2213  cdsb1 = sdsb1
2214  cdsb2 = sdsb2
2215  cdsb3 = sdsb3
2216 #endif
2217  !
2218 #ifdef W3_ST3
2219  CALL readnl ( ndss, 'SDS3', status )
2220  WRITE (ndso,924) status
2221  WRITE (ndso,925) sdsc1, wnmeanp, sdsdelta1, &
2222  sdsdelta2
2223  ssdsc1 = sdsc1
2224  wwnmeanp = wnmeanp
2225  ffxfm = fxfm3 * tpi
2226  ffxpm = fxpm3 * grav / 28.
2227  wwnmeanptail = wnmeanptail
2228  ddelta1 = sdsdelta1
2229  ddelta2 = sdsdelta2
2230 #endif
2231  !
2232 #ifdef W3_ST4
2233  CALL readnl ( ndss, 'SDS4', status )
2234  WRITE (ndso,924) status
2235  WRITE (ndso,925) sdsc2, sdsbck, sdscum, wnmeanp
2236  ssdsc(1) = real(sdsbchoice)
2237  ssdsc(2) = sdsc2
2238  ssdsc(3) = sdscum
2239  ssdsc(4) = sdsc4
2240  ssdsc(5) = sdsc5
2241  ssdsc(6) = sdsc6
2242  ssdsc(7) = whitecapwidth
2243  ssdsc(8) = sdsstrain ! Straining constant ...
2244  ssdsc(9) = sdsl
2245  ssdsc(10) = sdsstraina*nth/360. ! angle for enhanced straining
2246  ssdsc(11) = sdsstrain2 ! straining constant for directional part
2247  ssdsc(12) = cumsigp
2248  ssdsc(13) = sdsmwd
2249  ssdsc(14) = spmss
2250  ssdsc(15) = sdsmwpow
2251  ssdsc(16) = sdkof
2252  ssdsc(17) = whitecapdur
2253  ssdsc(18) = sdsfacmtf
2254  ssdsc(19) = sdsnmtf
2255  ssdsc(20) = sdscump
2256  ssdsc(21) = sdsnuw
2257  !
2258  ssdsbr = sdsbr
2259  ssdsbrf1 = sdsbrf1
2260  ssdsbrfdf= sdsbrfdf
2261  ssdsbm(0) = sdsbm0
2262  ssdsbm(1) = sdsbm1
2263  ssdsbm(2) = sdsbm2
2264  ssdsbm(3) = sdsbm3
2265  ssdsbm(4) = sdsbm4
2266  ssdsbt = sdsbt
2267  ssdsiso = sdsiso
2268  ssdscos = sdscos
2269  ssdsp = sdsp
2270  ssdsdth = sdsdth
2271  wwnmeanp = wnmeanp
2272  ffxfm = fxfm3 * tpi
2273  ffxfa = fxfmage * tpi
2274  ffxpm = fxpm3 * grav / 28.
2275  wwnmeanptail = wnmeanptail
2276  ssdsbck = sdsbck
2277  ssdsabk = sdsabk
2278  ssdspbk = sdspbk
2279  ssdsbint = sdsbint
2280  ssdshck = sdshck
2281 #endif
2282  !
2283 #ifdef W3_ST6
2284  CALL readnl ( ndss, 'SDS6', status )
2285  WRITE (ndso,924) status
2286  sds6et = sdset
2287  sds6a1 = sdsa1
2288  sds6p1 = sdsp1
2289  sds6a2 = sdsa2
2290  sds6p2 = sdsp2
2291  j = 2
2292  IF (sdset) j = 1
2293  WRITE (ndso,925) yesxno(j), yesxno(3-j), sds6a1, sds6p1, sds6a2, sds6p2
2294 
2295  CALL readnl ( ndss, 'SWL6', status )
2296  WRITE (ndso,937) status
2297  j = 1
2298  swl6s6 = swlb1.GT.0.0
2299  IF (.NOT.swl6s6) j = 2
2300  swl6b1 = swlb1
2301  swl6cstb1 = cstb1
2302  IF (cstb1) THEN
2303  WRITE (ndso,940) yesxno(j), '(constant) ' ,swl6b1
2304  ELSE
2305  WRITE (ndso,940) yesxno(j), '(steepness dependent)' ,swl6b1
2306  END IF
2307 #endif
2308  !
2309  ! 6.g Define Sbt.
2310  !
2311 #ifdef W3_BT0
2312  WRITE (ndso,926)
2313 #endif
2314 #ifdef W3_BT4
2315  WRITE (ndso,926)
2316 #endif
2317  !
2318 #ifdef W3_BT1
2319  gamma = -0.067
2320  CALL readnl ( ndss, 'SBT1', status )
2321  WRITE (ndso,926) status
2322  WRITE (ndso,927) gamma
2323  sbtc1 = 2. * gamma / grav
2324 #endif
2325  !
2326 #ifdef W3_BT4
2327  sedmapd50=.false.
2328  sed_d50_uniform=2.e-4 ! default grain size: medium sand 200 microns
2329  ripfac1=0.4 ! A1 in Ardhuin et al. 2003
2330  ripfac2=-2.5 ! A2 in Ardhuin et al. 2003
2331  ripfac3=1.2 ! A3 in Ardhuin et al. 2003
2332  ripfac4=0.05 ! A4 in Ardhuin et al. 2003
2333  sigdepth=0.05
2334  botroughmin=0.01
2335  botroughfac=1.00
2336  CALL readnl ( ndss, 'SBT4', status )
2337  WRITE (ndso,926) status
2338  WRITE (ndso,927) sedmapd50, sed_d50_uniform, &
2341  sbtcx(1)=ripfac1
2342  sbtcx(2)=ripfac2
2343  sbtcx(3)=ripfac3
2344  sbtcx(4)=ripfac4
2345  sbtcx(5)=sigdepth
2346  sbtcx(6)=botroughmin
2347  sbtcx(7)=botroughfac
2348 #endif
2349  !
2350  !
2351  ! 6.h Define Sdb.
2352  !
2353 #ifdef W3_DB0
2354  WRITE (ndso,928)
2355 #endif
2356  !
2357 #ifdef W3_DB1
2358  bjalfa = 1.
2359  bjgam = 0.73
2360  bjflag = .true.
2361  CALL readnl ( ndss, 'SDB1', status )
2362  WRITE (ndso,928) status
2363  bjalfa = max( 0. , bjalfa )
2364  bjgam = max( 0. , bjgam )
2365  WRITE (ndso,929) bjalfa, bjgam
2366  IF ( bjflag ) THEN
2367  WRITE (ndso,*) ' Using Hmax/d ratio only.'
2368  ELSE
2369  WRITE (ndso,*) &
2370  ' Using Hmax/d in Miche style formulation.'
2371  END IF
2372  WRITE (ndso,*)
2373  sdbc1 = bjalfa
2374  sdbc2 = bjgam
2375  fdonly = bjflag
2376 #endif
2377  !
2378  !
2379 #ifdef W3_UOST
2380  uostfilelocal = 'obstructions_local.'//adjustl(trim(gname))//'.in'
2381  uostfileshadow = 'obstructions_shadow.'//adjustl(trim(gname))//'.in'
2382  uostfactorlocal = 1
2383  uostfactorshadow = 1
2384  CALL readnl ( ndss, 'UOST', status )
2385  WRITE (ndso,4500) status
2386  WRITE (ndso,4501) adjustl(trim(uostfilelocal)), adjustl(trim(uostfileshadow)), &
2387  uostfactorlocal, uostfactorshadow
2388 #endif
2389  !
2390  ! 6.i Define Str.
2391  !
2392 #ifdef W3_TR0
2393  WRITE (ndso,930)
2394 #endif
2395  !
2396  ! 6.j Define Sbs.
2397  !
2398 #ifdef W3_BS0
2399  WRITE (ndso,932)
2400 #endif
2401 #ifdef W3_BS1
2402  WRITE (ndso,932)
2403 #endif
2404  !
2405  ! 6.k Define Sxx and Sic.
2406  !
2407 #ifdef W3_IC1
2408  WRITE (ndso,935)
2409  WRITE(ndso,'(A/A)')' Sice will be calculated using ' &
2410  //'user-specified ki values.',' Required ' &
2411  //'field input: ice parameter 1.'
2412 #endif
2413  !
2414 #ifdef W3_IC2
2415  WRITE (ndso,935)
2416  WRITE(ndso,'(A/A)')' Sice will be calculated using ' &
2417  //'under-ice boundary layer method.',' Required ' &
2418  //'field input: ice parameters 1 and 2.'
2419 #endif
2420  !
2421 #ifdef W3_IC3
2422  WRITE (ndso,935)
2423  WRITE(ndso,'(A/A)')' Sice will be calculated using '&
2424  //'Wang and Shen method.',' '&
2425  //'Required field input: ice parameters 1, 2, 3 and 4.'
2426 #endif
2427  !
2428 #ifdef W3_IC4
2429  WRITE (ndso,935)
2430  WRITE(ndso,'(A/A)')' Sice will be calculated using '&
2431  //'Empirical method.',' '&
2432  //'Required field input: ice parameters (varies).'
2433 #endif
2434  !
2435 #ifdef W3_IC5
2436  WRITE (ndso,935)
2437  WRITE(ndso,'(A/A/)')' Sice will be calculated using '&
2438  //'effective medium models.',' '&
2439  //'Required field input: ice parameters 1, 2, 3 and 4.'
2440 #endif
2441  !
2442  ! 6.l Read unstructured data
2443  ! initialisation of logical related to unstructured grid
2444  ugobcauto = .true.
2445  ugbccfl = .true.
2446  ugobcdepth= -10.
2447  ugobcok = .false.
2448  ugobcfile = 'unset'
2449  expfsn = .true.
2450  expfspsi = .false.
2451  expfsfct = .false.
2452  impfsn = .false.
2453  imptotal = .false.
2454  exptotal = .false.
2455  imprefraction = .false.
2456  impfreqshift = .false.
2457  impsource = .false.
2458  setup_apply_wlv = .true.
2459  solverthr_setup=1e-6
2460  crit_dep_setup=0.1
2461  jgs_terminate_maxiter = .true.
2462  jgs_terminate_difference = .true.
2463  jgs_terminate_norm = .false.
2464  jgs_limiter = .false.
2465  jgs_limiter_func = 1
2466  jgs_block_gauss_seidel = .true.
2467  jgs_use_jacobi = .true.
2468  jgs_maxiter=100
2469  jgs_pmin = 1
2470  jgs_diff_thr = 1.e-10
2471  jgs_norm_thr = 1.e-20
2472  jgs_nlevel = 0
2473  jgs_source_nonlinear = .false.
2474  ! read data from the unstructured devoted namelist
2475  CALL readnl ( ndss, 'UNST', status )
2476 
2477  b_jgs_use_jacobi = jgs_use_jacobi
2478  b_jgs_terminate_maxiter = jgs_terminate_maxiter
2479  b_jgs_terminate_difference = jgs_terminate_difference
2480  b_jgs_terminate_norm = jgs_terminate_norm
2481  b_jgs_limiter = jgs_limiter
2482  b_jgs_limiter_func = jgs_limiter_func
2483  b_jgs_block_gauss_seidel = jgs_block_gauss_seidel
2484  b_jgs_maxiter = jgs_maxiter
2485  b_jgs_pmin = jgs_pmin
2486  b_jgs_diff_thr = jgs_diff_thr
2487  b_jgs_norm_thr = jgs_norm_thr
2488  b_jgs_nlevel = jgs_nlevel
2489  b_jgs_source_nonlinear = jgs_source_nonlinear
2490 
2491  nbsel=0
2492 
2493  IF (expfsn) nbsel = nbsel+1
2494  IF (expfspsi) nbsel = nbsel+1
2495  IF (expfsfct) nbsel = nbsel+1
2496  IF (impfsn) nbsel = nbsel+1
2497  IF (imptotal) nbsel = nbsel+1
2498  IF (exptotal) nbsel = nbsel+1
2499 
2500  IF (gtype .EQ. ungtype) THEN
2501  IF (nbsel .ne. 1) THEN
2502  IF (nbsel .gt. 1) THEN
2503  WRITE (ndse,*) 'MORE THAN ONE UNSTRUCTURED SCHEME SELECTED'
2504  CALL extcde ( 19 )
2505  ELSE IF (nbsel .eq. 0) THEN
2506  WRITE (ndse,*) 'NOTHING SELECTED FROM THE UNSTRUCTURED PART'
2507  CALL extcde ( 19 )
2508  END IF
2509  END IF
2510  END IF
2511  !
2512  ! 6.m Select propagation scheme
2513  !
2514  WRITE (ndso,950)
2515  !
2516  nrprop = 0
2517  flprop = .true.
2518  pname = ' '
2519 #ifdef W3_PR0
2520  pname = 'Not defined '
2521  nrprop = nrprop + 1
2522  flprop = .false.
2523 #endif
2524 #ifdef W3_PR1
2525  pname = 'First order upstream '
2526  nrprop = nrprop + 1
2527 #endif
2528 #ifdef W3_UQ
2529  pname = '3rd order UQ'
2530 #endif
2531 #ifdef W3_UNO
2532  pname = '2nd order UNO'
2533 #endif
2534  j = len_trim(pname)
2535 #ifdef W3_PR2
2536  pname = pname(1:j)//' + GSE diffusion '
2537  nrprop = nrprop + 1
2538 #endif
2539 #ifdef W3_PR3
2540  pname = pname(1:j)//' + GSE averaging '
2541  nrprop = nrprop + 1
2542 #endif
2543  !
2544 #ifdef W3_SMC
2545  pname = 'UNO2 on SMC grid + diffusion '
2546 #endif
2547  !
2548  IF ( (flcx.OR.flcy.OR.flcth.OR.flck) .AND. .NOT. flprop ) THEN
2549  WRITE (ndse,1030)
2550  CALL extcde ( 20 )
2551  END IF
2552  !
2553  IF ( .NOT.(flcx.OR.flcy.OR.flcth.OR.flck) .AND. flprop ) THEN
2554  WRITE (ndse,1031)
2555  END IF
2556  !
2557  IF ( nrprop.EQ.0 ) THEN
2558  WRITE (ndse,1032)
2559  CALL extcde ( 21 )
2560  END IF
2561  !
2562  IF ( nrprop .GT. 1 ) THEN
2563  WRITE (ndse,1033) nrprop
2564  CALL extcde ( 22 )
2565  END IF
2566  !
2567  ! 6.m Parameters for propagation scheme
2568  !
2569  WRITE (ndso,951) pname
2570  !
2571  cfltm = 0.7
2572  !
2573 #ifdef W3_PR2
2574  dtime = 0.
2575  latmin = 70.
2576 #endif
2577  !
2578 #ifdef W3_SMC
2579  !! Default values of SMC grid parameters. JGLi06Apr2021
2580  ncel = 1
2581  nufc = 1
2582  nvfc = 1
2583  nglo = 1
2584  narc = 1
2585  nbgl = 1
2586  nbac = 1
2587  lvsmc = 1
2588  mrfct = 1
2589  ishft = 0
2590  jeqt = 0
2591  nbismc = 0
2592  cflsm = 0.7
2593  dtims = 360.0
2594  rfmaxd = 36.0
2595  uno3 = .false.
2596  averg = .true.
2597  seawnd = .false.
2598  arctic = .false.
2599 #endif
2600  !
2601 #ifdef W3_PR3
2602  wdthcg = 1.5
2603  wdthth = wdthcg
2604 #endif
2605  !
2606 #ifdef W3_PR1
2607  CALL readnl ( ndss, 'PRO1', status )
2608  IF ( status(18:18) .EQ. ':' ) status(18:18) = ' '
2609  WRITE (ndso,952) status(1:18)
2610  cfltm = max( 0. , cfltm )
2611  WRITE (ndso,953) cfltm
2612 #endif
2613  !
2614 #ifdef W3_PR2
2615  CALL readnl ( ndss, 'PRO2', status )
2616  IF ( status(18:18) .EQ. ':' ) status(18:18) = ' '
2617  WRITE (ndso,952) status(1:18)
2618  cfltm = max( 0. , cfltm )
2619  dtime = max( 0. , dtime )
2620  latmin = min( 89. , abs(latmin) )
2621  clatmn = cos( latmin * dera )
2622  IF ( dtime .EQ. 0. ) THEN
2623  WRITE (ndso,953) cfltm, latmin
2624  ELSE
2625  WRITE (ndso,954) cfltm, dtime/3600., latmin
2626  END IF
2627  dtme = dtime
2628 #endif
2629  !
2630 #ifdef W3_SMC
2631  CALL readnl ( ndss, 'PSMC', status )
2632  IF ( status(18:18) .EQ. ':' ) status(18:18) = ' '
2633  WRITE (ndso,952) status(1:18)
2634  cflsm = max( 0. , cflsm )
2635  dtims = max( 0. , dtims )
2636  rfmaxd = min( 80.0, abs(rfmaxd) )
2637  refran = rfmaxd * dera
2638  !! Printing out SMC grid parameters.
2639  WRITE (ndso,1950)
2640  WRITE (ndso,1951) pnsmc
2641  WRITE (ndso,1953) cflsm, dtims/3600., rfmaxd
2642  funo3 = uno3
2643  fverg = averg
2644  fswnd = seawnd
2645  arctc = arctic
2646  nbsmc = nbismc
2647  IF( funo3 ) WRITE (ndso,*) &
2648  " Advection use 3rd order UNO3 instead of UNO2 scheme."
2649  IF( fverg ) WRITE (ndso,*) &
2650  " Extra 1-2-1 average smoothing activated on SMC grid."
2651  IF( fswnd ) WRITE (ndso,*) &
2652  " Sea-point only wind input is required for SMC grid. "
2653  IF( arctc ) WRITE (ndso,*) &
2654  " Arctic polar part will be appended to this SMC grid."
2655  nrlv = lvsmc
2656  WRITE (ndso,4001) nrlv
2657  WRITE (ndso,4002) jeqt
2658  WRITE (ndso,4302) ishft
2659  WRITE (ndso,4003) nbsmc
2660 #endif
2661  !
2662 #ifdef W3_PR3
2663  CALL readnl ( ndss, 'PRO3', status )
2664  IF ( status(18:18) .EQ. ':' ) status(18:18) = ' '
2665 #endif
2666  IF (gtype.NE.ungtype) THEN
2667 #ifdef W3_PR3
2668  WRITE (ndso,952) status(1:18)
2669  cfltm = max( 0. , cfltm )
2670  WRITE (ndso,953) cfltm, wdthcg
2671  IF ( wdthcg*(xfr-1.) .GT. 1. ) WRITE (ndso,955) 1./(xfr-1.)
2672  WRITE (ndso,954) wdthth
2673  IF ( wdthth*dth .GT. 1. ) WRITE (ndso,955) 1./dth
2674  WRITE (ndso,*)
2675 #endif
2676  ENDIF
2677 #ifdef W3_PR3
2678  wdcg = wdthcg
2679  wdth = wdthth
2680 #endif
2681  !
2682  ctmax = cfltm
2683  !
2684 #ifdef W3_RTD
2685  ! Set/ read in rotation values - these will be written out
2686  ! later with the rest of the grid info
2687  ! Default is a non-rotated lat-lon grid
2688  plat = 90.
2689  plon = -180.
2690  unrot = .false.
2691  CALL readnl ( ndss, 'ROTD', status )
2692  plon = mod( plon + 180., 360. ) - 180.
2693  ! Ensure that a grid with pole at the geographic North is standard lat-lon
2694  IF ( plat == 90. .AND. ( plon /= -180. .OR. unrot ) ) THEN
2695  WRITE( ndse, 1052 )
2696  CALL extcde ( 33 )
2697  ENDIF
2698  ! Default poles of output b. c. are non-rotated:
2699  bplat = 90.
2700  bplon = -180.
2701  CALL readnl ( ndss, 'ROTB', status )
2702  ! A b. c. dest. grid with pole at the geographic North must be non-rotated
2703  DO i=1,9
2704  IF ( bplat(i) == 90. ) THEN
2705  ! Require BPLON(I) == -180., but don't blaim the user if BPLON(I) == 180.
2706  IF ( bplon(i) == 180. ) bplon(i) = -180.
2707  IF ( bplon(i) == -180. ) cycle
2708  END IF
2709  IF ( bplat(i) < 90. ) cycle
2710  WRITE( ndse, 1053 )
2711  CALL extcde ( 34 )
2712  END DO
2713 #endif
2714  !
2715  ! 6.n Set miscellaneous parameters (ice, seeding, numerics ... )
2716  !
2717  cice0 = 0.5
2718  cicen = 0.5
2719  lice = 0.
2720  icehfac= 1.0
2721  icehmin= 0.2 ! the 0.2 value is arbitrary and needs to be tuned.
2722  icehinit= 0.5
2723  icesln = 1.0
2724  icewind= 1.0
2725  icesnl = 1.0
2726  icesds = 1.0
2727  icehdisp= 0.6 ! Prevent from convergence crash in w3dispmd in the presence of ice, should be tuned
2728  iceddisp= 80
2729  icefdisp= 2
2730  gshift = 0.0d0
2731  pmove = 0.5
2732  xseed = 1.
2733  flagtr = 0
2734  xp = 0.15
2735  xr = 0.10
2736  xfilt = 0.05
2737  ihm = 100
2738  hspm = 0.05
2739  wsm = 1.7
2740  wsc = 0.333
2741  flc = .true.
2742  trckcmpr = .true.
2743  nosw = 5
2744  !
2745  ! Gas fluxes
2746  !
2747  aircmin = 2.0 ! cmin for whitecap coverage and entrained air
2748  airgb = 0.2 ! volume of entrained air constant (Deike et al. 2017)
2749  !
2750 #ifdef W3_NCO
2751  ! NCEP operations retains first three swell systems.
2752  nosw=3
2753 #endif
2754  ptm = 1 ! Default to standard WW3 partitioning. C. Bunney
2755  ptfc = 0.1 ! Part. method 5 cutoff freq default. C. Bunney
2756  fmiche = 1.6
2757  rwndc = 1.
2758  wcor1 = 99.
2759  wcor2 = 0.
2760  btbet = 1.2 ! β for c / [U cos(θ - φ)] < β
2761  ! Variables for Space-Time Extremes
2762  ! Default negative values make w3iogomd switch off space-time extremes
2763  ! forces user to provide NAMELIST if wanting to compute STE parameters
2764  stdx = -1.
2765  stdy = -1.
2766  stdt = -1.
2767  icedisp = .false.
2768  caltype = 'standard'
2769  ! Variables for 3D array output
2770  e3d=0
2771  i1e3d=1
2772  i2e3d=nk
2773  p2sf = 0
2774  i1p2sf = 1
2775  i2p2sf = 15
2776  us3d = 0
2777  i1us3d = 1
2778  i2us3d = nk
2779  ussp=0
2780  iussp=1
2781  stk_wn(:)=0.0
2782  stk_wn(1)=tpi/100. !Set default decay of 100 m for Stokes drift
2783  th1mf=0
2784  i1th1m=1
2785  i2th1m=nk
2786  sth1mf=0
2787  i1sth1m=1
2788  i2sth1m=nk
2789  th2mf=0
2790  i1th2m=1
2791  i2th2m=nk
2792  sth2mf=0
2793  i1sth2m=1
2794  i2sth2m=nk
2795  !
2796  facberg=1.
2797 #ifdef W3_IS0
2798  WRITE (ndso,944)
2799 #endif
2800 #ifdef W3_IS1
2801  isc1 = 1.
2802  isc2 = 0.
2803  CALL readnl ( ndss, 'SIS1', status )
2804  WRITE (ndso,945) status
2805  WRITE (ndso,946) isc1, isc2
2806  is1c1 = isc1
2807  is1c2 = isc2
2808 #endif
2809 #ifdef W3_IS2
2810  isc1 = 1.
2811  is2c2 = 0. ! 0.025
2812  is2c3 = 0. ! 2.4253
2813  is2conc = 0.
2814  is2backscat = 1.
2815  is2break = .false.
2816  is2breakf = 3.6
2817  is2flexstr=6.00e+05 ! value used in Ardhuin et al. 2020
2818  is2isoscat=.true. ! uses isotropic back-scatter
2819  is2disp=.false. !not dispersion only attenuation following Liu disp. eq.
2820  is2dupdate=.true.
2821  is2fragility=0.9
2822  is2dmin=20
2823  is2damp=0.
2824  is2creepb=0.
2825  is2creepc=0.4 ! This gives an impact of break-up over a wider freq. range
2826  ! ! compared to the 0.2 value in Boutin et al. 2018
2827  is2creepd=0.5
2828  is2creepn=3.0
2829  is2breake=1.
2830  is2wim1=1.
2831  is2andisb=.true. !anelastic instead of inelastic dissipation if IS2CREEPB>0
2832  is2andise=0.55 !energy of activation
2833  is2andisd=2.0e-9 !see Ardhuin et al. 2020
2834  is2andisn=1. !dependency on stress. Equal to 1 normally?
2835  CALL readnl ( ndss, 'SIS2', status )
2836  WRITE (ndso,947) status
2837  WRITE (ndso,2948) isc1, is2backscat, is2isoscat, is2break, is2dupdate, is2flexstr, is2disp, &
2841 #endif
2842  !
2843 #ifdef W3_REF1
2844  refcoast=0.
2845  refmap=0.
2846  refmapd=0.
2847  refrmax=1.
2848  reffreqpow=2.
2849  reffreq=0.
2850  refcosp_straight=4.
2851  refslope=0.22
2852  refsubgrid=0.
2853  reficeberg=0.
2854  refunstsource=0.
2855  !
2856  CALL readnl ( ndss, 'REF1', status )
2857  WRITE (ndso,969) status
2858 #endif
2859  !
2860 #ifdef W3_IG1
2861  igmethod = 2
2862  igaddoutp= 0
2863  igsource = 2
2864  igsterms = 0
2865  igmaxfreq=0.03
2866  igsourceatbp = 0
2867  igbcoverwrite = .true.
2868  igswellmax = .true.
2869  igkdmin = 1.1
2870  igfixeddepth = 0.
2871  igempirical = 0.00125
2872  CALL readnl ( ndss, 'SIG1 ', status )
2873  WRITE (ndso,970) status
2874 #endif
2875  !
2876 #ifdef W3_IC2
2877  ic2disper = .false.
2878  ic2turb = 1.
2879  ic2turbs = 0.
2880  ic2rough = 0.01
2881  ic2reynolds = 1.5e5
2882  ic2smooth = 2e5
2883  ic2visc = 1.
2884  ic2dmax = 0.
2885 #endif
2886  !
2887 #ifdef W3_IC3
2888  ic3maxthk = 100.0
2889  ic3maxcnc = 100.0
2890  ic2turb = 2.0 ! from run_test example by F.A.
2891  ic2turbs = 0.
2892  ic2rough = 0.02 ! from run_test example by F.A. (alt:0.1)
2893  ic2reynolds = 1.5e5
2894  ic2smooth = 7.0e4
2895  ic2visc = 2.0
2896  ic3cheng = .true.
2897  usecgice = .false.
2898  ic3hilim = 100.0
2899  ic3kilim = 100.0
2900  ic3hice = -1.0
2901  ic3visc = -2.0
2902  ic3dens = -3.0
2903  ic3elas = -4.0
2904 #endif
2905  !fixme: if USECGICE = .TRUE., don't allow use of IC3MAXTHK<100.0
2906 
2907 #ifdef W3_IC4
2908  ic4method = 1 !switch for methods within IC4
2909  ic4ki=0.0
2910  ic4fc=0.0
2911  ic4cn=0.0
2912  ic4fmin=0.0
2913  ic4kibk=0.0
2914 #endif
2915  !
2916 #ifdef W3_IC5
2917  ic5minig = 1.
2918  ic5minwt = 0.
2919  ic5maxkratio = 1e9
2920  ic5maxki = 100.
2921  ic5minhw = 0.
2922  ic5maxiter = 100.
2923  ic5rkick = 0.
2924  ic5kfilter = 0.0025
2925  ic5vemod = 3. ! 1: EFS, 2: RP, 3: M2 (default)
2926 #endif
2927  !
2928 #ifdef W3_IC2
2929  CALL readnl ( ndss, 'SIC2 ', status )
2930  WRITE (ndso,971) status
2931 #endif
2932  !
2933 #ifdef W3_IC3
2934  CALL readnl ( ndss, 'SIC3 ', status )
2935  WRITE (ndso,971) status
2936 #endif
2937  !
2938 #ifdef W3_IC4
2939  CALL readnl ( ndss, 'SIC4 ', status )
2940  WRITE (ndso,971) status
2941 #endif
2942  !
2943 #ifdef W3_IC5
2944  CALL readnl ( ndss, 'SIC5 ', status )
2945  ic5vemod = min(max(1., ic5vemod), 3.)
2946  WRITE (ndso,971) status
2947  WRITE (ndso,2971) ic5minig, ic5minwt, ic5maxkratio, &
2949  ic5kfilter, ic5mstr(nint(ic5vemod))
2950 #endif
2951  !
2952  CALL readnl ( ndss, 'OUTS', status )
2953  WRITE (ndso,4970) status
2954  !
2955  !
2956  ! output of frequency spectra, th1m ...
2957  !
2958  e3df(1,1) = e3d
2959  e3df(2,1) = min(max(1,i1e3d),nk)
2960  e3df(3,1) = min(max(1,i2e3d),nk)
2961  e3df(1,2) = th1mf
2962  e3df(2,2) = min(max(1,i1th1m),nk)
2963  e3df(3,2) = min(max(1,i2th1m),nk)
2964  e3df(1,3) = sth1mf
2965  e3df(2,3) = min(max(1,i1sth1m),nk)
2966  e3df(3,3) = min(max(1,i2sth1m),nk)
2967  e3df(1,4) = th2mf
2968  e3df(2,4) = min(max(1,i1th2m),nk)
2969  e3df(3,4) = min(max(1,i2th2m),nk)
2970  e3df(1,5) = sth2mf
2971  e3df(2,5) = min(max(1,i1sth2m),nk)
2972  e3df(3,5) = min(max(1,i2sth2m),nk)
2973  !
2974  ! output of microseismic source spectra
2975  !
2976  p2msf(1) = p2sf
2977  p2msf(2) = min(max(1,i1p2sf),nk)
2978  p2msf(3) = min(max(1,i2p2sf),nk)
2979  !
2980  ! output of Stokes drift profile
2981  !
2982  us3df(1) = us3d
2983  us3df(2) = max( 1 , min( nk, i1us3d) )
2984  us3df(3) = max( 1 , min( nk, i2us3d) )
2985  !
2986  ! output of Stokes drift partitions
2987  !
2988  usspf(1) = ussp
2989  usspf(2) = max( 1 , min(25, iussp ) )
2990  IF (iussp.GT.25) THEN
2991  WRITE(ndse,*) ' *** WAVEWATCH III ERROR IN ww3_grid:'
2992  WRITE(ndse,*) " Stokes drift partition outputs not "
2993  WRITE(ndse,*) " intended for use with more than 25 "
2994  WRITE(ndse,*) " partitions. Please reduce IUSSP "
2995  WRITE(ndse,*) " specified in ww3_grid.inp to proceed "
2996  CALL extcde( 31)
2997  ENDIF
2998 
2999  ussp_wn = 0.0 ! initialize to 0s
3000  DO j=1,usspf(2)
3001  ussp_wn(j) = stk_wn(j)
3002  ENDDO
3003 
3004  !
3005  WRITE (ndso,4971) p2msf(1:3)
3006  WRITE (ndso,4972) us3df(1:3)
3007  WRITE (ndso,4973) e3df(1:3,1)
3008  WRITE (ndso,4974) usspf(1:2)
3009  DO j=1,usspf(2)
3010  WRITE(ndso,4975) j,ussp_wn(j)
3011  ENDDO
3012  !
3013  CALL readnl ( ndss, 'MISC', status )
3014  WRITE (ndso,960) status
3015  !
3016  IF ( flagtr.LT.0 .OR. flagtr.GT.6 ) flagtr = 0
3017  cicen = min( 1. , max( 0. , cicen ) )
3018  icesln = min( 1. , max( 0. , icesln ) )
3019  icewind = min( 1. , max( 0. , icewind ) )
3020  icesds = min( 1. , max( 0. , icesds ) )
3021  icesnl = min( 1. , max( 0. , icesnl ) )
3022  ficen = cicen
3023  gridshift=gshift
3024  icescales(1)=icesln
3025  icescales(2)=icewind
3026  icescales(3)=icesnl
3027  icescales(4)=icesds
3028  cmprtrck=trckcmpr
3029  cice0 = min( cicen , max( 0. , cice0 ) )
3030  ficel = lice
3031  iicehmin = icehmin
3032  iicehfac = icehfac
3033  iicehinit = icehinit
3034  iicedisp= icedisp
3035  iicehdisp = icehdisp
3036  iiceddisp = iceddisp
3037  iicefdisp = icefdisp
3038  pmove = max( 0. , pmove )
3039  pfmove = pmove
3040  !
3041  btbeta = min(max(1., btbet), 2.)
3042  aaircmin = alog(grav/aircmin/sig(1))/alog(xfr)+1 ! goes from phase speed C=g/sig to index
3043  aairgb = airgb
3044  !
3045  ! Notes: Presently, if we select CICE0.ne.CICEN requires an obstruction
3046  ! grid, that is initialized with zeros as default.
3047  IF ( flagtr .LT. 3 ) THEN
3048  IF (cice0.NE.cicen) THEN
3049  cice0 = cicen
3050  IF (status=='(user def. values) :') WRITE (ndso,2961)
3051  END IF
3052  END IF
3053 #ifdef W3_IC0
3054  IF ( cice0.EQ.cicen .AND. flagtr.GE.3 ) flagtr = flagtr - 2
3055 #endif
3056  WRITE (ndso,961) cice0, cicen
3057  WRITE (ndso,8972) icewind
3058  fice0 = cice0
3059  ! Variables for Space-Time Extremes
3060  stexu = stdx
3061  IF ( stdy .LE. 0. ) THEN
3062  stdy = stdx
3063  END IF
3064  steyu = stdy
3065  stedu = stdt
3066  IF ( stdx .GT. 0 ) THEN
3067  WRITE (ndso,1040) stdx
3068  WRITE (ndso,1041) stdy
3069  ELSE
3070  WRITE (ndso,1042)
3071  END IF
3072  IF ( stdt .GT. 0 ) THEN
3073  WRITE (ndso,1043) stdt
3074  ELSE
3075  WRITE (ndso,1044)
3076  END IF
3077 #ifdef W3_MGG
3078  WRITE (ndso,962) pmove
3079 #endif
3080  !
3081 #ifdef W3_SEED
3082  xseed = max( 1. , xseed )
3083  WRITE (ndso,964) xseed
3084 #endif
3085 #ifdef W3_SCRIP
3086  WRITE (ndso,963) gshift
3087 #endif
3088  WRITE (ndso,1972) trckcmpr
3089  facsd = xseed
3090 #ifdef W3_RWND
3091  rwindc = rwndc
3092 #endif
3093 #ifdef W3_WCOR
3094  wwcor(1) = wcor1
3095  wwcor(2) = wcor2
3096 #endif
3097  !
3098  xp = max( 1.e-6 , xp )
3099  xr = max( 1.e-6 , xr )
3100  xrel = xr
3101  xfilt = max( 0. , xfilt )
3102  xflt = xfilt
3103  WRITE (ndso,965) xp, xr, xfilt
3104  facp = xp / pi * 0.62e-3 * tpi**4 / grav**2
3105  !
3106  ihmax = max( 50, ihm )
3107  hspmin = max( 0.0001 , hspm )
3108  wsmult = max( 1. , wsm )
3109  wscut = min( 1.0001 , max( 0. , wsc ) )
3110  flcomb = flc
3111  noswll = max( 1 , nosw )
3112  ptmeth = ptm ! Partitioning method. Chris Bunney (Jan 2016)
3113  ptfcut = ptfc ! Freq cutoff for partitiong method 5
3114  pmnam2 = ""
3115  IF( ptmeth .EQ. 1 ) THEN
3116  pmname = "WW3 default"
3117  ELSE IF( ptmeth .EQ. 2 ) THEN
3118  pmname = "Watershedding plus wind cut-off"
3119  ELSE IF( ptmeth .EQ. 3 ) THEN
3120  pmname = "Watershedding only"
3121  wscut = 0.0 ! We don't want to classify by ws frac
3122  pmnam2 = "WSC set to 0.0"
3123  ELSE IF( ptmeth .EQ. 4 ) THEN
3124  pmname = "Wind speed cut-off only"
3125  pmnam2 = "WSC set to 0.0, NOSW set to 1"
3126  wscut = 0.0 ! We don't want to classify by ws frac
3127  noswll = 1 ! Only ever one swell
3128  ELSE IF( ptmeth .EQ. 5 ) THEN
3129  WRITE(pmname, '("2-Band hi/low cutoff at ", F4.2,"Hz")') ptfcut
3130  pmnam2 = "WSC set to 0.0, NOSW set to 1"
3131  wscut = 0.0 ! We don't want to classify by ws frac
3132  noswll = 1 ! Only ever one swell
3133  ELSE
3134  WRITE( ndse, * ) &
3135  "*** Error - unknown partitioing method (PTM)! ***"
3136  CALL exit(1)
3137  ENDIF
3138 
3139  IF ( flcomb ) THEN
3140  j = 1
3141  ELSE
3142  j = 2
3143  END IF
3144  WRITE (ndso,966) ihmax, hspmin, wsmult, wscut, yesxno(j), noswll
3145  WRITE (ndso,5971) pmname
3146  IF( pmnam2 .NE. "" ) WRITE (ndso,5972) pmnam2
3147  !! WRITE (NDSO,966) IHMAX, HSPMIN, WSMULT, WSCUT, YESXNO(J)
3148  !
3149  fhmax = max( 0.01 , fmiche )
3150  j = 2
3151 #ifdef W3_MLIM
3152  j = 1
3153 #endif
3154  WRITE (ndso,967) fhmax, fhmax/sqrt(2.), yesxno(j)
3155  IF ( fhmax.LT.0.50 .AND. j.EQ.1 ) WRITE (ndst,968)
3156  !
3157  IF (trim(caltype) .NE. 'standard' .AND. &
3158  trim(caltype) .NE. '360_day' .AND. &
3159  trim(caltype) .NE. '365_day' ) GOTO 2003
3160  WRITE (ndst,1973) caltype
3161  WRITE (ndso,*)
3162  !
3163  ! 6.x Read values for FLD stress calculation
3164  !
3165 #ifdef W3_FLD1
3166  tailtype = 0
3167  taillev = 0.006
3168  tailt1 = 1.25
3169  tailt2 = 3.00
3170 #endif
3171 #ifdef W3_FLD2
3172  tailtype = 0
3173  taillev = 0.006
3174  tailt1 = 1.25
3175  tailt2 = 3.00
3176 #endif
3177  !
3178 #ifdef W3_FLD1
3179  CALL readnl ( ndss, 'FLD1', status )
3180  taillev = min( max( 0.0005 , taillev ), 0.04)
3181  tail_lev = taillev
3182  tail_id = tailtype
3183  tail_tran1 = tailt1
3184  tail_tran2 = tailt2
3185 #endif
3186 #ifdef W3_FLD2
3187  CALL readnl ( ndss, 'FLD2', status )
3188  taillev = min( max( 0.0005 , taillev ), 0.04)
3189  tail_lev = taillev
3190  tail_id = tailtype
3191  tail_tran1 = tailt1
3192  tail_tran2 = tailt2
3193 #endif
3194  !
3195  ! 6.o End of namelist processing
3196  !
3197  IF (flgnml) THEN
3198  CLOSE (ndss)
3199  ELSE
3200  CLOSE (ndss,status='DELETE')
3201  END IF
3202  !
3203  IF ( flnmlo ) THEN
3204  WRITE (ndso,917)
3205 #ifdef W3_FLX3
3206  WRITE (ndso,2810) cdmax*1.e3, ctype
3207 #endif
3208 #ifdef W3_FLX4
3209  WRITE (ndso,2810) cdfac
3210 #endif
3211 #ifdef W3_LN1
3212  WRITE (ndso,2820) clin, rfpm, rfhf
3213 #endif
3214 #ifdef W3_ST1
3215  WRITE (ndso,2920) cinp
3216 #endif
3217  IF ( .NOT. flstb2 ) THEN
3218 #ifdef W3_ST2
3219  WRITE (ndso,2920) zwnd, swellf
3220 #endif
3221  ELSE
3222 #ifdef W3_STAB2
3223  WRITE (ndso,2921) zwnd, swellf, stabsh, stabof, &
3224  cneg, cpos, fneg
3225 #endif
3226  END IF
3227  !
3228 #ifdef W3_ST3
3229  WRITE (ndso,2920) zwnd, alpha0, z0max, betamax, sinthp, zalp, &
3230  swellf
3231 #endif
3232 #ifdef W3_ST4
3233  WRITE (ndso,2920) zwnd, alpha0, z0max, betamax, sinthp, zalp, &
3237 #endif
3238 #ifdef W3_ST6
3239  WRITE (ndso,2920) sina0, sinws, sinfc
3240 #endif
3241 #ifdef W3_NL1
3242  WRITE (ndso,2922) lambda, nlprop, kdconv, kdmin, &
3243  snlcs1, snlcs2, snlcs3, &
3244  iqtype, tailnl, gqmnf1, &
3247 #endif
3248 #ifdef W3_NL2
3249  WRITE (ndso,2922) iqtype, tailnl, ndepth
3250  IF ( iqtype .EQ. 3 ) THEN
3251  IF ( ndepth .EQ. 1 ) THEN
3252  WRITE (ndso,3923) dpthnl(1)
3253  ELSE
3254  WRITE (ndso,4923) dpthnl(1)
3255  END IF
3256  WRITE (ndso,5923) dpthnl(2:ndepth-1)
3257  WRITE (ndso,6923) dpthnl(ndepth)
3258  END IF
3259 #endif
3260 #ifdef W3_NL3
3261  WRITE (ndso,2922) nqdef, msc, nsc, kdfd, kdfs
3262  IF ( nqdef .EQ. 1 ) THEN
3263  WRITE (ndso,3923) qparms(1:5)
3264  ELSE
3265  WRITE (ndso,4923) qparms(1:5)
3266  DO j=2, nqdef-1
3267  WRITE (ndso,5923) qparms((j-1)*5+1:j*5)
3268  END DO
3269  WRITE (ndso,6923) qparms((nqdef-1)*5+1:nqdef*5)
3270  END IF
3271 #endif
3272 #ifdef W3_NL4
3273  WRITE (ndso,2922) indtsa, altlp
3274 #endif
3275 #ifdef W3_NL5
3276  WRITE (ndso,2922) qr5dpt, qr5oml, qi5dis, qi5kev, qi5ipl, qi5pmx
3277 #endif
3278 #ifdef W3_NLS
3279  WRITE (ndso,8922) a34, fhfc, dnm, fc1, fc2, fc3
3280 #endif
3281 #ifdef W3_ST1
3282  WRITE (ndso,2924) cdis, apm
3283 #endif
3284 #ifdef W3_ST2
3285  WRITE (ndso,2924) sdsa0, sdsa1, sdsa2, sdsb0, sdsb1, phimin
3286 #endif
3287 #ifdef W3_ST3
3288  WRITE (ndso,2924) sdsc1, wnmeanp, fxpm3, fxfm3, sdsdelta1, &
3289  sdsdelta2
3290 #endif
3291 
3292 #ifdef W3_ST4
3293  WRITE (ndso,2924) sdsbchoice, sdsc2, sdscum, sdsc4, &
3294  sdsc5, sdsc6, &
3295  wnmeanp, fxpm3, fxfm3, fxfmage, &
3302 #endif
3303 #ifdef W3_ST6
3304  WRITE (ndso,2924) sdset, sdsa1, sdsa2, sdsp1, sdsp2
3305  WRITE (ndso,2937) swlb1, cstb1
3306 #endif
3307 #ifdef W3_BT1
3308  WRITE (ndso,2926) gamma
3309 #endif
3310 #ifdef W3_BT4
3311  WRITE (ndso,2926) sedmapd50, sed_d50_uniform, &
3314 #endif
3315 #ifdef W3_DB1
3316  IF ( bjflag ) THEN
3317  WRITE (ndso,2928) bjalfa, bjgam, '.TRUE.'
3318  ELSE
3319  WRITE (ndso,2928) bjalfa, bjgam, '.FALSE.'
3320  END IF
3321 #endif
3322 #ifdef W3_PR1
3323  WRITE (ndso,2953) cfltm
3324 #endif
3325 #ifdef W3_PR2
3326  WRITE (ndso,2953) cfltm, dtime, latmin
3327 #endif
3328 #ifdef W3_SMC
3329  WRITE (ndso,2954) cflsm, dtims, arctic, rfmaxd, uno3, &
3331 #endif
3332 #ifdef W3_PR3
3333  WRITE (ndso,2953) cfltm, wdthcg, wdthth
3334 #endif
3335  !
3336  WRITE (ndso,2956) ugbccfl, ugobcauto, ugobcdepth,trim(ugobcfile), &
3343  jgs_limiter, &
3344  jgs_limiter_func, &
3345  jgs_use_jacobi, &
3347  jgs_maxiter, &
3348  jgs_pmin, &
3349  jgs_diff_thr, &
3350  jgs_norm_thr, &
3351  jgs_nlevel, &
3353  !
3354  WRITE (ndso,2976) p2sf, i1p2sf, i2p2sf, &
3355  us3d, i1us3d, i2us3d, &
3356  ussp, iussp, &
3357  e3d, i1e3d, i2e3d, &
3358  th1mf, i1th1m, i2th1m, &
3359  sth1mf, i1sth1m, i2sth1m, &
3360  th2mf, i1th2m, i2th2m, &
3362  !
3363 #ifdef W3_REF1
3364  WRITE(ndso,2986) refcoast, reffreq, refslope, refmap, &
3367 #endif
3368  !
3369 #ifdef W3_IG1
3370  WRITE(ndso,2977) igmethod, igaddoutp, igsource, &
3374 #endif
3375  !
3376 #ifdef W3_IC2
3377  WRITE(ndso,2978) ic2disper, ic2turb, ic2rough, &
3379  ic2dmax
3380 #endif
3381  !
3382 #ifdef W3_IC3
3383  WRITE(ndso,2979) ic3maxthk, ic3maxcnc, ic2turb, &
3388 #endif
3389  !
3390 #ifdef W3_IC4
3391  WRITE(ndso,nml=sic4)
3392 #endif
3393  !
3394 #ifdef W3_IC5
3395  WRITE(ndso,2981) ic5minig, ic5minwt, ic5maxkratio, &
3398 #endif
3399  !
3400 #ifdef W3_IS1
3401  WRITE (ndso,2946) is1c1, is1c2
3402 #endif
3403  !
3404 #ifdef W3_IS2
3405  WRITE (ndso,948) isc1, is2backscat, is2isoscat, is2break, &
3410 #endif
3411  !
3412 #ifdef W3_UOST
3413  WRITE (ndso, 4502) adjustl(trim(uostfilelocal)), adjustl(trim(uostfileshadow)), &
3414  uostfactorlocal, uostfactorshadow
3415 #endif
3416 
3417  !
3418  IF ( flcomb ) THEN
3419  WRITE (ndso,2966) cice0, cicen, lice, pmove, xseed, flagtr, &
3420  xp, xr, xfilt, ihmax, hspmin, wsmult, &
3421  wscut, '.TRUE.', noswll, fhmax, &
3422  rwndc, wcor1, wcor2, facberg, gshift, &
3423  stdx, stdy, stdt, icehmin, icehfac, &
3425  icesln, icewind, icesnl, icesds, &
3426  iceddisp,icefdisp, caltype, trckcmpr, &
3427  btbeta
3428  ELSE
3429  WRITE (ndso,2966) cice0, cicen, lice, pmove, xseed, flagtr, &
3430  xp, xr, xfilt, ihmax, hspmin, wsmult, &
3431  wscut, '.FALSE.', noswll, fhmax, &
3432  rwndc, wcor1, wcor2, facberg, gshift, &
3433  stdx, stdy, stdt, icehmin, icehfac, &
3435  icesln, icewind, icesnl, icesds, &
3436  iceddisp, icefdisp, caltype, trckcmpr,&
3437  btbeta
3438  END IF
3439  !
3440 #ifdef W3_FLD1
3441  WRITE(ndso,2987) tail_id, tail_lev, tail_tran1, tail_tran2
3442 #endif
3443 #ifdef W3_FLD2
3444  WRITE(ndso,2987) tail_id, tail_lev, tail_tran1, tail_tran2
3445 #endif
3446 #ifdef W3_RTD
3447  WRITE(ndso,4991) plat, plon, unrot
3448  WRITE(ndso,4992) bplat, bplon
3449 #endif
3450  !
3451  WRITE (ndso,918)
3452  END IF
3453  !
3454  ! 6.p Set various other values ...
3455  ! ... Tail in integration --> scale factor for A to E conv
3456  !
3457  fte = 0.25 * sig(nk) * dth * sig(nk)
3458  ftf = 0.20 * dth * sig(nk)
3459  ftwn = 0.20 * sqrt(grav) * dth * sig(nk)
3460  fttr = ftf
3461  ftwl = grav / 6. / sig(nk) * dth * sig(nk)
3462 #ifdef W3_ST3
3463  stxftf = 1/(fachf-1.-wnmeanp*2) &
3464  * sig(nk)**(2+wnmeanp*2) * dth
3465  stxftftail = 1/(fachf-1.-wnmeanptail*2) &
3466  * sig(nk)**(2+wnmeanptail*2) * dth
3467  stxftwn = 1/(fachf-1.-wnmeanp*2) * sig(nk)**(2) &
3468  * (sig(nk)/sqrt(grav))**(wnmeanp*2) * dth
3469  sstxftf = stxftf
3470  sstxftftail = stxftftail
3471  sstxftwn = stxftwn
3472 #endif
3473  !
3474 #ifdef W3_ST4
3475  stxftf = 1/(fachf-1.-wnmeanp*2) &
3476  * sig(nk)**(2+wnmeanp*2) * dth
3477  stxftftail = 1/(fachf-1.-wnmeanptail*2) &
3478  * sig(nk)**(2+wnmeanptail*2) * dth
3479  stxftwn = 1/(fachf-1.-wnmeanp*2) * sig(nk)**(2) &
3480  * (sig(nk)/sqrt(grav))**(wnmeanp*2) * dth
3481  sstxftf = stxftf
3482  sstxftftail = stxftftail
3483  sstxftwn = stxftwn
3484 #endif
3485  !
3486  ! ... High frequency cut-off
3487  !
3488  fxfm = 2.5
3489 #ifdef W3_ST6
3490  fxfm = sin6fc
3491 #endif
3492  fxpm = 4.0
3493  fxpm = fxpm * grav / 28.
3494  fxfm = fxfm * tpi
3495  xfc = 3.0
3496 #ifdef W3_ST2
3497  xfh = 2.0
3498  xf1 = 1.75
3499  xf2 = 2.5
3500  xft = xf2
3501 #endif
3502  !
3503  facti1 = 1. / log(xfr)
3504  facti2 = 1. - log(tpi*fr1) * facti1
3505  !
3506  ! Setting of FACHF moved to before !/NL2 set-up for consistency
3507  !
3508 #ifdef W3_NL2
3509  fachf = -tailnl
3510 #endif
3511  fachfa = xfr**(-fachf-2)
3512  fachfe = xfr**(-fachf)
3513  !
3514  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3515  ! 7. Read and prepare the grid.
3516  ! 7.a Type of grid
3517  !
3518  IF (flgnml) THEN
3519  gstrg=trim(nml_grid%TYPE)
3520  IF (trim(nml_grid%COORD).EQ.'SPHE') flagll=.true.
3521  IF (trim(nml_grid%COORD).EQ.'CART') flagll=.false.
3522  cstrg=trim(nml_grid%CLOS)
3523  ELSE
3524  CALL nextln ( comstr , ndsi , ndse )
3525  READ (ndsi,*,END=2001,ERR=2002) GSTRG, FLAGLL, cstrg
3526  CALL nextln ( comstr , ndsi , ndse )
3527  END IF
3528 
3529  SELECT CASE (trim(gstrg))
3530  CASE ('RECT')
3531  gtype = rlgtype
3532  WRITE (ndso,3000) 'rectilinear'
3533  CASE ('CURV')
3534  gtype = clgtype
3535  WRITE (ndso,3000) 'curvilinear'
3536  CASE ('UNST')
3537  gtype = ungtype
3538  WRITE (ndso,3000) 'unstructured'
3539  !!Li Add SMC grid type option. JGLi12Oct2020
3540  CASE ('SMCG')
3541  gtype = smctype
3542  WRITE (ndso,3000) 'SMC Grid'
3543  CASE DEFAULT
3544  WRITE (ndse,1007) trim(gstrg)
3545  CALL extcde ( 25 )
3546  END SELECT
3547  !
3548  IF ( flagll ) THEN
3549  factor = 1.
3550  WRITE (ndso,3001) 'spherical'
3551  ELSE
3552  factor = 1.e-3
3553  WRITE (ndso,3001) 'Cartesian'
3554  END IF
3555  !
3556  ! Only process grid closure string for logically rectangular grids.
3557  ! Closure setting for unstructured grids is NONE.
3558  iclose = iclose_none
3559  IF ( gtype.NE.ungtype ) THEN
3560  SELECT CASE (trim(cstrg))
3561  CASE ('NONE')
3562  iclose = iclose_none
3563  WRITE (ndso,3002) 'none'
3564  CASE ('SMPL')
3565  iclose = iclose_smpl
3566  WRITE (ndso,3002) 'simple'
3567  CASE ('TRPL')
3568  WRITE (ndse,'(/2A)') ' *** WARNING WW3_GRID: TRIPOLE ', &
3569  'GRID CLOSURE IMPLEMENTATION IS INCOMPLETE ***'
3570  iclose = iclose_trpl
3571  WRITE (ndso,3002) 'tripole'
3572  IF ( gtype.EQ.rlgtype ) THEN
3573  WRITE (ndse,1009)
3574  CALL extcde ( 25 )
3575  END IF
3576  CASE DEFAULT
3577  ! Check for old style GLOBAL input
3578  SELECT CASE (trim(cstrg))
3579  CASE ('T','t','.TRU','.tru')
3580  iclose = iclose_smpl
3581  WRITE (ndso,3002) 'simple'
3582  WRITE (ndse,1013)
3583  CASE ('F','f','.FAL','.fal')
3584  iclose = iclose_none
3585  WRITE (ndso,3002) 'none'
3586  WRITE (ndse,1013)
3587  CASE DEFAULT
3588  WRITE (ndse,1012) trim(cstrg)
3589  CALL extcde ( 25 )
3590  END SELECT
3591  END SELECT
3592  IF ( iclose.NE.iclose_none .AND. .NOT.flagll ) THEN
3593  WRITE (ndse,1008)
3594  CALL extcde ( 25 )
3595  END IF
3596  END IF !GTYPE.NE.UNGTYPE
3597  !
3598  ! 7.b Size of grid
3599  !
3600  IF (flgnml) THEN
3601  SELECT CASE ( gtype )
3602  !!Li SMCTYPE shares domain info with RLGTYPE. JGLi12Oct2020
3603  CASE ( rlgtype, smctype )
3604  nx = nml_rect%NX
3605  ny = nml_rect%NY
3606  nx = max( 3 , nx )
3607  ny = max( 3 , ny )
3608  WRITE (ndso,3003) nx, ny
3609  CASE ( clgtype )
3610  nx = nml_curv%NX
3611  ny = nml_curv%NY
3612  nx = max( 3 , nx )
3613  ny = max( 3 , ny )
3614  WRITE (ndso,3003) nx, ny
3615  CASE ( ungtype )
3616  ny=1
3617  END SELECT
3618  ELSE
3619  IF ( gtype.NE.ungtype) THEN
3620  CALL nextln ( comstr , ndsi , ndse )
3621  READ (ndsi,*,END=2001,ERR=2002) NX, ny
3622  nx = max( 3 , nx )
3623  ny = max( 3 , ny )
3624  WRITE (ndso,3003) nx, ny
3625  ELSE
3626  ny =1
3627  END IF
3628  END IF
3629  !
3630  ! Propagation specific to unstructured grids
3631  !
3632  do_change_wlv=.false.
3633  IF ( gtype.EQ.ungtype) THEN
3634  unstschemes = 0
3635  IF (expfsn) unstschemes(1) = 1
3636  IF (expfspsi) unstschemes(2) = 1
3637  IF (expfsfct) unstschemes(3) = 1
3638  IF (impfsn) unstschemes(4) = 1
3639  IF (imptotal) unstschemes(5) = 1
3640  IF (exptotal) unstschemes(6) = 1
3641 
3642  IF (sum(unstschemes) .eq. 0) THEN
3643  WRITE(ndse,*) 'NO UNST SCHEME SELECTED'
3644  CALL extcde ( 19 )
3645  ELSE IF (sum(unstschemes) .gt. 1) THEN
3646  WRITE(ndse,*) 'MORE THAN ONE UNST SCHEME SELECTED'
3647  CALL extcde ( 19 )
3648  ENDIF
3649 
3650  unstscheme=-1
3651  DO ix=1,6
3652  IF (unstschemes(ix).EQ.1) THEN
3653  unstscheme=ix
3654  EXIT
3655  END IF
3656  END DO
3657 
3658  fsbccfl = ugbccfl
3659  SELECT CASE (unstscheme)
3660  CASE (1)
3661  fsn = expfsn
3662  pname2 = 'N Explicit (Fluctuation Splitting) '
3663  CASE (2)
3664  fspsi = expfspsi
3665  pname2 = 'PSI Explicit (Fluctuation Splitting) '
3666  CASE (3)
3667  fsfct = expfsfct
3668  pname2 = ' Flux Corrected Transport Explicit'
3669  CASE (4)
3670  fsnimp = impfsn
3671  pname2 = 'N Implicit (Fluctuation Splitting) '
3672  CASE (5)
3673  fstotalimp = imptotal
3674  pname2 = 'N Implicit (Fluctuation Splitting) for total implicit'
3675  CASE (6)
3676  fstotalexp = exptotal
3677  pname2 = 'N Explicit (Fluctuation Splitting) for one exchange explicit DC HPCF '
3678  END SELECT
3679 
3680  IF (fstotalimp .or. fstotalexp) THEN
3681  lpdlib = .true.
3682  ENDIF
3683  !
3684  IF (sum(unstschemes).GT.1) WRITE(ndso,1035)
3685  WRITE (ndso,2951) pname2
3686 
3687 
3688  IF (imprefraction .and. imptotal .AND. flcth) THEN
3689  fsrefraction = .true.
3690  pname2 = 'Refraction done implicitly'
3691  WRITE (ndso,2951) pname2
3692  ELSE
3693  fsrefraction = .false.
3694  END IF
3695  IF (impfreqshift .and. imptotal .AND. flck) THEN
3696  fsfreqshift = .true.
3697  pname2 = 'Frequency shifting done implicitly'
3698  WRITE (ndso,2951) pname2
3699  ELSE
3700  fsfreqshift = .false.
3701  END IF
3702  IF (impsource .and. imptotal .AND. flsou) THEN
3703  fssource = .true.
3704  pname2 = 'Source terms integrated implicitly'
3705  WRITE (ndso,2951) pname2
3706  ELSE
3707  fssource = .false.
3708  END IF
3709  IF (setup_apply_wlv) THEN
3710  do_change_wlv = setup_apply_wlv
3711  pname2 = 'Wave setup is added to the WLV'
3712  WRITE (ndso,2952) pname2
3713  END IF
3714  solverthr_stp = solverthr_setup
3715  crit_dep_stp = crit_dep_setup
3716  END IF
3717 
3718  !
3719  ! 7.c Grid coordinates (branch here based on grid type)
3720  !
3721  IF ( gtype.NE.ungtype) ALLOCATE ( xgrdin(nx,ny), ygrdin(nx,ny) )
3722  SELECT CASE ( gtype )
3723  !
3724  ! 7.c.1 Rectilinear grid
3725  !
3726  !!Li SMC grid shares domain info with RLGTYPE. JGLi12Oct2020
3727  CASE ( rlgtype, smctype )
3728  !
3729  IF (flgnml) THEN
3730  sx = nml_rect%SX
3731  sy = nml_rect%SY
3732  vsc = nml_rect%SF
3733  x0 = nml_rect%X0
3734  y0 = nml_rect%Y0
3735  vsc0 = nml_rect%SF0
3736  ELSE
3737  CALL nextln ( comstr , ndsi , ndse )
3738  READ (ndsi,*,END=2001,ERR=2002) SX, SY, vsc
3739  CALL nextln ( comstr , ndsi , ndse )
3740  READ (ndsi,*,END=2001,ERR=2002) X0, Y0, vsc0
3741  END IF
3742  !
3743  vsc = max( 1.e-7 , vsc )
3744  sx = sx / vsc
3745  sy = sy / vsc
3746  sx = max( 1.e-7 , sx )
3747  sy = max( 1.e-7 , sy )
3748  IF ( iclose.EQ.iclose_smpl ) sx = 360. / real(nx)
3749  !
3750  vsc0 = max( 1.e-7 , vsc0 )
3751  x0 = x0 / vsc0
3752  y0 = y0 / vsc0
3753  !
3754  IF ( flagll ) THEN
3755  WRITE (ndso,3004) factor*sx, factor*sy, &
3756  factor*x0, factor*(x0+real(nx-1)*sx), &
3757  factor*y0, factor*(y0+real(ny-1)*sy)
3758  ELSE
3759  WRITE (ndso,3005) factor*sx, factor*sy, &
3760  factor*x0, factor*(x0+real(nx-1)*sx), &
3761  factor*y0, factor*(y0+real(ny-1)*sy)
3762  END IF
3763  !
3764  DO iy=1, ny
3765  DO ix=1, nx
3766  xgrdin(ix,iy) = x0 + real(ix-1)*sx
3767  ygrdin(ix,iy) = y0 + real(iy-1)*sy
3768  END DO
3769  END DO
3770  !
3771  ! 7.c.2 Curvilinear grid
3772  !
3773  CASE ( clgtype )
3774  !
3775  ! 7.c.2.a Process x-coordinates
3776  !
3777  IF (flgnml) THEN
3778  ndsg = nml_curv%XCOORD%IDF
3779  vsc = nml_curv%XCOORD%SF
3780  vof = nml_curv%XCOORD%OFF
3781  idla = nml_curv%XCOORD%IDLA
3782  idfm = nml_curv%XCOORD%IDFM
3783  rform = trim(nml_curv%XCOORD%FORMAT)
3784  from = trim(nml_curv%XCOORD%FROM)
3785  fname = trim(nml_curv%XCOORD%FILENAME)
3786  ELSE
3787  CALL nextln ( comstr , ndsi , ndse )
3788  READ (ndsi,*,END=2001,ERR=2002) NDSG, VSC, VOF, &
3789  idla, idfm, rform, from, fname
3790  END IF
3791  !
3792  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
3793  IF (idfm.LT.1 .OR. idfm.GT.3) idfm = 1
3794  !
3795  WRITE (ndso,3006) ndsg, vsc, vof, idla, idfm
3796  IF (idfm.EQ.2) WRITE (ndso,3008) trim(rform)
3797  IF (from.EQ.'NAME' .AND. ndsg.NE.ndsi) &
3798  WRITE (ndso,3009) trim(fname)
3799  !
3800  IF ( ndsg .EQ. ndsi ) THEN
3801  IF ( idfm .EQ. 3 ) THEN
3802  WRITE (ndse,1004) ndsg
3803  CALL extcde (23)
3804  ELSE
3805  IF (.NOT.flgnml) THEN
3806  CALL nextln ( comstr , ndsi , ndse )
3807  END IF
3808  END IF
3809  ELSE
3810  IF ( idfm .EQ. 3 ) THEN
3811  IF (from.EQ.'NAME') THEN
3812  OPEN (ndsg,file=trim(fnmpre)//trim(fname),&
3813  form='UNFORMATTED', convert=file_endian, &
3814  status='OLD',err=2000,iostat=ierr)
3815  ELSE
3816  OPEN (ndsg, &
3817  form='UNFORMATTED', convert=file_endian, &
3818  status='OLD',err=2000,iostat=ierr)
3819  END IF
3820  ELSE
3821  IF (from.EQ.'NAME') THEN
3822  OPEN (ndsg,file=trim(fnmpre)//trim(fname),&
3823  status='OLD',err=2000,iostat=ierr)
3824  ELSE
3825  OPEN (ndsg, &
3826  status='OLD',err=2000,iostat=ierr)
3827  END IF
3828  END IF !IDFM
3829  END IF !NDSG
3830  !
3831  CALL ina2r ( xgrdin, nx, ny, 1, nx, 1, ny, ndsg, ndst, ndse, &
3832  idfm, rform, idla, vsc, vof)
3833  !
3834  ! 7.c.2.b Process y-coordinates
3835  !
3836  IF (flgnml) THEN
3837  ndsg = nml_curv%YCOORD%IDF
3838  vsc = nml_curv%YCOORD%SF
3839  vof = nml_curv%YCOORD%OFF
3840  idla = nml_curv%YCOORD%IDLA
3841  idfm = nml_curv%YCOORD%IDFM
3842  rform = trim(nml_curv%YCOORD%FORMAT)
3843  from = trim(nml_curv%YCOORD%FROM)
3844  fname = trim(nml_curv%YCOORD%FILENAME)
3845  ELSE
3846  CALL nextln ( comstr , ndsi , ndse )
3847  READ (ndsi,*,END=2001,ERR=2002) NDSG, VSC, VOF, &
3848  idla, idfm, rform, from, fname
3849  END IF
3850  !
3851  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
3852  IF (idfm.LT.1 .OR. idfm.GT.3) idfm = 1
3853  !
3854  WRITE (ndso,3007) ndsg, vsc, vof, idla, idfm
3855  IF (idfm.EQ.2) WRITE (ndso,3008) trim(rform)
3856  IF (from.EQ.'NAME' .AND. ndsg.NE.ndsi) &
3857  WRITE (ndso,3009) trim(fname)
3858  !
3859  IF ( ndsg .EQ. ndsi ) THEN
3860  IF ( idfm .EQ. 3 ) THEN
3861  WRITE (ndse,1004) ndsg
3862  CALL extcde (23)
3863  ELSE
3864  IF (.NOT.flgnml) THEN
3865  CALL nextln ( comstr , ndsi , ndse )
3866  END IF
3867  END IF
3868  ELSE
3869  IF ( idfm .EQ. 3 ) THEN
3870  IF (from.EQ.'NAME') THEN
3871  OPEN (ndsg,file=trim(fnmpre)//trim(fname),&
3872  form='UNFORMATTED', convert=file_endian, &
3873  status='OLD',err=2000,iostat=ierr)
3874  ELSE
3875  OPEN (ndsg, &
3876  form='UNFORMATTED', convert=file_endian, &
3877  status='OLD',err=2000,iostat=ierr)
3878  END IF
3879  ELSE
3880  IF (from.EQ.'NAME') THEN
3881  OPEN (ndsg,file=trim(fnmpre)//trim(fname),&
3882  status='OLD',err=2000,iostat=ierr)
3883  ELSE
3884  OPEN (ndsg, &
3885  status='OLD',err=2000,iostat=ierr)
3886  END IF
3887  END IF !IDFM
3888  END IF !NDSG
3889  !
3890  CALL ina2r ( ygrdin, nx, ny, 1, nx, 1, ny, ndsg, ndst, ndse, &
3891  idfm, rform, idla, vsc, vof)
3892  !
3893  ! 7.c.2.c Check for obvious errors in grid definition or input
3894  !
3895  ! ....... Check for inverted grid (can result from wrong IDLA)
3896  IF ( (xgrdin(2,1)-xgrdin(1,1))*(ygrdin(1,2)-ygrdin(1,1)) .LT. &
3897  (ygrdin(2,1)-ygrdin(1,1))*(xgrdin(1,2)-xgrdin(1,1)) ) THEN
3898  WRITE (ndse,1011) idla
3899  !.........Notes: here, we are checking to make sure that the j axis is ~90 degrees
3900  !................counter-clockwise from the i axis (the standard cartesian setup).
3901  !................So, it is a check on the handedness of the grid.
3902  !................We have confirmed for one case that a left-handed grid produces
3903  !................errors in SCRIP. We have not confirmed that left-handed grids necessarily
3904  !................produce errors in single-grid simulations, or that they necessarily
3905  !................produce errors in all multi-grid simulations.
3906  !................Note that transposing or flipping a grid will generally change the handedness.
3907  CALL extcde (25)
3908  END IF
3909  !
3910  ! 7.c.3 Unstructured grid
3911  !
3912  CASE ( ungtype )
3913  !
3914  maxx = 0.
3915  maxy = 0.
3916  dxymax = 0.
3917  WRITE (ndso,1150)
3918 
3919  IF (flgnml) THEN
3920  zlim = nml_grid%ZLIM
3921  dmin = nml_grid%DMIN
3922  ndsg = nml_unst%IDF
3923  vsc = nml_unst%SF
3924  idla = nml_unst%IDLA
3925  idfm = nml_unst%IDFM
3926  rform = trim(nml_unst%FORMAT)
3927  from = 'NAME'
3928  fname = trim(nml_unst%FILENAME)
3929  ugobcfile = trim(nml_unst%UGOBCFILE)
3930  END IF
3931  END SELECT !GTYPE
3932  !
3933  ! 7.d Depth information for grid
3934  !
3935  IF (flgnml) THEN
3936  IF (gtype.NE.ungtype) THEN
3937  zlim = nml_grid%ZLIM
3938  dmin = nml_grid%DMIN
3939  ndsg = nml_depth%IDF
3940  vsc = nml_depth%SF
3941  idla = nml_depth%IDLA
3942  idfm = nml_depth%IDFM
3943  rform = trim(nml_depth%FORMAT)
3944  from = trim(nml_depth%FROM)
3945  fname = trim(nml_depth%FILENAME)
3946  END IF
3947  ELSE
3948  CALL nextln ( comstr , ndsi , ndse )
3949  READ (ndsi,*,END=2001,ERR=2002) ZLIM, DMIN, NDSG, VSC, IDLA, &
3950  idfm, rform, from, fname
3951  END IF
3952  !
3953  dmin = max( 1.e-3 , dmin )
3954  IF ( abs(vsc) .LT. 1.e-7 ) vsc = 1.
3955  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
3956  IF (idfm.LT.1 .OR. idfm.GT.3) idfm = 1
3957  !
3958  WRITE (ndso,972) ndsg, zlim, dmin, vsc, idla, idfm
3959  IF (idfm.EQ.2) WRITE (ndso,973) trim(rform)
3960  IF (from.EQ.'NAME' .AND. ndsg.NE.ndsi) &
3961  WRITE (ndso,974) trim(fname)
3962 
3963 #ifdef W3_SMC
3964  !Li Save the depth conversion factor for SMC grid use. JGLi03Nov2023
3965  dvsmc = vsc
3966 #endif
3967 
3968  !
3969  ! 7.e Read bottom depths
3970  !
3971  IF ( gtype.NE.ungtype ) THEN
3972  !
3973  ! Reading depths on structured grid
3974  !
3975  ALLOCATE ( zbin(nx,ny), obsx(nx,ny), obsy(nx,ny) )
3976  !
3977  ! Initialize subgrid obstructions with zeros.
3978  zbin(:,:)=0.
3979  obsx(:,:)=0.
3980  obsy(:,:)=0.
3981 
3982  !Li Suspended for SMC grid, which uses depth stored in its cell array.
3983  !Li JGLi15Oct2014
3984  IF( gtype .NE. smctype ) THEN
3985  !
3986  IF ( ndsg .EQ. ndsi ) THEN
3987  IF ( idfm .EQ. 3 ) THEN
3988  WRITE (ndse,1004) ndsg
3989  CALL extcde (23)
3990  ELSE
3991  CALL nextln ( comstr , ndsi , ndse )
3992  END IF
3993  ELSE ! NDSG.NE.NDSI
3994  IF ( idfm .EQ. 3 ) THEN
3995  IF (from.EQ.'NAME') THEN
3996  OPEN (ndsg,file=trim(fnmpre)//trim(fname), &
3997  form='UNFORMATTED', convert=file_endian,&
3998  status='OLD',err=2000,iostat=ierr)
3999  ELSE
4000  OPEN (ndsg, form='UNFORMATTED', convert=file_endian, &
4001  status='OLD',err=2000,iostat=ierr)
4002  END IF
4003  ELSE
4004  IF (from.EQ.'NAME') THEN
4005  OPEN (ndsg,file=trim(fnmpre)//trim(fname), &
4006  status='OLD',err=2000,iostat=ierr)
4007  ELSE
4008  OPEN (ndsg, &
4009  status='OLD',err=2000,iostat=ierr)
4010  END IF
4011  END IF
4012  END IF !( NDSG .EQ. NDSI )
4013  !
4014  CALL ina2r ( zbin, nx, ny, 1, nx, 1, ny, ndsg, ndst, ndse, &
4015  idfm, rform, idla, vsc, 0.0)
4016  !
4017  !Li End of IF( GTYPE .NE. SMCTYPE ) block
4018  ENDIF
4019  !
4020  ELSE
4021  !
4022  ! Reading depths on unstructured grid (this also sets number of mesh points, NX)
4023  !
4024  CALL readmsh(ndsg,fname)
4025  ALLOCATE(zbin(nx, ny),obsx(nx,ny),obsy(nx,ny))
4026  zbin(:,1) = vsc * zb(:)
4027  !
4028  ! subgrid obstructions are not yet handled in unstructured grids
4029  !
4030  obsx(:,:)=0.
4031  obsy(:,:)=0.
4032 
4033  END IF
4034  !
4035  ! 7.f Set up temporary map
4036  !
4037  ALLOCATE ( tmpsta(ny,nx), tmpmap(ny,nx) )
4038  tmpsta = 0
4039  !
4040  IF (gtype .EQ. ungtype) THEN
4041  tmpsta = 1
4042  ELSE
4043  DO iy=1, ny
4044  DO ix=1, nx
4045  IF ( zbin(ix,iy) .LE. zlim ) tmpsta(iy,ix) = 1
4046  END DO
4047  END DO
4048  ENDIF
4049  !
4050  !Li Suspended for SMC grid. JGLi15Oct2014
4051  IF( gtype .NE. smctype ) THEN
4052  !
4053  ! 7.g Subgrid information
4054  !
4055  trflag = flagtr
4056  IF ( trflag.GT.6 .OR. trflag.LT.0 ) trflag = 0
4057  !
4058  IF ( trflag .EQ. 0 ) THEN
4059  WRITE (ndso,976) 'Not available.'
4060  ELSE IF ( trflag.EQ.1 .OR. trflag.EQ.3 .OR. trflag.EQ.5 ) THEN
4061  WRITE (ndso,976) 'In between grid points.'
4062  ELSE
4063  WRITE (ndso,976) 'At grid points.'
4064  END IF
4065  !
4066  IF ( trflag .NE. 0 ) THEN
4067  !
4068  ! 7.g.1 Info from input file
4069  !
4070  IF (flgnml) THEN
4071  ndstr = nml_obst%IDF
4072  vsc = nml_obst%SF
4073  idla = nml_obst%IDLA
4074  idft = nml_obst%IDFM
4075  rform = trim(nml_obst%FORMAT)
4076  from = trim(nml_obst%FROM)
4077  tname = trim(nml_obst%FILENAME)
4078  ELSE
4079  CALL nextln ( comstr , ndsi , ndse )
4080  READ (ndsi,*,END=2001,ERR=2002) NDSTR, VSC, IDLA, IDFT, RFORM, &
4081  from, tname
4082  END IF
4083  !
4084  IF ( abs(vsc) .LT. 1.e-7 ) vsc = 1.
4085  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
4086  IF (idft.LT.1 .OR. idft.GT.3) idft = 1
4087  !
4088  WRITE (ndso,977) ndstr, vsc, idla, idft
4089  IF (idft.EQ.2) WRITE (ndso,973) rform
4090  IF (from.EQ.'NAME' .AND. ndsg.NE.ndstr) WRITE (ndso,974) tname
4091  !
4092  ! 7.g.2 Open file and check if necessary
4093  !
4094  IF ( ndstr .EQ. ndsi ) THEN
4095  IF ( idft .EQ. 3 ) THEN
4096  WRITE (ndse,1004) ndstr
4097  CALL extcde (23)
4098  ELSE
4099  CALL nextln ( comstr , ndsi , ndse )
4100  END IF
4101  ELSE IF ( ndstr .EQ. ndsg ) THEN
4102  IF ( ( idfm.EQ.3 .AND. idft.NE.3 ) .OR. &
4103  ( idfm.NE.3 .AND. idft.EQ.3 ) ) THEN
4104  WRITE (ndse,1005) idfm, idft
4105  CALL extcde (24)
4106  END IF
4107  ELSE
4108  IF ( idft .EQ. 3 ) THEN
4109  IF (from.EQ.'NAME') THEN
4110  OPEN (ndstr,file=trim(fnmpre)//tname, &
4111  form='UNFORMATTED', convert=file_endian,status='OLD',err=2000, &
4112  iostat=ierr)
4113  ELSE
4114  OPEN (ndstr, form='UNFORMATTED', convert=file_endian, &
4115  status='OLD',err=2000,iostat=ierr)
4116  END IF
4117  ELSE
4118  IF (from.EQ.'NAME') THEN
4119  OPEN (ndstr,file=trim(fnmpre)//tname, &
4120  status='OLD',err=2000,iostat=ierr)
4121  ELSE
4122  OPEN (ndstr, &
4123  status='OLD',err=2000,iostat=ierr)
4124  END IF
4125  END IF
4126  END IF
4127  !
4128  ! 7.g.3 Read the data
4129  !
4130  CALL ina2r ( obsx, nx, ny, 1, nx, 1, ny, ndstr, ndst, ndse, &
4131  idft, rform, idla, vsc, 0.0)
4132  !
4133  IF ( ndstr .EQ. ndsi ) CALL nextln ( comstr , ndsi , ndse )
4134  !
4135  CALL ina2r ( obsy, nx, ny, 1, nx, 1, ny, ndstr, ndst, ndse, &
4136  idft, rform, idla, vsc, 0.0)
4137  !
4138  ! 7.g.4 Limit
4139  !
4140  DO ix=1, nx
4141  DO iy=1, ny
4142  obsx(ix,iy) = max( 0. , min(1.,obsx(ix,iy)) )
4143  obsy(ix,iy) = max( 0. , min(1.,obsy(ix,iy)) )
4144  END DO
4145  END DO
4146  !
4147  WRITE (ndso,*)
4148  !
4149  END IF ! TRFLAG
4150  !
4151  !Li End of IF( GTYPE .NE. SMCTYPE ) block
4152  END IF
4153  !
4154 #ifdef W3_RTD
4155  ! 7.h Calculate rotation angles for configs with rotated pole
4156  polon = plon
4157  polat = plat
4158  flagunr = unrot
4159  ! Default values PLON=-180, PLAT=90, UNROT=.FALSE. for standard lat-lon
4160 
4161  ALLOCATE( angldin(nx,ny) )
4162  ! For standard lat-lon the rotation angles are zero
4163  IF ( polat == 90. ) THEN
4164  angldin = 0.
4165  ELSE
4166  ALLOCATE(stdlat(nx,ny), stdlon(nx,ny))
4167 
4168  ! Calculate rotation angles; (StdLon/Lat are returned, but not used)
4169  ! The regular grid X/YGRDIN are used as equatorial lon and lat
4170  CALL w3eqtoll( ygrdin, xgrdin, stdlat, stdlon, angldin, &
4171  polat, polon, nx*ny )
4172 
4173  ! Clean up
4174  DEALLOCATE( stdlat, stdlon )
4175  END IF
4176  ! Write out rotation information
4177  WRITE (ndso,4203) polat, polon
4178  WRITE (ndso,4200)
4179  WRITE (ndso,4201) ( ix, ix=1,nx,nx/3)
4180  WRITE (ndso,4202) 1,(angldin(ix, 1), ix=1,nx,nx/3)
4181  WRITE (ndso,4202) ny,(angldin(ix,ny), ix=1,nx,nx/3)
4182  IF ( flagunr ) WRITE (ndso,4204)
4183  WRITE (ndso,*) ' '
4184 
4185 #endif
4186  !
4187 #ifdef W3_SMC
4188  !! 7.i Read SMC grid cell and face integer arrays.
4189  IF( gtype .EQ. smctype ) THEN
4190 
4191  !! Overwrite 2 parameters for SMC grid. JGLi03Mar2021
4192  dtms = dtims
4193  ctmax = cflsm
4194  !
4195  IF (flgnml) THEN
4196  ndstr = nml_smc%MCELS%IDF
4197  idla = nml_smc%MCELS%IDLA
4198  idfm = nml_smc%MCELS%IDFM
4199  rform = trim(nml_smc%MCELS%FORMAT)
4200  tname = trim(nml_smc%MCELS%FILENAME)
4201  ELSE
4202  CALL nextln ( comstr , ndsi , ndse )
4203  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4204  END IF
4205  OPEN (ndstr,file=trim(fnmpre)//tname, &
4206  form='FORMATTED',status='OLD',err=2000)
4207  ALLOCATE ( nlvcelsk( 0:nrlv ) )
4208  READ (ndstr,*) nlvcelsk
4209  ncel=nlvcelsk(0)
4210  nglo=ncel
4211  WRITE (ndso,4004) ncel, nlvcelsk
4212 
4213  ALLOCATE ( ijkcelin( 5, ncel))
4214  CALL ina2i ( ijkcelin, 5, ncel, 1, 5, 1, ncel, ndstr, ndst, ndse, &
4215  idfm, rform, idla, 1, 0)
4216  CLOSE(ndstr)
4217  !!Li Offset to change Equator index = 0 to regular grid index JEQT
4218  ijkcelin( 2, :) = ijkcelin( 2, :) + jeqt
4219  !!Li Offset to change i-index = 0 to regular grid index ISHFT
4220  ijkcelin( 1, :) = ijkcelin( 1, :) + ishft
4221 
4222  WRITE (ndso,4005) tname
4223  WRITE (ndso,4006) 1,(ijkcelin(ix, 1), ix=1,5)
4224  WRITE (ndso,4006) ncel,(ijkcelin(ix, ncel), ix=1,5)
4225  WRITE (ndso,*) ' '
4226 
4227  IF (flgnml) THEN
4228  ndstr = nml_smc%ISIDE%IDF
4229  idla = nml_smc%ISIDE%IDLA
4230  idfm = nml_smc%ISIDE%IDFM
4231  rform = trim(nml_smc%ISIDE%FORMAT)
4232  tname = trim(nml_smc%ISIDE%FILENAME)
4233  ELSE
4234  CALL nextln ( comstr , ndsi , ndse )
4235  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4236  END IF
4237  OPEN (ndstr,file=trim(fnmpre)//tname, &
4238  form='FORMATTED',status='OLD',err=2000)
4239  ALLOCATE ( nlvufcsk( 0:nrlv ) )
4240  READ (ndstr,*) nlvufcsk
4241  nufc = nlvufcsk(0)
4242  ngui = nufc
4243  WRITE (ndso,4007) nufc, nlvufcsk
4244 
4245  ALLOCATE ( ijkufcin( 7, nufc) )
4246  CALL ina2i ( ijkufcin, 7, nufc, 1, 7, 1, nufc, ndstr, ndst, ndse, &
4247  idfm, rform, idla, 1, 0)
4248  CLOSE(ndstr)
4249  !!Li Offset to change Equator index = 0 to regular grid index
4250  ijkufcin( 2, :) = ijkufcin( 2, :) + jeqt
4251  ijkufcin( 1, :) = ijkufcin( 1, :) + ishft
4252 
4253  WRITE (ndso,4008) tname
4254  WRITE (ndso,4009) 1,(ijkufcin(ix, 1), ix=1,7)
4255  WRITE (ndso,4009) nufc,(ijkufcin(ix, nufc), ix=1,7)
4256  WRITE (ndso,*) ' '
4257 
4258  IF (flgnml) THEN
4259  ndstr = nml_smc%JSIDE%IDF
4260  idla = nml_smc%JSIDE%IDLA
4261  idfm = nml_smc%JSIDE%IDFM
4262  rform = trim(nml_smc%JSIDE%FORMAT)
4263  tname = trim(nml_smc%JSIDE%FILENAME)
4264  ELSE
4265  CALL nextln ( comstr , ndsi , ndse )
4266  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4267  END IF
4268  OPEN (ndstr,file=trim(fnmpre)//tname, &
4269  form='FORMATTED',status='OLD',err=2000)
4270  ALLOCATE ( nlvvfcsk( 0:nrlv ) )
4271  READ (ndstr,*) nlvvfcsk
4272  nvfc= nlvvfcsk(0)
4273  ngvj= nvfc
4274  WRITE (ndso,4010) nvfc, nlvvfcsk
4275 
4276  ALLOCATE ( ijkvfcin( 8, nvfc) )
4277  CALL ina2i ( ijkvfcin, 8, nvfc, 1, 8, 1, nvfc, ndstr, ndst, ndse, &
4278  idfm, rform, idla, 1, 0)
4279  CLOSE(ndstr)
4280  !!Li Offset to change Equator index = 0 to regular grid index
4281  ijkvfcin( 2, :) = ijkvfcin( 2, :) + jeqt
4282  ijkvfcin( 1, :) = ijkvfcin( 1, :) + ishft
4283 
4284  WRITE (ndso,4011) tname
4285  WRITE (ndso,4012) 1,(ijkvfcin(ix, 1), ix=1,8)
4286  WRITE (ndso,4012) nvfc,(ijkvfcin(ix, nvfc), ix=1,8)
4287  WRITE (ndso,*) ' '
4288 
4289  !!Li Subgrid obstruction for each SMCels. JGLi15Oct2014
4290  IF (flgnml) THEN
4291  ndstr = nml_smc%SUBTR%IDF
4292  idla = nml_smc%SUBTR%IDLA
4293  idfm = nml_smc%SUBTR%IDFM
4294  rform = trim(nml_smc%SUBTR%FORMAT)
4295  tname = trim(nml_smc%SUBTR%FILENAME)
4296  ELSE
4297  CALL nextln ( comstr , ndsi , ndse )
4298  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4299  END IF
4300  OPEN (ndstr,file=trim(fnmpre)//tname, &
4301  form='FORMATTED',status='OLD',err=2000)
4302  READ (ndstr,*) ncobst, jobs
4303  WRITE (ndso,4110) ncobst, jobs
4304 
4305  ALLOCATE ( ijkobstr( jobs, ncobst) )
4306  CALL ina2i ( ijkobstr, jobs, ncobst, 1, jobs, 1, ncobst, ndstr, ndst, &
4307  ndse, idfm, rform, idla, 1, 0)
4308  CLOSE(ndstr)
4309 
4310  WRITE (ndso,4111) tname
4311  WRITE (ndso,4012) 1, (ijkobstr(ix, 1), ix=1,jobs)
4312  WRITE (ndso,4012) ncobst, (ijkobstr(ix, ncobst), ix=1,jobs)
4313  WRITE (ndso,*) ' '
4314 
4315  !!Li Bounary cell sequential numbers are read only if NBISMC>0
4316  IF( nbismc .GT. 0 ) THEN
4317  IF (flgnml) THEN
4318  ndstr = nml_smc%BUNDY%IDF
4319  idla = nml_smc%BUNDY%IDLA
4320  idfm = nml_smc%BUNDY%IDFM
4321  rform = trim(nml_smc%BUNDY%FORMAT)
4322  tname = trim(nml_smc%BUNDY%FILENAME)
4323  ELSE
4324  CALL nextln ( comstr , ndsi , ndse )
4325  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4326  END IF
4327  OPEN (ndstr,file=trim(fnmpre)//tname, &
4328  form='FORMATTED',status='OLD',err=2000)
4329  ALLOCATE ( nbicelin( nbismc ) )
4330  CALL ina2i ( nbicelin, 1, nbismc, 1, 1, 1, nbismc, ndstr, ndst, &
4331  ndse, idfm, rform, idla, 1, 0)
4332  CLOSE(ndstr)
4333 
4334  WRITE (ndso,4013) tname
4335  WRITE (ndso,4014) 1, nbicelin( 1)
4336  WRITE (ndso,4014) nbismc, nbicelin(nbismc)
4337  WRITE (ndso,*) ' '
4338  ENDIF
4339  !
4340  !! 7.j Read Arctic grid cell and boundary cell integer arrays.
4341  IF( arctc ) THEN
4342 
4343  IF (flgnml) THEN
4344  ndstr = nml_smc%MBARC%IDF
4345  idla = nml_smc%MBARC%IDLA
4346  idfm = nml_smc%MBARC%IDFM
4347  rform = trim(nml_smc%MBARC%FORMAT)
4348  tname = trim(nml_smc%MBARC%FILENAME)
4349  ELSE
4350  CALL nextln ( comstr , ndsi , ndse )
4351  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4352  END IF
4353  OPEN (ndstr,file=trim(fnmpre)//tname, &
4354  form='FORMATTED',status='OLD',err=2000)
4355  READ (ndstr,*) narc, nbgl, nbac
4356  WRITE (ndso,4015) narc, nbgl, nbac
4357 
4358  ALLOCATE ( ijkcelac( 5, narc) )
4359  CALL ina2i ( ijkcelac, 5, narc, 1, 5, 1, narc, ndstr, ndst, ndse, &
4360  idfm, rform, idla, 1, 0)
4361  CLOSE(ndstr)
4362  !!Li Offset to change Equator index = 0 to regular grid index JEQT
4363  ijkcelac( 2, :) = ijkcelac( 2, :) + jeqt
4364  ijkcelac( 1, :) = ijkcelac( 1, :) + ishft
4365 
4366  WRITE (ndso,4016) tname
4367  WRITE (ndso,4006) 1,(ijkcelac(ix, 1), ix=1,5)
4368  WRITE (ndso,4006) narc,(ijkcelac(ix, narc), ix=1,5)
4369  WRITE (ndso,*) ' '
4370 
4371  IF (flgnml) THEN
4372  ndstr = nml_smc%AISID%IDF
4373  idla = nml_smc%AISID%IDLA
4374  idfm = nml_smc%AISID%IDFM
4375  rform = trim(nml_smc%AISID%FORMAT)
4376  tname = trim(nml_smc%AISID%FILENAME)
4377  ELSE
4378  CALL nextln ( comstr , ndsi , ndse )
4379  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4380  END IF
4381  OPEN (ndstr,file=trim(fnmpre)//tname, &
4382  form='FORMATTED',status='OLD',err=2000)
4383  READ (ndstr,*) naui
4384  WRITE (ndso,4017) naui
4385 
4386  ALLOCATE ( ijkufcac( 7, naui) )
4387  CALL ina2i ( ijkufcac, 7, naui, 1, 7, 1, naui, ndstr, ndst, ndse, &
4388  idfm, rform, idla, 1, 0)
4389  CLOSE(ndstr)
4390  !!Li Offset to change Equator index = 0 to regular grid index
4391  ijkufcac( 2, :) = ijkufcac( 2, :) + jeqt
4392  ijkufcac( 1, :) = ijkufcac( 1, :) + ishft
4393  !!Li Offset Arctic cell sequential numbers by global cell number NGLO
4394  DO ip=1, naui
4395  DO ix=4,7
4396  IF( ijkufcac(ix,ip) > 0 ) ijkufcac(ix,ip) = ijkufcac(ix,ip) + nglo
4397  ENDDO
4398  ENDDO
4399 
4400  WRITE (ndso,4018) tname
4401  WRITE (ndso,4009) 1,(ijkufcac(ix, 1), ix=1,7)
4402  WRITE (ndso,4009) naui,(ijkufcac(ix, naui), ix=1,7)
4403  WRITE (ndso,*) ' '
4404 
4405  IF (flgnml) THEN
4406  ndstr = nml_smc%AJSID%IDF
4407  idla = nml_smc%AJSID%IDLA
4408  idfm = nml_smc%AJSID%IDFM
4409  rform = trim(nml_smc%AJSID%FORMAT)
4410  tname = trim(nml_smc%AJSID%FILENAME)
4411  ELSE
4412  CALL nextln ( comstr , ndsi , ndse )
4413  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFM, RFORM, tname
4414  END IF
4415  OPEN (ndstr,file=trim(fnmpre)//tname, &
4416  form='FORMATTED',status='OLD',err=2000)
4417  READ (ndstr,*) navj
4418  WRITE (ndso,4019) navj
4419 
4420  ALLOCATE ( ijkvfcac( 8, navj) )
4421  CALL ina2i ( ijkvfcac, 8, navj, 1, 8, 1, navj, ndstr, ndst, ndse, &
4422  idfm, rform, idla, 1, 0)
4423  CLOSE(ndstr)
4424  !!Li Offset to change Equator index = 0 to regular grid index
4425  ijkvfcac( 2, :) = ijkvfcac( 2, :) + jeqt
4426  ijkvfcac( 1, :) = ijkvfcac( 1, :) + ishft
4427  !!Li Offset Arctic cell sequential numbers by global cell number NGLO
4428  DO ip=1, navj
4429  DO iy=4,7
4430  IF( ijkvfcac(iy,ip) > 0 ) ijkvfcac(iy,ip) = ijkvfcac(iy,ip) + nglo
4431  ENDDO
4432  ENDDO
4433 
4434  WRITE (ndso,4020) tname
4435  WRITE (ndso,4012) 1,(ijkvfcac(ix, 1), ix=1,8)
4436  WRITE (ndso,4012) navj,(ijkvfcac(ix, navj), ix=1,8)
4437  WRITE (ndso,*) ' '
4438 
4439  !!Li Reset total cell and face numbers
4440  ncel = nglo + narc
4441  nufc = ngui + naui
4442  nvfc = ngvj + navj
4443  !!Li Also append Arctic part into base level sub-loops
4444  nlvcelsk(nrlv)=nlvcelsk(nrlv)+narc
4445  nlvufcsk(nrlv)=nlvufcsk(nrlv)+naui
4446  nlvvfcsk(nrlv)=nlvvfcsk(nrlv)+navj
4447  !!Li Reset NBAC to total number of boundary cells.
4448  nbac = nbgl + nbac
4449 
4450  ENDIF !! ARCTC section.
4451 
4452  ENDIF !! GTYPE .EQ. SMCTYPE
4453 #endif
4454  !
4455  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4456  ! 8. Finalize status maps
4457  ! 8.a Defines open boundary conditions for UNST grids
4458  !
4459  j = len_trim(ugobcfile)
4460  IF (gtype.EQ.ungtype.AND.ugobcfile(:j).NE.'unset') &
4461  CALL readmshobc(ndsg,ugobcfile,tmpsta,ugobcok)
4462  IF ((gtype.EQ.ungtype).AND.ugobcauto.AND.(.NOT.ugobcok)) &
4463  CALL ug_getopenboundary(tmpsta,zbin,ugobcdepth)
4464  !
4465  ! 8.b Determine where to get the data
4466  !
4467  IF (flgnml) THEN
4468  ndstr = nml_mask%IDF
4469  idla = nml_mask%IDLA
4470  idft = nml_mask%IDFM
4471  rform = trim(nml_mask%FORMAT)
4472  from = trim(nml_mask%FROM)
4473  tname = trim(nml_mask%FILENAME)
4474  IF (tname.EQ.'unset' .OR. tname.EQ.'UNSET') from='PART'
4475  ELSE
4476  CALL nextln ( comstr , ndsi , ndse )
4477  READ (ndsi,*,END=2001,ERR=2002) NDSTR, IDLA, IDFT, RFORM, &
4478  from, tname
4479  END IF
4480  !
4481  ! ... Data to be read in parts
4482  !
4483  IF ( from .EQ. 'PART' ) THEN
4484  !
4485  ! 8.b Update TMPSTA with input boundary data (ILOOP=1)
4486  ! and excluded points (ILOOP=2)
4487  !
4488  IF ( iclose .EQ. iclose_trpl ) THEN
4489  WRITE(ndse,*)'PROGRAM W3GRID STATUS MAP CALCULATION IS '// &
4490  'NOT TESTED FOR TRIPOLE GRIDS FOR CASE WHERE USER OPTS '// &
4491  'TO READ DATA IN PARTS. STOPPING NOW (107).'
4492  CALL extcde ( 107 )
4493  END IF
4494  DO iloop=1, 2
4495  !
4496  i = 1
4497  IF ( iloop .EQ. 1 ) THEN
4498  WRITE (ndso,979) 'boundary points'
4499  nstat = 2
4500  ELSE
4501  WRITE (ndso,979) 'excluded points'
4502  nstat = -1
4503  END IF
4504  first = .true.
4505  !
4506  DO
4507  IF (flgnml) THEN
4508  ! inbound points
4509  IF (iloop.EQ.1) THEN
4510  IF (nml_inbnd_count%N_POINT.GT.0 .AND. i.LE.nml_inbnd_count%N_POINT) THEN
4511  ix = nml_inbnd_point(i)%X_INDEX
4512  iy = nml_inbnd_point(i)%Y_INDEX
4513  connct = nml_inbnd_point(i)%CONNECT
4514  i=i+1
4515  ELSE
4516  EXIT
4517  END IF
4518  ! excluded points
4519  ELSE IF (iloop.EQ.2) THEN
4520  IF (nml_excl_count%N_POINT.GT.0 .AND. i.LE.nml_excl_count%N_POINT) THEN
4521  ix = nml_excl_point(i)%X_INDEX
4522  iy = nml_excl_point(i)%Y_INDEX
4523  connct = nml_excl_point(i)%CONNECT
4524  i=i+1
4525  ELSE
4526  EXIT
4527  END IF
4528  END IF
4529  ELSE
4530  CALL nextln ( comstr , ndsi , ndse )
4531  READ (ndsi,*,END=2001,ERR=2002) IX, IY, connct
4532  END IF
4533  !
4534  ! ... Check if last point reached.
4535  !
4536  IF (ix.EQ.0 .AND. iy.EQ.0) EXIT
4537  !
4538  ! ... Check if point in grid.
4539  !
4540  IF (gtype.EQ.ungtype.AND.(ugobcauto.OR.ugobcok)) cycle
4541  IF (ix.LT.1 .OR. ix.GT.nx .OR. iy.LT.1 .OR. iy.GT.ny) THEN
4542  WRITE (ndso,981)
4543  WRITE (ndso,*) ' ', ix, iy
4544  cycle
4545  END IF
4546  !
4547  ! ... Check if intermediate points are to be added.
4548  !
4549  IF ( connct .AND. .NOT.first ) THEN
4550  idx = ix - ixo
4551  idy = iy - iyo
4552  IF ( idx.EQ.0 .OR. idy.EQ.0 .OR. &
4553  abs(idx).EQ.abs(idy) ) THEN
4554  nba = max( max(abs(idx),abs(idy))-1 , 0 )
4555  IF (idx.NE.0) idx = sign(1,idx)
4556  IF (idy.NE.0) idy = sign(1,idy)
4557  ix = ixo
4558  iy = iyo
4559  DO iba=1, nba
4560  ix = ix + idx
4561  iy = iy + idy
4562  IF ( tmpsta(iy,ix).EQ.1 .OR. j.EQ.2 ) THEN
4563  tmpsta(iy,ix) = nstat
4564  ELSE
4565  WRITE(ndso,*) 'WARNING: POINT (',ix,',',iy, &
4566  ') CANNOT BE GIVEN THE STATUS ',nstat
4567  END IF
4568  END DO
4569  ix = ix + idx
4570  iy = iy + idy
4571  ELSE
4572  WRITE (ndso,982)
4573  WRITE (ndso,*) ' ', ix , iy
4574  WRITE (ndso,*) ' ', ixo, iyo
4575  END IF
4576  END IF
4577  !
4578  ! ... Check if point itself is to be added
4579  !
4580  IF ( tmpsta(iy,ix).EQ.1 .OR. j.EQ.2 ) THEN
4581  tmpsta(iy,ix) = nstat
4582  END IF
4583  !
4584  ! ... Save data of previous point
4585  !
4586  ixo = ix
4587  iyo = iy
4588  first = .false.
4589  !
4590  ! ... Branch back to read.
4591  !
4592  END DO
4593  !
4594  ! 8.c Final processing excluded points
4595  !
4596  IF ( iloop .EQ. 2 ) THEN
4597  !
4598  i = 1
4599  DO
4600  IF (flgnml) THEN
4601  ! excluded bodies
4602  IF (nml_excl_count%N_BODY.GT.0 .AND. i.LE.nml_excl_count%N_BODY) THEN
4603  ix = nml_excl_body(i)%X_INDEX
4604  iy = nml_excl_body(i)%Y_INDEX
4605  i=i+1
4606  ELSE
4607  EXIT
4608  END IF
4609  ELSE
4610  CALL nextln ( comstr , ndsi , ndse )
4611  READ (ndsi,*,END=2001,ERR=2002) IX, iy
4612  END IF
4613  !
4614  ! ... Check if last point reached.
4615  !
4616  IF (ix.EQ.0 .AND. iy.EQ.0) EXIT
4617  !
4618  ! ... Check if point in grid.
4619  !
4620  IF (ix.LT.1 .OR. ix.GT.nx .OR. iy.LT.1 .OR. iy.GT.ny) THEN
4621  WRITE (ndso,981)
4622  WRITE (ndso,*) ' ', ix, iy
4623  cycle
4624  END IF
4625  !
4626  ! ... Check if point already excluded
4627  !
4628  IF ( tmpsta(iy,ix) .EQ. nstat ) THEN
4629  WRITE (ndso,1981)
4630  WRITE (ndso,*) ' ', ix, iy
4631  cycle
4632  END IF
4633  !
4634  ! ... Search for points to exclude
4635  !
4636  tmpmap = tmpsta
4637  j = 1
4638  ix1 = ix
4639  iy1 = iy
4640  !
4641  jj = tmpsta(iy,ix)
4642  tmpsta(iy,ix) = nstat
4643  DO
4644  nbt = 0
4645  DO ix=max(1,ix1-j), min(ix1+j,nx)
4646  DO iy=max(1,iy1-j), min(iy1+j,ny)
4647  IF ( tmpsta(iy,ix) .EQ. jj ) THEN
4648  IF (ix.GT.1) THEN
4649  IF (tmpsta(iy ,ix-1).EQ.nstat &
4650  .AND. tmpmap(iy ,ix-1).EQ.jj ) THEN
4651  tmpsta(iy,ix) = nstat
4652  END IF
4653  END IF
4654  IF (ix.LT.nx) THEN
4655  IF (tmpsta(iy ,ix+1).EQ.nstat &
4656  .AND. tmpmap(iy ,ix+1).EQ.jj ) THEN
4657  tmpsta(iy,ix) = nstat
4658  END IF
4659  END IF
4660  IF (iy.LT.ny) THEN
4661  IF (tmpsta(iy+1,ix ).EQ.nstat &
4662  .AND. tmpmap(iy+1,ix ).EQ.jj ) THEN
4663  tmpsta(iy,ix) = nstat
4664  END IF
4665  END IF
4666  IF (iy.GT.1) THEN
4667  IF (tmpsta(iy-1,ix ).EQ.nstat &
4668  .AND. tmpmap(iy-1,ix ).EQ.jj ) THEN
4669  tmpsta(iy,ix) = nstat
4670  END IF
4671  END IF
4672  IF (tmpsta(iy,ix).EQ.nstat) nbt = nbt + 1
4673  END IF
4674  END DO
4675  END DO
4676  !
4677  IF ( nbt .NE. 0 ) THEN
4678  j = j + 1
4679  ELSE
4680  EXIT
4681  END IF
4682  END DO
4683  END DO
4684  !
4685  ! ... Outer boundary excluded points
4686  !
4687  IF ( gtype.NE.ungtype ) THEN
4688 
4689  DO ix=1, nx
4690  IF ( tmpsta( 1,ix) .EQ. 1 ) tmpsta( 1,ix) = nstat
4691  IF ( tmpsta(ny,ix) .EQ. 1 ) tmpsta(ny,ix) = nstat
4692  END DO
4693  !
4694  IF ( iclose.EQ.iclose_none ) THEN
4695  DO iy=2, ny-1
4696  IF ( tmpsta(iy, 1) .EQ. 1 ) tmpsta(iy, 1) = nstat
4697  IF ( tmpsta(iy,nx) .EQ. 1 ) tmpsta(iy,nx) = nstat
4698  END DO
4699  END IF
4700 
4701  END IF ! GTYPE
4702  !
4703  END IF ! ILOOP .EQ. 2
4704  !
4705  ! ... Branch back input / excluded points ( ILOOP in 8.b )
4706  !
4707  END DO
4708  !
4709  ELSE ! FROM .EQ. PART
4710  !
4711  ! 8.d Read the map from file instead
4712  !
4713  nstat = -1
4714  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
4715  IF (idft.LT.1 .OR. idft.GT.3) idft = 1
4716 
4717  !!Li Suspended for SMC grid though the file input line in ww3_grid.inp
4718  !!Li is kept to divert the program into this block. JGLi15Oct2014
4719  !!Li
4720  IF( gtype .NE. smctype ) THEN
4721  !!Li
4722  !
4723  WRITE (ndso,978) ndstr, idla, idft
4724  IF (idft.EQ.2) WRITE (ndso,973) rform
4725  IF (from.EQ.'NAME') WRITE (ndso,974) tname
4726  !
4727  IF ( ndstr .EQ. ndsi ) THEN
4728  IF ( idft .EQ. 3 ) THEN
4729  WRITE (ndse,1004) ndstr
4730  CALL extcde (23)
4731  ELSE
4732  CALL nextln ( comstr , ndsi , ndse )
4733  END IF
4734  ELSE
4735  IF ( idft .EQ. 3 ) THEN
4736  IF (from.EQ.'NAME') THEN
4737  OPEN (ndstr,file=trim(fnmpre)//tname, &
4738  form='UNFORMATTED', convert=file_endian,status='OLD',err=2000, &
4739  iostat=ierr)
4740  ELSE
4741  OPEN (ndstr, form='UNFORMATTED', convert=file_endian, &
4742  status='OLD',err=2000,iostat=ierr)
4743  END IF
4744  ELSE
4745  IF (from.EQ.'NAME') THEN
4746  OPEN (ndstr,file=trim(fnmpre)//tname, &
4747  status='OLD',err=2000,iostat=ierr)
4748  ELSE
4749  OPEN (ndstr, &
4750  status='OLD',err=2000,iostat=ierr)
4751  END IF
4752  END IF
4753  END IF
4754  !
4755  ALLOCATE ( readmp(nx,ny) )
4756  CALL ina2i ( readmp, nx, ny, 1, nx, 1, ny, ndstr, ndst, &
4757  ndse, idft, rform, idla, 1, 0 )
4758  !
4759  IF ( iclose.EQ.iclose_none ) THEN
4760  DO iy=2, ny-1
4761  IF ( readmp( 1,iy) .EQ. 1 ) readmp( 1,iy) = 3
4762  IF ( readmp(nx,iy) .EQ. 1 ) readmp(nx,iy) = 3
4763  END DO
4764  END IF
4765  !
4766  DO ix=1, nx
4767  IF ( readmp(ix, 1) .EQ. 1 ) readmp(ix, 1) = 3
4768  IF ( readmp(ix,ny) .EQ. 1 .AND. iclose .NE. iclose_trpl) &
4769  readmp(ix,ny) = 3
4770  END DO
4771  !
4772  DO iy=1, ny
4773  DO ix=1, nx
4774  IF ( readmp(ix,iy) .EQ. 3 ) THEN
4775  tmpsta(iy,ix) = nstat
4776  ELSE
4777  tmpsta(iy,ix) = readmp(ix,iy)
4778  ! force to dry the sea points over zlim
4779  IF ( zbin(ix,iy) .GT. zlim ) tmpsta(iy,ix) = 0
4780  END IF
4781  END DO
4782  END DO
4783  DEALLOCATE ( readmp )
4784  !!Li
4785  ENDIF !! GTYPE .NE. SMCTYPE
4786  !
4787  END IF !FROM .NE. 'PART'
4788  !
4789  ! 8.e Get NSEA and other counters
4790  !
4791  nsea = 0
4792  nland = 0
4793  nbi = 0
4794  nbt = 0
4795  !
4796  DO ix=1, nx
4797  DO iy=1, ny
4798  IF ( tmpsta(iy,ix) .GT. 0 ) nsea = nsea + 1
4799  IF ( tmpsta(iy,ix) .EQ. 0 ) nland = nland + 1
4800  IF ( tmpsta(iy,ix) .LT. 0 ) nbt = nbt + 1
4801  IF ( tmpsta(iy,ix) .EQ. 2 ) nbi = nbi + 1
4802  END DO
4803  END DO
4804  !
4805 #ifdef W3_SMC
4806  IF( gtype .EQ. smctype ) THEN
4807  !Li Moved before FLBPI is defined with NBI value. JGLi05Jun2015
4808  !Li Overwrite NSEA with NCel for SMC grid.
4809  nsea = ncel
4810  !Li Use input NBI number for SMC grid because merged
4811  !Li cells are over-counted by model.
4812  nbi = nbismc
4813  !Li No land points are used in SMC grid. JGLi26Feb2016
4814  nland = 0
4815  ENDIF !! GTYPE .EQ. SMCTYPE
4816 #endif
4817  !
4818  WRITE (ndso,980)
4819  flbpi = nbi .GT. 0
4820  IF ( .NOT. flbpi ) THEN
4821  WRITE (ndso,985)
4822  ELSE
4823  WRITE (ndso,986) nbi
4824 #ifdef W3_O1
4825  IF ( flagll ) THEN
4826  WRITE (ndso, 987)
4827  ELSE
4828  WRITE (ndso,1987)
4829  END IF
4830  ibi = 1
4831  DO iy=1, ny
4832  DO ix=1, nx
4833  IF (gtype.NE.ungtype) THEN
4834  x = factor * ( xgrdin(ix,iy) )
4835  y = factor * ( ygrdin(ix,iy) )
4836  ELSE
4837  x = factor * xgrd(1,ix)
4838  y = factor * ygrd(1,ix)
4839  END IF
4840  IF ( tmpsta(iy,ix).EQ.2 ) THEN
4841  IF ( flagll ) THEN
4842  WRITE (ndso, 988) ibi, ix, iy, x, y
4843  ELSE
4844  WRITE (ndso,1988) ibi, ix, iy, x, y
4845  END IF
4846  ibi = ibi + 1
4847  END IF
4848  END DO
4849  END DO
4850 #endif
4851  END IF
4852  !
4853  WRITE (ndso,1980)
4854  IF ( nbt .EQ. 0 ) THEN
4855  WRITE (ndso,1985)
4856  ELSE
4857  WRITE (ndso,1986) nbt
4858  END IF
4859  !
4860  ! 8.f Set up all maps
4861  !
4862  CALL w3dimx ( 1, nx, ny, nsea, ndse, ndst &
4863 #ifdef W3_SMC
4864  , ncel, nufc, nvfc, nrlv, nbsmc &
4865  , narc, nbac, nspec &
4866 #endif
4867  )
4868 #ifdef W3_SMC
4869  WRITE (ndso,4021) ncel
4870 #endif
4871  !
4872  ! 8.g Activation of reflections and scattering
4873  ffacberg=facberg
4874 #ifdef W3_REF1
4875  refpars(1)=refcoast
4876  refpars(2)=refsubgrid
4877  refpars(3)=refunstsource
4878  refpars(4)=reficeberg
4879  refpars(6)=reffreq
4880  refpars(7)=refslope
4881  refpars(8)=refcosp_straight
4882  refpars(9)=refrmax
4883  refpars(10)=reffreqpow
4884  IF (gtype.EQ.ungtype) refpars(2:5)=0.
4885  IF (refmap.EQ.0) THEN
4886  reflc(3,:)=refpars(7)
4887  END IF
4888 #endif
4889 
4890 
4891  IF (gtype.NE.ungtype) THEN
4892  DO iy=1, ny
4893  DO ix=1, nx
4894  xgrd(iy,ix) = xgrdin(ix,iy)
4895  ygrd(iy,ix) = ygrdin(ix,iy)
4896  END DO
4897  END DO
4898  DEALLOCATE ( xgrdin, ygrdin )
4899  CALL w3gntx ( 1, 6, 6 )
4900  ELSE
4901  END IF ! GTYPE
4902  !
4903 #ifdef W3_SMC
4904  !!Li Shelter MAPSTA LLG definition for SMC
4905  IF( gtype .NE. smctype ) THEN
4906 #endif
4907  !
4908  mapsta = tmpsta
4909  mapfs = 0
4910  !
4911 #ifdef W3_T
4912  ALLOCATE ( mapout(nx,ny) )
4913  mapout = 0
4914  !
4915  ix3 = 1 + nx/60
4916  iy3 = 1 + ny/60
4917  CALL prtblk (ndst, nx, ny, nx, zbin, mapout, 1, 0., &
4918  1, nx, ix3, 1, ny, iy3, 'Zb', 'm')
4919 #endif
4920  !
4921  trnx = 0.
4922  trny = 0.
4923  !
4924  isea = 0
4925  DO iy=1, ny
4926  DO ix=1, nx
4927  IF ( tmpsta(iy,ix) .EQ. nstat ) THEN
4928  mapsta(iy,ix) = 0
4929  mapst2(iy,ix) = 1
4930  tmpsta(iy,ix) = 3
4931  ELSE
4932  mapsta(iy,ix) = tmpsta(iy,ix)
4933  mapst2(iy,ix) = 0
4934  END IF
4935  IF ( mapsta(iy,ix) .NE. 0 ) THEN
4936  isea = isea + 1
4937  mapfs(iy,ix) = isea
4938  zb(isea) = zbin(ix,iy)
4939 #ifdef W3_T
4940  mapout(ix,iy) = 1
4941 #endif
4942  mapsf(isea,1) = ix
4943  mapsf(isea,2) = iy
4944  IF ( flagll ) THEN
4945  y = ygrd(iy,ix)
4946  clats(isea) = cos(y*dera)
4947  clatis(isea) = 1. / clats(isea)
4948  cthg0s(isea) = - tan(dera*y) / radius
4949  ELSE
4950  clats(isea) = 1.
4951  clatis(isea) = 1.
4952  cthg0s(isea) = 0.
4953  END IF
4954  END IF
4955 
4956  !/ ------------------------------------------------------------------- /
4957 
4958  ! notes: Oct 22 2012: I moved the following "if-then" statement from
4959  ! inside the "IF ( MAPSTA(IY,IX) .NE. 0 )" statement to outside that
4960  ! statement. This is needed since later on, ATRNX is computed from
4961  ! TRNX(ix-1) , TRNX(ix) etc. which causes boundary effects if the
4962  ! MAPSTA=0 values are set to TRNX=0
4963 
4964  IF ( trflag .NE. 0 ) THEN
4965  trnx(iy,ix) = 1. - obsx(ix,iy)
4966  trny(iy,ix) = 1. - obsy(ix,iy)
4967  END IF
4968 
4969  END DO
4970  END DO
4971  !
4972 #ifdef W3_SMC
4973  !!Li SMC grid definition of mapping arrays.
4974  ELSE
4975  !!Li Pass refined level cell and face counts to NLv*(NRLv)
4976  nlvcel(0)=0
4977  nlvufc(0)=0
4978  nlvvfc(0)=0
4979  DO ip = 1, nrlv
4980  nlvcel(ip)=nlvcelsk(ip) + nlvcel(ip-1)
4981  nlvufc(ip)=nlvufcsk(ip) + nlvufc(ip-1)
4982  nlvvfc(ip)=nlvvfcsk(ip) + nlvvfc(ip-1)
4983  ENDDO
4984  WRITE (ndso,4022) nlvcel
4985  WRITE (ndso,4023) nlvufc
4986  WRITE (ndso,4024) nlvvfc
4987 
4988  !Li Redefine MAPSF MAPFS MAPSTA MAPST2 CLATS and ZB for SMC Grid,
4989  !Li using SMC grid cell array and assuming NSEA=NCel.
4990  mapsta = 0
4991  mapst2 = 1
4992  mapfs = 0
4993  !LS Allocation for read-in variables that remain local only.
4994  ALLOCATE ( ijkvfc8(nvfc) )
4995  ALLOCATE ( ijkdep(-9:ncel) )
4996 
4997  !Li Pass input SMC arrays to newly declared grid arrays.
4998  WRITE (ndso,4025) ncel
4999  ijkcel(1:4, 1:nglo)=ijkcelin(1:4, 1:nglo)
5000  ijkdep(1:nglo)=ijkcelin(5, 1:nglo)
5001  ijkufc(1:7, 1:ngui)=ijkufcin(1:7, 1:ngui)
5002  ijkvfc(1:7, 1:ngvj)=ijkvfcin(1:7, 1:ngvj)
5003  ijkvfc8(1:ngvj)=ijkvfcin(8, 1:ngvj)
5004  !Li Append Arctic part
5005  IF( arctc ) THEN
5006  ijkcel(1:4, nglo+1:ncel)=ijkcelac(1:4, 1:narc)
5007  ijkdep(nglo+1:ncel)=ijkcelac(5, 1:narc)
5008  ijkufc(1:7, ngui+1:nufc)=ijkufcac(1:7, 1:naui)
5009  ijkvfc(1:7, ngvj+1:nvfc)=ijkvfcac(1:7, 1:navj)
5010  ijkvfc8(ngvj+1:nvfc)=ijkvfcac(8, 1:navj)
5011  ENDIF !! ARCTC
5012 
5013  WRITE (ndso,4026)
5014  WRITE (ndso,4006) 1,(ijkcel(ix, 1), ix=1,4), ijkdep(1)
5015  jj=ncel
5016  WRITE (ndso,4006) jj,(ijkcel(ix, jj), ix=1,4), ijkdep(jj)
5017  WRITE (ndso,*) ' '
5018  WRITE (ndso,4027)
5019  WRITE (ndso,4009) 1,(ijkufc(ix, 1), ix=1,7)
5020  jj=nufc
5021  WRITE (ndso,4009) jj,(ijkufc(ix, jj), ix=1,7)
5022  WRITE (ndso,*) ' '
5023  WRITE (ndso,4028)
5024  WRITE (ndso,4012) 1,(ijkvfc(ix, 1), ix=1,7), ijkvfc8(1)
5025  jj=nvfc
5026  WRITE (ndso,4012) jj,(ijkvfc(ix, jj), ix=1,7), ijkvfc8(jj)
5027  WRITE (ndso,*) ' '
5028 
5029  !Li Boundary -9 to 0 cells for cell x-size 2**n
5030  !Li Note the position indice for bounary cell are not used.
5031  ijkcel(1, -9:0)=0
5032  !Li Use Equator Y index for boundary cells. JGLi04Apr2011
5033  !Li IJKCel(2, -9:0)=0
5034  ijkcel(2, -9:0)=jeqt
5035  ijkcel(3, 0)=1
5036  ijkcel(4, 0)=1
5037  !Li Use minimum 10 m depth for boundary cells.
5038  !Li Y-size is restricted below base-cell value.
5039  !Li For refined boundary cells, its y-size is replaced with
5040  !Li the inner cell y-size for flux gradient.
5041  ijkdep(0)=10
5042  DO ip=1,9
5043  ijkcel(3,-ip)=ijkcel(3,-ip+1)*2
5044  ik=min(ip, nrlv-1)
5045  ijkcel(4,-ip)=2**ik
5046  ijkdep(-ip)=10
5047  ENDDO
5048  WRITE (ndso,4029)
5049  DO ip=0, -9, -1
5050  WRITE (ndso,4030) ijkcel(:,ip), ijkdep(ip)
5051  ENDDO
5052 
5053  WRITE (ndso,4031) ncel
5054  !Li Multi-resolution SMC grid requires rounding of x, y indices
5055  !Li by a factor MRFct.
5056  mrfct = 2**(nrlv - 1)
5057  WRITE (ndso,4032) mrfct
5058 
5059  !Li Cosine for SMC uses refined latitude increment.
5060  symr = sy*dera/float( mrfct )
5061  !Li Reference y point for adjusted cell j=0 in radian. JGLi16Feb2016
5062  yj0r = ( y0 - 0.5*sy )*dera
5063 
5064  DO isea=1, ncel
5065  !Li There is no polar cell row so it is mapped to last row.
5066  IF( arctc .AND. (isea .EQ. ncel) ) THEN
5067  ix=1
5068  iy=ny
5069  ik=1
5070  js=1
5071  ELSE
5072  ix=ijkcel(1,isea)/mrfct + 1
5073  iy=ijkcel(2,isea)/mrfct + 1
5074  ik=max(1, ijkcel(3,isea)/mrfct)
5075  js=max(1, ijkcel(4,isea)/mrfct)
5076  ENDIF
5077 
5078  ! Check that IX, IY are in the bound of [1,NX] and [1,NY] respec.
5079  IF ((ix+ik-1 .GT. nx) .OR. (ix .LE. 0)) THEN
5080  WRITE (ndse,1014) isea, ix, ix+ik-1, nx
5081  CALL extcde(65)
5082  END IF
5083 
5084  IF ((iy+js-1 .GT. ny) .OR. (iy .LE. 0)) THEN
5085  WRITE (ndse,1015) isea, iy, iy+js-1, ny
5086  CALL extcde(65)
5087  END IF
5088 
5089  !Li Allow land cell to be defined by ZLIM value and only reset
5090  !Li MAPST* land values for sea points. JGLi03Nov2023
5091  zb(isea) = dvsmc * float(ijkdep(isea))
5092  IF( zb(isea) .LT. zlim ) THEN
5093  mapsta(iy:iy+js-1,ix:ix+ik-1) = 1
5094  mapst2(iy:iy+js-1,ix:ix+ik-1) = 0
5095  ENDIF
5096  mapfs(iy:iy+js-1,ix:ix+ik-1) = isea
5097  mapsf(isea,1) = ix
5098  mapsf(isea,2) = iy
5099  mapsf(isea,3) = iy + (ix-1) * ny
5100 
5101  !Li New variable CLATS to hold cosine latitude at cell centre.
5102  !Li Also added CLATIS and CTHG0S for version 4.08.
5103  !Li Use adjusted j-index to calculate cell centre y from YJ0R.
5104  y = yj0r + symr*( float(ijkcel(2,isea))+0.5*float(ijkcel(4,isea)) )
5105  !Li Arctic polar cell does not need COS(LAT), set 1 row down.
5106  IF(y .GE. hpi-0.1*symr) y=hpi - symr*0.5*float( mrfct )
5107 
5108  clats(isea) = cos( y )
5109  clatis(isea)= 1. / clats(isea)
5110  cthg0s(isea)= - tan( y ) / radius
5111  !!Li Sub-grid obstruction is set zero beyond NCObst cells.
5112  IF(isea .GT. ncobst) THEN
5113  trnmx=1.0
5114  trnmy=1.0
5115  ELSE
5116  !!Li Present obstruction is isotropic and in percentage.
5117  trnmx=1.0 - ijkobstr(1, isea)*0.01
5118  trnmy=1.0 - ijkobstr(jobs, isea)*0.01
5119  ENDIF
5120  ctrnx(isea) = max(0.11, trnmx)
5121  ctrny(isea) = max(0.11, trnmy)
5122  END DO
5123  !!Li Transparency for boundary cells are 1.0 JGLi16Jan2012
5124  ctrnx(-9:0) = 1.0
5125  ctrny(-9:0) = 1.0
5126  !!Li Check range of MAPSF and MAPFS
5127  WRITE (ndso,4033) minval( mapsf(:,1) ), maxval( mapsf(:,1) )
5128  WRITE (ndso,4034) minval( mapsf(:,2) ), maxval( mapsf(:,2) )
5129  WRITE (ndso,4035) minval( mapsf(:,3) ), maxval( mapsf(:,3) )
5130  WRITE (ndso,4036) minval( mapfs(:,:) ), maxval( mapfs(:,:) )
5131 
5132  !Li New variable CLATF to hold cosine latitude at cell V face.
5133  DO ip = 1, nvfc
5134  ! CLATF(IP) = COS( SYMR*FLOAT(IJKVFc(2,IP) - JEQT) )
5135  !Li Use adjusted j-index to calculate cell face Y from YJ0R.
5136  clatf(ip) = cos( symr*float(ijkvfc(2,ip)) + yj0r )
5137  ENDDO
5138  IF(nbismc .GT. 0) THEN
5139  !Li Save input boundary SMC list to ISMCBP(NBSMC)
5140  ismcbp(1:nbismc) = nbicelin(1:nbismc)
5141  !Li Reset MAPSTA for boundary cells if any.
5142  DO ip=1, nbismc
5143  isea = nbicelin(ip)
5144  ix=ijkcel(1,isea)/mrfct + 1
5145  iy=ijkcel(2,isea)/mrfct + 1
5146  ik=max(1, ijkcel(3,isea)/mrfct)
5147  js=max(1, ijkcel(4,isea)/mrfct)
5148  mapsta(iy:iy+js-1,ix:ix+ik-1) = 2
5149  mapst2(iy:iy+js-1,ix:ix+ik-1) = 0
5150  ENDDO
5151  ENDIF
5152  !Li Define rotation angle for Arctic cells.
5153  IF( arctc ) THEN
5154 
5155  polonac = 179.999
5156  polatac = 0.001
5157  ALLOCATE( xlonac(narc),ylatac(narc),elonac(narc),elatac(narc) )
5158  DO isea=nglo+1, ncel
5159  !Li There is no polar cell row so it is mapped to last row.
5160  IF(isea .EQ. ncel) THEN
5161  ix=1
5162  iy=ny
5163  ik=1
5164  js=1
5165  ELSE
5166  ix=ijkcel(1,isea)/mrfct + 1
5167  iy=ijkcel(2,isea)/mrfct + 1
5168  ik=max(1, ijkcel(3,isea)/mrfct)
5169  js=max(1, ijkcel(4,isea)/mrfct)
5170  ENDIF
5171  xlonac(isea-nglo)= x0 + real(ix-1+ik/2)*sx
5172  ylatac(isea-nglo)= y0 + real(iy-1+js/2)*sy
5173  ENDDO
5174 
5175  CALL w3lltoeq ( ylatac, xlonac, elatac, elonac, &
5176  & angarc, polatac, polonac, narc )
5177 
5178  WRITE (ndso,4037) narc
5179  WRITE (ndso,4038) (angarc(ix), ix=1,narc,narc/8)
5180 
5181  !Li Mapping Arctic boundary cells with inner model cells
5182  DO ip=1, nbac
5183  ix=ijkcel(1,ip+nglo)
5184  iy=ijkcel(2,ip+nglo)
5185  DO isea=1, nglo
5186  IF( (ix .EQ. ijkcel(1,isea)) .AND. &
5187  & (iy .EQ. ijkcel(2,isea)) ) THEN
5188  iclbac(ip) = isea
5189  ENDIF
5190  ENDDO
5191  ENDDO
5192  WRITE (ndso,4039) nbac
5193  WRITE (ndso,4040) (iclbac(ix), ix=1,nbac,nbac/8)
5194 
5195  !Li Redefine GCT term factor for Arctic part or the netative of
5196  !Li tangient of rotated latitude divided by radius. JGLi14Sep2015
5197  DO isea=nglo+1, ncel-1
5198  cthg0s(isea)= - tan( elatac(isea-nglo)*dera ) / radius
5199  ENDDO
5200  cthg0s(ncel)=0.0
5201 
5202  ENDIF !! ARCTC section.
5203  ENDIF !! (GTYPE .NE. SMCTYPE) ELSE SMCTYPE block.
5204 #endif
5205  !
5206 #ifdef W3_RTD
5207  !Li Assign rotated grid angle for all sea points. JGLi01Feb2016
5208  DO isea=1,nsea
5209  ix = mapsf(isea,1)
5210  iy = mapsf(isea,2)
5211  angld(isea) = angldin(ix,iy)
5212  END DO
5213 #endif
5214  !
5215 #ifdef W3_T
5216  CALL prtblk (ndst, nx, ny, nx, zbin, mapout, 0, 0., &
5217  1, nx, ix3, 1, ny, iy3, 'Sea points', 'm')
5218  DEALLOCATE ( mapout )
5219 #endif
5220  !
5221  DO isp=1, nspec+nth
5222  mapwn(isp) = 1 + (isp-1)/nth
5223  mapth(isp) = 1 + mod(isp-1,nth)
5224  END DO
5225  !
5226 #ifdef W3_O2
5227  nmap = 1 + (nx-1)/ncol
5228  WRITE (ndso,1100) nmap
5229  DO imap=1, nmap
5230  ix0 = 1 + (imap-1)*ncol
5231  ixn = min( nx , imap*ncol )
5232  DO iy=ny,1,-1
5233  WRITE (ndso,1101) (tmpsta(iy,ix),ix=ix0,ixn)
5234  END DO
5235  WRITE (ndso,*) ' '
5236  END DO
5237  WRITE (ndso,1102)
5238 #endif
5239 
5240 #ifdef W3_O2a
5241  OPEN (ndsm,file=trim(fnmpre)//'mask.ww3')
5242  DO iy=1, ny
5243  WRITE (ndsm,998) min(1,mapsta(iy,:))
5244  END DO
5245  CLOSE (ndsm)
5246 #endif
5247  !
5248 #ifdef W3_O2b
5249  IF ( trflag .GT. 0 ) THEN
5250  nmapb = 1 + (nx-1)/ncol
5251  WRITE (ndso,1103) 'X', nmapb
5252  DO imapb=1, nmapb
5253  ix0 = 1 + (imapb-1)*ncol
5254  ixn = min( nx , imapb*ncol )
5255  DO iy=ny,1,-1
5256  WRITE (ndso,1101) (nint(10.*obsx(ix,iy)),ix=ix0,ixn)
5257  END DO
5258  WRITE (ndso,*) ' '
5259  END DO
5260  WRITE (ndso,1104)
5261  WRITE (ndso,1103) 'Y', nmapb
5262  DO imapb=1, nmapb
5263  ix0 = 1 + (imapb-1)*ncol
5264  ixn = min( nx , imapb*ncol )
5265  DO iy=ny,1,-1
5266  WRITE (ndso,1101) (nint(10.*obsy(ix,iy)),ix=ix0,ixn)
5267  END DO
5268  WRITE (ndso,*) ' '
5269  END DO
5270  WRITE (ndso,1104)
5271  END IF
5272 #endif
5273  !
5274 #ifdef W3_O2c
5275  OPEN (ndsm,file=trim(fnmpre)//'mapsta.ww3', recl=2*nx*ny*50+1)
5276  DO iy=ny,1, -1
5277  DO ix=1,nx
5278  DO i=1,50
5279  WRITE (ndsm,1998,advance='NO') (tmpsta(iy,ix))
5280  END DO
5281  END DO
5282  END DO
5283  CLOSE (ndsm)
5284 #endif
5285  !
5286 
5287 #ifdef W3_IG1
5288  igpars(1)=igmethod
5289  igpars(2)=igaddoutp
5290  igpars(3)=igsource
5291  igpars(4)=0
5292  IF (igbcoverwrite) igpars(4)=igpars(4)+1
5293  IF (igswellmax) igpars(4)=igpars(4)+2
5294  igpars(5)=1
5295  DO ik=1,nk
5296  IF (sig(ik)*tpiinv.LT.igmaxfreq) igpars(5)=ik
5297  END DO
5298  igmindep=minval(zb*(-1.)-2) ! -2 / +2 is there for water level changes
5299  igmaxdep=maxval(zb*(-1.)+2)
5300  IF (igsourceatbp.EQ.1) igmindep=1. ! should use true minimum depth ...
5301  igpars(6)=1+nint(log(max(igmaxdep,1.0)/max(igmindep,1.0))/log(1.1))
5302  igpars(7)=max(igmindep,1.0)
5303  igpars(8)=igsourceatbp
5304  igpars(9)=igkdmin
5305  igpars(10)=igfixeddepth
5306  igpars(11)=igempirical**2
5307  igpars(12)=igsterms
5308 #endif
5309  !
5310 #ifdef W3_IC2
5311  ic2pars(:)=0.
5312  IF (ic2disper) ic2pars(1)=1.
5313  ic2pars(2)=ic2turb
5314  ic2pars(3)=ic2rough
5315  ic2pars(4)=ic2reynolds
5316  ic2pars(5)=ic2smooth
5317  ic2pars(6)=ic2visc
5318  ic2pars(7)=ic2turbs
5319  ic2pars(8)=ic2dmax
5320 #endif
5321  !
5322 #ifdef W3_IC3
5323  ic3pars(:)=0.
5324  ic3pars(1)=ic3maxthk
5325  ic3pars(2)=ic2turb
5326  ic3pars(3)=ic2rough
5327  ic3pars(4)=ic2reynolds
5328  ic3pars(5)=ic2smooth
5329  ic3pars(6)=ic2visc
5330  ic3pars(7)=ic2turbs
5331  ic3pars(8)=ic3maxcnc
5332  IF (ic3cheng) ic3pars(9)=1.0
5333  ic3pars(10)=ic3hilim
5334  ic3pars(11)=ic3kilim
5335  IF (usecgice) ic3pars(12)=1.0
5336  ic3pars(13)=ic3hice
5337  ic3pars(14)=ic3visc
5338  ic3pars(15)=ic3dens
5339  ic3pars(16)=ic3elas
5340 #endif
5341  !
5342 #ifdef W3_IC4
5343  ic4pars(1)=ic4method
5344  ic4_ki=ic4ki
5345  ic4_fc=ic4fc
5346  ic4_cn=ic4cn
5347  ic4_fmin=ic4fmin
5348  ic4_kibk=ic4kibk
5349 #endif
5350  !
5351 #ifdef W3_IC5
5352  ic5pars(:)=0.
5353  ic5pars(1)=ic5minig
5354  ic5pars(2)=ic5minwt
5355  ic5pars(3)=ic5maxkratio
5356  ic5pars(4)=ic5maxki
5357  ic5pars(5)=ic5minhw
5358  ic5pars(6)=ic5maxiter
5359  ic5pars(7)=ic5rkick
5360  ic5pars(8)=ic5kfilter
5361  ic5pars(9)=ic5vemod
5362 #endif
5363  !
5364 #ifdef W3_IS2
5365  is2pars(1) = isc1
5366  is2pars(2) = is2backscat
5367  is2pars(3)=0.
5368  IF (is2break) is2pars(3)=1.
5369  is2pars(4)=is2c2
5370  is2pars(5)=is2c3
5371  is2pars(6)=0.
5372  IF (is2disp) is2pars(6)=1.
5373  is2pars(7)=is2damp
5374  is2pars(8)=is2fragility
5375  is2pars(9)=is2dmin
5376  is2pars(10)=0.
5377  IF (is2dupdate) is2pars(10)=1.
5378  is2pars(11)=is2conc
5379  is2pars(12)=abs(is2creepb)
5380  is2pars(13)=is2creepc
5381  is2pars(14)=is2creepd
5382  is2pars(15)=is2creepn
5383  is2pars(16)=is2breake
5384  is2pars(17)=is2breakf
5385  is2pars(18)=is2wim1
5386  is2pars(19)=is2flexstr
5387  is2pars(20)=0.
5388  IF (is2isoscat) is2pars(20)=1.
5389  is2pars(21)=is2andisd
5390  is2pars(22)=is2andisn
5391  is2pars(23)=0.
5392  IF (is2andisb) is2pars(23)=1.
5393  is2pars(24)=is2andise
5394 #endif
5395  !
5396  ! 9.d Estimates shoreline direction for reflection
5397  ! and shoreline treatment in general for UNST grids.
5398  ! NB: this is updated with moving water levels in W3ULEV
5399  ! AR: this is not anymore needed and will be deleted ...
5400  !
5401  IF (gtype.EQ.ungtype) THEN
5402  CALL set_ug_iobp
5403 
5404 #ifdef W3_REF1
5405  ELSE
5406  CALL w3setref
5407 #endif
5408  END IF
5409 #ifdef W3_REF1
5410  !
5411  ! 9.a Reads shoreline slope (whith REF1 switch only)
5412  !
5413  ALLOCATE ( refd(nx,ny), refd2(nx,ny), refs(nx,ny) )
5414  IF (refmap.EQ.0) THEN
5415  refs(:,:)=1.
5416  ELSE
5417  !
5418  ! 9.b Info from input file
5419  !
5420  IF (flgnml) THEN
5421  ndstr = nml_slope%IDF
5422  vsc = nml_slope%SF
5423  idla = nml_slope%IDLA
5424  idft = nml_slope%IDFM
5425  rform = trim(nml_slope%FORMAT)
5426  from = trim(nml_slope%FROM)
5427  tname = trim(nml_slope%FILENAME)
5428  ELSE
5429  CALL nextln ( comstr , ndsi , ndse )
5430  READ (ndsi,*,END=2001,ERR=2002) NDSTR, VSC, IDLA, IDFT, RFORM, &
5431  from, tname
5432  END IF
5433  !
5434  IF ( abs(vsc) .LT. 1.e-7 ) vsc = 1.
5435  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
5436  IF (idft.LT.1 .OR. idft.GT.3) idft = 1
5437  !
5438  WRITE (ndso,1977) ndstr, vsc, idla, idft
5439  IF (idft.EQ.2) WRITE (ndso,973) rform
5440  IF (from.EQ.'NAME' .AND. ndsg.NE.ndstr) WRITE (ndso,974) tname
5441  !
5442  ! 9;c Open file and check if necessary
5443  !
5444  IF ( ndstr .EQ. ndsi ) THEN
5445  IF ( idft .EQ. 3 ) THEN
5446  WRITE (ndse,1004) ndstr
5447  CALL extcde (23)
5448  ELSE
5449  CALL nextln ( comstr , ndsi , ndse )
5450  END IF
5451  ELSE IF ( ndstr .EQ. ndsg ) THEN
5452  IF ( ( idfm.EQ.3 .AND. idft.NE.3 ) .OR. &
5453  ( idfm.NE.3 .AND. idft.EQ.3 ) ) THEN
5454  WRITE (ndse,1005) idfm, idft
5455  CALL extcde (24)
5456  END IF
5457  ELSE
5458  IF ( idft .EQ. 3 ) THEN
5459  IF (from.EQ.'NAME') THEN
5460  OPEN (ndstr,file=trim(fnmpre)//tname, &
5461  form='UNFORMATTED', convert=file_endian,status='OLD',err=2000, &
5462  iostat=ierr)
5463  ELSE
5464  OPEN (ndstr, form='UNFORMATTED', convert=file_endian, &
5465  status='OLD',err=2000,iostat=ierr)
5466  END IF
5467  ELSE
5468  IF (from.EQ.'NAME') THEN
5469  OPEN (ndstr,file=trim(fnmpre)//tname, &
5470  status='OLD',err=2000,iostat=ierr)
5471  ELSE
5472  OPEN (ndstr, &
5473  status='OLD',err=2000,iostat=ierr)
5474  END IF !end of (FROM.EQ.'NAME')
5475  END IF !end of ( IDFT .EQ. 3 )
5476  END IF !end of ( NDSTR .EQ. NDSG )
5477  !
5478  ! 9.d Read the data
5479  !
5480  ! CALL INA2R ( REFD, NX, NY, 1, NX, 1, NY, NDSTR, NDST, NDSE, &
5481  ! IDFM, RFORM, IDLA, VSC, 0.0)
5482  !
5483  IF ( ndstr .EQ. ndsi ) CALL nextln ( comstr , ndsi , ndse )
5484  !
5485  ! CALL INA2R ( REFD2, NX, NY, 1, NX, 1, NY, NDSTR, NDST, NDSE, &
5486  ! IDFM, RFORM, IDLA, VSC, 0.0)
5487  CALL ina2r ( refs, nx, ny, 1, nx, 1, ny, ndstr, ndst, ndse, &
5488  idfm, rform, idla, vsc, 0.0)
5489  DO isea=1,nsea
5490  ix = mapsf(isea,1)
5491  iy = mapsf(isea,2)
5492  reflc(3,isea) = refs(ix,iy)*refmap
5493  END DO
5494  nmapb = 1 + (nx-1)/ncol
5495  WRITE (ndso,1105) nmapb
5496 #endif
5497 #if defined W3_T && defined W3_REF1
5498  WRITE(ndso,*) 'Maximum slope for reflection:',maxval(refs*refmap)
5499 #endif
5500  !
5501 #ifdef W3_REF1
5502  DO imapb=1, nmapb
5503  ix0 = 1 + (imapb-1)*ncol
5504  ixn = min( nx , imapb*ncol )
5505 #endif
5506 #if defined W3_T && defined W3_REF1
5507  DO iy=ny,1,-1
5508  WRITE (ndso,1101) (nint(100.*refs(ix,iy)*refmap),ix=ix0,ixn)
5509  END DO
5510 #endif
5511 #ifdef W3_REF1
5512  WRITE (ndso,*) ' '
5513  END DO
5514  WRITE (ndso,1106)
5515  !
5516  WRITE (ndso,*)
5517  !
5518  END IF !end of (REFMAP.EQ.0)
5519 #endif
5520  !
5521  DEALLOCATE ( zbin, tmpsta, tmpmap )
5522 #ifdef W3_RTD
5523  DEALLOCATE ( angldin )
5524 #endif
5525  !
5526  ! 9.e Reads bottom information from file
5527  !
5528 #ifdef W3_BT4
5529  ALLOCATE ( sed_d50file(nx,ny))
5530  IF ( sedmapd50 ) THEN
5531 
5532  !
5533  ! 9.e.1 Info from input file
5534  !
5535  IF (flgnml) THEN
5536  ndstr = nml_sed%IDF
5537  vsc = nml_sed%SF
5538  idla = nml_sed%IDLA
5539  idft = nml_sed%IDFM
5540  rform = trim(nml_sed%FORMAT)
5541  from = trim(nml_sed%FROM)
5542  tname = trim(nml_sed%FILENAME)
5543  ELSE
5544  CALL nextln ( comstr , ndsi , ndse )
5545  READ (ndsi,*,END=2001,ERR=2002) NDSTR, VSC, IDLA, IDFT, RFORM, &
5546  from, tname
5547  END IF
5548  !
5549  IF ( abs(vsc) .LT. 1.e-7 ) THEN
5550  vsc = 1.
5551  ELSE
5552  ! WARNING TO BE ADDED ...
5553  END IF
5554  IF (idla.LT.1 .OR. idla.GT.4) idla = 1
5555  IF (idft.LT.1 .OR. idft.GT.3) idft = 1
5556  !
5557  WRITE (ndso,1978) ndstr, vsc, idla, idft
5558  IF (idft.EQ.2) WRITE (ndso,973) rform
5559  IF (from.EQ.'NAME' .AND. ndsg.NE.ndstr) WRITE (ndso,974) tname
5560  !
5561  ! 9.e.2 Open file and check if necessary
5562  !
5563  IF ( ndstr .EQ. ndsi ) THEN
5564  IF ( idft .EQ. 3 ) THEN
5565  WRITE (ndse,1004) ndstr
5566  CALL extcde (23)
5567  ELSE
5568  CALL nextln ( comstr , ndsi , ndse )
5569  END IF
5570  ELSE IF ( ndstr .EQ. ndsg ) THEN
5571  IF ( ( idfm.EQ.3 .AND. idft.NE.3 ) .OR. &
5572  ( idfm.NE.3 .AND. idft.EQ.3 ) ) THEN
5573  WRITE (ndse,1005) idfm, idft
5574  CALL extcde (24)
5575  END IF
5576  ELSE
5577  IF ( idft .EQ. 3 ) THEN
5578  IF (from.EQ.'NAME') THEN
5579  OPEN (ndstr,file=trim(fnmpre)//tname, &
5580  form='UNFORMATTED', convert=file_endian,status='OLD',err=2000, &
5581  iostat=ierr)
5582  ELSE
5583  OPEN (ndstr, form='UNFORMATTED', convert=file_endian, &
5584  status='OLD',err=2000,iostat=ierr)
5585  END IF
5586  ELSE
5587  IF (from.EQ.'NAME') THEN
5588  OPEN (ndstr,file=trim(fnmpre)//tname, &
5589  status='OLD',err=2000,iostat=ierr)
5590  ELSE
5591  OPEN (ndstr, &
5592  status='OLD',err=2000,iostat=ierr)
5593  END IF
5594  END IF
5595  END IF
5596  !
5597  ! 9.e.3 Read the data
5598  !
5599  CALL ina2r ( sed_d50file, nx, ny, 1, nx, 1, ny, ndstr, ndst, ndse, &
5600  idfm, rform, idla, vsc, vof)
5601  !
5602  IF ( ndstr .EQ. ndsi ) CALL nextln ( comstr , ndsi , ndse )
5603  !
5604  WRITE (ndso,*) 'Min and Max values of grain sizes:',minval(sed_d50file), maxval(sed_d50file)
5605  WRITE (ndso,*)
5606  !
5607  ELSE
5609  END IF
5610  !
5611  DO iy=1, ny
5612  DO ix=1, nx
5613  isea = mapfs(iy,ix)
5614  sed_d50(isea) = sed_d50file(ix,iy)
5615  sed_d50(isea) = max(sed_d50(isea),1e-5)
5616  ! Critical Shields number, Soulsby, R.L. and R J S W Whitehouse
5617  ! Threshold of sed. motion in coastal environments, Proc. Pacific Coasts and
5618  ! ports, 1997 conference, Christchurch, p149-154, University of Cantebury, NZ
5619  sed_dstar=(grav*(sed_sg-1)/nu_water**2)**(0.333333)*sed_d50(isea)
5620  sed_psic(isea)=0.3/(1+1.2*sed_dstar)+0.55*(1-exp(-0.02*sed_dstar))
5621 #endif
5622 
5623 
5624 #ifdef W3_BT4
5625  END DO
5626  END DO
5627 #endif
5628  !
5629  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5630  ! 10. Prepare output boundary points.
5631  ! ILOOP = 1 to count NFBPO and NBO
5632  ! ILOOP = 2 to fill data arrays
5633  !
5634  WRITE (ndso,990)
5635  IF ( .NOT. flgnml ) &
5636  OPEN (ndss,file=trim(fnmpre)//'ww3_grid.scratch',form='FORMATTED')
5637  !
5638  DO iloop = 1, 2
5639  !
5640  IF ( iloop.EQ.2 ) CALL w3dmo5 ( 1, ndst, ndse, 2 )
5641  !
5642  i = 1
5643  nbotot = 0
5644  nfbpo = 0
5645  nbo(0) = 0
5646  nbo2(0)= 0
5647  first = .true.
5648  IF ( .NOT. flgnml ) THEN
5649  rewind(ndss)
5650  IF ( iloop .EQ. 1 ) THEN
5651  ndsi2 = ndsi
5652  ELSE
5653  ndsi2 = ndss
5654  END IF
5655  END IF
5656  !
5657  DO
5658  IF (flgnml) THEN
5659  ! outbound lines
5660  IF (nml_outbnd_count%N_LINE.GT.0 .AND. i.LE.nml_outbnd_count%N_LINE) THEN
5661  xo0 = nml_outbnd_line(i)%X0
5662  yo0 = nml_outbnd_line(i)%Y0
5663  dxo = nml_outbnd_line(i)%DX
5664  dyo = nml_outbnd_line(i)%DY
5665  npo = nml_outbnd_line(i)%NP
5666  i=i+1
5667  ELSE
5668  npo=0
5669  END IF
5670  ELSE
5671  CALL nextln ( comstr , ndsi2 , ndse )
5672  READ (ndsi2,*,END=2001,ERR=2002) XO0, YO0, DXO, DYO, npo
5673  END IF
5674  !
5675  IF ( .NOT. flgnml .AND. iloop .EQ. 1 ) THEN
5676  backspace(ndsi)
5677  READ (ndsi,'(A)') line
5678  WRITE (ndss,'(A)') line
5679  END IF
5680  !
5681  ! ... Check if new file to be used
5682  !
5683  first = first .OR. npo.LE.0
5684  npo = abs(npo)
5685  !
5686  ! ... Preparations for new output file including end check
5687  ! and output for last output file
5688  !
5689  IF ( first ) THEN
5690  !
5691  first = .false.
5692  !
5693 #ifdef W3_RTD
5694  IF ( npo.NE.0 ) THEN
5695  ! Destination pole lat, lon from namelist
5696  bpolat = bplat(nfbpo+1)
5697  bpolon = bplon(nfbpo+1)
5698  END IF
5699  !
5700 #endif
5701  IF ( nfbpo.GE.1 .AND. iloop.EQ.2 ) THEN
5702  WRITE (ndso,991) nfbpo, nbo(nfbpo) - nbo(nfbpo-1), &
5703  nbo2(nfbpo) - nbo2(nfbpo-1)
5704 #ifdef W3_RTD
5705  ! Print dest. Pole lat/lon if either the dest or present grid is rotated
5706  IF ( bplat(nfbpo) < 90. .OR. polat < 90. ) &
5707  WRITE (ndso,1991) bplat(nfbpo), bplon(nfbpo)
5708  !
5709 #endif
5710 #ifdef W3_O1
5711  IF ( nbo(nfbpo) - nbo(nfbpo-1) .EQ. 1 ) THEN
5712  IF ( flagll ) THEN
5713  WRITE (ndso,992)
5714  ELSE
5715  WRITE (ndso,2992)
5716  END IF
5717  ELSE
5718  IF ( flagll ) THEN
5719  WRITE (ndso,1992)
5720  ELSE
5721  WRITE (ndso,3992)
5722  END IF
5723  END IF
5724  ip0 = nbo(nfbpo-1)+1
5725  ipn = nbo(nfbpo)
5726  iph = ip0 + (ipn-ip0-1)/2
5727  ipi = iph -ip0 + 1 + mod(ipn-ip0+1,2)
5728  DO ip=ip0, iph
5729  IF ( flagll ) THEN
5730  WRITE (ndso,1993) ip-nbo(nfbpo-1), &
5731  factor*xbpo(ip), &
5732  factor*ybpo(ip), &
5733  ip+ipi-nbo(nfbpo-1), &
5734  factor*xbpo(ip+ipi), &
5735  factor*ybpo(ip+ipi)
5736  ELSE
5737  WRITE (ndso,3993) ip-nbo(nfbpo-1), &
5738  factor*xbpo(ip), &
5739  factor*ybpo(ip), &
5740  ip+ipi-nbo(nfbpo-1), &
5741  factor*xbpo(ip+ipi), &
5742  factor*ybpo(ip+ipi)
5743  END IF
5744  END DO
5745  IF ( mod(ipn-ip0+1,2) .EQ. 1 ) THEN
5746  IF ( flagll ) THEN
5747  WRITE (ndso, 993) iph+1-nbo(nfbpo-1), &
5748  factor*xbpo(iph+1), &
5749  factor*ybpo(iph+1)
5750  ELSE
5751  WRITE (ndso,2993) iph+1-nbo(nfbpo-1), &
5752  factor*xbpo(iph+1), &
5753  factor*ybpo(iph+1)
5754  END IF
5755  END IF
5756  WRITE (ndso,*)
5757 #endif
5758  END IF
5759  !
5760  IF ( npo .EQ. 0 ) EXIT
5761  !
5762  nfbpo = nfbpo + 1
5763  IF ( nfbpo .GT. 9 ) THEN
5764  WRITE (ndse,1006)
5765  CALL extcde ( 50 )
5766  END IF
5767  nbo2(nfbpo) = nbo2(nfbpo-1)
5768  nbo(nfbpo) = nbotot
5769  !
5770  END IF
5771  !
5772  ! ... Loop over line segment - - - - - - - - - - - - - - - - - - - - -
5773  !
5774 #ifdef W3_RTD
5775  ! If either base or destination grid is rotated lat-lon
5776  IF ( allocated(bdylon) .eqv. .true. ) THEN
5777  deallocate( bdylon, bdylat )
5778  IF ( bpolat < 90. .OR. polat < 90. ) &
5779  deallocate( elatbdy, elonbdy, anglbdy )
5780  END IF
5781  allocate( bdylon(npo), bdylat(npo))
5782  IF ( bpolat < 90. .OR. polat < 90. ) &
5783  allocate( elatbdy(npo), elonbdy(npo), anglbdy(npo) )
5784  !
5785 #endif
5786 #ifdef W3_T
5787  WRITE (ndst,9090)
5788 #endif
5789  !
5790  DO ip=1, npo
5791  !
5792  xo = xo0 + real(ip-1)*dxo
5793  yo = yo0 + real(ip-1)*dyo
5794 #ifdef W3_RTD
5795  !
5796  ! Boundary points are specified in coordinates of the destination grid
5797  !
5798  ! Collect the line segment points into arrays
5799  bdylon(ip) = xo
5800  bdylat(ip) = yo
5801  ! Close the loop before calculating rotated lat-lon coordinates.
5802  END DO
5803 
5804  ! Create one or two sets of the segment points:
5805  ! 1. (BDYLAT, BDYLON) in standard lat-lon coordinates,
5806  ! 2. Also (ELatbdy, ELonbdy) in case the base grid is rotated
5807 
5808  IF ( bpolat < 90. ) THEN
5809  ! The destination grid is rotated (std->rot or rot->rot)
5810  ! Change BDYLAT, BDYLON to their standard lat-lon positions
5811  ! Let ELatbdy,ELonbdy contain the rotated lat-lon coordinates
5812  elatbdy(:) = bdylat(:)
5813  elonbdy(:) = bdylon(:)
5814  CALL w3eqtoll ( elatbdy, elonbdy, bdylat, bdylon, &
5815  & anglbdy, bpolat, bpolon, npo )
5816  ! Let the standard longitudes BDYLON be within the range [-180.,180.[
5817  ! or [0., 360.[ depending on the grid pole
5818  IF ( polon < -90. .OR. polon > 90. ) THEN
5819  bdylon(:) = mod( bdylon(:) + 180., 360. ) - 180.
5820  ELSE
5821  bdylon(:) = mod( bdylon(:) + 360., 360. )
5822  END IF
5823  END IF ! bPolat < 90.
5824  ! From now, BDYLAT, BDYLON are defined in standard lat-lon coordinates
5825  !
5826  IF ( polat < 90. ) THEN
5827  ! The base grid is rotated (rot->std or rot->rot)
5828  ! Find lat-lon in coordinates of the rotated base grid
5829  CALL w3lltoeq ( bdylat, bdylon, elatbdy, elonbdy, &
5830  & anglbdy, polat, polon, npo )
5831  END IF
5832  !
5833  ! Take up again the loop over the line segment points
5834  DO ip=1, npo
5835  IF ( polat < 90. ) THEN
5836  ! The base grid is rotated (rot->std, rot->rot)
5837  ! (The std. lat-lon values BDYLAT, BDYLON go to YBPO, XBPO)
5838  xo = elonbdy(ip)
5839  yo = elatbdy(ip)
5840  ELSE
5841  ! The base grid is standard geographic (std->rot or std->std)
5842  xo = bdylon(ip)
5843  yo = bdylat(ip)
5844  END IF
5845 #endif
5846  !
5847  ! ... Compute bilinear remapping weights
5848  !
5849  ingrid = w3grmp( gsu, xo, yo, ixr, iyr, rd )
5850  !
5851  ! Change cell-corners from counter-clockwise to column-major order
5852  ix = ixr(3); iy = iyr(3); x = rd(3);
5853  ixr(3) = ixr(4); iyr(3) = iyr(4); rd(3) = rd(4);
5854  ixr(4) = ix ; iyr(4) = iy ; rd(4) = x ;
5855  !
5856 #ifdef W3_T
5857  WRITE (ndst,9091) factor*xo, factor*yo, &
5858  (ixr(j), iyr(j), rd(j), j=1,4)
5859 #endif
5860  !
5861  ! ... Check if point in grid
5862  !
5863  IF ( ingrid ) THEN
5864  !
5865  ! ... Check if point not on land
5866  !
5867  IF ( ( mapsta(iyr(1),ixr(1)).GT.0 .AND. &
5868  rd(1).GT.0.05 ) .OR. &
5869  ( mapsta(iyr(2),ixr(2)).GT.0 .AND. &
5870  rd(2).GT.0.05 ) .OR. &
5871  ( mapsta(iyr(3),ixr(3)).GT.0 .AND. &
5872  rd(3).GT.0.05 ) .OR. &
5873  ( mapsta(iyr(4),ixr(4)).GT.0 .AND. &
5874  rd(4).GT.0.05 ) ) THEN
5875  !
5876  ! ... Check storage and store coordinates
5877  !
5878  nbotot = nbotot + 1
5879  IF ( iloop .EQ. 1 ) cycle
5880  !
5881 #ifdef W3_RTD
5882  ! BDYLAT, BDYLON contain Y0, X0, which are remapped to standard lat/lon.
5883  ! BDYLAT, BDYLON are stored in the mod_def file.
5884  IF ( polat < 90. ) THEN
5885  xo = bdylon(ip)
5886  yo = bdylat(ip)
5887  END IF
5888 #endif
5889  xbpo(nbotot) = xo
5890  ybpo(nbotot) = yo
5891  !
5892  ! ... Interpolation factors
5893  !
5894  rdtot = 0.
5895  DO j=1, 4
5896  IF ( mapsta(iyr(j),ixr(j)).GT.0 .AND. &
5897  rd(j).GT.0.05 ) THEN
5898  rdbpo(nbotot,j) = rd(j)
5899  ELSE
5900  rdbpo(nbotot,j) = 0.
5901  END IF
5902  rdtot = rdtot + rdbpo(nbotot,j)
5903  END DO
5904  !
5905  DO j=1, 4
5906  rdbpo(nbotot,j) = rdbpo(nbotot,j) / rdtot
5907  END DO
5908  !
5909 #ifdef W3_T
5910  WRITE (ndst,9092) rdtot, (rdbpo(nbotot,j),j=1,4)
5911 #endif
5912  !
5913  ! ... Determine sea and interpolation point counters
5914  !
5915  DO j=1, 4
5916  iseai(j) = mapfs(iyr(j),ixr(j))
5917  END DO
5918  !
5919  DO j=1, 4
5920  IF ( iseai(j).EQ.0 .OR. rdbpo(nbotot,j).EQ. 0. ) THEN
5921  ipbpo(nbotot,j) = 0
5922  ELSE
5923  flnew = .true.
5924  DO ist=nbo2(nfbpo-1)+1, nbo2(nfbpo)
5925  IF ( iseai(j) .EQ. isbpo(ist) ) THEN
5926  flnew = .false.
5927  ipbpo(nbotot,j) = ist - nbo2(nfbpo-1)
5928  END IF
5929  END DO
5930  IF ( flnew ) THEN
5931  nbo2(nfbpo) = nbo2(nfbpo) + 1
5932  ipbpo(nbotot,j) = nbo2(nfbpo) - nbo2(nfbpo-1)
5933  isbpo(nbo2(nfbpo)) = iseai(j)
5934  END IF
5935  END IF
5936  END DO
5937  !
5938 #ifdef W3_T
5939  WRITE (ndst,9093) iseai, (ipbpo(nbotot,j),j=1,4)
5940 #endif
5941  !
5942  ! ... Error output
5943  !
5944  ELSE
5945  IF ( flagll ) THEN
5946  WRITE (ndse,2995) factor*xo, factor*yo
5947  ELSE
5948  WRITE (ndse,995) factor*xo, factor*yo
5949  END IF
5950  END IF
5951  ELSE
5952  IF ( flagll ) THEN
5953  WRITE (ndse,2994) factor*xo, factor*yo
5954  ELSE
5955  WRITE (ndse,994) factor*xo, factor*yo
5956  END IF
5957  END IF
5958  !
5959  END DO
5960  !
5961  nbo(nfbpo) = nbotot
5962  !
5963  ! ... Branch back to read.
5964  !
5965  END DO
5966  !
5967  ! ... End of ILOOP loop
5968  !
5969  END DO
5970  !
5971  IF ( .NOT. flgnml ) CLOSE ( ndss, status='DELETE' )
5972  !
5973  flbpo = nbotot .GT. 0
5974  IF ( .NOT. flbpo ) THEN
5975  WRITE (ndso,996)
5976  ELSE
5977  WRITE (ndso,997) nbotot, nbo2(nfbpo)
5978  END IF
5979  !
5980 #ifdef W3_T0
5981  WRITE (ndst,9095)
5982  DO ifile=1, nfbpo
5983  DO ip=nbo2(ifile-1)+1, nbo2(ifile)
5984  WRITE (ndst,9096) ifile, ip-nbo2(ifile-1), isbpo(ip)
5985  END DO
5986  END DO
5987 #endif
5988  !
5989  !--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5990  !10. Write model definition file.
5991  !
5992  WRITE (ndso,999)
5993  CALL w3iogr ( 'WRITE', ndsm &
5994 #ifdef W3_ASCII
5995  ,ndsa=ndsma &
5996 #endif
5997  )
5998  !
5999  CLOSE (ndsm)
6000 #ifdef W3_ASCII
6001  CLOSE (ndsma)
6002 #endif
6003  !
6004  GOTO 2222
6005  !
6006  ! Escape locations read errors :
6007  !
6008 2000 CONTINUE
6009  WRITE (ndse,1000) ierr
6010  CALL extcde ( 60 )
6011  !
6012 2001 CONTINUE
6013  WRITE (ndse,1001)
6014  CALL extcde ( 61 )
6015  !
6016 2002 CONTINUE
6017  WRITE (ndse,1002) ierr
6018  CALL extcde ( 62 )
6019  !
6020 2003 CONTINUE
6021  WRITE (ndse,1003)
6022  CALL extcde ( 64 )
6023  !
6024 2222 CONTINUE
6025  IF ( gtype .NE. ungtype) THEN
6026  IF ( nx*ny .NE. nsea ) THEN
6027  WRITE (ndso,9997) nx, ny, nx*ny, nsea, &
6028  100.*real(nsea)/real(nx*ny), nbi, nland, nbt
6029  ELSE
6030  WRITE (ndso,9998) nx, ny, nx*ny, nsea, nbi, nland, nbt
6031  END IF
6032  ELSE IF ( gtype .EQ. ungtype ) THEN
6033  IF ( nx*ny .NE. nsea ) THEN
6034  WRITE (ndso,9997) 0, 0, nx*ny, nsea, &
6035  100.*real(nsea)/real(nx*ny), nbi, nland, nbt
6036  ELSE
6037  WRITE (ndso,9998) 0, 0, nx*ny, nsea, nbi, nland, nbt
6038  END IF
6039  ENDIF ! GTYPE .EQ. UNGTYPE
6040 
6041  WRITE (ndso,9999)
6042 
6043 #ifdef W3_SCRIP
6044  grid1_units='degrees' ! the other option is radians...we don't use this
6045  grid1_name='src' ! this is not used, except for netcdf output
6046  CALL get_scrip_info(1, &
6047  & grid1_center_lon, grid1_center_lat, &
6048  & grid1_corner_lon, grid1_corner_lat, grid1_mask, &
6049  & grid1_dims, grid1_size, grid1_corners, grid1_rank)
6050 
6051 
6052 #endif
6053 
6054 #ifdef W3_SCRIP
6055  IF (gtype .EQ. ungtype) THEN
6056  grid1_rank=1
6057  DEALLOCATE(grid1_dims)
6058  ALLOCATE(grid1_dims(grid1_rank))
6059  grid1_dims(1) = grid1_size
6060  ENDIF
6061 #endif
6062 
6063 #ifdef W3_SCRIP
6064  DO i = 1,grid1_size
6065  IF (grid1_center_lon(i) < 0.0) THEN
6066  grid1_center_lon(i) = grid1_center_lon(i)+360.0
6067  ENDIF
6068  DO j = 1,grid1_corners
6069  IF (grid1_corner_lon(j,i) < 0.0) THEN
6070  grid1_corner_lon(j,i) = grid1_corner_lon(j,i)+360.0
6071  ENDIF
6072  ENDDO
6073  ENDDO
6074 #endif
6075 
6076 #ifdef W3_SCRIPNC
6077  ierr = nf90_create(trim('scrip.nc'), nf90_netcdf4, ncid)
6078  ierr = nf90_def_dim(ncid, 'grid_size', grid1_size, grid_size_dimid)
6079  ierr = nf90_def_dim(ncid, 'grid_corners', grid1_corners, grid_corners_dimid)
6080  ierr = nf90_def_dim(ncid, 'grid_rank', grid1_rank, grid_rank_dimid)
6081 #endif
6082 
6083 #ifdef W3_SCRIPNC
6084  ierr = nf90_def_var(ncid, 'grid_center_lat', nf90_double, &
6086  ierr = nf90_def_var(ncid, 'grid_center_lon', nf90_double, &
6088  ierr = nf90_def_var(ncid, 'grid_corner_lat', nf90_double, &
6091  ierr = nf90_def_var(ncid, 'grid_corner_lon', nf90_double, &
6094  ierr = nf90_def_var(ncid, 'grid_imask', nf90_int, &
6096  ierr = nf90_def_var(ncid, 'grid_dims', nf90_int, &
6098  ierr = nf90_enddef(ncid)
6099 #endif
6100 
6101 #ifdef W3_SCRIP
6102  ALLOCATE(grid1_imask(grid1_dims(1)))
6103  grid1_imask = 0
6104  DO i = 1,grid1_dims(1)
6105  IF (grid1_mask(i)) THEN
6106  grid1_imask(i) = 1
6107  ENDIF
6108  ENDDO
6109 #endif
6110 
6111 #ifdef W3_SCRIPNC
6112  ierr = nf90_put_att(ncid,grid_center_lat_varid,'units',grid1_units)
6113  ierr = nf90_put_att(ncid,grid_center_lon_varid,'units',grid1_units)
6114  ierr = nf90_put_att(ncid,grid_corner_lat_varid,'units',grid1_units)
6115  ierr = nf90_put_att(ncid,grid_corner_lon_varid,'units',grid1_units)
6116  ierr = nf90_put_att(ncid,grid_imask_varid,'units','unitless')
6117 #endif
6118 
6119 #ifdef W3_SCRIPNC
6120  ierr = nf90_put_var(ncid,grid_center_lat_varid,grid1_center_lat)
6121  ierr = nf90_put_var(ncid,grid_center_lon_varid,grid1_center_lon)
6122  ierr = nf90_put_var(ncid,grid_corner_lat_varid,grid1_corner_lat)
6123  ierr = nf90_put_var(ncid,grid_corner_lon_varid,grid1_corner_lon)
6124  ierr = nf90_put_var(ncid,grid_imask_varid,grid1_imask)
6125  ierr = nf90_put_var(ncid,grid_dims_varid,grid1_dims)
6126  ierr = nf90_close(ncid)
6127 #endif
6128 
6129 
6130  !
6131  ! Formats
6132  !
6133 900 FORMAT (/15x,' *** WAVEWATCH III Grid preprocessor *** '/ &
6134  15x,'==============================================='/)
6135 901 FORMAT ( ' Comment character is ''',a,''''/)
6136 902 FORMAT ( ' Grid name : ',a/)
6137 903 FORMAT (/' Spectral discretization : '/ &
6138  ' --------------------------------------------------'/ &
6139  ' Number of directions :',i4/ &
6140  ' Directional increment (deg.):',f6.1)
6141 904 FORMAT ( ' First direction (deg.):',f6.1)
6142 905 FORMAT ( ' Number of frequencies :',i4/ &
6143  ' Frequency range (Hz) :',f9.4,'-',f6.4/ &
6144  ' Increment factor :',f8.3/)
6145  !
6146 910 FORMAT (/' Model definition :'/ &
6147  ' --------------------------------------------------')
6148 911 FORMAT ( ' Dry run (no calculations) : ',a/ &
6149  ' Propagation in X-direction : ',a/ &
6150  ' Propagation in Y-direction : ',a/ &
6151  ' Refraction : ',a/ &
6152  ' Current-induced k-shift : ',a/ &
6153  ' Source term calc. and int. : ',a/)
6154 912 FORMAT (/' Time steps : '/ &
6155  ' --------------------------------------------------'/ &
6156  ' Maximum global time step (s) :',f8.2/ &
6157  ' Maximum CFL time step X-Y (s) :',f8.2/ &
6158  ' Maximum CFL time step k-theta (s) :',f8.2/ &
6159  ' Minimum source term time step (s) :',f8.2/)
6160 913 FORMAT (/ ' WARNING, TIME STEP LESS THAN 1 s, NITER:',i8 /)
6161 915 FORMAT ( ' Preprocessing namelists ...')
6162 916 FORMAT ( ' Preprocessing namelists finished.'/)
6163 917 FORMAT (/' Equivalent namelists ...'/)
6164 918 FORMAT (/' Equivalent namelists finished.'/)
6165  !
6166 #ifdef W3_FLX1
6167 810 FORMAT (/' Stresses (Wu 1980)'/ &
6168  ' --------------------------------------------------'/)
6169 #endif
6170 #ifdef W3_FLX2
6171 810 FORMAT (/' Stresses (T&C 96)'/ &
6172  ' --------------------------------------------------'/)
6173 #endif
6174 #ifdef W3_FLX3
6175 810 FORMAT (/' Stresses (T&C 96 capped) ',a/ &
6176  ' --------------------------------------------------')
6177 #endif
6178 #ifdef W3_FLX4
6179 810 FORMAT (/' Stresses (Hwang 2011) ',a/ &
6180  ' --------------------------------------------------')
6181 811 FORMAT ( ' drag coefficient scaling :',f8.2 /)
6182 2810 FORMAT ( ' &FLX4 CDFAC =',f6.3,' /')
6183 #endif
6184 #ifdef W3_FLX5
6185 810 FORMAT (/' Direct use of stress from input'/ &
6186  ' --------------------------------------------------'/)
6187 #endif
6188 #ifdef W3_FLX3
6189 811 FORMAT ( ' Max Cd * 10^3 :',f8.2/ &
6190  ' Cap type : ',a/)
6191 2810 FORMAT ( ' &FLX3 CDMAX =',f6.2,'E-3 , CTYPE = ',i1,' /')
6192 #endif
6193  !
6194 #ifdef W3_LN0
6195 820 FORMAT (/' Linear input not defined.'/)
6196 #endif
6197 #ifdef W3_SEED
6198 820 FORMAT (/' Seeding as proxi for linear input.'/)
6199 #endif
6200  !
6201 #ifdef W3_LN1
6202 820 FORMAT (/' Linear input (C&M-R 82) ',a/ &
6203  ' --------------------------------------------------')
6204 821 FORMAT ( ' CLIN :',f8.2/ &
6205  ' Factor for fPM in filter :',f8.2/ &
6206  ' Factor for fh in filter :',f8.2/)
6207 2820 FORMAT ( ' &SLN1 CLIN =',f6.1,', RFPM =',f6.2, &
6208  ', RFHF =',f6.2,' /')
6209 #endif
6210  !
6211 #ifdef W3_ST0
6212 920 FORMAT (/' Wind input not defined.'/)
6213 #endif
6214  !
6215 #ifdef W3_ST1
6216 920 FORMAT (/' Wind input (WAM-3) ',a/ &
6217  ' --------------------------------------------------')
6218 921 FORMAT ( ' Cinp :',e10.3/)
6219 2920 FORMAT ( ' &SIN1 CINP =',f7.3,' /')
6220 #endif
6221  !
6222 #ifdef W3_ST2
6223 920 FORMAT (/' Wind input (T&C 1996) ',a/ &
6224  ' --------------------------------------------------')
6225 921 FORMAT ( ' Height of input wind (m) :',f8.2/ &
6226  ' Factor negative swell :',f9.3/)
6227 #endif
6228 #ifdef W3_STAB2
6229 1921 FORMAT ( ' Effective wind mean factor :',f8.2/ &
6230  ' Stability par. offset :',f9.3/ &
6231  ' Stab. correction :',f9.3,f8.3/&
6232  ' Stab. correction stab. fac. :',f7.1,f9.1/)
6233 #endif
6234 #ifdef W3_ST2
6235 2920 FORMAT ( ' &SIN2 ZWND =',f5.1,', SWELLF =',f6.3,' /')
6236 #endif
6237 #ifdef W3_STAB2
6238 2921 FORMAT ( ' &SIN2 ZWND =',f5.1,', SWELLF =',f6.3,', STABSH =', &
6239  f6.3,', STABOF = ',e10.3,','/ &
6240  ' CNEG =',f7.3,', CPOS =',f7.3,', FNEG =',f7.1,' /')
6241 #endif
6242  !
6243 #ifdef W3_ST3
6244 920 FORMAT (/' Wind input (WAM 4+) ',a/ &
6245  ' --------------------------------------------------')
6246 921 FORMAT ( ' minimum Charnock coeff. :',f10.4/ &
6247  ' betamax :',f9.3/ &
6248  ' power of cos. in wind input :',f9.3/ &
6249  ' z0max :',f9.3/ &
6250  ' zalp :',f9.3/ &
6251  ' Height of input wind (m) :',f8.2/ &
6252  ' swell attenuation factor :',f9.3/ )
6253 2920 FORMAT ( ' &SIN3 ZWND =',f5.1,', ALPHA0 =',f8.5,', Z0MAX =',f8.5,', BETAMAX =', &
6254  f8.5,','/ &
6255  ' SINTHP =',f8.5,', ZALP =',f8.5,','/ &
6256  ' SWELLF =',f8.5,'R /'/)
6257 #endif
6258  !
6259 #ifdef W3_ST4
6260 920 FORMAT (/' Wind input (WAM 4+) ',a/ &
6261  ' --------------------------------------------------')
6262 921 FORMAT ( ' minimum Charnock coeff. :',f10.4/ &
6263  ' betamax :',f9.3/ &
6264  ' power of cos. in wind input :',f9.3/ &
6265  ' z0max :',f9.3/ &
6266  ' zalp :',f9.3/ &
6267  ' Height of input wind (m) :',f8.2/ &
6268  ' wind stress sheltering :',f9.3/ &
6269  ' swell attenuation param. :',i5/ &
6270  ' swell attenuation factor :',f9.3/ &
6271  ' swell attenuation factor2 :',f9.3/ &
6272  ' swell attenuation factor3 :',f9.3/ &
6273  ' critical Reynolds number :',f9.1/ &
6274  ' swell attenuation factor5 :',f9.3/ &
6275  ' swell attenuation factor6 :',f9.3/ &
6276  ' swell attenuation factor7 :',f14.3/ &
6277  ' ratio of z0 for orb. & mean :',f9.3/)
6278 2920 FORMAT ( ' &SIN4 ZWND =',f5.1,', ALPHA0 =',f8.5,', Z0MAX =',f8.5,', BETAMAX =', &
6279  f8.5,','/ &
6280  ' SINTHP =',f8.5,', ZALP =',f8.5,', TAUWSHELTER =',f8.5, &
6281  ', SWELLFPAR =',i2,','/ &
6282  ' SWELLF =',f8.5,', SWELLF2 =',f8.5, &
6283  ', SWELLF3 =',f8.5,', SWELLF4 =',f9.1,','/ &
6284  ' SWELLF5 =',f8.5,', SWELLF6 =',f8.5, &
6285  ', SWELLF7 =',f12.2,', Z0RAT =',f8.5,', SINBR =',f8.5,','/ &
6286  ' SINTABLE =',i2,', TAUWBUG =',i2, &
6287  ', VISCSTRESS =',f8.5,', SINTAIL1 =',f8.5,', SINTAIL2 =',f8.5,',' / &
6288  ', CAPCHA =',f8.5,', CHAMIN =',f8.5,', CHA0 =',f8.5,', UCAP =',f5.1,', SIGMAUCAP =', &
6289  f5.1,' /')
6290 #endif
6291  !
6292 #ifdef W3_ST6
6293 920 FORMAT (/' Wind input (Donelan et al, 2006) ',a/ &
6294  ' --------------------------------------------------')
6295 921 FORMAT ( ' negative wind input active : ',a/ &
6296  ' attenuation factor : ',f6.2/ &
6297  ' wind speed scaling factor : ',f6.2/ &
6298  ' frequency cut-off factor : ',f6.2/)
6299 2920 FORMAT ( ' &SIN6 SINA0 =', f6.3, ', SINWS =', f6.2, ', SINFC =', f6.2, ' /')
6300 #endif
6301  !
6302 #ifdef W3_NL0
6303 922 FORMAT (/' Nonlinear interactions not defined.'/)
6304 #endif
6305  !
6306 #ifdef W3_NL1
6307 922 FORMAT (/' Nonlinear interactions (DIA) ',a/ &
6308  ' --------------------------------------------------')
6309 923 FORMAT ( ' Lambda :',f8.2/ &
6310  ' Prop. constant :',e10.3/ &
6311  ' kd conversion factor :',f8.2/ &
6312  ' minimum kd :',f8.2/ &
6313  ' shallow water constants :',f8.2,2f6.2/)
6314 2922 FORMAT ( ' &SNL1 LAMBDA =',f7.3,', NLPROP =',e10.3, &
6315  ', KDCONV =',f7.3,', KDMIN =',f7.3,','/ &
6316  ' SNLCS1 =',f7.3,', SNLCS2 =',f7.3, &
6317  ', SNLCS3 = ',f7.3','/ &
6318  ' IQTYPE =',i2,', TAILNL =',f5.1,','/ &
6319  ' GQMNF1 =',i2,', GQMNT1 =',i2,',', &
6320  ' GQMNQ_OM2 =',i2,', GQMTHRSAT =',e11.4,', GQMTHRCOU =',f4.3,','/ &
6321  ' GQAMP1 =',f5.3,', GQAMP2 =',f5.3,', GQAMP3 =',f5.3,', GQAMP4 =',f5.3,' /')
6322 #endif
6323  !
6324 #ifdef W3_NL2
6325 922 FORMAT (/' Nonlinear interactions (WRT) ',a/ &
6326  ' --------------------------------------------------')
6327 923 FORMAT ( ' Deep/shallow options : ',a/ &
6328  ' Power of h-f tail : ',f6.1)
6329 1923 FORMAT ( ' Number of depths used : ',i4/ &
6330  ' Depths (m) :',5f7.1)
6331 2923 FORMAT ( ' ',5f7.1)
6332 2922 FORMAT ( ' &SNL2 IQTYPE =',i2,', TAILNL =',f5.1,',', &
6333  ' NDEPTH =',i3,' /')
6334 3923 FORMAT ( ' &SNL2 DEPTHS =',f9.2,' /')
6335 4923 FORMAT ( ' &ANL2 DEPTHS =',f9.2,' ,')
6336 5923 FORMAT ( ' ',f9.2,' ,')
6337 6923 FORMAT ( ' ',f9.2,' /')
6338 #endif
6339  !
6340 #ifdef W3_NL3
6341 922 FORMAT (/' Nonlinear interactions (GMD) ',a/ &
6342  ' --------------------------------------------------')
6343 923 FORMAT ( ' Powers in scaling functions : ',2f7.2/ &
6344  ' Nondimension filter depths : ',2f7.2)
6345 1923 FORMAT ( ' Number of quad. definitions : ',i4)
6346 2923 FORMAT ( ' ',2f8.3,f6.1,2e12.4)
6347 2922 FORMAT ( ' &SNL3 NQDEF =',i3,', MSC =',f6.2,', NSC =', &
6348  f6.2,', KDFD =',f6.2,', KDFS =',f6.2,' /')
6349 3923 FORMAT ( ' &ANL3 QPARMS = ',2(f5.3,', '),f5.1,', ',e11.4, &
6350  ', ',e11.4,' /')
6351 4923 FORMAT ( ' &ANL3 QPARMS = ',2(f5.3,', '),f5.1,', ',e11.4, &
6352  ', ',e11.4,' ,')
6353 5923 FORMAT ( ' ',2(f5.3,', '),f5.1,', ',e11.4, &
6354  ', ',e11.4,' ,')
6355 6923 FORMAT ( ' ',2(f5.3,', '),f5.1,', ',e11.4, &
6356  ', ',e11.4,' /')
6357 #endif
6358  !
6359 #ifdef W3_NL4
6360 922 FORMAT (/' Nonlinear interactions (TSA) ',a/ &
6361  ' --------------------------------------------------')
6362 923 FORMAT ( ' Source term computation (1=TSA,0=FBI) : ',i2/ &
6363  ' Alternate loops (1=no,2=yes) : ',i2/ &
6364  ' (To speed up computation) ')
6365 2922 FORMAT ( ' &SNL4 ITSA =',i2,', IALT =',i2 )
6366 #endif
6367  !
6368 #ifdef W3_NL5
6369 922 FORMAT(/' Nonlinear interactions (GKE) ',a/ &
6370  ' --------------------------------------------------')
6371 923 FORMAT ( ' Constant water depth (in meter) : ', f7.1/ &
6372  ' Quasi-resonant quartets cut-off : ', f8.2/ &
6373  ' Discretiz. of GKE (0:Con., 1:GS): ', i5/ &
6374  ' GKE (0: GS13-JFM, 1: J03-JPO) : ', i5/ &
6375  ' Interp (0: nearest, 1: bilinear): ', i5/ &
6376  ' Mixing (0: no, N: N Tm, -1: b_T): ', i5/)
6377 2922 FORMAT ( ' &SNL5 NL5DPT =', f7.1, ', NL5OML =', f5.2, &
6378  ', NL5DIS =', i2.1, ', NL5KEV =', i2.1, &
6379  ', NL5IPL =', i2.1, ', NL5PMX =', i5.1, ' /')
6380 #endif
6381  !
6382 #ifdef W3_NLS
6383 9922 FORMAT (/' HF filter based on Snl ',a/ &
6384  ' --------------------------------------------------')
6385 9923 FORMAT ( ' a34 (lambda) :',f9.3,f9.4/ &
6386  ' Prop. constant :',e10.3/ &
6387  ' maximum relative change :',f9.3/ &
6388  ' filter constants :',f8.2,2f6.2/)
6389 8922 FORMAT ( ' &SNLS A34 =',f6.3,', FHFC =',e11.4, &
6390  ', DNM =',f6.3,','/' FC1 =',f6.3, &
6391  ', FC2 =',f6.3,', FC3 =',f6.3,' /')
6392 #endif
6393  !
6394 #ifdef W3_ST0
6395 924 FORMAT (/' Dissipation not defined.'/)
6396 #endif
6397  !
6398 #ifdef W3_ST1
6399 924 FORMAT (/' Dissipation (WAM-3) ',a/ &
6400  ' --------------------------------------------------')
6401 925 FORMAT ( ' Cdis :',e10.3/ &
6402  ' Apm :',e10.3/)
6403 2924 FORMAT ( ' &SDS1 CDIS =',e12.4,', APM =',e11.4,' /')
6404 #endif
6405  !
6406 #ifdef W3_ST2
6407 924 FORMAT (/' Dissipation (T&C 1996) ',a/ &
6408  ' --------------------------------------------------')
6409 925 FORMAT ( ' High-frequency constants :',f8.2,e11.3,f6.2/ &
6410  ' Low-frequency constants :',e11.3,f6.2/&
6411  ' ',e11.3,f6.2/&
6412  ' Minimum input peak freq. (-):',f10.4/ &
6413  ' Minimum PHI :',f10.4/)
6414 2924 FORMAT ( ' &SDS2 SDSA0 =',e10.3,', SDSA1 =',e10.3,', SDSA2 =', &
6415  e10.3,', '/ &
6416  ' SDSB0 =',e10.3,', SDSB1 =',e10.3,', ', &
6417  'PHIMIN =',e10.3,' /')
6418 #endif
6419  !
6420 #ifdef W3_ST3
6421 924 FORMAT (/' Dissipation (WAM Cycle 4+) ',a/ &
6422  ' --------------------------------------------------')
6423 925 FORMAT ( ' SDSC1 :',1e11.3/ &
6424  ' Power of k in mean k :',f8.2/ &
6425  ' weights of k and k^2 :',f9.3,f6.3/)
6426 2924 FORMAT ( ' &SDS3 SDSC1 =',e12.4,', WNMEANP =',f4.2, &
6427  ', FXPM3 =', f4.2,',FXFM3 =',f4.2,', '/ &
6428  ' SDSDELTA1 =', f5.2,', SDSDELTA2 =',f5.2, &
6429  ' /')
6430 #endif
6431  !
6432 #ifdef W3_ST4
6433 924 FORMAT (/' Dissipation (Ardhuin / Filipot / Romero ) ',a/ &
6434  ' --------------------------------------------------')
6435 925 FORMAT ( ' SDSC2, SDSBCK, SDSCUM :',3e11.3/ &
6436  ' Power of k in mean k :',f8.2/)
6437 #endif
6438 
6439 
6440 #ifdef W3_ST4
6441 2924 FORMAT ( ' &SDS4 SDSBCHOICE = ',f3.1, &
6442  ', SDSC2 =',e12.4,', SDSCUM =',f6.2,', '/ &
6443  ' SDSC4 =',f6.2,', SDSC5 =',e12.4, &
6444  ', SDSC6 =',e12.4,','/ &
6445  ' WNMEANP =',f4.2,', FXPM3 =', f4.2, &
6446  ', FXFM3 =',f4.1,', FXFMAGE =',f6.3, ', '/ &
6447  ' SDSBINT =',e12.4,', SDSBCK =',e12.4, &
6448  ', SDSABK =',f6.3,', SDSPBK =',f6.3,', '/ &
6449  ' SDSHCK =',f5.2,', SDSBR = ',e12.4, &
6450  ', SDSSTRAIN =',f5.1,', SDSSTRAINA =',f4.1, &
6451  ', SDSSTRAIN2 =',f5.1,', '/ &
6452  ' SDSBT =',f5.2,', SDSP =',f5.2, &
6453  ', SDSISO =',i2, &
6454  ', SDSCOS =',f3.1,', SDSDTH =',f5.1,', '/ &
6455  ' SDSBRF1 = ',f5.2,', SDSBRFDF =',i2,', '/ &
6456  ' SDSBM0 = ',f5.2, ', SDSBM1 =',f5.2, &
6457  ', SDSBM2 =',f5.2,', SDSBM3 =',f5.2,', SDSBM4 =', &
6458  f7.2,', '/, &
6459  ' SPMSS = ',f5.2, ', SDKOF =',f5.2, &
6460  ', SDSMWD =',f5.2,', SDSFACMTF =',f5.1,', '/ &
6461  ' SDSMWPOW =',f3.1,', SDSNMTF =', f5.2, &
6462  ', SDSCUMP =', f3.1,', CUMSIGP =', f3.1,', SDSNUW =', e10.3,', '/, &
6463  ' WHITECAPWIDTH =',f5.2, ' WHITECAPDUR =',f5.2,' /')
6464 #endif
6465  !
6466 #ifdef W3_ST6
6467 924 FORMAT (/' Dissipation (Rogers et al. 2012) ',a/ &
6468  ' --------------------------------------------------')
6469 925 FORMAT ( ' normalise by threshold spectral density : ',a/&
6470  ' normalise by spectral density : ',a/&
6471  ' coefficient and exponent for '/ &
6472  ' inherent breaking term a1, L as in (21) : ',e10.3,i3/ &
6473  ' cumulative breaking term a2, M as in (22) : ',e10.3,i3/ &
6474  ' ')
6475 2924 FORMAT ( ' &SDS6 SDSET = ',l,', SDSA1 = ',e10.3, &
6476  ', SDSA2 = ',e10.3,', SDSP1 = ',i2,', SDSP1 = ', &
6477  i2,' /' )
6478 
6479 937 FORMAT (/' Swell dissipation ',a/ &
6480  ' --------------------------------------------------')
6481 940 FORMAT ( ' subroutine W3SWL6 activated : ',a/ &
6482  ' coefficient b1 ',a, ' : ',e10.3/ )
6483 2937 FORMAT ( ' &SWL6 SWLB1 = ',e10.3,', CSTB1 = ',l,' /')
6484 #endif
6485  !
6486 #ifdef W3_BT0
6487 926 FORMAT (/' Bottom friction not defined.'/)
6488 #endif
6489  !
6490 #ifdef W3_BT1
6491 926 FORMAT (/' Bottom friction (JONSWAP) ',a/ &
6492  ' --------------------------------------------------')
6493 927 FORMAT ( ' gamma :',f8.4/)
6494 2926 FORMAT ( ' &SBT1 GAMMA =',e12.4,' /')
6495 #endif
6496  !
6497 #ifdef W3_BT4
6498 926 FORMAT (/' Bottom friction (SHOWEX) ',a/ &
6499  ' --------------------------------------------------')
6500 927 FORMAT ( ' SEDMAPD50, SED_D50_UNIFORM :',l3,1x,f8.6/ &
6501  ' RIPFAC1,RIPFAC2,RIPFAC3,RIPFAC4 :',4f8.4/ &
6502  ' SIGDEPTH, BOTROUGHMIN, BOTROUGHFAC:',3f8.4/)
6503 2926 FORMAT ( ' &SBT4 SEDMAPD50 =',l3,', SED_D50_UNIFORM =',f8.6,','/ &
6504  ' RIPFAC1 =',f8.4,', RIPFAC2 =',f8.4, &
6505  ', RIPFAC3 =',f8.4,', RIPFAC4 =',f8.4,','/ &
6506  ' SIGDEPTH =',f8.4,', BOTROUGHMIN =',f8.4, &
6507  ', BOTROUGHFAC =',f4.1,' /')
6508 #endif
6509  !
6510 #ifdef W3_DB0
6511 928 FORMAT (/' Surf breaking not defined.'/)
6512 #endif
6513  !
6514 #ifdef W3_DB1
6515 928 FORMAT (/' Surf breaking (B&J 1978) ',a/ &
6516  ' --------------------------------------------------')
6517 929 FORMAT ( ' alpha :',f8.3/ &
6518  ' gamma :',f8.3)
6519 2928 FORMAT ( ' &SDB1 BJALFA =',f7.3,', BJGAM =',f7.3, &
6520  ', BJFLAG = ',a,' /')
6521 #endif
6522  !
6523 #ifdef W3_TR0
6524 930 FORMAT (/' Triad interactions not defined.'/)
6525 #endif
6526  !
6527 #ifdef W3_BS0
6528 932 FORMAT (/' Bottom scattering not defined.'/)
6529 #endif
6530 #ifdef W3_BS1
6531 932 FORMAT (/' Experimental bottom scattering (F. Ardhuin).'/)
6532 #endif
6533  !
6534 #ifdef W3_IC1
6535 935 FORMAT (/' Dissipation via ice parameters (SIC1).'&
6536  ,/' --------------------------------------------------')
6537 #endif
6538  !
6539 #ifdef W3_IC2
6540 935 FORMAT (/' Dissipation via ice parameters (SIC2).'&
6541  ,/' --------------------------------------------------')
6542 #endif
6543  !
6544 #ifdef W3_IC3
6545 935 FORMAT (/' Dissipation via ice parameters (SIC3).'&
6546  ,/' --------------------------------------------------')
6547 #endif
6548  !
6549 #ifdef W3_IC4
6550 935 FORMAT (/' Dissipation via ice parameters (SIC4).'&
6551  ,/' --------------------------------------------------')
6552 #endif
6553  !
6554 #ifdef W3_IC5
6555 935 FORMAT (/' Dissipation via ice parameters (SIC5).'&
6556  ,/' --------------------------------------------------')
6557 #endif
6558  !
6559 #ifdef W3_IS0
6560 944 FORMAT (/' Ice scattering not defined.'/)
6561 #endif
6562 #ifdef W3_IS1
6563 945 FORMAT (/' Ice scattering ',a,/ &
6564  ' --------------------------------------------------')
6565 946 FORMAT (' Isotropic (linear function of ice concentration)'/&
6566  ' slope : ',e10.3/ &
6567  ' offset : ',e10.3)
6568 2946 FORMAT ( ' &SIS1 ISC1 =',e10.3,', ISC2 =',e10.3)
6569 #endif
6570 #ifdef W3_IS2
6571 947 FORMAT (/' Ice scattering ',a,/ &
6572  ' --------------------------------------------------')
6573 948 FORMAT (' IS2 Scattering ... '/&
6574  ' scattering coefficient : ',e10.3/ &
6575  ' 0: no back-scattering : ',e10.3/ &
6576  ' TRUE: istropic back-scattering : ',l3/ &
6577  ' TRUE: update of ICEDMAX : ',l3/ &
6578  ' TRUE: keeps updated ICEDMAX : ',l3/ &
6579  ' flexural strength : ',e10.3/ &
6580  ' TRUE: uses Robinson-Palmer disp.: ',l3/ &
6581  ' attenuation : ',f5.2/ &
6582  ' fragility : ',f5.2/ &
6583  ' minimum floe size in meters : ',f5.2/ &
6584  ' pack scattering coef 1 : ',f5.2/ &
6585  ' pack scattering coef 2 : ',f5.2/ &
6586  ' scaling by concentration : ',f5.2/ &
6587  ' creep B coefficient : ',e10.3/ &
6588  ' creep C coefficient : ',f5.2/ &
6589  ' creep D coefficient : ',f5.2/ &
6590  ' creep N power : ',f5.2/ &
6591  ' elastic energy factor : ',f5.2/ &
6592  ' factor for ice breakup : ',f5.2/ &
6593  ' IS2WIM1 : ',f5.2/ &
6594  ' anelastic dissipation : ',l3/ &
6595  ' energy of activation : ',f5.2/ &
6596  ' anelastic coefficient : ',e11.3/ &
6597  ' anelastic exponent : ',f5.2)
6598 2948 FORMAT ( ' &SIS2 ISC1 =',e10.3,', IS2BACKSCAT =',e10.3, &
6599  ', IS2ISOSCAT =',l3,', IS2BREAK =',l3, &
6600  ', IS2DUPDATE =',l3,','/ &
6601  ' IS2FLEXSTR =',e11.3,', IS2DISP =',l3, &
6602  ', IS2DAMP =',f3.1, &
6603  ', IS2FRAGILITY =',f4.2,', IS2DMIN =',f5.2,','/ &
6604  ' IS2C2 =',f12.8,', IS2C3 =',f8.4, &
6605  ', IS2CONC =',f5.1,', IS2CREEPB =',e11.3,','/ &
6606  ' IS2CREEPC =',f5.2,', IS2CREEPD =',f5.2, &
6607  ', IS2CREEPN =',f5.2,','/ &
6608  ' IS2BREAKE =',f5.2, &
6609  ', IS2BREAKF =',f5.2,', IS2WIM1 =',f5.2,','/ &
6610  ', IS2ANDISB =',l3,', IS2ANDISE =',f5.2, &
6611  ', IS2ANDISD =',e11.3,', IS2ANDISN=',f5.2, ' /')
6612 #endif
6613 #ifdef W3_UOST
6614 4500 FORMAT (/' Unresolved Obstacles Source Term (UOST) ',a,/ &
6615  ' --------------------------------------------------')
6616 4501 FORMAT (' local alpha-beta file: ',a, &
6617  ' shadow alpha-beta file: ',a,/ &
6618  ' local calibration factor: ',f5.2, &
6619  ' shadow calibration factor: ',f5.2)
6620 4502 FORMAT (' &UOST UOSTFILELOCAL = ',a,', UOSTFILESHADOW = ',a,/ &
6621  ' UOSTFACTORLOCAL = ',f5.2', UOSTFACTORSHADOW = ',f5.2,' /')
6622 #endif
6623  !
6624 950 FORMAT (/' Propagation scheme : '/ &
6625  ' --------------------------------------------------')
6626 951 FORMAT ( ' Type of scheme (structured) :',1x,a)
6627 2951 FORMAT ( ' Type of scheme(unstructured):',1x,a)
6628 2952 FORMAT ( ' wave setup computation:',1x,a)
6629 952 FORMAT ( ' ',1x,a)
6630 #ifdef W3_PR1
6631 953 FORMAT ( ' CFLmax depth refraction :',f9.3/)
6632 2953 FORMAT ( ' &PRO1 CFLTM =',f5.2,' /')
6633 #endif
6634  !
6635 #ifdef W3_PR2
6636 953 FORMAT ( ' CFLmax depth refraction :',f9.3/ &
6637  ' Effective swell age (h) : switched off'/ &
6638  ' Cut-off latitude (degr.) :',f7.1/)
6639 954 FORMAT ( ' CFLmax depth refraction :',f9.3/ &
6640  ' Effective swell age (h) :',f8.2/ &
6641  ' Cut-off latitude (degr.) :',f7.1/)
6642 2953 FORMAT ( ' &PRO2 CFLTM =',f5.2,', DTIME =',f8.0, &
6643  ', LATMIN =',f5.1,' /')
6644 #endif
6645  !
6646 #ifdef W3_SMC
6647 1950 FORMAT (/' SMC grid parameters : '/ &
6648  ' --------------------------------------------------')
6649 1951 FORMAT ( ' Type of scheme (structured) :',1x,a)
6650 1953 FORMAT ( ' Max propagation CFL number :',f9.3/ &
6651  ' Effective swell age (h) :',f8.2/ &
6652  ' Maximum refraction (degr.) :',f8.2/)
6653 2954 FORMAT ( ' &PSMC CFLSM =',f5.2,', DTIMS =', f9.1/ &
6654  ' Arctic =',l5, ', RFMAXD =', f9.2/ &
6655  ' UNO3 =',l5, ', AVERG =',l5/ &
6656  ' LvSMC =',i5, ', NBISMC =',i9/ &
6657  ' ISHFT =',i5, ', JEQT =',i9/ &
6658  ' SEAWND =',l5, '/')
6659 #endif
6660  !
6661 #ifdef W3_PR3
6662 953 FORMAT ( ' CFLmax depth refraction :',f9.3/ &
6663  ' Averaging area factor Cg :',f8.2)
6664 954 FORMAT ( ' Averaging area factor theta :',f8.2)
6665 955 FORMAT ( .GE.' **** Internal maximum ',f6.2,' ****')
6666 2953 FORMAT ( ' &PRO3 CFLTM =',f5.2, &
6667  ', WDTHCG = ',f4.2,', WDTHTH = ',f4.2,' /')
6668 #endif
6669  !
6670 2956 FORMAT ( ' &UNST UGBCCFL =',l3,', UGOBCAUTO =',l3, &
6671  ', UGOBCDEPTH =', f8.3,', UGOBCFILE=',a,','/ &
6672  ', EXPFSN =',l3,',EXPFSPSI =',l3, &
6673  ', EXPFSFCT =', l3,',IMPFSN =',l3,',EXPTOTAL=',l3, &
6674  ', IMPTOTAL=',l3,',IMPREFRACTION=', l3, &
6675  ', IMPFREQSHIFT=', l3,', IMPSOURCE=', l3, &
6676  ', SETUP_APPLY_WLV=', l3, &
6677  ', JGS_TERMINATE_MAXITER=', l3, &
6678  ', JGS_TERMINATE_DIFFERENCE=', l3, &
6679  ', JGS_TERMINATE_NORM=', l3, &
6680  ', JGS_LIMITER=', l3, &
6681  ', JGS_LIMITER_FUNC=', i3, &
6682  ', JGS_USE_JACOBI=', l3, &
6683  ', JGS_BLOCK_GAUSS_SEIDEL=', l3, &
6684  ', JGS_MAXITER=', i5, &
6685  ', JGS_PMIN=', f8.3, &
6686  ', JGS_DIFF_THR=', f8.3, &
6687  ', JGS_NORM_THR=', f8.3, &
6688  ', JGS_NLEVEL=', i3, &
6689  ', JGS_SOURCE_NONLINEAR=', l3 / )
6690  !
6691 960 FORMAT (/' Miscellaneous ',a/ &
6692  ' --------------------------------------------------')
6693 2961 FORMAT ( ' *** WAVEWATCH-III WARNING IN W3GRID :'/ &
6694  .NE.' CICE0CICEN requires FLAGTR>2'/ &
6695  ' Parameters corrected: CICE0 = CICEN'/)
6696 2962 FORMAT (/' *** WAVEWATCH-III WARNING IN W3GRID : User requests', &
6697  'CICE0=CICEN corresponding to discontinuous treatment of ', &
6698  'ice, so we will change FLAGTR')
6699 2963 FORMAT (/' *** WAVEWATCH-III WARNING IN W3GRID :'/ &
6700  ' Ice physics used, so we will change FLAGTR.')
6701 961 FORMAT ( ' Ice concentration cut-offs :',f8.2,f6.2)
6702 #ifdef W3_MGG
6703 962 FORMAT ( ' Moving grid GSE cor. power :',f8.2)
6704 #endif
6705 #ifdef W3_SCRIP
6706 963 FORMAT( ' Grid offset for multi-grid w/SCRIP : ',e11.3)
6707 #endif
6708 1972 FORMAT ( ' Compression of track output : ',l3)
6709 #ifdef W3_SEED
6710 964 FORMAT ( ' Xseed in seeding algorithm :',f8.2)
6711 #endif
6712 965 FORMAT (/' Dynamic source term integration scheme :'/ &
6713  ' Xp (-) :',f9.3/ &
6714  ' Xr (-) :',f9.3/ &
6715  ' Xfilt (-) :',f9.3)
6716 966 FORMAT (/' Wave field partitioning :'/ &
6717  ' Levels (-) :',i5/ &
6718  ' Minimum wave height (m) :',f9.3/ &
6719  ' Wind area multiplier (-) :',f9.3/ &
6720  ' Cut-off wind sea fract. (-) :',f9.3/ &
6721  ' Combine wind seas : ',a/ &
6722  ' Number of swells in fld out :',i5)
6723 967 FORMAT (/' Miche-style limiting wave height :'/ &
6724  ' Hs,max/d factor (-) :',f9.3/ &
6725  ' Hrms,max/d factor (-) :',f9.3/ &
6726  ' Limiter activated : ',a)
6727 968 FORMAT ( ' *** FACTOR DANGEROUSLY LOW ***')
6728 1973 FORMAT (/' Calendar type : ',a)
6729  !
6730 #ifdef W3_REF1
6731 969 FORMAT (/' Shoreline reflection ',a/ &
6732  ' --------------------------------------------------')
6733 #endif
6734  !
6735 #ifdef W3_IG1
6736 970 FORMAT (/' Second order and infragravity waves ',a/ &
6737  ' --------------------------------------------------')
6738 #endif
6739  !
6740 5971 FORMAT (' Partitioning method : ',a)
6741 5972 FORMAT (' Namelist options overridden : ',a)
6742  !
6743 #ifdef W3_IC2
6744 971 FORMAT (/' Boundary layer below ice ',a/ &
6745  ' --------------------------------------------------')
6746 #endif
6747 #ifdef W3_IC3
6748 971 FORMAT (/' Visco-elastic ice layer ',a/ &
6749  ' --------------------------------------------------')
6750 #endif
6751 #ifdef W3_IC4
6752 971 FORMAT (/' Empirical wave-ice physics ',a/ &
6753  ' --------------------------------------------------')
6754 #endif
6755 #ifdef W3_IC5
6756 971 FORMAT (/' Effective medium ice model (SIC5) ',a/ &
6757  ' --------------------------------------------------')
6758 2971 FORMAT ( ' Min. Ice shear modulus G : ', e10.1/, &
6759  ' Min. Wave period T : ', f7.2/, &
6760  ' Max. Wavenumber Ratio (Ko/Kr): ', e10.1/, &
6761  ' Max. Attenu. Rate (Ki) : ', e10.1/, &
6762  ' Min. Water depth (d) : ', f5.0/, &
6763  ' Max. # of Newton Iter. : ', f5.0/, &
6764  ' Use Rand. Kick : ', f5.0/, &
6765  ' Excluded Imag. Corridor : ', f9.4/, &
6766  ' Selected ice model : ', a/)
6767 #endif
6768  !
6769 8972 FORMAT ( ' Wind input reduction factor in presence of ', &
6770  /' ice :',f6.2, &
6771  /' (0.0==> no reduction and 1.0==> no wind', &
6772  /' input with 100% ice cover)')
6773  !
6774  !
6775 4970 FORMAT (/' Spectral output on full grid ',a/ &
6776  ' --------------------------------------------------')
6777 4971 FORMAT ( ' Second order pressure at K=0:',3i4)
6778 4972 FORMAT ( ' Spectrum of Uss :',3i4)
6779 4973 FORMAT ( ' Frequency spectrum :',3i4)
6780 4974 FORMAT ( ' Partions of Uss :',2i4)
6781 4975 FORMAT ( ' Partition wavenumber #',i2,' : ',1f6.3)
6782 
6783  !
6784 4980 FORMAT (/' Coastal / iceberg reflection ',a/ &
6785  ' --------------------------------------------------')
6786 4981 FORMAT ( ' Coefficient for shorelines :',f6.4)
6787 4989 FORMAT ( ' *** CURVLINEAR GRID: REFLECTION NOT IMPLEMENTED YET ***')
6788 2977 FORMAT ( ' &SIG1 IGMETHOD =',i2,', IGADDOUTP =',i2,', IGSOURCE =',i2, &
6789  ', IGSTERMS = ',i2,', IGBCOVERWRITE =', l3,','/ &
6790  ' IGSWELLMAX =', l3,', IGMAXFREQ =',f6.4, &
6791  ', IGSOURCEATBP = ',i2,', IGKDMIN = ',f6.4,','/ &
6792  ' IGFIXEDDEPTH = ',f6.2,', IGEMPIRICAL = ',f8.6,' /')
6793  !
6794 2978 FORMAT ( ' &SIC2 IC2DISPER =',l3,', IC2TURB =',f6.2, &
6795  ', IC2ROUGH =',f10.6,','/ &
6796  ' IC2REYNOLDS = ',f10.1,', IC2SMOOTH = ',f10.1, &
6797  ', IC2VISC =',f6.3,','/ &
6798  ', IC2TURBS =',f8.2,', IC2DMAX =',f5.3,' /')
6799  !
6800 2979 FORMAT ( ' &SIC3 IC3MAXTHK =',f6.2, ', IC3MAXCNC =',f6.2,','/ &
6801  ' IC2TURB =',f8.2, &
6802  ', IC2ROUGH =',f7.3,','/ &
6803  ' IC2REYNOLDS = ',f10.1,', IC2SMOOTH = ',f10.1, &
6804  ', IC2VISC =',f10.3,','/ &
6805  ' IC2TURBS =',f8.2,', IC3CHENG =',l3, &
6806  ', USECGICE =',l3,', IC3HILIM = ',f6.2,','/ &
6807  ' IC3KILIM = ',e9.2,', IC3HICE = ',e9.2, &
6808  ', IC3VISC = ',e9.2,','/ &
6809  ' IC3DENS = ',e9.2,', IC3ELAS = ',e9.2,' /')
6810  !
6811 2981 FORMAT ( ' &SIC5 IC5MINIG = ', e9.2, ', IC5MINWT = ', f5.2, &
6812  ', IC5MAXKRATIO = ', e9.2, ','/ &
6813  ' IC5MAXKI = ', e9.2, ', IC5MINHW = ', f4.0, &
6814  ', IC5MAXITER = ', f4.0, ','/ &
6815  ' IC5RKICK = ', f2.0, ', IC5KFILTER = ', f7.4, &
6816  ', IC5VEMOD = ', f4.0, ' /')
6817  !
6818 2966 FORMAT ( ' &MISC CICE0 =',f6.3,', CICEN =',f6.3, &
6819  ', LICE = ',f8.1,', PMOVE =',f6.3,','/ &
6820  ' XSEED =',f6.3,', FLAGTR = ', i1, &
6821  ', XP =',f6.3,', XR =',f6.3,', XFILT =', f6.3 / &
6822  ' IHM =',i5,', HSPM =',f6.3,', WSM =',f6.3, &
6823  ', WSC =',f6.3,', FLC = ',a/ &
6824  ' NOSW =',i3,', FMICHE =',f6.3,', RWNDC =' , &
6825  f6.3,', WCOR1 =',f6.2,', WCOR2 =',f6.2,','/ &
6826  ' FACBERG =',f4.1,', GSHIFT = ',e11.3, &
6827  ', STDX = ' ,f7.2,', STDY =',f7.2,','/ &
6828  ' STDT =', f8.2, &
6829  ', ICEHMIN =',f5.2,', ICEHFAC =',f5.2,','/ &
6830  ' ICEHINIT =',f5.2,', ICEDISP =',l3, &
6831  ', ICEHDISP =',f5.2,','/ &
6832  ' ICESLN = ',f6.2,', ICEWIND = ',f6.2, &
6833  ', ICESNL = ',f6.2,', ICESDS = ',f5.2,','/ &
6834  ' ICEDDISP = ',f5.2,', ICEFDISP = ',f5.2, &
6835  ', CALTYPE = ',a8,' , TRCKCMPR = ', l3,','/ &
6836  ' BTBET = ', f6.2, ' /')
6837  !
6838 2976 FORMAT ( ' &OUTS P2SF =',i2,', I1P2SF =',i2,', I2P2SF =',i3,','/&
6839  ' US3D =',i2,', I1US3D =',i3,', I2US3D =',i3,','/&
6840  ' USSP =',i2,', IUSSP =',i3,','/&
6841  ' E3D =',i2,', I1E3D =',i3,', I2E3D =',i3,','/&
6842  ' TH1MF =',i2,', I1TH1M =',i3,', I2TH1M =',i3,','/&
6843  ' STH1MF=',i2,', I1STH1M=',i3,', I2STH1M=',i3,','/&
6844  ' TH2MF =',i2,', I1TH2M =',i3,', I2TH2M =',i3,','/&
6845  ' STH2MF=',i2,', I1STH2M=',i3,', I2STH2M=',i3,' /')
6846  !
6847 2986 FORMAT ( ' &REF1 REFCOAST =',f5.2,', REFFREQ =',f5.2,', REFSLOPE =',f5.3, &
6848  ', REFMAP =',f4.1, ', REFMAPD =',f4.1, ', REFSUBGRID =',f5.2,','/ &
6849  ' REFRMAX=',f5.2,', REFFREQPOW =',f5.2, &
6850  ', REFICEBERG =',f5.2,', REFCOSP_STRAIGHT =',f4.1,' /')
6851  !
6852 2987 FORMAT ( ' &FLD TAIL_ID =',i1,' TAIL_LEV =',f5.4,' TAILT1 =',f5.3,&
6853  ' TAILT2 =',f5.3,' /')
6854 #ifdef W3_RTD
6855 
6856 4991 FORMAT ( ' &ROTD PLAT =', f6.2,', PLON =', f7.2,', UNROT =',l3,' /')
6857 4992 FORMAT ( ' &ROTB BPLAT =',9(f6.1,",")/ &
6858  ' BPLON =',9(f6.1,","),' /')
6859 #endif
6860 
6861 3000 FORMAT (/' The spatial grid: '/ &
6862  ' --------------------------------------------------'/ &
6863  /' Grid type : ',a)
6864 3001 FORMAT ( ' Coordinate system : ',a)
6865 3002 FORMAT ( ' Index closure type : ',a)
6866 3003 FORMAT ( ' Dimensions : ',i6,i8)
6867 3004 FORMAT (/' Increments (deg.) :',2f10.4/ &
6868  ' Longitude range (deg.) :',2f10.4/ &
6869  ' Latitude range (deg.) :',2f10.4)
6870 3005 FORMAT ( ' Increments (km) :',2f8.2/ &
6871  ' X range (km) :',2f8.2/ &
6872  ' Y range (km) :',2f8.2)
6873 3006 FORMAT (/' X-coordinate unit :',i6/ &
6874  ' Scale factor :',f10.4/ &
6875  ' Add offset :',e12.4/ &
6876  ' Layout indicator :',i6/ &
6877  ' Format indicator :',i6)
6878 3007 FORMAT (/' Y-coordinate unit :',i6/ &
6879  ' Scale factor :',f10.4/ &
6880  ' Add offset :',e12.4/ &
6881  ' Layout indicator :',i6/ &
6882  ' Format indicator :',i6)
6883 3008 FORMAT ( ' Format : ',a)
6884 3009 FORMAT ( ' File name : ',a)
6885 #ifdef W3_SMC
6886 4001 FORMAT ( ' SMC refined levels NRLv = ',i8)
6887 4002 FORMAT ( ' SMC Equator j shift no. = ',i8)
6888 4302 FORMAT ( ' SMC I-index shift number = ',i8)
6889 4003 FORMAT ( ' SMC input boundary no. = ',i8)
6890 4004 FORMAT ( ' SMC NCel = ',6i9)
6891 4005 FORMAT ( ' IJKCel(5,NCel) read from ', a)
6892 4006 FORMAT (6i8)
6893 4007 FORMAT ( ' SMC NUFc = ',6i9)
6894 4008 FORMAT ( ' IJKUFc(7,NCel) read from ', a)
6895 4009 FORMAT (8i8)
6896 4010 FORMAT ( ' SMC NVFc = ',6i9)
6897 4011 FORMAT ( ' IJKVFc(8,NCel) read from ', a)
6898 4110 FORMAT ( ' SMC NCObsr = ',6i9)
6899 4111 FORMAT ( ' IJKObstr(1,NCel) read from ', a)
6900 4012 FORMAT (9i8)
6901 4013 FORMAT ( ' NBICelin(NBISMC) read from ', a)
6902 4014 FORMAT (2i8)
6903 4015 FORMAT ( ' ARC NARC = ',6i9)
6904 4016 FORMAT ( ' IJKCel(5,NARC) read from ', a)
6905 4017 FORMAT ( ' ARC NAUI = ',6i9)
6906 4018 FORMAT ( ' IJKUFc(7,NAUI) read from ', a)
6907 4019 FORMAT ( ' ARC NAVJ = ',6i9)
6908 4020 FORMAT ( ' IJKVFc(8,NAVJ) read from ', a)
6909 4021 FORMAT ( ' Varables by W3DIMX NCel = ',i9)
6910 4022 FORMAT ( ' Defined NLvCel ',6i9)
6911 4023 FORMAT ( ' Defined NLvUFc ',6i9)
6912 4024 FORMAT ( ' Defined NLvVFc ',6i9)
6913 4025 FORMAT ( ' Define IJKCel from -9 to ',i9)
6914 4026 FORMAT ( ' IJKCel(5,NCel) defined : ')
6915 4027 FORMAT ( ' IJKUFc(7,NUFc) defined : ')
6916 4028 FORMAT ( ' IJKVFc(8,NVFc) defined : ')
6917 4029 FORMAT ( ' Boundary cells IJKCel(:,-9:0) : ')
6918 4030 FORMAT (5i8)
6919 4031 FORMAT ( ' Define MAPSF ... 1 to ',i9)
6920 4032 FORMAT ( ' Multi-Resolution factor = ',i6)
6921 4033 FORMAT ( ' Range of MAPSF(:,1) : ',2i9)
6922 4034 FORMAT ( ' Range of MAPSF(:,2) : ',2i9)
6923 4035 FORMAT ( ' Range of MAPSF(:,3) : ',2i9)
6924 4036 FORMAT ( ' Range of MAPFS(:,:) : ',2i9)
6925 4037 FORMAT ( ' Arctic AngArc defined as ',i6)
6926 4038 FORMAT (9f8.2)
6927 4039 FORMAT ( ' Arctic ICLBAC defined as ',i6)
6928 4040 FORMAT (9i8)
6929 #endif
6930 #ifdef W3_RTD
6931 4200 FORMAT ( ' AnglDin(NX,NY) defn checks : ')
6932 4201 FORMAT ( ' JY/IX',4i8)
6933 4202 FORMAT (i12,4f8.2)
6934 4203 FORMAT ( ' Rotated pole lat/lon (deg.) : ',2f9.3)
6935 4204 FORMAT ( ' Output dirns and x-y vectors will be set to True North')
6936 #endif
6937 972 FORMAT (/' Bottom level unit :',i6/ &
6938  ' Limiting depth (m) :',f8.2/ &
6939  ' Minimum depth (m) :',f8.2/ &
6940  ' Scale factor :',f8.2/ &
6941  ' Layout indicator :',i6/ &
6942  ' Format indicator :',i6)
6943 973 FORMAT ( ' Format : ',a)
6944 974 FORMAT ( ' File name : ',a)
6945 976 FORMAT (/' Sub-grid information : ',a)
6946 977 FORMAT ( ' Obstructions unit :',i6/ &
6947  ' Scale factor :',f10.4/ &
6948  ' Layout indicator :',i6/ &
6949  ' Format indicator :',i6)
6950 978 FORMAT (/' Mask information : From file.'/ &
6951  ' Mask unit :',i6/ &
6952  ' Layout indicator :',i6/ &
6953  ' Format indicator :',i6)
6954 1977 FORMAT ( ' Shoreline slope :',i6/ &
6955  ' Scale factor :',f10.4/ &
6956  ' Layout indicator :',i6/ &
6957  ' Format indicator :',i6)
6958 1978 FORMAT ( ' Grain sizes :',i6/ &
6959  ' Scale factor :',f10.4/ &
6960  ' Layout indicator :',i6/ &
6961  ' Format indicator :',i6)
6962  !
6963 979 FORMAT ( ' Processing ',a)
6964 980 FORMAT (/' Input boundary points : '/ &
6965  ' --------------------------------------------------')
6966 1980 FORMAT (/' Excluded points : '/ &
6967  ' --------------------------------------------------')
6968 981 FORMAT ( ' *** POINT OUTSIDE GRID (SKIPPED), IX, IY =')
6969 1981 FORMAT ( ' *** POINT ALREADY EXCLUDED (SKIPPED), IX, IY =')
6970 982 FORMAT ( ' *** CANNOT CONNECT POINTS, IX, IY =')
6971 985 FORMAT ( ' No boundary points.'/)
6972 986 FORMAT ( ' Number of boundary points :',i6/)
6973 1985 FORMAT ( ' No excluded points.'/)
6974 1986 FORMAT ( ' Number of excluded points :',i6/)
6975 987 FORMAT ( ' Nr.| IX | IY | Long. | Lat. '/ &
6976  ' -----|-------|-------|---------|---------')
6977 1987 FORMAT ( ' Nr.| IX | IY | X | Y '/ &
6978  ' -----|-------|-------|-----------|-----------')
6979 988 FORMAT ( ' ',i4,2(' |',i6),2(' |',f8.2))
6980 1988 FORMAT ( ' ',i4,2(' |',i6),2(' |',f8.1,'E3'))
6981 989 FORMAT ( ' ')
6982  !
6983 990 FORMAT (/' Output boundary points : '/ &
6984  ' --------------------------------------------------')
6985 991 FORMAT ( ' File nest',i1,'.ww3 Number of points :',i6/ &
6986  ' Number of spectra :',i6)
6987 1991 FORMAT ( ' Dest. grid Polat:',f6.2,', Polon:',f8.2)
6988 992 FORMAT (/' Nr.| Long. | Lat. '/ &
6989  ' -----|---------|---------')
6990 1992 FORMAT (/' Nr.| Long. | Lat. ', &
6991  ' Nr.| Long. | Lat. '/ &
6992  ' -----|---------|---------', &
6993  ' -----|---------|---------')
6994 993 FORMAT ( ' ',i4,2(' |',f8.2))
6995 1993 FORMAT ( ' ',i4,2(' |',f8.2), &
6996  ' ',i4,2(' |',f8.2))
6997 994 FORMAT ( ' *** POINT OUTSIDE GRID (SKIPPED) : X,Y =',2f10.5)
6998 995 FORMAT ( ' *** POINT ON LAND (SKIPPED) : X,Y =',2f10.5)
6999 2992 FORMAT (/' Nr.| X | Y '/ &
7000  ' -----|-----------|-----------')
7001 3992 FORMAT (/' Nr.| X | Y ', &
7002  ' Nr.| X | Y '/ &
7003  ' -----|-----------|-----------', &
7004  ' -----|-----------|-----------')
7005 2993 FORMAT ( ' ',i4,2(' |',f8.1,'E3'))
7006 3993 FORMAT ( ' ',i4,2(' |',f8.1,'E3'), &
7007  ' ',i4,2(' |',f8.1,'E3'))
7008 2994 FORMAT ( ' *** POINT OUTSIDE GRID (SKIPPED) : X,Y =',2(f8.1,'E3'))
7009 2995 FORMAT ( ' *** POINT ON LAND (SKIPPED) : X,Y =',2(f8.1,'E3'))
7010 996 FORMAT ( ' No boundary points.'/)
7011 997 FORMAT ( ' Number of boundary points :',i6/ &
7012  ' Number of spectra :',i6/)
7013  !
7014 #ifdef W3_O2a
7015 998 FORMAT (50i2)
7016 #endif
7017 #ifdef W3_O2c
7018 1998 FORMAT (50i2)
7019 #endif
7020  !
7021 999 FORMAT (/' Writing model definition file ...'/)
7022  !
7023 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7024  ' ERROR IN OPENING INPUT FILE'/ &
7025  ' IOSTAT =',i5/)
7026  !
7027 1001 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7028  ' PREMATURE END OF INPUT FILE'/)
7029  !
7030 1002 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7031  ' ERROR IN READING FROM INPUT FILE'/ &
7032  ' IOSTAT =',i5/)
7033  !
7034 1003 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7035  ' INVALID CALENDAR TYPE: SELECT ONE OF:', &
7036  ' standard, 360_day, or 365_day '/)
7037  !
7038 1004 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7039  ' CANNOT READ UNFORMATTED (IDFM = 3) FROM UNIT', &
7040  i4,' (ww3_grid.inp)'/)
7041  !
7042 1005 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
7043  ' BOTTOM AND OBSTRUCTION DATA FROM SAME FILE '/ &
7044  ' BUT WITH INCOMPATIBLE FORMATS (',i1,',',i1,')'/)
7045  !
7046 1006 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7047  ' TOO MANY NESTING OUTPUT FILES '/)
7048  !
7049 1007 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7050  ' ILLEGAL GRID TYPE:',a4)
7051  !
7052 1008 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7053  ' A CARTESIAN WITH CLOSURE IS NOT ALLOWED')
7054  !
7055 1009 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7056  ' A RECTILINEAR TRIPOLE GRID IS NOT ALLOWED')
7057  !
7058 1010 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'// &
7059  ' NO PROPAGATION + NO SOURCE TERMS = NO WAVE MODEL'// &
7060  ' ( USE DRY RUN FLAG TO TEMPORARILY SWITCH OFF ', &
7061  'CALCULATIONS )'/)
7062  !
7063 1011 FORMAT (/' *** WAVEWATCH-III WARNING IN W3GRID :'/ &
7064  ' LEFT-HANDED GRID -- POSSIBLE CAUSE IS WRONG '/ &
7065  ' IDLA:',i4,' . THIS MAY PRODUCE ERRORS '/ &
7066  ' (COMMENT THIS EXTCDE AT YOUR OWN RISK).')
7067  !
7068 1012 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7069  ' ILLEGAL GRID CLOSURE TYPE:',a4)
7070  !
7071 1013 FORMAT (/' *** WAVEWATCH-III WARNING IN W3GRID :'/ &
7072  ' THE GLOBAL (LOGICAL) INPUT FLAG IS DEPRECATED'/ &
7073  ' AND REPLACED WITH A STRING INDICATING THE TYPE'/ &
7074  ' OF GRID INDEX CLOSURE (NONE, SMPL or TRPL).'/ &
7075  ' *** PLEASE UPDATE YOUR GRID INPUT FILE ACCORDINGLY ***'/)
7076  !
7077 #ifdef W3_SMC
7078 1014 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7079  ' SMC CELL LONGITUDE RANGE OUTSIDE BASE GRID RANGE:'/&
7080  ' ISEA =', i6, '; IX =', i4, ':', i4,'; NX =', i4/)
7081 1015 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7082  ' SMC CELL LATITUDE RANGE OUTSIDE BASE GRID RANGE: '/&
7083  ' ISEA =', i6, '; IY =', i4, ':', i4,'; NY =', i4/)
7084 #endif
7085  !
7086 1020 FORMAT (/' *** WAVEWATCH-III ERROR IN W3GRID :'/ &
7087  ' SOURCE TERMS REQUESTED BUT NOT SELECTED'/)
7088 1021 FORMAT (/' *** WAVEWATCH III WARNING IN W3GRID :'/ &
7089  ' SOURCE TERMS SELECTED BUT NOT REQUESTED'/)
7090 1022 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7091  ' ILLEGAL NUMBER OF !/LNn OR SEED SWITCHES :',i3)
7092 1023 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7093  ' ILLEGAL NUMBER OF !/STn SWITCHES :',i3)
7094 1024 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7095  ' ILLEGAL NUMBER OF !/NLn SWITCHES :',i3)
7096 1025 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7097  ' ILLEGAL NUMBER OF !/BTn SWITCHES :',i3)
7098 1026 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7099  ' ILLEGAL NUMBER OF !/DBn SWITCHES :',i3)
7100 1027 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7101  ' ILLEGAL NUMBER OF !/TRn SWITCHES :',i3)
7102 1028 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7103  ' ILLEGAL NUMBER OF !/BSn SWITCHES :',i3)
7104  !
7105 1030 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7106  ' PROPAGATION REQUESTED BUT NO SCHEME SELECTED '/)
7107 1031 FORMAT (/' *** WAVEWATCH III WARNING IN W3GRID :'/ &
7108  ' NO PROPAGATION REQUESTED BUT SCHEME SELECTED '/)
7109 1032 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7110  ' NO PROPAGATION SCHEME SELECTED ( use !/PR0 ) '/)
7111 1033 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7112  ' MULTIPLE PROPAGATION SCHEMES SELECTED :',i3/ &
7113  ' CHECK !/PRn SWITCHES'/)
7114 1034 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7115  ' ILLEGAL NUMBER OF !/ICn SWITCHES :',i3)
7116 1035 FORMAT (/' *** WAVEWATCH III WARNING IN W3GRID :'/ &
7117  ' ONLY FIRST PROPAGATION SCHEME WILL BE USED: ')
7118 1036 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7119  ' ILLEGAL NUMBER OF !/ISn SWITCHES :',i3)
7120 #ifdef W3_RTD
7121 1052 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7122  ' WITH NAMELIST VALUE PLAT == 90, PLON MUST BE -180'/ &
7123  ' AND UNROT MUST BE .FALSE.' )
7124 1053 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID :'/ &
7125  ' WITH NAMELIST VALUE BPLAT == 90, BPLON MUST BE -180')
7126 #endif
7127  !
7128 1040 FORMAT ( ' Space-time extremes DX :',f10.2)
7129 1041 FORMAT ( ' Space-time extremes DX :',f10.2)
7130 1042 FORMAT ( ' Space-time extremes DX-Y set to default 1000 m')
7131 1043 FORMAT ( ' Space-time extremes Dt :',f8.2)
7132 1044 FORMAT ( ' Space-time extremes Dt set to default 1200 s')
7133  !
7134 1100 FORMAT (/' Status map, printed in',i6,' part(s) '/ &
7135  ' -----------------------------------'/)
7136 1101 FORMAT (2x,180i2)
7137 1102 FORMAT ( ' Legend : '/ &
7138  ' -----------------------------'/ &
7139  ' 0 : Land point '/ &
7140  ' 1 : Sea point '/ &
7141  ' 2 : Active boundary point '/ &
7142  ' 3 : Excluded point '/)
7143 1103 FORMAT (/' Obstruction map ',a1,', printed in',i6,' part(s) '/ &
7144  ' ---------------------------------------------'/)
7145 1104 FORMAT ( ' Legend : '/ &
7146  ' --------------------------------'/ &
7147  ' fraction of obstruction * 10 '/)
7148 
7149 1105 FORMAT (/' Shoreline slope, printed in',i6,' part(s) '/ &
7150  ' ---------------------------------------------'/)
7151 1106 FORMAT ( ' Legend : '/ &
7152  ' --------------------------------'/ &
7153  ' Slope * 100'/)
7154 
7155 
7156 1150 FORMAT (/' Reading unstructured grid definition files ...'/)
7157  !
7158 9997 FORMAT (/' Summary grid statistics : '/ &
7159  ' --------------------------------------------------'/ &
7160  ' Number of longitudes :',i10/ &
7161  ' Number of latitudes :',i10/ &
7162  ' Number of grid points :',i10/ &
7163  ' Number of sea points :',i10,' (',f4.1,'%)'/&
7164  ' Number of input b. points :',i10/ &
7165  ' Number of land points :',i10/ &
7166  ' Number of excluded points :',i10/)
7167 9998 FORMAT (/' Summary grid statistics : '/ &
7168  ' --------------------------------------------------'/ &
7169  ' Number of longitudes :',i10/ &
7170  ' Number of latitudes :',i10/ &
7171  ' Number of grid points :',i10/ &
7172  ' Number of sea points :',i10,' (100%)'/ &
7173  ' Number of input b. points :',i10/ &
7174  ' Number of land points :',i10/ &
7175  ' Number of excluded points :',i10/)
7176 9999 FORMAT (/' End of program '/ &
7177  ' ========================================'/ &
7178  ' WAVEWATCH III Grid preprocessor '/)
7179  !
7180 #ifdef W3_T
7181 9090 FORMAT ( ' TEST W3GRID : OUTPUT BOUND. POINT DATA LINE SEG.')
7182 9091 FORMAT ( ' ',2f8.2,4(2i4,f7.2))
7183 9092 FORMAT ( ' ',f7.2,2x,4f7.2)
7184 9093 FORMAT ( ' ',4i7/ &
7185  ' ',4i7)
7186 #endif
7187  !
7188 #ifdef W3_T0
7189 9095 FORMAT ( ' TEST W3GRID : OUTPUT BOUND. POINT SPEC DATA ')
7190 9096 FORMAT ( ' ',i3,2i8)
7191 #endif
7192 
7193  END SUBROUTINE w3grid
7194  !/
7195  !/ Internal function READNL ------------------------------------------ /
7196  !/
7197  !/ ------------------------------------------------------------------- /
7198  SUBROUTINE readnl ( NDS, NAME, STATUS )
7199  !/
7200  !/ +-----------------------------------+
7201  !/ | WAVEWATCH III NOAA/NCEP |
7202  !/ | H. L. Tolman |
7203  !/ | FORTRAN 90 |
7204  !/ | Last update : 01-Jun-2013 |
7205  !/ +-----------------------------------+
7206  !/
7207  ! 1. Purpose :
7208  !
7209  ! Read namelist info from file if namelist is found in file.
7210  !
7211  ! 2. Method :
7212  !
7213  ! Look for namelist with name NAME in unit NDS and read if found.
7214  !
7215  ! 3. Parameters :
7216  !
7217  ! Parameter list
7218  ! ----------------------------------------------------------------
7219  ! NDS Int. I Data set number used for search.
7220  ! NAME C*4 I Name of namelist.
7221  ! STATUS C*20 O Status at end of routine,
7222  ! '(default values) ' if no namelist found.
7223  ! '(user def. values)' if namelist read.
7224  ! ----------------------------------------------------------------
7225  !
7226  ! 4. Subroutines used :
7227  !
7228  ! Name Type Module Description
7229  ! ----------------------------------------------------------------
7230  ! EXTCDE Subr. W3SERVMD Abort program as graceful as possible.
7231  ! ----------------------------------------------------------------
7232  !
7233  ! 5. Called by :
7234  !
7235  ! Program in which it is contained.
7236  !
7237  ! 6. Error messages :
7238  !
7239  ! 7. Remarks :
7240  !
7241  ! 8. Structure :
7242  !
7243  ! 9. Switches :
7244  !
7245  ! 10. Source code :
7246  !
7247  !/ ------------------------------------------------------------------- /
7248  !/ Parameter list
7249  !/
7250  INTEGER, INTENT(IN) :: NDS
7251  CHARACTER, INTENT(IN) :: NAME*4
7252  CHARACTER, INTENT(OUT) :: STATUS*20
7253  !/
7254  !/ ------------------------------------------------------------------- /
7255  !/ Local parameters
7256  !/
7257  INTEGER :: IERR, I, J
7258  CHARACTER :: LINE*80
7259  !/
7260  !/ ------------------------------------------------------------------- /
7261  !/
7262 #ifdef W3_S
7263  CALL strace (ient, 'READNL')
7264 #endif
7265  !
7266  rewind(nds)
7267  status = '(default values) : '
7268  !
7269  DO
7270  READ (nds,'(A)',END=800,ERR=800,IOSTAT=IERR) line
7271  DO i=1, 70
7272  IF ( line(i:i) .NE. ' ' ) THEN
7273  IF ( line(i:i) .EQ. '&' ) THEN
7274  IF ( line(i+1:i+4) .EQ. name ) THEN
7275  backspace(nds)
7276  SELECT CASE(name)
7277 #ifdef W3_FLD1
7278  CASE('FLD1')
7279  READ (nds,nml=fld1,END=801,ERR=802,IOSTAT=J)
7280 #endif
7281 #ifdef W3_FLD2
7282  CASE('FLD2')
7283  READ (nds,nml=fld2,END=801,ERR=802,IOSTAT=J)
7284 #endif
7285 #ifdef W3_FLX3
7286  CASE('FLX3')
7287  READ (nds,nml=flx3,END=801,ERR=802,IOSTAT=J)
7288 #endif
7289 #ifdef W3_FLX4
7290  CASE('FLX4')
7291  READ (nds,nml=flx4,END=801,ERR=802,IOSTAT=J)
7292 #endif
7293 #ifdef W3_LN1
7294  CASE('SLN1')
7295  READ (nds,nml=sln1,END=801,ERR=802,IOSTAT=J)
7296 #endif
7297 #ifdef W3_ST1
7298  CASE('SIN1')
7299  READ (nds,nml=sin1,END=801,ERR=802,IOSTAT=J)
7300 #endif
7301 #ifdef W3_ST2
7302  CASE('SIN2')
7303  READ (nds,nml=sin2,END=801,ERR=802,IOSTAT=J)
7304 #endif
7305 #ifdef W3_ST3
7306  CASE('SIN3')
7307  READ (nds,nml=sin3,END=801,ERR=802,IOSTAT=J)
7308 #endif
7309 #ifdef W3_ST4
7310  CASE('SIN4')
7311  READ (nds,nml=sin4,END=801,ERR=802,IOSTAT=J)
7312 #endif
7313 #ifdef W3_ST6
7314  CASE('SIN6')
7315  READ (nds,nml=sin6,END=801,ERR=802,IOSTAT=J)
7316 #endif
7317 #ifdef W3_NL1
7318  CASE('SNL1')
7319  READ (nds,nml=snl1,END=801,ERR=802,IOSTAT=J)
7320 #endif
7321 #ifdef W3_NL2
7322  CASE('SNL2')
7323  READ (nds,nml=snl2,END=801,ERR=802,IOSTAT=J)
7324  CASE('ANL2')
7325  IF ( ndepth .GT. 100 ) GOTO 804
7326  depths(1:ndepth) = dpthnl
7327  READ (nds,nml=anl2,END=801,ERR=802,IOSTAT=J)
7328  dpthnl = depths(1:ndepth)
7329 #endif
7330 #ifdef W3_NL3
7331  CASE('SNL3')
7332  READ (nds,nml=snl3,END=801,ERR=802,IOSTAT=J)
7333  CASE('ANL3')
7334  IF ( nqdef .GT. 100 ) GOTO 804
7335  READ (nds,nml=anl3,END=801,ERR=802,IOSTAT=J)
7336 #endif
7337 #ifdef W3_NL4
7338  CASE('SNL4')
7339  READ (nds,nml=snl4,END=801,ERR=802,IOSTAT=J)
7340 #endif
7341 #ifdef W3_NL5
7342  CASE('SNL5')
7343  READ (nds,nml=snl5,END=801,ERR=802,IOSTAT=J)
7344 #endif
7345 #ifdef W3_NLS
7346  CASE('SNLS')
7347  READ (nds,nml=snls,END=801,ERR=802,IOSTAT=J)
7348 #endif
7349 #ifdef W3_ST1
7350  CASE('SDS1')
7351  READ (nds,nml=sds1,END=801,ERR=802,IOSTAT=J)
7352 #endif
7353 #ifdef W3_ST2
7354  CASE('SDS2')
7355  READ (nds,nml=sds2,END=801,ERR=802,IOSTAT=J)
7356 #endif
7357 #ifdef W3_ST3
7358  CASE('SDS3')
7359  READ (nds,nml=sds3,END=801,ERR=802,IOSTAT=J)
7360 #endif
7361 #ifdef W3_ST4
7362  CASE('SDS4')
7363  READ (nds,nml=sds4,END=801,ERR=802,IOSTAT=J)
7364 #endif
7365 #ifdef W3_ST6
7366  CASE('SDS6')
7367  READ (nds,nml=sds6,END=801,ERR=802,IOSTAT=J)
7368  CASE('SWL6')
7369  READ (nds,nml=swl6,END=801,ERR=802,IOSTAT=J)
7370 #endif
7371 #ifdef W3_BT1
7372  CASE('SBT1')
7373  READ (nds,nml=sbt1,END=801,ERR=802,IOSTAT=J)
7374 #endif
7375 #ifdef W3_BT4
7376  CASE('SBT4')
7377  READ (nds,nml=sbt4,END=801,ERR=802,IOSTAT=J)
7378 #endif
7379 #ifdef W3_IS1
7380  CASE('SIS1')
7381  READ (nds,nml=sis1,END=801,ERR=802,IOSTAT=J)
7382 #endif
7383 #ifdef W3_IS2
7384  CASE('SIS2')
7385  READ (nds,nml=sis2,END=801,ERR=802,IOSTAT=J)
7386 #endif
7387 #ifdef W3_DB1
7388  CASE('SDB1')
7389  READ (nds,nml=sdb1,END=801,ERR=802,IOSTAT=J)
7390 #endif
7391 #ifdef W3_UOST
7392  CASE('UOST')
7393  READ (nds,nml=uost,END=801,ERR=802,IOSTAT=J)
7394 #endif
7395 #ifdef W3_PR1
7396  CASE('PRO1')
7397  READ (nds,nml=pro1,END=801,ERR=802,IOSTAT=J)
7398 #endif
7399 #ifdef W3_PR2
7400  CASE('PRO2')
7401  READ (nds,nml=pro2,END=801,ERR=802,IOSTAT=J)
7402 #endif
7403 #ifdef W3_SMC
7404  CASE('PSMC')
7405  READ (nds,nml=psmc,END=801,ERR=802,IOSTAT=J)
7406 #endif
7407 #ifdef W3_PR3
7408  CASE('PRO3')
7409  READ (nds,nml=pro3,END=801,ERR=802,IOSTAT=J)
7410 #endif
7411 #ifdef W3_RTD
7412  CASE('ROTD')
7413  READ (nds,nml=rotd,END=801,ERR=802,IOSTAT=J)
7414  CASE('ROTB')
7415  READ (nds,nml=rotb,END=801,ERR=802,IOSTAT=J)
7416 #endif
7417 #ifdef W3_REF1
7418  CASE('REF1')
7419  READ (nds,nml=ref1,END=801,ERR=802,IOSTAT=J)
7420 #endif
7421 #ifdef W3_IG1
7422  CASE('SIG1')
7423  READ (nds,nml=sig1,END=801,ERR=802,IOSTAT=J)
7424 #endif
7425 #ifdef W3_IC2
7426  CASE('SIC2')
7427  READ (nds,nml=sic2,END=801,ERR=802,IOSTAT=J)
7428 #endif
7429 #ifdef W3_IC3
7430  CASE('SIC3')
7431  READ (nds,nml=sic3,END=801,ERR=802,IOSTAT=J)
7432 #endif
7433 #ifdef W3_IC4
7434  CASE('SIC4 ')
7435  READ (nds,nml=sic4,END=801,ERR=802,IOSTAT=J)
7436 #endif
7437 #ifdef W3_IC5
7438  CASE('SIC5 ')
7439  READ (nds,nml=sic5,END=801,ERR=802,IOSTAT=J)
7440 #endif
7441  CASE('UNST')
7442  READ (nds,nml=unst,END=801,ERR=802,IOSTAT=J)
7443  CASE('OUTS')
7444  READ (nds,nml=outs,END=801,ERR=802,IOSTAT=J)
7445  CASE('MISC')
7446  READ (nds,nml=misc,END=801,ERR=802,IOSTAT=J)
7447  CASE DEFAULT
7448  GOTO 803
7449  END SELECT
7450  status = '(user def. values) :'
7451  RETURN
7452  END IF
7453  ELSE
7454  EXIT
7455  END IF
7456  ENDIF
7457  END DO
7458  END DO
7459  !
7460 800 CONTINUE
7461  RETURN
7462  !
7463 801 CONTINUE
7464  WRITE (ndse,1001) name
7465  CALL extcde(1)
7466  RETURN
7467  !
7468 802 CONTINUE
7469  WRITE (ndse,1002) name, j
7470  CALL extcde(2)
7471  RETURN
7472  !
7473 803 CONTINUE
7474  WRITE (ndse,1003) name
7475  CALL extcde(3)
7476  RETURN
7477  !
7478 #ifdef W3_NL2
7479 804 CONTINUE
7480  WRITE (ndse,1004) ndepth
7481  CALL extcde(4)
7482  RETURN
7483 #endif
7484  !
7485 #ifdef W3_NL3
7486 804 CONTINUE
7487  WRITE (ndse,1004) nqdef
7488  CALL extcde(4)
7489  RETURN
7490 #endif
7491  !
7492  ! Formats
7493  !
7494 1001 FORMAT (/' *** WAVEWATCH III ERROR IN READNL : '/ &
7495  ' PREMATURE END OF FILE IN READING ',a/)
7496 1002 FORMAT (/' *** WAVEWATCH III ERROR IN READNL : '/ &
7497  ' ERROR IN READING ',a,' IOSTAT =',i8/)
7498 1003 FORMAT (/' *** WAVEWATCH III ERROR IN READNL : '/ &
7499  ' NAMELIST NAME ',a,' NOT RECOGNIZED'/)
7500 #ifdef W3_NL2
7501 1004 FORMAT (/' *** WAVEWATCH III ERROR IN READNL : '/ &
7502  .LE.' TEMP DEPTH ARRAY TOO SMALL, ',i8/)
7503 #endif
7504 #ifdef W3_NL3
7505 1004 FORMAT (/' *** WAVEWATCH-III ERROR IN READNL : '/ &
7506  .LE.' TEMP QPARMS ARRAY TOO SMALL, ',i8/)
7507 #endif
7508  !/
7509  !/ End of READNL ----------------------------------------------------- /
7510  !/
7511  END SUBROUTINE readnl
7512  !/
7513  !/ End of W3GRID ----------------------------------------------------- /
7514  !/
7515 END MODULE w3gridmd
w3gridmd::flinds
logical flinds
Definition: w3gridmd.F90:713
w3gridmd::refmap
real refmap
Definition: w3gridmd.F90:739
w3gridmd::flagtr
integer flagtr
Definition: w3gridmd.F90:803
w3odatmd::nbo
integer, dimension(:), pointer nbo
Definition: w3odatmd.F90:531
w3gridmd::ugobcauto
logical ugobcauto
Definition: w3gridmd.F90:921
w3gridmd::ic5maxkratio
real ic5maxkratio
Definition: w3gridmd.F90:775
w3gridmd::ic5maxki
real ic5maxki
Definition: w3gridmd.F90:775
w3gridmd::is2dupdate
logical is2dupdate
Definition: w3gridmd.F90:734
w3gdatmd::nic42
integer, parameter nic42
Definition: w3gdatmd.F90:622
w3gridmd::status
character status
Definition: w3gridmd.F90:782
w3gridmd::sdsl
real sdsl
Definition: w3gridmd.F90:849
w3gridmd::xlonac
real, dimension(:), allocatable xlonac
Definition: w3gridmd.F90:690
w3gridmd::offset
real(scrip_r8) offset
Definition: w3gridmd.F90:797
w3gridmd::stdlat
real, dimension(:,:), allocatable stdlat
Definition: w3gridmd.F90:694
w3gridmd::cneg
real cneg
Definition: w3gridmd.F90:832
scrip_grids::grid1_corners
integer(scrip_i4), save grid1_corners
Definition: scrip_grids.f:68
w3gridmd::jgs_diff_thr
real *8 jgs_diff_thr
Definition: w3gridmd.F90:939
w3gridmd::wcor1
real wcor1
Definition: w3gridmd.F90:630
w3gridmd::dxo
real dxo
Definition: w3gridmd.F90:630
w3odatmd::flbpo
logical, pointer flbpo
Definition: w3odatmd.F90:546
w3gridmd::rdtot
real rdtot
Definition: w3gridmd.F90:630
w3gridmd::icehdisp
real icehdisp
Definition: w3gridmd.F90:804
scrip_grids::grid1_mask
logical(scrip_logical), dimension(:), allocatable, target, save grid1_mask
Definition: scrip_grids.f:93
w3gridmd::nbicelin
integer, dimension(:), allocatable nbicelin
Definition: w3gridmd.F90:686
w3gridmd::nris
integer nris
Definition: w3gridmd.F90:582
w3servmd::nextln
subroutine nextln(CHCKC, NDSI, NDSE)
Definition: w3servmd.F90:222
w3gridmd::flgnml
logical flgnml
Definition: w3gridmd.F90:713
w3gridmd::ugobcfile
character ugobcfile
Definition: w3gridmd.F90:944
w3gridmd::ip0
integer ip0
Definition: w3gridmd.F90:599
w3gridmd::jgs_limiter_func
integer jgs_limiter_func
Definition: w3gridmd.F90:917
w3gridmd::xfilt
real xfilt
Definition: w3gridmd.F90:804
w3gridmd::reffreq
real reffreq
Definition: w3gridmd.F90:739
w3gridmd::x
real x
Definition: w3gridmd.F90:630
w3gridmd::isp
integer isp
Definition: w3gridmd.F90:582
w3gridmd::swellf3
real swellf3
Definition: w3gridmd.F90:849
w3gridmd::yo0
real yo0
Definition: w3gridmd.F90:630
w3gridmd::swellf
real swellf
Definition: w3gridmd.F90:832
w3gridmd::flnmlo
logical flnmlo
Definition: w3gridmd.F90:718
w3gridmd::ix2
integer ix2
Definition: w3gridmd.F90:582
w3gridmd::imap
integer imap
Definition: w3gridmd.F90:613
w3gridmd::grid_center_lon_varid
integer grid_center_lon_varid
Definition: w3gridmd.F90:793
w3gridmd::sdsbr
real sdsbr
Definition: w3gridmd.F90:849
w3gridmd::icehmin
real icehmin
Definition: w3gridmd.F90:804
w3gridmd::is2conc
real is2conc
Definition: w3gridmd.F90:728
w3gridmd::plon
real plon
Definition: w3gridmd.F90:949
w3gridmd::rth0
real rth0
Definition: w3gridmd.F90:630
w3gridmd::gqamp3
real gqamp3
Definition: w3gridmd.F90:879
w3gridmd::expfsn
logical expfsn
Definition: w3gridmd.F90:923
w3gridmd::idfm
integer idfm
Definition: w3gridmd.F90:582
w3gridmd::snlcs1
real snlcs1
Definition: w3gridmd.F90:876
w3gridmd::sdscos
real sdscos
Definition: w3gridmd.F90:849
w3gridmd::is2damp
real is2damp
Definition: w3gridmd.F90:728
w3gridmd::grid_size_dimid
integer grid_size_dimid
Definition: w3gridmd.F90:792
w3gridmd::ixn
integer ixn
Definition: w3gridmd.F90:582
w3gridmd::cfltm
real cfltm
Definition: w3gridmd.F90:804
w3triamd
Reads triangle and unstructured grid information.
Definition: w3triamd.F90:21
w3gridmd::nthi
integer nthi
Definition: w3gridmd.F90:582
w3gridmd::refd2
real, dimension(:,:), allocatable refd2
Definition: w3gridmd.F90:704
w3gridmd::fldb
logical fldb
Definition: w3gridmd.F90:713
w3gridmd::icesds
real icesds
Definition: w3gridmd.F90:804
w3gridmd::phimin
real phimin
Definition: w3gridmd.F90:660
w3gridmd::fname
character fname
Definition: w3gridmd.F90:782
w3gridmd::gqmthrsat
real gqmthrsat
Definition: w3gridmd.F90:879
w3gridmd::i1us3d
integer i1us3d
Definition: w3gridmd.F90:643
w3gridmd::ic5minig
real ic5minig
Definition: w3gridmd.F90:775
w3gridmd::flstb2
logical flstb2
Definition: w3gridmd.F90:719
w3gridmd::first
logical first
Definition: w3gridmd.F90:713
w3gridmd::nl5ipl
integer nl5ipl
Definition: w3gridmd.F90:894
w3gridmd::xo0
real xo0
Definition: w3gridmd.F90:630
w3gridmd::jgs_terminate_maxiter
logical jgs_terminate_maxiter
Definition: w3gridmd.F90:913
w3gridmd::gqmnq_om2
integer gqmnq_om2
Definition: w3gridmd.F90:878
w3gridmd::nba
integer nba
Definition: w3gridmd.F90:582
w3gridmd::ip
integer ip
Definition: w3gridmd.F90:582
w3gridmd::cdis
real cdis
Definition: w3gridmd.F90:657
w3gridmd::ndstr
integer ndstr
Definition: w3gridmd.F90:582
w3gridmd::ix0
integer ix0
Definition: w3gridmd.F90:582
w3gridmd::spmss
real spmss
Definition: w3gridmd.F90:849
w3gridmd::igkdmin
real igkdmin
Definition: w3gridmd.F90:749
w3gridmd::refsubgrid
real refsubgrid
Definition: w3gridmd.F90:739
w3nmlgridmd::nml_outbnd_line_t
Definition: w3nmlgridmd.F90:230
w3gridmd::nml_sed
type(nml_sed_t) nml_sed
Definition: w3gridmd.F90:572
w3gridmd::gqmnt1
integer gqmnt1
Definition: w3gridmd.F90:878
w3gridmd::flst6
logical flst6
Definition: w3gridmd.F90:721
w3gridmd::sdscump
real sdscump
Definition: w3gridmd.F90:849
w3gridmd::swellf4
real swellf4
Definition: w3gridmd.F90:849
w3gridmd::nml_inbnd_point
type(nml_inbnd_point_t), dimension(:), allocatable nml_inbnd_point
Definition: w3gridmd.F90:574
w3gridmd::fc1
real fc1
Definition: w3gridmd.F90:672
w3gridmd::stdt
real stdt
Definition: w3gridmd.F90:804
w3gridmd::yesxno
character(len=6), dimension(2) yesxno
Definition: w3gridmd.F90:785
w3gridmd::tmpmap
integer, dimension(:,:), allocatable tmpmap
Definition: w3gridmd.F90:625
w3gridmd::pmove
real pmove
Definition: w3gridmd.F90:804
w3gridmd::nml_outbnd_count
type(nml_outbnd_count_t) nml_outbnd_count
Definition: w3gridmd.F90:578
w3gridmd::ncid
integer ncid
Definition: w3gridmd.F90:791
w3gridmd::cflsm
real cflsm
Definition: w3gridmd.F90:905
w3gridmd::refs
real, dimension(:,:), allocatable refs
Definition: w3gridmd.F90:704
w3gridmd::bjflag
logical bjflag
Definition: w3gridmd.F90:898
w3gridmd::sdscum
real sdscum
Definition: w3gridmd.F90:849
w3gridmd::z0max
real z0max
Definition: w3gridmd.F90:838
w3gridmd::dtims
real dtims
Definition: w3gridmd.F90:905
w3gridmd::bdylat
real, dimension(:), allocatable bdylat
Definition: w3gridmd.F90:696
w3gridmd::i1sth1m
integer i1sth1m
Definition: w3gridmd.F90:643
w3gridmd::i1th2m
integer i1th2m
Definition: w3gridmd.F90:643
w3gridmd::i
integer i
Definition: w3gridmd.F90:582
w3gridmd::reficeberg
real reficeberg
Definition: w3gridmd.F90:739
w3gridmd::nl5oml
real nl5oml
Definition: w3gridmd.F90:893
w3gridmd::jgs_terminate_difference
logical jgs_terminate_difference
Definition: w3gridmd.F90:914
w3gdatmd::sdsc1
real, pointer sdsc1
Definition: w3gdatmd.F90:1301
w3gridmd::wnmeanptail
real wnmeanptail
Definition: w3gridmd.F90:838
w3gridmd::iseai
integer, dimension(4) iseai
Definition: w3gridmd.F90:582
w3gridmd::line
character line
Definition: w3gridmd.F90:782
w3gridmd::ith
integer ith
Definition: w3gridmd.F90:582
w3gridmd::ucap
real ucap
Definition: w3gridmd.F90:849
w3gridmd::ussp
integer ussp
Definition: w3gridmd.F90:643
w3nmlgridmd::nml_sed_t
Definition: w3nmlgridmd.F90:185
w3gridmd::nml_excl_body
type(nml_excl_body_t), dimension(:), allocatable nml_excl_body
Definition: w3gridmd.F90:577
w3gridmd::rfhf
real rfhf
Definition: w3gridmd.F90:654
w3gridmd::ifile
integer ifile
Definition: w3gridmd.F90:619
w3gridmd::nrprop
integer nrprop
Definition: w3gridmd.F90:582
w3gridmd::ic3elas
real ic3elas
Definition: w3gridmd.F90:760
w3gridmd::sdset
logical sdset
Definition: w3gridmd.F90:872
w3gridmd::latmin
real latmin
Definition: w3gridmd.F90:678
w3gridmd::idepth
integer idepth
Definition: w3gridmd.F90:596
w3gridmd::readnl
subroutine readnl(NDS, NAME, STATUS)
Definition: w3gridmd.F90:7199
w3nmlgridmd::nml_excl_point_t
Definition: w3nmlgridmd.F90:213
w3gridmd::sdsfacmtf
real sdsfacmtf
Definition: w3gridmd.F90:849
w3gridmd::sed_dstar
real sed_dstar
Definition: w3gridmd.F90:708
w3odatmd::ipbpo
integer, dimension(:,:), pointer ipbpo
Definition: w3odatmd.F90:535
w3gridmd::sdsp2
integer sdsp2
Definition: w3gridmd.F90:871
w3gridmd::chamin
real chamin
Definition: w3gridmd.F90:849
w3gridmd::iy3
integer iy3
Definition: w3gridmd.F90:616
w3gridmd::refmapd
real refmapd
Definition: w3gridmd.F90:739
w3gridmd::bpolon
real bpolon
Definition: w3gridmd.F90:699
w3gridmd::nml_grid
type(nml_grid_t) nml_grid
Definition: w3gridmd.F90:563
w3gridmd::yo
real yo
Definition: w3gridmd.F90:630
w3gridmd::dphid
real dphid
Definition: w3gridmd.F90:660
w3gridmd::conv_dx
real(scrip_r8) conv_dx
Definition: w3gridmd.F90:797
w3gridmd::ic4method
integer ic4method
Definition: w3gridmd.F90:769
w3gridmd::ic2dmax
real ic2dmax
Definition: w3gridmd.F90:755
w3gridmd::nml_excl_point
type(nml_excl_point_t), dimension(:), allocatable nml_excl_point
Definition: w3gridmd.F90:576
w3gridmd::impsource
logical impsource
Definition: w3gridmd.F90:931
w3gridmd::gqmnf1
integer gqmnf1
Definition: w3gridmd.F90:878
w3nmlgridmd::nml_timesteps_t
Definition: w3nmlgridmd.F90:79
w3gridmd::icewind
real icewind
Definition: w3gridmd.F90:804
w3gridmd::fxfm3
real fxfm3
Definition: w3gridmd.F90:838
w3gridmd::bplon
real, dimension(9) bplon
Definition: w3gridmd.F90:952
w3gridmd::yj0r
real yj0r
Definition: w3gridmd.F90:905
w3gridmd::jgs_block_gauss_seidel
logical jgs_block_gauss_seidel
Definition: w3gridmd.F90:918
w3gridmd::viscstress
real viscstress
Definition: w3gridmd.F90:849
w3gridmd::taillev
real taillev
Definition: w3gridmd.F90:818
w3gridmd::whitecapdur
real whitecapdur
Definition: w3gridmd.F90:849
w3gridmd::grid_corner_lon_varid
integer grid_corner_lon_varid
Definition: w3gridmd.F90:794
w3gridmd::obsx
real, dimension(:,:), allocatable obsx
Definition: w3gridmd.F90:703
w3gridmd::xgrdin
real, dimension(:,:), allocatable xgrdin
Definition: w3gridmd.F90:702
w3gridmd::sinws
real sinws
Definition: w3gridmd.F90:869
w3gridmd::i2p2sf
integer i2p2sf
Definition: w3gridmd.F90:641
w3gridmd::iyo
integer iyo
Definition: w3gridmd.F90:582
w3gridmd::nl5pmx
integer nl5pmx
Definition: w3gridmd.F90:894
w3gridmd::iph
integer iph
Definition: w3gridmd.F90:599
w3nmlgridmd::nml_outbnd_count_t
Definition: w3nmlgridmd.F90:226
w3gridmd::zbin
real, dimension(:,:), allocatable zbin
Definition: w3gridmd.F90:703
w3gridmd::nml_smc
type(nml_smc_t) nml_smc
Definition: w3gridmd.F90:567
w3gridmd::wsc
real wsc
Definition: w3gridmd.F90:804
w3gsrumd
Definition: w3gsrumd.F90:17
w3gridmd::sigmaucap
real sigmaucap
Definition: w3gridmd.F90:849
w3gridmd::pmname
character pmname
Definition: w3gridmd.F90:815
w3gridmd::nml_slope
type(nml_slope_t) nml_slope
Definition: w3gridmd.F90:571
w3gridmd::cdmax
real cdmax
Definition: w3gridmd.F90:826
w3gridmd::ngvj
integer ngvj
Definition: w3gridmd.F90:609
w3gridmd::pmnam2
character pmnam2
Definition: w3gridmd.F90:815
w3gridmd::ix
integer ix
Definition: w3gridmd.F90:582
w3gridmd::pnsmc
character pnsmc
Definition: w3gridmd.F90:907
w3gridmd::tauwshelter
real tauwshelter
Definition: w3gridmd.F90:849
w3gridmd::sdsa1
real sdsa1
Definition: w3gridmd.F90:834
w3gridmd::usecgice
logical usecgice
Definition: w3gridmd.F90:765
w3gridmd::sds4a
real sds4a
Definition: w3gridmd.F90:849
w3gridmd::ix3
integer ix3
Definition: w3gridmd.F90:616
w3odatmd::ptmeth
integer, pointer ptmeth
Definition: w3odatmd.F90:555
w3gridmd::sdsb1
real sdsb1
Definition: w3gridmd.F90:834
w3gridmd::stabsh
real stabsh
Definition: w3gridmd.F90:832
w3gridmd::ic3hilim
real ic3hilim
Definition: w3gridmd.F90:760
w3gridmd::ncobst
integer ncobst
Definition: w3gridmd.F90:608
w3gridmd::kdfd
real kdfd
Definition: w3gridmd.F90:887
w3gridmd::sdsbrf1
real sdsbrf1
Definition: w3gridmd.F90:849
w3gridmd::unstschemes
integer, dimension(6) unstschemes
Definition: w3gridmd.F90:935
w3gridmd::nlvufcsk
integer, dimension(:), allocatable nlvufcsk
Definition: w3gridmd.F90:684
w3gridmd::icehfac
real icehfac
Definition: w3gridmd.F90:804
w3gridmd::cstrg
character(len=4) cstrg
Definition: w3gridmd.F90:637
w3gridmd::sth1mf
integer sth1mf
Definition: w3gridmd.F90:643
w3gridmd::flnew
logical flnew
Definition: w3gridmd.F90:713
w3nmlgridmd::nml_run_t
Definition: w3nmlgridmd.F90:69
w3gridmd::is2creepd
real is2creepd
Definition: w3gridmd.F90:728
w3gridmd::stdy
real stdy
Definition: w3gridmd.F90:804
w3gridmd::sth2mf
integer sth2mf
Definition: w3gridmd.F90:643
w3gridmd::nsc
real nsc
Definition: w3gridmd.F90:887
w3gridmd::naui
integer naui
Definition: w3gridmd.F90:609
w3gridmd::crit_dep_setup
real *8 crit_dep_setup
Definition: w3gridmd.F90:942
w3gridmd::exptotal
logical exptotal
Definition: w3gridmd.F90:927
w3gridmd::jobs
integer jobs
Definition: w3gridmd.F90:608
w3gdatmd::gname
character(len=30), pointer gname
Definition: w3gdatmd.F90:1223
w3gridmd::swellf6
real swellf6
Definition: w3gridmd.F90:849
w3gridmd::gqamp2
real gqamp2
Definition: w3gridmd.F90:879
w3gridmd::idx
integer idx
Definition: w3gridmd.F90:582
w3gridmd::impfreqshift
logical impfreqshift
Definition: w3gridmd.F90:930
w3gridmd::fneg
real fneg
Definition: w3gridmd.F90:832
w3gridmd::imptotal
logical imptotal
Definition: w3gridmd.F90:928
w3gridmd::ndstrc
integer ndstrc
Definition: w3gridmd.F90:582
w3odatmd::fnmpre
character(len=80) fnmpre
Definition: w3odatmd.F90:330
w3gridmd::nbotot
integer nbotot
Definition: w3gridmd.F90:582
w3arrymd::ina2i
subroutine ina2i(ARRAY, MX, MY, LX, HX, LY, HY, NDS, NDST, NDSE, IDFM, RFORM, IDLA, VSC, VOF)
Definition: w3arrymd.F90:295
w3gridmd::sdsbm4
real sdsbm4
Definition: w3gridmd.F90:849
w3gridmd::y
real y
Definition: w3gridmd.F90:630
w3gridmd::nrtr
integer nrtr
Definition: w3gridmd.F90:582
w3gridmd::sdsmwpow
real sdsmwpow
Definition: w3gridmd.F90:849
w3gridmd::elatac
real, dimension(:), allocatable elatac
Definition: w3gridmd.F90:690
w3gridmd::nml_depth
type(nml_depth_t) nml_depth
Definition: w3gridmd.F90:568
w3gridmd::sinthp
real sinthp
Definition: w3gridmd.F90:838
w3gridmd::i1e3d
integer i1e3d
Definition: w3gridmd.F90:642
w3gridmd::nml_run
type(nml_run_t) nml_run
Definition: w3gridmd.F90:561
w3gridmd::ndss
integer ndss
Definition: w3gridmd.F90:582
w3gridmd::factor
real factor
Definition: w3gridmd.F90:630
w3odatmd::isbpo
integer, dimension(:), pointer isbpo
Definition: w3odatmd.F90:535
w3gridmd::refcoast
real refcoast
Definition: w3gridmd.F90:739
scrip_grids::grid1_rank
integer(scrip_i4), save grid1_rank
Definition: scrip_grids.f:68
w3odatmd::nbi
integer, pointer nbi
Definition: w3odatmd.F90:530
w3odatmd::flbpi
logical, pointer flbpi
Definition: w3odatmd.F90:546
w3gridmd::ic3maxcnc
real ic3maxcnc
Definition: w3gridmd.F90:760
w3gridmd::is2c3
real is2c3
Definition: w3gridmd.F90:728
w3gridmd::sdsbm1
real sdsbm1
Definition: w3gridmd.F90:849
w3servmd::w3eqtoll
subroutine w3eqtoll(PHI_EQ, LAMBDA_EQ, PHI, LAMBDA, ANGLED, PHI_POLE, LAMBDA_POLE, POINTS)
Definition: w3servmd.F90:1224
w3gridmd::expfspsi
logical expfspsi
Definition: w3gridmd.F90:924
w3gridmd::uno3
logical uno3
Definition: w3gridmd.F90:906
w3gridmd::jgs_terminate_norm
logical jgs_terminate_norm
Definition: w3gridmd.F90:915
w3gridmd::ic2turb
real ic2turb
Definition: w3gridmd.F90:755
w3gridmd::flic
logical flic
Definition: w3gridmd.F90:713
w3gridmd::ipi
integer ipi
Definition: w3gridmd.F90:599
w3gridmd::flst4
logical flst4
Definition: w3gridmd.F90:720
w3gridmd::grid_dims_varid
integer grid_dims_varid
Definition: w3gridmd.F90:796
w3gridmd::sdsbint
real sdsbint
Definition: w3gridmd.F90:849
w3gridmd::th2mf
integer th2mf
Definition: w3gridmd.F90:643
w3gridmd::tname
character tname
Definition: w3gridmd.F90:782
w3gridmd::ik
integer ik
Definition: w3gridmd.F90:582
w3gridmd::btbet
real btbet
Definition: w3gridmd.F90:804
w3arrymd::ina2r
subroutine ina2r(ARRAY, MX, MY, LX, HX, LY, HY, NDS, NDST, NDSE, IDFM, RFORM, IDLA, VSC, VOF)
Definition: w3arrymd.F90:78
w3gridmd::igmindep
real igmindep
Definition: w3gridmd.F90:749
w3gridmd::ijkcelac
integer, dimension(:,:), allocatable ijkcelac
Definition: w3gridmd.F90:688
w3gridmd::averg
logical averg
Definition: w3gridmd.F90:906
w3gridmd::cstb1
logical cstb1
Definition: w3gridmd.F90:872
w3gridmd::fmiche
real fmiche
Definition: w3gridmd.F90:630
w3gridmd::ygrdin
real, dimension(:,:), allocatable ygrdin
Definition: w3gridmd.F90:702
w3gridmd::a34
real a34
Definition: w3gridmd.F90:672
w3gridmd::grid_corner_lat_varid
integer grid_corner_lat_varid
Definition: w3gridmd.F90:794
w3gridmd::ndsi2
integer ndsi2
Definition: w3gridmd.F90:582
w3gdatmd::w3setg
subroutine w3setg(IMOD, NDSE, NDST)
Definition: w3gdatmd.F90:2152
scrip_grids
Definition: scrip_grids.f:49
w3gridmd::ijkufcin
integer, dimension(:,:), allocatable ijkufcin
Definition: w3gridmd.F90:685
w3gridmd::typeid
character(len=18) typeid
Definition: w3gridmd.F90:787
w3gridmd::isc2
real isc2
Definition: w3gridmd.F90:725
w3gridmd::sdsnuw
real sdsnuw
Definition: w3gridmd.F90:849
w3gridmd::swellf2
real swellf2
Definition: w3gridmd.F90:849
w3gridmd::rfpm
real rfpm
Definition: w3gridmd.F90:654
w3gridmd::ijkdep
integer, dimension(:), allocatable ijkdep
Definition: w3gridmd.F90:689
w3gridmd::sdsp
real sdsp
Definition: w3gridmd.F90:849
w3nmlgridmd::nml_smc_t
Definition: w3nmlgridmd.F90:129
w3gridmd::ijkvfcac
integer, dimension(:,:), allocatable ijkvfcac
Definition: w3gridmd.F90:688
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3gridmd::sdsbm0
real sdsbm0
Definition: w3gridmd.F90:849
w3gridmd::fltc96
logical fltc96
Definition: w3gridmd.F90:717
w3gridmd::w3grid
subroutine w3grid()
Definition: w3gridmd.F90:1156
w3gridmd::sdsbchoice
real sdsbchoice
Definition: w3gridmd.F90:848
w3gridmd::nbismc
integer nbismc
Definition: w3gridmd.F90:608
w3gridmd::ylatac
real, dimension(:), allocatable ylatac
Definition: w3gridmd.F90:690
w3gridmd::refcosp_straight
real refcosp_straight
Definition: w3gridmd.F90:739
w3gridmd::tailt2
real tailt2
Definition: w3gridmd.F90:818
w3odatmd::nbi2
integer, pointer nbi2
Definition: w3odatmd.F90:530
w3gridmd::iyn
integer, dimension(nfl) iyn
Definition: w3gridmd.F90:582
w3gridmd::sdsbm2
real sdsbm2
Definition: w3gridmd.F90:849
w3gridmd::ctype
integer ctype
Definition: w3gridmd.F90:825
w3gridmd::sintail2
real sintail2
Definition: w3gridmd.F90:849
w3gridmd::airgb
real airgb
Definition: w3gridmd.F90:814
w3gridmd::fxfmage
real fxfmage
Definition: w3gridmd.F90:849
w3gridmd::ifl
integer ifl
Definition: w3gridmd.F90:582
w3nmlgridmd::nml_grid_t
Definition: w3nmlgridmd.F90:87
w3gridmd::iy
integer iy
Definition: w3gridmd.F90:582
w3gridmd::flnl
logical flnl
Definition: w3gridmd.F90:713
w3gridmd::idy
integer idy
Definition: w3gridmd.F90:582
w3nmlgridmd
Definition: w3nmlgridmd.F90:3
w3gridmd::ripfac1
real ripfac1
Definition: w3gridmd.F90:708
scrip_kindsmod::scrip_r8
integer, parameter, public scrip_r8
Definition: scrip_kindsmod.f90:38
w3gridmd::nland
integer nland
Definition: w3gridmd.F90:582
w3gridmd::grid_area_varid
integer grid_area_varid
Definition: w3gridmd.F90:795
w3odatmd::w3dmo5
subroutine w3dmo5(IMOD, NDSE, NDST, IBLOCK)
Definition: w3odatmd.F90:1321
w3gridmd::kdmin
real kdmin
Definition: w3gridmd.F90:876
w3gridmd::is2fragility
real is2fragility
Definition: w3gridmd.F90:728
w3gridmd::igbcoverwrite
logical igbcoverwrite
Definition: w3gridmd.F90:746
w3gridmd::betamax
real betamax
Definition: w3gridmd.F90:838
w3gridmd::sdsnmtf
real sdsnmtf
Definition: w3gridmd.F90:849
w3gridmd::i1sth2m
integer i1sth2m
Definition: w3gridmd.F90:643
w3gridmd::bdylon
real, dimension(:), allocatable bdylon
Definition: w3gridmd.F90:696
w3gridmd
Definition: w3gridmd.F90:3
w3gridmd::nml_spectrum
type(nml_spectrum_t) nml_spectrum
Definition: w3gridmd.F90:560
w3gridmd::cha0
real cha0
Definition: w3gridmd.F90:849
w3gridmd::icesnl
real icesnl
Definition: w3gridmd.F90:804
w3gridmd::wnmeanp
real wnmeanp
Definition: w3gridmd.F90:838
w3gridmd::stdx
real stdx
Definition: w3gridmd.F90:804
w3gridmd::nfl
integer, parameter nfl
Definition: w3gridmd.F90:581
w3nmlgridmd::nml_slope_t
Definition: w3nmlgridmd.F90:174
w3servmd
Definition: w3servmd.F90:3
w3gridmd::is2creepc
real is2creepc
Definition: w3gridmd.F90:728
w3gdatmd::uostfilelocal
character(len=:), pointer uostfilelocal
Definition: w3gdatmd.F90:1400
w3gridmd::ndepth
integer ndepth
Definition: w3gridmd.F90:882
w3gridmd::is2wim1
real is2wim1
Definition: w3gridmd.F90:728
w3gridmd::nrbs
integer nrbs
Definition: w3gridmd.F90:582
w3gridmd::nl5dpt
real nl5dpt
Definition: w3gridmd.F90:893
w3gridmd::nmap
integer nmap
Definition: w3gridmd.F90:613
w3servmd::w3lltoeq
subroutine w3lltoeq(PHI, LAMBDA, PHI_EQ, LAMBDA_EQ, ANGLED, PHI_POLE, LAMBDA_POLE, POINTS)
Definition: w3servmd.F90:1084
w3gridmd::obsy
real, dimension(:,:), allocatable obsy
Definition: w3gridmd.F90:703
w3gridmd::sinfc
real sinfc
Definition: w3gridmd.F90:869
w3gridmd::nrdb
integer nrdb
Definition: w3gridmd.F90:582
w3gridmd::indtsa
integer indtsa
Definition: w3gridmd.F90:890
w3gridmd::ijkvfcin
integer, dimension(:,:), allocatable ijkvfcin
Definition: w3gridmd.F90:685
scrip_grids::grid1_dims
integer(scrip_i4), dimension(:), allocatable, save grid1_dims
Definition: scrip_grids.f:74
w3gridmd::nml_excl_count
type(nml_excl_count_t) nml_excl_count
Definition: w3gridmd.F90:575
w3odatmd::nbo2
integer, dimension(:), pointer nbo2
Definition: w3odatmd.F90:531
w3odatmd::flcomb
logical, pointer flcomb
Definition: w3odatmd.F90:554
w3timemd::caltype
character, public caltype
Definition: w3timemd.F90:79
w3gridmd::j
integer j
Definition: w3gridmd.F90:582
w3gridmd::ndsm
integer ndsm
Definition: w3gridmd.F90:582
w3gridmd::sdsb3
real sdsb3
Definition: w3gridmd.F90:834
w3gridmd::jgs_limiter
logical jgs_limiter
Definition: w3gridmd.F90:916
w3gridmd::dptfac
real dptfac
Definition: w3gridmd.F90:666
w3gridmd::i1p2sf
integer i1p2sf
Definition: w3gridmd.F90:641
w3gridmd::stdlon
real, dimension(:,:), allocatable stdlon
Definition: w3gridmd.F90:694
w3gridmd::angldin
real, dimension(:,:), allocatable angldin
Definition: w3gridmd.F90:694
w3gridmd::i2th1m
integer i2th1m
Definition: w3gridmd.F90:643
w3gridmd::sdsc6
real sdsc6
Definition: w3gridmd.F90:849
w3gridmd::aircmin
real aircmin
Definition: w3gridmd.F90:814
w3odatmd::w3seto
subroutine w3seto(IMOD, NDSERR, NDSTST)
Definition: w3odatmd.F90:1523
w3gridmd::nrnl
integer nrnl
Definition: w3gridmd.F90:582
w3gridmd::us3d
integer us3d
Definition: w3gridmd.F90:643
w3gridmd::nmapb
integer nmapb
Definition: w3gridmd.F90:582
w3gridmd::iba
integer iba
Definition: w3gridmd.F90:582
w3gridmd::imprefraction
logical imprefraction
Definition: w3gridmd.F90:929
w3snlsmd
Nonlinear interaction based ‘smoother’ for high frequencies.
Definition: w3snlsmd.F90:21
w3gridmd::i2sth1m
integer i2sth1m
Definition: w3gridmd.F90:643
w3odatmd::hspmin
real, pointer hspmin
Definition: w3odatmd.F90:553
w3gridmd::swellf5
real swellf5
Definition: w3gridmd.F90:849
w3gridmd::nml_unst
type(nml_unst_t) nml_unst
Definition: w3gridmd.F90:566
w3gridmd::capcha
real capcha
Definition: w3gridmd.F90:849
w3gridmd::sdsbck
real sdsbck
Definition: w3gridmd.F90:849
w3gridmd::grid_corners_dimid
integer grid_corners_dimid
Definition: w3gridmd.F90:792
w3gridmd::snlcs2
real snlcs2
Definition: w3gridmd.F90:876
w3gridmd::arctic
logical arctic
Definition: w3gridmd.F90:906
w3gridmd::flref
logical flref
Definition: w3gridmd.F90:713
w3gridmd::ic4ki
real, dimension(nic4) ic4ki
Definition: w3gridmd.F90:770
w3gridmd::reffreqpow
real reffreqpow
Definition: w3gridmd.F90:739
w3gridmd::jj
integer jj
Definition: w3gridmd.F90:582
w3gridmd::stk_wn
real, dimension(25) stk_wn
Definition: w3gridmd.F90:650
w3gridmd::trnmx
real trnmx
Definition: w3gridmd.F90:683
constants::tabu_fw
subroutine tabu_fw
Estimate friction coefficients in oscillatory boundary layers using tabulation on Kelvin functions.
Definition: constants.F90:120
w3gridmd::is2creepb
real is2creepb
Definition: w3gridmd.F90:728
w3odatmd
Definition: w3odatmd.F90:3
scrip_grids::grid1_center_lon
real(scrip_r8), dimension(:), allocatable, target, save grid1_center_lon
Definition: scrip_grids.f:103
w3gridmd::is2andisn
real is2andisn
Definition: w3gridmd.F90:728
w3gridmd::cicen
real cicen
Definition: w3gridmd.F90:804
w3gridmd::botroughmin
real botroughmin
Definition: w3gridmd.F90:708
w3gridmd::tailtype
integer tailtype
Definition: w3gridmd.F90:817
w3gridmd::flbs
logical flbs
Definition: w3gridmd.F90:713
w3gridmd::snlcs3
real snlcs3
Definition: w3gridmd.F90:876
w3gridmd::sdsc2
real sdsc2
Definition: w3gridmd.F90:849
w3gridmd::fhfc
real fhfc
Definition: w3gridmd.F90:672
w3gridmd::flprop
logical flprop
Definition: w3gridmd.F90:713
w3gridmd::js
integer js
Definition: w3gridmd.F90:608
w3gridmd::i2sth2m
integer i2sth2m
Definition: w3gridmd.F90:643
w3gridmd::ic2smooth
real ic2smooth
Definition: w3gridmd.F90:755
w3gridmd::sdsstrain2
real sdsstrain2
Definition: w3gridmd.F90:849
w3gridmd::ierr
integer ierr
Definition: w3gridmd.F90:582
w3gridmd::rwndc
real rwndc
Definition: w3gridmd.F90:630
w3gridmd::cinp
real cinp
Definition: w3gridmd.F90:657
w3gridmd::sina0
real sina0
Definition: w3gridmd.F90:869
w3gridmd::bjgam
real bjgam
Definition: w3gridmd.F90:897
w3gridmd::is2andisb
logical is2andisb
Definition: w3gridmd.F90:734
w3gridmd::sigma
real sigma
Definition: w3gridmd.F90:630
w3gridmd::hspm
real hspm
Definition: w3gridmd.F90:804
w3gridmd::jgs_use_jacobi
logical jgs_use_jacobi
Definition: w3gridmd.F90:919
w3gridmd::jeqt
integer jeqt
Definition: w3gridmd.F90:608
w3gridmd::z0rat
real z0rat
Definition: w3gridmd.F90:849
w3gridmd::isc1
real isc1
Definition: w3gridmd.F90:725
w3gridmd::igmaxdep
real igmaxdep
Definition: w3gridmd.F90:749
w3gridmd::igempirical
real igempirical
Definition: w3gridmd.F90:749
scrip_grids::grid1_corner_lat
real(scrip_r8), dimension(:,:), allocatable, target, save grid1_corner_lat
Definition: scrip_grids.f:120
w3gridmd::symr
real symr
Definition: w3gridmd.F90:905
w3gridmd::nml_curv
type(nml_curv_t) nml_curv
Definition: w3gridmd.F90:565
w3nmlgridmd::nml_excl_body_t
Definition: w3nmlgridmd.F90:219
w3gridmd::ic2turbs
real ic2turbs
Definition: w3gridmd.F90:755
w3gridmd::fc3
real fc3
Definition: w3gridmd.F90:672
w3gridmd::flc
logical flc
Definition: w3gridmd.F90:811
w3gridmd::ndsg
integer ndsg
Definition: w3gridmd.F90:582
w3gridmd::is2breakf
real is2breakf
Definition: w3gridmd.F90:728
w3gridmd::fachf
real fachf
Definition: w3gridmd.F90:630
w3gridmd::dtime
real dtime
Definition: w3gridmd.F90:901
w3gridmd::seawnd
logical seawnd
Definition: w3gridmd.F90:906
w3gridmd::msc
real msc
Definition: w3gridmd.F90:887
w3gridmd::xp
real xp
Definition: w3gridmd.F90:630
w3gridmd::i2e3d
integer i2e3d
Definition: w3gridmd.F90:642
w3gridmd::grid_rank_dimid
integer grid_rank_dimid
Definition: w3gridmd.F90:792
scrip_grids::grid1_name
character(scrip_charlength), save grid1_name
Definition: scrip_grids.f:77
w3gridmd::ijkobstr
integer, dimension(:,:), allocatable ijkobstr
Definition: w3gridmd.F90:686
w3gridmd::iussp
integer iussp
Definition: w3gridmd.F90:643
w3odatmd::nfbpo
integer, pointer nfbpo
Definition: w3odatmd.F90:530
w3gridmd::tailt1
real tailt1
Definition: w3gridmd.F90:818
w3gridmd::sedmapd50
logical sedmapd50
Definition: w3gridmd.F90:707
w3gridmd::alpha0
real alpha0
Definition: w3gridmd.F90:838
w3snl3md::delthm
real, parameter, public delthm
Definition: w3snl3md.F90:132
w3gridmd::ntrace
integer ntrace
Definition: w3gridmd.F90:582
w3gridmd::xr
real xr
Definition: w3gridmd.F90:804
w3dispmd::distab
subroutine distab
Definition: w3dispmd.F90:552
w3gridmd::nml_obst
type(nml_obst_t) nml_obst
Definition: w3gridmd.F90:570
w3gridmd::rxfr
real rxfr
Definition: w3gridmd.F90:630
w3gridmd::is2breake
real is2breake
Definition: w3gridmd.F90:728
w3gridmd::ibi
integer ibi
Definition: w3gridmd.F90:599
w3nmlgridmd::nml_inbnd_point_t
Definition: w3nmlgridmd.F90:200
w3gridmd::nrsrce
integer nrsrce
Definition: w3gridmd.F90:582
w3iogrmd::w3iogr
subroutine w3iogr(INXOUT, NDSM, IMOD, FEXT ifdef W3_ASCII
Reading and writing of the model definition file.
Definition: w3iogrmd.F90:117
w3gridmd::ic4kibk
real ic4kibk
Definition: w3gridmd.F90:770
w3gridmd::apm
real apm
Definition: w3gridmd.F90:657
w3gridmd::elatbdy
real, dimension(:), allocatable elatbdy
Definition: w3gridmd.F90:696
w3gridmd::grid_center_lat_varid
integer grid_center_lat_varid
Definition: w3gridmd.F90:793
w3gridmd::dnm
real dnm
Definition: w3gridmd.F90:672
w3gridmd::icedisp
logical icedisp
Definition: w3gridmd.F90:811
w3gridmd::iy1
integer iy1
Definition: w3gridmd.F90:582
w3gridmd::sintable
integer sintable
Definition: w3gridmd.F90:846
w3gridmd::jgs_source_nonlinear
logical jgs_source_nonlinear
Definition: w3gridmd.F90:920
w3gridmd::swellfpar
integer swellfpar
Definition: w3gridmd.F90:846
w3gridmd::th1mf
integer th1mf
Definition: w3gridmd.F90:643
w3gridmd::polonac
real polonac
Definition: w3gridmd.F90:687
w3gridmd::nml_outbnd_line
type(nml_outbnd_line_t), dimension(:), allocatable nml_outbnd_line
Definition: w3gridmd.F90:579
w3gridmd::rd
real, dimension(4) rd
Definition: w3gridmd.F90:630
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3nmlgridmd::nml_rect_t
Definition: w3nmlgridmd.F90:98
w3gridmd::jgs_pmin
real *8 jgs_pmin
Definition: w3gridmd.F90:938
w3iogrmd
Reading/writing of model definition file.
Definition: w3iogrmd.F90:20
w3gridmd::bpolat
real bpolat
Definition: w3gridmd.F90:699
w3gridmd::ic5kfilter
real ic5kfilter
Definition: w3gridmd.F90:775
w3gridmd::fxpm3
real fxpm3
Definition: w3gridmd.F90:838
w3gridmd::icefdisp
real icefdisp
Definition: w3gridmd.F90:804
w3odatmd::wsmult
real, pointer wsmult
Definition: w3odatmd.F90:553
w3gridmd::grid_imask_varid
integer grid_imask_varid
Definition: w3gridmd.F90:795
w3gridmd::ic2disper
logical ic2disper
Definition: w3gridmd.F90:754
w3gridmd::sdshck
real sdshck
Definition: w3gridmd.F90:849
w3gridmd::fltr
logical fltr
Definition: w3gridmd.F90:713
w3gridmd::fname2
character fname2
Definition: w3gridmd.F90:782
w3gridmd::nlvcelsk
integer, dimension(:), allocatable nlvcelsk
Definition: w3gridmd.F90:684
w3gridmd::idft
integer idft
Definition: w3gridmd.F90:582
w3gridmd::i1th1m
integer i1th1m
Definition: w3gridmd.F90:643
w3gridmd::sdsbt
real sdsbt
Definition: w3gridmd.F90:849
w3gridmd::unrot
logical unrot
Definition: w3gridmd.F90:950
w3gridmd::ijkcelin
integer, dimension(:,:), allocatable ijkcelin
Definition: w3gridmd.F90:685
w3gridmd::from
character from
Definition: w3gridmd.F90:782
w3gridmd::ijkufcac
integer, dimension(:,:), allocatable ijkufcac
Definition: w3gridmd.F90:688
w3gridmd::jgs_norm_thr
real *8 jgs_norm_thr
Definition: w3gridmd.F90:940
w3gridmd::ptm
integer ptm
Definition: w3gridmd.F90:812
w3gridmd::igmaxfreq
real igmaxfreq
Definition: w3gridmd.F90:749
w3gridmd::ixr
integer, dimension(4) ixr
Definition: w3gridmd.F90:582
w3gridmd::nqdef
integer nqdef
Definition: w3gridmd.F90:886
w3gridmd::impfsn
logical impfsn
Definition: w3gridmd.F90:926
w3gridmd::bjalfa
real bjalfa
Definition: w3gridmd.F90:897
w3odatmd::xbpo
real, dimension(:), pointer xbpo
Definition: w3odatmd.F90:541
w3gridmd::sdsbm3
real sdsbm3
Definition: w3gridmd.F90:849
w3gridmd::swellf7
real swellf7
Definition: w3gridmd.F90:849
w3gridmd::bplat
real, dimension(9) bplat
Definition: w3gridmd.F90:952
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gridmd::plat
real plat
Definition: w3gridmd.F90:949
w3gridmd::ixo
integer ixo
Definition: w3gridmd.F90:582
w3gridmd::jgs_nlevel
integer jgs_nlevel
Definition: w3gridmd.F90:937
w3gridmd::npo
integer npo
Definition: w3gridmd.F90:582
w3gridmd::iy2
integer iy2
Definition: w3gridmd.F90:582
w3gridmd::nbsel
integer nbsel
Definition: w3gridmd.F90:934
w3gridmd::ugbccfl
logical ugbccfl
Definition: w3gridmd.F90:922
w3odatmd::ndso
integer, pointer ndso
Definition: w3odatmd.F90:456
w3gdatmd::w3nmod
subroutine w3nmod(NUMBER, NDSE, NDST, NAUX)
Definition: w3gdatmd.F90:1433
w3nmlgridmd::nml_spectrum_t
Definition: w3nmlgridmd.F90:60
scrip_grids::grid1_center_lat
real(scrip_r8), dimension(:), allocatable, target, save grid1_center_lat
Definition: scrip_grids.f:103
w3gridmd::connct
logical connct
Definition: w3gridmd.F90:713
w3arrymd
Definition: w3arrymd.F90:3
w3gridmd::sdspbk
real sdspbk
Definition: w3gridmd.F90:849
w3nmlgridmd::nml_excl_count_t
Definition: w3nmlgridmd.F90:208
w3gridmd::readmp
integer, dimension(:,:), allocatable readmp
Definition: w3gridmd.F90:625
w3gridmd::gqmthrcou
real gqmthrcou
Definition: w3gridmd.F90:879
scrip_kindsmod
Definition: scrip_kindsmod.f90:3
w3gridmd::nrlin
integer nrlin
Definition: w3gridmd.F90:582
w3nmlgridmd::nml_curv_t
Definition: w3nmlgridmd.F90:110
w3gridmd::ihm
integer ihm
Definition: w3gridmd.F90:803
w3gridmd::nric
integer nric
Definition: w3gridmd.F90:582
w3gridmd::gamma
real gamma
Definition: w3gridmd.F90:675
w3gridmd::ic5vemod
real ic5vemod
Definition: w3gridmd.F90:775
w3gridmd::i2us3d
integer i2us3d
Definition: w3gridmd.F90:643
w3gridmd::sdsa2
real sdsa2
Definition: w3gridmd.F90:834
w3gridmd::imapb
integer imapb
Definition: w3gridmd.F90:582
w3gridmd::wdthth
real wdthth
Definition: w3gridmd.F90:911
w3nmlgridmd::nml_obst_t
Definition: w3nmlgridmd.F90:163
w3gridmd::ient
integer, save ient
Definition: w3gridmd.F90:622
w3gridmd::gqamp1
real gqamp1
Definition: w3gridmd.F90:879
w3snl3md::lammax
real, parameter, public lammax
Definition: w3snl3md.F90:131
w3gridmd::kdconv
real kdconv
Definition: w3gridmd.F90:876
w3gdatmd::uostfactorshadow
real, pointer uostfactorshadow
Definition: w3gdatmd.F90:1401
w3gridmd::ishft
integer ishft
Definition: w3gridmd.F90:608
w3gridmd::ic2rough
real ic2rough
Definition: w3gridmd.F90:755
scrip_grids::grid1_corner_lon
real(scrip_r8), dimension(:,:), allocatable, target, save grid1_corner_lon
Definition: scrip_grids.f:120
w3gridmd::nrbt
integer nrbt
Definition: w3gridmd.F90:582
w3nmlgridmd::nml_unst_t
Definition: w3nmlgridmd.F90:118
w3gridmd::zwnd
real zwnd
Definition: w3gridmd.F90:832
w3gridmd::sdsp1
integer sdsp1
Definition: w3gridmd.F90:871
w3gridmd::cumsigp
real cumsigp
Definition: w3gridmd.F90:849
w3gridmd::clin
real clin
Definition: w3gridmd.F90:654
wmscrpmd
Routines to determine and process grid dependencies in the multi-grid wave model.
Definition: wmscrpmd.F90:23
w3gridmd::ncol
integer ncol
Definition: w3gridmd.F90:601
w3gridmd::cpos
real cpos
Definition: w3gridmd.F90:832
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3gridmd::refrmax
real refrmax
Definition: w3gridmd.F90:739
w3gridmd::flbt
logical flbt
Definition: w3gridmd.F90:713
w3gridmd::igswellmax
logical igswellmax
Definition: w3gridmd.F90:746
w3gridmd::conv_dy
real(scrip_r8) conv_dy
Definition: w3gridmd.F90:797
w3gridmd::is2break
logical is2break
Definition: w3gridmd.F90:734
w3gdatmd::uostfileshadow
character(len=:), pointer uostfileshadow
Definition: w3gdatmd.F90:1400
w3gridmd::ic3dens
real ic3dens
Definition: w3gridmd.F90:760
w3gridmd::gstrg
character(len=4) gstrg
Definition: w3gridmd.F90:637
w3gridmd::is2disp
logical is2disp
Definition: w3gridmd.F90:734
w3gridmd::fc2
real fc2
Definition: w3gridmd.F90:672
w3gridmd::igsourceatbp
integer igsourceatbp
Definition: w3gridmd.F90:747
w3gridmd::unstscheme
integer unstscheme
Definition: w3gridmd.F90:936
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3gridmd::ic5rkick
real ic5rkick
Definition: w3gridmd.F90:775
w3gridmd::ic3cheng
logical ic3cheng
Definition: w3gridmd.F90:765
w3gridmd::nml_inbnd_count
type(nml_inbnd_count_t) nml_inbnd_count
Definition: w3gridmd.F90:573
w3gridmd::stxftf
real stxftf
Definition: w3gridmd.F90:838
w3gridmd::igfixeddepth
real igfixeddepth
Definition: w3gridmd.F90:749
w3gridmd::ic5maxiter
real ic5maxiter
Definition: w3gridmd.F90:775
w3gridmd::polatac
real polatac
Definition: w3gridmd.F90:687
w3gridmd::anglbdy
real, dimension(:), allocatable anglbdy
Definition: w3gridmd.F90:696
w3gridmd::e3d
integer e3d
Definition: w3gridmd.F90:642
w3gridmd::fpos
real fpos
Definition: w3gridmd.F90:832
w3gdatmd
Definition: w3gdatmd.F90:16
w3gridmd::fpia
real fpia
Definition: w3gridmd.F90:660
w3gridmd::iqtype
integer iqtype
Definition: w3gridmd.F90:878
scrip_grids::grid1_size
integer(scrip_i4), save grid1_size
Definition: scrip_grids.f:68
w3gridmd::altlp
integer altlp
Definition: w3gridmd.F90:890
w3gridmd::rform
character rform
Definition: w3gridmd.F90:782
w3gridmd::wcor2
real wcor2
Definition: w3gridmd.F90:630
w3odatmd::ptfcut
real, pointer ptfcut
Definition: w3odatmd.F90:556
w3gridmd::nlvvfcsk
integer, dimension(:), allocatable nlvvfcsk
Definition: w3gridmd.F90:684
w3gridmd::jgs_maxiter
integer jgs_maxiter
Definition: w3gridmd.F90:933
w3odatmd::ybpo
real, dimension(:), pointer ybpo
Definition: w3odatmd.F90:541
w3gridmd::flis
logical flis
Definition: w3gridmd.F90:713
w3gridmd::stabof
real stabof
Definition: w3gridmd.F90:832
w3gridmd::wsm
real wsm
Definition: w3gridmd.F90:804
w3gridmd::sdsstrain
real sdsstrain
Definition: w3gridmd.F90:849
w3gridmd::p2sf
integer p2sf
Definition: w3gridmd.F90:641
w3gridmd::elonac
real, dimension(:), allocatable elonac
Definition: w3gridmd.F90:690
w3gridmd::is2andise
real is2andise
Definition: w3gridmd.F90:728
w3gridmd::ic3hice
real ic3hice
Definition: w3gridmd.F90:760
w3gridmd::vsc
real vsc
Definition: w3gridmd.F90:630
w3gridmd::expfsfct
logical expfsfct
Definition: w3gridmd.F90:925
w3gridmd::ugobcdepth
real ugobcdepth
Definition: w3gridmd.F90:945
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3gridmd::sdsa0
real sdsa0
Definition: w3gridmd.F90:834
w3odatmd::w3nout
subroutine w3nout(NDSERR, NDSTST)
Definition: w3odatmd.F90:561
w3gridmd::iceddisp
real iceddisp
Definition: w3gridmd.F90:804
w3gridmd::ic4fmin
real ic4fmin
Definition: w3gridmd.F90:770
w3gridmd::tailnl
real tailnl
Definition: w3gridmd.F90:879
w3gridmd::ptfc
real ptfc
Definition: w3gridmd.F90:813
w3snl3md
Generalized and optimized multiple DIA implementation.
Definition: w3snl3md.F90:24
w3gridmd::depths
real, dimension(100) depths
Definition: w3gridmd.F90:666
w3gridmd::wdthcg
real wdthcg
Definition: w3gridmd.F90:911
w3odatmd::ihmax
integer, pointer ihmax
Definition: w3odatmd.F90:551
w3gridmd::fllin
logical fllin
Definition: w3gridmd.F90:713
w3gridmd::zalp
real zalp
Definition: w3gridmd.F90:838
w3gridmd::gqamp4
real gqamp4
Definition: w3gridmd.F90:879
w3gridmd::tauwbug
integer tauwbug
Definition: w3gridmd.F90:846
w3gridmd::ripfac2
real ripfac2
Definition: w3gridmd.F90:708
w3gridmd::sdkof
real sdkof
Definition: w3gridmd.F90:849
w3servmd::itrace
subroutine itrace(NDS, NMAX)
Definition: w3servmd.F90:91
w3gridmd::sed_porofile
real, dimension(:,:), allocatable sed_porofile
Definition: w3gridmd.F90:706
w3gridmd::is2backscat
real is2backscat
Definition: w3gridmd.F90:728
w3gridmd::ic5minwt
real ic5minwt
Definition: w3gridmd.F90:775
w3gridmd::ic5minhw
real ic5minhw
Definition: w3gridmd.F90:775
w3gridmd::swlb1
real swlb1
Definition: w3gridmd.F90:869
w3gridmd::navj
integer navj
Definition: w3gridmd.F90:609
w3gridmd::sdsc5
real sdsc5
Definition: w3gridmd.F90:849
w3gridmd::ix1
integer ix1
Definition: w3gridmd.F90:582
w3gridmd::nosw
integer nosw
Definition: w3gridmd.F90:582
w3gridmd::i2th2m
integer i2th2m
Definition: w3gridmd.F90:643
w3gridmd::ngui
integer ngui
Definition: w3gridmd.F90:609
w3gridmd::ripfac4
real ripfac4
Definition: w3gridmd.F90:708
w3gridmd::ndsi
integer ndsi
Definition: w3gridmd.F90:582
w3odatmd::noswll
integer, pointer noswll
Definition: w3odatmd.F90:460
w3gridmd::is2isoscat
logical is2isoscat
Definition: w3gridmd.F90:734
w3gridmd::ith0
integer ith0
Definition: w3gridmd.F90:582
w3gridmd::sintail1
real sintail1
Definition: w3gridmd.F90:849
w3gridmd::lice
real lice
Definition: w3gridmd.F90:804
w3gridmd::dyo
real dyo
Definition: w3gridmd.F90:630
w3gridmd::dvsmc
real dvsmc
Definition: w3gridmd.F90:682
w3gridmd::lambda
real lambda
Definition: w3gridmd.F90:876
w3gridmd::cdfac
real cdfac
Definition: w3gridmd.F90:829
w3gridmd::tmpsta
integer, dimension(:,:), allocatable tmpsta
Definition: w3gridmd.F90:625
w3gridmd::nki
integer nki
Definition: w3gridmd.F90:582
w3gridmd::xseed
real xseed
Definition: w3gridmd.F90:804
w3gridmd::sdsstraina
real sdsstraina
Definition: w3gridmd.F90:849
w3gridmd::vsc0
real vsc0
Definition: w3gridmd.F90:630
w3gridmd::ic2reynolds
real ic2reynolds
Definition: w3gridmd.F90:755
w3gridmd::nml_rect
type(nml_rect_t) nml_rect
Definition: w3gridmd.F90:564
w3gridmd::sdsdelta1
real sdsdelta1
Definition: w3gridmd.F90:841
w3nmlgridmd::nml_depth_t
Definition: w3nmlgridmd.F90:141
w3gridmd::sed_d50_uniform
real sed_d50_uniform
Definition: w3gridmd.F90:708
w3gridmd::sdsiso
integer sdsiso
Definition: w3gridmd.F90:846
w3gridmd::pname2
character pname2
Definition: w3gridmd.F90:782
w3gridmd::is2c2
real is2c2
Definition: w3gridmd.F90:728
w3timemd
Definition: w3timemd.F90:3
w3gridmd::zlim
real zlim
Definition: w3gridmd.F90:630
w3gridmd::ic4cn
real, dimension(nic42) ic4cn
Definition: w3gridmd.F90:770
w3gridmd::sinbr
real sinbr
Definition: w3gridmd.F90:849
w3gridmd::ist
integer ist
Definition: w3gridmd.F90:582
w3gridmd::sdsdelta2
real sdsdelta2
Definition: w3gridmd.F90:841
w3gridmd::nstat
integer nstat
Definition: w3gridmd.F90:582
w3gridmd::trnmy
real trnmy
Definition: w3gridmd.F90:683
w3gridmd::lvsmc
integer lvsmc
Definition: w3gridmd.F90:608
w3gridmd::icehinit
real icehinit
Definition: w3gridmd.F90:804
w3gridmd::nlprop
real nlprop
Definition: w3gridmd.F90:663
w3gridmd::setup_apply_wlv
logical setup_apply_wlv
Definition: w3gridmd.F90:932
w3gridmd::nml_mask
type(nml_mask_t) nml_mask
Definition: w3gridmd.F90:569
w3gridmd::refslope
real refslope
Definition: w3gridmd.F90:723
w3gridmd::sdsabk
real sdsabk
Definition: w3gridmd.F90:849
w3dispmd
Definition: w3dispmd.F90:3
w3gridmd::iyr
integer, dimension(4) iyr
Definition: w3gridmd.F90:582
w3gridmd::sxfr
real sxfr
Definition: w3gridmd.F90:630
w3gridmd::ic5mstr
character(len=4), dimension(3) ic5mstr
Definition: w3gridmd.F90:779
w3gridmd::sdsb2
real sdsb2
Definition: w3gridmd.F90:834
scrip_grids::grid1_imask
integer(scrip_i4), dimension(:), allocatable, target, save grid1_imask
Definition: scrip_grids.f:99
w3gridmd::sdsmwd
real sdsmwd
Definition: w3gridmd.F90:849
w3gridmd::iloop
integer iloop
Definition: w3gridmd.F90:582
w3gridmd::ijkvfc8
integer, dimension(:), allocatable ijkvfc8
Definition: w3gridmd.F90:689
w3gridmd::elonbdy
real, dimension(:), allocatable elonbdy
Definition: w3gridmd.F90:696
w3gridmd::stxftwn
real stxftwn
Definition: w3gridmd.F90:838
w3gridmd::ic3maxthk
real ic3maxthk
Definition: w3gridmd.F90:760
scrip_grids::grid1_units
character(scrip_charlength), save grid1_units
Definition: scrip_grids.f:80
w3gridmd::is2andisd
real is2andisd
Definition: w3gridmd.F90:728
w3gridmd::facberg
real facberg
Definition: w3gridmd.F90:723
w3gridmd::sdsc1
real sdsc1
Definition: w3gridmd.F90:841
w3gridmd::rfmaxd
real rfmaxd
Definition: w3gridmd.F90:905
w3gridmd::qparms
real, dimension(500) qparms
Definition: w3gridmd.F90:669
w3gridmd::sdsc4
real sdsc4
Definition: w3gridmd.F90:849
w3gridmd::ic4fc
real, dimension(nic4) ic4fc
Definition: w3gridmd.F90:770
w3gridmd::nml_timesteps
type(nml_timesteps_t) nml_timesteps
Definition: w3gridmd.F90:562
w3gridmd::isea
integer isea
Definition: w3gridmd.F90:582
w3nmlgridmd::nml_inbnd_count_t
Definition: w3nmlgridmd.F90:196
w3gridmd::is2creepn
real is2creepn
Definition: w3gridmd.F90:728
w3gridmd::xo
real xo
Definition: w3gridmd.F90:630
w3arrymd::prtblk
subroutine prtblk(NDS, NX, NY, MX, F, MAP, MAP0, FSC, IX1, IX2, IX3, IY1, IY2, IY3, PRVAR, PRUNIT)
Definition: w3arrymd.F90:1112
w3gridmd::refunstsource
real refunstsource
Definition: w3gridmd.F90:739
w3gridmd::comstr
character comstr
Definition: w3gridmd.F90:782
w3gridmd::rfr1
real rfr1
Definition: w3gridmd.F90:630
w3gridmd::ndsma
integer ndsma
Definition: w3gridmd.F90:593
w3gridmd::refd
real, dimension(:,:), allocatable refd
Definition: w3gridmd.F90:704
w3gridmd::is2dmin
real is2dmin
Definition: w3gridmd.F90:728
w3gridmd::igsterms
integer igsterms
Definition: w3gridmd.F90:747
w3gdatmd::uostfactorlocal
real, pointer uostfactorlocal
Definition: w3gdatmd.F90:1401
w3gridmd::gshift
real(8) gshift
Definition: w3gridmd.F90:810
w3gridmd::whitecapwidth
real whitecapwidth
Definition: w3gridmd.F90:849
w3gridmd::kdfs
real kdfs
Definition: w3gridmd.F90:887
w3gridmd::cice0
real cice0
Definition: w3gridmd.F90:804
w3gridmd::sigdepth
real sigdepth
Definition: w3gridmd.F90:708
w3gridmd::fpib
real fpib
Definition: w3gridmd.F90:660
w3gridmd::ic3visc
real ic3visc
Definition: w3gridmd.F90:760
w3gridmd::nbt
integer nbt
Definition: w3gridmd.F90:582
w3gridmd::solverthr_setup
real *8 solverthr_setup
Definition: w3gridmd.F90:941
w3gridmd::pname
character pname
Definition: w3gridmd.F90:782
w3gridmd::ic2visc
real ic2visc
Definition: w3gridmd.F90:755
w3odatmd::wscut
real, pointer wscut
Definition: w3odatmd.F90:553
w3gridmd::botroughfac
real botroughfac
Definition: w3gridmd.F90:708
w3gridmd::sed_d50file
real, dimension(:,:), allocatable sed_d50file
Definition: w3gridmd.F90:706
w3gridmd::sdsbrfdf
integer sdsbrfdf
Definition: w3gridmd.F90:846
w3gridmd::ipn
integer ipn
Definition: w3gridmd.F90:599
w3gridmd::ic3kilim
real ic3kilim
Definition: w3gridmd.F90:760
w3gridmd::vof
real vof
Definition: w3gridmd.F90:630
w3gridmd::sdsdth
real sdsdth
Definition: w3gridmd.F90:849
w3gdatmd::nic4
integer, parameter nic4
Definition: w3gdatmd.F90:622
w3odatmd::rdbpo
real, dimension(:,:), pointer rdbpo
Definition: w3odatmd.F90:541
w3gridmd::igmethod
integer igmethod
Definition: w3gridmd.F90:747
w3nmlgridmd::w3nmlgrid
subroutine w3nmlgrid(NDSI, INFILE, NML_SPECTRUM, NML_RUN, NML_TIMESTEPS, NML_GRID, NML_RECT, NML_CURV, NML_UNST, NML_SMC, NML_DEPTH, NML_MASK, NML_OBST, NML_SLOPE, NML_SED, NML_INBND_COUNT, NML_INBND_POINT, NML_EXCL_COUNT, NML_EXCL_POINT, NML_EXCL_BODY, NML_OUTBND_COUNT, NML_OUTBND_LINE, IERR)
Definition: w3nmlgridmd.F90:255
w3gridmd::idla
integer idla
Definition: w3gridmd.F90:582
w3gridmd::stxftftail
real stxftftail
Definition: w3gridmd.F90:841
w3gridmd::ugobcok
logical ugobcok
Definition: w3gridmd.F90:946
w3gridmd::mapout
integer, dimension(:,:), allocatable mapout
Definition: w3gridmd.F90:627
w3gridmd::ingrid
logical ingrid
Definition: w3gridmd.F90:713
w3gridmd::icesln
real icesln
Definition: w3gridmd.F90:804
w3gridmd::igaddoutp
integer igaddoutp
Definition: w3gridmd.F90:747
w3gridmd::nl5kev
integer nl5kev
Definition: w3gridmd.F90:894
w3nmlgridmd::nml_mask_t
Definition: w3nmlgridmd.F90:152
w3gridmd::nl5dis
integer nl5dis
Definition: w3gridmd.F90:894
w3gridmd::is2flexstr
real is2flexstr
Definition: w3gridmd.F90:728
w3gridmd::trckcmpr
logical trckcmpr
Definition: w3gridmd.F90:811
w3gridmd::ripfac3
real ripfac3
Definition: w3gridmd.F90:708
w3gridmd::sdsb0
real sdsb0
Definition: w3gridmd.F90:834
w3gridmd::igsource
integer igsource
Definition: w3gridmd.F90:747