From 1fdd694acd25b3958f507a30fe640d3baf50ceb4 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 19 Oct 2017 16:22:39 +0200
Subject: [PATCH] Philippe 19/10/2017: IO: removed extern_userio.f90 + cleaning

---
 src/LIB/SURCOUCHE/src/extern_userio.f90 | 174 ------------------------
 src/LIB/SURCOUCHE/src/mode_mppdb.f90    |  12 +-
 src/MNH/advec_3rd_order_aux.f90         |  48 ++-----
 src/MNH/advec_weno_k_2_aux.f90          |  48 ++-----
 src/MNH/aircraft_balloon_evol.f90       |   3 +-
 src/MNH/ch_aqueous_sedimc2r2.f90JPP     |   2 +-
 src/MNH/ch_model0d.f90                  |   1 +
 src/MNH/compare_dad.f90                 |   4 +-
 src/MNH/compute_r00.f90                 |   6 -
 src/MNH/eddy_fluxn.f90                  |   4 +-
 src/MNH/exchange.f90                    |   4 +-
 src/MNH/flash_geom_elec.f90             |   1 -
 src/MNH/fun.f90                         |   8 +-
 src/MNH/get_nb_procio_read_mnh.f90      |   1 +
 src/MNH/get_nb_procio_write_mnh.f90     |   1 +
 src/MNH/gps_zenith.f90                  |   2 +-
 src/MNH/gps_zenith_grid.f90             |   2 -
 src/MNH/ini_cst.f90                     |   1 -
 src/MNH/ini_les_cart_maskn.f90          |   2 +-
 src/MNH/ini_lesn.f90                    |   2 +-
 src/MNH/ini_lima.f90                    |   4 +-
 src/MNH/ini_lima_warm.f90               |   4 +-
 src/MNH/ini_modeln.f90                  |   2 +-
 src/MNH/ini_posprofilern.f90            |   1 +
 src/MNH/ini_spectren.f90                |   2 +-
 src/MNH/ini_surfstationn.f90            |   1 +
 src/MNH/init_aerosol_properties.f90     |   4 +-
 src/MNH/init_for_convlfi.f90            |   2 +-
 src/MNH/lesn.f90                        |   4 +-
 src/MNH/mnh2lpdm.f90                    |   2 +-
 src/MNH/mnh2lpdm_ech.f90                |   2 +-
 src/MNH/mnh_surf_grid_io_init.f90       |   1 +
 src/MNH/mnhget_luout.f90                |   1 +
 src/MNH/mode_gatherall_border_ll.f90    |   2 +-
 src/MNH/pgd_grid_io_init_mnh.f90        |   1 +
 src/MNH/prep_ideal_case.f90             |   2 +-
 src/MNH/prep_nest_pgd.f90               |   2 +-
 src/MNH/profilern.f90                   |   1 +
 src/MNH/read_all_data_grib_case.f90     |   2 -
 src/MNH/read_prc_fmfile.f90             |   2 -
 src/MNH/resolved_elecn.f90              |   2 +-
 src/MNH/set_geosbal.f90                 |   2 +-
 src/MNH/set_grid.f90                    |   2 +-
 src/MNH/set_mass.f90                    |   2 +-
 src/MNH/set_msk.f90                     |   4 +-
 src/MNH/set_perturb.f90                 |   2 +-
 src/MNH/spawn_field2.f90                |   4 +-
 src/MNH/spawn_zs.f90                    |   1 +
 src/MNH/spec_ver_int.f90                |   2 +-
 src/MNH/spectre_arome.f90               |   1 +
 src/MNH/stationn.f90                    |   1 +
 src/MNH/write_hgrid.f90                 |   2 -
 src/MNH/write_lbn.f90                   |   1 -
 src/MNH/write_lfifm1_for_diag.f90       |   2 +-
 src/MNH/write_lfifmn_fordiachron.f90    |   2 +-
 src/MNH/write_lfin.f90                  |   2 +-
 src/MNH/write_seriesn.f90               |   2 +-
 57 files changed, 76 insertions(+), 326 deletions(-)
 delete mode 100644 src/LIB/SURCOUCHE/src/extern_userio.f90

