Skip to content

Commit

Permalink
init_bugs2: fix issue NOAA-EMC#1017 and other issues pointed out by C…
Browse files Browse the repository at this point in the history
…hris and others
  • Loading branch information
aronroland committed Jan 10, 2024
1 parent 57ba5f8 commit 5482da9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
24 changes: 18 additions & 6 deletions model/src/w3profsmd_pdlib.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2854,12 +2854,24 @@ SUBROUTINE PDLIB_W3XYPUG_BLOCK_EXPLICIT(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)
!
USE W3ODATMD, only: IAPROC
USE W3GDATMD, only: B_JGS_USE_JACOBI
USE W3TIMEMD, only: DSEC21
USE W3ODATMD, only: TBPI0, TBPIN, FLBPI
USE W3WDATMD, only: TIME

LOGICAL, INTENT(IN) :: LCALC
INTEGER, INTENT(IN) :: IMOD
REAL, INTENT(IN) :: FACX, FACY, DTG, VGX, VGY
REAL :: RD1, RD2

IF ( FLBPI ) THEN
RD1 = DSEC21 ( TBPI0, TIME )
RD2 = DSEC21 ( TBPI0, TBPIN )
ELSE
RD1=1.
RD2=0.
END IF

CALL PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)
CALL PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, RD1, RD2, DTG, VGX, VGY, LCALC)
!/
!/ End of W3XYPFSN ----------------------------------------------------- /
!/
Expand Down Expand Up @@ -6328,7 +6340,7 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
#endif
END SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK
!/ ------------------------------------------------------------------- /
SUBROUTINE PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)
SUBROUTINE PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, RD10, RD20, DTG, VGX, VGY, LCALC)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
Expand Down Expand Up @@ -6402,7 +6414,7 @@ SUBROUTINE PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)

INTEGER, INTENT(IN) :: IMOD

REAL, INTENT(IN) :: FACX, FACY, DTG, VGX, VGY
REAL, INTENT(IN) :: FACX, FACY, DTG, VGX, VGY, RD10, RD20

REAL :: KTMP(3), UTILDE(NTH), ST(NTH,NPA)
REAL :: FL11(NTH), FL12(NTH), FL21(NTH), FL22(NTH), FL31(NTH), FL32(NTH), KKSUM(NTH,NPA)
Expand All @@ -6411,7 +6423,7 @@ SUBROUTINE PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)
REAL :: KSIG(NPA), CGSIG(NPA), CXX(NTH,NPA), CYY(NTH,NPA)
REAL :: LAMBDAX(NTH), LAMBDAY(NTH)
REAL :: DTMAX(NTH), DTMAXEXP(NTH), DTMAXOUT, DTMAXGL
REAL :: FIN(1), FOUT(1), REST, CFLXY, RD1, RD2, RD10, RD20
REAL :: FIN(1), FOUT(1), REST, CFLXY, RD1, RD2
REAL :: UOLD(NTH,NPA), U(NTH,NPA)

REAL, PARAMETER :: ONESIXTH = 1.0/6.0
Expand Down Expand Up @@ -6570,8 +6582,8 @@ SUBROUTINE PDLIB_EXPLICIT_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCALC)
IF ( FLBPI ) THEN
DO ITH = 1, NTH
ISP = ITH + (IK-1) * NTH
RD1 = RD10 - DTG * REAL(ITER(IK)-IT)/REAL(ITER(IK))
RD2 = RD20
RD1=RD10 - DTMAXGL * REAL(ITER(IK)-IT)/REAL(ITER(IK))
RD2=RD20
IF ( RD2 .GT. 0.001 ) THEN
RD2 = MIN(1.,MAX(0.,RD1/RD2))
RD1 = 1. - RD2
Expand Down
7 changes: 5 additions & 2 deletions model/src/w3sdb1md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ SUBROUTINE W3SDB1 (IX, A, DEPTH, EMEAN, FMEAN, WNMEAN, CG, LBREAK, S, D )
S = 0.
D = 0.

THR = DBLE(1.E-15)
IF (SUM(A) .LT. THR) RETURN
IF (EMEAN .LT. TINY(1.d0)) THEN
S = 0
D = 0
RETURN
ENDIF

IWB = 1
!
Expand Down
2 changes: 1 addition & 1 deletion model/src/w3srcemd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
IF (.NOT. FSSOURCE .or. LSLOC) THEN
#endif
#ifdef W3_TR1
CALL W3STR1 ( SPEC, SPECOLD, CG1, WN1, DEPTH, IX, VSTR, VDTR )
CALL W3STR1 ( SPEC, SPECOLD, CG1, WN1, DEPTH, IX, ETOT, VSTR, VDTR )
#endif
#ifdef W3_PDLIB
ENDIF
Expand Down
10 changes: 8 additions & 2 deletions model/src/w3str1md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ MODULE W3STR1MD
!>
!> @author A. J. van der Westhuysen @date 13-Jan-2013
!>
SUBROUTINE W3STR1 (A, AOLD, CG, WN, DEPTH, IX, S, D)
SUBROUTINE W3STR1 (A, AOLD, CG, WN, DEPTH, IX, EMEAN, S, D)
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
Expand Down Expand Up @@ -320,7 +320,7 @@ SUBROUTINE W3STR1 (A, AOLD, CG, WN, DEPTH, IX, S, D)
!/ ------------------------------------------------------------------- /
!/ Parameter list
!/
REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH, A(NSPEC), AOLD(NSPEC)
REAL, INTENT(IN) :: CG(NK), WN(NK), DEPTH, A(NSPEC), AOLD(NSPEC), EMEAN
INTEGER, INTENT(IN) :: IX
REAL, INTENT(OUT) :: S(NSPEC), D(NSPEC)
!/
Expand Down Expand Up @@ -396,6 +396,12 @@ SUBROUTINE W3STR1 (A, AOLD, CG, WN, DEPTH, IX, S, D)
!
! 1. Integral over directions
!
IF (EMEAN .LT. TINY(1.)) THEN
S = 0
D = 0
RETURN
ENDIF

SIGM01 = 0.
EMEAN = 0.
JACEPS = 1E-12
Expand Down

0 comments on commit 5482da9

Please sign in to comment.