WAVEWATCH III  beta 0.0.1
w3iotrmd Module Reference

Generate track output. More...

Functions/Subroutines

subroutine w3iotr (NDSINP, NDSOUT, A, IMOD)
 Perform output of spectral information along provided tracks. More...
 

Detailed Description

Generate track output.

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

Function/Subroutine Documentation

◆ w3iotr()

subroutine w3iotrmd::w3iotr ( integer, intent(in)  NDSINP,
integer, intent(in)  NDSOUT,
real, dimension(nth,nk,0:nseal), intent(in)  A,
integer, intent(in)  IMOD 
)

Perform output of spectral information along provided tracks.

     Time and location data for the track is read from the file
     track_i.FILEXT, and output spectra additional information are
     written to track_o.FILEXT.

     The spectrum dumped is the frequency-direction spectrum in
     m**2/Hz/rad.

     The output spectra are energy density spectra in terms of the
     true frequency and a direction in radians. The corresponding
     band widths are part of the file header.
Parameters
[in,out]NDSINPUnit number of input file track_i.FILEXT.
[in,out]NDSOUTUnit number of output file track_o.FILEXT.
[in,out]ASpectra (shape conversion through par list).
[in,out]IMODModel grid number.
Author
H. L. Tolman
Date
08-Jun-2018

Definition at line 105 of file w3iotrmd.F90.

