Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Mon Dec 11, 2017 11:25 am




Post new topic Reply to topic  [ 6 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: 6
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: 6
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: 1017
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 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  
PostPosted: Tue Nov 21, 2017 6:16 pm 
Offline

Joined: Tue Jun 06, 2017 1:54 pm
Posts: 6
Location: Dalhousie University
This reply only partly applies to my setup. Indeed, my NAVG=0 (=> no output) differs from my NRST=1440 (=> daily restart writing). However, AVERAGES is switched off and DIAGNOSTICS_TS and DIAGNOSTICS_BIO are switched on, though, with NDIA=NRST=1440. Hence, I would expect that the diagnostics output should not be affected by what you described above.

I agree that NDIA must not be larger than NRST in order to allow for correct averaged values. However, identical (and also smaller) values should be fine, conceptually and technically, following your explanation.

In addition, I set NHIS=NRST=1440 for my history output. To my understanding, this should not cause the writing into a wrong history file record after restart if the actual output step is still smaller than or equal to NDEFHIS+1 ("+1" because of initial values written to record 1 for first history file of new simulation).


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 21, 2017 6:32 pm 
Offline
Site Admin
User avatar

Joined: Wed Feb 26, 2003 4:41 pm
Posts: 1017
Location: IMCS, Rutgers University
Smaller values of NDIA are possible but its value needs to be an exact factor of NRST, say NDIA=NRST/2 should give you an integer. The time window (in seconds) should be exactly divided by DT.


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 21, 2017 7:49 pm 
Offline

Joined: Tue Jun 06, 2017 1:54 pm
Posts: 6
Location: Dalhousie University
Both is the case as NDIA=NRST and NDIA is defined anyway as an integer factor applied to DT.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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