New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#1325 (Incorrect output restart filenames generated if files exist and ln_clobber is .true.) – NEMO

Opened 10 years ago

Closed 10 years ago

#1325 closed Bug (fixed)

Incorrect output restart filenames generated if files exist and ln_clobber is .true.

Reported by: acc Owned by: nemo
Priority: low Milestone:
Component: OCE Version: v3.6
Severity: Keywords:
Cc:

Description

With ln_clobber set to .true. it should be possible to repeat runs and overwrite earlier versions of output files. The logic is currently flawed in that the processor number is appended to the base filename for checking if the file exists in iom_open and again in iom_nf90_open for output files. The string variable is reset between calls if the file does not exist but not if the file exists and ln_clobber is .true. The result is an extra set of restart files with names such as:

ORCA2_00000465_restart_0000_0000.nc

Changing:

          IF( llwrt .AND. .NOT. ln_clobber ) THEN   ! we stop as we want to write in a new file 
             CALL ctl_stop( TRIM(clinfo), 'We want to write in a new file but '//TRIM(clname)//' already exists...' )
             istop = nstop + 1                      ! make sure that istop /= nstop so we don't open the file
          ENDIF

to:

          IF( llwrt .AND. .NOT. ln_clobber ) THEN   ! we stop as we want to write in a new file 
             CALL ctl_stop( TRIM(clinfo), 'We want to write in a new file but '//TRIM(clname)//' already exists...' )
             istop = nstop + 1                      ! make sure that istop /= nstop so we don't open the file
          ELSEIF( llwrt ) THEN     ! the file exists and we are in write mode with permission to 
             clname = cltmpn       ! overwrite so get back the file name without the cpu number
          ENDIF

in iom.F90 gives the correct behaviour.

Commit History (1)

ChangesetAuthorTimeChangeLog
4650acc2014-05-29T11:08:22+02:00

#1325. Minor fix to iom.F90 to prevent incorrect filename generation and allow existing restart files to be correctly overwritten if ln_clobber is .true.

Change History (1)

comment:1 Changed 10 years ago by acc

  • Resolution set to fixed
  • Status changed from new to closed

Fix submitted at revision 4650. Ticket closed.

Note: See TracTickets for help on using tickets.