Restart, LDEFOUT and NDEFHIS

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
dputrasahan
Posts: 12
Joined: Mon May 15, 2006 1:18 pm
Location: Scripps Institution of Oceanography

Restart, LDEFOUT and NDEFHIS

#1 Unread post by dputrasahan »

Hi all!

I'm having some problems with restarting ROMS again. I'm running a 10 year spinup, and in the first year (say Oct. 2002), the model had been accidentally aborted. I tried to restart the model from where it was aborted (Oct. 2002, NRREC=60) and it worked. However, the output wasn't written to the his.nc files. ROMS has continued to write out the rst record, but not the his output. When I restarted in Oct. 2002, it will run but not write out the results until it reaches the end of the year, and then when it goes over to the next year (Jan. 2003), it will start to write out his records on a new file. Is there any way I can get ROMS to write out the his records during the year it restarted? I tried using LDEFOUT == F, hoping that the output would append to existing his.nc file for the particular restart year. I also tried LDEFOUT == T, hoping it creates a new file for the restart year. None of these options would write out the output for the restart year. These are some options that I've set in the ocean.in file.

NTIMES == 2073600
DT == 150.0d0
NDTFAST == 43

NRREC == 60
LcycleRST == T
NRST == 1440

LDEFOUT == T
NHIS == 2880
NDEFHIS == 207360

Is it possible that since NDEFHIS == 207360, it waits for that time index before creating a new his.nc file? I would like it to create a new his.nc file for each new year, but could there be an option/switch to let it continue writing out the output for the restart year (append to old file or a new file doesn't matter), and then make new his.nc files for the subsequent years?

Thank you so much in advance.

Cheers,
Dian

longmtm
Posts: 55
Joined: Tue Dec 13, 2005 7:23 pm
Location: Univ of Maryland Center for Environmental Science

#2 Unread post by longmtm »

I guess you can specify a smaller value of the NDEFHIS, so that you will have multiple history outpus per year, then you shall be able to restart from in the middle of a year,

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#3 Unread post by kate »

I believe it to be a bug in output.F. I reported restart issues to Hernan a few years ago and I have a version which behaves closer to how I think it should... Here's part of a diff:

Code: Select all

@@ -67,17 +73,32 @@
 !
       IF (LdefHIS(ng)) THEN
         IF (ndefHIS(ng).gt.0) THEN
-          IF (idefHIS(ng).lt.0) THEN
-            idefHIS(ng)=((ntstart(ng)-1)/ndefHIS(ng))*ndefHIS(ng)
-            IF (idefHIS(ng).lt.iic(ng)-1) THEN
-              idefHIS(ng)=idefHIS(ng)+ndefHIS(ng)
+          IF (iic(ng).eq.ntstart(ng)) THEN
+            lcheck=.TRUE.
+            IF (idefHIS(ng).lt.0) THEN
+              idefHIS(ng)=((ntstart(ng)-1)/ndefHIS(ng))*ndefHIS(ng)
+              IF (idefHIS(ng).lt.iic(ng)-1) THEN
+                idefHIS(ng)=idefHIS(ng)+ndefHIS(ng)
+              END IF
+            END IF
+            IF (MOD(iic(ng)-1,ndefHIS(ng)).gt.0) THEN
+              ldef=ldefout(ng)
+            ELSE
+              ldef=.TRUE.
             END IF
+          ELSE
+            lcheck=.FALSE.
           END IF
           IF ((iic(ng)-1).eq.idefHIS(ng)) THEN
             idefHIS(ng)=idefHIS(ng)+ndefHIS(ng)
+            ldef=.TRUE.
+            lcheck=.TRUE.
+! think about this one...
             IF (nHIS(ng).ne.ndefHIS(ng).and.iic(ng).eq.ntstart(ng)) THEN
               idefHIS(ng)=idefHIS(ng)+nHIS(ng)
             END IF
+          END IF
+          IF (lcheck) THEN
             NrecHIS(ng)=0
             ifile=(iic(ng)-1)/ndefHIS(ng)+1
             IF (Master) THEN
@@ -86,12 +107,6 @@
   10          FORMAT (a,'_',i4.4,'.nc')
             END IF
             IF (ncHISid(ng).ne.-1) status=nf90_close(ncHISid(ng))
-            IF ((iic(ng).eq.ntstart(ng)).and.                               &
-     &          (MOD(iic(ng)-1,ndefHIS(ng)).gt.0)) THEN
-              ldef=ldefout(ng)
-            ELSE
-              ldef=.TRUE.
-            END IF
             CALL def_his (ng, ldef)
             IF (exit_flag.ne.NoError) RETURN
             LwrtHIS(ng)=.TRUE.
Note that you have to declare lcheck at the top.

Post Reply