Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Sun Nov 19, 2017 9:42 pm




Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Author Message
PostPosted: Wed Oct 04, 2017 4:36 pm 
Offline

Joined: Tue Jun 06, 2017 1:54 pm
Posts: 4
Location: Dalhousie University
Hello,

There seems to be a bug in the DEF_DIAGS at the point where the output time step for the diagnostics file is determined after a restart of ROMS. In my code (which is from August this year) lines 721-734 read as:
Code:
!
!  Set unlimited time record dimension to the appropriate value.
!
        IF (nRST(ng).eq.nDIA(ng)) THEN
          IF (ndefDIA(ng).gt.0) THEN
            DIA(ng)%Rindex=((ntstart(ng)-1)-                            &
     &                      ndefDIA(ng)*((ntstart(ng)-1)/ndefDIA(ng)))/ &
     &                     nDIA(ng)
          ELSE
            DIA(ng)%Rindex=(ntstart(ng)-1)/nDIA(ng)
          END IF
        ELSE
          DIA(ng)%Rindex=rec_size
        END IF

In case nRST does not equal nDIA and the last written restart time stamp is before the last one in the diagnostics file, the old data in the diagnostics file are not overwritten at the correct position but the newly calculated data are appended to the file. I suppose changing the logic in DEF_DIAGS analogous to that of DEF_HIS should solve this issue.

Best,
Fabian


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 16, 2017 12:07 am 
Offline

Joined: Tue Jun 06, 2017 1:54 pm
Posts: 4
Location: Dalhousie University
It seems the DEF_HIS logic for determining the output record (see below) also has a flaw.
Code:
!
!  Set unlimited time record dimension to the appropriate value.
!
        IF (ndefHIS(ng).gt.0) THEN
          HIS(ng)%Rindex=((ntstart(ng)-1)-                              &
     &                    ndefHIS(ng)*((ntstart(ng)-1)/ndefHIS(ng)))/   &
     &                   nHIS(ng)
        ELSE
          HIS(ng)%Rindex=(ntstart(ng)-1)/nHIS(ng)
        END IF
        HIS(ng)%Rindex=MIN(HIS(ng)%Rindex,rec_size)


Today I had to restart a simulation with daily HIS (and RST) output after 3 days of simulated time with the first HIS file still being the correct output file. However, the first call of WRT_HIS in the re-started job (initialised at day 4 midnight) did not write to the 5th record but to the 4th, i.e., the last record from the previous job was overwritten incorrectly (and subsequent output also was written to the wrong records).

I replaced the code as follows and now it works correctly:
Code:
!
!  Set unlimited time record dimension to the appropriate value.
!
        IF (ndefHIS(ng).gt.0) THEN
          IF ((ntstart(ng)-1).lt.ndefHIS(ng)) THEN
            HIS(ng)%Rindex=1+((ntstart(ng)-1)- ndefHIS(ng)*            &
     &                        ((ntstart(ng)-1)/ndefHIS(ng)))/nHIS(ng)
          ELSE
            HIS(ng)%Rindex=  ((ntstart(ng)-1)- ndefHIS(ng)*            &
     &                        ((ntstart(ng)-1)/ndefHIS(ng)))/nHIS(ng)
          END IF
        ELSE
          HIS(ng)%Rindex=(ntstart(ng)-1)/nHIS(ng)
        END IF
        HIS(ng)%Rindex=MIN(HIS(ng)%Rindex,rec_size)


Best,
Fabian


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 17, 2017 6:26 pm 
Offline
Site Admin
User avatar

Joined: Wed Feb 26, 2003 4:41 pm
Posts: 1013
Location: IMCS, Rutgers University
Well, this logic has worked for us for years. Your problem is that NAVG and NDIA are inconsistent with NRST. If you have AVERAGES and DIAGNOSTICS_TS and/or DIAGNOSTICS_UV activated, you need to set NAVG=NDIA. It doesn't make any sense to have different values because you if you are going to compute balances and fluxes, you need data from both average and diagnostic NetCDF files. Since the ROMS data are time-averaged, you need to set NRST=NAVG=NDIA, if you want to restart your application. In this way, there is always a robust way to restart the summation for the time averages and have a continous solution.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group