diff --git a/src/MNH/modd_fmout.f90 b/src/MNH/modd_fmout.f90 index 22a73cee8f726a6caf76df613a1a26aca422dc3c..c7072ec844c892918186c2f0b82f53a2b5c39623 100644 --- a/src/MNH/modd_fmout.f90 +++ b/src/MNH/modd_fmout.f90 @@ -47,6 +47,10 @@ USE MODD_PARAMETERS ! IMPLICIT NONE ! +LOGICAL,SAVE :: LBAK_BEG = .FALSE. ! Force a backup at the first timestep + ! of the segment for all models +LOGICAL,SAVE :: LBAK_END = .FALSE. ! Force a backup at the last timestep + ! of the segment for all models REAL,SAVE,ALLOCATABLE,DIMENSION(:,:) :: XBAK_TIME ! XBAK_TIME(m,i) array of ! the increments in seconds from the beginning of the segment to the diff --git a/src/MNH/modn_fmout.f90 b/src/MNH/modn_fmout.f90 index a80e3f261e41149f0a990b7570cc6b4f2be3fcd1..3f3efbb8ec0db7cedd59ac92fa802a4d7d5d7a37 100644 --- a/src/MNH/modn_fmout.f90 +++ b/src/MNH/modn_fmout.f90 @@ -48,6 +48,6 @@ USE MODD_FMOUT ! IMPLICIT NONE ! -NAMELIST/NAM_FMOUT/XBAK_TIME,NBAK_STEP +NAMELIST/NAM_FMOUT/LBAK_BEG,LBAK_END,XBAK_TIME,NBAK_STEP ! END MODULE MODN_FMOUT diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90 index 0f0f7a9f7ec5d69de15fe61689228041bd345526..d5aa74c13f34abcafef150ff8bb7c5afb0a9d969 100644 --- a/src/MNH/set_grid.f90 +++ b/src/MNH/set_grid.f90 @@ -575,13 +575,21 @@ DO IMI = 1, NMODEL END IF END DO ! - !* 2.3.2 Group all backups in a common form + !* 2.3.2 Group all backups in a common form and add backups at beginning and end if requested + ! + IF (LBAK_BEG) IBAK_NUMB = IBAK_NUMB + 1 + IF (LBAK_END) IBAK_NUMB = IBAK_NUMB + 1 ! ALLOCATE(IBAK_STEP(IBAK_NUMB)) IBAK_STEP(:) = NNEGUNDEF ! IBAK_NUMB = 0 ! + IF (LBAK_BEG) THEN + IBAK_NUMB = IBAK_NUMB + 1 + IBAK_STEP(IBAK_NUMB) = 1 ! 1 is the 1st step number + END IF + ! DO JOUT = 1,JPOUTMAX IF (XBAK_TIME(IMI,JOUT) >= 0.) THEN IBAK_NUMB = IBAK_NUMB + 1 @@ -596,6 +604,12 @@ DO IMI = 1, NMODEL END IF END DO ! + IF (LBAK_END) THEN + IBAK_NUMB = IBAK_NUMB + 1 + IBAK_STEP(IBAK_NUMB) = NINT(XSEGLEN/DYN_MODEL(IMI)%XTSTEP)+1 + IF (IMI == 1) IBAK_STEP(IBAK_NUMB) = IBAK_STEP(IBAK_NUMB) - ISUP + END IF + ! !* 2.3.2 Find and remove duplicated entries ! DO JOUT = 1,IBAK_NUMB