From e7b01d2ad565554b50a7cda33182b12770ba40bd Mon Sep 17 00:00:00 2001
From: Antoine Cyril David Hoffmann <ahoffman@spcpc606.epfl.ch>
Date: Fri, 23 Apr 2021 09:46:40 +0200
Subject: [PATCH] diagnostic to have a cp at tf if no crash

---
 src/diagnose.F90 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/diagnose.F90 b/src/diagnose.F90
index eb03b75a..33e8dbee 100644
--- a/src/diagnose.F90
+++ b/src/diagnose.F90
@@ -261,6 +261,11 @@ SUBROUTINE diagnose(kstep)
      CALL cpu_time(finish)
      CALL attach(fidres, "/data/input","cpu_time",finish-start)
 
+     ! make a checkpoint at last timestep if not crashed
+     IF(.NOT. crashed) THEN
+       IF(my_id .EQ. 0) write(*,*) 'Saving last state'
+       CALL diagnose_5d
+     ENDIF
      ! Display computational time cost
      IF (my_id .EQ. 0) CALL display_h_min_s(finish-start)
 
-- 
GitLab