From 03d1eb366be851f7d66b2d0681a7fa9736ed8c90 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Tue, 13 Sep 2016 14:17:06 +0200
Subject: [PATCH] Philippe 13/09/2016: moved TOUTBAK datatype from mode_io.f90
 to modd_io.f90

---
 src/LIB/SURCOUCHE/src/modd_io.f90 | 20 ++++++++++++++++----
 src/LIB/SURCOUCHE/src/mode_io.f90 | 12 ------------
 src/MNH/modd_outn.f90             |  2 +-
 src/MNH/set_grid.f90              |  4 +++-
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/LIB/SURCOUCHE/src/modd_io.f90 b/src/LIB/SURCOUCHE/src/modd_io.f90
index d58eeb88c..156bba9a5 100644
--- a/src/LIB/SURCOUCHE/src/modd_io.f90
+++ b/src/LIB/SURCOUCHE/src/modd_io.f90
@@ -23,10 +23,6 @@ INTEGER, SAVE :: ISP     !! Actual proc number
 INTEGER, SAVE :: ISNPROC !! Total number of allocated processors 
 LOGICAL, SAVE :: GSMONOPROC = .FALSE. !! True if sequential execution (ISNPROC = 1) 
 
-TYPE LFIPARAM
-  INTEGER :: FITYP   ! FM File Type (used in FMCLOSE)
-END TYPE LFIPARAM
-
 LOGICAL, SAVE :: L1D   = .FALSE. ! TRUE if 1D model version
 LOGICAL, SAVE :: L2D   = .FALSE. ! TRUE if 2D model version
 LOGICAL, SAVE :: LPACK = .FALSE. ! TRUE if FM compression occurs in 1D or 2D model version
@@ -35,4 +31,20 @@ LOGICAL, SAVE :: LIOCDF4    = .FALSE. ! TRUE will enable full NetCDF4 (HDF5) I/O
 LOGICAL, SAVE :: LLFIOUT    = .FALSE. ! TRUE will also force LFI output when LIOCDF4 is on (debug only)  
 LOGICAL, SAVE :: LLFIREAD   = .FALSE. ! TRUE will force LFI read (instead of NetCDF) when LIOCDF4 is on (debug only)  
 LOGICAL, SAVE :: LDEFLATEX2 = .FALSE. ! TRUE to enable Zlib deflate compression on X2 fields  
+
+TYPE LFIPARAM
+  INTEGER :: FITYP   ! FM File Type (used in FMCLOSE)
+END TYPE LFIPARAM
+
+!Structure describing the characteristics of an output or a backup
+TYPE TOUTBAK
+  INTEGER           :: NBAKID = -1  !Backup number
+  INTEGER           :: NOUTID = -1  !Output number
+  INTEGER           :: NSTEP        !Timestep number
+  REAL              :: XTIME        !Time from start of the segment (in seconds and rounded to a timestep)
+  CHARACTER(LEN=28) :: CFILENAME    !Filename
+  INTEGER           :: NOUTDAD = -1 !Index of the corresponding dad file (file with same time)
+  CHARACTER(LEN=28) :: CDADFILENAME !Filename of dad
+END TYPE TOUTBAK
+
 END MODULE MODD_IO_ll
diff --git a/src/LIB/SURCOUCHE/src/mode_io.f90 b/src/LIB/SURCOUCHE/src/mode_io.f90
index 7f9f4e071..105c16b0d 100644
--- a/src/LIB/SURCOUCHE/src/mode_io.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io.f90
@@ -60,18 +60,6 @@ MODULE MODE_IO_ll
   PUBLIC  io_file,io_rank
   !JUANZ
 
-  !Structure describing the characteristics of an output or a backup
-  TYPE TOUTBAK
-    INTEGER           :: NBAKID = -1  !Backup number
-    INTEGER           :: NOUTID = -1  !Output number
-    INTEGER           :: NSTEP        !Timestep number
-    REAL              :: XTIME        !Time from start of the segment (in seconds and rounded to a timestep)
-    CHARACTER(LEN=28) :: CFILENAME    !Filename
-    INTEGER           :: NOUTDAD = -1 !Index of the corresponding dad file (file with same time)
-    CHARACTER(LEN=28) :: CDADFILENAME !Filename of dad
-  END TYPE TOUTBAK
-  PUBLIC TOUTBAK
-
 CONTAINS 
 
   FUNCTION IONEWFLU()
diff --git a/src/MNH/modd_outn.f90 b/src/MNH/modd_outn.f90
index 30e11345d..a51dc5863 100644
--- a/src/MNH/modd_outn.f90
+++ b/src/MNH/modd_outn.f90
@@ -43,7 +43,7 @@
 !
 !
 USE MODD_PARAMETERS, ONLY: JPMODELMAX, JPOUTMAX
-USE MODE_IO_ll, ONLY:TOUTBAK
+USE MODD_IO_ll, ONLY:TOUTBAK
 IMPLICIT NONE
 
 TYPE OUT_t
diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90
index 564184109..db683d82f 100644
--- a/src/MNH/set_grid.f90
+++ b/src/MNH/set_grid.f90
@@ -28,7 +28,7 @@ INTERFACE
                           TPDTMOD,TPDTCUR,KSTOP,KOUT_NUMB,TPOUTBAKN           )
 !
 USE MODD_TYPE_DATE
-USE MODE_IO_ll, ONLY:TOUTBAK
+USE MODD_IO_ll, ONLY:TOUTBAK
 !
 INTEGER,                INTENT(IN)  :: KMI       ! Model index
 CHARACTER (LEN=*),      INTENT(IN)  :: HINIFILE  ! Name of the initial file
@@ -255,6 +255,7 @@ USE MODD_OUT_n,       ONLY : OUT_MODEL
 USE MODD_VAR_ll,      ONLY : IP,NPROC
 USE MODD_DYN_n,       ONLY : DYN_MODEL
 USE MODD_IO_SURF_MNH, ONLY : IO_SURF_MNH_MODEL
+USE MODD_IO_ll,       ONLY : TOUTBAK
 !
 IMPLICIT NONE
 !
@@ -329,6 +330,7 @@ REAL, DIMENSION(:), ALLOCATABLE   :: ZYHAT_ll    !   Position y in the conformal
                                                  ! plane (array on the complete domain)
 REAL                         :: ZXHATM,ZYHATM    ! coordinates of mass point
 REAL                         :: ZLATORI, ZLONORI ! lat and lon of left-bottom point
+REAL                         :: ZOUT, ZOUTMAX    ! Time of output/backup
 INTEGER                      :: ITEMP            ! Intermediate variable
 INTEGER                      :: IPOS
 INTEGER                :: IGRID,ILENCH,IRESP  !   File
-- 
GitLab