diff --git a/src/LIB/SURCOUCHE/src/extern_userio.f90 b/src/LIB/SURCOUCHE/src/extern_userio.f90
deleted file mode 100644
index 7cf8feab8..000000000
--- a/src/LIB/SURCOUCHE/src/extern_userio.f90
+++ /dev/null
@@ -1,174 +0,0 @@
-!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
-!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
-!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
-!MNH_LIC for details. version 1.
-!-----------------------------------------------------------------
-!--------------- special set of characters for CVS information
-!-----------------------------------------------------------------
-! $Source$
-! $Name$ 
-! $Revision$ 
-! $Date$
-!-----------------------------------------------------------------
-!-----------------------------------------------------------------
-
-!
-! This file contains all the user IO routines. All these external routines have
-! an interface in the modi_allio.f90 file.
-!
-
-!
-! Routines found in the MODE_IO_ll module : INITIO_ll, OPEN_ll, CLOSE_ll, FLUSH_ll
-!
-SUBROUTINE INITIO_ll()
-USE MODE_IO_ll, ONLY : E_INITIO_ll=>INITIO_ll
-IMPLICIT NONE 
-
-CALL E_INITIO_ll()
-
-END SUBROUTINE INITIO_ll
-
-SUBROUTINE OPEN_ll(UNIT,FILE,MODE,LFIPAR,COMM,STATUS,ACCESS,  &
-     IOSTAT,FORM,RECL,BLANK,POSITION,ACTION,DELIM,PAD,OPARALLELIO)
-USE MODE_IO_ll, ONLY : E_OPEN_ll=>OPEN_ll
-USE MODD_IO_ll, ONLY : LFIPARAM
-IMPLICIT NONE 
-
-INTEGER,         INTENT(OUT)           :: UNIT  !! Different from fortran OPEN
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: FILE
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: MODE
-TYPE(LFIPARAM),  POINTER,     OPTIONAL :: LFIPAR
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: STATUS
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: ACCESS
-INTEGER,         INTENT(OUT)           :: IOSTAT
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: FORM
-INTEGER,         INTENT(IN),  OPTIONAL :: RECL
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: BLANK
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: POSITION
-CHARACTER(len=*),INTENT(IN)            :: ACTION
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: DELIM
-CHARACTER(len=*),INTENT(IN),  OPTIONAL :: PAD
-INTEGER,         INTENT(IN),  OPTIONAL :: COMM
-LOGICAL,         INTENT(IN),  OPTIONAL :: OPARALLELIO
-
-IF ( PRESENT(OPARALLELIO) ) THEN
-  CALL E_OPEN_ll(UNIT,FILE,MODE,LFIPAR,COMM,STATUS,ACCESS,  &
-      IOSTAT,FORM,RECL,BLANK,POSITION,ACTION,DELIM,PAD,OPARALLELIO=OPARALLELIO)
-ELSE
-  CALL E_OPEN_ll(UNIT,FILE,MODE,LFIPAR,COMM,STATUS,ACCESS,  &
-      IOSTAT,FORM,RECL,BLANK,POSITION,ACTION,DELIM,PAD)
-ENDIF
-
-END SUBROUTINE OPEN_ll
-
-SUBROUTINE CLOSE_ll(HFILE,IOSTAT,STATUS,OPARALLELIO)
-USE MODE_IO_ll, ONLY : E_CLOSE_ll=>CLOSE_ll
-IMPLICIT NONE 
-
-CHARACTER(LEN=*), INTENT(IN)            :: HFILE
-INTEGER,          INTENT(OUT), OPTIONAL :: IOSTAT
-CHARACTER(LEN=*), INTENT(IN),  OPTIONAL :: STATUS
-LOGICAL,          INTENT(IN),  OPTIONAL :: OPARALLELIO
-
-IF( PRESENT(OPARALLELIO) ) THEN
-  CALL E_CLOSE_ll(HFILE,IOSTAT,STATUS,OPARALLELIO=OPARALLELIO)
-ELSE
-  CALL E_CLOSE_ll(HFILE,IOSTAT,STATUS)
-ENDIF
-
-END SUBROUTINE CLOSE_ll
-
-SUBROUTINE FLUSH_ll(HFILE,IRESP)
-USE MODE_IO_ll, ONLY : E_FLUSH_ll=>FLUSH_ll
-IMPLICIT NONE 
-
-CHARACTER(LEN=*), INTENT(IN)            :: HFILE
-INTEGER,          INTENT(OUT), OPTIONAL :: IRESP
-
-CALL E_FLUSH_ll(HFILE,IRESP)
-
-END SUBROUTINE FLUSH_ll
-!
-! Routines found in the MODE_FM module : FMATTR_ll, FMLOOK_ll
-!
-SUBROUTINE SET_FMPACK_ll(O1D,O2D,OPACK)
-USE MODE_FM, ONLY : E_SET_FMPACK_ll=>SET_FMPACK_ll
-LOGICAL, INTENT(IN) :: O1D,O2D,OPACK
-
-CALL E_SET_FMPACK_ll(O1D,O2D,OPACK)
-
-END SUBROUTINE SET_FMPACK_ll
-
-SUBROUTINE FMLOOK_ll(HFILEM,HFIPRI,KNUMBR,KRESP)
-USE MODE_FM, ONLY : E_FMLOOK_ll=>FMLOOK_ll
-IMPLICIT NONE 
-CHARACTER(LEN=*), INTENT(IN)  :: HFILEM
-CHARACTER(LEN=*), INTENT(IN)  :: HFIPRI
-INTEGER,          INTENT(OUT) :: KNUMBR
-INTEGER,          INTENT(OUT) :: KRESP
-
-CALL E_FMLOOK_ll(HFILEM,HFIPRI,KNUMBR,KRESP)
-
-END SUBROUTINE FMLOOK_ll
-!
-! Routines found in the MODE_GATHER_ll module : GATHERALL_xx
-!
-SUBROUTINE GATHERALL_X1(HDIR,PSEND,PRECV,KRESP)
-USE MODE_GATHER_ll, ONLY : E_GATHERALL_X1=>GATHERALL_X1
-IMPLICIT NONE 
-CHARACTER(LEN=*),  INTENT(IN) :: HDIR
-REAL,DIMENSION(:), INTENT(IN) :: PSEND
-REAL,DIMENSION(:), INTENT(INOUT):: PRECV
-INTEGER,           INTENT(INOUT):: KRESP
-
-CALL E_GATHERALL_X1(HDIR,PSEND,PRECV,KRESP)
-
-END SUBROUTINE GATHERALL_X1
-  
-SUBROUTINE GATHERALL_X2(HDIR,PSEND,PRECV,KRESP)
-USE MODE_GATHER_ll, ONLY : E_GATHERALL_X2=>GATHERALL_X2
-IMPLICIT NONE 
-CHARACTER(LEN=*),    INTENT(IN) :: HDIR
-REAL,DIMENSION(:,:), INTENT(IN) :: PSEND
-REAL,DIMENSION(:,:), INTENT(INOUT):: PRECV
-INTEGER,             INTENT(INOUT):: KRESP
-
-CALL E_GATHERALL_X2(HDIR,PSEND,PRECV,KRESP)
-
-END SUBROUTINE GATHERALL_X2
-  
-SUBROUTINE GATHERALL_X3(HDIR,PSEND,PRECV,KRESP)
-USE MODE_GATHER_ll, ONLY : E_GATHERALL_X3=>GATHERALL_X3
-IMPLICIT NONE
-CHARACTER(LEN=*),      INTENT(IN) :: HDIR
-REAL,DIMENSION(:,:,:), INTENT(IN) :: PSEND
-REAL,DIMENSION(:,:,:), INTENT(INOUT):: PRECV
-INTEGER,               INTENT(INOUT):: KRESP
-
-CALL E_GATHERALL_X3(HDIR,PSEND,PRECV,KRESP)
-
-END SUBROUTINE GATHERALL_X3
-  
-SUBROUTINE GATHERALL_N1(HDIR,KSEND,KRECV,KRESP)
-USE MODE_GATHER_ll, ONLY : E_GATHERALL_N1=>GATHERALL_N1
-IMPLICIT NONE
-CHARACTER(LEN=*),     INTENT(IN) :: HDIR
-INTEGER,DIMENSION(:), INTENT(IN) :: KSEND
-INTEGER,DIMENSION(:), INTENT(INOUT):: KRECV
-INTEGER,              INTENT(INOUT):: KRESP
-
-CALL E_GATHERALL_N1(HDIR,KSEND,KRECV,KRESP)
-
-END SUBROUTINE GATHERALL_N1
-
-SUBROUTINE GATHERALL_N2(HDIR,KSEND,KRECV,KRESP)
-USE MODE_GATHER_ll, ONLY : E_GATHERALL_N2=>GATHERALL_N2
-IMPLICIT NONE
-CHARACTER(LEN=*),       INTENT(IN) :: HDIR
-INTEGER,DIMENSION(:,:), INTENT(IN) :: KSEND
-INTEGER,DIMENSION(:,:), INTENT(INOUT):: KRECV
-INTEGER,                INTENT(INOUT):: KRESP
-
-CALL E_GATHERALL_N2(HDIR,KSEND,KRECV,KRESP)
-
-END SUBROUTINE GATHERALL_N2
diff --git a/src/LIB/SURCOUCHE/src/mode_mppdb.f90 b/src/LIB/SURCOUCHE/src/mode_mppdb.f90
index 42bff6b5a..27a67e641 100644
--- a/src/LIB/SURCOUCHE/src/mode_mppdb.f90
+++ b/src/LIB/SURCOUCHE/src/mode_mppdb.f90
@@ -258,9 +258,9 @@ CONTAINS
   SUBROUTINE MPPDB_CHECK3D(PTAB,MESSAGE,PRECISION)
 
     USE MODD_PARAMETERS_ll, ONLY : JPHEXT
-    USE MODI_GATHER_ll
     USE MODD_VAR_ll    , ONLY : MPI_PRECISION
     USE MODD_MPIF      , ONLY : MPI_INTEGER, MPI_STATUS_IGNORE, MPI_SUM
+    USE MODE_GATHER_ll
 
     IMPLICIT NONE
 
@@ -418,11 +418,6 @@ CONTAINS
                            ,PTAB11,PTAB12,PTAB13,PTAB14,PTAB15,PTAB16,PTAB17,PTAB18,PTAB19,PTAB20 &
                            )
 
-    USE MODD_PARAMETERS_ll, ONLY : JPHEXT
-    USE MODI_GATHER_ll
-    USE MODD_VAR_ll    , ONLY : MPI_PRECISION
-
-
     IMPLICIT NONE
 
     CHARACTER(len=*)                     :: MESSAGE
@@ -458,7 +453,7 @@ CONTAINS
   SUBROUTINE MPPDB_CHECK2D(PTAB,MESSAGE,PRECISION)
 
     USE MODD_PARAMETERS_ll, ONLY : JPHEXT
-    USE MODI_GATHER_ll
+    USE MODE_GATHER_ll
     USE MODD_VAR_ll    , ONLY : MPI_PRECISION
     USE MODD_MPIF      , ONLY : MPI_INTEGER, MPI_STATUS_IGNORE, MPI_SUM
 