105  !/
106  !/ +-----------------------------------+
107  !/ | WAVEWATCH III NOAA/NCEP |
108  !/ | H. L. Tolman |
109  !/ | FORTRAN 90 |
110  !/ | Last update : 08-Jun-2018 |
111  !/ +-----------------------------------+
112  !/
113  !/ 22-Dec-1998 : Final FORTRAN 77 ( version 1.18 )
114  !/ 27-Dec-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
115  !/ 24-Jan-2001 : Flat grid version ( version 2.06 )
116  !/ 20-Aug-2003 : Output through NAPTRK, seq. file. ( version 3.04 )
117  !/ 24-Nov-2004 : Multiple grid version. ( version 3.06 )
118  !/ 04-May-2005 : Change to MPI_COMM_WAVE. ( version 3.07 )
119  !/ 27-Jun-2005 : Adding MAPST2, ( version 3.07 )
120  !/ 27-Jun-2006 : Adding file name preamble. ( version 3.09 )
121  !/ 17-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
122  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
123  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
124  !/ (W. E. Rogers & T. J. Campbell, NRL)
125  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
126  !/ (W. E. Rogers & T. J. Campbell, NRL)
127  !/ 06-Dec-2010 : Change from GLOBAL (logical) to ICLOSE (integer) to
128  !/ specify index closure for a grid. ( version 3.14 )
129  !/ (T. J. Campbell, NRL)
130  !/ 26-Dec-2012 : Initialize ASPTRK. ( version 4.11 )
131  !/ 12-Dec-2014 : Modify instanciation of NRQTR ( version 5.04 )
132  !/ 08-Jun-2018 : use W3PARALL/INIT_GET_JSEA_ISPROC ( version 6.04 )
133  !/
134  !/ Copyright 2009-2014 National Weather Service (NWS),
135  !/ National Oceanic and Atmospheric Administration. All rights
136  !/ reserved. WAVEWATCH III is a trademark of the NWS.
137  !/ No unauthorized use without permission.
138  !/
139  ! 1. Purpose :
140  !
141  ! Perform output of spectral information along provided tracks.
142  !
143  ! 2. Method :
144  !
145  ! Time and location data for the track is read from the file
146  ! track_i.FILEXT, and output spectra additional information are
147  ! written to track_o.FILEXT.
148  !
149  ! The spectrum dumped is the frequency-direction spectrum in
150  ! m**2/Hz/rad.
151  !
152  ! The output spectra are energy density spectra in terms of the
153  ! true frequency and a direction in radians. The corresponding
154  ! band widths are part of the file header.
155  !
156  ! 3. Parameters :
157  !
158  ! Parameter list
159  ! ----------------------------------------------------------------
160  ! NDSINP Int. I Unit number of input file track_i.FILEXT
161  ! If negative, file is unformatted and v.v.
162  ! NDSOUT Int. I Unit number of output file track_o.FILEXT
163  ! A R.A. I Spectra (shape conversion through par list).
164  ! IMOD Int. I Model grid number.
165  ! ----------------------------------------------------------------
166  !
167  ! 4. Subroutines used :
168  !
169  ! See module documentation.
170  !
171  ! 5. Called by :
172  !
173  ! Name Type Module Description
174  ! ----------------------------------------------------------------
175  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
176  ! ----------------------------------------------------------------
177  !
178  ! 6. Error messages :
179  !
180  ! - If input file not found, a warning is printed and output
181  ! type is disabled.
182  !
183  ! 8. Structure :
184  !
185  ! See source code.
186  !
187  ! 9. Switches :
188  !
189  ! !/SHRD Switch for shared / distributed memory architecture.
190  ! !/DIST Id.
191  ! !/MPI MPI interface routines.
192  !
193  ! !/S Enable subroutine tracing.
194  ! !/T General test output.
195  ! !/T1 Test output on track point status.
196  ! !/T2 Test output of mask arrays.
197  ! !/T3 Test output for writing of file.
198  !
199  ! 10. Remarks :
200  !
201  ! Regarding section 3.e.2 "Optimize: omit points that are not
202  ! strictly required.". This optimization saves disk space but
203  ! results in output files that are more difficult to use. For
204  ! example, matlab built-in function "griddata" requires all four
205  ! bounding points. This means that a post-processing code must
206  ! have extra logic do deal with cases without all four bounding
207  ! points (interpolation along a line, or nearest neighbor).
208  ! A namelist variable has been add to make this feature optional.
209  ! Default, original behavior: TRCKCMPR = T (in /MISC/ namelist).
210  ! Save all points: TRCKCMPR = F (in /MISC/ namelist).
211  ! Within the present routine, the logical is named "CMPRTRCK".
212  !
213  ! 11. Source code :
214  !
215  !/ ------------------------------------------------------------------- /
216  USE constants
217  !/
218  USE w3gdatmd, ONLY: w3setg, cmprtrck
219  USE w3wdatmd, ONLY: w3setw
220  USE w3adatmd, ONLY: w3seta
221  USE w3odatmd, ONLY: w3seto, w3dmo3
222  !/
223  USE w3gdatmd, ONLY: nk, nth, nspec, nsea, nseal, nx, ny, &
224  flagll, iclose, xgrd, ygrd, gsu, &
225  dpdx, dpdy, dqdx, dqdy, mapsta, mapst2, &
226  mapfs, th, dth, sig, dsip, xfr, filext
227  USE w3gsrumd, ONLY: w3gfcl
228 #ifdef W3_T
229  USE w3gsrumd, ONLY: w3gsup
230 #endif
231  USE w3gdatmd, ONLY: maxx, maxy, gtype, ungtype
232  USE w3wdatmd, ONLY: time, ust
233  USE w3adatmd, ONLY: cg, dw, cx, cy, ua, ud, as
234 #ifdef W3_MPI
235  USE w3adatmd, ONLY: mpi_comm_wave
236 #endif
237  USE w3odatmd, ONLY: ndst, ndse, iaproc, naproc, naptrk, naperr, &
238  ipass => ipass3, atolast => tolast, &
239  adtout => dtout, o3init, stop, mask1, &
241 #ifdef W3_MPI
242  USE w3odatmd, ONLY: it0trk, nrqtr, irqtr
243 #endif
244  !/
245  USE w3timemd
246  USE w3parall, ONLY : init_get_jsea_isproc
247  USE w3servmd, ONLY : strsplit
248 #ifdef W3_S
249  USE w3servmd, ONLY: strace
250 #endif
251  !
252  IMPLICIT NONE
253  !
254 #ifdef W3_MPI
255  include "mpif.h"
256 #endif
257  !/
258  !/ ------------------------------------------------------------------- /
259  !/ Parameter list
260  !/
261  INTEGER, INTENT(IN) :: NDSINP, NDSOUT, IMOD
262  REAL, INTENT(IN) :: A(NTH,NK,0:NSEAL)
263  !/
264  !/ ------------------------------------------------------------------- /
265  !/ Local parameters
266  !/
267  INTEGER, PARAMETER :: OTYPE = 3
268  INTEGER :: NDSTI, NDSTO, ISPROC, IERR, &
269  IK, ITH, IX, IY, TIMEB(2), TIMEE(2), &
270  TTIME(2), IX1, IX2, IY1, IY2, &
271  IXX(4), IYY(4), I, J, ISEA, JSEA, &
272  TOLAST(2)
273 #ifdef W3_S
274  INTEGER, SAVE :: IENT = 0
275 #endif
276 #ifdef W3_T
277  INTEGER :: NREAD, NTRACK, NSPECO, NLOCO
278 #endif
279 #ifdef W3_T3
280  INTEGER :: ISPT
281 #endif
282 #ifdef W3_MPI
283  INTEGER :: IT, IROOT, IFROM, IERR_MPI
284  INTEGER, ALLOCATABLE :: STATUS(:,:)
285 #endif
286  REAL :: XN, YN, XT, YT, RD, X, Y, WX, WY, &
287  SPEC(NK,NTH), FACTOR, ASPTRK(NTH,NK),&
288  DTOUT, XX(4), YY(4)
289  REAL, SAVE :: RDCHCK = 0.05, rtchck = 0.05
290  LOGICAL :: FORMI, FLAG1, FLAG2, INGRID
291  CHARACTER :: TRCKT*32, LINE*1024, TSTSTR*3, IDTST*34
292  CHARACTER(LEN=100) :: LIST(5)
293 #ifdef W3_T1
294  CHARACTER(LEN=17), SAVE :: TSTLOC = ' '
295 #endif
296 #ifdef W3_T2
297  CHARACTER(LEN=1) :: MAPSTR(NX)
298 #endif
299  !
300  equivalence(ixx(1),ix1) , (ixx(2),ix2) , &
301  (iyy(1),iy1) , (iyy(3),iy2)
302  !/
303  !/ ------------------------------------------------------------------- /
304  !/
305 #ifdef W3_S
306  CALL strace (ient, 'W3IOTR')
307 #endif
308  !
309  CALL w3seto ( imod, ndse, ndst )
310  CALL w3setg ( imod, ndse, ndst )
311  CALL w3seta ( imod, ndse, ndst )
312  CALL w3setw ( imod, ndse, ndst )
313  !
314  tolast = atolast(:,otype)
315  dtout = adtout(otype)
316  !
317  IF ( .NOT. o3init ) CALL w3dmo3 ( imod, ndse, ndst )
318  !
319  formi = ndsinp .GT. 0
320  ndsti = abs(ndsinp)
321  ndsto = abs(ndsout)
322 
323  IF (gtype .EQ. ungtype) THEN
324  xn = maxx
325  yn = maxy
326  ENDIF
327  !
328  isproc = iaproc
329  ipass = ipass + 1
330  !
331  IF ( flagll ) THEN
332  factor = 1.
333  ELSE
334  factor = 1.e-3
335  END IF
336  !
337  asptrk = 0.
338  !
339 #ifdef W3_T
340  WRITE (ndst,9000) time
341 #endif
342  !
343 #ifdef W3_MPI
344  IF ( nrqtr .NE. 0 ) THEN
345  CALL mpi_startall ( nrqtr, irqtr, ierr_mpi )
346  ALLOCATE ( status(mpi_status_size,nrqtr) )
347  CALL mpi_waitall ( nrqtr, irqtr , status, ierr_mpi )
348  DEALLOCATE ( status )
349  END IF
350 #endif
351  !
352  ! 1. First pass through routine ------------------------------------- *
353  !
354  IF ( ipass .EQ. 1 ) THEN
355  !
356 #ifdef W3_T
357  WRITE (ndst,9010) tolast, dtout, ndsti, ndsto, formi
358 #endif
359  ! Removed by F.A. 2010/12/24 /T CALL W3GSUP ( GSU, NDST )
360  !
361  i = len_trim(filext)
362  j = len_trim(fnmpre)
363  !
364  ! 1.a Open input file
365  !
366  IF ( formi ) THEN
367 #ifdef W3_T
368  WRITE (ndst,9011) fnmpre(:j)//'track_i.'//filext(:i), &
369  'FORMATTED'
370 #endif
371  OPEN (ndsti,file=fnmpre(:j)//'track_i.'//filext(:i), &
372  status='OLD',err=800,form='FORMATTED',iostat=ierr)
373  READ (ndsti,'(A)',err=801,END=802,IOSTAT=IERR) idtst
374  ELSE
375 #ifdef W3_T
376  WRITE (ndst,9011) fnmpre(:j)//'track_i.'//filext(:i), &
377  'UNFORMATTED'
378 #endif
379  OPEN (ndsti,file=fnmpre(:j)//'track_i.'//filext(:i), &
380  status='OLD',err=800,form='UNFORMATTED', convert=file_endian,iostat=ierr)
381  READ (ndsti,err=801,END=802,IOSTAT=IERR) idtst
382  END IF
383  !
384  IF ( idtst .NE. idstri ) GOTO 803
385  !
386  ! 1.b Open output file
387  !
388  IF ( iaproc .EQ. naptrk ) THEN
389 #ifdef W3_T
390  WRITE (ndst,9012) fnmpre(:j)//'track_o.'//filext(:i), &
391  'UNFORMATTED'
392 #endif
393  OPEN (ndsto,file=fnmpre(:j)//'track_o.'//filext(:i), &
394  form='UNFORMATTED', convert=file_endian,err=810,iostat=ierr)
395  WRITE (ndsto,err=811,iostat=ierr) idstro, flagll, nk, &
396  nth, xfr
397  WRITE (ndsto,err=811,iostat=ierr) 0.5*pi-th(1), -dth, &
398  (sig(ik)*tpiinv,ik=1,nk), &
399  (dsip(ik)*tpiinv,ik=1,nk)
400  END IF
401  !
402  ! 1.c Initialize maps
403  !
404 #ifdef W3_T
405  WRITE (ndst,9015)
406 #endif
407  !
408  mask2 = .false.
409  trckid = ''
410  !
411  END IF
412  !
413  ! 2. Preparations --------------------------------------------------- *
414  ! 2.a Shift mask arrays
415  !
416 #ifdef W3_T
417  WRITE (ndst,9020)
418 #endif
419  !
420  mask1 = mask2
421  mask2 = .false.
422  !
423  ! 2.b Set time frame
424  !
425  timeb = time
426  timee = time
427  CALL tick21 ( timee , dtout )
428  !
429  IF ( dsec21(timee,tolast) .LT. 0. ) THEN
430  timee = tolast
431 #ifdef W3_T
432  WRITE (ndst,9022)
433 #endif
434  END IF
435  !
436 #ifdef W3_T
437  WRITE (ndst,9021) timeb, timee
438 #endif
439  !
440  ! 3. Loop over input points ----------------------------------------- *
441  !
442 #ifdef W3_T
443  nread = 0
444  ntrack = 0
445 #endif
446  !
447  ! 3.a Read new track point (infinite loop)
448  !
449  IF ( stop ) THEN
450  tolast = time
451 #ifdef W3_T
452  WRITE (ndst,9034)
453 #endif
454  GOTO 399
455  END IF
456  !
457 #ifdef W3_T1
458  WRITE (ndst,9030)
459 #endif
460  !
461  DO
462  !
463  IF ( formi ) THEN
464  READ (ndsti,'(A)',err=801,END=390,IOSTAT=IERR) line
465  list(:)=''
466  CALL strsplit(line,list)
467  READ(list(1),'(I8)') ttime(1)
468  READ(list(2),'(I6)') ttime(2)
469  READ(list(3),*) xt
470  READ(list(4),*) yt
471  IF(SIZE(list).GE.5) trckt=list(5)
472  ELSE
473  READ (ndsti, err=801,END=390,IOSTAT=IERR) TTIME, XT, YT, trckt
474  END IF
475 #ifdef W3_T
476  nread = nread + 1
477 #endif
478  !
479  ! 3.b Point before time interval
480  !
481  IF ( dsec21(timeb,ttime) .LT. 0. ) THEN
482 #ifdef W3_T1
483  WRITE (ndst,9031) ttime,factor*xt,factor*yt,'TOO EARLY'
484 #endif
485  cycle
486  END IF
487  !
488  ! 3.c Point after time interval
489  !
490  IF ( dsec21(timee,ttime) .GT. 0. ) THEN
491  backspace(ndsti)
492 #ifdef W3_T
493  nread = nread - 1
494 #endif
495 #ifdef W3_T1
496  WRITE (ndst,9031) ttime,factor*xt,factor*yt,'TOO LATE'
497 #endif
498  GOTO 399
499  END IF
500  !
501  ! 3.d Check time in interval
502  !
503  flag1 = dsec21(ttime,timee) .GT. rtchck*dtout
504  flag2 = dsec21(timeb,ttime) .GT. rtchck*dtout
505  !
506  ! 3.e Check point coordinates
507  !
508 
509  ! 3.e.1 Initial identification of computational grid points to include.
510  !
511  ! Find cell that encloses target point (note that the returned
512  ! cell corner indices are adjusted for global wrapping and the
513  ! coordinates are adjusted to avoid branch cut crossings)
514  ingrid = w3gfcl( gsu, xt, yt, ixx, iyy, xx, yy )
515  IF ( .NOT. ingrid ) THEN
516 #ifdef W3_T1
517  WRITE (ndst,9031) ttime, factor*xt, factor*yt, &
518  'OUT OF GRID'
519 #endif
520  cycle
521  END IF
522  !
523  ! Change cell-corners from counter-clockwise to column-major order
524  ix = ixx(4); iy = iyy(4);
525  ixx(4) = ixx(3); iyy(4) = iyy(3);
526  ixx(3) = ix; iyy(3) = iy;
527  !
528  ! 3.e.2 Optimize: omit points that are not strictly required.
529  ! See "Remarks"
530 
531  IF(cmprtrck)THEN ! perform track compression
532 
533  ! Project onto I-axis
534  rd = dpdx(iyy(1),ixx(1))*(xt-xx(1)) &
535  + dpdy(iyy(1),ixx(1))*(yt-yy(1))
536  !
537  ! Collapse to left or right if within tolerance
538  IF ( rd .LT. rdchck ) THEN
539  ixx(2) = ixx(1)
540  ixx(4) = ixx(3)
541  ELSE IF ( rd .GT. 1.-rdchck ) THEN
542  ixx(1) = ixx(2)
543  ixx(3) = ixx(4)
544  END IF
545  !
546  ! Project onto J-axis
547  rd = dqdx(iyy(1),ixx(1))*(xt-xx(1)) &
548  + dqdy(iyy(1),ixx(1))*(yt-yy(1))
549  !
550  ! Collapse to top or bottom if within tolerance
551  IF ( rd .LT. rdchck ) THEN
552  iyy(3) = iyy(1)
553  iyy(4) = iyy(2)
554  ELSE IF ( rd .GT. 1.-rdchck ) THEN
555  iyy(1) = iyy(3)
556  iyy(2) = iyy(4)
557  END IF
558 
559  END IF ! IF(CMPRTRCK)THEN
560  !
561  ! 3.f Mark the four corner points
562  !
563  DO j=1, 4
564  !
565  ix = ixx(j)
566  iy = iyy(j)
567  IF(gtype .EQ. ungtype) THEN
568  x = xgrd(1,ix)
569  y = ygrd(1,ix)
570  ENDIF
571  mask1(iy,ix) = mask1(iy,ix) .OR. flag1
572  mask2(iy,ix) = mask2(iy,ix) .OR. flag2
573  trckid(iy,ix) = trckt
574  !
575 #ifdef W3_T1
576  IF ( mapsta(iy,ix) .EQ. 0 ) THEN
577  IF ( mapst2(iy,ix) .EQ. 0 ) THEN
578  tstloc(4*j-3:4*j-1) = 'LND'
579  ELSE
580  tstloc(4*j-3:4*j-1) = 'XCL'
581  END IF
582  ELSE IF ( mapsta(iy,ix) .LT. 0 ) THEN
583  IF ( mapst2(iy,ix) .EQ. 1 ) THEN
584  tstloc(4*j-3:4*j-1) = 'ICE'
585  ELSE IF ( mapst2(iy,ix) .EQ. 2 ) THEN
586  tstloc(4*j-3:4*j-1) = 'DRY'
587  ELSE
588  tstloc(4*j-3:4*j-1) = 'DIS'
589  END IF
590  ELSE IF ( mapsta(iy,ix) .GT. 0 ) THEN
591  tstloc(4*j-3:4*j-1) = 'SEA'
592  END IF
593 #endif
594  !
595  END DO
596  !
597 #ifdef W3_T1
598  WRITE (ndst,9031) ttime, factor*xt, factor*yt, tstloc, &
599  ixx(1), ixx(2), iyy(1), iyy(3), flag1, flag2
600 #endif
601  !
602 #ifdef W3_T
603  ntrack = ntrack + 1
604 #endif
605  !
606  END DO
607  !
608  ! 3.g End of input file escape location
609  !
610 390 CONTINUE
611 #ifdef W3_T
612  WRITE (ndst,9033)
613 #endif
614  stop = .true.
615  !
616  ! 3.h Read end escape location
617  !
618 399 CONTINUE
619  !
620  ! 3.h Mask test output
621  !
622 #ifdef W3_T2
623  WRITE (ndst,9035)
624  DO iy=ny,1,-1
625  DO ix=1, nx
626  IF ( mask1(iy,ix) ) THEN
627  mapstr(ix) = 'X'
628  ELSE IF ( mask2(iy,ix) ) THEN
629  mapstr(ix) = 'x'
630  ELSE
631  mapstr(ix) = '.'
632  END IF
633  END DO
634  WRITE (ndst,9036) mapstr
635  END DO
636 #endif
637  !
638  ! 4. Write data for flagged locations ------------------------------- *
639  !
640 #ifdef W3_T
641  nloco = 0
642  nspeco = 0
643 #endif
644 #ifdef W3_MPI
645  it = it0trk
646  iroot = naptrk - 1
647  ALLOCATE ( status(mpi_status_size,1) )
648 #endif
649  !
650  DO iy=1, ny
651  DO ix=1, nx
652  IF ( mask1(iy,ix) ) THEN
653  !
654  IF(gtype .EQ. ungtype) THEN
655  x = xgrd(1,ix)
656  y = ygrd(1,ix)
657  ELSE
658  x = xgrd(iy,ix)
659  y = ygrd(iy,ix)
660  ENDIF
661 #ifdef W3_MPI
662  it = it + 1
663 #endif
664 #ifdef W3_T
665  nloco = nloco + 1
666 #endif
667  !
668  ! 4.a Status of point
669  !
670  IF ( mapsta(iy,ix) .EQ. 0 ) THEN
671  IF ( mapst2(iy,ix) .EQ. 0 ) THEN
672  tststr = 'LND'
673  ELSE
674  tststr = 'XCL'
675  END IF
676  ELSE IF ( mapsta(iy,ix) .LT. 0 ) THEN
677  IF ( mapst2(iy,ix) .EQ. 1 ) THEN
678  tststr = 'ICE'
679  ELSE IF ( mapst2(iy,ix) .EQ. 2 ) THEN
680  tststr = 'DRY'
681  ELSE
682  tststr = 'DIS'
683  END IF
684  ELSE
685  tststr = 'SEA'
686  END IF
687  !
688 #ifdef W3_T
689  IF ( tststr .EQ. 'SEA' ) nspeco = nspeco + 1
690 #endif
691  !
692  ! 4.b Determine where point is stored
693  ! ( land point assumed stored on IAPROC = NAPTRK
694  ! set to -99 in test output )
695  !
696  isea = mapfs(iy,ix)
697  IF ( isea .EQ. 0 ) THEN
698  isproc = naptrk
699 #ifdef W3_T3
700  ispt = -99
701 #endif
702  ELSE
703  CALL init_get_jsea_isproc(isea, jsea, isproc)
704 #ifdef W3_T3
705  ispt = isproc
706 #endif
707  END IF
708 #ifdef W3_MPI
709  ifrom = isproc - 1
710 #endif
711  ! 4.c Spectrum is at local processor, but this is not the NAPTRK
712  ! Send the spectrum to NAPTRK
713 
714  IF ( isproc.EQ.iaproc .AND. iaproc.NE.naptrk ) THEN
715 #ifdef W3_T3
716  WRITE (ndst,9040) ix, iy, isea, ispt, 'SENDING'
717 #endif
718 #ifdef W3_MPI
719  CALL mpi_send ( a(1,1,jsea), nspec, mpi_real, &
720  iroot, it, mpi_comm_wave, ierr_mpi )
721 #endif
722  END IF
723  !
724  ! 4.d This is NAPTRK, perform all output
725  !
726  IF ( iaproc .EQ. naptrk ) THEN
727  !
728  ! 4.e Sea point, prepare data
729  !
730  IF ( tststr .EQ. 'SEA' ) THEN
731  !
732  wx = ua(isea) * cos(ud(isea))
733  wy = ua(isea) * sin(ud(isea))
734  !
735  ! ..... Local spectra
736  !
737  IF ( iaproc .EQ. isproc ) THEN
738  DO ik=1, nk
739  DO ith=1, nth
740  spec(ik,ith) = &
741  tpi*a(ith,ik,jsea)*sig(ik)/cg(ik,isea)
742  END DO
743  END DO
744  !
745  ! ..... Non-local spectra
746  !
747  ELSE
748 #ifdef W3_T3
749  WRITE (ndst,9040) ix, iy, isea, ispt, &
750  'RECEIVING'
751 #endif
752 #ifdef W3_MPI
753  CALL mpi_recv (asptrk, nspec, mpi_real,&
754  ifrom, it, mpi_comm_wave, &
755  status, ierr_mpi )
756 #endif
757  !
758  DO ik=1, nk
759  DO ith=1, nth
760  spec(ik,ith) = &
761  tpi*asptrk(ith,ik)*sig(ik)/cg(ik,isea)
762  END DO
763  END DO
764  END IF
765  !
766  ! 4.e Sea point, write general data + spectrum
767  !
768  WRITE (ndsto,err=811,iostat=ierr) &
769  time, x, y, tststr, trckid(iy,ix)
770  WRITE (ndsto,err=811,iostat=ierr) &
771  dw(isea), cx(isea), cy(isea), wx, wy, &
772  ust(isea), as(isea), spec
773  !
774  ! 4.f Non-sea point, write
775  !
776  ELSE
777  WRITE (ndsto,err=811,iostat=ierr) &
778  time, x, y, tststr, trckid(iy,ix)
779  !
780  ! ..... Sea and non-sea points processed
781  !
782  END IF
783  !
784  ! ..... End of action at NAPTRK
785  !
786 #ifdef W3_T3
787  WRITE (ndst,9040) ix, iy, isea, ispt, 'WRITTEN', time
788 #endif
789  END IF
790  !
791  ! ..... Close IF for mask flag (top section 4)
792  !
793  END IF
794  !
795  ! ..... End of loop over map
796  !
797  END DO
798  END DO
799  !
800 #ifdef W3_MPI
801  DEALLOCATE ( status )
802 #endif
803  !
804 #ifdef W3_T
805  WRITE (ndst,9090) ntrack, nread, nspeco, nloco
806 #endif
807  !
808  GOTO 888
809  !
810  ! Error Escape Locations
811  !
812 800 CONTINUE
813  IF ( iaproc .EQ. naperr ) WRITE (ndse,1000) filext(:i), ierr
814  GOTO 880
815  !
816 801 CONTINUE
817  IF ( iaproc .EQ. naperr ) WRITE (ndse,1001) filext(:i), ierr
818  GOTO 880
819  !
820 802 CONTINUE
821  IF ( iaproc .EQ. naperr ) WRITE (ndse,1002) filext(:i)
822  GOTO 880
823  !
824 803 CONTINUE
825  IF ( iaproc .EQ. naperr ) WRITE (ndse,1003) filext(:i), idstri, idtst
826  GOTO 880
827  !
828 810 CONTINUE
829  IF ( iaproc .EQ. naperr ) WRITE (ndse,1010) filext(:i), ierr
830  GOTO 880
831  !
832 811 CONTINUE
833  IF ( iaproc .EQ. naperr ) WRITE (ndse,1011) filext(:i), ierr
834  !
835  ! Disabeling output
836  !
837 880 CONTINUE
838  atolast(:,3) = time
839 #ifdef W3_T
840  WRITE (ndst,9080)
841 #endif
842  !
843 888 CONTINUE
844  !
845  RETURN
846  !
847  ! Formats
848  !
849 1000 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
850  ' INPUT FILE WITH TRACK DATA NOT FOUND ', &
851  '(FILE track_i.',a,' IOSTAT =',i6,')'/ &
852  ' TRACK OUTPUT DISABLED '/)
853 1001 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
854  ' ERROR IN READING FILE track_i.',a,' IOSTAT =',i6/&
855  ' (ADITIONAL) TRACK OUTPUT DISABLED '/)
856 1002 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
857  ' PREMATURE END OF FILE track_i.',a/ &
858  ' TRACK OUTPUT DISABLED '/)
859 1003 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
860  ' UNEXPECTED CONTENTS OF OF FILE track_i.',a/ &
861  ' EXPECTED : ',a/ &
862  ' FOUND : ',a/ &
863  ' TRACK OUTPUT DISABLED '/)
864 1010 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
865  ' ERROR IN OPENING OUTPUT FILE ', &
866  '(FILE track_o.',a,' IOSTAT =',i6,')'/ &
867  ' TRACK OUTPUT DISABLED '/)
868 1011 FORMAT (/' *** WAVEWATCH III WARNING IN W3IOTR : '/ &
869  ' ERROR IN WRITING TO FILE track_o.',a,' IOSTAT =',i6/ &
870  ' (ADITIONAL) TRACK OUTPUT DISABLED '/)
871  !
872 #ifdef W3_T
873 9000 FORMAT (' TEST W3IOTR : MODEL TIME : ',i8.8,i7.6)
874 9010 FORMAT (' LAST OUTPUT TIME : ',i8.8,i7.6/ &
875  ' OUTPUT TIME INC, : ',f6.0/ &
876  ' UNIT NUMBERS : ',2i4/ &
877  ' FORMAT FLAGS : ',l4)
878 9011 FORMAT (' TEST W3IOTR : OPENING INPUT : ',a,' [',a,']')
879 9012 FORMAT (' TEST W3IOTR : OPENING OUTPUT : ',a,' [',a,']')
880 9015 FORMAT (' TEST W3IOTR : PREPARING MASKS')
881 9020 FORMAT (' TEST W3IOTR : SHIFTING MASKS')
882 9021 FORMAT (' TEST W3IOTR : OUTPUT TIME FRAME: ',i8.8,i7.6/ &
883  ' ',i8.8,i7.6)
884 9022 FORMAT (' TEST W3IOTR : ENDING TIME REACHED')
885 9033 FORMAT (' TEST W3IOTR : END OF INPUT FILE')
886 9034 FORMAT (' TEST W3IOTR : OUTPUT TYPE DISABLED')
887 9090 FORMAT (' TEST W3IOTR : NUMBER OF TRACK P: ',i10, &
888  ' (OUT OF',i10,')'/ &
889  ' NUMBER OF SPECTRA: ',i10, &
890  ' (OUT OF',i10,')')
891 9080 FORMAT (' TEST W3IOTR : OUTPUT TYPE DISABLED.')
892 #endif
893  !
894 #ifdef W3_T1
895 9030 FORMAT (' TEST W3IOTR : POINT-BY-POINT STATUS')
896 9031 FORMAT (' ',i8.8,i7.6,2f9.2,1x,a,1x,4i4,2l3)
897 #endif
898 #ifdef W3_T2
899 9035 FORMAT (' TEST W3IOTR : DUMP OF MAPS : ')
900 9036 FORMAT (132a1)
901 #endif
902  !
903 #ifdef W3_T3
904 9040 FORMAT (' TEST W3IOTR : POINT',2i4,' (',i6,')', &
905  ' ON PROCESS',i4,2x,a,i10.8,i7.6)
906 #endif
907  !/
908  !/ End of W3IOTR ----------------------------------------------------- /
909  !/

