Index: /trunk/LMDZ.GENERIC/changelog.txt
===================================================================
--- /trunk/LMDZ.GENERIC/changelog.txt	(revision 3310)
+++ /trunk/LMDZ.GENERIC/changelog.txt	(revision 3311)
@@ -1907,6 +1907,11 @@
  (see routine "read_volcano" in volcano.F90)
 
-== 20/11/2023 == YJ
+== 22/04/2024 == YJ
 - Cosmetic + clarifying some variables and comments in chemistry
 - add controle variable for actinique UV flux in photochemistry
   and output surface UV flux in diagspecUV.nc
+
+== 22/04/2024 == YJ
+Split open_startphy to create_restartphy and only open_startphy
+will before open_startphy was doing both by create_restartphy
+at firstcall
Index: /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90	(revision 3310)
+++ /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90	(revision 3311)
@@ -40,5 +40,5 @@
     PUBLIC inquire_dimension, inquire_dimension_length
     PUBLIC inquire_field, inquire_field_ndims
-    PUBLIC open_startphy,close_startphy,open_restartphy,close_restartphy
+    PUBLIC open_startphy,close_startphy,create_restartphy,open_restartphy,close_restartphy
     
 CONTAINS
@@ -458,10 +458,9 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-  SUBROUTINE open_restartphy(filename)
+  SUBROUTINE create_restartphy(filename)
   USE netcdf, only: NF90_CREATE, NF90_CLOBBER, NF90_64BIT_OFFSET, &
                     NF90_NOERR, nf90_strerror, &
                     NF90_PUT_ATT, NF90_GLOBAL, NF90_DEF_DIM, &
-                    NF90_UNLIMITED, NF90_ENDDEF, &
-                    NF90_WRITE, NF90_OPEN
+                    NF90_UNLIMITED, NF90_ENDDEF
   USE mod_phys_lmdz_para, only: is_master
   USE mod_grid_phy_lmdz, only: klon_glo
@@ -475,10 +474,7 @@
     CHARACTER(LEN=*),INTENT(IN) :: filename
     INTEGER                     :: ierr
-    LOGICAL,SAVE :: already_created=.false.
-!$OMP THREADPRIVATE(already_created)
-    
-    IF (is_master) THEN
-      if (.not.already_created) then
-        ! At the very first call, create the file
+    
+    IF (is_master) THEN
+      
         ierr=NF90_CREATE(filename,IOR(NF90_CLOBBER,NF90_64BIT_OFFSET), &
                           nid_restart)
@@ -488,15 +484,4 @@
           CALL ABORT
         ENDIF
-        already_created=.true.
-      else
-        ! Just open the file
-        ierr=NF90_OPEN(filename,NF90_WRITE,nid_restart)
-        IF (ierr/=NF90_NOERR) THEN
-          write(*,*)'open_restartphy: problem opening file '//trim(filename)
-          write(*,*)trim(nf90_strerror(ierr))
-          CALL ABORT
-        ENDIF
-        return
-      endif ! of if (.not.already_created)
 
       ierr=NF90_PUT_ATT(nid_restart,NF90_GLOBAL,"title",&
@@ -573,4 +558,23 @@
         CALL ABORT
       ENDIF
+    ENDIF
+
+  END SUBROUTINE create_restartphy
+
+  SUBROUTINE open_restartphy(filename)
+  USE netcdf, only: NF90_OPEN, NF90_NOERR, NF90_WRITE, nf90_strerror
+  USE mod_phys_lmdz_para, only: is_master
+
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(IN) :: filename
+    INTEGER                     :: ierr
+    
+    IF (is_master) THEN
+        ierr=NF90_OPEN(filename,NF90_WRITE,nid_restart)
+        IF (ierr/=NF90_NOERR) THEN
+          write(*,*)'open_restartphy: problem opening file '//trim(filename)
+          write(*,*)trim(nf90_strerror(ierr))
+          CALL ABORT
+        ENDIF
     ENDIF
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 3310)
+++ /trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90	(revision 3311)
@@ -14,5 +14,5 @@
                        emisice, emissiv,             &
                        iceradius, dtemisice, phisfi
-  use iostart, only : open_restartphy, close_restartphy, & 
+  use iostart, only : create_restartphy, close_restartphy, & 
                       put_var, put_field, length
   use mod_grid_phy_lmdz, only : klon_glo
@@ -46,5 +46,5 @@
   
   ! Create physics start file
-  call open_restartphy(filename)
+  call create_restartphy(filename)
 
 ! tab_cntrl() contains run parameters
