Hi SCHISM group,
When running SCHISM with WWMIII using the WWM parametric wave boundary format:
FILEBOUND = 'wwmbnd.gr3'
FILEWAVE = 'wave_param_boundary.dat'
IBOUNDFORMAT = 1
LBCWA = T
LBCSE = T
LINHOM = T
LBCSP = F
the file wave_param_boundary.dat exists and contains time-varying, spatially non-uniform parametric wave boundary data. Each time block contains one header line followed by one row for each active wave boundary node:
header line
Hs Period Direction Spread Shape SpreadMode GaussWidth Gamma
Hs Period Direction Spread Shape SpreadMode GaussWidth Gamma
...
However, the model does not read the file specified by FILEWAVE. Instead, it attempts to read the Fortran default file name fort.50005.
The model may fail with an error similar to:
forrtl: No such file or directory
unit 50005
file fort.50005
or the WWM wave boundary file is not read correctly.
In WWMIII, FILEWAVE is assigned to WAV%FNAME, while WAV%FHNDL is a Fortran unit number, for example:
WAV%FHNDL = 50005
WAV%FNAME = FILEWAVE
However, in the READWAVEPARWWM subroutine in src/WWMIII/wwm_initio.F90, the IBOUNDFORMAT=1 path directly reads from the unit:
READ(WAV%FHNDL,*)
READ(WAV%FHNDL, *) SPPARM(:,IPP)
If the unit has not previously been explicitly opened with:
OPEN(WAV%FHNDL, FILE=TRIM(WAV%FNAME), STATUS='OLD')
Fortran treats the unopened unit 50005 as the default file fort.50005. As a result, the model does not read:
FILEWAVE = 'wave_param_boundary.dat'
and instead tries to read:
In READWAVEPARWWM, before the first READ(WAV%FHNDL,*), check whether the unit is already opened. If it is not opened, explicitly open the file specified by WAV%FNAME.
Add a local variable:
Then add the following before reading from WAV%FHNDL:
INQUIRE(WAV%FHNDL, OPENED=LOPEN2)
IF (.NOT. LOPEN2) THEN
CALL TEST_FILE_EXIST_DIE('Missing wave file : ', TRIM(WAV%FNAME))
OPEN(WAV%FHNDL, FILE=TRIM(WAV%FNAME), STATUS='OLD')
END IF
If the statement is split across multiple lines, Fortran free-form continuation should be used, for example:
CALL TEST_FILE_EXIST_DIE('Missing wave file : ', &
& TRIM(WAV%FNAME))
After adding the explicit INQUIRE and OPEN logic, IBOUNDFORMAT=1 correctly reads the file specified by FILEWAVE, such as wave_param_boundary.dat, and the model can continue running normally.
Hi SCHISM group,
When running SCHISM with WWMIII using the WWM parametric wave boundary format:
the file
wave_param_boundary.datexists and contains time-varying, spatially non-uniform parametric wave boundary data. Each time block contains one header line followed by one row for each active wave boundary node:However, the model does not read the file specified by
FILEWAVE. Instead, it attempts to read the Fortran default file namefort.50005.The model may fail with an error similar to:
or the WWM wave boundary file is not read correctly.
In WWMIII,
FILEWAVEis assigned toWAV%FNAME, whileWAV%FHNDLis a Fortran unit number, for example:However, in the
READWAVEPARWWMsubroutine insrc/WWMIII/wwm_initio.F90, theIBOUNDFORMAT=1path directly reads from the unit:If the unit has not previously been explicitly opened with:
Fortran treats the unopened unit
50005as the default filefort.50005. As a result, the model does not read:and instead tries to read:
In
READWAVEPARWWM, before the firstREAD(WAV%FHNDL,*), check whether the unit is already opened. If it is not opened, explicitly open the file specified byWAV%FNAME.Add a local variable:
Then add the following before reading from
WAV%FHNDL:If the statement is split across multiple lines, Fortran free-form continuation should be used, for example:
After adding the explicit
INQUIREandOPENlogic,IBOUNDFORMAT=1correctly reads the file specified byFILEWAVE, such aswave_param_boundary.dat, and the model can continue running normally.