References w3adatmd::as, w3adatmd::cg, w3gdatmd::cmprtrck, w3adatmd::cx, w3adatmd::cy, w3gdatmd::dpdx, w3gdatmd::dpdy, w3gdatmd::dqdx, w3gdatmd::dqdy, w3gdatmd::dsip, w3gdatmd::dth, w3odatmd::dtout, w3adatmd::dw, file(), constants::file_endian, w3gdatmd::filext, w3gdatmd::flagll, w3odatmd::fnmpre, w3gdatmd::gsu, w3gdatmd::gtype, w3odatmd::iaproc, w3gdatmd::iclose, include(), w3parall::init_get_jsea_isproc(), w3odatmd::ipass3, w3odatmd::irqtr, w3odatmd::it0trk, w3gdatmd::mapfs, w3gdatmd::mapst2, w3gdatmd::mapsta, w3odatmd::mask1, w3odatmd::mask2, w3gdatmd::maxx, w3gdatmd::maxy, w3adatmd::mpi_comm_wave, w3odatmd::naperr, w3odatmd::naproc, w3odatmd::naptrk, w3odatmd::ndse, w3odatmd::ndst, w3gdatmd::nk, w3odatmd::nrqtr, w3gdatmd::nsea, w3gdatmd::nseal, w3gdatmd::nspec, w3gdatmd::nth, w3gdatmd::nx, w3gdatmd::ny, w3odatmd::o3init, w3gdatmd::sig, w3odatmd::stop, w3servmd::strace(), w3servmd::strsplit(), w3gdatmd::th, w3wdatmd::time, w3odatmd::tolast, w3odatmd::trckid, w3adatmd::ua, w3adatmd::ud, w3gdatmd::ungtype, w3wdatmd::ust, w3odatmd::w3dmo3(), w3gsrumd::w3gsup(), w3adatmd::w3seta(), w3gdatmd::w3setg(), w3odatmd::w3seto(), w3wdatmd::w3setw(), w3gdatmd::xfr, w3gdatmd::xgrd, and w3gdatmd::ygrd.

