Opened 11 years ago

Closed 11 years ago

#605 closed bug (Fixed)

Corrected FLOATS restart

Reported by: arango Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description (last modified by arango)

Corrected a problem in def_floats.F when setting the DRIFTER(ng)%bounded switch during restart. If the floats have not been released yet at restart time, the values of Xgrid, Ygrid, and Zgrid will be _FillValue (i.e. 1.0E+37) in the FLOATS NetCDF file. The calls to netcdf_get_fvar in def_floats.F will replace such values with zeros.

Therefore, we need to read Zgrid first so the DRIFTER(ng)%bounded switch is FALSE in such cases to trigger the release. This switch will be set corrected if Xgrid and Ygrid are read last. The zero values in Xgrid and/or Ygrid due to unreleased floats will set DRIFTER(ng)%bounded=FALSE because of the lower bound is 0.5 in fractional coordinates. So the order of operations in def_floats.F is very important during restart.

The correct code is then:

# ifdef SOLVE3D
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Zgrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(N(ng),r8)).or.                           &
     &        (Tinp(l).lt.0.0_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(izgrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(izrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO
!
# endif
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Xgrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(Lm(ng)+1,r8)-0.5_r8).or.                 &
     &        (Tinp(l).lt.0.5_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(ixgrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(ixrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO
!
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Ygrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(Mm(ng)+1,r8)-0.5_r8).or.                 &
     &        (Tinp(l).lt.0.5_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(iygrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(iyrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO

Many thanks to Diego Narvaez for bringing this issue to my attention. This issue was also discussed in forum sometime ago but I was not able to reproduce it. We didn't have enough information.

I also correct a bug in packing.F when computing the norm in parallel. Many thanks to Andy for reporting this problem.

Change History (1)

comment:1 by arango, 11 years ago

Description: modified (diff)
Resolution: Fixed
Status: newclosed
Note: See TracTickets for help on using tickets.