From 70878adaffefd2647c6e2450abe853f1c4d665df Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Tue, 30 Nov 2021 10:49:02 +0100
Subject: [PATCH] Philippe 30/11/2021: Cray compiler problem: workaround
 compiler bug by changing intent of file (in->inout)

---
 LIBTOOLS/tools/lfi2cdf/src/mode_util.f90      |  2 +-
 src/LIB/SURCOUCHE/src/mode_io_field_write.f90 | 94 +++++++++----------
 src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90   |  8 +-
 src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90   | 36 +++----
 src/MNH/advection_metsv.f90                   |  4 +-
 src/MNH/c2r2_adjust.f90                       |  4 +-
 src/MNH/compute_r00.f90                       |  4 +-
 src/MNH/endstep_budget.f90                    |  4 +-
 src/MNH/free_atm_profile.f90                  |  4 +-
 src/MNH/khko_notadjust.f90                    |  4 +-
 src/MNH/les_specn.f90                         |  4 +-
 src/MNH/lima.f90                              |  4 +-
 src/MNH/lima_adjust.f90                       |  4 +-
 src/MNH/lima_adjust_split.f90                 |  4 +-
 src/MNH/lima_ccn_activation.f90               |  4 +-
 src/MNH/lima_notadjust.f90                    |  4 +-
 src/MNH/lima_nucleation_procs.f90             |  4 +-
 src/MNH/lima_warm.f90                         |  4 +-
 src/MNH/lima_warm_nucl.f90                    |  4 +-
 src/MNH/mnhwrite_zs_dummyn.f90                |  4 +-
 src/MNH/mode_les_diachro.f90                  | 18 ++--
 src/MNH/paspol.f90                            |  4 +-
 src/MNH/phys_paramn.f90                       |  4 +-
 src/MNH/prandtl.f90                           |  4 +-
 src/MNH/radiations.f90                        |  2 +-
 src/MNH/rain_c2r2_khko.f90                    |  4 +-
 src/MNH/resolved_cloud.f90                    |  4 +-
 src/MNH/set_cstn.f90                          |  4 +-
 src/MNH/set_mass.f90                          |  4 +-
 src/MNH/set_rsou.f90                          |  4 +-
 src/MNH/shallow_mf_pack.f90                   |  4 +-
 src/MNH/tke_eps_sources.f90                   |  4 +-
 src/MNH/turb.f90                              |  2 +-
 src/MNH/turb_cloud_index.f90                  |  4 +-
 src/MNH/turb_hor.f90                          |  4 +-
 src/MNH/turb_hor_dyn_corr.f90                 |  4 +-
 src/MNH/turb_hor_splt.f90                     |  4 +-
 src/MNH/turb_hor_sv_flux.f90                  |  4 +-
 src/MNH/turb_hor_thermo_corr.f90              |  4 +-
 src/MNH/turb_hor_thermo_flux.f90              |  4 +-
 src/MNH/turb_hor_uv.f90                       |  4 +-
 src/MNH/turb_hor_uw.f90                       |  4 +-
 src/MNH/turb_hor_vw.f90                       |  4 +-
 src/MNH/turb_ver.f90                          |  4 +-
 src/MNH/turb_ver_dyn_flux.f90                 |  4 +-
 src/MNH/turb_ver_sv_flux.f90                  |  4 +-
 src/MNH/turb_ver_thermo_corr.f90              |  4 +-
 src/MNH/turb_ver_thermo_flux.f90              |  4 +-
 src/MNH/uv_to_zonal_and_merid.f90             | 10 +-
 src/MNH/ver_int_thermo.f90                    |  4 +-
 src/MNH/ver_thermo.f90                        |  4 +-
 src/MNH/write_aircraft_balloon.f90            |  4 +-
 src/MNH/write_balloonn.f90                    |  4 +-
 src/MNH/write_budget.f90                      |  6 +-
 src/MNH/write_diachro.f90                     |  6 +-
 src/MNH/write_dummy_gr_fieldn.f90             |  4 +-
 src/MNH/write_hgrid.f90                       |  4 +-
 src/MNH/write_hgridn.f90                      |  4 +-
 src/MNH/write_lbn.f90                         |  4 +-
 src/MNH/write_les_budgetn.f90                 |  2 +-
 src/MNH/write_les_rt_budgetn.f90              |  2 +-
 src/MNH/write_les_sv_budgetn.f90              |  2 +-
 src/MNH/write_lesn.f90                        | 12 +--
 src/MNH/write_lfifm1_for_diag.f90             |  4 +-
 src/MNH/write_lfifm1_for_diag_supp.f90        |  4 +-
 src/MNH/write_lfifmn_fordiachron.f90          |  2 +-
 src/MNH/write_lfin.f90                        |  4 +-
 src/MNH/write_profilern.f90                   |  4 +-
 src/MNH/write_seriesn.f90                     |  4 +-
 src/MNH/write_stationn.f90                    |  4 +-
 src/MNH/zsmt_pgd.f90                          |  4 +-
 src/ZSOLVER/advection_metsv.f90               |  4 +-
 src/ZSOLVER/turb.f90                          |  2 +-
 src/ZSOLVER/turb_hor_dyn_corr.f90             |  4 +-
 src/ZSOLVER/turb_hor_thermo_flux.f90          |  4 +-
 75 files changed, 221 insertions(+), 221 deletions(-)

diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
index 5bca2401c..3a23df757 100644
--- a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
+++ b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
@@ -1596,7 +1596,7 @@ END DO
     USE MODD_IO,           ONLY: TFILEDATA
     use mode_io_tools_nc4, only: IO_Dim_find_create_nc4, IO_Dim_find_byname_nc4
 
-    TYPE(TFILEDATA),INTENT(IN)    :: TPFILE
+    TYPE(TFILEDATA),INTENT(INOUT) :: TPFILE
     TYPE(workfield),INTENT(INOUT) :: TPREC
     INTEGER,        INTENT(OUT)   :: KRESP
 
diff --git a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90
index 1879a20a2..dec7aca4c 100644
--- a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90
@@ -130,7 +130,7 @@ CONTAINS
 
 
   SUBROUTINE IO_File_write_check(TPFILE,HSUBR,KRESP)
-    TYPE(TFILEDATA),  INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),  INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*), INTENT(IN)  :: HSUBR
     INTEGER,          INTENT(OUT) :: KRESP
     !
@@ -161,7 +161,7 @@ CONTAINS
 
 
   SUBROUTINE IO_Format_write_select(TPFILE,OLFI,ONC4)
-    TYPE(TFILEDATA), INTENT(IN)  :: TPFILE ! File structure
+    TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE ! File structure
     LOGICAL,         INTENT(OUT) :: OLFI   ! Write in LFI format?
     LOGICAL,         INTENT(OUT) :: ONC4   ! Write in netCDF format?
 
@@ -227,7 +227,7 @@ CONTAINS
 
 
   SUBROUTINE IO_Header_write(TPFILE,HDAD_NAME)
-    TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE   ! File structure
+    TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! File structure
     CHARACTER(LEN=*),OPTIONAL,INTENT(IN)  :: HDAD_NAME
 
     integer :: ifile
@@ -249,7 +249,7 @@ CONTAINS
     USE MODD_CONF_n,     ONLY: CSTORAGE_TYPE
     USE MODD_PARAMETERS, ONLY: NFILENAMELGTMAXLFI
     !
-    TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE   ! File structure
+    TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! File structure
     CHARACTER(LEN=*),OPTIONAL,INTENT(IN)  :: HDAD_NAME
     !
     CHARACTER(LEN=:),ALLOCATABLE :: YDAD_NAME
@@ -311,7 +311,7 @@ subroutine IO_Field_create( tpfile, tpfield )
   use modd_field
   use modd_io,            only: gsmonoproc, isp
 
-  type(tfiledata),  intent(in) :: tpfile
+  type(tfiledata),  intent(inout) :: tpfile
   type(tfielddata), intent(in) :: tpfield
 
   integer                  :: ik_file
@@ -498,7 +498,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),           INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),           INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),          INTENT(IN) :: HNAME    ! name of the field to write
     REAL,                      INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,          INTENT(OUT):: KRESP    ! return-code 
@@ -528,7 +528,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
     REAL,TARGET,                 INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -598,7 +598,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),                INTENT(IN)  :: HNAME    ! name of the field to write
     REAL,DIMENSION(:),               INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,               OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -631,7 +631,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                      INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                     INTENT(IN)  :: TPFIELD
     REAL,DIMENSION(:),TARGET,             INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -722,7 +722,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),                INTENT(IN)  :: HNAME    ! name of the field to write
     REAL,DIMENSION(:,:),             INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,               OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -761,7 +761,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                      INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                     INTENT(IN)  :: TPFIELD
     REAL,DIMENSION(:,:),TARGET,           INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -979,7 +979,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                              INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                              INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),                             INTENT(IN)  :: HNAME    ! name of the field to write
     REAL,             DIMENSION(:,:,:),           INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                            OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -1020,7 +1020,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),TARGET,                 INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),TARGET,                 INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                       INTENT(IN)  :: TPFIELD
     REAL,DIMENSION(:,:,:),TARGET,           INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                      OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -1448,7 +1448,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                   INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                   INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),                  INTENT(IN)  :: HNAME    ! name of the field to write
     REAL,DIMENSION(:,:,:,:),           INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                 OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -1485,7 +1485,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                          INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                          INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                         INTENT(IN)  :: TPFIELD
     REAL,DIMENSION(:,:,:,:),TARGET,           INTENT(IN)  :: PFIELD   ! array containing the data field
     INTEGER,                        OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -1664,7 +1664,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     REAL,DIMENSION(:,:,:,:,:),   INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -1700,7 +1700,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                INTENT(IN) :: TPFIELD
     REAL,DIMENSION(:,:,:,:,:),TARGET,INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,                INTENT(OUT):: KRESP    ! return-code 
@@ -1839,7 +1839,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     REAL,DIMENSION(:,:,:,:,:,:), INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -1873,7 +1873,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                   INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),                   INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                  INTENT(IN) :: TPFIELD
     REAL,DIMENSION(:,:,:,:,:,:),TARGET,INTENT(IN) :: PFIELD   ! array containing the data field
     INTEGER,OPTIONAL,                  INTENT(OUT):: KRESP    ! return-code 
@@ -1955,7 +1955,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     INTEGER,                     INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -1984,7 +1984,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
     INTEGER,                     INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2044,7 +2044,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     INTEGER,DIMENSION(:),        INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2076,7 +2076,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),              INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),             INTENT(IN) :: TPFIELD
     INTEGER,DIMENSION(:),TARGET,  INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,             INTENT(OUT):: KRESP    ! return-code 
@@ -2153,7 +2153,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     INTEGER,DIMENSION(:,:),      INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2188,7 +2188,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),              INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),             INTENT(IN) :: TPFIELD
     INTEGER,DIMENSION(:,:),TARGET,INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,             INTENT(OUT):: KRESP    ! return-code 
@@ -2335,7 +2335,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     INTEGER,DIMENSION(:,:,:),    INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2369,7 +2369,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),                INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),               INTENT(IN) :: TPFIELD
     INTEGER,DIMENSION(:,:,:),TARGET,INTENT(IN) :: KFIELD   ! array containing the data field
     INTEGER,OPTIONAL,               INTENT(OUT):: KRESP    ! return-code 
@@ -2510,7 +2510,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                      INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),                     INTENT(IN)  :: HNAME    ! name of the field to write
     INTEGER,DIMENSION(:,:,:,:),           INTENT(IN)  :: KFIELD   ! array containing the data field
     INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -2547,7 +2547,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                             INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                            INTENT(IN)  :: TPFIELD
     INTEGER,DIMENSION(:,:,:,:),TARGET,           INTENT(IN)  :: KFIELD   ! array containing the data field
     INTEGER,                           OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
