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

[ww3_multi] Negative UNIT number for ASCII output #1116

Closed
ukmo-ccbunney opened this issue Nov 1, 2023 · 3 comments · Fixed by #1118
Closed

[ww3_multi] Negative UNIT number for ASCII output #1116

ukmo-ccbunney opened this issue Nov 1, 2023 · 3 comments · Fixed by #1118
Assignees
Labels
bug Something isn't working

Comments

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented Nov 1, 2023

Describe the bug
When compiling ww3_multi with the ASCII switch, the unit number for ASCII gridded output (w3iogo) is being set to -1

To Reproduce
Run mww3_test_09/MPI_ASCII regtest; model core dumps trying to open output file.
Issue is likely compiler dependent.

I am getting the issue when using the GNU GFortran compiler and a bit of debug PRINT statements shows that the unit number for NDSOA is -1 for ASCII output here, which is invalid:

WW3/model/src/w3iogomd.F90

Lines 2621 to 2624 in 4cd995d

#ifdef W3_ASCII
OPEN (NDSOA,FILE=FNMPRE(:J)//'out_grd.'//FILEXT(:I)//'.txt', &
form ='FORMATTED',ERR=800,IOSTAT=IERR)
#endif

I am not sure how the unit numbers are set in WW3_MULTI, I will investigate.

Expected behavior
Core dump.
Error message I get is:

8  0x52D40F in __w3servmd_MOD_extcde at w3servmd.F90:867
#9  0x4D26C0 in __w3iogomd_MOD_w3iogo at w3iogomd.F90:4042
#10  0x544B23 in __w3wavemd_MOD_w3wave at w3wavemd.F90:2599
#11  0x44912C in __wmwavemd_MOD_wmwave at wmwavemd.F90:1286
#12  0x4012F2 in w3mlti at ww3_multi.F90:190

 *** WAVEWATCH III ERROR IN W3IOGO :
     ERROR IN OPENING FILE
     IOSTAT = 5002


EXTCDE MPI_ABORT, IEXIT=    41
@ukmo-ccbunney ukmo-ccbunney added the bug Something isn't working label Nov 1, 2023
@ukmo-ccbunney ukmo-ccbunney self-assigned this Nov 1, 2023
@ukmo-ccbunney
Copy link
Collaborator Author

I think it perhaps needs an extra entry like this in wminitmd to set the unit number for ASCII out_grd output?

WW3/model/src/wminitmd.F90

Lines 5448 to 5456 in 4cd995d

IF ( MDS(7,I) .NE. -1 ) THEN
IF ( IAPROC .EQ. NAPFLD ) THEN
TNAME = TRIM(FNMPRE)//'out_grd.' // FILEXT(:II)
CALL WMUSET ( MDSE,MDST, MDS(7,I), .TRUE., NAME=TNAME )
ELSE
CALL WMUSET ( MDSE,MDST, MDS(7,I), .FALSE. )
MDS(7,I) = -1
END IF
END IF

@MatthewMasarik-NOAA
Copy link
Collaborator

I think it perhaps needs an extra entry like this in wminitmd to set the unit number for ASCII out_grd output?

WW3/model/src/wminitmd.F90

Lines 5448 to 5456 in 4cd995d

IF ( MDS(7,I) .NE. -1 ) THEN
IF ( IAPROC .EQ. NAPFLD ) THEN
TNAME = TRIM(FNMPRE)//'out_grd.' // FILEXT(:II)
CALL WMUSET ( MDSE,MDST, MDS(7,I), .TRUE., NAME=TNAME )
ELSE
CALL WMUSET ( MDSE,MDST, MDS(7,I), .FALSE. )
MDS(7,I) = -1
END IF
END IF

Interesting. That looks promising.

@ukmo-ccbunney
Copy link
Collaborator Author

OK. I think I have a fix for this.
The unit number assignment in ww3_multi is much more complex than I realised!
I will raise a PR after running some tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants