WAVEWATCH III  beta 0.0.1
ww3_sbs1.F90 File Reference

Contains program W3SBS1. More...

Go to the source code of this file.

Functions/Subroutines

program w3sbs1
 Program shell to run multi half-coupled. More...
 
subroutine rdtime (NDS, TIME)
 Internal subroutine to get next time in time file. More...
 
subroutine rdwind (NDS, TIME, NX, NY, REWIND)
 Internal subroutine to test readnext wind fields from the data file. More...
 

Detailed Description

Contains program W3SBS1.

Author
H. L. Tolman
A. Chawla
Date
05-Dec-2012

Definition in file ww3_sbs1.F90.

Function/Subroutine Documentation

◆ rdtime()

subroutine w3sbs1::rdtime ( integer, intent(in)  NDS,
integer, dimension(2), intent(out)  TIME 
)

Internal subroutine to get next time in time file.

Including wait until file is there.

Parameters
[in]NDSUnit number for times file.
[out]TIMENext time in times file.
Author
H. L. Tolman
Date
05-Dec-2012

Definition at line 404 of file ww3_sbs1.F90.

404  !/
405  !/ +-----------------------------------+
406  !/ | WAVEWATCH-III NOAA/NCEP |
407  !/ | H. L. Tolman |
408  !/ | FORTRAN 90 |
409  !/ | Last update : 05-Dec-2012 !
410  !/ +-----------------------------------+
411  !/
412  !/ 10-Aug-2010 : Origination. ( version 3.14.4 )
413  !/ 05-Dec-2012 : Making sleep a system call. ( version 4.11 )
414  !/
415  ! 1. Purpose :
416  !
417  ! Internal subroutine to get next time in time file, including
418  ! waiting until the file is there.
419  !
420  ! 3. Parameters :
421  !
422  ! Parameter list
423  ! ----------------------------------------------------------------
424  ! NDS Int. I Unit number for times file.
425  ! TIME I.A. O Next time in times file.
426  ! ----------------------------------------------------------------
427  !
428  ! 10. Source code :
429  !
430  !/ ------------------------------------------------------------------- /
431  !/ Parameter list
432  !/
433  INTEGER, INTENT(IN) :: NDS
434  INTEGER, INTENT(OUT) :: TIME(2)
435  !/
436  !/ ------------------------------------------------------------------- /
437  !/ Local parameters
438  !/
439 #ifdef W3_SBS
440  CHARACTER(LEN=10) :: COMMAND
441 #endif
442  !/
443  ! -------------------------------------------------------------------- /
444  ! 1. Reading loop
445  !
446  DO
447  !
448  READ (nds,910,END=110,ERR=810,IOSTAT=IERR) time
449  EXIT
450  !
451 110 CONTINUE
452  IF ( improc .EQ. nmpscr ) WRITE (mdss, 911 )
453  backspace nds
454  !
455 #ifdef W3_SBS
456  WRITE (command,'(A5,1X,I4)') 'sleep ', sleep1
457  CALL system ( command )
458 #endif
459  !
460  END DO
461  !
462  RETURN
463  !
464  ! Escape locations read errors --------------------------------------- *
465  !
466 810 CONTINUE
467  WRITE (mdss,1010) ierr
468  CALL extcde ( 10 )
469  !
470  ! Formats
471  !
472 910 FORMAT (1x,i8,1x,i6)
473  !
474 911 FORMAT (/' END OF TIMES FILE REACHED FOR WIND DATA '/ &
475  ' WAITING BEFORE CHECKING AGAIN')
476  !
477 1010 FORMAT (/' *** WAVEWATCH-III ERROR IN W3SBS1/RDTIME : '/ &
478  ' ERROR IN OPENING TIMES FILE'/ &
479  ' IOSTAT =',i5/)
480  !/
481  !/ End of RDTIME ----------------------------------------------------- /
482  !/

References w3servmd::extcde(), wmmdatmd::improc, wmmdatmd::mdss, and wmmdatmd::nmpscr.

Referenced by w3sbs1().