@@ -2726,7 +2726,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     LOGICAL,                     INTENT(IN) :: OFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2756,7 +2756,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
     LOGICAL,                     INTENT(IN) :: OFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2816,7 +2816,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     LOGICAL,DIMENSION(:),        INTENT(IN) :: OFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2848,7 +2848,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),              INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),             INTENT(IN) :: TPFIELD
     LOGICAL,DIMENSION(:),TARGET,  INTENT(IN) :: OFIELD   ! array containing the data field
     INTEGER,OPTIONAL,             INTENT(OUT):: KRESP    ! return-code 
@@ -2925,7 +2925,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     CHARACTER(LEN=*),            INTENT(IN) :: HFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -2955,7 +2955,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
     CHARACTER(LEN=*),            INTENT(IN) :: HFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -3005,7 +3005,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),              INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),             INTENT(IN) :: HNAME    ! name of the field to write
     CHARACTER(LEN=*),DIMENSION(:),INTENT(IN) :: HFIELD   ! array containing the data field
     INTEGER,OPTIONAL,             INTENT(OUT):: KRESP    ! return-code 
@@ -3035,7 +3035,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),              INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),             INTENT(IN) :: TPFIELD
     CHARACTER(LEN=*),DIMENSION(:),INTENT(IN) :: HFIELD   ! array containing the data field
     INTEGER,OPTIONAL,             INTENT(OUT):: KRESP    ! return-code 
@@ -3108,7 +3108,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     TYPE (DATE_TIME),            INTENT(IN) :: TFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -3139,7 +3139,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
     TYPE (DATE_TIME),            INTENT(IN) :: TFIELD   ! array containing the data field
     INTEGER,OPTIONAL,            INTENT(OUT):: KRESP    ! return-code 
@@ -3185,7 +3185,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),               INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),               INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),              INTENT(IN) :: HNAME    ! name of the field to write
     TYPE (DATE_TIME),DIMENSION(:), INTENT(IN) :: TFIELD   ! array containing the data field
     INTEGER,OPTIONAL,              INTENT(OUT):: KRESP    ! return-code
@@ -3216,7 +3216,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),               INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),               INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),              INTENT(IN) :: TPFIELD
     TYPE (DATE_TIME),DIMENSION(:), INTENT(IN) :: TFIELD   ! array containing the data field
     INTEGER,OPTIONAL,              INTENT(OUT):: KRESP    ! return-code
@@ -3261,7 +3261,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
     INTEGER,                     INTENT(IN) :: KL3D     ! size of the LB array in FM
     REAL,DIMENSION(:,:,:),       INTENT(IN) :: PLB      ! array containing the LB field
@@ -3296,7 +3296,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),             INTENT(IN)    :: TPFILE
+    TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),            INTENT(INOUT) :: TPFIELD
     INTEGER,                     INTENT(IN)    :: KL3D   ! size of the LB array in FM
     REAL,DIMENSION(:,:,:),TARGET,INTENT(IN)    :: PLB    ! array containing the LB field
@@ -3456,7 +3456,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                INTENT(IN)  :: TPFIELD
     CHARACTER(LEN=*),                INTENT(IN)  :: HBUDGET  ! 'BUDGET' (budget)  or 'OTHER' (MesoNH field)
     REAL,   DIMENSION(:,:), TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
@@ -3550,7 +3550,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                INTENT(IN)  :: TPFIELD
     CHARACTER(LEN=*),                INTENT(IN)  :: HBUDGET  ! 'BUDGET' (budget)  or 'OTHER' (MesoNH field)
     REAL, DIMENSION(:,:,:), TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
@@ -3644,7 +3644,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                    INTENT(IN)  :: TPFILE
+    TYPE(TFILEDATA),                    INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                   INTENT(IN)  :: TPFIELD
     CHARACTER(LEN=*),                   INTENT(IN)  :: HBUDGET  ! 'BUDGET' (budget)  or 'OTHER' (MesoNH field)
     REAL, DIMENSION(:,:,:,:), TARGET,   INTENT(IN)  :: PFIELD   ! array containing the data field
@@ -3738,7 +3738,7 @@ end subroutine IO_Ndimlist_reduce
     !
     !*      0.1   Declarations of arguments
     !
-    TYPE(TFILEDATA),                 INTENT(IN) :: TPFILE
+    TYPE(TFILEDATA),                 INTENT(INOUT) :: TPFILE
     TYPE(TFIELDDATA),                INTENT(IN) :: TPFIELD
     CHARACTER(LEN=*),                INTENT(IN) :: HBUDGET  ! 'BUDGET' (budget)  or 'OTHER' (MesoNH field)
     REAL,DIMENSION(:,:,:,:,:),TARGET,INTENT(IN) :: PFIELD   ! array containing the data field
diff --git a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
index 477c389db..48216395d 100644
--- a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
@@ -83,7 +83,7 @@ SUBROUTINE IO_Dimids_guess_nc4(TPFILE, TPFIELD, KLEN, TPDIMS, KRESP)
 USE MODD_FIELD, ONLY: NMNHDIM_ARAKAWA, TYPECHAR
 !
 !Used by LFI2CDF
-TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
+TYPE(TFILEDATA),                      INTENT(INOUT)  :: TPFILE
 TYPE(TFIELDDATA),                     INTENT(IN)  :: TPFIELD
 INTEGER,                              INTENT(IN)  :: KLEN
 TYPE(tdimnc),DIMENSION(:),            INTENT(OUT) :: TPDIMS
@@ -506,7 +506,7 @@ use modd_field,  only: NMNHDIM_UNKNOWN, NMNHDIM_ONE, NMNHDIM_COMPLEX,
                        NMNHDIM_STATION_TIME,        NMNHDIM_LASTDIM_DIACHRO,                            &
                        NMNHDIM_NOTLISTED, NMNHDIM_UNUSED, NMNHDIM_ARAKAWA
 
-TYPE(TFILEDATA),                              INTENT(IN)  :: TPFILE
+TYPE(TFILEDATA),                              INTENT(INOUT)  :: TPFILE
 TYPE(TFIELDDATA),                             INTENT(IN)  :: TPFIELD
 INTEGER(KIND=CDFINT),DIMENSION(:),            INTENT(IN)  :: KSHAPE
 INTEGER(KIND=CDFINT),DIMENSION(:),ALLOCATABLE,INTENT(OUT) :: KVDIMS
@@ -654,7 +654,7 @@ END SUBROUTINE IO_Vdims_fill_nc4
 subroutine IO_Dim_find_create_nc4( tpfile, klen, kidx, hdimname)
 use modd_netcdf, only: tdimnc
 
-type(tfiledata),            intent(in) :: tpfile
+type(tfiledata),            intent(inout) :: tpfile
 integer(kind=CDFINT),       intent(in) :: klen
 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: HDIMNAME
 integer, intent(out) :: kidx !Position of the dimension in the dimension array
@@ -735,7 +735,7 @@ end subroutine IO_Dim_find_create_nc4
 FUNCTION IO_Strdimid_get_nc4(TPFILE,KLEN)
 use modd_netcdf, only: tdimnc
 
-TYPE(TFILEDATA),      INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),      INTENT(INOUT) :: TPFILE
 INTEGER(KIND=CDFINT), INTENT(IN) :: KLEN
 INTEGER(KIND=CDFINT)             :: IO_Strdimid_get_nc4
 
diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90
index 53053069c..90442bede 100644
--- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90
@@ -372,7 +372,7 @@ use NETCDF, only: NF90_CHAR, NF90_FLOAT, NF90_INT1
 use modd_field,     only: NMNHDIM_TIME, TYPECHAR, TYPEDATE, TYPEINT, TYPELOG, TYPEREAL, TYPEUNDEF
 use modd_precision, only: MNHINT_NF90, MNHREAL_NF90
 
-type(tfiledata),       intent(in)            :: tpfile
+type(tfiledata),       intent(inout)         :: tpfile
 type(tfielddata),      intent(in)            :: tpfield
 integer, dimension(:), intent(in),  optional :: kshape
 character(len=*),      intent(in),  optional :: hcalendar
@@ -524,7 +524,7 @@ end subroutine IO_Field_create_nc4
 
 SUBROUTINE IO_Field_write_nc4_X0(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 REAL,                  INTENT(IN) :: PFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -547,7 +547,7 @@ END SUBROUTINE IO_Field_write_nc4_X0
 
 SUBROUTINE IO_Field_write_nc4_X1(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),TARGET,INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),TARGET,INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 REAL,DIMENSION(:),     INTENT(IN) :: PFIELD   ! array containing the data field
 INTEGER,               INTENT(OUT):: KRESP
@@ -609,7 +609,7 @@ END SUBROUTINE IO_Field_write_nc4_X2
 
 SUBROUTINE IO_Field_write_nc4_X3(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 REAL,DIMENSION(:,:,:), INTENT(IN) :: PFIELD   ! array containing the data field
 INTEGER,               INTENT(OUT):: KRESP
@@ -635,7 +635,7 @@ END SUBROUTINE IO_Field_write_nc4_X3
 
 SUBROUTINE IO_Field_write_nc4_X4(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),           INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),           INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),          INTENT(IN) :: TPFIELD
 REAL,DIMENSION(:,:,:,:),   INTENT(IN) :: PFIELD   ! array containing the data field
 INTEGER,                   INTENT(OUT):: KRESP
@@ -661,7 +661,7 @@ END SUBROUTINE IO_Field_write_nc4_X4
 
 SUBROUTINE IO_Field_write_nc4_X5(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),           INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),           INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),          INTENT(IN) :: TPFIELD
 REAL,DIMENSION(:,:,:,:,:), INTENT(IN) :: PFIELD   ! array containing the data field
 INTEGER,                   INTENT(OUT):: KRESP
@@ -687,7 +687,7 @@ END SUBROUTINE IO_Field_write_nc4_X5
 
 SUBROUTINE IO_Field_write_nc4_X6(TPFILE,TPFIELD,PFIELD,KRESP)
 !
-TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),             INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
 REAL,DIMENSION(:,:,:,:,:,:), INTENT(IN) :: PFIELD   ! array containing the data field
 INTEGER,                     INTENT(OUT):: KRESP
@@ -722,7 +722,7 @@ use modd_field,          only: NMNHDIM_LEVEL
 USE MODD_PARAMETERS_ll,  ONLY: JPVEXT
 #endif
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 INTEGER,               INTENT(IN) :: KFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -772,7 +772,7 @@ USE MODD_PARAMETERS_ll,  ONLY: JPHEXT, JPVEXT
 USE MODD_PARAMETERS_ll,  ONLY: JPVEXT
 #endif
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 INTEGER, DIMENSION(:), INTENT(IN) :: KFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -798,7 +798,7 @@ END SUBROUTINE IO_Field_write_nc4_N1
 
 SUBROUTINE IO_Field_write_nc4_N2(TPFILE,TPFIELD,KFIELD,KRESP)
 !
-TYPE(TFILEDATA),TARGET,INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),TARGET,INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 INTEGER,DIMENSION(:,:),INTENT(IN) :: KFIELD   ! array containing the data field
 INTEGER,               INTENT(OUT):: KRESP
@@ -824,7 +824,7 @@ END SUBROUTINE IO_Field_write_nc4_N2
 
 SUBROUTINE IO_Field_write_nc4_N3(TPFILE,TPFIELD,KFIELD,KRESP)
 !
-TYPE(TFILEDATA),TARGET,  INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),TARGET,  INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),        INTENT(IN) :: TPFIELD
 INTEGER,DIMENSION(:,:,:),INTENT(IN) :: KFIELD   ! array containing the data field
 INTEGER,                 INTENT(OUT):: KRESP
@@ -850,7 +850,7 @@ END SUBROUTINE IO_Field_write_nc4_N3
 
 SUBROUTINE IO_Field_write_nc4_N4(TPFILE,TPFIELD,KFIELD,KRESP)
 !
-TYPE(TFILEDATA),TARGET,    INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),TARGET,    INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),          INTENT(IN) :: TPFIELD
 INTEGER,DIMENSION(:,:,:,:),INTENT(IN) :: KFIELD   ! array containing the data field
 INTEGER,                   INTENT(OUT):: KRESP
