Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fb 360 calendar #8

Merged
merged 15 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/ftn/w3gdatmd.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
! FLDRY Log. Public Flag for 'dry' run (IO and data
! processing only).
! FLCx Log. Public Flags for prop. is different spaces.
! FLSOU Log. Public Flag for source term calcualtion.
! FLSOU Log. Public Flag for source term calculation.
! FUNO3 Log. Public Flag for 3rd order UNO3 scheme on SMC grid.
! FVERG Log. Public Flag for 1-2-1 averaging smoothing on SMC grid.
! FSWND Log. Public Flag for sea-point only wind input on SMC grid.
Expand Down
9 changes: 5 additions & 4 deletions model/ftn/w3iogrmd.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
!/
!/ Private parameter statements (ID strings)
!/
CHARACTER(LEN=10), PARAMETER, PRIVATE :: VERGRD = '2020-04-15'
CHARACTER(LEN=10), PARAMETER, PRIVATE :: VERGRD = '2020-06-18'
CHARACTER(LEN=35), PARAMETER, PRIVATE :: &
IDSTR = 'WAVEWATCH III MODEL DEFINITION FILE'
!/
Expand Down Expand Up @@ -146,6 +146,7 @@
!/ 18-Aug-2018 : S_{ice} IC5 (Q. Liu) ( version 6.06 )
!/ 26-Aug-2018 : UOST (Mentaschi et al. 2015, 2018) ( version 6.06 )
!/ 15-Apr-2020 : Adds optional opt-out for CFL on BC ( version 7.08 )
!/ 18-Jun-2020 : Adds 360-day calendar option ( version 7.08 )
!/
!/ Copyright 2009-2013 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -234,7 +235,7 @@
!/NLX USE W3SNLXMD, ONLY: INSNLX
!/NLS USE W3SNLSMD, ONLY: INSNLS
!/IS2 USE W3SIS2MD, ONLY: INSIS2
USE W3TIMEMD, ONLY: NOLEAP
USE W3TIMEMD, ONLY: CALTYPE
USE W3SERVMD, ONLY: EXTCDE
!/S USE W3SERVMD, ONLY: STRACE
USE W3DISPMD
Expand Down Expand Up @@ -640,7 +641,7 @@
FICE0, FICEN, FICEL, PFMOVE, FLDRY, FLCX, FLCY, FLCTH, &
FLCK, FLSOU, FLBPI, FLBPO, CLATS, CLATIS, CTHG0S, &
STEXU, STEYU, STEDU, IICEHMIN, IICEHINIT, IICEDISP, &
ICESCALES(1:4), NOLEAP, CMPRTRCK, IICEHFAC, IICEHDISP, &
ICESCALES(1:4), CALTYPE, CMPRTRCK, IICEHFAC, IICEHDISP,&
IICEDDISP, IICEFDISP, BTBETA