◆ rdwind()

subroutine w3sbs1::rdwind ( integer, intent(in)  NDS,
integer, dimension(2), intent(in)  TIME,
integer, intent(in)  NX,
integer, intent(in)  NY,
logical, intent(in)  REWIND 
)

Internal subroutine to test readnext wind fields from the data file.

Including testing to see if file was read properly.

Parameters
[in]NDSUnit number for times file.
[in]TIMENext time in times file.
[in]NXGrid size in X
[in]NYGrid size in Y
[in]REWINDFlag for wind file rewind
Author
H. L. Tolman
Date
05-Dec-2012

Definition at line 500 of file ww3_sbs1.F90.

500  !/
501  !/ +-----------------------------------+
502  !/ | WAVEWATCH-III NOAA/NCEP |
503  !/ | H. L. Tolman |
504  !/ | FORTRAN 90 |
505  !/ | Last update : 05-Dec-2012 !
506  !/ +-----------------------------------+
507  !/
508  !/ 10-Aug-2010 : Origination. ( version 3.14.4 )
509  !/ 05-Dec-2012 : Making sleep a system call. ( version 4.11 )
510  !/
511  ! 1. Purpose :
512  !
513  ! Internal subroutine to test readnext wind fields from the data
514  ! file, including testing to see if file was read properly.
515  !
516  ! 3. Parameters :
517  !
518  ! Parameter list
519  ! ----------------------------------------------------------------
520  ! NDS Int. I Unit number for times file.
521  ! TIME I.A. I Next time in times file.
522  ! NX,NY Int. I Grid size.
523  ! REWIND Log. I Flag for wind file rewind.
524  ! ----------------------------------------------------------------
525  !
526  ! 10. Source code :
527  !
528  !/ ------------------------------------------------------------------- /
529  !/ Parameter list
530  !/
531  INTEGER, INTENT(IN) :: NDS, TIME(2), NX, NY
532  LOGICAL, INTENT(IN) :: REWIND
533  !/
534  !/ ------------------------------------------------------------------- /
535  !/ Local parameters
536  !/
537  INTEGER :: TTIME(2), IX, IY
538  INTEGER, SAVE :: NREW = 0
539  REAL :: DTTST, XXX(NX,NY)
540 #ifdef W3_SBS
541  CHARACTER(LEN=10) :: COMMAND
542 #endif
543  !
544  ! -------------------------------------------------------------------- /
545  ! 1. Loops
546  !
547  DO
548  !
549  ! ... Inner loop reading
550  !
551  DO
552  !
553  nrew = nrew + 1
554  READ (nds,END=140,ERR=140) ttime
555 #ifdef W3_T
556  WRITE (mdst,9000) ttime
557 #endif
558  !
559  nrew = nrew + 1
560  READ (nds,END=130,ERR=130) ((XXX(IX,IY),IX=1,NX),IY=1,NY)
561 #ifdef W3_T
562  WRITE (mdst,9001) 'U'
563 #endif
564  !
565  nrew = nrew + 1
566  READ (nds,END=120,ERR=120) ((XXX(IX,IY),IX=1,NX),IY=1,NY)
567 #ifdef W3_T
568  WRITE (mdst,9001) 'V'
569 #endif
570  !
571  IF ( TYPE .EQ. 'WNS' ) then
572  nrew = nrew + 1
573  READ (nds,END=110,ERR=110) ((XXX(IX,IY),IX=1,NX),IY=1,NY)
574 #ifdef W3_T
575  WRITE (mdst,9001) 'DT'
576 #endif
577  END IF
578  !
579  EXIT
580  !
581 110 CONTINUE
582  backspace nds
583  nrew = nrew - 1
584 120 CONTINUE
585  backspace nds
586  nrew = nrew - 1
587 130 CONTINUE
588  backspace nds
589  nrew = nrew - 1
590 140 CONTINUE
591  backspace nds
592  nrew = nrew - 1
593  !
594  IF ( improc .EQ. nmpscr ) WRITE (mdss,900)
595  !
596 #ifdef W3_SBS
597  WRITE (command,'(A5,1X,I4)') 'sleep ', sleep2
598  CALL system ( command )
599 #endif
600  !
601  END DO
602  !
603  ! ... Outer loop catching up
604  !
605  dttst = dsec21( time , ttime )
606  !
607  IF ( dttst .LT. 0. ) THEN
608  IF ( improc .EQ. nmpscr ) WRITE (mdss,901) ttime
609  ELSE IF ( dttst .EQ. 0. ) THEN
610  EXIT
611  ELSE
612  GOTO 800
613  END IF
614  !
615  END DO
616  !
617  ! ... Rewind all
618  !
619  IF ( rewind ) THEN
620  !
621  IF ( improc.EQ.nmpscr .AND. nrew.GT.4 ) WRITE (mdss,902) nrew
622  !
623  DO i=1, nrew
624  backspace nds
625  END DO
626  !
627  nrew = 0
628  !
629  END IF
630  !
631  RETURN
632  !
633  ! Escape locations read errors --------------------------------------- *
634  !
635 800 CONTINUE
636  WRITE (mdss,1010)
637  CALL extcde ( 10 )
638  !
639  ! Formats
640  !
641 900 FORMAT (' FILE NOT YET COMPLETE ... ')
642 901 FORMAT (' SKIPPING FILE FOR ',i8.8,i7.6)
643 902 FORMAT (' REWINDING FILE BY ',i4,' RECORDS')
644  !
645 1010 FORMAT (/' *** WAVEWATCH-III ERROR IN W3SBS1/RDWIND : '/ &
646  ' FILE READ PAST EXPECTED TIME '/)
647  !
648 #ifdef W3_T
649 9000 FORMAT ( ' TEST RDWIND: TIME READ ',i8.8,1x,i6.6)
650 9001 FORMAT ( ' FIELD READ ',a)
651 #endif
652  !/
653  !/ End of RDWIND ----------------------------------------------------- /
654  !/