@@ -876,7 +876,7 @@ END SUBROUTINE IO_Field_write_nc4_N4
 
 SUBROUTINE IO_Field_write_nc4_L0(TPFILE,TPFIELD,OFIELD,KRESP)
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 LOGICAL,               INTENT(IN) :: OFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -907,7 +907,7 @@ END SUBROUTINE IO_Field_write_nc4_L0
 
 SUBROUTINE IO_Field_write_nc4_L1(TPFILE,TPFIELD,OFIELD,KRESP)
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 LOGICAL, DIMENSION(:), INTENT(IN) :: OFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -941,7 +941,7 @@ END SUBROUTINE IO_Field_write_nc4_L1
 
 SUBROUTINE IO_Field_write_nc4_C0(TPFILE,TPFIELD,HFIELD,KRESP)
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 CHARACTER(LEN=*),      INTENT(IN) :: HFIELD
 INTEGER,               INTENT(OUT):: KRESP
@@ -979,7 +979,7 @@ SUBROUTINE IO_Field_write_nc4_C1(TPFILE,TPFIELD,HFIELD,KRESP)
 !  Modif
 !    J.Escobar : 25/04/2018 : missing 'IF ALLOCATED(IVDIMSTMP)' DEALLOCATE
 !----------------------------------------------------------------
-TYPE(TFILEDATA),              INTENT(IN)  :: TPFILE
+TYPE(TFILEDATA),              INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),             INTENT(IN)  :: TPFIELD
 CHARACTER(LEN=*),DIMENSION(:),INTENT(IN)  :: HFIELD
 INTEGER,                      INTENT(OUT) :: KRESP
@@ -1016,7 +1016,7 @@ USE MODD_TYPE_DATE
 !
 USE MODE_DATETIME
 !
-TYPE(TFILEDATA),       INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),       INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),      INTENT(IN) :: TPFIELD
 TYPE (DATE_TIME),      INTENT(IN) :: TPDATA
 INTEGER,               INTENT(OUT):: KRESP
@@ -1070,7 +1070,7 @@ USE MODD_TYPE_DATE
 !
 USE MODE_DATETIME
 !
-TYPE(TFILEDATA),                INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),                INTENT(INOUT) :: TPFILE
 TYPE(TFIELDDATA),               INTENT(IN) :: TPFIELD
 TYPE (DATE_TIME), DIMENSION(:), INTENT(IN) :: TPDATA
 INTEGER,                        INTENT(OUT):: KRESP
diff --git a/src/MNH/advection_metsv.f90 b/src/MNH/advection_metsv.f90
index 0c6247740..233674414 100644
--- a/src/MNH/advection_metsv.f90
+++ b/src/MNH/advection_metsv.f90
@@ -20,7 +20,7 @@ INTERFACE
 USE MODD_IO,        ONLY: TFILEDATA
 USE MODD_TYPE_DATE, ONLY: DATE_TIME
 !
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT) ::  TPFILE       ! Output file
 CHARACTER(LEN=6),       INTENT(IN)   :: HMET_ADV_SCHEME, & ! Control of the
                                         HSV_ADV_SCHEME, &  ! scheme applied
                                         HUVW_ADV_SCHEME
@@ -203,7 +203,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of dummy arguments :
 !
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT) ::  TPFILE       ! Output file
 CHARACTER(LEN=6),       INTENT(IN)   :: HMET_ADV_SCHEME, & ! Control of the
                                         HSV_ADV_SCHEME, &  ! scheme applied
                                         HUVW_ADV_SCHEME
diff --git a/src/MNH/c2r2_adjust.f90 b/src/MNH/c2r2_adjust.f90
index b97914d1a..471e09389 100644
--- a/src/MNH/c2r2_adjust.f90
+++ b/src/MNH/c2r2_adjust.f90
@@ -18,7 +18,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 !
 INTEGER,                          INTENT(IN)    :: KRR        ! Number of moist variables
-TYPE(TFILEDATA),                  INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),                  INTENT(INOUT) :: TPFILE     ! Output file
 CHARACTER(len=4),                 INTENT(IN)    :: HTURBDIM   ! Dimensionality of the turbulence scheme
 CHARACTER(len=4),                 INTENT(IN)    :: HRAD       ! Radiation scheme name
 LOGICAL,                          INTENT(IN)    :: OSUBG_COND ! Switch for Subgrid condensation
@@ -163,7 +163,7 @@ IMPLICIT NONE
 !*       0.1   Declarations of dummy arguments :
 !
 INTEGER,                          INTENT(IN)    :: KRR        ! Number of moist variables
-TYPE(TFILEDATA),                  INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),                  INTENT(INOUT) :: TPFILE     ! Output file
 CHARACTER(len=4),                 INTENT(IN)    :: HTURBDIM   ! Dimensionality of the turbulence scheme
 CHARACTER(len=4),                 INTENT(IN)    :: HRAD       ! Radiation scheme name
 LOGICAL,                          INTENT(IN)    :: OSUBG_COND ! Switch for Subgrid condensation
diff --git a/src/MNH/compute_r00.f90 b/src/MNH/compute_r00.f90
index 692fb3a1e..6be52813a 100644
--- a/src/MNH/compute_r00.f90
+++ b/src/MNH/compute_r00.f90
@@ -12,7 +12,7 @@ SUBROUTINE COMPUTE_R00(TPFILE)
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! Output file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! Output file
 !
 END SUBROUTINE COMPUTE_R00
 END INTERFACE
@@ -88,7 +88,7 @@ IMPLICIT NONE
 !
 !*       0.1   declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! Output file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! Output file
 !
 !*       0.2   declarations of local variables
 !
diff --git a/src/MNH/endstep_budget.f90 b/src/MNH/endstep_budget.f90
index eef2796be..5dd14b169 100644
--- a/src/MNH/endstep_budget.f90
+++ b/src/MNH/endstep_budget.f90
@@ -15,7 +15,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 USE MODD_TYPE_DATE
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPDIAFILE  ! file to write
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPDIAFILE  ! file to write
 INTEGER,           INTENT(IN) :: KTCOUNT    ! temporal loop counter
 TYPE (DATE_TIME),  INTENT(IN) :: TPDTCUR    ! Current date and time
 REAL,              INTENT(IN) :: PTSTEP     ! time step
@@ -93,7 +93,7 @@ IMPLICIT NONE
 !  
 !*       0.1   Declarations of arguments :
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPDIAFILE  ! file to write
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPDIAFILE  ! file to write
 INTEGER,           INTENT(IN) :: KTCOUNT    ! temporal loop counter
 TYPE (DATE_TIME),  INTENT(IN) :: TPDTCUR    ! Current date and time
 REAL,              INTENT(IN) :: PTSTEP     ! time step
diff --git a/src/MNH/free_atm_profile.f90 b/src/MNH/free_atm_profile.f90
index 50496da72..80291beef 100644
--- a/src/MNH/free_atm_profile.f90
+++ b/src/MNH/free_atm_profile.f90
@@ -12,7 +12,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE    ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE    ! File characteristics
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PVAR_MX   ! thermodynamical field
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PZMASS_MX ! mass points altitude
 REAL,   DIMENSION(:,:),   INTENT(IN)  :: PZS_LS    ! large scale orography
@@ -112,7 +112,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declaration of arguments
 !              ------------------------
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE    ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE    ! File characteristics
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PVAR_MX   ! thermodynamical field
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PZMASS_MX ! mass points altitude
 REAL,   DIMENSION(:,:),   INTENT(IN)  :: PZS_LS    ! large scale orography
diff --git a/src/MNH/khko_notadjust.f90 b/src/MNH/khko_notadjust.f90
index 344c2e976..ecdc0c3ea 100644
--- a/src/MNH/khko_notadjust.f90
+++ b/src/MNH/khko_notadjust.f90
@@ -19,7 +19,7 @@ USE MODD_IO, ONLY: TFILEDATA
 !
 INTEGER,                  INTENT(IN)    :: KRR      ! Number of moist variables
 INTEGER,                  INTENT(IN)    :: KTCOUNT      ! Number of moist variables
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 CHARACTER(len=4),         INTENT(IN)    :: HRAD     ! Radiation scheme name
 REAL,                     INTENT(IN)    :: PTSTEP   ! Double Time step
                                                     ! (single if cold start)
@@ -123,7 +123,7 @@ IMPLICIT NONE
 !
 INTEGER,                  INTENT(IN)    :: KRR      ! Number of moist variables
 INTEGER,                  INTENT(IN)    :: KTCOUNT      ! Number of moist variables
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 CHARACTER(len=4),         INTENT(IN)    :: HRAD     ! Radiation scheme name
 REAL,                     INTENT(IN)    :: PTSTEP   ! Double Time step
                                                     ! (single if cold start)
diff --git a/src/MNH/les_specn.f90 b/src/MNH/les_specn.f90
index 9be8e1f80..2d40990fa 100644
--- a/src/MNH/les_specn.f90
+++ b/src/MNH/les_specn.f90
@@ -99,7 +99,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA), INTENT(IN) :: TPDIAFILE ! file to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPDIAFILE ! file to write
 !
 !*      0.2  declaration of local variables
 !
@@ -205,7 +205,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro_spec
 
-type(tfiledata),          intent(in) :: tpdiafile ! file to write
+type(tfiledata),          intent(inout) :: tpdiafile ! file to write
 real, dimension(:,:,:),   intent(in) :: zcorri    ! 2 pts correlation data
 real, dimension(:,:,:),   intent(in) :: zcorrj    ! 2 pts correlation data
 character(len=*),         intent(in) :: ymnhname
diff --git a/src/MNH/lima.f90 b/src/MNH/lima.f90
index c248f1acf..2f5c3e3fb 100644
--- a/src/MNH/lima.f90
+++ b/src/MNH/lima.f90
@@ -27,7 +27,7 @@ INTEGER,                  INTENT(IN)    :: KKU   !uppest atmosphere array index
 INTEGER,                  INTENT(IN)    :: KKL   !vert. levels type 1=MNH -1=ARO
 !
 REAL,                     INTENT(IN)    :: PTSTEP     ! Time step
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
@@ -151,7 +151,7 @@ INTEGER,                  INTENT(IN)    :: KKU   !uppest atmosphere array index
 INTEGER,                  INTENT(IN)    :: KKL   !vert. levels type 1=MNH -1=ARO
 !
 REAL,                     INTENT(IN)    :: PTSTEP     ! Time step
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
diff --git a/src/MNH/lima_adjust.f90 b/src/MNH/lima_adjust.f90
index 31ea1fefa..a7f7b75dd 100644
--- a/src/MNH/lima_adjust.f90
+++ b/src/MNH/lima_adjust.f90
@@ -21,7 +21,7 @@ USE MODD_NSV, only: NSV_LIMA_BEG
 !
 INTEGER,                  INTENT(IN)   :: KRR        ! Number of moist variables
 INTEGER,                  INTENT(IN)   :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE     ! Output file
 LOGICAL,                  INTENT(IN)   :: OSUBG_COND ! Switch for Subgrid 
                                                      ! Condensation
 REAL,                     INTENT(IN)   :: PTSTEP     ! Time step          
@@ -176,7 +176,7 @@ IMPLICIT NONE
 !
 INTEGER,                  INTENT(IN)   :: KRR        ! Number of moist variables
 INTEGER,                  INTENT(IN)   :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE     ! Output file
 LOGICAL,                  INTENT(IN)   :: OSUBG_COND ! Switch for Subgrid 
                                                      ! Condensation
 REAL,                     INTENT(IN)   :: PTSTEP     ! Time step          
diff --git a/src/MNH/lima_adjust_split.f90 b/src/MNH/lima_adjust_split.f90
index 6f7dbb738..52e24390c 100644
--- a/src/MNH/lima_adjust_split.f90
+++ b/src/MNH/lima_adjust_split.f90
@@ -21,7 +21,7 @@ USE MODD_NSV,   only: NSV_LIMA_BEG
 !
 INTEGER,                  INTENT(IN)   :: KRR        ! Number of moist variables
 INTEGER,                  INTENT(IN)   :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE     ! Output file
 CHARACTER(len=80),        INTENT(IN)   :: HCONDENS
 CHARACTER(len=4),         INTENT(IN)   :: HLAMBDA3   ! formulation for lambda3 coeff
 LOGICAL,                  INTENT(IN)   :: OSUBG_COND ! Switch for Subgrid
@@ -180,7 +180,7 @@ IMPLICIT NONE
 !
 INTEGER,                  INTENT(IN)   :: KRR        ! Number of moist variables
 INTEGER,                  INTENT(IN)   :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE     ! Output file
 CHARACTER(len=80),        INTENT(IN)    :: HCONDENS
 CHARACTER(len=4),         INTENT(IN)    :: HLAMBDA3  ! formulation for lambda3 coeff
 LOGICAL,                  INTENT(IN)   :: OSUBG_COND ! Switch for Subgrid 
diff --git a/src/MNH/lima_ccn_activation.f90 b/src/MNH/lima_ccn_activation.f90
index b7786ea4f..0e02818f3 100644
--- a/src/MNH/lima_ccn_activation.f90
+++ b/src/MNH/lima_ccn_activation.f90
@@ -14,7 +14,7 @@ INTERFACE
                                    PCLDFR                                         )
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
@@ -117,7 +117,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of dummy arguments :
 !
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
diff --git a/src/MNH/lima_notadjust.f90 b/src/MNH/lima_notadjust.f90
index 94ea1f4fd..16a7ead40 100644
--- a/src/MNH/lima_notadjust.f90
+++ b/src/MNH/lima_notadjust.f90
@@ -16,7 +16,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 !
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 CHARACTER(len=4),         INTENT(IN)    :: HRAD     ! Radiation scheme name
 REAL,                     INTENT(IN)    :: PTSTEP   ! Double Time step
                                                     ! (single if cold start)
@@ -104,7 +104,7 @@ IMPLICIT NONE
 !
 !
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 CHARACTER(len=4),              INTENT(IN)    :: HRAD     ! Radiation scheme name
 REAL,                     INTENT(IN)    :: PTSTEP   ! Double Time step
                                                     ! (single if cold start)
diff --git a/src/MNH/lima_nucleation_procs.f90 b/src/MNH/lima_nucleation_procs.f90
index 122d4b3c8..71686542d 100644
--- a/src/MNH/lima_nucleation_procs.f90
+++ b/src/MNH/lima_nucleation_procs.f90
@@ -18,7 +18,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 !
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODJ     ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
@@ -106,7 +106,7 @@ IMPLICIT NONE
 !-------------------------------------------------------------------------------
 !
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODJ     ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
diff --git a/src/MNH/lima_warm.f90 b/src/MNH/lima_warm.f90
index 14b1a09fc..8d8cea50f 100644
--- a/src/MNH/lima_warm.f90
+++ b/src/MNH/lima_warm.f90
@@ -31,7 +31,7 @@ INTEGER,                  INTENT(IN)    :: KSPLITR    ! Number of small time ste
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
                                                       ! (single if cold start)
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 INTEGER,                  INTENT(IN)    :: KRR        ! Number of moist variables
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PZZ        ! Height (z)
@@ -172,7 +172,7 @@ INTEGER,                  INTENT(IN)    :: KSPLITR    ! Number of small time ste
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
                                                       ! (single if cold start)
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 INTEGER,                  INTENT(IN)    :: KRR        ! Number of moist variables
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PZZ        ! Height (z)
diff --git a/src/MNH/lima_warm_nucl.f90 b/src/MNH/lima_warm_nucl.f90
index 549a5fc84..30238389e 100644
--- a/src/MNH/lima_warm_nucl.f90
+++ b/src/MNH/lima_warm_nucl.f90
@@ -21,7 +21,7 @@ LOGICAL,                  INTENT(IN)    :: OACTIT     ! Switch to activate the
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
                                                       ! (single if cold start)
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
@@ -132,7 +132,7 @@ LOGICAL,                  INTENT(IN)    :: OACTIT     ! Switch to activate the
 REAL,                     INTENT(IN)    :: PTSTEP     ! Double Time step
                                                       ! (single if cold start)
 INTEGER,                  INTENT(IN)    :: KMI        ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF   ! Reference density
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PEXNREF    ! Reference Exner function
diff --git a/src/MNH/mnhwrite_zs_dummyn.f90 b/src/MNH/mnhwrite_zs_dummyn.f90
index 29392ec2b..2eb445232 100644
--- a/src/MNH/mnhwrite_zs_dummyn.f90
+++ b/src/MNH/mnhwrite_zs_dummyn.f90
@@ -11,7 +11,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 END SUBROUTINE MNHWRITE_ZS_DUMMY_n
 !
@@ -72,7 +72,7 @@ IMPLICIT NONE
 !*       0.1   Declarations of arguments
 !              -------------------------
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 !*       0.2   Declarations of local variables
 !              -------------------------------
