Bug in output.F

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Bug in output.F

#1 Unread post by m.hadfield »

It is my habit to do ROMS simulations in discrete chunks, saving restart files and stopping & restarting the simulation at regular intervals. Normally I use the NDEFHIS and NDEFAVG parameters so that new history & averages files are created on each restart.

There's a bug in output.F in ROMS 2.1 that breaks handling of averages files (and I think diagnostic files) in this case. The problem is that at each restart a new averages file is created, overwriting the previously existing one that had the data. (This is hard to explain here. I can give a detailed example if necessary. Or try it for yourself.)

The cure is to change line 110 of output.F, ie

Code: Select all

 
          IF (idefavg(ng).lt.0) idefavg(ng)=ntstart-1
to

Code: Select all

          IF (idefavg(ng).lt.0) idefavg(ng)=ntstart+navg(ng)-1
and line 113, ie

Code: Select all

            ifile=(iic(ng)-1)/ndefavg(ng)+1
to

Code: Select all

            ifile=(iic(ng)-navg(ng)-1)/ndefavg(ng)+1
I have tested the modified code pretty thoroughly and confirmed that it always does what I expect. I have made corresponding changes to the diagnostic-file code, but haven't checked them out.

This bug has been reported and fixed before, but seems to have crept back in. I have been told that there are people who prefer the ROMS 2.1 behaviour and don't like my "fixes". If so, please speak uyp.

User avatar
arango
Site Admin
Posts: 1347
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

#2 Unread post by arango »

Well, I have to think about this one. In the past, we used the restart option to append to an existing time-averaged file. This was done for very long simulations computed by chunks. In this case, the chunks were run for the time necessary to compute one or several averaging cycles. For instance, if you are averaging every 30 days, you need to run for multiples of 30. The restart files also need to be save at the same interval.

Now, it is possible that we need both capabilities. I need to check if your fix allows for both capabilities. It will be undesirable to put a CPP option to differentiate between one or several output files strategies.

Post Reply