Bug with time-dependent bathymetry and PERFECT_RESTART

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
rtopper
Posts: 24
Joined: Fri Jul 04, 2014 2:32 pm
Location: MARUM, University of Bremen

Bug with time-dependent bathymetry and PERFECT_RESTART

#1 Unread post by rtopper »

Strictly speaking it is a bug, but it only affects users with a really specific combination of options.

When one sets LcycleRST == F in combination with SED_MORPH and PERFECT_RESTART, ROMS tries to write bath to an index exceeding the dimension bounds (three) at the fourth WRT_RST. It is an issue very similar to the one described in this 4 year old topic : viewtopic.php?f=24&t=1853&p=9724&hilit= ... ound#p9724

EDIT #1: I thought I had a fix, but I seem to be wrong ...
& GRID(ng) % h, &
^
ftn-772 crayftn: ERROR WRT_RST, File = wrt_rst.f90, Line = 126, Column = 39
The rank of this actual argument must match that of assumed-shape dummy argument "A".

Cray Fortran : Version 8.4.0 (u84052f84233i84288p84437a84011e84007z84437)
Cray Fortran : (x8412r84005w84007t8415b84042)
Cray Fortran : Fri Apr 15, 2016 18:14:44
Cray Fortran : Compile time: 0.5200 seconds
Cray Fortran : 659 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
Cray Fortran : "explain ftn-message number" gives more information about each message.

EDIT #2:

In def_rst.F the dimensions of the output to be written for the time varying bathymetry is defined with t2dgrd.

Code: Select all

        t2dgrd(1)=DimIDs( 1)
        t2dgrd(2)=DimIDs( 5)
        sr2dgrd(1)=DimIDs( 1)
        sr2dgrd(2)=DimIDs( 5)
        sr2dgrd(3)=DimIDs(12)
# ifdef PERFECT_RESTART
        t2dgrd(3)=DimIDs(31)
        t2dgrd(4)=DimIDs(12)
# else
        t2dgrd(3)=DimIDs(12)
Without PERFECT_RESTART the output for the time-varying bathymetry gets dimensions (xi_rho, eta_rho, time), i.e. DimIDs(1,5,12).
With PERFECT_RESTART the output gets dimensions (xi_rho,eta_rho,3) (4th dimension is not used).

I think we want to keep the dimensions of the time-varying bathymetry output at (xi_rho, eta_rho, time) even if PERFECT_RESTART is defined (seems to agree with how the bathymetry is read again in get_state.F).

I think we can change lines 720 - 735 in def_rst.F from

Code: Select all

#if defined SEDIMENT && defined SED_MORPH
!
!  Define  time-varying bathymetry
!
        Vinfo( 1)=Vname(1,idbath)
        Vinfo( 2)=Vname(2,idbath)
        Vinfo( 3)=Vname(3,idbath)
        Vinfo(14)=Vname(4,idbath)
        Vinfo(16)=Vname(1,idtime)
        Vinfo(22)='coordinates'
        Aval(5)=REAL(Iinfo(1,idbath,ng),r8)
        status=def_var(ng, iNLM, RST(ng)%ncid, RST(ng)%Vid(idbath),     &
     &                 NF_FRST, nvd3, t2dgrd, Aval, Vinfo, ncname,      &
     &                 SetFillVal = .FALSE.)
        IF (exit_flag.ne.NoError) RETURN
#endif
to

Code: Select all

#if defined SEDIMENT && defined SED_MORPH
!
!  Define  time-varying bathymetry
!
        Vinfo( 1)=Vname(1,idbath)
        Vinfo( 2)=Vname(2,idbath)
        Vinfo( 3)=Vname(3,idbath)
        Vinfo(14)=Vname(4,idbath)
        Vinfo(16)=Vname(1,idtime)
        Vinfo(22)='coordinates'
        Aval(5)=REAL(Iinfo(1,idbath,ng),r8)
        status=def_var(ng, iNLM, RST(ng)%ncid, RST(ng)%Vid(idbath),     &
# ifdef PERFECT_RESTART
     &                 NF_FRST, nvd3, sr2dgrd, Aval, Vinfo, ncname,      &
# else
     &                 NF_FRST, nvd3, t2dgrd, Aval, Vinfo, ncname,      &
# endif
     &                 SetFillVal = .FALSE.)
        IF (exit_flag.ne.NoError) RETURN
#endif
sr2dgrd has dimensions (xi_rho, eta_rho, time) with and without PERFECT_RESTART.

I haven't found a reason yet to use t2dgrd instead of sr2dgrd when PERFECT_RESTART is not defined. It might therefore be possible to just replace t2dgrd with sr2dgrd for the bathymetry output.

Post Reply