diff --git a/src/MNH/mode_les_diachro.f90 b/src/MNH/mode_les_diachro.f90
index f56b2ce0f..bb13d6a08 100644
--- a/src/MNH/mode_les_diachro.f90
+++ b/src/MNH/mode_les_diachro.f90
@@ -661,7 +661,7 @@ subroutine Les_diachro_1D( tpdiafile, tpfield, hgroup, hgroupcomment, odoavg, od
 use modd_field, only: NMNHDIM_BUDGET_LES_TIME, NMNHDIM_UNUSED, tfield_metadata_base
 use modd_io,    only: tfiledata
 
-type(tfiledata),                       intent(in) :: tpdiafile  ! File to write
+type(tfiledata),                       intent(inout) :: tpdiafile  ! File to write
 type(tfield_metadata_base),            intent(in) :: tpfield    ! Metadata of field
 character(len=*),                      intent(in) :: hgroup     ! Group of the field
 character(len=*),                      intent(in) :: hgroupcomment
@@ -706,7 +706,7 @@ use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_SV, NMNHDIM_B
                       tfield_metadata_base
 use modd_io,    only: tfiledata
 
-type(tfiledata),                         intent(in) :: tpdiafile  ! File to write
+type(tfiledata),                         intent(inout) :: tpdiafile  ! File to write
 type(tfield_metadata_base),              intent(in) :: tpfield    ! Metadata of field
 character(len=*),                        intent(in) :: hgroup     ! Group of the field
 character(len=*),                        intent(in) :: hgroupcomment
@@ -763,7 +763,7 @@ use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM
                       tfield_metadata_base
 use modd_io,    only: tfiledata
 
-type(tfiledata),                           intent(in) :: tpdiafile  ! File to write
+type(tfiledata),                           intent(inout) :: tpdiafile  ! File to write
 type(tfield_metadata_base),                intent(in) :: tpfield    ! Metadata of field
 character(len=*),                          intent(in) :: hgroup     ! Group of the field
 character(len=*),                          intent(in) :: hgroupcomment
@@ -861,7 +861,7 @@ use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM
                       tfield_metadata_base
 use modd_io,    only: tfiledata
 
-type(tfiledata),                             intent(in) :: tpdiafile  ! File to write
+type(tfiledata),                             intent(inout) :: tpdiafile  ! File to write
 type(tfield_metadata_base),                  intent(in) :: tpfield ! Metadata of field
 character(len=*),                            intent(in) :: hgroup     ! Group of the field
 character(len=*),                            intent(in) :: hgroupcomment
@@ -971,7 +971,7 @@ use modd_type_date,     only: date_time
 
 implicit none
 
-type(tfiledata),                                          intent(in) :: tpdiafile ! File to write
+type(tfiledata),                                          intent(inout) :: tpdiafile ! File to write
 type(tfield_metadata_base),                               intent(in) :: tpfield
 character(len=*),                                         intent(in) :: hgroup    ! Group of the field
 character(len=*),                                         intent(in) :: hgroupcomment
@@ -1252,7 +1252,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-type(tfiledata),                    intent(in) :: tpdiafile! file to write
+type(tfiledata),                    intent(inout) :: tpdiafile! file to write
 type(tfield_metadata_base),         intent(in) :: tpfieldx ! Metadata of field pfieldx
 type(tfield_metadata_base),         intent(in) :: tpfieldy ! Metadata of field pfieldy
 real,             dimension(:,:,:), intent(in) :: pfieldx
@@ -1285,7 +1285,7 @@ use modd_type_date,     only: date_time
 
 use mode_write_diachro, only: Write_diachro
 
-type(tfiledata),                    intent(in) :: tpdiafile! file to write
+type(tfiledata),                    intent(inout) :: tpdiafile! file to write
 type(tfield_metadata_base),         intent(in) :: tpfield ! Metadata of field pfield
 logical,                            intent(in) :: gavg
 real,             dimension(:,:,:), intent(in) :: pfield
@@ -1455,7 +1455,7 @@ use modd_io,    only: tfiledata
 
 implicit none
 
-type(tfiledata),                      intent(in) :: tpdiafile! file to write
+type(tfiledata),                      intent(inout) :: tpdiafile! file to write
 type(tfield_metadata_base),           intent(in) :: tpfieldx ! metadata of field pfieldx
 type(tfield_metadata_base),           intent(in) :: tpfieldy ! metadata of field pfieldy
 real,             dimension(:,:,:,:), intent(in) :: pspectrax! spectra in x
@@ -1485,7 +1485,7 @@ use mode_write_diachro, only: Write_diachro
 
 implicit none
 
-type(tfiledata),             intent(in) :: tpdiafile ! file to write
+type(tfiledata),             intent(inout) :: tpdiafile ! file to write
 type(tfield_metadata_base),  intent(in) :: tpfield   ! metadata of field pfield
 real, dimension(:,:,:,:),    intent(in) :: pspectra
 
diff --git a/src/MNH/paspol.f90 b/src/MNH/paspol.f90
index b3043a864..8a266ece2 100644
--- a/src/MNH/paspol.f90
+++ b/src/MNH/paspol.f90
@@ -20,7 +20,7 @@ REAL,                   INTENT(IN)    :: PTSTEP     ! Double timestep except
 REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PSFSV      ! surface flux of scalars
 INTEGER,                INTENT(IN)    :: KLUOUT     ! unit for output listing count
 INTEGER,                INTENT(IN)    :: KVERB      ! verbosity level
-TYPE(TFILEDATA),        INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE     ! Output file
 !
 END SUBROUTINE PASPOL
 !
@@ -109,7 +109,7 @@ REAL,                   INTENT(IN)    :: PTSTEP     ! Double timestep except
 REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PSFSV      ! surface flux of scalars
 INTEGER,                INTENT(IN)    :: KLUOUT     ! unit for output listing count
 INTEGER,                INTENT(IN)    :: KVERB      ! verbosity level
-TYPE(TFILEDATA),        INTENT(IN)    :: TPFILE     ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE     ! Output file
 !
 !*      0.2    declarations of local variables
 !
diff --git a/src/MNH/phys_paramn.f90 b/src/MNH/phys_paramn.f90
index e0c34e06b..9c5525716 100644
--- a/src/MNH/phys_paramn.f90
+++ b/src/MNH/phys_paramn.f90
@@ -18,7 +18,7 @@ USE MODD_IO,        ONLY: TFILEDATA
 use modd_precision, only: MNHTIME
 !
 INTEGER,           INTENT(IN)     :: KTCOUNT   ! temporal iteration count
-TYPE(TFILEDATA),   INTENT(IN)     :: TPFILE    ! Synchronous output file
+TYPE(TFILEDATA),   INTENT(INOUT)  :: TPFILE    ! Synchronous output file
 ! advection schemes
 REAL(kind=MNHTIME), DIMENSION(2), INTENT(INOUT) :: PRAD,PSHADOWS,PKAFR,PGROUND,PTURB,PMAFL,PDRAG,PTRACER,PEOL ! to store CPU
                                                                                                          ! time for computing time
@@ -350,7 +350,7 @@ IMPLICIT NONE
 !*      0.1    declarations of arguments
 !
 INTEGER,           INTENT(IN)     :: KTCOUNT   ! temporal iteration count
-TYPE(TFILEDATA),   INTENT(IN)     :: TPFILE    ! Synchronous output file
+TYPE(TFILEDATA),   INTENT(INOUT)  :: TPFILE    ! Synchronous output file
 ! advection schemes
 REAL(kind=MNHTIME), DIMENSION(2), INTENT(INOUT) :: PRAD,PSHADOWS,PKAFR,PGROUND,PTURB,PMAFL,PDRAG,PTRACER,PEOL ! to store CPU
                                                                                                          ! time for computing time
diff --git a/src/MNH/prandtl.f90 b/src/MNH/prandtl.f90
index ebe407a91..af2fb0577 100644
--- a/src/MNH/prandtl.f90
+++ b/src/MNH/prandtl.f90
@@ -33,7 +33,7 @@ INTEGER,                INTENT(IN)   :: KRRI          ! number of ice var.
 LOGICAL,                INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                  ! diagnostic fields in the syncronous FM-file
 CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! Kind of turbulence param.
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX,PDYY,PDZZ,PDZX,PDZY
                                                   ! metric coefficients
 !
@@ -238,7 +238,7 @@ INTEGER,                INTENT(IN)   :: KRRI          ! number of ice var.
 LOGICAL,                INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                  ! diagnostic fields in the syncronous FM-file
 CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! Kind of turbulence param.
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX,PDYY,PDZZ,PDZX,PDZY
                                                   ! metric coefficients
 !
diff --git a/src/MNH/radiations.f90 b/src/MNH/radiations.f90
index e0bda3fca..94e77fc63 100644
--- a/src/MNH/radiations.f90
+++ b/src/MNH/radiations.f90
@@ -176,7 +176,7 @@ IMPLICIT NONE
 !
 !*       0.1   DECLARATIONS OF DUMMY ARGUMENTS :
 !
-TYPE(TFILEDATA),  INTENT(IN)         :: TPFILE    ! Output file
+TYPE(TFILEDATA),  INTENT(INOUT)      :: TPFILE    ! Output file
 LOGICAL, INTENT(IN)                  :: OCLOUD_ONLY! flag for the cloud column
                                                    !    computations only
 LOGICAL, INTENT(IN)                  :: OCLEAR_SKY ! 
diff --git a/src/MNH/rain_c2r2_khko.f90 b/src/MNH/rain_c2r2_khko.f90
index 5708c0d4c..90adfbaf8 100644
--- a/src/MNH/rain_c2r2_khko.f90
+++ b/src/MNH/rain_c2r2_khko.f90
@@ -35,7 +35,7 @@ INTEGER,                  INTENT(IN)    :: KSPLITR ! Number of small time step
                                       ! integration for  rain sedimendation
 REAL,                     INTENT(IN)    :: PTSTEP ! Time step :XTSTEP in namelist
 INTEGER,                  INTENT(IN)    :: KMI     ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PZZ     ! Height (z)
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODJ  ! Dry density * Jacobian
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF! Reference density
@@ -261,7 +261,7 @@ INTEGER,                  INTENT(IN)    :: KSPLITR ! Number of small time step
                                       ! integration for  rain sedimendation
 REAL,                     INTENT(IN)    :: PTSTEP ! Time step :XTSTEP in namelist
 INTEGER,                  INTENT(IN)    :: KMI     ! Model index 
-TYPE(TFILEDATA),          INTENT(IN)    :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE   ! Output file
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PZZ     ! Height (z)
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODJ  ! Dry density * Jacobian
 REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRHODREF! Reference density
diff --git a/src/MNH/resolved_cloud.f90 b/src/MNH/resolved_cloud.f90
index a5ad941ca..934977056 100644
--- a/src/MNH/resolved_cloud.f90
+++ b/src/MNH/resolved_cloud.f90
@@ -43,7 +43,7 @@ INTEGER,                  INTENT(IN)   :: KSPLITG  ! Number of small time step
 INTEGER,                  INTENT(IN)   :: KMI      ! Model index
 INTEGER,                  INTENT(IN)   :: KTCOUNT  ! Temporal loop counter
 CHARACTER(LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX,HLBCY   ! X and Y-direc. LBC type
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE   ! Output file
 CHARACTER(len=4),         INTENT(IN)   :: HRAD     ! Radiation scheme name
 CHARACTER(len=4),         INTENT(IN)   :: HTURBDIM ! Dimensionality of the
                                                    ! turbulence scheme
@@ -361,7 +361,7 @@ INTEGER,                  INTENT(IN)   :: KSPLITG  ! Number of small time step
 INTEGER,                  INTENT(IN)   :: KMI      ! Model index
 INTEGER,                  INTENT(IN)   :: KTCOUNT  ! Temporal loop counter
 CHARACTER(LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX,HLBCY   ! X and Y-direc. LBC type
-TYPE(TFILEDATA),          INTENT(IN)   :: TPFILE   ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT):: TPFILE   ! Output file
 CHARACTER(len=4),         INTENT(IN)   :: HRAD     ! Radiation scheme name
 CHARACTER(len=4),         INTENT(IN)   :: HTURBDIM ! Dimensionality of the
                                                    ! turbulence scheme
diff --git a/src/MNH/set_cstn.f90 b/src/MNH/set_cstn.f90
index 31f00cb4d..7b19e04ae 100644
--- a/src/MNH/set_cstn.f90
+++ b/src/MNH/set_cstn.f90
@@ -13,7 +13,7 @@ SUBROUTINE SET_CSTN(TPFILE,TPEXPREFILE,HFUNU,HFUNV,KILOC,KJLOC,OBOUSS,PJ,OSHIFT,
 !
 USE MODD_IO, ONLY : TFILEDATA
 !
-TYPE(TFILEDATA),        INTENT(IN)  :: TPFILE ! outpput data file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE ! outpput data file
 TYPE(TFILEDATA),        INTENT(IN)  :: TPEXPREFILE ! input data file
 CHARACTER(LEN=*),       INTENT(IN)  :: HFUNU  ! type of variation of U
                                               ! in y direction
@@ -189,7 +189,7 @@ IMPLICIT NONE
 !  
 !*       0.1   Declarations of arguments :
 !
-TYPE(TFILEDATA),        INTENT(IN)  :: TPFILE ! outpput data file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE ! outpput data file
 TYPE(TFILEDATA),        INTENT(IN)  :: TPEXPREFILE ! input data file
 CHARACTER(LEN=*),       INTENT(IN)  :: HFUNU  ! type of variation of U
                                               ! in y direction
diff --git a/src/MNH/set_mass.f90 b/src/MNH/set_mass.f90
index b3402a0e3..6bcfe0ee4 100644
--- a/src/MNH/set_mass.f90
+++ b/src/MNH/set_mass.f90
@@ -15,7 +15,7 @@ SUBROUTINE SET_MASS(TPFILE,OPROFILE_IN_PROC, PZFLUX_PROFILE,
 !
 USE MODD_IO, ONLY : TFILEDATA
 !
-TYPE(TFILEDATA),        INTENT(IN) :: TPFILE    ! File characteristics
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE    ! File characteristics
 LOGICAL,                INTENT(IN) :: OPROFILE_IN_PROC ! initialization profile in current processor
 REAL, DIMENSION(:),     INTENT(IN) :: PZFLUX_PROFILE   ! Z at flux points on the initialization point column
 INTEGER,                INTENT(IN) :: KILOC     ! I Localisation of vertical profile
@@ -160,7 +160,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments :
 !
-TYPE(TFILEDATA),        INTENT(IN)             :: TPFILE    ! File characteristics
+TYPE(TFILEDATA),        INTENT(INOUT)          :: TPFILE    ! File characteristics
 LOGICAL,                INTENT(IN)             :: OPROFILE_IN_PROC ! initialization profile in current processor
 REAL, DIMENSION(:),     INTENT(IN)             :: PZFLUX_PROFILE   ! Z at flux points on the initialization point column
 INTEGER,                INTENT(IN)             :: KILOC     ! I Localisation of vertical profile
diff --git a/src/MNH/set_rsou.f90 b/src/MNH/set_rsou.f90
index c0aca1504..596bc53f2 100644
--- a/src/MNH/set_rsou.f90
+++ b/src/MNH/set_rsou.f90
@@ -14,7 +14,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY : TFILEDATA
 !
-TYPE(TFILEDATA),        INTENT(IN)  :: TPFILE ! outpput data file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE ! outpput data file
 TYPE(TFILEDATA),        INTENT(IN)  :: TPEXPREFILE ! input data file
 CHARACTER(LEN=*),       INTENT(IN)  :: HFUNU  ! type of variation of U
                                               ! in y direction
@@ -292,7 +292,7 @@ IMPLICIT NONE
 !  
 !*       0.1   Declarations of arguments :
 !
-TYPE(TFILEDATA),        INTENT(IN)  :: TPFILE ! outpput data file
+TYPE(TFILEDATA),        INTENT(INOUT) :: TPFILE ! outpput data file
 TYPE(TFILEDATA),        INTENT(IN)  :: TPEXPREFILE ! input data file
 CHARACTER(LEN=*),       INTENT(IN)  :: HFUNU  ! type of variation of U
                                               ! in y direction
diff --git a/src/MNH/shallow_mf_pack.f90 b/src/MNH/shallow_mf_pack.f90
index d5c0bbdfe..9db7c82e6 100644
--- a/src/MNH/shallow_mf_pack.f90
+++ b/src/MNH/shallow_mf_pack.f90
@@ -38,7 +38,7 @@ CHARACTER (LEN=4),      INTENT(IN)   :: HMF_CLOUD  ! Type of statistical cloud
 LOGICAL,                INTENT(IN)   :: OMIXUV     ! True if mixing of momentum
 LOGICAL,                INTENT(IN)   :: OMF_FLX    ! switch to write the
                                                    ! MF fluxes in the synchronous FM-file
-TYPE(TFILEDATA),        INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT):: TPFILE     ! Output file
 REAL(kind=MNHTIME),DIMENSION(2), INTENT(OUT)  :: PTIME_LES  ! time spent in LES computations
 REAL,                   INTENT(IN)   :: PIMPL_MF   ! degre of implicitness
 REAL,                   INTENT(IN)   :: PTSTEP     ! Dynamical timestep 
@@ -159,7 +159,7 @@ CHARACTER (LEN=4),      INTENT(IN)   :: HMF_CLOUD  ! Type of statistical cloud
 LOGICAL,                INTENT(IN)   :: OMIXUV     ! True if mixing of momentum
 LOGICAL,                INTENT(IN)   :: OMF_FLX    ! switch to write the
                                                    ! MF fluxes in the synchronous FM-file
-TYPE(TFILEDATA),        INTENT(IN)   :: TPFILE     ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT):: TPFILE     ! Output file
 REAL(kind=MNHTIME),DIMENSION(2), INTENT(OUT)  :: PTIME_LES  ! time spent in LES computations
 REAL,                   INTENT(IN)   :: PIMPL_MF   ! degre of implicitness
 REAL,                   INTENT(IN)   :: PTSTEP     ! Dynamical timestep 
diff --git a/src/MNH/tke_eps_sources.f90 b/src/MNH/tke_eps_sources.f90
index ea34bc2e1..4f98499d2 100644
--- a/src/MNH/tke_eps_sources.f90
+++ b/src/MNH/tke_eps_sources.f90
@@ -33,7 +33,7 @@ REAL,                    INTENT(IN)   ::  PEXPL, PIMPL ! Coef. temporal. disc.
 CHARACTER(len=4),        INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                        ! turbulence scheme
 CHARACTER(len=4),        INTENT(IN)   ::  HTURBLEN     ! kind of mixing length
-TYPE(TFILEDATA),         INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),         INTENT(INOUT)::  TPFILE       ! Output file
 LOGICAL,                 INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                   ! diagnostic fields in the syncronous FM-file
 REAL, DIMENSION(:,:,:),  INTENT(INOUT)::  PDP          ! Dyn. prod. of TKE
@@ -230,7 +230,7 @@ REAL,                    INTENT(IN)   ::  PEXPL, PIMPL ! Coef. temporal. disc.
 CHARACTER(len=4),        INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                        ! turbulence scheme
 CHARACTER(len=4),        INTENT(IN)   ::  HTURBLEN     ! kind of mixing length
-TYPE(TFILEDATA),         INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),         INTENT(INOUT)::  TPFILE       ! Output file
 LOGICAL,                 INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                   ! diagnostic fields in the syncronous FM-file
 REAL, DIMENSION(:,:,:),  INTENT(INOUT)::  PDP          ! Dyn. prod. of TKE
