Describe the bug
When using the TR1 flag to enable non-linear triad interactions, the w3str1md.F90 is performing a divide by zero when starting from a coldstart.
Perhaps easily solved by adding a test on EMEAN after summing the spectrum between sections 3 and 4? Something like:
! 3. Add tail beyond discrete spectrum
!
EBAND = EB(NK) / DDEN(NK)
EMEAN = EMEAN + EBAND * FTE
SIGM01 = SIGM01 + EBAND * FTF
!
! 3.1 [NEW] Check for zero energy
!
IF(EMEAN .EQ. 0.0) THEN
S(:) = 0
D(:) = 0
RETURN
END IF
!
! 4. Final processing
!
SIGM01 = SIGM01 / EMEAN
To Reproduce
Run a TR1 test case with a cold start. You might need debug flags to catch the divide by zero.
Expected behavior
Runtime error something like this (generated by GNU compiler):
Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
Describe the bug When using the TR1 flag to enable non-linear triad interactions, the
w3str1md.F90
is performing a divide by zero when starting from a coldstart.This is due to EMEAN being zero at coldstart, therefore causing problems at this line: https://github.com/NOAA-EMC/WW3/blob/02cb72f7b15d7384c507813a3a6569265f588491/model/src/w3str1md.F90#L431
Perhaps easily solved by adding a test on EMEAN after summing the spectrum between sections 3 and 4? Something like:
To Reproduce Run a TR1 test case with a cold start. You might need debug flags to catch the divide by zero.
Expected behavior Runtime error something like this (generated by GNU compiler):
Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.