@@ -607,7 +602,6 @@ CONTAINS
   SUBROUTINE MPPDB_CHECKLB(PLB,MESSAGE,PRECISION,HLBTYPE,KRIM)
 
     USE MODD_PARAMETERS_ll, ONLY : JPHEXT
-    USE MODI_GATHER_ll
     USE MODD_VAR_ll    , ONLY : MPI_PRECISION ,  NMNH_COMM_WORLD
     USE MODD_IO_ll,        ONLY : ISP,ISNPROC,GSMONOPROC,LPACK,L2D
     USE MODD_MPIF      , ONLY   : MPI_INTEGER, MPI_STATUS_IGNORE
@@ -792,7 +786,6 @@ CONTAINS
   SUBROUTINE MPPDB_CHECK_SURFEX2D(PTAB,MESSAGE,PRECISION,KLUOUT,HTYPE,KIU,KJU)
 
     USE MODD_PARAMETERS, ONLY : JPHEXT
-    USE MODI_GATHER_ll
     USE MODD_VAR_ll    , ONLY : MPI_PRECISION
     USE MODI_GET_1D_MASK
     USE MODI_UNPACK_SAME_RANK
@@ -887,7 +880,6 @@ CONTAINS
   SUBROUTINE MPPDB_CHECK_SURFEX3D(PTAB,MESSAGE,PRECISION,KLUOUT,HTYPE,KZSIZE)
 
     USE MODD_PARAMETERS, ONLY : JPHEXT
-    USE MODI_GATHER_ll
     USE MODD_VAR_ll    , ONLY : MPI_PRECISION
     USE MODI_GET_1D_MASK
     USE MODI_UNPACK_SAME_RANK
diff --git a/src/MNH/advec_3rd_order_aux.f90 b/src/MNH/advec_3rd_order_aux.f90
index f74f3eb83..078fca67f 100644
--- a/src/MNH/advec_3rd_order_aux.f90
+++ b/src/MNH/advec_3rd_order_aux.f90
@@ -189,16 +189,8 @@ SELECT CASE ( HLBCX(1) ) ! X direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IW=IIB+1
-    IE=IIE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 3rd order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF  
+  IW=IIB+1
+  IE=IIE
 !
   IWF=IW-1
   IEF=IE-1
@@ -345,16 +337,8 @@ SELECT CASE ( HLBCX(1) ) ! X direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IW=IIB+1
-    IE=IIE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 3rd order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF  
+  IW=IIB+1
+  IE=IIE
 !
   IWF=IW
   IEF=IE
