WAVEWATCH III  beta 0.0.1
w3iosfmd.F90
Go to the documentation of this file.
1 
7 
8 #include "w3macros.h"
9 !/ ------------------------------------------------------------------- /
16 MODULE w3iosfmd
17  !/
18  !/ +-----------------------------------+
19  !/ | WAVEWATCH III NOAA/NCEP |
20  !/ | H. L. Tolman |
21  !/ | FORTRAN 90 |
22  !/ | Last update : 25-Jul-2018 |
23  !/ +-----------------------------------+
24  !/
25  !/ 27-Jun-2006 : Origination. ( version 3.09 )
26  !/ 02-Nov-2006 : Origination W3CPRT and W3IOSF. ( version 3.10 )
27  !/ 24-Mar-2007 : Add pars for entire spectrum. ( version 3.11 )
28  !/ 17-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
29  !/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
30  !/ 30-Oct-2009 : Fix unitialized dtsiz in w3iosf. ( version 3.14 )
31  !/ (T. J. Campbell, NRL)
32  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
33  !/ (W. E. Rogers & T. J. Campbell, NRL)
34  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
35  !/ (W. E. Rogers & T. J. Campbell, NRL)
36  !/ 06-Mar-2012 : Reparing test output under MPI. ( version 4.07 )
37  !/ 08-Jun-2018 : use W3ADATMD, W3PARALL, INIT_GET_ISEA and
38  !/ INIT_GET_JSEA_ISPROC ( version 6.04 )
39  !/ 25-Jul-2018 : Changed DIMXP size for partitioning ( version 6.05 )
40  !/ methods 4 and 5. (C Bunney, UKMO)
41  !/
42  !/ Copyright 2009-2012 National Weather Service (NWS),
43  !/ National Oceanic and Atmospheric Administration. All rights
44  !/ reserved. WAVEWATCH III is a trademark of the NWS.
45  !/ No unauthorized use without permission.
46  !/
47  ! 1. Purpose :
48  !
49  ! I/O and computational routines for the wave-field separation
50  ! output.
51  !
52  ! 2. Variables and types :
53  !
54  ! Name Type Scope Description
55  ! ----------------------------------------------------------------
56  ! VERPRT C*10 Private Partition file version number.
57  ! IDSTR C*35 Private Partition file ID string.
58  ! ----------------------------------------------------------------
59  !
60  ! 3. Subroutines and functions :
61  !
62  ! Name Type Scope Description
63  ! ----------------------------------------------------------------
64  ! W3CPRT Subr. Public Partition all requested local spectra.
65  ! W3IOSF Subr. Public Processing and output of partitioned
66  ! wave data.
67  ! ----------------------------------------------------------------
68  !
69  ! 4. Subroutines and functions used :
70  !
71  ! Name Type Module Description
72  ! ----------------------------------------------------------------
73  ! W3PART Subr. W3PARTMD Spectral partition for single spectrum.
74  ! STRACE Sur. W3SERVMD Subroutine tracing.
75  ! EXTCDE Subr. Id. Program abort.
76  ! MPI_SEND, MPI_RECV
77  ! MPI send and recieve routines
78  ! ----------------------------------------------------------------
79  !
80  ! 5. Remarks :
81  !
82  ! 6. Switches :
83  !
84  ! !/S Enable subroutine tracing.
85  ! !/T Enable test output
86  !
87  ! 7. Source code :
88  !
89  !/ ------------------------------------------------------------------- /
90  PUBLIC
91  !/
92  !/ Private parameter statements (ID strings)
93  !/
94  CHARACTER(LEN=10), PARAMETER, PRIVATE :: VERPRT = '2018-07-25'
95  CHARACTER(LEN=35), PARAMETER, PRIVATE :: &
96  IDSTR = 'WAVEWATCH III PARTITIONED DATA FILE'
97  !/
98 CONTAINS
99  !/ ------------------------------------------------------------------- /
108  SUBROUTINE w3cprt ( IMOD )
109  !/
110  !/ +-----------------------------------+
111  !/ | WAVEWATCH III NOAA/NCEP |
112  !/ | H. L. Tolman |
113  !/ | FORTRAN 90 |
114  !/ | Last update : 25-Jul-2018 !
115  !/ +-----------------------------------+
116  !/
117  !/ 30-Oct-2006 : Origination. ( version 3.10 )
118  !/ 24-Mar-2007 : Add pars for entire spectrum. ( version 3.11 )
119  !/ 25-Jul-2018 : Changed DIMXP size for partitioning ( version 6.05 )
120  !/ methods 4 and 5. (C Bunney, UKMO)
121  !/
122  ! 1. Purpose :
123  !
124  ! Partitioning of spectra into fields for all grid points that
125  ! are locally stored.
126  !
127  ! 2. Method :
128  !
129  ! 3. Parameters :
130  !
131  ! Parameter list
132  ! ----------------------------------------------------------------
133  ! IMOD Int. I Grid number.
134  ! ----------------------------------------------------------------
135  !
136  ! 4. Subroutines used :
137  !
138  ! Name Type Module Description
139  ! ----------------------------------------------------------------
140  ! W3PART Subr. W3PARTMD Spectral partition for single spectrum.
141  ! STRACE Subr. W3SERVMD Subroutine tracing.
142  ! ----------------------------------------------------------------
143  !
144  ! 5. Called by :
145  !
146  ! Name Type Module Description
147  ! ----------------------------------------------------------------
148  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
149  ! ----------------------------------------------------------------
150  !
151  ! 6. Error messages :
152  !
153  ! 7. Remarks :
154  !
155  ! - Although a sparse (IX,IY) grid is looked for, th major loop
156  ! is still over NSEAL to simplify storage.
157  !
158  ! 8. Structure :
159  !
160  ! 9. Switches :
161  !
162  ! !/S Enable subroutine tracing.
163  ! !/T Enable test output
164  !
165  ! 10. Source code :
166  !
167  !/ ------------------------------------------------------------------- /
168  !/
169  USE constants
170  !
171  USE w3partmd, ONLY: w3part
172 #ifdef W3_S
173  USE w3servmd, ONLY: strace
174 #endif
175  !
176  USE w3gdatmd, ONLY: nsea, nseal, mapsf, mapsta, nk, nth, sig
177  USE w3adatmd, ONLY: wn, cg, u10, u10d, dw
178  USE w3odatmd, ONLY: iaproc, naproc, outpts, o6init, &
180  USE w3wdatmd, ONLY: va, asf
181  USE w3adatmd, ONLY: nsealm
183 #ifdef W3_T
184  USE w3odatmd, ONLY: ndst
185 #endif
186  !
187  IMPLICIT NONE
188  !/
189  !/ ------------------------------------------------------------------- /
190  !/ Parameter list
191  !/
192  INTEGER, INTENT(IN) :: imod
193  !/
194  !/ ------------------------------------------------------------------- /
195  !/ Local parameters
196  !/
197  INTEGER :: dimxp, jsea, isea, ix, iy, &
198  ik, ith, np, tmpsiz, oldsiz, finsiz
199  INTEGER, SAVE :: tsfac = 7
200 #ifdef W3_S
201  INTEGER, SAVE :: ient = 0
202 #endif
203  REAL :: uabs, udir, depth, fact, e2(nk,nth)
204  REAL, ALLOCATABLE :: XP(:,:), TMP(:,:), TMP2(:,:)
205  !/
206 #ifdef W3_S
207  CALL strace (ient, 'W3CPRT')
208 #endif
209  !
210  ! -------------------------------------------------------------------- /
211  ! 0. Initializations
212  !
213  IF(ptmeth .EQ. 4 .OR. ptmeth .EQ. 5) THEN
214  ! Partitioning methods 4 and 5 only ever create 2 partitions
215  ! C. Bunney, 25-Jul-18
216  dimxp = 2
217  ELSE
218  dimxp = ((nk+1)/2) * ((nth-1)/2)
219  ENDIF
220 
221  ALLOCATE ( xp(dimp,0:dimxp) )
222  !
223  IF ( o6init ) THEN
224  DEALLOCATE ( outpts(imod)%OUT6%DTPRT )
225  ELSE
226  ALLOCATE ( outpts(imod)%OUT6%ICPRT(nsealm+1,2) )
227  icprt => outpts(imod)%OUT6%ICPRT
228  o6init = .true.
229  END IF
230  icprt = 0
231  icprt(1,2) = 1
232  !
233  tmpsiz = tsfac * nseal
234  ALLOCATE ( tmp(dimp,tmpsiz) )
235  !
236 #ifdef W3_T
237  WRITE (ndst,9000) dimp, dimxp, tmpsiz
238 #endif
239  !
240  ! -------------------------------------------------------------------- /
241  ! 1. Loop over sea points
242  !
243  DO jsea=1, nseal
244  !
245  ! -------------------------------------------------------------------- /
246  ! 2. Check need for processing
247  !
248  CALL init_get_isea(isea, jsea)
249  ix = mapsf(isea,1)
250  iy = mapsf(isea,2)
251  icprt(jsea+1,2) = icprt(jsea,2)
252  !
253  IF ( mapsta(iy,ix) .LT. 0 ) cycle
254  !
255  ! -------------------------------------------------------------------- /
256  ! 3. Prepare for partitioning
257  !
258  uabs = u10(isea)*asf(isea)
259  udir = u10d(isea)*rade
260  depth = dw(isea)
261  !
262  DO ik=1, nk
263  fact = tpi * sig(ik) / cg(ik,isea)
264  DO ith=1, nth
265  e2(ik,ith) = va(ith+(ik-1)*nth,jsea) * fact
266  END DO
267  END DO
268  !
269  ! -------------------------------------------------------------------- /
270  ! 4. perform partitioning
271  !
272  !AR: NaN checks should results in immediate stop after trace ...
273  IF (depth.NE.depth) THEN
274  WRITE(6,*) 'IOSF:',isea,ix,iy,dw(isea),depth
275  WRITE(*,*) 'FOUND NaN in depth'
276  stop 'CRITICAL ERROR IN DEPTH ARRAY'
277  END IF
278  CALL w3part ( e2, uabs, udir, depth, wn(1:nk,isea), &
279  np, xp, dimxp )
280  !
281  ! -------------------------------------------------------------------- /
282  ! 5. Store results (temp)
283  !
284  IF ( np .GE. 0 ) THEN
285  icprt( jsea ,1) = np + 1
286  icprt(jsea+1,2) = icprt(jsea,2) + np + 1
287  !
288  IF ( icprt(jsea,2)+np .GT. tmpsiz ) THEN
289  ALLOCATE ( tmp2(dimp,tmpsiz) )
290  tmp2 = tmp
291  DEALLOCATE ( tmp )
292  oldsiz = tmpsiz
293  tmpsiz = tmpsiz + max( tsfac*nseal , dimxp )
294  ALLOCATE ( tmp(dimp,tmpsiz) )
295  tmp(:,1:oldsiz) = tmp2(:,1:oldsiz)
296  tmp(:,oldsiz+1:) = 0.
297  DEALLOCATE ( tmp2 )
298 #ifdef W3_T
299  WRITE (ndst,9050) jsea, oldsiz, tmpsiz
300 #endif
301  END IF
302  !
303  tmp(:,icprt(jsea,2):icprt(jsea,2)+np) = xp(:,0:np)
304  !
305  END IF
306  !
307  ! -------------------------------------------------------------------- /
308  ! 6. End of loop and clean up
309  !
310  END DO
311  !
312  finsiz = icprt(nseal+1,2) - 1
313  !
314 #ifdef W3_T
315  WRITE (ndst,9060)
316  WRITE (ndst,9061) (cmplx(jsea,icprt(jsea,:)),jsea=1,min(100,nseal))
317  WRITE (ndst,9062) finsiz
318 #endif
319  !
320  ALLOCATE ( outpts(imod)%OUT6%DTPRT(dimp,max(1,finsiz)) )
321  dtprt => outpts(imod)%OUT6%DTPRT
322  IF ( finsiz .GT. 0 ) THEN
323  dtprt = tmp(:,1:finsiz)
324  ELSE
325  dtprt = 0.
326  END IF
327  !
328  DEALLOCATE ( xp, tmp )
329  !
330  RETURN
331  !
332  ! Formats
333  !
334 #ifdef W3_T
335 9000 FORMAT (' TEST W3CPRT : DIMP, DIMXP, TMPSIZ :',i2,2i6)
336 9050 FORMAT (' TEST W3CPRT : POINT',i4,', STORAGE',2i6)
337 9060 FORMAT (' TEST W3CPRT : COUNTERS FOR STORAGE (JSEA,NP,ST):')
338 9061 FORMAT (100(' ',5(2f9.0)/))
339 9062 FORMAT (' TEST W3CPRT : FINAL STORAGE SIZE :',i6)
340 #endif
341  !/
342  !/ End of W3CPRT ----------------------------------------------------- /
343  !/
344  END SUBROUTINE w3cprt
345 
346  !/ ------------------------------------------------------------------- /
360  SUBROUTINE w3iosf ( NDSPT, IMOD )
361  !/
362  !/ +-----------------------------------+
363  !/ | WAVEWATCH III NOAA/NCEP |
364  !/ | H. L. Tolman |
365  !/ | FORTRAN 90 |
366  !/ | Last update : 30-Oct-2009 |
367  !/ +-----------------------------------+
368  !/
369  !/ 02-Nov-2006 : Origination. ( version 1.10 )
370  !/ 24-Mar-2007 : Add pars for entire spectrum. ( version 3.11 )
371  !/ 17-May-2007 : Adding NTPROC/NAPROC separation. ( version 3.11 )
372  !/ 30-Oct-2009 : Fix unitialized dtsiz error. ( version 3.14 )
373  !/ (T. J. Campbell, NRL)
374  !/ 30-Oct-2009 : Implement run-time grid selection. ( version 3.14 )
375  !/ (W. E. Rogers & T. J. Campbell, NRL)
376  !/ 30-Oct-2009 : Implement curvilinear grid type. ( version 3.14 )
377  !/ (W. E. Rogers & T. J. Campbell, NRL)
378  !/
379  ! 1. Purpose :
380  !
381  ! Write partitioned spectrakl data to file. Unlike other
382  ! WAVEWATCH III IO routines, this one writes only.
383  ! First ad-hoc version.
384  !
385  ! 2. Method :
386  !
387  ! Writing to formatted or unformatted file with ID headers.
388  !
389  ! 3. Parameters :
390  !
391  ! Parameter list
392  ! ----------------------------------------------------------------
393  ! NDSPT Int. I Unit number.
394  ! IMOD Int. I Grid number.
395  ! ----------------------------------------------------------------
396  !
397  ! 4. Subroutines used :
398  !
399  ! Name Type Module Description
400  ! ----------------------------------------------------------------
401  ! STRACE Subr. W3SERVMD Subroutine tracing.
402  ! EXTCDE Subr. Id. Program abort.
403  ! MPI_SEND, MPI_RECV
404  ! MPI send and recieve routines
405  ! ----------------------------------------------------------------
406  !
407  ! 5. Called by :
408  !
409  ! Name Type Module Description
410  ! ----------------------------------------------------------------
411  ! W3WAVE Subr. W3WAVEMD Actual wave model routine.
412  ! ----------------------------------------------------------------
413  !
414  ! 6. Error messages :
415  !
416  ! 7. Remarks :
417  !
418  ! 8. Structure :
419  !
420  ! 9. Switches :
421  !
422  ! !/S Enable subroutine tracing.
423  ! !/T Enable test output
424  !
425  ! 10. Source code :
426  !
427  !/ ------------------------------------------------------------------- /
428  !/
429  USE constants
430  USE w3servmd, ONLY: extcde
431 #ifdef W3_S
432  USE w3servmd, ONLY: strace
433 #endif
434  !
435  USE w3gdatmd, ONLY: filext, nsea, xgrd, ygrd, mapsf, flagll
436 #ifdef W3_MPI
437  USE w3gdatmd, ONLY: nseal
438 #endif
439  USE w3wdatmd, ONLY: time, asf
440  USE w3odatmd, ONLY: ndse, iaproc, naproc, napprt, naperr, &
441  ipass => ipass6, flform, fnmpre, outpts, &
442  ix0, ixn, ixs, iy0, iyn, iys, dimp
443  USE w3adatmd, ONLY: dw, u10, u10d, cx, cy
444  USE w3adatmd, ONLY: nsealm
445  USE w3parall, ONLY: init_get_jsea_isproc
446 #ifdef W3_MPI
447  USE w3adatmd, ONLY: mpi_comm_wave
448  USE w3odatmd, ONLY: icprt, dtprt, it0prt
449 #endif
450 #ifdef W3_T
451  USE w3odatmd, ONLY: ndst
452 #endif
453  !
454  IMPLICIT NONE
455  !
456 #ifdef W3_MPI
457  include "mpif.h"
458 #endif
459  !/
460  !/ ------------------------------------------------------------------- /
461  !/ Parameter list
462  !/
463  INTEGER, INTENT(IN) :: NDSPT, IMOD
464  !/
465  !/ ------------------------------------------------------------------- /
466  !/ Local parameters
467  !/
468  INTEGER :: I, J, IERR, ISEA, JSEA, JAPROC, &
469  IX, IY, IP, IOFF, DTSIZ=0
470 #ifdef W3_MPI
471  INTEGER :: ICSIZ, IERR_MPI, IT, &
472  STATUS(MPI_STATUS_SIZE,1), JSLM
473 #endif
474 #ifdef W3_S
475  INTEGER, SAVE :: IENT = 0
476 #endif
477  INTEGER, POINTER :: ICP(:,:)
478  REAL :: X, Y, DEPTH, UABS, UDIR, CABS, CDIR
479  REAL, POINTER :: DTP(:,:)
480  !
481  TYPE procs
482  INTEGER, POINTER :: ICPRT(:,:)
483  REAL, POINTER :: DTPRT(:,:)
484  END TYPE procs
485  !
486  TYPE(procs), TARGET, ALLOCATABLE :: PROC(:)
487  !
488  ! -------------------------------------------------------------------- /
489  ! 0. Initializations
490  !
491 #ifdef W3_S
492  CALL strace (ient, 'W3IOSF')
493 #endif
494  !
495  ipass = ipass + 1
496 #ifdef W3_MPI
497  icsiz = 2 * ( nsealm + 1 )
498 #endif
499  !
500 #ifdef W3_T
501  WRITE (ndst,9000) ipass, flform, ndspt, imod, iaproc, napprt
502 #endif
503  !
504  ! -------------------------------------------------------------------- /
505  ! 1. Set up file ( IPASS = 1 and proper processor )
506  !
507  IF ( ipass.EQ.1 .AND. iaproc.EQ.napprt ) THEN
508  !
509  ! 1.a Open file
510  !
511  i = len_trim(filext)
512  j = len_trim(fnmpre)
513  !
514 #ifdef W3_T
515  WRITE (ndst,9010) fnmpre(:j)//'partition.'//filext(:i)
516 #endif
517  !
518  IF ( flform ) THEN
519  OPEN (ndspt,file=fnmpre(:j)//'partition.'//filext(:i), &
520  err=800,iostat=ierr)
521  ELSE
522  OPEN (ndspt,file=fnmpre(:j)//'partition.'//filext(:i), &
523  form='UNFORMATTED',convert=file_endian,err=800,iostat=ierr)
524  END IF
525  !
526  rewind(ndspt)
527  !
528  ! 1.b Header info
529  !
530  IF ( flform ) THEN
531  WRITE (ndspt,910) idstr, verprt
532  IF ( flagll ) THEN
533  WRITE (ndspt,911) ' yyyymmdd hhmmss '// &
534  'lat lon name nprt'// &
535  ' depth ubas udir cabs cdir'
536  ELSE
537  WRITE (ndspt,911) ' yyyymmdd hhmmss '// &
538  'X Y name nprt'// &
539  ' depth ubas udir cabs cdir'
540  END IF
541  WRITE (ndspt,911) ' hs tp lp '// &
542  ' theta sp wf'
543  ELSE
544  WRITE ( ndspt ) idstr, verprt
545  IF ( flagll ) THEN
546  WRITE ( ndspt ) ' yyyymmdd hhmmss '// &
547  'lat lon name nprt'// &
548  ' depth ubas udir cabs cdir'
549  ELSE
550  WRITE ( ndspt ) ' yyyymmdd hhmmss '// &
551  'X Y name nprt'// &
552  ' depth ubas udir cabs cdir'
553  END IF
554  WRITE ( ndspt ) ' hs tp lp '// &
555  ' theta sp wf'
556  END IF
557  !
558  END IF
559  !
560  ! -------------------------------------------------------------------- /
561  ! 2. Send data if output is non-local ( MPI only )
562  ! Leave routine after send
563  !
564  IF ( iaproc.NE.napprt .AND. iaproc.LE.naproc ) THEN
565  !
566 #ifdef W3_T
567  WRITE (ndst,9020) iaproc, napprt, nsealm+1
568 #endif
569  !
570 #ifdef W3_MPI
571  it = it0prt + iaproc - 1
572  CALL mpi_send ( icprt, icsiz, mpi_real, napprt-1, it, &
573  mpi_comm_wave, ierr_mpi )
574  dtsiz = icprt(nseal+1,2) - 1
575 #endif
576  !
577 #ifdef W3_T
578  WRITE (ndst,9021) iaproc, napprt, dtsiz
579 #endif
580  !
581 #ifdef W3_MPI
582  it = it0prt + naproc + iaproc - 1
583  IF ( dtsiz .GT. 0 ) CALL mpi_send &
584  ( dtprt, 6*dtsiz, mpi_real, napprt-1, &
585  it, mpi_comm_wave, ierr_mpi )
586 #endif
587  !
588  END IF
589  !
590  IF ( iaproc .NE. napprt ) RETURN
591  !
592  ! -------------------------------------------------------------------- /
593  ! 3. Point to and/or gather data
594  ! 3.a Set up storage
595  !
596  ALLOCATE ( proc(naproc) )
597  !
598  ! 3.b Point to local data
599  !
600  IF ( iaproc .LE. naproc ) THEN
601  proc(iaproc)%ICPRT => outpts(imod)%OUT6%ICPRT
602  proc(iaproc)%DTPRT => outpts(imod)%OUT6%DTPRT
603  END IF
604  !
605  ! 3.c Allocate and get counters and arrrays
606  !
607  DO japroc=1, naproc
608  IF ( iaproc .EQ. japroc ) cycle
609  !
610 #ifdef W3_T
611  WRITE (ndst,9030) japroc, nsealm+1
612 #endif
613  !
614 #ifdef W3_MPI
615  ALLOCATE ( proc(japroc)%ICPRT(nsealm+1,2) )
616  icp => proc(japroc)%ICPRT
617  it = it0prt + japroc - 1
618  CALL mpi_recv ( icp, icsiz, mpi_real, japroc-1, it, &
619  mpi_comm_wave, status, ierr_mpi )
620  jslm = 1 + (nsea-japroc)/naproc
621  dtsiz = icp(jslm+1,2) - 1
622 #endif
623  !
624 #ifdef W3_T
625  WRITE (ndst,9031) japroc, dtsiz
626 #endif
627  !
628 #ifdef W3_MPI
629  ALLOCATE ( proc(japroc)%DTPRT(dimp,max(1,dtsiz)) )
630  dtp => proc(japroc)%DTPRT
631  it = it0prt + naproc + japroc - 1
632  IF ( dtsiz .GT. 0 ) CALL mpi_recv &
633  ( dtp, dimp*dtsiz, mpi_real, japroc-1, &
634  it, mpi_comm_wave, status, ierr_mpi )
635 #endif
636  !
637  END DO
638  !
639  ! -------------------------------------------------------------------- /
640  ! 4. Write all data for which partitions are found
641  ! 4.a General loop over all sea points
642  !
643  DO isea=1, nsea
644  !
645  ! 4.b Check for partitioned data at sea point
646  !
647  CALL init_get_jsea_isproc(isea, jsea, japroc)
648  !
649  icp => proc(japroc)%ICPRT
650  dtp => proc(japroc)%DTPRT
651  !
652  IF ( icp(jsea,1) .EQ. 0 ) cycle
653  !
654  ! 4.c Process point ID line
655  !
656  ix = mapsf(isea,1)
657  iy = mapsf(isea,2)
658  IF ( ix.LT.ix0 .OR. ix.GT.ixn .OR. mod(ix-ix0,ixs).NE.0 ) cycle
659  IF ( iy.LT.iy0 .OR. iy.GT.iyn .OR. mod(iy-iy0,iys).NE.0 ) cycle
660  x = xgrd(iy,ix)
661  y = ygrd(iy,ix)
662  depth = dw(isea)
663  uabs = u10(isea)*asf(isea)
664  udir = mod( 270. - u10d(isea)*rade , 360. )
665  cabs = sqrt( cx(isea)**2 + cy(isea)**2 )
666  IF ( cabs .LT. 1.e-3 ) THEN
667  cdir = 0.
668  ELSE
669  cdir = atan2( cy(isea), cx(isea) ) * rade
670  cdir = mod( 270. - cdir , 360. )
671  END IF
672  !
673  IF ( flform ) THEN
674  IF ( flagll ) THEN
675  WRITE (ndspt,940) time, y, x, &
676  'grid_point', icp(jsea,1) - 1, &
677  depth, uabs, udir, cabs, cdir
678  ELSE
679  WRITE (ndspt,941) time, x*1.e-3, y*1.e-3, &
680  'grid_point', icp(jsea,1) - 1, &
681  depth, uabs, udir, cabs, cdir
682  END IF
683  ELSE
684  IF ( flagll ) THEN
685  WRITE ( ndspt ) time, y, x, &
686  'grid_point', icp(jsea,1) - 1, &
687  depth, uabs, udir, cabs, cdir
688  ELSE
689  WRITE ( ndspt ) time, x*1.e-3, y*1.e-3, &
690  'grid_point', icp(jsea,1) - 1, &
691  depth, uabs, udir, cabs, cdir
692  END IF
693  END IF
694  !
695  ! 4.d Process partitions for this point
696  !
697  ioff = icp(jsea,2)
698  !
699  IF ( flform ) THEN
700  DO ip=0, icp(jsea,1) - 1
701  WRITE (ndspt,942) ip, dtp(:,ip+ioff)
702  END DO
703  ELSE
704  DO ip=0, icp(jsea,1) - 1
705  WRITE ( ndspt ) ip, dtp(:,ip+ioff)
706  END DO
707  END IF
708  !
709  END DO
710  !
711  ! -------------------------------------------------------------------- /
712  ! 5. Clean up data structure
713  !
714 #ifdef W3_MPI
715  DO japroc=1, naproc
716  IF ( iaproc .EQ. japroc ) cycle
717  DEALLOCATE ( proc(japroc)%ICPRT, proc(japroc)%DTPRT )
718  END DO
719 #endif
720  !
721  DEALLOCATE ( proc )
722  !
723  RETURN
724  !
725  ! Escape locations read errors --------------------------------------- *
726  !
727 800 CONTINUE
728  IF ( iaproc .EQ. naperr ) WRITE (ndse,1000) ierr
729  CALL extcde ( 1 )
730  !
731  ! Formats
732  !
733 910 FORMAT (a,1x,a)
734 911 FORMAT (a)
735  !
736 940 FORMAT (1x,i8.8,1x,i6.6,2f8.3,2x,'''',a10,'''', &
737  1x,i2,f7.1,f5.1,f6.1,f5.2,f6.1)
738 941 FORMAT (1x,i8.8,1x,i6.6,2(f8.1,'E3'),2x,'''',a10,'''', &
739  1x,i2,f7.1,f5.1,f6.1,f5.2,f6.1)
740 942 FORMAT (i3,3f8.2,2f9.2,f7.2)
741  !
742 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3IOSF : '/ &
743  ' ERROR IN OPENING FILE'/ &
744  ' IOSTAT =',i5/)
745  !
746 #ifdef W3_T
747 9000 FORMAT (' TEST W3IOSF : IPASS =',i4,', FLFROM = ',l1, &
748  ', NDSPT =',i3,', IMOD =',i3,','/ &
749  ' IAPROC, NAPPRT =',2i4)
750 9010 FORMAT (' TEST W3IOSF : OPENING NEW FILE [',a,']')
751 9020 FORMAT (' TEST W3IOSF : SENDING ICPRT FROM',i3,' TO',i3, &
752  ' WITH SIZE :',i6)
753 #endif
754 #ifdef W3_T
755 9021 FORMAT (' TEST W3IOSF : SENDING DTPRT FROM',i3,' TO',i3, &
756  ' WITH SIZE :',i6)
757 #endif
758 #ifdef W3_T
759 9030 FORMAT (' TEST W3IOSF : RECEIVING ICPRT FROM',i3, &
760  ' WITH SIZE :',i6)
761 #endif
762 #ifdef W3_T
763 9031 FORMAT (' TEST W3IOSF : RECEIVING DTPRT FROM',i3, &
764  ' WITH SIZE :',i6)
765 #endif
766  !/
767  !/ End of W3IOSF ----------------------------------------------------- /
768  !/
769  END SUBROUTINE w3iosf
770  !/
771  !/ End of module W3IOSFMD -------------------------------------------- /
772  !/
773 END MODULE w3iosfmd
w3gdatmd::nk
integer, pointer nk
Definition: w3gdatmd.F90:1230
w3gdatmd::nseal
integer, pointer nseal
Definition: w3gdatmd.F90:1097
include
cmake src_list cmake include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake) check_switches("$
Definition: CMakeLists.txt:15
w3adatmd::nsealm
integer, pointer nsealm
Definition: w3adatmd.F90:686
w3gdatmd::ygrd
double precision, dimension(:,:), pointer ygrd
Definition: w3gdatmd.F90:1205
w3adatmd
Define data structures to set up wave model auxiliary data for several models simultaneously.
Definition: w3adatmd.F90:26
w3iosfmd::w3cprt
subroutine w3cprt(IMOD)
Partitioning of spectra into fields for all grid points that are locally stored.
Definition: w3iosfmd.F90:109
w3partmd
Spectral partitioning according to the watershed method.
Definition: w3partmd.F90:18
w3wdatmd
Define data structures to set up wave model dynamic data for several models simultaneously.
Definition: w3wdatmd.F90:18
w3odatmd::dtprt
real, dimension(:,:), pointer dtprt
Definition: w3odatmd.F90:553
w3odatmd::iy0
integer, pointer iy0
Definition: w3odatmd.F90:551
w3adatmd::cg
real, dimension(:,:), pointer cg
Definition: w3adatmd.F90:575
w3odatmd::o6init
logical, pointer o6init
Definition: w3odatmd.F90:554
w3adatmd::dw
real, dimension(:), pointer dw
Definition: w3adatmd.F90:584
w3adatmd::u10d
real, dimension(:), pointer u10d
Definition: w3adatmd.F90:584
w3gdatmd::sig
real, dimension(:), pointer sig
Definition: w3gdatmd.F90:1234
w3gdatmd::xgrd
double precision, dimension(:,:), pointer xgrd
Definition: w3gdatmd.F90:1205
w3odatmd::ipass6
integer, pointer ipass6
Definition: w3odatmd.F90:551
w3odatmd::ptmeth
integer, pointer ptmeth
Definition: w3odatmd.F90:555
w3odatmd::iaproc
integer, pointer iaproc
Definition: w3odatmd.F90:457
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
constants::rade
real, parameter rade
RADE Conversion factor from radians to degrees.
Definition: constants.F90:76
w3odatmd::flform
logical, pointer flform
Definition: w3odatmd.F90:554
w3odatmd::fnmpre
character(len=80) fnmpre
Definition: w3odatmd.F90:330
w3wdatmd::va
real, dimension(:,:), pointer va
Definition: w3wdatmd.F90:183
w3odatmd::iyn
integer, pointer iyn
Definition: w3odatmd.F90:551
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
w3odatmd::iys
integer, pointer iys
Definition: w3odatmd.F90:551
w3odatmd::naperr
integer, pointer naperr
Definition: w3odatmd.F90:457
w3gdatmd::nsea
integer, pointer nsea
Definition: w3gdatmd.F90:1097
w3servmd
Definition: w3servmd.F90:3
w3gdatmd::nth
integer, pointer nth
Definition: w3gdatmd.F90:1230
w3odatmd::it0prt
integer, pointer it0prt
Definition: w3odatmd.F90:512
w3odatmd
Definition: w3odatmd.F90:3
w3adatmd::cy
real, dimension(:), pointer cy
Definition: w3adatmd.F90:584
w3gdatmd::mapsf
integer, dimension(:,:), pointer mapsf
Definition: w3gdatmd.F90:1163
w3odatmd::naproc
integer, pointer naproc
Definition: w3odatmd.F90:457
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3adatmd::wn
real, dimension(:,:), pointer wn
Definition: w3adatmd.F90:575
w3adatmd::u10
real, dimension(:), pointer u10
Definition: w3adatmd.F90:584
w3odatmd::napprt
integer, pointer napprt
Definition: w3odatmd.F90:457
w3odatmd::ixs
integer, pointer ixs
Definition: w3odatmd.F90:551
constants::tpi
real, parameter tpi
TPI 2*Pi.
Definition: constants.F90:72
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148
w3odatmd::dimp
integer, parameter dimp
Definition: w3odatmd.F90:325
w3odatmd::ixn
integer, pointer ixn
Definition: w3odatmd.F90:551
w3odatmd::ix0
integer, pointer ix0
Definition: w3odatmd.F90:551
w3parall::init_get_jsea_isproc
subroutine init_get_jsea_isproc(ISEA, JSEA, ISPROC)
Set JSEA for all schemes.
Definition: w3parall.F90:1163
w3odatmd::ndst
integer, pointer ndst
Definition: w3odatmd.F90:456
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
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
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736
w3odatmd::outpts
type(output), dimension(:), allocatable, target outpts
Definition: w3odatmd.F90:452
w3partmd::w3part
subroutine w3part(SPEC, UABS, UDIR, DEPTH, WN, NP, XP, DIMXP)
Interface to watershed partitioning routines.
Definition: w3partmd.F90:139
w3odatmd::icprt
integer, dimension(:,:), pointer icprt
Definition: w3odatmd.F90:551
w3iosfmd::w3iosf
subroutine w3iosf(NDSPT, IMOD)
Write partitioned spectral data to file.
Definition: w3iosfmd.F90:361
w3adatmd::cx
real, dimension(:), pointer cx
Definition: w3adatmd.F90:584
w3parall
Parallel routines for implicit solver.
Definition: w3parall.F90:22
w3gdatmd::mapsta
integer, dimension(:,:), pointer mapsta
Definition: w3gdatmd.F90:1163
w3iosfmd
I/O and computational routines for the wave-field separation output.
Definition: w3iosfmd.F90:16
w3parall::init_get_isea
subroutine init_get_isea(ISEA, JSEA)
Set ISEA for all schemes.
Definition: w3parall.F90:1398
w3gdatmd::flagll
logical, pointer flagll
Definition: w3gdatmd.F90:1219
w3wdatmd::asf
real, dimension(:), pointer asf
Definition: w3wdatmd.F90:183
w3gdatmd::filext
character(len=13), pointer filext
Definition: w3gdatmd.F90:1224