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.
#369 (Restart module writes restart files twice) – NEMO

Opened 15 years ago

Closed 15 years ago

Last modified 6 years ago

#369 closed Bug (invalid)

Restart module writes restart files twice

Reported by: ed.blockley Owned by: nemo
Priority: low Milestone:
Component: OCE Version: trunk
Severity: Keywords: restartability
Cc:

Description

In restart.F90 at line at line 84 rst_opn() opens and sets up the restart file if we are one timestep before a restart timestep (kt == nitrst).
It then sets lrst_oce to .TRUE. which causes the rst_write() routine to be called by step.F90 in the same timestep.
At the next timestep (kt==nitrst) we again right the restart file with the correct fields and close it.

Therefore we are writing the data into the file twice (at kt==nitrst-1 and kt==nitrst).

As this was causing us a slow down I have fixed this in my local code by extending the IF( kt == nitrst ) loop to include all the iom_rstput() calls (i.e. by moving line 168 up to line 127).
Perhaps this may not be appropriate for all users though?

Commit History (0)

(No commits)

Change History (4)

comment:1 Changed 15 years ago by smasson

Yes, rst_write will be called by step.F90 when kt = nitrst - 1 and kt = nitrst BUT I done it on purpose!
If there is no bug..., rst_write will not do the same thing at each call. If you use the default format for restart files (def of jprstlib, line 36 of iom_def.F90), rst_write will in fact use iom_nf90.F90

  • at kt = nitrst - 1, it will define the variables (line 366 of iom_nf90) but it will skip writing part (line 415)
  • at kt = nitrst, it will now skip the variable definition (kvid > 0) and will do writing part (as kt = kwrite)

This trick was made to ensure performance when writing NetCDF file (first define all variables, next close the define mode, next write the data). With your modification, you define and write the data at the same time which should be very bad for the performance. That's why I am very surprised that you get opposite conclusion regarding the performance in your tests...
Could you tell me more?

comment:2 Changed 15 years ago by ed.blockley

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

Apologies. I hadn't looked through the iom_nf90 routine thoroughly enough and hadn't noticed the IF( kt == kwrite ) loop at line 415.
We were also thrown by the amount of time that the model was spending at kt=nitrst-1 forgetting that defining the variables in netCDF files tends to take up a fair bit of the time and also allocate space.

I have now closed this ticket as 'invalid'

comment:3 Changed 6 years ago by nemo

  • Keywords restartability added; restart removed

comment:4 Changed 6 years ago by marc

In 9207:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found
Note: See TracTickets for help on using tickets.