@@ -500,16 +484,8 @@ SELECT CASE ( HLBCY(1) ) !
 !
 CASE ('CYCL')          ! In that case one must have HLBCY(1) == HLBCY(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IS=IJB+1
-    IN=IJE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 4th order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF
+  IS=IJB+1
+  IN=IJE
 !
   ISF=IS-1
   INF=IN-1
@@ -656,16 +632,8 @@ SELECT CASE ( HLBCY(1) ) ! Y direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IS=IJB+1
-    IN=IJE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 4th order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF
+  IS=IJB+1
+  IN=IJE
 !
   ISF=IS
   INF=IN
diff --git a/src/MNH/advec_weno_k_2_aux.f90 b/src/MNH/advec_weno_k_2_aux.f90
index 4660a4a7b..4aae23170 100644
--- a/src/MNH/advec_weno_k_2_aux.f90
+++ b/src/MNH/advec_weno_k_2_aux.f90
@@ -223,16 +223,8 @@ SELECT CASE ( HLBCX(1) ) ! X direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IW=IIB
-    IE=IIE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 3rd order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF
+  IW=IIB
+  IE=IIE
 !
 ! r: many left cells in regard to 'i' cell for each stencil
 !
@@ -485,16 +477,8 @@ SELECT CASE ( HLBCX(1) ) ! X direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IW=IIB
-    IE=IIE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 3rd order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF  
+  IW=IIB
+  IE=IIE
 !
 ! intermediate fluxes for positive wind case
 !
@@ -747,16 +731,8 @@ SELECT CASE ( HLBCY(1) ) !
 !
 CASE ('CYCL')          ! In that case one must have HLBCY(1) == HLBCY(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IS=IJB
-    IN=IJE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 4th order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF
+  IS=IJB
+  IN=IJE
 !
 ! intermediate fluxes for positive wind case
 !
@@ -1003,16 +979,8 @@ SELECT CASE ( HLBCY(1) ) ! Y direction LBC type: (1) for left side
 !
 CASE ('CYCL')          ! In that case one must have HLBCX(1) == HLBCX(2)
 !
-!!$  IF(NHALO == 1) THEN
-    IS=IJB
-    IN=IJE
-!!$  ELSE
-!!$    CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT,IRESP)
-!!$    WRITE(ILUOUT,*) 'ERROR : 4th order advection in CYCLic case '
-!!$    WRITE(ILUOUT,*) 'cannot be used with NHALO=2'
-!!$    CALL ABORT
-!!$    STOP
-!!$  END IF
+  IS=IJB
+  IN=IJE
 !
 ! intermediate fluxes for positive wind case
 !
diff --git a/src/MNH/aircraft_balloon_evol.f90 b/src/MNH/aircraft_balloon_evol.f90
index 85d29d190..d2b5c32b9 100644
--- a/src/MNH/aircraft_balloon_evol.f90
+++ b/src/MNH/aircraft_balloon_evol.f90
@@ -178,9 +178,10 @@ USE MODD_PARAM_LIMA, ONLY: XALPHAR_L=>XALPHAR,XNUR_L=>XNUR,XALPHAS_L=>XALPHAS,XN
                            XALPHAG_L=>XALPHAG,XNUG_L=>XNUG, XALPHAI_L=>XALPHAI,XNUI_L=>XNUI,&
                            XRTMIN_L=>XRTMIN,XALPHAC_L=>XALPHAC,XNUC_L=>XNUC
 !
-USE MODE_ll
+USE MODE_FM, ONLY : FMLOOK_ll
 USE MODE_IO_ll
 USE MODE_GRIDPROJ
+USE MODE_ll
 USE MODE_MSG
 !
 USE MODI_WATER_SUM
diff --git a/src/MNH/ch_aqueous_sedimc2r2.f90JPP b/src/MNH/ch_aqueous_sedimc2r2.f90JPP
index 19969ca7b..44e309035 100644
--- a/src/MNH/ch_aqueous_sedimc2r2.f90JPP
+++ b/src/MNH/ch_aqueous_sedimc2r2.f90JPP
@@ -287,7 +287,7 @@ END DO
 !
 ! Apply the rain sedimentation rate to the WR_xxx aqueous species
 !
-!CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+!ILUOUT = TLUOUT%NLU
 !WRITE(ILUOUT,*) 'valuers ZSV_SEDIM_FACT TIME =', PTIME-59400.
 !DO JI=IIB,IIE
 !  DO JJ = IJB,IJE
diff --git a/src/MNH/ch_model0d.f90 b/src/MNH/ch_model0d.f90
index f15d6c4e0..293573c1c 100644
--- a/src/MNH/ch_model0d.f90
+++ b/src/MNH/ch_model0d.f90
@@ -88,6 +88,7 @@ USE MODD_CH_M9_n,     ONLY: NEQ, NREAC,      & ! no. of species & reactions
 USE MODD_CONF, ONLY : CPROGRAM 
 USE MODD_CH_M9_SCHEME, ONLY :  CCSTYPE,TACCS
 
+USE MODE_IO_ll
 USE MODE_MODELN_HANDLER
 !!
 !!
diff --git a/src/MNH/compare_dad.f90 b/src/MNH/compare_dad.f90
index 5c19c6642..0843a172e 100644
--- a/src/MNH/compare_dad.f90
+++ b/src/MNH/compare_dad.f90
@@ -70,7 +70,7 @@ END MODULE MODI_COMPARE_DAD
 !
 USE MODD_CONF
 USE MODD_IO_ll,      ONLY: TFILEDATA
-USE MODD_LUNIT_n
+USE MODD_LUNIT_n,    ONLY: TLUOUT
 USE MODD_PARAMETERS, ONLY: JPHEXT,JPVEXT,NMNHNAMELGTMAX
 !
 USE MODE_FIELD, ONLY : TFIELDDATA,TFIELDLIST,FIND_FIELD_ID_FROM_MNHNAME
@@ -120,7 +120,7 @@ TYPE(TFILEDATA),POINTER :: TZDADSPAFILE => NULL()
 !*   1.    INITIALIZATIONS
 !          ---------------
 !
-CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+ILUOUT = TLUOUT%NLU
 !
 ZLON0_1=0.
 ZLAT0_1=0.
diff --git a/src/MNH/compute_r00.f90 b/src/MNH/compute_r00.f90
index ef7110775..5208ce853 100644
--- a/src/MNH/compute_r00.f90
+++ b/src/MNH/compute_r00.f90
@@ -97,12 +97,6 @@ TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! Output file
 !
 !*       0.2   declarations of local variables
 !
-INTEGER  :: IRESP                ! return code in FM routines
-INTEGER  :: INPRAR               ! number of articles predicted  in
-                                 !  the LFIFM file
-INTEGER  :: ININAR               ! number of articles  present in
-                                 !  the LFIFM file
-!
 INTEGER                            :: IFILECUR,JFILECUR,NIU,NJU,NKU
 INTEGER                            :: NFILES,JLOOP
 REAL                               :: ZXOR,ZYOR,ZDX,ZDY
diff --git a/src/MNH/eddy_fluxn.f90 b/src/MNH/eddy_fluxn.f90
index fc2a90315..66ddd34b2 100644
--- a/src/MNH/eddy_fluxn.f90
+++ b/src/MNH/eddy_fluxn.f90
@@ -102,7 +102,7 @@ USE MODI_GRADIENT_U
 USE MODI_GRADIENT_V
 USE MODI_SHUMAN
 USE MODE_GRIDPROJ
-USE MODD_LUNIT_n
+USE MODD_LUNIT_n, ONLY: TLUOUT
 USE MODD_REF
 USE MODD_LATZ_EDFLX
 !
@@ -167,7 +167,7 @@ IKE=IKU-JPVEXT
 IIU = SIZE(XXHAT)
 
 ! RECOVER THE LOGICAL UNIT NUMBER FOR THE OUTPUT PRINTS
-CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+ILUOUT = TLUOUT%NLU
 !
 !       1.1 ALLOCATION DES TABLEAUX
 !           -----------------------
diff --git a/src/MNH/exchange.f90 b/src/MNH/exchange.f90
index b96fb5154..9a5ef3b28 100644
--- a/src/MNH/exchange.f90
+++ b/src/MNH/exchange.f90
@@ -105,7 +105,7 @@ USE MODD_GRID_n
 USE MODD_NSV
 USE MODD_BUDGET,      ONLY : LBUDGET_SV
 USE MODD_CST,         ONLY : XMNH_TINY
-USE MODD_LUNIT_n,     ONLY : CLUOUT
+USE MODD_LUNIT_n,     ONLY : TLUOUT
 USE MODI_SHUMAN
 USE MODI_SUM_ll
 USE MODI_BUDGET
@@ -140,7 +140,7 @@ REAL      :: ZRATIO, ZMASSTOT, ZMASSPOS
 !------------------------------------------------------------------------------
 !
 IKU=SIZE(XZHAT)
-CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+ILUOUT = TLUOUT%NLU
 !
 !*       1.     TRANSFORMS THE SOURCE TERMS INTO PROGNOSTIC VARIABLES
 !               -----------------------------------------------------
diff --git a/src/MNH/flash_geom_elec.f90 b/src/MNH/flash_geom_elec.f90
index b655a21ac..b5c4b84a3 100644
--- a/src/MNH/flash_geom_elec.f90
+++ b/src/MNH/flash_geom_elec.f90
@@ -118,7 +118,6 @@ USE MODD_ELEC_FLASH
 USE MODI_SHUMAN
 USE MODI_TO_ELEC_FIELD_n
 USE MODI_ION_ATTACH_ELEC
-USE MODI_IO_ll
 !
 #ifdef MNH_PGI
 USE MODE_PACK_PGI
diff --git a/src/MNH/fun.f90 b/src/MNH/fun.f90
index 5ba1bfd74..1da74fcb1 100644
--- a/src/MNH/fun.f90
+++ b/src/MNH/fun.f90
@@ -92,7 +92,7 @@ END MODULE MODI_FUN
 !*       0.    DECLARATIONS
 !              ------------
 !
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 USE MODD_GRID_n
 USE MODD_DIM_n
 USE MODD_PARAMETERS
@@ -193,7 +193,7 @@ END FUNCTION FUNUYZ
 USE MODD_GRID_n
 USE MODD_DIM_n
 USE MODD_PARAMETERS
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 !
 !
 IMPLICIT NONE
@@ -280,7 +280,7 @@ END FUNCTION FUNUY
 !*       0.    DECLARATIONS
 !              ------------
 !
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 USE MODD_GRID_n
 USE MODD_DIM_n
 USE MODD_PARAMETERS
@@ -376,7 +376,7 @@ END FUNCTION FUNVXZ
 !*       0.    DECLARATIONS
 !              ------------
 !
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 USE MODD_GRID_n
 USE MODD_DIM_n
 USE MODD_PARAMETERS
diff --git a/src/MNH/get_nb_procio_read_mnh.f90 b/src/MNH/get_nb_procio_read_mnh.f90
index ea9fa17af..37ee6e815 100644
--- a/src/MNH/get_nb_procio_read_mnh.f90
+++ b/src/MNH/get_nb_procio_read_mnh.f90
@@ -37,6 +37,7 @@
 !-------------------------------------------------------------------------------
 !
 USE MODE_FD_ll,        ONLY : GETFD,JPFINL,FD_ll
+USE MODE_FM,           ONLY : FMLOOK_ll
 USE MODD_IO_SURF_MNH,  ONLY : COUT, TPINFILE
 !
 IMPLICIT NONE
diff --git a/src/MNH/get_nb_procio_write_mnh.f90 b/src/MNH/get_nb_procio_write_mnh.f90
index 13df98f2d..e1c41f7b4 100644
--- a/src/MNH/get_nb_procio_write_mnh.f90
+++ b/src/MNH/get_nb_procio_write_mnh.f90
@@ -37,6 +37,7 @@
 !-------------------------------------------------------------------------------
 !
 USE MODE_FD_ll,        ONLY : GETFD,JPFINL,FD_ll
+USE MODE_FM,           ONLY : FMLOOK_ll
 USE MODD_IO_SURF_MNH,  ONLY : COUT, COUTFILE
 !
 IMPLICIT NONE
diff --git a/src/MNH/gps_zenith.f90 b/src/MNH/gps_zenith.f90
index 52f6b240c..7bfd24d9c 100644
--- a/src/MNH/gps_zenith.f90
+++ b/src/MNH/gps_zenith.f90
@@ -86,10 +86,10 @@ USE MODD_DIAG_FLAG
 USE MODD_GRID, ONLY: XLONORI,XLATORI
 USE MODD_GRID_n
 USE MODE_GRIDPROJ
+USE MODE_IO_ll
 USE MODE_ll
 !
 USE MODI_INTERPOL_STATION
-USE MODI_IO_ll
 !
 IMPLICIT NONE
 !
diff --git a/src/MNH/gps_zenith_grid.f90 b/src/MNH/gps_zenith_grid.f90
index 346ae30a7..b56c3b26c 100644
--- a/src/MNH/gps_zenith_grid.f90
+++ b/src/MNH/gps_zenith_grid.f90
@@ -88,8 +88,6 @@ USE MODD_GRID_n
 USE MODE_GRIDPROJ
 USE MODE_ll
 !
-USE MODI_IO_ll
-!
 IMPLICIT NONE
 !
 !
diff --git a/src/MNH/ini_cst.f90 b/src/MNH/ini_cst.f90
index b8f02fcb1..9434bc16f 100644
--- a/src/MNH/ini_cst.f90
+++ b/src/MNH/ini_cst.f90
@@ -42,7 +42,6 @@ END MODULE MODI_INI_CST
 !!
 !!    EXTERNAL
 !!    --------
-!!      FMLOOK : to retrieve logical unit number associated to a file
 !!
 !!    IMPLICIT ARGUMENTS
 !!    ------------------
diff --git a/src/MNH/ini_les_cart_maskn.f90 b/src/MNH/ini_les_cart_maskn.f90
index 0a4912b08..67d89717d 100644
--- a/src/MNH/ini_les_cart_maskn.f90
+++ b/src/MNH/ini_les_cart_maskn.f90
@@ -69,7 +69,7 @@ END MODULE MODI_INI_LES_CART_MASKn
 !          ------------
 !
 USE MODE_ll
-USE MODI_GATHER_ll 
+USE MODE_GATHER_ll 
 USE MODE_MODELN_HANDLER
 !
 USE MODD_CONF
diff --git a/src/MNH/ini_lesn.f90 b/src/MNH/ini_lesn.f90
index 1d839e333..371650295 100644
--- a/src/MNH/ini_lesn.f90
+++ b/src/MNH/ini_lesn.f90
@@ -40,6 +40,7 @@
 !          ------------
 !
 USE MODE_ll
+USE MODE_GATHER_ll
 USE MODE_IO_ll
 USE MODE_MSG
 USE MODE_MODELN_HANDLER
@@ -68,7 +69,6 @@ USE MODD_CONDSAMP, ONLY : LCONDSAMP
 
 USE MODI_INI_LES_CART_MASKn
 USE MODI_COEF_VER_INTERP_LIN
-USE MODI_GATHER_ll
 !
 IMPLICIT NONE
 !
diff --git a/src/MNH/ini_lima.f90 b/src/MNH/ini_lima.f90
index ba15ca10c..1a71679b9 100644
--- a/src/MNH/ini_lima.f90
+++ b/src/MNH/ini_lima.f90
@@ -48,7 +48,7 @@ USE MODD_CST
 USE MODD_REF
 USE MODD_PARAM_LIMA
 USE MODD_PARAMETERS
-USE MODD_LUNIT
+USE MODD_LUNIT, ONLY : TLUOUT0
 !
 IMPLICIT NONE
 !
@@ -80,7 +80,7 @@ INTEGER  :: IRESP   ! Return code of FM-routines
 !
 !
 ! Init output listing
-CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT0,IRESP)
+ILUOUT0 = TLUOUT0%NLU
 !
 !
 ! KSPLITR
