From 2970f894e6ef1cc05e437c99bcb4e17a697796e1 Mon Sep 17 00:00:00 2001
From: Antoine Hoffmann <antoine.hoffmann@epfl.ch>
Date: Mon, 17 Jul 2023 10:13:45 +0200
Subject: [PATCH] add precision for opening the restart file

---
 src/restarts_mod.F90 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/restarts_mod.F90 b/src/restarts_mod.F90
index 93e09b75..491fd53b 100644
--- a/src/restarts_mod.F90
+++ b/src/restarts_mod.F90
@@ -10,6 +10,7 @@ USE grid, ONLY: local_Na,local_Na_offset,local_np,local_np_offset,&
 USE fields
 USE diagnostics_par
 USE time_integration
+USE prec_const, ONLY : xp,dp,sp
 IMPLICIT NONE
 
 PUBLIC :: load_moments!, write_restart
@@ -41,7 +42,11 @@ CONTAINS
     WRITE(rstfile,'(a,a1,i2.2,a3)') TRIM(resfile0),'_',job2load,'.h5'
     CALL speak("Resume from "//rstfile)
     ! Open file
-    CALL openf(rstfile, fidrst,mpicomm=comm0)
+    IF(xp .EQ. dp) THEN
+      CALL openf(rstfile, fidrst, mode='r', real_prec='d', mpicomm=comm0)
+    ELSE
+      CALL openf(rstfile, fidrst, mode='r', mpicomm=comm0)
+    ENDIF
     ! Get the dimensions of the checkpoint moments
     CALL getatt(fidrst,"/data/input/model",  "Na", Na_cp)
     CALL getatt(fidrst,"/data/input/grid" ,  "Np", Np_cp)
-- 
GitLab