WAVEWATCH III  beta 0.0.1
w3bullmd Module Reference

Module W3BULLMD. More...

Functions/Subroutines

subroutine w3bull (NPART, XPART, DIMXP, UABS, UD, IPNT, IOUT, TIMEV)
 Read a WAVEWATCH-III version 1.17 point output data file and produces a table of mean parameters for all individual wave systems. More...
 

Variables

integer, parameter nptab = 6
 
integer, parameter nfld = 50
 
integer, parameter npmax = 80
 
real, parameter bhsmin = 0.15
 
real, parameter bhsdrop = 0.05
 
real, dimension(nptab, 2) hst
 
real, dimension(nptab, 2) tpt
 
real, dimension(nptab, 2) dmt
 
character(len=129) ascbline
 
character(len=664) csvbline
 
character(len=67) cascbline
 
logical, dimension(npmaxiyy
 

Detailed Description

Module W3BULLMD.

Author
J. H. Alves
H. L. Tolman
Date
26-Dec-2012

Function/Subroutine Documentation

◆ w3bull()

subroutine w3bullmd::w3bull ( integer, intent(in)  NPART,
real, dimension(dimp,0:dimxp), intent(in)  XPART,
integer, intent(in)  DIMXP,
real, intent(in)  UABS,
real, intent(in)  UD,
integer  IPNT,
integer, intent(in)  IOUT,
integer, dimension(2), intent(inout)  TIMEV 
)

Read a WAVEWATCH-III version 1.17 point output data file and produces a table of mean parameters for all individual wave systems.

Partitioning is made using the built-in module w3partmd. Partitions are ranked and organized into coherent sequences that are then written as tables to output files. Input options for generating tables are defined in ww3_outp.inp. This module sorts the table data, output to file is controlled by WW3_OUTP.

Parameters
[in]NPART
[in]XPART
[in]DIMXP
[in]UABS
[in]UD
IPNT
[in]IOUT
[in,out]TIMEV
Author
J. H. Alves
H. L. Tolman
Date
11-Mar-2013

Definition at line 91 of file w3bullmd.F90.

91  !/
92  !/ +-----------------------------------+
93  !/ | WAVEWATCH-III NOAA/NCEP |
94  !/ | J. H. Alves |
95  !/ | H. L. Tolman |
96  !/ | FORTRAN 90 |
97  !/ | Last update : 11-Mar-2013 !
98  !/ +-----------------------------------+
99  !/
100  !/ 01-Apr-2010 : Origination. ( version 3.14 )
101  !/ 26-Dec-2012 : Modified obsolete declarations. ( version 4.11 )
102  !/ 15-Aug-2011 : Adjustments to version 4.05 ( version 4.05 )
103  !/ 11-Mar-2013 : Minor cleanup ( version 4.09 )
104  !/
105  ! 1. Purpose :
106  !
107  ! Read a WAVEWATCH-III version 1.17 point output data file and
108  ! produces a table of mean parameters for all individual wave
109  ! systems.
110  !
111  ! 2. Method :
112  !
113  ! Partitioning is made using the built-in module w3partmd. Partitions
114  ! are ranked and organized into coherent sequences that are then
115  ! written as tables to output files. Input options for generating
116  ! tables are defined in ww3_outp.inp. This module sorts the table
117  ! data, output to file is controlled by WW3_OUTP.
118  !
119  ! 3. Parameters :
120  !
121  ! Parameter list
122  ! ----------------------------------------------------------------
123  ! DHSMAX Real Max. change in Hs for system to be considered
124  ! related to previous time.
125  ! DTPMAX Real Id. Tp.
126  ! DDMMAX Real Id. Dm.
127  ! DDWMAX Real Maximum differences in wind and wave direction
128  ! for marking of system as under the influence
129  ! of the local wind,
130  ! AGEMIN Real Id. wave age.
131  ! ----------------------------------------------------------------
132  !
133  ! 4. Subroutines used :
134  !
135  ! Name Type Module Description
136  ! ----------------------------------------------------------------
137  ! STRACE Sur. W3SERVMD Subroutine tracing.
138  ! ----------------------------------------------------------------
139  !
140  ! 5. Called by :
141  !
142  ! WW3_OUTP
143  !
144  ! 6. Error messages :
145  !
146  ! Error control made in WW3_OUTP.
147  !
148  ! 7. Remarks :
149  !
150  ! Current version does not allow generating tables for multiple
151  ! points.
152  !
153  ! 8. Structure :
154  !
155  ! 9. Switches :
156  !
157  ! !/S Enable subroutine tracing.
158  ! !/T Enable test output
159  !
160  ! 10. Source code :
161  !
162  !/ ------------------------------------------------------------------- /
163  ! USE CONSTANTS
164 #ifdef W3_S
165  USE w3servmd, ONLY: strace
166 #endif
167  !
168  IMPLICIT NONE
169  !
170  !/
171  !/ ------------------------------------------------------------------- /
172  !/ Parameter list
173  !/
174  !/
175  !/ ------------------------------------------------------------------- /
176  !/ Local parameters
177  !/
178  !/
179  !
180  ! -------------------------------------------------------------------- /
181  ! 1. Initializations
182  !
183 #ifdef W3_S
184  INTEGER, SAVE :: IENT = 0
185 #endif
186  REAL :: DHSMAX, DTPMAX, &
187  DDMMAX, DDWMAX, AGEMIN
188  parameter( dhsmax = 1.50 )
189  parameter( dtpmax = 1.50 )
190  parameter( ddmmax = 15. )
191  parameter( ddwmax = 30. )
192  parameter( agemin = 0.8 )
193  INTEGER, INTENT(IN) :: NPART, DIMXP, IOUT
194  INTEGER, INTENT(INOUT) :: TIMEV(2)
195  REAL, INTENT(IN) :: UABS, &
196  UD, XPART(DIMP,0:DIMXP)
197  INTEGER :: IPG1,IPI(NPMAX), ILEN(NPMAX), IP, &
198  IPNOW, IFLD, INOTAB, IPNT, ITAB, &
199  DOUTP, FCSTI, NZERO
200  REAL :: AFR, AGE, DDMMAXR, DELDM, DELDMR, &
201  DELDW, DELHS, DELTP, DHSMAXR, &
202  DTPMAXR, HMAX, HSTOT, TP, UDIR, FACT
203  REAL :: HSP(NPMAX), TPP(NPMAX), &
204  DMP(NPMAX), WNP(NPMAX), HSD(NPMAX), &
205  TPD(NPMAX), WDD(NPMAX)
206  LOGICAL :: FLAG(NPMAX)
207  CHARACTER(LEN=129) :: BLANK, TAIL !, ASCBLINE
208 #ifdef W3_NCO
209  CHARACTER(LEN=67) :: CBLANK, CTAIL !, CASCBLINE
210 #endif
211  CHARACTER(LEN=15) :: PART
212 #ifdef W3_NCO
213  CHARACTER(LEN=9) :: CPART
214 #endif
215  CHARACTER(LEN=664) :: BLANK2 !,CSVBLINE
216  CHARACTER :: STIME*8,FORM*20,FORM1*2
217  CHARACTER(LEN=16) :: PART2
218  !/
219  !/ ------------------------------------------------------------------- /
220  !
221 #ifdef W3_S
222  CALL strace (ient, 'XXXXXX')
223 #endif
224  !
225  ! 1.a Constants etc.
226  !
227  ! Set FACT to proper scaling according to spherical or cartesian
228  IF ( flagll ) THEN
229  fact = 1.
230  ELSE
231  fact = 1.e-3
232  ENDIF
233  !
234  ! Convert wind direction to azimuthal reference
235  udir = mod( ud+180., 360. )
236  !
237  tail( 1: 40) = '+-------+-----------+-----------------+-'
238  tail( 41: 80) = '----------------+-----------------+-----'
239  tail( 81:120) = '------------+-----------------+---------'
240  tail(120:129) = '---------+'
241  blank( 1: 40) = '| nn nn | nn | | '
242  blank( 41: 80) = ' | | '
243  blank( 81:120) = ' | | '
244  blank(120:129) = ' |'
245  ascbline = blank
246 #ifdef W3_NCO
247  ctail( 1:40) = '----------------------------------------'
248  ctail(41:67) = '---------------------------'
249  cblank( 1:40) = ' '
250  cblank(41:67) = ' '
251  cascbline = cblank
252 #endif
253  !
254  blank2( 1: 40)=' , , , , , , , , '
255  blank2( 41: 88)=', , , , , , , , , '
256  blank2( 89:136)=', , , , , , , , , '
257  blank2(137:184)=', , , , , , , , , '
258  blank2(185:232)=', , , , , , , , , '
259  blank2(233:280)=', , , , , , , , , '
260  blank2(281:328)=', , , , , , , , , '
261  blank2(329:376)=', , , , , , , , , '
262  blank2(377:424)=', , , , , , , , , '
263  blank2(425:472)=', , , , , , , , , '
264  blank2(473:520)=', , , , , , , , , '
265  blank2(521:568)=', , , , , , , , , '
266  blank2(569:616)=', , , , , , , , , '
267  blank2(617:664)=', , , , , , , , , '
268  !
269  csvbline = blank2
270  !
271  ipg1 = 0
272  IF (iout .EQ. 1) THEN
273  DO ip=1, nptab
274  hst(ip,1) = -99.9
275  tpt(ip,1) = -99.9
276  dmt(ip,1) = -99.9
277  ENDDO
278  DO ip=1, npmax
279  iyy(ip) = .false.
280  ipi(ip)=1
281  ilen(ip)=0
282  ENDDO
283  ENDIF
284  !
285  ! 3. Get overall wave height ---------------------------------------- *
286  !
287  hstot = xpart(1,0)
288  tp = xpart(2,0)
289  DO ip=1, npart
290  hsp(ip) = xpart(1,ip)
291  tpp(ip) = xpart(2,ip)
292  wnp(ip) = tpi / xpart(3,ip)
293  dmp(ip) = mod( xpart(4,ip) + 180., 360.)
294  ENDDO
295 
296  nzero = 0
297  nzero = count( hsp <= bhsmin .AND. hsp /= 0. )
298  !
299  ! 4. Process all partial fields ------------------------------------- *
300  !
301  DO ip=npart+1, npmax
302  hsp(ip) = 0.00
303  tpp(ip) = -999.99
304  dmp(ip) = -999.99
305  ENDDO
306 
307  DO ip=1, nptab
308  hst(ip,2) = hst(ip,1)
309  tpt(ip,2) = tpt(ip,1)
310  dmt(ip,2) = dmt(ip,1)
311  hst(ip,1) = -1.
312  tpt(ip,1) = -1.
313  dmt(ip,1) = -1.
314  ENDDO
315  !
316  ! 5. Generate output table ------------------------------------------ *
317  ! 5.a Time and overall wave height to string
318  !
319  ascbline = blank
320  csvbline = blank2
321 #ifdef W3_NCO
322  cascbline = cblank
323 #endif
324  !
325  ! Fill the variable forecast time with hrs relative to reference time
326  IF ( timev(1) .LE. 0 ) timev = time
327  fcsti = dsec21(timev, time) / 3600
328  WRITE(csvbline(1:4),'(I4)')fcsti
329  !
330  DO ifld=1,nptab
331  iyy(ifld)=.false.
332  ENDDO
333  !
334  ! ... write the time labels for current table line
335  WRITE (csvbline(6:9),'(I4)') int(time(1)/10000)
336  WRITE (csvbline(11:12),'(I2)') &
337  int(time(1)/100)-100*int(time(1)/10000)
338  WRITE (csvbline(14:15),'(I2)') mod(time(1),100)
339  WRITE (csvbline(17:18),'(I2)') time(2)/10000
340  WRITE (csvbline(20:24),'(F5.2)') uabs
341  WRITE (csvbline(26:28),'(I3)') int(udir)
342  IF ( hstot .GT. 0. ) WRITE (csvbline(30:34),'(F5.2)') hstot
343  IF ( hstot .GT. 0. ) WRITE (csvbline(36:40),'(F5.2)') tp
344  !
345  WRITE (ascbline(3:4),'(I2)') mod(time(1),100)
346  WRITE (ascbline(6:7),'(I2)') time(2)/10000
347  !
348  IF ( hstot .GT. 0. ) WRITE (ascbline(10:14),'(F5.2)') hstot
349  WRITE (ascbline(16:17),'(I2)') npart - nzero
350  !
351 #ifdef W3_NCO
352  WRITE (cascbline(1:2),'(I2.2)') mod(time(1),100)
353  WRITE (cascbline(3:4),'(I2.2)') time(2)/10000
354  IF ( hstot .GT. 0. ) WRITE (cascbline(6:7),'(I2)') nint(hstot/0.3048)
355 #endif
356  !
357  IF ( npart.EQ.0 .OR. hstot.LT.0.1 ) GOTO 699
358  !
359  ! 5.b Switch off peak with too low wave height
360  !
361  DO ip=1, npart
362  flag(ip) = hsp(ip) .GT. bhsmin
363  ENDDO
364  !
365  ! 5.c Find next highest wave height
366  !
367  inotab = 0
368  !
369 601 CONTINUE
370  !
371  hmax = 0.
372  ipnow = 0
373  DO ip=1, npart
374  IF ( hsp(ip).GT.hmax .AND. flag(ip) ) THEN
375  ipnow = ip
376  hmax = hsp(ip)
377  ENDIF
378  ENDDO
379  !
380  ! 5.d No more peaks, skip to output
381  !
382  IF ( ipnow .EQ. 0 ) GOTO 699
383  !
384  ! 5.e Find matching field
385  !
386  itab = 0
387  !
388  DO ip=1, nptab
389  IF ( tpt(ip,2) .GT. 0. ) THEN
390  !
391  delhs = abs( hst(ip,2) - hsp(ipnow) )
392  deltp = abs( tpt(ip,2) - tpp(ipnow) )
393  deldm = abs( dmt(ip,2) - dmp(ipnow) )
394  IF ( deldm .GT. 180. ) deldm = 360. - deldm
395  IF ( delhs.LT.dhsmax .AND. &
396  deltp.LT.dtpmax .AND. &
397  deldm.LT.ddmmax ) itab = ip
398  !
399  ENDIF
400  ENDDO
401  !
402  ! 5.f No matching field, find empty fields
403  !
404  IF ( itab .EQ. 0 ) THEN
405  DO ip=nptab, 1, -1
406  IF ( tpt(ip,1).LT.0. .AND. tpt(ip,2).LT.0. ) &
407  itab = ip
408  ENDDO
409  ENDIF
410  !
411  ! 5.g Slot in table found, write
412  !
413  ! Remove clear windseas
414  !
415  IF ( itab .NE. 0 ) THEN
416  !
417  WRITE (part,'(1X,F5.2,F5.1,I4)') &
418  hsp(ipnow), tpp(ipnow), nint(dmp(ipnow))
419 #ifdef W3_NCO
420  WRITE (cpart,'(I2,1X,I2.2,1X,I3.3)') &
421  nint(hsp(ipnow)/0.3048), &
422  nint(tpp(ipnow)), &
423  nint(mod(dmp(ipnow)+180.,360.))
424 #endif
425  deldw = mod( abs( udir - dmp(ipnow) ) , 360. )
426  IF ( deldw .GT. 180. ) deldw = 360. - deldw
427  afr = 2.*pi/tpp(ipnow)
428  age = uabs * wnp(ipnow) / afr
429  IF ( deldw.LT.ddwmax .AND. age.GT.agemin ) part(1:1) = '*'
430  !
431  ascbline(5+itab*18:19+itab*18) = part
432 #ifdef W3_NCO
433  cascbline(itab*10-1:itab*10+7) = cpart
434 #endif
435  !
436  DO ifld=1,nptab
437  IF(itab.EQ.ifld)THEN
438  iyy(ifld)=.true.
439  hsd(ifld)=hsp(ipnow)
440  tpd(ifld)=tpp(ipnow)
441  wdd(ifld)=nint(dmp(ipnow))
442  ENDIF
443  ENDDO
444  !
445  hst(itab,1) = hsp(ipnow)
446  tpt(itab,1) = tpp(ipnow)
447  dmt(itab,1) = dmp(ipnow)
448 
449  !
450  ! 5.h No slot in table found, write
451  !
452  ELSE
453  !
454  inotab = inotab + 1
455  WRITE (ascbline(19:19),'(I1)') inotab
456  !
457  ENDIF
458  !
459  flag(ipnow) = .false.
460  GOTO 601
461  !
462  ! 5.i End of processing, write line in table
463  !
464 699 CONTINUE
465  !
466  DO ifld=1,nptab
467  IF(iyy(ifld))THEN
468  ilen(ifld)=ilen(ifld)+1
469  IF (ilen(ifld).EQ.1)THEN
470  ipi(ifld)=ipg1+1
471  ipg1=ipg1+1
472  ENDIF
473  WRITE (part2,'(",",F5.2,",",F5.2,",",I3)') &
474  hsd(ifld), tpd(ifld), nint(wdd(ifld))
475  csvbline(25+ipi(ifld)*16:40+ipi(ifld)*16) = part2
476  ELSE
477  ilen(ifld)=0
478  ENDIF
479  ENDDO
480  !
481  RETURN
482  !/
483  !/ End of W3BULL ----------------------------------------------------- /
484  !/

References ascbline, bhsmin, cascbline, csvbline, dmt, w3timemd::dsec21(), w3gdatmd::flagll, hst, iyy, nptab, constants::pi, w3servmd::strace(), w3wdatmd::time, constants::tpi, and tpt.

Referenced by w3expo().

Variable Documentation

◆ ascbline

character(len=129) w3bullmd::ascbline

Definition at line 50 of file w3bullmd.F90.

50  CHARACTER(LEN=129) :: ASCBLINE

Referenced by w3bull(), and w3outp().

◆ bhsdrop

real, parameter w3bullmd::bhsdrop = 0.05

Definition at line 47 of file w3bullmd.F90.

Referenced by w3outp().

◆ bhsmin

real, parameter w3bullmd::bhsmin = 0.15

Definition at line 47 of file w3bullmd.F90.

47  REAL, PARAMETER :: BHSMIN = 0.15, bhsdrop = 0.05

Referenced by w3bull(), and w3outp().

◆ cascbline

character(len=67) w3bullmd::cascbline

Definition at line 53 of file w3bullmd.F90.

53  CHARACTER(LEN=67) :: CASCBLINE

Referenced by w3bull(), and w3outp().

◆ csvbline

character(len=664) w3bullmd::csvbline

Definition at line 51 of file w3bullmd.F90.

51  CHARACTER(LEN=664) :: CSVBLINE

Referenced by w3bull(), and w3outp().

◆ dmt

real, dimension(nptab,2) w3bullmd::dmt

Definition at line 48 of file w3bullmd.F90.

Referenced by w3bull(), and w3outp().

◆ hst

real, dimension(nptab,2) w3bullmd::hst

Definition at line 48 of file w3bullmd.F90.

48  REAL :: HST(NPTAB,2), TPT(NPTAB,2), &
49  DMT(NPTAB,2)

Referenced by w3bull(), and w3outp().

◆ iyy

logical, dimension(npmax) w3bullmd::iyy

Definition at line 55 of file w3bullmd.F90.

55  LOGICAL :: IYY(NPMAX)

Referenced by w3bull(), and w3outp().

◆ nfld

integer, parameter w3bullmd::nfld = 50

Definition at line 45 of file w3bullmd.F90.

Referenced by w3outp().

◆ npmax

integer, parameter w3bullmd::npmax = 80

Definition at line 45 of file w3bullmd.F90.

Referenced by w3outp().

◆ nptab

integer, parameter w3bullmd::nptab = 6

Definition at line 45 of file w3bullmd.F90.

45  INTEGER, PARAMETER :: NPTAB = 6, nfld = 50, npmax = 80

Referenced by w3bull(), and w3outp().

◆ tpt

real, dimension(nptab,2) w3bullmd::tpt

Definition at line 48 of file w3bullmd.F90.

Referenced by w3bull(), and w3outp().

w3timemd::dsec21
real function dsec21(TIME1, TIME2)
Definition: w3timemd.F90:333
w3servmd
Definition: w3servmd.F90:3
m_constants::pi
real pi
circular constant, 3.1415...
Definition: mod_constants.f90:29
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148