diff --git a/src/MNH/ini_lima_warm.f90 b/src/MNH/ini_lima_warm.f90
index 613e899ff..c59a9cd74 100644
--- a/src/MNH/ini_lima_warm.f90
+++ b/src/MNH/ini_lima_warm.f90
@@ -43,7 +43,7 @@ USE MODD_REF
 USE MODD_PARAM_LIMA
 USE MODD_PARAM_LIMA_WARM
 USE MODD_PARAMETERS
-USE MODD_LUNIT
+USE MODD_LUNIT, ONLY : TLUOUT0
 !
 USE MODI_LIMA_FUNCTIONS
 USE MODI_HYPGEO
@@ -412,7 +412,7 @@ XCRER = 1.0/ (ZGAMR(6) * XAR**(2.0/3.0))
 !
 GFLAG = .TRUE.
 IF (GFLAG) THEN
-  CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT0,IRESP)
+  ILUOUT0 = TLUOUT0%NLU
   WRITE(UNIT=ILUOUT0,FMT='(" Summary of the cloud particule characteristics")')
   WRITE(UNIT=ILUOUT0,FMT='("             CLOUD")')
   WRITE(UNIT=ILUOUT0,FMT='("                   masse: A=",E13.6," B=",E13.6)') &
diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90
index bd00e1883..8abedaeac 100644
--- a/src/MNH/ini_modeln.f90
+++ b/src/MNH/ini_modeln.f90
@@ -283,6 +283,7 @@ USE MODE_IO_ll
 USE MODE_IO_MANAGE_STRUCT, ONLY : IO_FILE_ADD2LIST
 USE MODE_FM
 USE MODE_FMREAD
+USE MODE_GATHER_ll
 USE MODE_MSG
 USE MODE_TYPE_ZDIFFU
 !
@@ -351,7 +352,6 @@ USE MODD_LBC_n
 USE MODD_PASPOL_n
 !
 !
-USE MODI_GATHER_ll
 USE MODI_INI_BUDGET
 USE MODI_INI_SW_SETUP
 USE MODI_SET_GRID
diff --git a/src/MNH/ini_posprofilern.f90 b/src/MNH/ini_posprofilern.f90
index e641527c7..e79b92472 100644
--- a/src/MNH/ini_posprofilern.f90
+++ b/src/MNH/ini_posprofilern.f90
@@ -88,6 +88,7 @@ USE MODD_CONF
 USE MODD_GRID
 USE MODD_RADIATIONS_n, ONLY: NAER
 !
+USE MODE_FM, ONLY : FMLOOK_ll
 USE MODE_GRIDPROJ
 USE MODE_IO_ll
 USE MODE_ll
diff --git a/src/MNH/ini_spectren.f90 b/src/MNH/ini_spectren.f90
index 2e3fe3424..64af9982f 100644
--- a/src/MNH/ini_spectren.f90
+++ b/src/MNH/ini_spectren.f90
@@ -46,6 +46,7 @@ USE MODD_ARGSLIST_ll, ONLY : LIST_ll
 USE MODE_IO_ll
 USE MODE_FM
 USE MODE_FMREAD
+USE MODE_GATHER_ll
 USE MODE_MSG
 USE MODE_TYPE_ZDIFFU
 !
@@ -115,7 +116,6 @@ USE MODD_LBC_n
 USE MODD_PASPOL_n
 !
 !
-USE MODI_GATHER_ll
 USE MODI_SET_GRID
 USE MODI_METRICS
 USE MODI_UPDATE_METRICS
diff --git a/src/MNH/ini_surfstationn.f90 b/src/MNH/ini_surfstationn.f90
index ae8952c81..73c72cf2e 100644
--- a/src/MNH/ini_surfstationn.f90
+++ b/src/MNH/ini_surfstationn.f90
@@ -87,6 +87,7 @@ USE MODD_DYN_n
 USE MODD_CONF
 USE MODD_GRID
 !
+USE MODE_FM, ONLY : FMLOOK_ll
 USE MODE_GRIDPROJ
 USE MODE_IO_ll
 USE MODE_ll
diff --git a/src/MNH/init_aerosol_properties.f90 b/src/MNH/init_aerosol_properties.f90
index cdce0986f..52c9d68f6 100644
--- a/src/MNH/init_aerosol_properties.f90
+++ b/src/MNH/init_aerosol_properties.f90
@@ -26,7 +26,7 @@
 !              ------------
 !
 USE MODD_PARAM_n,         ONLY : CCLOUD
