diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90 index cb9783d9bd9288aa639deb93933f07d4fc9c173e..ee532312ba59768a2d0048e3e2231b13c0afbf1d 100644 --- a/src/MNH/modeln.f90 +++ b/src/MNH/modeln.f90 @@ -499,6 +499,7 @@ INTEGER :: IPOINTS CHARACTER(len=16) :: YTCOUNT,YPOINTS CHARACTER(LEN=:), ALLOCATABLE :: YDADNAME ! +INTEGER :: IBAKSTEP ! Number of timesteps since previous backup INTEGER :: ISYNCHRO ! model synchronic index relative to its father ! = 1 for the first time step in phase with DAD ! = 0 for the last time step (out of phase) @@ -1036,7 +1037,12 @@ IF ( nfile_backup_current < NBAK_NUMB ) THEN CALL WRITE_SURF_ATM_n(YSURF_CUR,'MESONH','ALL') IF ( KTCOUNT > 1) THEN CALL DIAG_SURF_ATM_n(YSURF_CUR,'MESONH') - CALL WRITE_DIAG_SURF_ATM_n(YSURF_CUR,'MESONH','ALL', KTCOUNT/nfile_backup_current) + IF ( NFILE_BACKUP_CURRENT == 1 ) THEN + IBAKSTEP = KTCOUNT - 1 + ELSE + IBAKSTEP = KTCOUNT - TBACKUPN(NFILE_BACKUP_CURRENT - 1)%NSTEP + END IF + CALL WRITE_DIAG_SURF_ATM_n( YSURF_CUR, 'MESONH', 'ALL', IBAKSTEP ) END IF NULLIFY(TFILE_SURFEX) END IF