I tried to restart a ROMS run by changing these parameters from the original ocean.in file:
Code: Select all
NRREC == -1
LDEFOUT == F ! to append to existing file
ININAME = (restart file)
The condition at line 75 of Nonlinear/output.F:
Code: Select all
IF (iic(ng)-1).eq.idefHIS(ng)) THEN
I was able to solve this (somewhat) by adding the following kludge code below line 106 of Nonlinear/output.F:
Code: Select all
! Kludge code to output data from history files
IF ((nrrec(ng).ne.0).and.(iic(ng).eq.ntstart(ng)).and. &
& (MOD(iic(ng)-1,ndefHIS(ng)).gt.0)) THEN
ldef=ldefout(ng)
ifile=INT((iic(ng)-1)/ndefHIS(ng))+1
IF (Master) THEN
lstr=LEN_TRIM(HISbase(ng))
WRITE (HISname(ng),10) HISbase(ng)(1:lstr-3),ifile
END IF
IF (ncHISid(ng).ne.-1) status=nf90_close(ncHISid(ng))
CALL def_his (ng, ldef)
IF (exit_flag.ne.NoError) RETURN
LwrtHIS(ng)=.TRUE.
END IF
This could probably be fixed in the code in lines 67-106 by using appropriate conditional statements.
I was unable to get the code to write out to the correct index in the netcdf file. In my case, NRST and NHIS are the same, so the last history record matches the last timestep. Where the restart happened, I'd get two of the same timestep in the history file. I tried altering NrecHIS, but that didn't work and then saw that there was also tHISindx(ng) in wrt_his.F, but couldn't figure out how to set it properly.