-USE MODD_LUNIT,           ONLY : CLUOUT0
+USE MODD_LUNIT,           ONLY : TLUOUT0
 USE MODD_PARAM_LIMA,      ONLY : LWARM, LACTI, NMOD_CCN, HINI_CCN, HTYPE_CCN,        &
                                  XR_MEAN_CCN, XLOGSIG_CCN, XRHO_CCN,                 &
                                  XKHEN_MULTI, XMUHEN_MULTI, XBETAHEN_MULTI,          &
@@ -70,7 +70,7 @@ INTEGER  :: IRESP   ! Return code of FM-routines
 !
 !-------------------------------------------------------------------------------
 !
-CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT0,IRESP)
+ILUOUT0 = TLUOUT0%NLU
 !
 !!!!!!!!!!!!!!!!
 ! CCN properties
diff --git a/src/MNH/init_for_convlfi.f90 b/src/MNH/init_for_convlfi.f90
index 73ff69a90..211f587a7 100644
--- a/src/MNH/init_for_convlfi.f90
+++ b/src/MNH/init_for_convlfi.f90
@@ -91,10 +91,10 @@ USE MODE_GRIDCART
 !
 USE MODE_FM
 USE MODE_FMREAD
+USE MODE_GATHER_ll
 USE MODE_IO_ll
 USE MODE_ll
 !
-USE MODI_GATHER_ll
 USE MODI_INI_CST
 !JUANZ
 USE MODE_SPLITTINGZ_ll
diff --git a/src/MNH/lesn.f90 b/src/MNH/lesn.f90
index 14c0a2604..793244a9e 100644
--- a/src/MNH/lesn.f90
+++ b/src/MNH/lesn.f90
@@ -62,7 +62,7 @@ USE MODD_CONF_n
 USE MODD_PARAM_n
 USE MODD_TURB_n
 USE MODD_METRICS_n
-USE MODD_LUNIT_n
+USE MODD_LUNIT_n, ONLY: TLUOUT
 USE MODD_PARAM_n, ONLY: CCLOUD
 USE MODD_PRECIP_n, ONLY: XINPRR,XACPRR,XINPRR3D,XEVAP3D,XINPRC,XINDEP
 USE MODD_NSV, ONLY : NSV, NSV_CS
@@ -227,7 +227,7 @@ IKE=IKU-JPVEXT
 IKB=1+JPVEXT
 CALL GET_DIM_EXT_ll('B',IIU,IJU)
 !
-CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+ILUOUT = TLUOUT%NLU
 !
 !-------------------------------------------------------------------------------
 !
diff --git a/src/MNH/mnh2lpdm.f90 b/src/MNH/mnh2lpdm.f90
index dd808b5dd..bfbe25bfa 100644
--- a/src/MNH/mnh2lpdm.f90
+++ b/src/MNH/mnh2lpdm.f90
@@ -23,11 +23,11 @@
 !*	0.1 Modules.
 !
 USE MODD_MNH2LPDM
-USE MODI_IO_LL
 USE MODD_CONF, ONLY : CPROGRAM
 USE MODD_IO_ll,ONLY : TPTR2FILE
 !
 USE MODE_FM
+USE MODE_IO_ll
 USE MODE_IO_MANAGE_STRUCT, ONLY: IO_FILE_ADD2LIST
 !
 USE MODI_MNH2LPDM_INI
diff --git a/src/MNH/mnh2lpdm_ech.f90 b/src/MNH/mnh2lpdm_ech.f90
index 2b0a83647..5e572edb5 100644
--- a/src/MNH/mnh2lpdm_ech.f90
+++ b/src/MNH/mnh2lpdm_ech.f90
@@ -32,8 +32,8 @@ USE MODD_MNH2LPDM
 !
 USE MODE_FM
 USE MODE_FMREAD
+USE MODE_IO_ll
 !
-USE MODI_IO_ll
 USE MODI_INI_CST
 !
 IMPLICIT NONE
diff --git a/src/MNH/mnh_surf_grid_io_init.f90 b/src/MNH/mnh_surf_grid_io_init.f90
index 21d5043ba..39f94602b 100644
--- a/src/MNH/mnh_surf_grid_io_init.f90
+++ b/src/MNH/mnh_surf_grid_io_init.f90
@@ -110,6 +110,7 @@ END MODULE MODI_MNH_SURF_GRID_IO_INIT
 !
 USE MODE_ll
 USE MODE_FM
+USE MODE_IO_ll
 USE MODD_PARAMETERS, ONLY : JPHEXT, JPVEXT, JPMODELMAX
 USE MODD_CONF,       ONLY : CPROGRAM, L1D, L2D, LPACK
 !
diff --git a/src/MNH/mnhget_luout.f90 b/src/MNH/mnhget_luout.f90
index d4cd0cdd3..6e25b0c49 100644
--- a/src/MNH/mnhget_luout.f90
+++ b/src/MNH/mnhget_luout.f90
@@ -57,6 +57,7 @@ END MODULE MODI_MNHGET_LUOUT
 !*       0.    DECLARATIONS
 !              ------------
 !
+USE MODE_FM, ONLY : FMLOOK_ll
 USE MODE_ll
 USE MODD_CONF, ONLY : CPROGRAM
 !
diff --git a/src/MNH/mode_gatherall_border_ll.f90 b/src/MNH/mode_gatherall_border_ll.f90
index b0f95d278..2fc38ac68 100644
--- a/src/MNH/mode_gatherall_border_ll.f90
+++ b/src/MNH/mode_gatherall_border_ll.f90
@@ -37,7 +37,7 @@ SUBROUTINE GATHERALL_BORDER_ll(HCODE,PA,PA_ll,KINFO_ll)
 
 USE MODD_PARAMETERS
 USE MODE_ll
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 !
 !---------------------------------------------------------------------
 !
diff --git a/src/MNH/pgd_grid_io_init_mnh.f90 b/src/MNH/pgd_grid_io_init_mnh.f90
index 7f21b8eb4..93f379cff 100644
--- a/src/MNH/pgd_grid_io_init_mnh.f90
+++ b/src/MNH/pgd_grid_io_init_mnh.f90
@@ -66,6 +66,7 @@ MODULE MODI_PGD_GRID_IO_INIT_MNH
     USE MODD_PARAMETERS, ONLY : JPHEXT, JPVEXT, JPMODELMAX
     USE MODD_CONF,       ONLY : CPROGRAM, L1D, L2D, LPACK
     !
+    USE MODE_IO_ll
     !JUANZ
     USE MODE_SPLITTINGZ_ll
     !JUANZ
diff --git a/src/MNH/prep_ideal_case.f90 b/src/MNH/prep_ideal_case.f90
index fbe3a0ac8..1c5d1045e 100644
--- a/src/MNH/prep_ideal_case.f90
+++ b/src/MNH/prep_ideal_case.f90
@@ -360,6 +360,7 @@ USE MODE_GRIDCART         ! Executive modules
 USE MODE_GRIDPROJ
 USE MODE_FM
 USE MODE_FMREAD
+USE MODE_GATHER_ll
 USE MODE_IO_ll
 USE MODE_IO_MANAGE_STRUCT, ONLY : IO_FILE_ADD2LIST
 USE MODE_ll
@@ -385,7 +386,6 @@ USE MODI_TOTAL_DMASS
 USE MODI_WGUESS
 USE MODI_CH_INIT_SCHEME_n
 USE MODI_CH_INIT_FIELD_n
-USE MODI_GATHER_ll
 USE MODI_INI_NSV
 USE MODI_READ_PRE_IDEA_NAM_n
 USE MODI_CH_AER_INIT_SOA