diff --git a/src/MNH/turb.f90 b/src/MNH/turb.f90
index 0eeef1423..0d5254975 100644
--- a/src/MNH/turb.f90
+++ b/src/MNH/turb.f90
@@ -332,7 +332,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBLEN_CL  ! kind of cloud mixing len
 REAL,                   INTENT(IN)   ::  PIMPL        ! degree of implicitness
 CHARACTER (LEN=4),      INTENT(IN)   ::  HCLOUD       ! Kind of microphysical scheme
 REAL,                   INTENT(IN)   ::  PTSTEP       ! timestep 
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   :: PDXX,PDYY,PDZZ,PDZX,PDZY
                                         ! metric coefficients
diff --git a/src/MNH/turb_cloud_index.f90 b/src/MNH/turb_cloud_index.f90
index c194db611..aaef0f449 100644
--- a/src/MNH/turb_cloud_index.f90
+++ b/src/MNH/turb_cloud_index.f90
@@ -17,7 +17,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 !
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 LOGICAL,                INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                  ! diagnostic fields in the syncronous FM-file
 INTEGER,                INTENT(IN)   :: KRRI          ! number of ice water var.
@@ -100,7 +100,7 @@ IMPLICIT NONE
 !*       0.1   declarations of arguments
 !
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 LOGICAL,                INTENT(IN)   ::  OTURB_DIAG   ! switch to write some
                                  ! diagnostic fields in the syncronous FM-file
 INTEGER,                INTENT(IN)   :: KRRI          ! number of ice water var.
diff --git a/src/MNH/turb_hor.f90 b/src/MNH/turb_hor.f90
index 0d10395bc..62adf385f 100644
--- a/src/MNH/turb_hor.f90
+++ b/src/MNH/turb_hor.f90
@@ -38,7 +38,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                          ! Metric coefficients
@@ -270,7 +270,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                          ! Metric coefficients
diff --git a/src/MNH/turb_hor_dyn_corr.f90 b/src/MNH/turb_hor_dyn_corr.f90
index 6104f0aa8..ceebdd109 100644
--- a/src/MNH/turb_hor_dyn_corr.f90
+++ b/src/MNH/turb_hor_dyn_corr.f90
@@ -29,7 +29,7 @@ REAL,                     INTENT(IN)    ::  PTSTEP       ! timestep
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -188,7 +188,7 @@ REAL,                     INTENT(IN)    ::  PTSTEP       ! timestep
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/MNH/turb_hor_splt.f90 b/src/MNH/turb_hor_splt.f90
index cee813251..8996757cc 100644
--- a/src/MNH/turb_hor_splt.f90
+++ b/src/MNH/turb_hor_splt.f90
@@ -38,7 +38,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                          ! Metric coefficients
@@ -289,7 +289,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                          ! Metric coefficients
diff --git a/src/MNH/turb_hor_sv_flux.f90 b/src/MNH/turb_hor_sv_flux.f90
index e49e71fe1..dff4a9007 100644
--- a/src/MNH/turb_hor_sv_flux.f90
+++ b/src/MNH/turb_hor_sv_flux.f90
@@ -25,7 +25,7 @@ USE MODD_IO, ONLY: TFILEDATA
 INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -150,7 +150,7 @@ IMPLICIT NONE
 INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/MNH/turb_hor_thermo_corr.f90 b/src/MNH/turb_hor_thermo_corr.f90
index bc9c94a5c..3b1ef464d 100644
--- a/src/MNH/turb_hor_thermo_corr.f90
+++ b/src/MNH/turb_hor_thermo_corr.f90
@@ -29,7 +29,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PINV_PDXX   ! 1./PDXX
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PINV_PDYY   ! 1./PDYY
@@ -169,7 +169,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PINV_PDXX   ! 1./PDXX
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PINV_PDYY   ! 1./PDYY
diff --git a/src/MNH/turb_hor_thermo_flux.f90 b/src/MNH/turb_hor_thermo_flux.f90
index 768eade63..96e82cb70 100644
--- a/src/MNH/turb_hor_thermo_flux.f90
+++ b/src/MNH/turb_hor_thermo_flux.f90
@@ -31,7 +31,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -172,7 +172,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/MNH/turb_hor_uv.f90 b/src/MNH/turb_hor_uv.f90
index b987f77fd..50b42d36f 100644
--- a/src/MNH/turb_hor_uv.f90
+++ b/src/MNH/turb_hor_uv.f90
@@ -27,7 +27,7 @@ USE MODD_IO, ONLY: TFILEDATA
 INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -168,7 +168,7 @@ IMPLICIT NONE
 INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/MNH/turb_hor_uw.f90 b/src/MNH/turb_hor_uw.f90
index eed50515a..5433d83f5 100644
--- a/src/MNH/turb_hor_uw.f90
+++ b/src/MNH/turb_hor_uw.f90
@@ -26,7 +26,7 @@ INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
@@ -153,7 +153,7 @@ INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
diff --git a/src/MNH/turb_hor_vw.f90 b/src/MNH/turb_hor_vw.f90
index 98342494c..93446e37c 100644
--- a/src/MNH/turb_hor_vw.f90
+++ b/src/MNH/turb_hor_vw.f90
@@ -26,7 +26,7 @@ INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -152,7 +152,7 @@ INTEGER,                  INTENT(IN)    ::  KSPLT        ! split process index
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/MNH/turb_ver.f90 b/src/MNH/turb_ver.f90
index 904059b7c..2f32b303c 100644
--- a/src/MNH/turb_ver.f90
+++ b/src/MNH/turb_ver.f90
@@ -39,7 +39,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! timestep 
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                       ! Metric coefficients
@@ -365,7 +365,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! timestep 
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                       ! Metric coefficients
diff --git a/src/MNH/turb_ver_dyn_flux.f90 b/src/MNH/turb_ver_dyn_flux.f90
index e7c6ae4ae..34a0a0ab7 100644
--- a/src/MNH/turb_ver_dyn_flux.f90
+++ b/src/MNH/turb_ver_dyn_flux.f90
@@ -35,7 +35,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                       ! Metric coefficients
@@ -340,7 +340,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDXX, PDYY, PDZZ, PDZX, PDZY 
                                                       ! Metric coefficients
diff --git a/src/MNH/turb_ver_sv_flux.f90 b/src/MNH/turb_ver_sv_flux.f90
index d3e4fa41d..d84a5a94b 100644
--- a/src/MNH/turb_ver_sv_flux.f90
+++ b/src/MNH/turb_ver_sv_flux.f90
@@ -32,7 +32,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ 
                                                       ! Metric coefficients
@@ -307,7 +307,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ
                                                       ! Metric coefficients
diff --git a/src/MNH/turb_ver_thermo_corr.f90 b/src/MNH/turb_ver_thermo_corr.f90
index 4b7898b18..4ed095dd3 100644
--- a/src/MNH/turb_ver_thermo_corr.f90
+++ b/src/MNH/turb_ver_thermo_corr.f90
@@ -37,7 +37,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ         ! Metric coefficients
 !
@@ -339,7 +339,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
                                                       ! turbulence scheme
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ         ! Metric coefficients
 !
diff --git a/src/MNH/turb_ver_thermo_flux.f90 b/src/MNH/turb_ver_thermo_flux.f90
index e79a2a5d6..f6dfef48b 100644
--- a/src/MNH/turb_ver_thermo_flux.f90
+++ b/src/MNH/turb_ver_thermo_flux.f90
@@ -41,7 +41,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ         ! Metric coefficients
 REAL, DIMENSION(:,:),   INTENT(IN)   ::  PDIRCOSZW    ! Director Cosinus of the
@@ -398,7 +398,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBDIM     ! dimensionality of the
 CHARACTER(len=4),       INTENT(IN)   ::  HTOM         ! type of Third Order Moment
 REAL,                   INTENT(IN)   ::  PIMPL, PEXPL ! Coef. for temporal disc.
 REAL,                   INTENT(IN)   ::  PTSTEP       ! Double Time Step
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PDZZ         ! Metric coefficients
 REAL, DIMENSION(:,:),   INTENT(IN)   ::  PDIRCOSZW    ! Director Cosinus of the
diff --git a/src/MNH/uv_to_zonal_and_merid.f90 b/src/MNH/uv_to_zonal_and_merid.f90
index 6ce72b8c2..59834d3a7 100644
--- a/src/MNH/uv_to_zonal_and_merid.f90
+++ b/src/MNH/uv_to_zonal_and_merid.f90
@@ -17,7 +17,7 @@ REAL, DIMENSION(:,:,:),                  INTENT(IN)  :: PV       ! Input V compo
 INTEGER,                                 INTENT(IN)  :: KGRID    ! Grid positions of components
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PZC      ! Output U component
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PMC      ! Output V component
-TYPE(TFILEDATA),               OPTIONAL, INTENT(IN)  :: TPFILE   ! Output file
+TYPE(TFILEDATA),               OPTIONAL, INTENT(INOUT) :: TPFILE   ! Output file
 TYPE(TFIELDDATA),DIMENSION(2), OPTIONAL, INTENT(IN)  :: TZFIELDS ! Fields characteristics
 !
 END SUBROUTINE UV_TO_ZONAL_AND_MERID3D
@@ -32,7 +32,7 @@ REAL, DIMENSION(:,:),                    INTENT(IN)  :: PV       ! Input V compo
 INTEGER,                                 INTENT(IN)  :: KGRID    ! Grid positions of components
 REAL, DIMENSION(:,:),          OPTIONAL, INTENT(OUT) :: PZC      ! Output U component
 REAL, DIMENSION(:,:),          OPTIONAL, INTENT(OUT) :: PMC      ! Output V component
-TYPE(TFILEDATA),               OPTIONAL, INTENT(IN)  :: TPFILE   ! Output file
+TYPE(TFILEDATA),               OPTIONAL, INTENT(INOUT) :: TPFILE   ! Output file
 TYPE(TFIELDDATA),DIMENSION(2), OPTIONAL, INTENT(IN)  :: TZFIELDS ! Fields characteristics
 !
 END SUBROUTINE UV_TO_ZONAL_AND_MERID2D
@@ -55,7 +55,7 @@ REAL, DIMENSION(:,:,:),                  INTENT(IN)  :: PV       ! Input V compo
 INTEGER,                                 INTENT(IN)  :: KGRID    ! Grid positions of components
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PZC      ! Output U component
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PMC      ! Output V component
-TYPE(TFILEDATA),               OPTIONAL, INTENT(IN)  :: TPFILE   ! Output file
+TYPE(TFILEDATA),               OPTIONAL, INTENT(INOUT) :: TPFILE   ! Output file
 TYPE(TFIELDDATA),DIMENSION(2), OPTIONAL, INTENT(IN)  :: TZFIELDS ! Fields characteristics
 !
 END SUBROUTINE UV_TO_ZONAL_AND_MERID3D
@@ -124,7 +124,7 @@ REAL, DIMENSION(:,:,:),                  INTENT(IN)  :: PV       ! Input V compo
 INTEGER,                                 INTENT(IN)  :: KGRID    ! Grid positions of components
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PZC      ! Output U component
 REAL, DIMENSION(:,:,:),        OPTIONAL, INTENT(OUT) :: PMC      ! Output V component
-TYPE(TFILEDATA),               OPTIONAL, INTENT(IN)  :: TPFILE   ! Output file
+TYPE(TFILEDATA),               OPTIONAL, INTENT(INOUT) :: TPFILE   ! Output file
 TYPE(TFIELDDATA),DIMENSION(2), OPTIONAL, INTENT(IN)  :: TZFIELDS ! Fields characteristics
 !
 !*      0.2    declarations of local variables
@@ -294,7 +294,7 @@ REAL, DIMENSION(:,:),                    INTENT(IN)  :: PV       ! Input V compo
 INTEGER,                                 INTENT(IN)  :: KGRID    ! Grid positions of components
 REAL, DIMENSION(:,:),          OPTIONAL, INTENT(OUT) :: PZC      ! Output U component
 REAL, DIMENSION(:,:),          OPTIONAL, INTENT(OUT) :: PMC      ! Output V component
