From de2eb44013a7a4a7a61ea5e149666e77b1b68ba4 Mon Sep 17 00:00:00 2001 From: Antoine Cyril David Hoffmann <ahoffman@spcpc606.epfl.ch> Date: Mon, 1 Feb 2021 12:12:15 +0100 Subject: [PATCH] cp at end of sim only if not crashed simulation --- src/basic_mod.F90 | 1 + src/diagnose.F90 | 2 +- src/tesend.F90 | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/basic_mod.F90 b/src/basic_mod.F90 index 6cf33393..a0205cbc 100644 --- a/src/basic_mod.F90 +++ b/src/basic_mod.F90 @@ -16,6 +16,7 @@ MODULE basic INTEGER :: cstep = 0 ! Current step number (Init from restart file) LOGICAL :: RESTART = .FALSE. ! Signal end of run LOGICAL :: nlend = .FALSE. ! Signal end of run + LOGICAL :: crash = .FALSE. ! Signal end of crashed run INTEGER :: ierr ! flag for MPI error INTEGER :: my_id ! identification number of current process diff --git a/src/diagnose.F90 b/src/diagnose.F90 index eb726906..041d4f88 100644 --- a/src/diagnose.F90 +++ b/src/diagnose.F90 @@ -261,7 +261,7 @@ SUBROUTINE diagnose(kstep) ! Close all diagnostic files CALL closef(fidres) - IF (nsave_cp .GT. 0) THEN + IF ((nsave_cp .GT. 0) .AND. (.NOT. crashed)) THEN CALL checkpoint_save(cp_counter) CALL closef(fidrst) ENDIF diff --git a/src/tesend.F90 b/src/tesend.F90 index faffab8c..ec76bb15 100644 --- a/src/tesend.F90 +++ b/src/tesend.F90 @@ -14,6 +14,7 @@ SUBROUTINE tesend & ierr) IF( mlend ) THEN nlend = .TRUE. + crash = .TRUE. IF (my_id .EQ. 0) WRITE(*,'(/a)') 'rhs are NaN/Inf' IF (my_id .EQ. 0) WRITE(*,*) 'Run terminated at cstep=',cstep RETURN -- GitLab