diff --git a/src/MNH/prep_nest_pgd.f90 b/src/MNH/prep_nest_pgd.f90
index 0a65ebd02..808bb6314 100644
--- a/src/MNH/prep_nest_pgd.f90
+++ b/src/MNH/prep_nest_pgd.f90
@@ -147,7 +147,7 @@ INTEGER, DIMENSION(JPMODELMAX) :: NXSIZE   ! number of grid points for each mode
 INTEGER, DIMENSION(JPMODELMAX) :: NYSIZE   ! in x and y-directions
                                            ! relatively to its father grid
 !
-INTEGER                        :: ILUOUT0, IRESP
+INTEGER                        :: ILUOUT0
 INTEGER                        :: IINFO_ll ! return code of // routines
 INTEGER                        :: JPGD     ! loop control
 CHARACTER(LEN=28)              :: YMY_NAME,YDAD_NAME
diff --git a/src/MNH/profilern.f90 b/src/MNH/profilern.f90
index 64ed6ad1b..a31a16dd5 100644
--- a/src/MNH/profilern.f90
+++ b/src/MNH/profilern.f90
@@ -112,6 +112,7 @@ USE MODD_DIAG_IN_RUN
 USE MODD_CONF
 USE MODD_NSV
 !
+USE MODE_FM, ONLY : FMLOOK_ll
 USE MODE_ll
 !
 USE MODI_WATER_SUM
diff --git a/src/MNH/read_all_data_grib_case.f90 b/src/MNH/read_all_data_grib_case.f90
index 7aec59f93..71d7cee6a 100644
--- a/src/MNH/read_all_data_grib_case.f90
+++ b/src/MNH/read_all_data_grib_case.f90
@@ -69,8 +69,6 @@ END MODULE MODI_READ_ALL_DATA_GRIB_CASE
 !!    subroutine HORIBL            : horizontal bilinear interpolation
 !!    subroutine XYTOLATLON        : projection from conformal to lat,lon
 !!
-!!    function   FMLOOK_ll         : to retrieve the logical unit associated with a file
-!!
 !!    Module     MODI_SET_SUBDOMAIN     : interface for subroutine SET_SUBDOMAIN
 !!    Module     MODI_READ_VER_GRID     : interface for subroutine READ_VER_GRID
 !!    Module     MODI_HORIBL            : interface for subroutine HORIBL
diff --git a/src/MNH/read_prc_fmfile.f90 b/src/MNH/read_prc_fmfile.f90
index 169e13ca0..363d61fcb 100644
--- a/src/MNH/read_prc_fmfile.f90
+++ b/src/MNH/read_prc_fmfile.f90
@@ -42,8 +42,6 @@ END MODULE MODI_READ_PRC_FMFILE
 !!
 !!    EXTERNAL
 !!    --------
-!!      FMREAD   : to read data in LFIFM file
-!!      FMLOOK   : to retrieve the logical unit of a file
 !!       
 !!    IMPLICIT ARGUMENTS
 !!    ------------------ 
diff --git a/src/MNH/resolved_elecn.f90 b/src/MNH/resolved_elecn.f90
index 8baf1d61e..f1bebd4ba 100644
--- a/src/MNH/resolved_elecn.f90
+++ b/src/MNH/resolved_elecn.f90
@@ -176,6 +176,7 @@ END MODULE MODI_RESOLVED_ELEC_n
 USE MODE_ll
 USE MODE_FM
 USE MODE_ELEC_ll
+USE MODE_IO_ll, ONLY : CLOSE_ll, OPEN_ll
 !
 USE MODD_METRICS_n, ONLY : XDXX, XDYY, XDZX, XDZY, XDZZ 
 USE MODD_FIELD_n, ONLY : XRSVS
@@ -194,7 +195,6 @@ USE MODD_TIME_n
 USE MODD_LMA_SIMULATOR
 USE MODD_PRINT_ELEC
 !
-USE MODI_IO_ll
 USE MODD_VAR_ll, ONLY : NMNH_COMM_WORLD
 USE MODI_RAIN_ICE_ELEC
 USE MODI_ICE_ADJUST_ELEC
diff --git a/src/MNH/set_geosbal.f90 b/src/MNH/set_geosbal.f90
index 48280d0dc..3a940d163 100644
--- a/src/MNH/set_geosbal.f90
+++ b/src/MNH/set_geosbal.f90
@@ -258,6 +258,7 @@ END MODULE MODI_SET_GEOSBAL
 !              ------------
 !
 USE MODE_FM
+USE MODE_GATHER_ll
 USE MODE_ll
 !
 USE MODD_PARAMETERS  ! declarative modules
@@ -272,7 +273,6 @@ USE MODD_FIELD_n
 USE MODD_REF
 !
 USE MODI_SHUMAN
-USE MODI_GATHER_ll
 !
 IMPLICIT NONE
 !
diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90
index ff16adde4..7a6ff658a 100644
--- a/src/MNH/set_grid.f90
+++ b/src/MNH/set_grid.f90
@@ -248,11 +248,11 @@ USE MODD_BUDGET
 USE MODD_DYN
 USE MODD_NESTING
 !
+USE MODE_GATHER_ll
 USE MODE_GRIDCART
 USE MODE_GRIDPROJ
 USE MODE_TIME
 USE MODE_ll
-USE MODI_GATHER_ll  !!!! a mettre dans mode_ll
 !
 USE MODE_FIELD, ONLY : TFIELDDATA,TFIELDLIST,FIND_FIELD_ID_FROM_MNHNAME
 USE MODE_FMREAD
diff --git a/src/MNH/set_mass.f90 b/src/MNH/set_mass.f90
index 9d4873001..70b884026 100644
--- a/src/MNH/set_mass.f90
+++ b/src/MNH/set_mass.f90
@@ -132,12 +132,12 @@ USE MODD_REF
 USE MODD_PARAMETERS
 USE MODD_DIM_n
 !
+USE MODE_GATHER_ll
 USE MODE_ll
 !
 USE MODI_VER_INT_THERMO ! interface modules
 USE MODI_WATER_SUM
 USE MODI_SET_REFZ
-USE MODI_GATHER_ll
 USE MODI_FUN
 USE MODI_VER_INT_DYN
 USE MODI_SHUMAN
diff --git a/src/MNH/set_msk.f90 b/src/MNH/set_msk.f90
index acc8752bb..001b22ab5 100644
--- a/src/MNH/set_msk.f90
+++ b/src/MNH/set_msk.f90
@@ -85,7 +85,7 @@ USE MODD_CST  , ONLY : XRHOLW
 USE MODD_PARAMETERS
 USE MODD_CONF
 USE MODE_ll
-USE MODD_LUNIT
+USE MODD_LUNIT, ONLY : TLUOUT0
 USE MODD_ARGSLIST_ll, ONLY : LIST_ll
 !
 !
@@ -125,7 +125,7 @@ INTEGER :: IBUIL,IBUJL,IBUIH,IBUJH
 !TYPE(LIST_ll), POINTER :: TZFIELDS_ll    ! list of fields to exchange
 !-------------------------------------------------------------------------------
 !
-CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT0,IRESP)
+ILUOUT0 = TLUOUT0%NLU
 !
 !*       1.    COMPUTES THE PHYSICAL SUBDOMAIN BOUNDS
 !              ---------------------------------------
diff --git a/src/MNH/set_perturb.f90 b/src/MNH/set_perturb.f90
index 0437f0817..5e08a8b86 100644
--- a/src/MNH/set_perturb.f90
+++ b/src/MNH/set_perturb.f90
@@ -113,7 +113,7 @@ USE MODD_LUNIT_n
 USE MODE_POS
 USE MODE_FM
 USE MODE_ll
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 USE MODI_SCATTER
 USE MODE_REPRO_SUM
 USE MODI_GET_HALO