-TYPE(TFILEDATA),               OPTIONAL, INTENT(IN)  :: TPFILE   ! Output file
+TYPE(TFILEDATA),               OPTIONAL, INTENT(INOUT) :: TPFILE   ! Output file
 TYPE(TFIELDDATA),DIMENSION(2), OPTIONAL, INTENT(IN)  :: TZFIELDS ! Fields characteristics
 !
 !*      0.2    declarations of local variables
diff --git a/src/MNH/ver_int_thermo.f90 b/src/MNH/ver_int_thermo.f90
index 6be5b55a9..d8c39bf00 100644
--- a/src/MNH/ver_int_thermo.f90
+++ b/src/MNH/ver_int_thermo.f90
@@ -14,7 +14,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE     ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! File characteristics
 LOGICAL,                  INTENT(IN)  :: OSHIFT     ! T: vertical shift of BL (used for GRIB file data)
 !                                                   ! F: no vertical shift (used for MESONH data)
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PTHV_MX    ! thetav on mixed grid
@@ -172,7 +172,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declaration of arguments
 !              ------------------------
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE     ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! File characteristics
 LOGICAL,                  INTENT(IN)  :: OSHIFT     ! T: vertical shift of BL (used for GRIB file data)
 !                                                   ! F: no vertical shift (used for MESONH data)
 REAL,   DIMENSION(:,:,:), INTENT(IN)  :: PTHV_MX    ! thetav on mixed grid
diff --git a/src/MNH/ver_thermo.f90 b/src/MNH/ver_thermo.f90
index d926e6c26..e591ba689 100644
--- a/src/MNH/ver_thermo.f90
+++ b/src/MNH/ver_thermo.f90
@@ -14,7 +14,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE     ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! File characteristics
 LOGICAL,                  INTENT(IN)  :: OSHIFT     ! T: vertical shift of BL (used for GRIB file data)
 !                                                   ! F: no vertical shift (used for MESONH data)
 REAL,   DIMENSION(:,:,:), INTENT(IN)     :: PTHV_MX   ! thetav on mixed grid
@@ -186,7 +186,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declaration of arguments
 !              ------------------------
-TYPE(TFILEDATA),          INTENT(IN)  :: TPFILE     ! File characteristics
+TYPE(TFILEDATA),          INTENT(INOUT) :: TPFILE     ! File characteristics
 LOGICAL,                  INTENT(IN)  :: OSHIFT     ! T: vertical shift of BL (used for GRIB file data)
 !                                                   ! F: no vertical shift (used for MESONH data)
 REAL,   DIMENSION(:,:,:), INTENT(IN)     :: PTHV_MX   ! thetav on mixed grid
diff --git a/src/MNH/write_aircraft_balloon.f90 b/src/MNH/write_aircraft_balloon.f90
index e132daa83..2623a8792 100644
--- a/src/MNH/write_aircraft_balloon.f90
+++ b/src/MNH/write_aircraft_balloon.f90
@@ -13,7 +13,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA), INTENT(IN) :: TPDIAFILE ! file to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPDIAFILE ! file to write
 !
 END SUBROUTINE WRITE_AIRCRAFT_BALLOON
 !
@@ -113,7 +113,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA), INTENT(IN) :: TPDIAFILE ! file to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPDIAFILE ! file to write
 !
 !-------------------------------------------------------------------------------
 !
diff --git a/src/MNH/write_balloonn.f90 b/src/MNH/write_balloonn.f90
index f0c790ddd..784d52b65 100644
--- a/src/MNH/write_balloonn.f90
+++ b/src/MNH/write_balloonn.f90
@@ -14,7 +14,7 @@ USE MODD_IO, ONLY: TFILEDATA
 !
 IMPLICIT NONE
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 END SUBROUTINE WRITE_BALLOON_n
 !
@@ -74,7 +74,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 !*       0.2   Declarations of local variables
 !
diff --git a/src/MNH/write_budget.f90 b/src/MNH/write_budget.f90
index 767541ad9..7031a9d3e 100644
--- a/src/MNH/write_budget.f90
+++ b/src/MNH/write_budget.f90
@@ -121,7 +121,7 @@ subroutine Write_budget( tpdiafile, tpdtcur, ptstep, ksv )
 
   implicit none
 
-  type(tfiledata), intent(in) :: tpdiafile    ! file to write
+  type(tfiledata), intent(inout) :: tpdiafile    ! file to write
   type(date_time), intent(in) :: tpdtcur      ! current date and time
   real,            intent(in) :: ptstep       ! time step
   integer,         intent(in) :: ksv          ! number of scalar variables
@@ -427,7 +427,7 @@ subroutine Store_one_budget_rho( tpdiafile, tpdates, tprhodj, knocompress, prhod
 
   implicit none
 
-  type(tfiledata),                                      intent(in)  :: tpdiafile   ! file to write
+  type(tfiledata),                                      intent(inout) :: tpdiafile   ! file to write
   type(date_time), dimension(:),                        intent(in)  :: tpdates
   type(tburhodata),                                     intent(in)  :: tprhodj     ! rhodj datastructure
   logical,                                              intent(in)  :: knocompress ! compression for the cart option
@@ -633,7 +633,7 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress,
 
   implicit none
 
-  type(tfiledata),                                      intent(in) :: tpdiafile   ! file to write
+  type(tfiledata),                                      intent(inout) :: tpdiafile   ! file to write
   type(date_time), dimension(:),                        intent(in) :: tpdates
   type(tbudgetdata),                                    intent(in) :: tpbudget ! Budget datastructure
   real,            dimension(:,:,:,:,:,:), allocatable, intent(in) :: prhodjn
diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90
index 8ad7c4538..77a681358 100644
--- a/src/MNH/write_diachro.f90
+++ b/src/MNH/write_diachro.f90
@@ -105,7 +105,7 @@ IMPLICIT NONE
 !
 !*       0.1   Dummy arguments
 !              ---------------
-TYPE(TFILEDATA),                                     INTENT(IN)           :: TPDIAFILE    ! file to write
+TYPE(TFILEDATA),                                     INTENT(INOUT)        :: TPDIAFILE    ! file to write
 type(tbudiachrometadata),                            intent(in)           :: tpbudiachro
 class(tfield_metadata_base), dimension(:),           intent(in)           :: tpfields
 type(date_time),             dimension(:),           intent(in)           :: tpdates  !Used only for LFI files
@@ -792,7 +792,7 @@ use modd_type_date,        only: date_time
 use mode_io_field_write,   only: IO_Field_create, IO_Field_write, IO_Field_write_box
 use mode_io_tools_nc4,     only: IO_Err_handle_nc4
 
-type(tfiledata),                                     intent(in)           :: tpdiafile        ! File to write
+type(tfiledata),                                     intent(inout)        :: tpdiafile        ! File to write
 type(tbudiachrometadata),                            intent(in)           :: tpbudiachro
 class(tfield_metadata_base), dimension(:),           intent(in)           :: tpfields
 real,                        dimension(:,:,:,:,:,:), intent(in)           :: pvar
@@ -1514,7 +1514,7 @@ use modd_parameters,  only: jphext
 
 use mode_io_field_write, only: IO_Field_create, IO_Field_write, IO_Field_write_box
 
-type(tfiledata),                                     intent(in)  :: tpfile        !File to write
+type(tfiledata),                                     intent(inout) :: tpfile        !File to write
 type(tbudiachrometadata),                            intent(in)  :: tpbudiachro
 class(tfield_metadata_base),                         intent(in)  :: tpfield
 real,                        dimension(:,:,:,:,:,:), intent(in)  :: pvar
diff --git a/src/MNH/write_dummy_gr_fieldn.f90 b/src/MNH/write_dummy_gr_fieldn.f90
index 74f56e63c..a8c9cbb92 100644
--- a/src/MNH/write_dummy_gr_fieldn.f90
+++ b/src/MNH/write_dummy_gr_fieldn.f90
@@ -13,7 +13,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 END SUBROUTINE WRITE_DUMMY_GR_FIELD_n
 !
@@ -74,7 +74,7 @@ IMPLICIT NONE
 !*       0.1   Declarations of arguments
 !              -------------------------
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 !*       0.2   Declarations of local variables
 !              -------------------------------
diff --git a/src/MNH/write_hgrid.f90 b/src/MNH/write_hgrid.f90
index 27b0c7d1a..ece97e010 100644
--- a/src/MNH/write_hgrid.f90
+++ b/src/MNH/write_hgrid.f90
@@ -12,7 +12,7 @@ INTERFACE
 USE MODD_IO, ONLY: TFILEDATA
 !
 INTEGER,         INTENT(IN)  :: KMI       ! model index
-TYPE(TFILEDATA), INTENT(IN)  :: TPFILE    ! File to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE    ! File to write
 !
 END SUBROUTINE WRITE_HGRID
 END INTERFACE
@@ -72,7 +72,7 @@ IMPLICIT NONE
 !*       0.1   declarations of arguments
 !
 INTEGER,         INTENT(IN)  :: KMI       ! model index
-TYPE(TFILEDATA), INTENT(IN)  :: TPFILE    ! File to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE    ! File to write
 !
 !
 !*       0.2   declarations of local variables
diff --git a/src/MNH/write_hgridn.f90 b/src/MNH/write_hgridn.f90
index 4e134e365..79e1a14ce 100644
--- a/src/MNH/write_hgridn.f90
+++ b/src/MNH/write_hgridn.f90
@@ -11,7 +11,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA), INTENT(IN)  :: TPFILE    ! File to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE    ! File to write
 !
 END SUBROUTINE WRITE_HGRID_n
 !
@@ -81,7 +81,7 @@ IMPLICIT NONE
 !
 !*       0.1   declarations of arguments
 !
-TYPE(TFILEDATA), INTENT(IN)  :: TPFILE    ! File to write
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE    ! File to write
 !
 !
 !*       0.2   declarations of local variables
diff --git a/src/MNH/write_lbn.f90 b/src/MNH/write_lbn.f90
index dc3fd036f..a974878fe 100644
--- a/src/MNH/write_lbn.f90
+++ b/src/MNH/write_lbn.f90
@@ -13,7 +13,7 @@ SUBROUTINE WRITE_LB_n(TPFILE)
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 END SUBROUTINE WRITE_LB_n
 !
 END INTERFACE
@@ -128,7 +128,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! File characteristics
 !
 !*       0.2   Declarations of local variables
 !
diff --git a/src/MNH/write_les_budgetn.f90 b/src/MNH/write_les_budgetn.f90
index 7827ba184..1d9879d2d 100644
--- a/src/MNH/write_les_budgetn.f90
+++ b/src/MNH/write_les_budgetn.f90
@@ -83,7 +83,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE! file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE! file to write
 !
 !
 !*      0.2  declaration of local variables
diff --git a/src/MNH/write_les_rt_budgetn.f90 b/src/MNH/write_les_rt_budgetn.f90
index 114d39cda..dbdd2a8b7 100644
--- a/src/MNH/write_les_rt_budgetn.f90
+++ b/src/MNH/write_les_rt_budgetn.f90
@@ -76,7 +76,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! file to write
 !
 !
 !*      0.2  declaration of local variables
diff --git a/src/MNH/write_les_sv_budgetn.f90 b/src/MNH/write_les_sv_budgetn.f90
index 6a3997964..3f5abbaaf 100644
--- a/src/MNH/write_les_sv_budgetn.f90
+++ b/src/MNH/write_les_sv_budgetn.f90
@@ -76,7 +76,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! file to write
 !
 !*      0.2  declaration of local variables
 !
diff --git a/src/MNH/write_lesn.f90 b/src/MNH/write_lesn.f90
index e4adb2045..21db488ff 100644
--- a/src/MNH/write_lesn.f90
+++ b/src/MNH/write_lesn.f90
@@ -101,7 +101,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE! file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE! file to write
 !
 !
 !*      0.2  declaration of local variables
@@ -1194,7 +1194,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro
 
-type(tfiledata),    intent(in) :: tpdiafile ! file to write
+type(tfiledata),    intent(inout) :: tpdiafile ! file to write
 real, dimension(:), intent(in) :: pdata
 character(len=*),   intent(in) :: hmnhname
 character(len=*),   intent(in) :: hcomment
@@ -1217,7 +1217,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro
 
