Skip to content

Commit 3e59145

Browse files
Fix failure of restart reproducability in cases with variable water level and deep bathymetry. In subroutine W3ULEV KDCHK computed from bathymetric depth rather than total water level. (NOAA-EMC#1591)
1 parent ed516b8 commit 3e59145

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

model/src/w3initmd.F90

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
514514
#ifdef W3_DIST
515515
CHARACTER(LEN=12) :: FORMAT
516516
#endif
517+
REAL :: DEPTHbat,WNbat,CGbat,KDCHCK
518+
REAL :: KDMAX = 4.
519+
517520
CHARACTER(LEN=23) :: DTME21
518521
CHARACTER(LEN=30) :: LFILE, TFILE
519522
integer :: memunit
@@ -1399,7 +1402,27 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
13991402
WRITE (NDST,9051) IS, DEPTH
14001403
#endif
14011404
!
1402-
DO IK=0, NK+1
1405+
! In shallow water, KDCHCK < KDMAX, assign time varying WN and CG as water level changes.
1406+
! In deep water, KDCHCK >= KDMAX, assign time constant WN and CG based on bathymetric depth (-ZB).
1407+
!
1408+
! Calculate the wavenumber for lowest frequency based on bathymetric depth
1409+
IF (IS.GT.0) THEN
1410+
DEPTHbat = MAX(DMIN,-ZB(IS))
1411+
ELSE
1412+
DEPTHbat = DMIN
1413+
END IF
1414+
#ifdef W3_PDLIB
1415+
CALL WAVNU3(SIG(1),DEPTHbat,WNbat,CGbat)
1416+
#else
1417+
CALL WAVNU1(SIG(1),DEPTHbat,WNbat,CGbat)
1418+
#endif
1419+
KDCHCK = WNbat * DEPTHbat
1420+
IF ( KDCHCK .GE. KDMAX ) THEN
1421+
! Use time constant CG and WN based on bathymetry for this point rather than time varying total depth.
1422+
DEPTH=DEPTHbat
1423+
ENDIF
1424+
1425+
DO IK=0, NK+1
14031426
!
14041427
! Calculate wavenumbers and group velocities.
14051428
#ifdef W3_PDLIB

model/src/w3updtmd.F90

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,7 @@ SUBROUTINE W3ULEV ( A, VA )
22012201
OWN(NK), DWN(NK)
22022202
REAL :: KDMAX = 4., RDKMIN = 0.05
22032203
REAL :: WLVeff
2204+
REAL :: DEPTHbat, CGbat, WNbat
22042205
#ifdef W3_T3
22052206
REAL :: OUT(NK,NTH)
22062207
#endif
@@ -2345,7 +2346,18 @@ SUBROUTINE W3ULEV ( A, VA )
23452346
!
23462347
! 2.a Check if deep water
23472348
!
2348-
KDCHCK = WN(1,ISEA) * MIN( DWO(ISEA) , DW(ISEA) )
2349+
!
2350+
! In shallow water, KDCHCK < KDMAX, assign time varying WN and CG as water level changes.
2351+
! In deep water, KDCHCK >= KDMAX, assign time constant WN and CG based on bathymetric depth (-ZB).
2352+
!
2353+
! Calculate the wavenumber for lowest frequency based on bathymetric depth
2354+
DEPTHbat=MAX(DMIN,-ZB(ISEA))
2355+
#ifdef W3_PDLIB
2356+
CALL WAVNU3(SIG(1),DEPTHbat,WNbat,CGbat)
2357+
#else
2358+
CALL WAVNU1(SIG(1),DEPTHbat,WNbat,CGbat)
2359+
#endif
2360+
KDCHCK = WNbat * DEPTHbat
23492361
IF ( KDCHCK .LT. KDMAX ) THEN
23502362
!
23512363
! 2.b Update grid and save old grid

0 commit comments

Comments
 (0)