diff --git a/src/MNH/spawn_field2.f90 b/src/MNH/spawn_field2.f90
index efbac78f8..db5deb4ea 100644
--- a/src/MNH/spawn_field2.f90
+++ b/src/MNH/spawn_field2.f90
@@ -168,7 +168,7 @@ USE MODD_IO_ll,           ONLY : TFILEDATA
 USE MODD_LATZ_EDFLX
 USE MODD_LBC_n,           ONLY:  LBC_MODEL
 USE MODD_LG,              ONLY: CLGNAMES
-USE MODD_LUNIT_n,         ONLY:  CLUOUT,LUNIT_MODEL
+USE MODD_LUNIT_n,         ONLY:  LUNIT_MODEL,TLUOUT
 USE MODD_NSV
 USE MODD_REF_n,           ONLY:  REF_MODEL
 USE MODD_PARAMETERS
@@ -279,7 +279,7 @@ CALL GO_TOMODEL_ll(2, IINFO_ll)
 !
 !*       1.0  recovers logical unit number of output listing
 !
-CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP)
+ILUOUT = TLUOUT%NLU
 !
 !*       1.1   Secondary variables
 !
diff --git a/src/MNH/spawn_zs.f90 b/src/MNH/spawn_zs.f90
index 83bcadd43..efce8381d 100644
--- a/src/MNH/spawn_zs.f90
+++ b/src/MNH/spawn_zs.f90
@@ -118,6 +118,7 @@ USE MODI_ZS_BOUNDARY
 !
 USE MODE_MODELN_HANDLER
 !
+USE MODE_FM
 USE MODE_MPPDB
 USE MODD_VAR_ll
 USE MODE_ll
diff --git a/src/MNH/spec_ver_int.f90 b/src/MNH/spec_ver_int.f90
index 3adeba417..7f9a2860d 100644
--- a/src/MNH/spec_ver_int.f90
+++ b/src/MNH/spec_ver_int.f90
@@ -64,7 +64,7 @@ USE MODD_LES
 USE MODD_PARAMETERS
 !
 USE MODE_ll
-USE MODI_GATHER_ll
+USE MODE_GATHER_ll
 USE MODI_VER_INTERP_LIN
 !
 IMPLICIT NONE
diff --git a/src/MNH/spectre_arome.f90 b/src/MNH/spectre_arome.f90
index e86983a95..61846877d 100644
--- a/src/MNH/spectre_arome.f90
+++ b/src/MNH/spectre_arome.f90
@@ -25,6 +25,7 @@ SUBROUTINE SPECTRE_AROME(HINIFILE,HOUTFILE,PDELTAX,PDELTAY,KI,KJ,KK)
 !     
 !
 USE MODD_CONF
+USE MODE_FM
 USE MODE_IO_ll
 USE MODD_SPECTRE
 USE MODI_COMPUTE_SPECTRE
diff --git a/src/MNH/stationn.f90 b/src/MNH/stationn.f90
index 52f102c51..9c2ee8fca 100644
--- a/src/MNH/stationn.f90
+++ b/src/MNH/stationn.f90
@@ -106,6 +106,7 @@ USE MODD_GRID
 USE MODD_TIME
 USE MODD_CONF
 !
+USE MODE_FM
 USE MODE_ll
 !
 USE MODI_WATER_SUM
diff --git a/src/MNH/write_hgrid.f90 b/src/MNH/write_hgrid.f90
index 203fb136e..27ae4046d 100644
--- a/src/MNH/write_hgrid.f90
+++ b/src/MNH/write_hgrid.f90
@@ -82,8 +82,6 @@ TYPE(TFILEDATA), INTENT(IN)  :: TPFILE    ! File to write
 !
 !*       0.2   declarations of local variables
 !
-INTEGER               :: IRESP
-!
 !-------------------------------------------------------------------------------
 !
 !*       1.     TEST ON MODEL INDEX
diff --git a/src/MNH/write_lbn.f90 b/src/MNH/write_lbn.f90
index f5d838517..1c04daf08 100644
--- a/src/MNH/write_lbn.f90
+++ b/src/MNH/write_lbn.f90
@@ -133,7 +133,6 @@ TYPE(TFILEDATA),   INTENT(IN) :: TPFILE ! File characteristics
 !*       0.2   Declarations of local variables
 !
 INTEGER            :: ILUOUT        ! logical unit
-INTEGER            :: IRESP         ! IRESP  : return-code for fmwrit
 !
 INTEGER            :: IRR           ! Index for moist variables
 INTEGER            :: JRR,JSV       ! loop index for moist and scalar variables
diff --git a/src/MNH/write_lfifm1_for_diag.f90 b/src/MNH/write_lfifm1_for_diag.f90
index d9c6cdc08..acd050bda 100644
--- a/src/MNH/write_lfifm1_for_diag.f90
+++ b/src/MNH/write_lfifm1_for_diag.f90
@@ -226,11 +226,11 @@ USE MODI_UV_TO_ZONAL_AND_MERID
 USE MODI_CALCSOUND
 USE MODI_FREE_ATM_PROFILE
 USE MODI_GPS_ZENITH
-USE MODI_GATHER_ll
 !
 USE MODE_GRIDPROJ
 USE MODE_FIELD
 USE MODE_FMWRIT
+USE MODE_GATHER_ll
 USE MODE_ll
 USE MODE_IO_ll
 USE MODE_THERMO
diff --git a/src/MNH/write_lfifmn_fordiachron.f90 b/src/MNH/write_lfifmn_fordiachron.f90
index 8a7647d2c..b40493e3f 100644
--- a/src/MNH/write_lfifmn_fordiachron.f90
+++ b/src/MNH/write_lfifmn_fordiachron.f90
@@ -105,9 +105,9 @@ USE MODD_IO_ll, ONLY: TFILEDATA
 !
 USE MODE_FIELD, ONLY: TFIELDDATA, TYPEREAL
 USE MODE_FMWRIT
+USE MODE_GATHER_ll
 USE MODE_GRIDPROJ
 USE MODE_ll
-USE MODI_GATHER_ll
 !
 IMPLICIT NONE
 !
diff --git a/src/MNH/write_lfin.f90 b/src/MNH/write_lfin.f90
index 24ad092b5..edea3ee06 100644
--- a/src/MNH/write_lfin.f90
+++ b/src/MNH/write_lfin.f90
@@ -241,10 +241,10 @@ USE MODE_ll
 USE MODD_IO_ll, ONLY: TFILEDATA
 USE MODE_IO_ll, ONLY: UPCASE,CLOSE_ll
 USE MODE_FIELD
+USE MODE_GATHER_ll
 USE MODE_GRIDPROJ
 USE MODE_MODELN_HANDLER
 !
-USE MODI_GATHER_ll
 USE MODI_WRITE_LB_n
 USE MODI_WRITE_BALLOON_n
 USE MODI_DUSTLFI_n
diff --git a/src/MNH/write_seriesn.f90 b/src/MNH/write_seriesn.f90
index 0ae22bb9c..a8bafff88 100644
--- a/src/MNH/write_seriesn.f90
+++ b/src/MNH/write_seriesn.f90
@@ -76,11 +76,11 @@ USE MODD_PARAMETERS
 USE MODD_SERIES
 USE MODD_SERIES_n
 !
+USE MODE_GATHER_ll
 USE MODE_IO_ll
 USE MODE_ll
 USE MODE_MSG
 !
-USE MODI_GATHER_ll
 USE MODI_WRITE_DIACHRO
 !
 IMPLICIT NONE
-- 
GitLab