-type(tfiledata),      intent(in) :: tpdiafile ! file to write
+type(tfiledata),      intent(inout) :: tpdiafile ! file to write
 real, dimension(:,:), intent(in) :: pdata
 character(len=*),     intent(in) :: hmnhname
 character(len=*),     intent(in) :: hcomment
@@ -1240,7 +1240,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro
 
-type(tfiledata),                          intent(in) :: tpdiafile ! file to write
+type(tfiledata),                          intent(inout) :: tpdiafile ! file to write
 real,             dimension(:,:,:),       intent(in) :: pdata
 character(len=*),                         intent(in) :: hmnhname
 character(len=*),                         intent(in) :: hcomment
@@ -1264,7 +1264,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro
 
-type(tfiledata),                            intent(in) :: tpdiafile ! file to write
+type(tfiledata),                            intent(inout) :: tpdiafile ! file to write
 real,             dimension(:,:,:,:),       intent(in) :: pdata
 character(len=*),                           intent(in) :: hmnhname
 character(len=*),                           intent(in) :: hcomment
@@ -1288,7 +1288,7 @@ use modd_io,          only: tfiledata
 
 use mode_les_diachro, only: Les_diachro_2pt
 
-type(tfiledata),          intent(in) :: tpdiafile ! file to write
+type(tfiledata),          intent(inout) :: tpdiafile ! file to write
 real, dimension(:,:,:),   intent(in) :: zcorri    ! 2 pts correlation data
 real, dimension(:,:,:),   intent(in) :: zcorrj    ! 2 pts correlation data
 character(len=*),         intent(in) :: hmnhname
diff --git a/src/MNH/write_lfifm1_for_diag.f90 b/src/MNH/write_lfifm1_for_diag.f90
index 60240e9ca..c4fc3d50b 100644
--- a/src/MNH/write_lfifm1_for_diag.f90
+++ b/src/MNH/write_lfifm1_for_diag.f90
@@ -11,7 +11,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE       ! outpput data file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE       ! outpput data file
 CHARACTER(LEN=28), INTENT(IN) :: HDADFILE     ! corresponding FM-file name of 
                                               ! its DAD model
 !
@@ -259,7 +259,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE       ! outpput data file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE       ! outpput data file
 CHARACTER(LEN=28), INTENT(IN) :: HDADFILE     ! corresponding FM-file name of 
                                               ! its DAD model
 !
diff --git a/src/MNH/write_lfifm1_for_diag_supp.f90 b/src/MNH/write_lfifm1_for_diag_supp.f90
index 1bb11e435..ea51feba2 100644
--- a/src/MNH/write_lfifm1_for_diag_supp.f90
+++ b/src/MNH/write_lfifm1_for_diag_supp.f90
@@ -14,7 +14,7 @@ USE MODD_IO, ONLY: TFILEDATA
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! Output file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! Output file
 !
 END SUBROUTINE WRITE_LFIFM1_FOR_DIAG_SUPP
 !
@@ -170,7 +170,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! Output file
+TYPE(TFILEDATA),   INTENT(INOUT) :: TPFILE ! Output file
 !
 !*       0.2   Declarations of local variables
 !
diff --git a/src/MNH/write_lfifmn_fordiachron.f90 b/src/MNH/write_lfifmn_fordiachron.f90
index d6c6ba317..ee987bfc1 100644
--- a/src/MNH/write_lfifmn_fordiachron.f90
+++ b/src/MNH/write_lfifmn_fordiachron.f90
@@ -118,7 +118,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA),INTENT(IN) :: TPFILE
+TYPE(TFILEDATA),INTENT(INOUT) :: TPFILE
 !
 !*       0.2   Declarations of local variables
 !
diff --git a/src/MNH/write_lfin.f90 b/src/MNH/write_lfin.f90
index ea08bd41d..d397bec0b 100644
--- a/src/MNH/write_lfin.f90
+++ b/src/MNH/write_lfin.f90
@@ -15,7 +15,7 @@ USE MODD_IO, ONLY: TFILEDATA
 !
 IMPLICIT NONE
 !
-TYPE(TFILEDATA), INTENT(IN) :: TPFILE   ! File characteristics
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE   ! File characteristics
 CHARACTER(LEN=*),INTENT(IN) :: HDADFILE ! Corresponding FM-file name of its DAD model
 END SUBROUTINE WRITE_LFIFM_n
 !
@@ -296,7 +296,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of arguments
 !
-TYPE(TFILEDATA), INTENT(IN) :: TPFILE   ! File characteristics
+TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE   ! File characteristics
 CHARACTER(LEN=*),INTENT(IN) :: HDADFILE ! Corresponding FM-file name of its DAD model
 !
 !*       0.2   Declarations of local variables
diff --git a/src/MNH/write_profilern.f90 b/src/MNH/write_profilern.f90
index 486978e1c..f3fbf5aa0 100644
--- a/src/MNH/write_profilern.f90
+++ b/src/MNH/write_profilern.f90
@@ -55,7 +55,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! diachronic file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! diachronic file to write
 !
 !-------------------------------------------------------------------------------
 !
@@ -106,7 +106,7 @@ USE MODE_AERO_PSD
 USE MODE_DUST_PSD
 use mode_write_diachro,   only: Write_diachro
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! diachronic file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! diachronic file to write
 INTEGER,          INTENT(IN) :: KI
 !
 !*      0.2  declaration of local variables for diachro
diff --git a/src/MNH/write_seriesn.f90 b/src/MNH/write_seriesn.f90
index 54ed6c7c8..b17ef9b32 100644
--- a/src/MNH/write_seriesn.f90
+++ b/src/MNH/write_seriesn.f90
@@ -15,7 +15,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),    INTENT(IN) :: TPDIAFILE    ! file to write
+TYPE(TFILEDATA),    INTENT(INOUT) :: TPDIAFILE    ! file to write
 !
 END SUBROUTINE WRITE_SERIES_n
 !
@@ -90,7 +90,7 @@ IMPLICIT NONE
 !
 !*       0.1   declarations of arguments
 !
-TYPE(TFILEDATA),    INTENT(IN) :: TPDIAFILE    ! file to write
+TYPE(TFILEDATA),    INTENT(INOUT) :: TPDIAFILE    ! file to write
 !
 !*       0.2     Local variables 
 !
diff --git a/src/MNH/write_stationn.f90 b/src/MNH/write_stationn.f90
index 7efb9adaa..6b38193d6 100644
--- a/src/MNH/write_stationn.f90
+++ b/src/MNH/write_stationn.f90
@@ -13,7 +13,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! diachronic file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! diachronic file to write
 !
 END SUBROUTINE WRITE_STATION_n
 !
@@ -98,7 +98,7 @@ IMPLICIT NONE
 !
 !*      0.1  declarations of arguments
 !
-TYPE(TFILEDATA),  INTENT(IN) :: TPDIAFILE ! diachronic file to write
+TYPE(TFILEDATA),  INTENT(INOUT) :: TPDIAFILE ! diachronic file to write
 !
 !-------------------------------------------------------------------------------
 !
diff --git a/src/MNH/zsmt_pgd.f90 b/src/MNH/zsmt_pgd.f90
index b7c97c10a..b4609f1c7 100644
--- a/src/MNH/zsmt_pgd.f90
+++ b/src/MNH/zsmt_pgd.f90
@@ -13,7 +13,7 @@ INTERFACE
 !
 USE MODD_IO, ONLY: TFILEDATA
 !
-TYPE(TFILEDATA),     INTENT(IN)  :: TPFILE       ! File characteristics
+TYPE(TFILEDATA),     INTENT(INOUT) :: TPFILE       ! File characteristics
 INTEGER,             INTENT(IN)  :: KZSFILTER    ! number of iterations for fine orography
 INTEGER,             INTENT(IN)  :: KSLEVE       ! number of iterations
 INTEGER,             INTENT(IN)  :: KLOCZSFILTER ! number of iteration for filter of local fine orography
@@ -83,7 +83,7 @@ IMPLICIT NONE
 !
 !*       0.1   declarations of arguments
 !
-TYPE(TFILEDATA),     INTENT(IN)  :: TPFILE       ! File characteristics
+TYPE(TFILEDATA),     INTENT(INOUT) :: TPFILE       ! File characteristics
 INTEGER,             INTENT(IN)  :: KZSFILTER    ! number of iterations for fine orography
 INTEGER,             INTENT(IN)  :: KSLEVE       ! number of iterations
 INTEGER,             INTENT(IN)  :: KLOCZSFILTER ! number of iteration for filter of local fine orography
diff --git a/src/ZSOLVER/advection_metsv.f90 b/src/ZSOLVER/advection_metsv.f90
index 481586dd4..88fa40632 100644
--- a/src/ZSOLVER/advection_metsv.f90
+++ b/src/ZSOLVER/advection_metsv.f90
@@ -20,7 +20,7 @@ INTERFACE
 USE MODD_IO,        ONLY: TFILEDATA
 USE MODD_TYPE_DATE, ONLY: DATE_TIME
 !
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 CHARACTER(LEN=6),       INTENT(IN)   :: HMET_ADV_SCHEME, & ! Control of the
                                         HSV_ADV_SCHEME, &  ! scheme applied
                                         HUVW_ADV_SCHEME
@@ -204,7 +204,7 @@ IMPLICIT NONE
 !
 !*       0.1   Declarations of dummy arguments :
 !
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 CHARACTER(LEN=6),       INTENT(IN)   :: HMET_ADV_SCHEME, & ! Control of the
                                         HSV_ADV_SCHEME, &  ! scheme applied
                                         HUVW_ADV_SCHEME
diff --git a/src/ZSOLVER/turb.f90 b/src/ZSOLVER/turb.f90
index 248d01fb9..25ed9117b 100644
--- a/src/ZSOLVER/turb.f90
+++ b/src/ZSOLVER/turb.f90
@@ -332,7 +332,7 @@ CHARACTER(len=4),       INTENT(IN)   ::  HTURBLEN_CL  ! kind of cloud mixing len
 REAL,                   INTENT(IN)   ::  PIMPL        ! degree of implicitness
 CHARACTER (LEN=4),      INTENT(IN)   ::  HCLOUD       ! Kind of microphysical scheme
 REAL,                   INTENT(IN)   ::  PTSTEP       ! timestep 
-TYPE(TFILEDATA),        INTENT(IN)   ::  TPFILE       ! Output file
+TYPE(TFILEDATA),        INTENT(INOUT)::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:), INTENT(IN)   :: PDXX,PDYY,PDZZ,PDZX,PDZY
                                         ! metric coefficients
diff --git a/src/ZSOLVER/turb_hor_dyn_corr.f90 b/src/ZSOLVER/turb_hor_dyn_corr.f90
index 05ae05310..45e0b91b2 100644
--- a/src/ZSOLVER/turb_hor_dyn_corr.f90
+++ b/src/ZSOLVER/turb_hor_dyn_corr.f90
@@ -29,7 +29,7 @@ REAL,                     INTENT(IN)    ::  PTSTEP       ! timestep
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -190,7 +190,7 @@ REAL,                     INTENT(IN)    ::  PTSTEP       ! timestep
 LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 INTEGER,                  INTENT(IN)    ::  KRR          ! number of moist var.
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
diff --git a/src/ZSOLVER/turb_hor_thermo_flux.f90 b/src/ZSOLVER/turb_hor_thermo_flux.f90
index 9c02d72a1..c16b9e9c8 100644
--- a/src/ZSOLVER/turb_hor_thermo_flux.f90
+++ b/src/ZSOLVER/turb_hor_thermo_flux.f90
@@ -31,7 +31,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
@@ -172,7 +172,7 @@ LOGICAL,                  INTENT(IN)    ::  OTURB_FLX    ! switch to write the
                                  ! turbulent fluxes in the syncronous FM-file
 LOGICAL,                 INTENT(IN)  ::   OSUBG_COND ! Switch for sub-grid 
 !                                                    condensation
-TYPE(TFILEDATA),          INTENT(IN)    ::  TPFILE       ! Output file
+TYPE(TFILEDATA),          INTENT(INOUT) ::  TPFILE       ! Output file
 !
 REAL, DIMENSION(:,:,:),   INTENT(IN)    ::  PK          ! Turbulent diffusion doef.
                                                         ! PK = PLM * SQRT(PTKEM)
-- 
GitLab