Referenced by w3sbs1().

◆ w3sbs1()

program w3sbs1

Program shell to run multi half-coupled.

Program shell or driver to run the multi-grid wave model in 'half-coupled' mode, that is running side-by-side with a weather model while waiting for wind field to become available.

This version is set up for running at NCEP with a single input wind file, and requires an additional input file. times.inp Input file with time stamps. Add to this input file a time stamp after the field has been properly added to the wind.ww3 or equavalent file. This file should have the time stamps of fields available in the first auxiliary wind input file (grid).

Apart from management of the time stepping, this code is identical to ww3_multi.ftn, and reads the corresponding input file ww3_multi.inp

Note hardwired options and system dependent parts as identified in Section 7.

Author
H. L. Tolman
A. Chawla
Date
05-Dec-2012

Definition at line 36 of file ww3_sbs1.F90.

References w3timemd::dsec21(), wmmdatmd::etime, w3servmd::extcde(), file(), w3gdatmd::filext, w3idatmd::flwind, w3gdatmd::gname, wmmdatmd::improc, include(), wmmdatmd::mdse, wmmdatmd::mdsf, wmmdatmd::mdss, wmmdatmd::mdst, w3gdatmd::nauxgr, w3gdatmd::ngrids, wmmdatmd::nmproc, wmmdatmd::nmpscr, wmmdatmd::nrgrd, w3gdatmd::nx, w3gdatmd::ny, rdtime(), rdwind(), wmmdatmd::stime, w3gdatmd::w3setg(), w3idatmd::w3seti(), wmfinlmd::wmfinl(), wminitmd::wminit(), wmunitmd::wmuget(), wmunitmd::wmuset(), and wmwavemd::wmwave().

w3timemd::dsec21
real function dsec21(TIME1, TIME2)
Definition: w3timemd.F90:333
w3wdatmd::time
integer, dimension(:), pointer time
Definition: w3wdatmd.F90:172
w3servmd::extcde
subroutine extcde(IEXIT, UNIT, MSG, FILE, LINE, COMM)
Definition: w3servmd.F90:736