there is no way to recover an output NetCDF file after a NEMO crash. The reason is that .nc-file is not closed properly.
Is it possible to close .nc-file during NEMO modelling?
Or maybe create separate .nc-file for each time?
You don’t need to close the NetCDF file you are writing to update the value of its number of records. This can be done through a call to NF90_SYNC: “The function NF90_SYNC offers a way to synchronize the disk copy of a netCDF dataset with in-memory buffers”. see section 2.11 NF90_SYNC in the nf90 doc.
When you use xios, you can specify at which frequency you want that xios is calling NF90_SYNC by the means of the sync_freq keyword in the field_def_nemo-*.xml. files.
For example, If you specify sync_freq=“1ts” in your field_def_nemo-*.xml, the value of the number of records already written in your NetCDF files will be updated at every time step.
Note that calling NF90_SYNC at high frequency can strongly degrade the model performances… This should not be done in production mode.