Referenced by w3wavemd::w3wave().

w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3odatmd::w3dmo3
subroutine w3dmo3(IMOD, NDSE, NDST)
Definition: w3odatmd.F90:1151
include
cmake src_list cmake include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake) check_switches("$
Definition: CMakeLists.txt:15
w3gdatmd::dth
real, pointer dth
Definition: w3gdatmd.F90:1232
w3adatmd::as
real, dimension(:), pointer as
Definition: w3adatmd.F90:584
w3gdatmd::ygrd
double precision, dimension(:,:), pointer ygrd
Definition: w3gdatmd.F90:1205
w3gdatmd::gsu
type(t_gsu), pointer gsu
Definition: w3gdatmd.F90:1226
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3odatmd::trckid
character(len=32), dimension(:,:), pointer trckid
Definition: w3odatmd.F90:517
w3gdatmd::ungtype
integer, parameter ungtype
Definition: w3gdatmd.F90:626
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3gdatmd::maxx
real, pointer maxx
Definition: w3gdatmd.F90:1133
w3adatmd::cg
real, dimension(:,:), pointer cg
Definition: w3adatmd.F90:575
w3adatmd::dw
real, dimension(:), pointer dw
Definition: w3adatmd.F90:584
w3odatmd::dtout
real, dimension(:), pointer dtout
Definition: w3odatmd.F90:467
w3gsrumd
Definition: w3gsrumd.F90:17
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3gdatmd::xgrd
double precision, dimension(:,:), pointer xgrd
Definition: w3gdatmd.F90:1205
w3odatmd::iaproc
integer, pointer iaproc
Definition: w3odatmd.F90:457
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3gdatmd::ny
integer, pointer ny
Definition: w3gdatmd.F90:1097
w3odatmd::fnmpre
character(len=80) fnmpre
Definition: w3odatmd.F90:330
w3servmd::strsplit
subroutine strsplit(STRING, TAB)
Definition: w3servmd.F90:1440
w3gdatmd::dsip
real, dimension(:), pointer dsip
Definition: w3gdatmd.F90:1234
w3gdatmd::cmprtrck
logical, pointer cmprtrck
Definition: w3gdatmd.F90:1220
w3gdatmd::th
real, dimension(:), pointer th
Definition: w3gdatmd.F90:1234
w3gdatmd::w3setg
subroutine w3setg(IMOD, NDSE, NDST)
Definition: w3gdatmd.F90:2152
scrip_timers::status
character(len=8), dimension(max_timers), save status
Definition: scrip_timers.f:63
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3adatmd::w3seta
subroutine w3seta(IMOD, NDSE, NDST)
Select one of the WAVEWATCH III grids / models.
Definition: w3adatmd.F90:2645
w3gdatmd::dqdy
real, dimension(:,:), pointer dqdy
Definition: w3gdatmd.F90:1209
w3gdatmd::mapfs
integer, dimension(:,:), pointer mapfs
Definition: w3gdatmd.F90:1163
w3odatmd::naperr
integer, pointer naperr
Definition: w3odatmd.F90:457
w3odatmd::stop
logical, pointer stop
Definition: w3odatmd.F90:515
w3servmd
Definition: w3servmd.F90:3
w3adatmd::ud
real, dimension(:), pointer ud
Definition: w3adatmd.F90:584
w3wdatmd::w3setw
subroutine w3setw(IMOD, NDSE, NDST)
Select one of the WAVEWATCH III grids / models.
Definition: w3wdatmd.F90:660
w3odatmd::w3seto
subroutine w3seto(IMOD, NDSERR, NDSTST)
Definition: w3odatmd.F90:1523
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd
Definition: w3odatmd.F90:3
w3adatmd::cy
real, dimension(:), pointer cy
Definition: w3adatmd.F90:584
w3odatmd::tolast
integer, dimension(:,:), pointer tolast
Definition: w3odatmd.F90:464
m_constants::pi
real pi
circular constant, 3.1415...
Definition: mod_constants.f90:29
w3odatmd::naproc
integer, pointer naproc
Definition: w3odatmd.F90:457
w3gdatmd::dpdx
real, dimension(:,:), pointer dpdx
Definition: w3gdatmd.F90:1208
w3odatmd::irqtr
integer, dimension(:), pointer irqtr
Definition: w3odatmd.F90:513
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3gdatmd::iclose
integer, pointer iclose
Definition: w3gdatmd.F90:1096
w3odatmd::mask2
logical, dimension(:,:), pointer mask2
Definition: w3odatmd.F90:516
w3odatmd::naptrk
integer, pointer naptrk
Definition: w3odatmd.F90:457
w3gdatmd::dpdy
real, dimension(:,:), pointer dpdy
Definition: w3gdatmd.F90:1208
w3gdatmd::maxy
real, pointer maxy
Definition: w3gdatmd.F90:1133
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3gdatmd::gtype
integer, pointer gtype
Definition: w3gdatmd.F90:1094
w3gdatmd::xfr
real, pointer xfr
Definition: w3gdatmd.F90:1232
w3parall::init_get_jsea_isproc
subroutine init_get_jsea_isproc(ISEA, JSEA, ISPROC)
Set JSEA for all schemes.
Definition: w3parall.F90:1163
w3odatmd::it0trk
integer, pointer it0trk
Definition: w3odatmd.F90:512
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
w3odatmd::mask1
logical, dimension(:,:), pointer mask1
Definition: w3odatmd.F90:516
w3wdatmd::ust
real, dimension(:), pointer ust
Definition: w3wdatmd.F90:183
w3adatmd::mpi_comm_wave
integer, pointer mpi_comm_wave
Definition: w3adatmd.F90:676
constants
Define some much-used constants for global use (all defined as PARAMETER).
Definition: constants.F90:20
w3adatmd::ua
real, dimension(:), pointer ua
Definition: w3adatmd.F90:584
w3gdatmd
Definition: w3gdatmd.F90:16
constants::file_endian
character(*), parameter file_endian
FILE_ENDIAN Filled by preprocessor with 'big_endian', 'little_endian', or 'native'.
Definition: constants.F90:86
w3gsrumd::w3gsup
subroutine, public w3gsup(GSU, IUNIT, LFULL)
Definition: w3gsrumd.F90:885
w3odatmd::o3init
logical, pointer o3init
Definition: w3odatmd.F90:515
w3odatmd::ipass3
integer, pointer ipass3
Definition: w3odatmd.F90:510
w3adatmd::cx
real, dimension(:), pointer cx
Definition: w3adatmd.F90:584
w3gdatmd::nx
integer, pointer nx
Definition: w3gdatmd.F90:1097
w3timemd
Definition: w3timemd.F90:3
w3parall
Parallel routines for implicit solver.
Definition: w3parall.F90:22
w3gdatmd::dqdx
real, dimension(:,:), pointer dqdx
Definition: w3gdatmd.F90:1209
w3gdatmd::mapsta
integer, dimension(:,:), pointer mapsta
Definition: w3gdatmd.F90:1163
w3gdatmd::mapst2
integer, dimension(:,:), pointer mapst2
Definition: w3gdatmd.F90:1163
w3odatmd::nrqtr
integer, pointer nrqtr
Definition: w3odatmd.F90:512
w3gdatmd::flagll
logical, pointer flagll
Definition: w3gdatmd.F90:1219
w3gdatmd::filext
character(len=13), pointer filext
Definition: w3gdatmd.F90:1224