WRITE(NDSM)GRIDSHIFT
Expand Down Expand Up @@ -780,7 +781,7 @@
FICE0, FICEN, FICEL, PFMOVE, FLDRY, FLCX, FLCY, &
FLCTH, FLCK, FLSOU, FLBPI, FLBPO, CLATS, CLATIS, &
CTHG0S, STEXU, STEYU, STEDU, IICEHMIN, IICEHINIT, &
IICEDISP, ICESCALES(1:4), NOLEAP, CMPRTRCK, IICEHFAC, &
IICEDISP, ICESCALES(1:4), CALTYPE, CMPRTRCK, IICEHFAC, &
IICEDDISP, IICEHDISP, IICEFDISP, BTBETA
!/DEBUGIOGR WRITE(740+IAPROC,*) 'W3IOGR, step 7.14'
!/DEBUGIOGR FLUSH(740+IAPROC)
Expand Down
97 changes: 70 additions & 27 deletions model/ftn/w3timemd.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
!
INTEGER, PRIVATE :: PRFTB(8)
LOGICAL, PRIVATE :: FLPROF = .FALSE.
LOGICAL, PUBLIC :: NOLEAP
CHARACTER, PUBLIC :: CALTYPE*8
!
CONTAINS
!/ ------------------------------------------------------------------- /
Expand Down Expand Up @@ -192,13 +192,14 @@
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 29-Nov-1999 |
!/ | Last update : 18-Jun-2020 |
!/ +-----------------------------------+
!/ Based on INCYMD of the GLA GCM.
!/
!/ 18-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
!/ 29-Nov-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
!/ 10-Jan-2017 : Add NOLEAP option, 365 day calendar ( version 6.00 )
!/ 18-Jun-2020 : Add 360-day calendar option ( version 7.08 )
!/
! 1. Purpose :
!
Expand Down Expand Up @@ -247,26 +248,34 @@
!/
INTEGER :: NY, NM, ND
INTEGER, SAVE :: NDPM(12)
DATA NDPM / 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /
!/S INTEGER, SAVE :: IENT = 0
LOGICAL :: LEAP
!/
!/ ------------------------------------------------------------------- /
!/
!/S CALL STRACE (IENT, 'IYMD21')
!
! Declare the number of days in month depending on calendar
!
IF (TRIM(CALTYPE) .EQ. '360_day' ) THEN
NDPM=(/ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 /)
ELSE
NDPM=(/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
END IF
!
! "Unpack" and increment date :
!
NY = NYMD / 10000
NM = MOD(NYMD,10000) / 100
NM = MIN ( 12 , MAX(1,NM) )
ND = MOD(NYMD,100) + M
LEAP = MOD(NY,400).EQ.0 .OR. &
( MOD(NY,4).EQ.0 .AND. MOD(NY,100).NE.0 )
! Add override for simulations with no leap years
IF (NOLEAP) then
IF (TRIM(CALTYPE) .EQ. 'standard' ) THEN
LEAP = MOD(NY,400).EQ.0 .OR. &
( MOD(NY,4).EQ.0 .AND. MOD(NY,100).NE.0 )
ELSE
LEAP = .false.
ENDIF
END IF
!
! M = -1, change month if necessary :
!
Expand Down Expand Up @@ -314,12 +323,13 @@
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 05-Jan-2001 |
!/ | Last update : 18-Jun-2020 |
!/ +-----------------------------------+
!/
!/ 23-Mar-1993 : Final FORTRAN 77 ( version 1.18 )
!/ 29-Nov-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
!/ 05-Jan-2001 : Y2K leap year error correction. ( version 2.05 )
!/ 18-Jun-2020 : Add 360-day calendar support ( version 7.08 )
!/
!/
! 1. Purpose :
Expand Down Expand Up @@ -401,9 +411,17 @@
IF (NY1.EQ.NY2) GOTO 200
IF (NST.GT.0) THEN
NY2 = NY2 - 1
ND = ND + MYMD21 ( NY2*10000 + 1231 )
IF (TRIM(CALTYPE) .EQ. '360_day' ) THEN
ND = ND + MYMD21 ( NY2*10000 + 1230 )
ELSE
ND = ND + MYMD21 ( NY2*10000 + 1231 )
END IF
ELSE
ND = ND - MYMD21 ( NY2*10000 + 1231 )
IF (TRIM(CALTYPE) .EQ. '360_day' ) THEN
ND = ND - MYMD21 ( NY2*10000 + 1230 )
ELSE
ND = ND - MYMD21 ( NY2*10000 + 1231 )
END IF
NY2 = NY2 + 1
ENDIF
GOTO 100
Expand All @@ -428,13 +446,14 @@
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 29-Nov-1999 |
!/ | Last update : 18-Jun-2020 |
!/ +-----------------------------------+
!/ Based on MODYMD of the GLA GCM.
!/
!/ 19-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
!/ 29-Nov-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
!/ 10-Jan-2017 : Add NOLEAP option, 365 day calendar ( version 6.01 )
!/ 18-Jun-2020 : Add 360-day calendar support ( version 7.08 )
!/
! 1. Purpose :
!
Expand Down Expand Up @@ -482,23 +501,31 @@
!/
INTEGER :: NY, NM, ND
INTEGER, SAVE :: NDPM(12)
DATA NDPM / 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /
!/S INTEGER, SAVE :: IENT = 0
LOGICAL :: LEAP
!/
!/ ------------------------------------------------------------------- /
!/
!/S CALL STRACE (IENT, 'MYMD21')
!
! Declare the number of days in month depending on calendar
!
IF (TRIM(CALTYPE) .EQ. '360_day' ) THEN
NDPM=(/ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 /)
ELSE
NDPM=(/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
END IF
!
! "Unpack" and increment date :
!
NY = NYMD / 10000
NM = MOD(NYMD,10000) / 100
ND = MOD(NYMD,100)
LEAP = MOD(NY,400).EQ.0 .OR. &
( MOD(NY,4).EQ.0 .AND. MOD(NY,100).NE.0 )
!Allow override for NoLeap simulations
IF (NOLEAP) THEN
IF (TRIM(CALTYPE) .EQ. 'standard' ) THEN
LEAP = MOD(NY,400).EQ.0 .OR. &
( MOD(NY,4).EQ.0 .AND. MOD(NY,100).NE.0 )
ELSE
LEAP=.false.
ENDIF
!
Expand Down Expand Up @@ -1431,10 +1458,11 @@
!/ | WAVEWATCH III NOAA/NCEP |
!/ | M. Accensi |
!/ | FORTRAN 90 |
!/ | Last update : 15-May-2018 |
!/ | Last update : 18-Jun-2020 |
!/ +-----------------------------------+
!/
!/ 15-May-2018 : Origination ( version 6.05 )
!/ 18-Jun-2020 : Addition of 360-day calendar ( version 7.08 )
!/
! 1. Purpose :
!
Expand Down Expand Up @@ -1484,19 +1512,34 @@
!
! Convert dates and times :
!
A1 = (14-T1(2))/12
B1 = T1(1) + 4800 - A1
C1 = T1(2) + 12*A1 - 3
D1 = T1(3) + (153*C1 + 2)/5 + 365*B1 + B1/4 -B1/100 + B1/400
E1 = 3600.0*T1(5) + 60.0*(T1(6)-T1(4)) + T1(7) + T1(8)/1000.0
IF (TRIM(CALTYPE) .EQ. '360_day' ) THEN
A1 = (T2(1)-T1(1))*360 + (T2(2)-T1(2))*30 + (T2(3)-T1(3))

E1 = 3600.0*T1(5) + 60.0*(T1(6)-T1(4)) + T1(7) + T1(8)/1000.0
E2 = 3600.0*T2(5) + 60.0*(T2(6)-T2(4)) + T2(7) + T2(8)/1000.0
!
A2 = (14-T2(2))/12
B2 = T2(1) + 4800 - A2
C2 = T2(2) + 12*A2 - 3
D2 = T2(3) + (153*C2 + 2)/5 + 365*B2 + B2/4 -B2/100 + B2/400
E2 = 3600.0*T2(5) + 60.0*(T2(6)-T2(4)) + T2(7) + T2(8)/1000.0
TSUB = DBLE(A1) + (E2-E1)/86400.0d0
ELSE
A1 = (14-T1(2))/12
B1 = T1(1) + 4800 - A1
C1 = T1(2) + 12*A1 - 3
D1 = T1(3) + (153*C1 + 2)/5 + 365*B1
IF (TRIM(CALTYPE) .EQ. 'standard' ) THEN
D1 = D1 + B1/4 -B1/100 + B1/400
ENDIF
E1 = 3600.0*T1(5) + 60.0*(T1(6)-T1(4)) + T1(7) + T1(8)/1000.0
!
A2 = (14-T2(2))/12
B2 = T2(1) + 4800 - A2
C2 = T2(2) + 12*A2 - 3
D2 = T2(3) + (153*C2 + 2)/5 + 365*B2
IF (TRIM(CALTYPE) .EQ. 'standard' ) THEN
D2 = D2 + B2/4 -B2/100 + B2/400
ENDIF
E2 = 3600.0*T2(5) + 60.0*(T2(6)-T2(4)) + T2(7) + T2(8)/1000.0
!
TSUB = DBLE(D2-D1) + (E2-E1)/86400.0d0
TSUB = DBLE(D2-D1) + (E2-E1)/86400.0d0
ENDIF
!
RETURN
!/
Expand Down
29 changes: 22 additions & 7 deletions model/ftn/ww3_grid.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
!/ 22-Jan-2020 : Update default values for IS2 ( version 7.05 )
!/ 20-Feb-2020 : Include Romero's dissipation in ST4 ( version 7.06 )
!/ 15-Apr-2020 : Adds optional opt-out for CFL on BC ( version 7.08 )
!/ 18-Jun-2020 : Adds 360-day calendar option ( version 7.08 )
!/
!/ Copyright 2009-2013 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -519,7 +520,7 @@
IPBPO, ISBPO, XBPO, YBPO, RDBPO, FNMPRE, &
IHMAX, HSPMIN, WSMULT, WSCUT, FLCOMB, &
NOSWLL, PTMETH, PTFCUT
USE W3TIMEMD, ONLY: NOLEAP
USE W3TIMEMD, ONLY: CALTYPE
USE W3NMLGRIDMD
!
!/NL3 USE W3SNL3MD, ONLY: LAMMAX, DELTHM
Expand Down Expand Up @@ -892,8 +893,8 @@
RWNDC, FACBERG, NOSW, GSHIFT, WCOR1, WCOR2, &
STDX, STDY, STDT, ICEHMIN, ICEHINIT, ICEDISP, &
ICESLN, ICEWIND, ICESNL, ICESDS, ICEHFAC, &
ICEHDISP, ICEDDISP, ICEFDISP, NOLEAP, TRCKCMPR, &
PTM, PTFC, BTBET
ICEHDISP, ICEDDISP, ICEFDISP, CALTYPE, &
TRCKCMPR, PTM, PTFC, BTBET
NAMELIST /OUTS/ P2SF, I1P2SF, I2P2SF, &
US3D, I1US3D, I2US3D, &
USSP, IUSSP, STK_WN, &
Expand Down Expand Up @@ -2239,7 +2240,7 @@
STDY = -1.
STDT = -1.
ICEDISP = .FALSE.
NOLEAP = .FALSE.
CALTYPE = 'standard'
! Variables for 3D array output
E3D=0
I1E3D=1
Expand Down Expand Up @@ -2582,6 +2583,11 @@
!/MLIM J = 1
WRITE (NDSO,967) FHMAX, FHMAX/SQRT(2.), YESXNO(J)
IF ( FHMAX.LT.0.50 .AND. J.EQ.1 ) WRITE (NDST,968)
!
IF (TRIM(CALTYPE) .NE. 'standard' .AND. &
TRIM(CALTYPE) .NE. '360_day' .AND. &
TRIM(CALTYPE) .NE. '365_day' ) GOTO 2003
WRITE (NDST,1973) CALTYPE
WRITE (NDSO,*)
!
! 6.x Read values for FLD stress calculation
Expand Down Expand Up @@ -2761,7 +2767,7 @@
STDX, STDY, STDT, ICEHMIN, ICEHFAC, &
ICEHINIT, ICEDISP, ICEHDISP, &
ICESLN, ICEWIND, ICESNL, ICESDS, &
ICEDDISP,ICEFDISP, NOLEAP, TRCKCMPR, &
ICEDDISP,ICEFDISP, CALTYPE, TRCKCMPR, &
BTBETA
ELSE
WRITE (NDSO,2966) CICE0, CICEN, LICE, PMOVE, XSEED, FLAGTR, &
Expand All @@ -2771,7 +2777,7 @@
STDX, STDY, STDT, ICEHMIN, ICEHFAC, &
ICEHINIT, ICEDISP, ICEHDISP, &
ICESLN, ICEWIND, ICESNL, ICESDS, &
ICEDDISP, ICEFDISP, NOLEAP, TRCKCMPR, &
ICEDDISP, ICEFDISP, CALTYPE, TRCKCMPR,&
BTBETA
END IF
!
Expand Down Expand Up @@ -5188,6 +5194,10 @@
2002 CONTINUE
WRITE (NDSE,1002) IERR
CALL EXTCDE ( 62 )
!
2003 CONTINUE
WRITE (NDSE,1003)
CALL EXTCDE ( 64 )
!
2222 CONTINUE
IF ( GTYPE .NE. UNGTYPE) THEN
Expand Down Expand Up @@ -5689,6 +5699,7 @@
' Hrms,max/d factor (-) :',F9.3/ &
' Limiter activated : ',A)
968 FORMAT ( ' *** FACTOR DANGEROUSLY LOW ***')
1973 FORMAT (/' Calendar type : ',A)
!
!/REF1 969 FORMAT (/' Shoreline reflection ',A/ &
!/REF1 ' --------------------------------------------------')
Expand Down Expand Up @@ -5781,7 +5792,7 @@
' ICESLN = ',F6.2,', ICEWIND = ',F6.2, &
', ICESNL = ',F6.2,', ICESDS = ',F5.2,','/ &
' ICEDDISP = ',F5.2,', ICEFDISP = ',F5.2, &
', NOLEAP = ',L3,' , TRCKCMPR = ', L3,','/ &
', CALTYPE = ',A8,' , TRCKCMPR = ', L3,','/ &
' BTBET = ', F6.2, ' /')
!
2976 FORMAT ( ' &OUTS P2SF =',I2,', I1P2SF =',I2,', I2P2SF =',I3,','/&
Expand Down Expand Up @@ -5964,6 +5975,10 @@
1002 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
' ERROR IN READING FROM INPUT FILE'/ &
' IOSTAT =',I5/)
!
1003 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
' INVALID CALENDAR TYPE: SELECT ONE OF:', &
' standard, 360_day, or 365_day '/)
!
1004 FORMAT (/' *** WAVEWATCH III ERROR IN W3GRID : '/ &
' CANNOT READ UNFORMATTED (IDFM = 3) FROM UNIT', &
Expand Down
Loading