Index: /CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA1_cfg
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA1_cfg	(revision 4865)
+++ /CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA1_cfg	(revision 4866)
@@ -52,5 +52,7 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
-    nn_closea    =   1      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   nn_closea    =   1                  !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
+   ln_clodyn    =  .false.             !  
+   !
    !
    jphgr_msh   =       0               !  type of horizontal mesh
Index: NFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/closea.F90
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/closea.F90	(revision 4865)
+++ 	(revision )
@@ -1,531 +1,0 @@
-MODULE closea
-   !!======================================================================
-   !!                       ***  MODULE  closea  ***
-   !! Closed Seas  : specific treatments associated with closed seas
-   !!======================================================================
-   !! History :   8.2  !  00-05  (O. Marti)  Original code
-   !!             8.5  !  02-06  (E. Durand, G. Madec)  F90
-   !!             9.0  !  06-07  (G. Madec)  add clo_rnf, clo_ups, clo_bat
-   !!        NEMO 3.4  !  03-12  (P.G. Fogli) sbc_clo bug fix & mpp reproducibility
-   !!
-   !! 2016 : new closed seas for use in IPSLCM6 coupled model (O. Marti)
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dom_clo    : modification of the ocean domain for closed seas cases
-   !!   sbc_clo    : Special handling of closed seas
-   !!   clo_rnf    : set close sea outflows as river mouths (see sbcrnf)
-   !!   clo_ups    : set mixed centered/upstream scheme in closed sea (see traadv_cen2)
-   !!   clo_bat    : set to zero a field over closed sea (see domzrg)
-   !!----------------------------------------------------------------------
-   USE oce             ! dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   !USE iom             ! I/O manager library
-   USE sbc_oce         ! ocean surface boundary conditions
-   USE lib_fortran,    ONLY: glob_sum, DDPDD
-   USE lbclnk          ! lateral boundary condition - MPP exchanges
-   USE lib_mpp         ! MPP library
-   USE timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC dom_clo      ! routine called by domain module
-   PUBLIC sbc_clo      ! routine called by step module
-   PUBLIC clo_rnf      ! routine called by sbcrnf module
-   PUBLIC clo_ups      ! routine called in traadv_cen2(_jki) module
-   PUBLIC clo_bat      ! routine called in domzgr module
-
-   INTEGER, PUBLIC, PARAMETER          ::   jpncs   = 7      !: number of closed sea
-   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncstt            !: Type of closed sea
-   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsi1, ncsj1     !: south-west closed sea limits (i,j)
-   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsi2, ncsj2     !: north-east closed sea limits (i,j)
-   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsnr            !: number of point where run-off pours
-   INTEGER, PUBLIC, DIMENSION(jpncs,4) ::   ncsir, ncsjr     !: Location of runoff
-
-   REAL(wp), DIMENSION (:,:), ALLOCATABLE :: clo_mask        !: Defines area where excess run-off is distributed
-
-   REAL(wp), DIMENSION (jpncs+1)       ::   surf             !: Closed sea surface
-
-   INTEGER :: dia_closea_alloc
-
-   !! * Substitutions
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: closea.F90 4162 2013-11-07 10:19:49Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE dom_clo
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dom_clo  ***
-      !!        
-      !! ** Purpose :   Closed sea domain initialization
-      !!
-      !! ** Method  :   if a closed sea is located only in a model grid point
-      !!                just the thermodynamic processes are applied.
-      !!
-      !! ** Action  :   ncsi1(), ncsj1() : south-west closed sea limits (i,j)
-      !!                ncsi2(), ncsj2() : north-east Closed sea limits (i,j)
-      !!                ncsir(), ncsjr() : Location of runoff
-      !!                ncsnr            : number of point where run-off pours
-      !!                ncstt            : Type of closed sea
-      !!                                   =0 spread over the world ocean
-      !!                                   =2 put at location runoff
-      !!----------------------------------------------------------------------
-      INTEGER ::   jc               ! dummy loop indices
-      REAL(wp)::   ztmp
-      INTEGER ::   isrow
-      !!----------------------------------------------------------------------
-      
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*)'dom_clo : closed seas '
-      IF(lwp) WRITE(numout,*)'~~~~~~~'
-
-      ! Initial values
-      ncsnr(:) = 1  ;  ncsi1(:) = 1  ;  ncsi2(:) = 1  ;  ncsir(:,:) = 1
-      ncstt(:) = 0  ;  ncsj1(:) = 1  ;  ncsj2(:) = 1  ;  ncsjr(:,:) = 1
-
-      ! set the closed seas (in data domain indices)
-      ! -------------------
-
-      IF( cp_cfg == "orca" ) THEN
-         !
-         SELECT CASE ( jp_cfg )
-         !                                           ! =======================
-         CASE ( 1 )                                  ! ORCA_R1 configuration
-            !
-            !! This dirty section will be suppressed by simplification process: all this will come back in input files.
-            !! Currently these hard-wired indices relate to NEMO v3.6 and later. In this version, the grid has been extended southwards
-            !! for use with the under ice-shelf options (isf). The grid resolution is 362x332.
-            !! The pre v3.6 (362x292) domain can still be used optionally if the isf code is not activated. An adjustment (isrow)
-            !! is made to the hard-wired indices if the reduced domain is used.
-            
-            !! =======================
-            IF         ( jpjglo == 332 ) THEN  !  eORCA1 R1 - Using full isfÂ­extended domain.
-               isrow =  0
-            ELSEIF     ( jpjglo == 292 ) THEN  !  ORCA1 R1 Â­ Using pre-v3.6 files or adjusted start row from isf-extended grid
-               isrow = 40                      !    - Adjust jÂ­indices to account for less southerly starting latitude
-            ENDIF
-            
-            ncsnr(1)   = 1    ; ncstt(1)   = 0              ! Caspian Sea
-            ncsi1(1)   = 333  ; ncsj1(1)   = 243 - isrow      ! spread over the globe
-            ncsi2(1)   = 342  ; ncsj2(1)   = 274 - isrow
-            ncsir(1,1) = 1    ; ncsjr(1,1) = 1
-            !
-            ncsnr(2)   = 4    ; ncstt(2)   = 2              ! Lake Superior
-            ncsi1(2)   = 198  ; ncsj1(2)   = 258 - isrow      ! put at St Laurent mouth
-            ncsi2(2)   = 204  ; ncsj2(2)   = 262 - isrow
-            ncsir(2,1) = 225  ; ncsjr(2,1) = 220 - isrow
-            ncsir(2,2) = 225  ; ncsjr(2,2) = 221 - isrow
-            ncsir(2,3) = 226  ; ncsjr(2,3) = 220 - isrow
-            ncsir(2,4) = 226  ; ncsjr(2,4) = 221 - isrow
-            !
-            ncsnr(3)   = 4    ; ncstt(3)   = 2              ! Lake Michigan
-            ncsi1(3)   = 201  ; ncsj1(3)   = 250 - isrow      ! put at St Laurent mouth
-            ncsi2(3)   = 203  ; ncsj2(3)   = 256 - isrow
-            ncsir(3,1) = 225  ; ncsjr(3,1) = 220 - isrow
-            ncsir(3,2) = 225  ; ncsjr(3,2) = 221 - isrow
-            ncsir(3,3) = 226  ; ncsjr(3,3) = 220 - isrow
-            ncsir(3,4) = 226  ; ncsjr(3,4) = 221 - isrow
-            !
-            ncsnr(4)   = 4    ; ncstt(4)   = 2             ! Lake Huron
-            ncsi1(4)   = 204  ; ncsj1(4)   = 252 - isrow      ! put at St Laurent mouth
-            ncsi2(4)   = 209  ; ncsj2(4)   = 256 - isrow
-            ncsir(4,1) = 225  ; ncsjr(4,1) = 220 - isrow
-            ncsir(4,2) = 225  ; ncsjr(4,2) = 221 - isrow
-            ncsir(4,3) = 226  ; ncsjr(4,3) = 220 - isrow
-            ncsir(4,4) = 226  ; ncsjr(4,4) = 221 - isrow
-            !
-            ncsnr(5)   = 4    ; ncstt(5)   = 2              ! Lake Erie
-            ncsi1(5)   = 206  ; ncsj1(5)   = 249 - isrow      ! put at St Laurent mouth
-            ncsi2(5)   = 209  ; ncsj2(5)   = 251 - isrow
-            ncsir(5,1) = 225  ; ncsjr(5,1) = 220 - isrow
-            ncsir(5,2) = 225  ; ncsjr(5,2) = 221 - isrow
-            ncsir(5,3) = 226  ; ncsjr(5,3) = 220 - isrow
-            ncsir(5,4) = 226  ; ncsjr(5,4) = 221 - isrow
-            !
-            ncsnr(6)   = 4    ; ncstt(6)   = 2              ! Lake Ontario
-            ncsi1(6)   = 210  ; ncsj1(6)   = 252 - isrow      ! put at St Laurent mouth
-            ncsi2(6)   = 212  ; ncsj2(6)   = 252 - isrow
-            ncsir(6,1) = 225  ; ncsjr(6,1) = 220 - isrow
-            ncsir(6,2) = 225  ; ncsjr(6,2) = 221 - isrow
-            ncsir(6,3) = 226  ; ncsjr(6,3) = 220 - isrow
-            ncsir(6,4) = 226  ; ncsjr(6,4) = 221 - isrow
-            !
-            ncsnr(7)   = 1    ; ncstt(7)   = 0             ! Victoria Lake
-            ncsi1(7)   = 321  ; ncsj1(7)   = 180 - isrow     ! spread over the globe
-            ncsi2(7)   = 322  ; ncsj2(7)   = 189 - isrow
-            ncsir(7,1) = 1    ; ncsjr(7,1) = 1
-            
-            !                                        
-            !                                        ! =======================
-         CASE ( 2 )                                  !  ORCA_R2 configuration
-            !                                        ! =======================
-            !                                            ! Caspian Sea
-            ncsnr(1)   =   1  ;  ncstt(1)   =   0           ! spread over the globe
-            ncsi1(1)   =  11  ;  ncsj1(1)   = 103
-            ncsi2(1)   =  17  ;  ncsj2(1)   = 112
-            ncsir(1,1) =   1  ;  ncsjr(1,1) =   1 
-            !                                            ! Great North American Lakes
-            ncsnr(2)   =   1  ;  ncstt(2)   =   2           ! put at St Laurent mouth
-            ncsi1(2)   =  97  ;  ncsj1(2)   = 107
-            ncsi2(2)   = 103  ;  ncsj2(2)   = 111
-            ncsir(2,1) = 110  ;  ncsjr(2,1) = 111           
-            !                                            ! Black Sea (crossed by the cyclic boundary condition)
-            ncsnr(3:4) =   4  ;  ncstt(3:4) =   2           ! put in Med Sea (north of Aegean Sea)
-            ncsir(3:4,1) = 171;  ncsjr(3:4,1) = 106         !
-            ncsir(3:4,2) = 170;  ncsjr(3:4,2) = 106 
-            ncsir(3:4,3) = 171;  ncsjr(3:4,3) = 105 
-            ncsir(3:4,4) = 170;  ncsjr(3:4,4) = 105 
-            ncsi1(3)   = 174  ;  ncsj1(3)   = 107           ! 1 : west part of the Black Sea      
-            ncsi2(3)   = 181  ;  ncsj2(3)   = 112           !            (ie west of the cyclic b.c.)
-            ncsi1(4)   =   2  ;  ncsj1(4)   = 107           ! 2 : east part of the Black Sea 
-            ncsi2(4)   =   6  ;  ncsj2(4)   = 112           !           (ie east of the cyclic b.c.)
-             
-          
-
-            !                                        ! =======================
-         CASE ( 4 )                                  !  ORCA_R4 configuration
-            !                                        ! =======================
-            !                                            ! Caspian Sea
-            ncsnr(1)   =  1  ;  ncstt(1)   =  0  
-            ncsi1(1)   =  4  ;  ncsj1(1)   = 53 
-            ncsi2(1)   =  4  ;  ncsj2(1)   = 56
-            ncsir(1,1) =  1  ;  ncsjr(1,1) =  1
-            !                                            ! Great North American Lakes
-            ncsnr(2)   =  1  ;  ncstt(2)   =  2 
-            ncsi1(2)   = 49  ;  ncsj1(2)   = 55
-            ncsi2(2)   = 51  ;  ncsj2(2)   = 56
-            ncsir(2,1) = 57  ;  ncsjr(2,1) = 55
-            !                                            ! Black Sea
-            ncsnr(3)   =  4  ;  ncstt(3)   =  2  
-            ncsi1(3)   = 88  ;  ncsj1(3)   = 55 
-            ncsi2(3)   = 91  ;  ncsj2(3)   = 56
-            ncsir(3,1) = 86  ;  ncsjr(3,1) = 53
-            ncsir(3,2) = 87  ;  ncsjr(3,2) = 53 
-            ncsir(3,3) = 86  ;  ncsjr(3,3) = 52 
-            ncsir(3,4) = 87  ;  ncsjr(3,4) = 52
-            !                                            ! Baltic Sea
-            ncsnr(4)   =  1  ;  ncstt(4)   =  2
-            ncsi1(4)   = 75  ;  ncsj1(4)   = 59
-            ncsi2(4)   = 76  ;  ncsj2(4)   = 61
-            ncsir(4,1) = 84  ;  ncsjr(4,1) = 59 
-            !                                        ! =======================
-         CASE ( 025 )                                ! ORCA_R025 configuration
-            !                                        ! =======================
-            ncsnr(1)   = 1    ; ncstt(1)   = 0               ! Caspian + Aral sea
-            ncsi1(1)   = 1330 ; ncsj1(1)   = 645
-            ncsi2(1)   = 1400 ; ncsj2(1)   = 795
-            ncsir(1,1) = 1    ; ncsjr(1,1) = 1
-            !                                        
-            ncsnr(2)   = 1    ; ncstt(2)   = 0               ! Azov Sea 
-            ncsi1(2)   = 1284 ; ncsj1(2)   = 722
-            ncsi2(2)   = 1304 ; ncsj2(2)   = 747
-            ncsir(2,1) = 1    ; ncsjr(2,1) = 1
-            !
-         END SELECT
-         !
-      ENDIF
-
-      ! convert the position in local domain indices
-      ! --------------------------------------------
-      DO jc = 1, jpncs
-         ncsi1(jc)   = mi0( ncsi1(jc) )
-         ncsj1(jc)   = mj0( ncsj1(jc) )
-
-         ncsi2(jc)   = mi1( ncsi2(jc) )   
-         ncsj2(jc)   = mj1( ncsj2(jc) )  
-      END DO
-
-      !
-   END SUBROUTINE dom_clo
-
-
-   SUBROUTINE sbc_clo( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_clo  ***
-      !!                    
-      !! ** Purpose :   Special handling of closed seas
-      !!
-      !! ** Method  :   Water flux is forced to zero over closed sea
-      !!      Excess is shared between remaining ocean, or
-      !!      put as run-off in open ocean.
-      !!
-      !! ** Action  :   emp updated surface freshwater fluxes and associated heat content at kt
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean model time step
-      !
-      INTEGER             ::   ji, jj, jc, jn   ! dummy loop indices
-      REAL(wp), PARAMETER ::   rsmall = 1.e-20_wp    ! Closed sea correction epsilon
-      REAL(wp)            ::   zze2, ztmp, zcorr     ! 
-      REAL(wp)            ::   zcoef, zcoef1         ! 
-      COMPLEX(wp)         ::   ctmp 
-      REAL(wp), DIMENSION(jpncs) ::   zfwf   ! 1D workspace
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_clo')
-      !                                                   !------------------!
-      IF( kt == nit000 ) THEN                             !  Initialisation  !
-         !                                                !------------------!
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*)'sbc_clo : closed seas '
-         IF(lwp) WRITE(numout,*)'~~~~~~~'
-         !
-         ! Mask
-         ! --------------------------------------------
-         ALLOCATE ( clo_mask (jpi, jpj), STAT=dia_closea_alloc)
-         IF(dia_closea_alloc /= 0)   CALL ctl_warn('dia_closea_alloc: failed to allocate arrays.')
-         
-         clo_mask (:,:) = tmask (:,:,1)
-         
-         ! Latitude limits
-         WHERE ( gphit (:,:) .GT.  30.0_wp ) clo_mask (:,:) = 0.0_wp
-         WHERE ( gphit (:,:) .LT. -30.0_wp ) clo_mask (:,:) = 0.0_wp
-         !
-         ! Remove closed seas from mask
-         DO jc = 1, jpncs
-            DO jj = ncsj1(jc), ncsj2(jc)
-               DO ji = ncsi1(jc), ncsi2(jc)
-                  clo_mask (ji, jj) = 0.0_wp
-               END DO
-            END DO
-         END DO
-         
-         IF( lk_mpp ) CALL lbc_lnk ( clo_mask, 'T', 1._wp)
-      
-         !
-         surf(:) = 0.e0_wp
-         !
-         surf(jpncs+1) = glob_sum( e1e2t(:,:) * clo_mask (:,:) )   ! surface of the ocean where excess run-off goes
-         !
-         !                                        ! surface of closed seas 
-         IF( lk_mpp_rep ) THEN                         ! MPP reproductible calculation
-            DO jc = 1, jpncs
-               ctmp = CMPLX( 0.e0, 0.e0, wp )
-               DO jj = ncsj1(jc), ncsj2(jc)
-                  DO ji = ncsi1(jc), ncsi2(jc)
-                     ztmp = e1e2t(ji,jj) * tmask_i(ji,jj)
-                     CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-                  END DO 
-               END DO 
-               IF( lk_mpp )   CALL mpp_sum( ctmp )
-               surf(jc) = REAL(ctmp,wp)
-            END DO
-         ELSE                                          ! Standard calculation           
-            DO jc = 1, jpncs
-               DO jj = ncsj1(jc), ncsj2(jc)
-                  DO ji = ncsi1(jc), ncsi2(jc)
-                     surf(jc) = surf(jc) + e1e2t(ji,jj) * tmask_i(ji,jj)      ! surface of closed seas
-                  END DO 
-               END DO 
-            END DO 
-            IF( lk_mpp )   CALL mpp_sum ( surf, jpncs )       ! mpp: sum over all the global domain
-         ENDIF
-
-         IF(lwp) WRITE(numout,*)'     Closed sea surfaces'
-         DO jc = 1, jpncs
-            IF(lwp)WRITE(numout,FMT='(1I3,4I4,5X,F16.2)') jc, ncsi1(jc), ncsi2(jc), ncsj1(jc), ncsj2(jc), surf(jc)
-         END DO
-
-         IF(lwp) WRITE(numout,*)'     Surface for redistribution in closea ', surf(jpncs+1)
-         
-         !
-      ENDIF
-      !
-      !                                                   !--------------------!
-      !                                                   !  update emp        !
-      zfwf = 0.e0_wp                                      !--------------------!
-      IF( lk_mpp_rep ) THEN                         ! MPP reproductible calculation
-         DO jc = 1, jpncs
-            ctmp = CMPLX( 0.e0, 0.e0, wp )
-            DO jj = ncsj1(jc), ncsj2(jc)
-               DO ji = ncsi1(jc), ncsi2(jc)
-                  ztmp = e1e2t(ji,jj) * ( emp(ji,jj)-rnf(ji,jj) ) * tmask_i(ji,jj)
-                  CALL DDPDD( CMPLX( ztmp, 0.e0, wp ), ctmp )
-               END DO  
-            END DO 
-            IF( lk_mpp )   CALL mpp_sum( ctmp )
-            zfwf(jc) = REAL(ctmp,wp)
-         END DO
-      ELSE                                          ! Standard calculation           
-         DO jc = 1, jpncs
-            DO jj = ncsj1(jc), ncsj2(jc)
-               DO ji = ncsi1(jc), ncsi2(jc)
-                  zfwf(jc) = zfwf(jc) + e1e2t(ji,jj) * ( emp(ji,jj)-rnf(ji,jj) ) * tmask_i(ji,jj) 
-               END DO  
-            END DO 
-         END DO
-         IF( lk_mpp )   CALL mpp_sum ( zfwf(:) , jpncs )       ! mpp: sum over all the global domain
-      ENDIF
-
-      IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN      ! Black Sea case for ORCA_R2 configuration
-         zze2    = ( zfwf(3) + zfwf(4) ) * 0.5_wp
-         zfwf(3) = zze2
-         zfwf(4) = zze2
-      ENDIF
-
-      zcorr = 0._wp
-
-      DO jc = 1, jpncs
-         !
-         ! The following if avoids the redistribution of the round off
-         IF ( ABS(zfwf(jc) / surf(jpncs+1) ) > rsmall) THEN
-            !
-            IF( ncstt(jc) == 0 ) THEN           ! water/evap excess is shared by all open ocean
-               zcoef    = zfwf(jc) / surf(jpncs+1)
-               zcoef1   = rcp * zcoef
-               emp(:,:) = emp(:,:) + zcoef  * clo_mask (:,:) 
-               qns(:,:) = qns(:,:) - zcoef1 * sst_m(:,:) * clo_mask (:,:)
-               !
-            ELSEIF( ncstt(jc) == 1 ) THEN       ! Excess water in open sea, at outflow location, excess evap shared
-               IF ( zfwf(jc) <= 0.e0_wp ) THEN 
-                   DO jn = 1, ncsnr(jc)
-                     ji = mi0(ncsir(jc,jn))
-                     jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
-                     IF (      ji > 1 .AND. ji < jpi   &
-                         .AND. jj > 1 .AND. jj < jpj ) THEN 
-                         zcoef      = zfwf(jc) / ( REAL(ncsnr(jc)) * e1e2t(ji,jj) )
-                         zcoef1     = rcp * zcoef
-                         emp(ji,jj) = emp(ji,jj) + zcoef 
-                         qns(ji,jj) = qns(ji,jj) - zcoef1 * sst_m(ji,jj)
-                     ENDIF 
-                   END DO 
-               ELSE 
-                   zcoef    = zfwf(jc) / surf(jpncs+1)
-                   zcoef1   = rcp * zcoef
-                   emp(:,:) = emp(:,:) + zcoef  * clo_mask (:,:)
-                   qns(:,:) = qns(:,:) - zcoef1 * sst_m(:,:) * clo_mask (:,:)
-               ENDIF
-            ELSEIF( ncstt(jc) == 2 ) THEN       ! Excess e-p-r (either sign) goes to open ocean, at outflow location
-               DO jn = 1, ncsnr(jc)
-                  ji = mi0(ncsir(jc,jn))
-                  jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
-                  IF(      ji > 1 .AND. ji < jpi    &
-                     .AND. jj > 1 .AND. jj < jpj ) THEN 
-                     zcoef      = zfwf(jc) / ( REAL(ncsnr(jc)) *  e1e2t(ji,jj) )
-                     zcoef1     = rcp * zcoef
-                     emp(ji,jj) = emp(ji,jj) + zcoef
-                     qns(ji,jj) = qns(ji,jj) - zcoef1 * sst_m(ji,jj)
-                  ENDIF 
-               END DO 
-            ENDIF 
-            !
-            DO jj = ncsj1(jc), ncsj2(jc)
-               DO ji = ncsi1(jc), ncsi2(jc)
-                  zcoef      = zfwf(jc) / surf(jc)
-                  zcoef1     = rcp * zcoef
-                  emp(ji,jj) = emp(ji,jj) - zcoef
-                  qns(ji,jj) = qns(ji,jj) + zcoef1 * sst_m(ji,jj)
-               END DO  
-            END DO 
-            !
-         END IF
-      END DO 
-
-      emp (:,:) = emp (:,:) * tmask(:,:,1)
-      qns (:,:) = qns (:,:) * tmask(:,:,1)
-      !
-      CALL lbc_lnk( emp , 'T', 1._wp )
-      CALL lbc_lnk( qns , 'T', 1._wp )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_clo')
-      !
-   END SUBROUTINE sbc_clo
-
-
-   SUBROUTINE clo_rnf( p_rnfmsk )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_rnf  ***
-      !!                    
-      !! ** Purpose :   allow the treatment of closed sea outflow grid-points
-      !!                to be the same as river mouth grid-points
-      !!
-      !! ** Method  :   set to 1 the runoff mask (mskrnf, see sbcrnf module)
-      !!                at the closed sea outflow grid-point.
-      !!
-      !! ** Action  :   update (p_)mskrnf (set 1 at closed sea outflow)
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   p_rnfmsk   ! river runoff mask (rnfmsk array)
-      !
-      INTEGER  ::   jc, jn, ji, jj      ! dummy loop indices
-      !!----------------------------------------------------------------------
-      !
-      DO jc = 1, jpncs
-         IF( ncstt(jc) >= 1 ) THEN            ! runoff mask set to 1 at closed sea outflows
-             DO jn = 1, 4
-                DO jj =    mj0( ncsjr(jc,jn) ), mj1( ncsjr(jc,jn) )
-                   DO ji = mi0( ncsir(jc,jn) ), mi1( ncsir(jc,jn) )
-                      p_rnfmsk(ji,jj) = MAX( p_rnfmsk(ji,jj), 1.0_wp )
-                   END DO
-                END DO
-            END DO 
-         ENDIF 
-      END DO 
-      !
-   END SUBROUTINE clo_rnf
-
-   
-   SUBROUTINE clo_ups( p_upsmsk )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_rnf  ***
-      !!                    
-      !! ** Purpose :   allow the treatment of closed sea outflow grid-points
-      !!                to be the same as river mouth grid-points
-      !!
-      !! ** Method  :   set to 0.5 the upstream mask (upsmsk, see traadv_cen2 
-      !!                module) over the closed seas.
-      !!
-      !! ** Action  :   update (p_)upsmsk (set 0.5 over closed seas)
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   p_upsmsk   ! upstream mask (upsmsk array)
-      !
-      INTEGER  ::   jc, ji, jj      ! dummy loop indices
-      !!----------------------------------------------------------------------
-      !
-      DO jc = 1, jpncs
-         DO jj = ncsj1(jc), ncsj2(jc)
-            DO ji = ncsi1(jc), ncsi2(jc)
-               p_upsmsk(ji,jj) = 0.5_wp         ! mixed upstream/centered scheme over closed seas
-            END DO 
-         END DO 
-       END DO 
-       !
-   END SUBROUTINE clo_ups
-   
-      
-   SUBROUTINE clo_bat( pbat, kbat )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE clo_bat  ***
-      !!                    
-      !! ** Purpose :   suppress closed sea from the domain
-      !!
-      !! ** Method  :   set to 0 the meter and level bathymetry (given in 
-      !!                arguments) over the closed seas.
-      !!
-      !! ** Action  :   set pbat=0 and kbat=0 over closed seas
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pbat   ! bathymetry in meters (bathy array)
-      INTEGER , DIMENSION(jpi,jpj), INTENT(inout) ::   kbat   ! bathymetry in levels (mbathy array)
-      !
-      INTEGER  ::   jc, ji, jj      ! dummy loop indices
-      !!----------------------------------------------------------------------
-      !
-      DO jc = 1, jpncs
-         DO jj = ncsj1(jc), ncsj2(jc)
-            DO ji = ncsi1(jc), ncsi2(jc)
-               pbat(ji,jj) = 0._wp   
-               kbat(ji,jj) = 0   
-            END DO 
-         END DO 
-       END DO 
-       !
-   END SUBROUTINE clo_bat
-
-   !!======================================================================
-END MODULE closea
-
Index: /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/cpl_oasis3.F90
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/cpl_oasis3.F90	(revision 4866)
+++ /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/cpl_oasis3.F90	(revision 4866)
@@ -0,0 +1,574 @@
+
+MODULE cpl_oasis3
+   !!======================================================================
+   !!                    ***  MODULE cpl_oasis  ***
+   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3-MCT
+   !!=====================================================================
+   !! History :   
+   !!   9.0  !  04-06  (R. Redler, NEC Laboratories Europe, Germany) Original code
+   !!   " "  !  04-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision
+   !!   " "  !  04-11  (V. Gayler, MPI M&D) Grid writing
+   !!   " "  !  05-08  (R. Redler, W. Park) frld initialization, paral(2) revision
+   !!   " "  !  05-09  (R. Redler) extended to allow for communication over root only
+   !!   " "  !  06-01  (W. Park) modification of physical part
+   !!   " "  !  06-02  (R. Redler, W. Park) buffer array fix for root exchange
+   !!   3.4  !  11-11  (C. Harris) Changes to allow mutiple category fields
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT
+   !!   'key_oa3mct_v3'                 to be added for OASIS3-MCT version 3
+   !!----------------------------------------------------------------------
+   !!   cpl_init     : initialization of coupled mode communication
+   !!   cpl_define   : definition of grid and fields
+   !!   cpl_snd     : snd out fields in coupled mode
+   !!   cpl_rcv     : receive fields in coupled mode
+   !!   cpl_finalize : finalize the coupled mode communication
+   !!----------------------------------------------------------------------
+#if defined key_oasis3
+   USE mod_oasis                    ! OASIS3-MCT module
+#endif
+   USE par_oce                      ! ocean parameters
+   USE dom_oce                      ! ocean space and time domain
+   USE in_out_manager               ! I/O manager
+   USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
+   USE xios
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   cpl_init
+   PUBLIC   cpl_define
+   PUBLIC   cpl_snd
+   PUBLIC   cpl_rcv
+   PUBLIC   cpl_freq
+   PUBLIC   cpl_finalize
+
+   INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
+   INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis
+   INTEGER                    ::   ncomp_id          ! id returned by oasis_init_comp
+   INTEGER                    ::   nerror            ! return error code
+#if ! defined key_oasis3
+   ! OASIS Variables not used. defined only for compilation purpose
+   INTEGER                    ::   OASIS_Out         = -1
+   INTEGER                    ::   OASIS_REAL        = -1
+   INTEGER                    ::   OASIS_Ok          = -1
+   INTEGER                    ::   OASIS_In          = -1
+   INTEGER                    ::   OASIS_Sent        = -1
+   INTEGER                    ::   OASIS_SentOut     = -1
+   INTEGER                    ::   OASIS_ToRest      = -1
+   INTEGER                    ::   OASIS_ToRestOut   = -1
+   INTEGER                    ::   OASIS_Recvd       = -1
+   INTEGER                    ::   OASIS_RecvOut     = -1
+   INTEGER                    ::   OASIS_FromRest    = -1
+   INTEGER                    ::   OASIS_FromRestOut = -1
+#endif
+
+   INTEGER                    ::   nrcv         ! total number of fields received 
+   INTEGER                    ::   nsnd         ! total number of fields sent 
+   INTEGER                    ::   ncplmodel    ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
+   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=50   ! Maximum number of coupling fields
+   INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields
+   INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields
+   
+   TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
+      LOGICAL               ::   laction   ! To be coupled or not
+      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field   
+      CHARACTER(len = 1)    ::   clgrid    ! Grid type  
+      REAL(wp)              ::   nsgn      ! Control of the sign change
+      INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models)
+      INTEGER               ::   nct       ! Number of categories in field
+      INTEGER               ::   ncplmodel ! Maximum number of models to/from which this variable may be sent/received
+   END TYPE FLD_CPL
+
+   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC ::   srcv, ssnd   !: Coupling fields
+
+   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
+
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: cpl_oasis3.F90 7846 2017-03-30 13:25:01Z cetlod $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE cpl_init( cd_modname, kl_comm )
+      !!-------------------------------------------------------------------
+      !!             ***  ROUTINE cpl_init  ***
+      !!
+      !! ** Purpose :   Initialize coupled mode communication for ocean
+      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
+      !!
+      !! ** Method  :   OASIS3 MPI communication 
+      !!--------------------------------------------------------------------
+      CHARACTER(len = *), INTENT(in) ::   cd_modname   ! model name as set in namcouple file
+      INTEGER          , INTENT(out) ::   kl_comm      ! local communicator of the model
+      !!--------------------------------------------------------------------
+
+      ! WARNING: No write in numout in this routine
+      !============================================
+
+      !------------------------------------------------------------------
+      ! 1st Initialize the OASIS system for the application
+      !------------------------------------------------------------------
+      CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror )
+      IF ( nerror /= OASIS_Ok ) &
+         CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp')
+
+      !------------------------------------------------------------------
+      ! 3rd Get an MPI communicator for OPA local communication
+      !------------------------------------------------------------------
+
+      CALL oasis_get_localcomm ( kl_comm, nerror )
+      IF ( nerror /= OASIS_Ok ) &
+         CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' )
+      !
+   END SUBROUTINE cpl_init
+
+
+   SUBROUTINE cpl_define( krcv, ksnd, kcplmodel )
+      !!-------------------------------------------------------------------
+      !!             ***  ROUTINE cpl_define  ***
+      !!
+      !! ** Purpose :   Define grid and field information for ocean
+      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
+      !!
+      !! ** Method  :   OASIS3 MPI communication 
+      !!--------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
+      INTEGER, INTENT(in) ::   kcplmodel      ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
+      !
+      INTEGER :: id_part
+      INTEGER :: paral(5)       ! OASIS3 box partition
+      INTEGER :: ishape(2,2)    ! shape of arrays passed to PSMILe
+      INTEGER :: ji,jc,jm       ! local loop indicees
+      CHARACTER(LEN=64) :: zclname
+      CHARACTER(LEN=2) :: cli2
+      !!--------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'cpl_define : initialization in coupled ocean/atmosphere case'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
+      IF(lwp) WRITE(numout,*)
+
+      ncplmodel = kcplmodel
+      IF( kcplmodel > nmaxcpl ) THEN
+         CALL oasis_abort ( ncomp_id, 'cpl_define', 'ncplmodel is larger than nmaxcpl, increase nmaxcpl')   ;   RETURN
+      ENDIF
+
+      nrcv = krcv
+      IF( nrcv > nmaxfld ) THEN
+         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nrcv is larger than nmaxfld, increase nmaxfld')   ;   RETURN
+      ENDIF
+
+      nsnd = ksnd
+      IF( nsnd > nmaxfld ) THEN
+         CALL oasis_abort ( ncomp_id, 'cpl_define', 'nsnd is larger than nmaxfld, increase nmaxfld')   ;   RETURN
+      ENDIF
+
+      !
+      ! ... Define the shape for the area that excludes the halo
+      !     For serial configuration (key_mpp_mpi not being active)
+      !     nl* is set to the global values 1 and jp*glo.
+      !
+      ishape(:,1) = (/ 1, nlei-nldi+1 /)
+      ishape(:,2) = (/ 1, nlej-nldj+1 /)
+      !
+      ! ... Allocate memory for data exchange
+      !
+      ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
+      IF( nerror > 0 ) THEN
+         CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
+      ENDIF
+      !
+      ! -----------------------------------------------------------------
+      ! ... Define the partition 
+      ! -----------------------------------------------------------------
+      
+      paral(1) = 2                                              ! box partitioning
+      paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset    
+      paral(3) = nlei-nldi+1                                    ! local extent in i 
+      paral(4) = nlej-nldj+1                                    ! local extent in j
+      paral(5) = jpiglo                                         ! global extent in x
+      
+      IF( ln_ctl ) THEN
+         WRITE(numout,*) ' multiexchg: paral (1:5)', paral
+         WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj
+         WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp
+         WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp
+      ENDIF
+      
+      CALL oasis_def_partition ( id_part, paral, nerror, jpiglo*jpjglo )
+      !
+      ! ... Announce send variables. 
+      !
+      ssnd(:)%ncplmodel = kcplmodel
+      !
+      DO ji = 1, ksnd
+         IF ( ssnd(ji)%laction ) THEN
+
+            IF( ssnd(ji)%nct > nmaxcat ) THEN
+               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
+                  &              TRIM(ssnd(ji)%clname)//' is larger than nmaxcat, increase nmaxcat' )
+               RETURN
+            ENDIF
+            
+            DO jc = 1, ssnd(ji)%nct
+               DO jm = 1, kcplmodel
+
+                  IF ( ssnd(ji)%nct .GT. 1 ) THEN
+                     WRITE(cli2,'(i2.2)') jc
+                     zclname = TRIM(ssnd(ji)%clname)//'_cat'//cli2
+                  ELSE
+                     zclname = ssnd(ji)%clname
+                  ENDIF
+                  IF ( kcplmodel  > 1 ) THEN
+                     WRITE(cli2,'(i2.2)') jm
+                     zclname = 'model'//cli2//'_'//TRIM(zclname)
+                  ENDIF
+#if defined key_agrif
+                  IF( agrif_fixed() /= 0 ) THEN 
+                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
+                  END IF
+#endif
+                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out
+                  CALL oasis_def_var (ssnd(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 0 /),   &
+                     &                OASIS_Out          , ishape , OASIS_REAL, nerror )
+                  IF ( nerror /= OASIS_Ok ) THEN
+                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
+                     CALL oasis_abort ( ssnd(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
+                  ENDIF
+                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
+                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
+               END DO
+            END DO
+         ENDIF
+      END DO
+      !
+      ! ... Announce received variables. 
+      !
+      srcv(:)%ncplmodel = kcplmodel
+      !
+      DO ji = 1, krcv
+         IF ( srcv(ji)%laction ) THEN 
+            
+            IF( srcv(ji)%nct > nmaxcat ) THEN
+               CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
+                  &              TRIM(srcv(ji)%clname)//' is larger than nmaxcat, increase nmaxcat' )
+               RETURN
+            ENDIF
+            
+            DO jc = 1, srcv(ji)%nct
+               DO jm = 1, kcplmodel
+                  
+                  IF ( srcv(ji)%nct .GT. 1 ) THEN
+                     WRITE(cli2,'(i2.2)') jc
+                     zclname = TRIM(srcv(ji)%clname)//'_cat'//cli2
+                  ELSE
+                     zclname = srcv(ji)%clname
+                  ENDIF
+                  IF ( kcplmodel  > 1 ) THEN
+                     WRITE(cli2,'(i2.2)') jm
+                     zclname = 'model'//cli2//'_'//TRIM(zclname)
+                  ENDIF
+#if defined key_agrif
+                  IF( agrif_fixed() /= 0 ) THEN 
+                     zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
+                  END IF
+#endif
+                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In
+                  CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 0 /),   &
+                     &                OASIS_In           , ishape , OASIS_REAL, nerror )
+                  IF ( nerror /= OASIS_Ok ) THEN
+                     WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
+                     CALL oasis_abort ( srcv(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
+                  ENDIF
+                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
+                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
+
+               END DO
+            END DO
+         ENDIF
+      END DO
+      
+      !------------------------------------------------------------------
+      ! End of definition phase
+      !------------------------------------------------------------------
+      
+      CALL xios_oasis_enddef()
+      CALL oasis_enddef(nerror)
+      IF( nerror /= OASIS_Ok )   CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in oasis_enddef')
+      !
+   END SUBROUTINE cpl_define
+   
+   
+   SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo )
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE cpl_snd  ***
+      !!
+      !! ** Purpose : - At each coupling time-step,this routine sends fields
+      !!      like sst or ice cover to the coupler or remote application.
+      !!----------------------------------------------------------------------
+      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
+      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
+      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
+      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdata
+      !!
+      INTEGER                                   ::   jc,jm     ! local loop index
+      !!--------------------------------------------------------------------
+      !
+      ! snd data to OASIS3
+      !
+      DO jc = 1, ssnd(kid)%nct
+         DO jm = 1, ssnd(kid)%ncplmodel
+        
+            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN
+               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
+               
+               IF ( ln_ctl ) THEN        
+                  IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   &
+                     & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN
+                     WRITE(numout,*) '****************'
+                     WRITE(numout,*) 'oasis_put: Outgoing ', ssnd(kid)%clname
+                     WRITE(numout,*) 'oasis_put: ivarid ', ssnd(kid)%nid(jc,jm)
+                     WRITE(numout,*) 'oasis_put:  kstep ', kstep
+                     WRITE(numout,*) 'oasis_put:   info ', kinfo
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
+                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
+                     WRITE(numout,*) '****************'
+                  ENDIF
+               ENDIF
+               
+            ENDIF
+            
+         ENDDO
+      ENDDO
+      !
+    END SUBROUTINE cpl_snd
+
+
+   SUBROUTINE cpl_rcv( kid, kstep, pdata, pmask, kinfo )
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE cpl_rcv  ***
+      !!
+      !! ** Purpose : - At each coupling time-step,this routine receives fields
+      !!      like stresses and fluxes from the coupler or remote application.
+      !!----------------------------------------------------------------------
+      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
+      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdata     ! IN to keep the value if nothing is done
+      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pmask     ! coupling mask
+      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
+      !!
+      INTEGER                                   ::   jc,jm     ! local loop index
+      LOGICAL                                   ::   llaction, llfisrt
+      !!--------------------------------------------------------------------
+      !
+      ! receive local data from OASIS3 on every process
+      !
+      kinfo = OASIS_idle
+      !
+      DO jc = 1, srcv(kid)%nct
+         llfisrt = .TRUE.
+
+         DO jm = 1, srcv(kid)%ncplmodel
+
+            IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
+
+               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )         
+               
+               llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
+                  &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
+               
+               IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
+               
+               IF ( llaction ) THEN
+                  
+                  kinfo = OASIS_Rcv
+                  IF( llfisrt ) THEN 
+                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
+                     llfisrt = .FALSE.
+                  ELSE
+                     pdata(nldi:nlei,nldj:nlej,jc) = pdata(nldi:nlei,nldj:nlej,jc) + exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
+                  ENDIF
+                  
+                  IF ( ln_ctl ) THEN        
+                     WRITE(numout,*) '****************'
+                     WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
+                     WRITE(numout,*) 'oasis_get: ivarid '  , srcv(kid)%nid(jc,jm)
+                     WRITE(numout,*) 'oasis_get:   kstep', kstep
+                     WRITE(numout,*) 'oasis_get:   info ', kinfo
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
+                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
+                     WRITE(numout,*) '****************'
+                  ENDIF
+                  
+               ENDIF
+               
+            ENDIF
+            
+         ENDDO
+
+         !--- Fill the overlap areas and extra hallows (mpp)
+         !--- check periodicity conditions (all cases)
+         IF( .not. llfisrt )   CALL lbc_lnk( pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
+ 
+      ENDDO
+      !
+   END SUBROUTINE cpl_rcv
+
+
+   INTEGER FUNCTION cpl_freq( cdfieldname )  
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE cpl_freq  ***
+      !!
+      !! ** Purpose : - send back the coupling frequency for a particular field
+      !!----------------------------------------------------------------------
+      CHARACTER(len = *), INTENT(in) ::   cdfieldname    ! field name as set in namcouple file
+      !!
+      INTEGER               :: id
+      INTEGER               :: info
+      INTEGER, DIMENSION(1) :: itmp
+      INTEGER               :: ji,jm     ! local loop index
+      INTEGER               :: mop
+      !!----------------------------------------------------------------------
+      cpl_freq = 0   ! defaut definition
+      id = -1        ! defaut definition
+      !
+      DO ji = 1, nsnd
+         IF (ssnd(ji)%laction ) THEN
+            DO jm = 1, ncplmodel
+               IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN
+                  IF( TRIM(cdfieldname) == TRIM(ssnd(ji)%clname) ) THEN
+                     id = ssnd(ji)%nid(1,jm)
+                     mop = OASIS_Out
+                  ENDIF
+               ENDIF
+            ENDDO
+         ENDIF
+      ENDDO
+      DO ji = 1, nrcv
+         IF (srcv(ji)%laction ) THEN
+            DO jm = 1, ncplmodel
+               IF( srcv(ji)%nid(1,jm) /= -1 ) THEN
+                  IF( TRIM(cdfieldname) == TRIM(srcv(ji)%clname) ) THEN
+                     id = srcv(ji)%nid(1,jm)
+                     mop = OASIS_In
+                  ENDIF
+               ENDIF
+            ENDDO
+         ENDIF
+      ENDDO
+      !
+      IF( id /= -1 ) THEN
+#if defined key_oa3mct_v3
+         CALL oasis_get_freqs(id, mop, 1, itmp, info)
+#else
+         CALL oasis_get_freqs(id,      1, itmp, info)
+#endif
+         cpl_freq = itmp(1)
+      ENDIF
+      !
+   END FUNCTION cpl_freq
+
+
+   SUBROUTINE cpl_finalize
+      !!---------------------------------------------------------------------
+      !!              ***  ROUTINE cpl_finalize  ***
+      !!
+      !! ** Purpose : - Finalizes the coupling. If MPI_init has not been
+      !!      called explicitly before cpl_init it will also close
+      !!      MPI communication.
+      !!----------------------------------------------------------------------
+      !
+      DEALLOCATE( exfld )
+      IF (nstop == 0) THEN
+         CALL oasis_terminate( nerror )         
+      ELSE
+         CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" )
+      ENDIF       
+      !
+   END SUBROUTINE cpl_finalize
+
+#if ! defined key_oasis3
+
+   !!----------------------------------------------------------------------
+   !!   No OASIS Library          OASIS3 Dummy module...
+   !!----------------------------------------------------------------------
+
+   SUBROUTINE oasis_init_comp(k1,cd1,k2)
+      CHARACTER(*), INTENT(in   ) ::  cd1
+      INTEGER     , INTENT(  out) ::  k1,k2
+      k1 = -1 ; k2 = -1
+      WRITE(numout,*) 'oasis_init_comp: Error you sould not be there...', cd1
+   END SUBROUTINE oasis_init_comp
+
+   SUBROUTINE oasis_abort(k1,cd1,cd2)
+      INTEGER     , INTENT(in   ) ::  k1
+      CHARACTER(*), INTENT(in   ) ::  cd1,cd2
+      WRITE(numout,*) 'oasis_abort: Error you sould not be there...', cd1, cd2
+   END SUBROUTINE oasis_abort
+
+   SUBROUTINE oasis_get_localcomm(k1,k2)
+      INTEGER     , INTENT(  out) ::  k1,k2
+      k1 = -1 ; k2 = -1
+      WRITE(numout,*) 'oasis_get_localcomm: Error you sould not be there...'
+   END SUBROUTINE oasis_get_localcomm
+
+   SUBROUTINE oasis_def_partition(k1,k2,k3,k4)
+      INTEGER     , INTENT(  out) ::  k1,k3
+      INTEGER     , INTENT(in   ) ::  k2(5)
+      INTEGER     , INTENT(in   ) ::  k4
+      k1 = k2(1) ; k3 = k2(5)+k4
+      WRITE(numout,*) 'oasis_def_partition: Error you sould not be there...'
+   END SUBROUTINE oasis_def_partition
+
+   SUBROUTINE oasis_def_var(k1,cd1,k2,k3,k4,k5,k6,k7)
+      CHARACTER(*), INTENT(in   ) ::  cd1
+      INTEGER     , INTENT(in   ) ::  k2,k3(2),k4,k5(2,2),k6
+      INTEGER     , INTENT(  out) ::  k1,k7
+      k1 = -1 ; k7 = -1
+      WRITE(numout,*) 'oasis_def_var: Error you sould not be there...', cd1
+   END SUBROUTINE oasis_def_var
+
+   SUBROUTINE oasis_enddef(k1)
+      INTEGER     , INTENT(  out) ::  k1
+      k1 = -1
+      WRITE(numout,*) 'oasis_enddef: Error you sould not be there...'
+   END SUBROUTINE oasis_enddef
+  
+   SUBROUTINE oasis_put(k1,k2,p1,k3)
+      REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1
+      INTEGER                 , INTENT(in   ) ::  k1,k2
+      INTEGER                 , INTENT(  out) ::  k3
+      k3 = -1
+      WRITE(numout,*) 'oasis_put: Error you sould not be there...'
+   END SUBROUTINE oasis_put
+
+   SUBROUTINE oasis_get(k1,k2,p1,k3)
+      REAL(wp), DIMENSION(:,:), INTENT(  out) ::  p1
+      INTEGER                 , INTENT(in   ) ::  k1,k2
+      INTEGER                 , INTENT(  out) ::  k3
+      p1(1,1) = -1. ; k3 = -1
+      WRITE(numout,*) 'oasis_get: Error you sould not be there...'
+   END SUBROUTINE oasis_get
+
+   SUBROUTINE oasis_get_freqs(k1,k2,k3,k4)
+      INTEGER              , INTENT(in   ) ::  k1,k2
+      INTEGER, DIMENSION(1), INTENT(  out) ::  k3
+      INTEGER              , INTENT(  out) ::  k4
+      k3(1) = k1 ; k4 = k2
+      WRITE(numout,*) 'oasis_get_freqs: Error you sould not be there...'
+   END SUBROUTINE oasis_get_freqs
+
+   SUBROUTINE oasis_terminate(k1)
+      INTEGER     , INTENT(  out) ::  k1
+      k1 = -1
+      WRITE(numout,*) 'oasis_terminate: Error you sould not be there...'
+   END SUBROUTINE oasis_terminate
+   
+#endif
+
+   !!=====================================================================
+END MODULE cpl_oasis3
Index: NFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/domain.F90
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/domain.F90	(revision 4865)
+++ 	(revision )
@@ -1,480 +1,0 @@
-MODULE domain
-   !!==============================================================================
-   !!                       ***  MODULE domain   ***
-   !! Ocean initialization : domain initialization
-   !!==============================================================================
-   !! History :  OPA  !  1990-10  (C. Levy - G. Madec)  Original code
-   !!                 !  1992-01  (M. Imbard) insert time step initialization
-   !!                 !  1996-06  (G. Madec) generalized vertical coordinate 
-   !!                 !  1997-02  (G. Madec) creation of domwri.F
-   !!                 !  2001-05  (E.Durand - G. Madec) insert closed sea
-   !!   NEMO     1.0  !  2002-08  (G. Madec)  F90: Free form and module
-   !!            2.0  !  2005-11  (V. Garnier) Surface pressure gradient organization
-   !!            3.3  !  2010-11  (G. Madec)  initialisation in C1D configuration
-   !!            3.6  !  2013     ( J. Simeon, C. Calone, G. Madec, C. Ethe ) Online coarsening of outputs
-   !!----------------------------------------------------------------------
-   
-   !!----------------------------------------------------------------------
-   !!   dom_init       : initialize the space and time domain
-   !!   dom_nam        : read and contral domain namelists
-   !!   dom_ctl        : control print for the ocean domain
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean variables
-   USE dom_oce         ! domain: ocean
-   USE sbc_oce         ! surface boundary condition: ocean
-   USE trc_oce         ! shared ocean-passive tracers variables
-   USE phycst          ! physical constants
-   USE closea          ! closed seas
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distributed memory computing library
-
-   USE domhgr          ! domain: set the horizontal mesh
-   USE domzgr          ! domain: set the vertical mesh
-   USE domstp          ! domain: set the time-step
-   USE dommsk          ! domain: set the mask system
-   USE domwri          ! domain: write the meshmask file
-   USE domvvl          ! variable volume
-   USE c1d             ! 1D vertical configuration
-   USE dyncor_c1d      ! Coriolis term (c1d case)         (cor_c1d routine)
-   USE timing          ! Timing
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link)
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dom_init   ! called by opa.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!-------------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: domain.F90 7522 2017-01-02 10:06:49Z cetlod $
-   !! Software governed by the CeCILL licence        (NEMOGCM/NEMO_CeCILL.txt)
-   !!-------------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE dom_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dom_init  ***
-      !!                    
-      !! ** Purpose :   Domain initialization. Call the routines that are 
-      !!              required to create the arrays which define the space 
-      !!              and time domain of the ocean model.
-      !!
-      !! ** Method  : - dom_msk: compute the masks from the bathymetry file
-      !!              - dom_hgr: compute or read the horizontal grid-point position
-      !!                         and scale factors, and the coriolis factor
-      !!              - dom_zgr: define the vertical coordinate and the bathymetry
-      !!              - dom_stp: defined the model time step
-      !!              - dom_wri: create the meshmask file if nmsh=1
-      !!              - 1D configuration, move Coriolis, u and v at T-point
-      !!----------------------------------------------------------------------
-      INTEGER ::   jk          ! dummy loop argument
-      INTEGER ::   iconf = 0   ! local integers
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )   CALL timing_start('dom_init')
-      !
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_init : domain initialization'
-         WRITE(numout,*) '~~~~~~~~'
-      ENDIF
-      !
-                             CALL dom_nam      ! read namelist ( namrun, namdom, namcla )
-                             CALL dom_clo      ! Closed seas and lake
-                             CALL dom_hgr      ! Horizontal mesh
-                             CALL dom_zgr      ! Vertical mesh and bathymetry
-                             CALL dom_msk      ! Masks
-      IF( ln_sco )           CALL dom_stiff    ! Maximum stiffness ratio/hydrostatic consistency
-      !
-      ht_0(:,:) = 0.0_wp                       ! Reference ocean depth at T-points
-      hu_0(:,:) = 0.0_wp                       ! Reference ocean depth at U-points
-      hv_0(:,:) = 0.0_wp                       ! Reference ocean depth at V-points
-      DO jk = 1, jpk
-         ht_0(:,:) = ht_0(:,:) + e3t_0(:,:,jk) * tmask(:,:,jk)
-         hu_0(:,:) = hu_0(:,:) + e3u_0(:,:,jk) * umask(:,:,jk)
-         hv_0(:,:) = hv_0(:,:) + e3v_0(:,:,jk) * vmask(:,:,jk)
-      END DO
-      !
-      IF( lk_c1d )           CALL cor_c1d      ! 1D configuration: Coriolis set at T-point
-      !
-      IF( .NOT.lk_offline ) THEN
-        !
-        IF( lk_vvl )         CALL dom_vvl_init ! Vertical variable mesh
-        !
-        hu(:,:) = 0._wp                          ! Ocean depth at U-points
-        hv(:,:) = 0._wp                          ! Ocean depth at V-points
-        ht(:,:) = 0._wp                          ! Ocean depth at T-points
-        DO jk = 1, jpkm1
-           hu(:,:) = hu(:,:) + fse3u_n(:,:,jk) * umask(:,:,jk)
-           hv(:,:) = hv(:,:) + fse3v_n(:,:,jk) * vmask(:,:,jk)
-           ht(:,:) = ht(:,:) + fse3t_n(:,:,jk) * tmask(:,:,jk)
-        END DO
-        !                                        ! Inverse of the local depth
-        hur(:,:) = 1._wp / ( hu(:,:) + 1._wp - umask_i(:,:) ) * umask_i(:,:)
-        hvr(:,:) = 1._wp / ( hv(:,:) + 1._wp - vmask_i(:,:) ) * vmask_i(:,:)
-        !
-      ENDIF
-
-                             CALL dom_stp      ! time step
-      IF( nmsh /= 0      )   CALL dom_wri      ! Create a domain file
-      IF( .NOT.ln_rstart )   CALL dom_ctl      ! Domain control
-      !
-      IF( nn_timing == 1 )   CALL timing_stop('dom_init')
-      !
-   END SUBROUTINE dom_init
-
-
-   SUBROUTINE dom_nam
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE dom_nam  ***
-      !!                    
-      !! ** Purpose :   read domaine namelists and print the variables.
-      !!
-      !! ** input   : - namrun namelist
-      !!              - namdom namelist
-      !!              - namcla namelist
-      !!              - namnc4 namelist   ! "key_netcdf4" only
-      !!----------------------------------------------------------------------
-      USE ioipsl
-      NAMELIST/namrun/ cn_ocerst_indir, cn_ocerst_outdir, nn_stocklist, ln_rst_list,               &
-         &             nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , ln_rstart_ts, nn_rstctl,   &
-         &             nn_it000, nn_itend  , nn_date0    , nn_leapy     , nn_istate , nn_stock ,   &
-         &             nn_write, ln_dimgnnn, ln_mskland  , ln_cfmeta    , ln_clobber, nn_chunksz, nn_euler, ln_mskutil
-      NAMELIST/namdom/ nn_bathy, rn_bathy , rn_e3zps_min, rn_e3zps_rat, nn_msh, rn_hmin,   &
-         &             nn_acc   , rn_atfp     , rn_rdt      , rn_rdtmin ,                  &
-         &             rn_rdtmax, rn_rdth     , nn_closea , ln_crs,    &
-         &             jphgr_msh, &
-         &             ppglam0, ppgphi0, ppe1_deg, ppe2_deg, ppe1_m, ppe2_m, &
-         &             ppsur, ppa0, ppa1, ppkth, ppacr, ppdzmin, pphmax, ldbletanh, &
-         &             ppa2, ppkth2, ppacr2
-      NAMELIST/namcla/ nn_cla
-#if defined key_netcdf4
-      NAMELIST/namnc4/ nn_nchunks_i, nn_nchunks_j, nn_nchunks_k, ln_nc4zip
-#endif
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
-      !!----------------------------------------------------------------------
-
-      REWIND( numnam_ref )              ! Namelist namrun in reference namelist : Parameters of the run
-      READ  ( numnam_ref, namrun, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namrun in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namrun in configuration namelist : Parameters of the run
-      READ  ( numnam_cfg, namrun, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namrun in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namrun )
-      !
-      IF(lwp) THEN                  ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_nam  : domain initialization through namelist read'
-         WRITE(numout,*) '~~~~~~~ '
-         WRITE(numout,*) '   Namelist namrun'
-         WRITE(numout,*) '      job number                      nn_no      = ', nn_no
-         WRITE(numout,*) '      experiment name for output      cn_exp     = ', cn_exp
-         WRITE(numout,*) '      file prefix restart input       cn_ocerst_in= ', cn_ocerst_in
-         WRITE(numout,*) '      restart input directory         cn_ocerst_indir= ', cn_ocerst_indir
-         WRITE(numout,*) '      file prefix restart output      cn_ocerst_out= ', cn_ocerst_out
-         WRITE(numout,*) '      restart output directory        cn_ocerst_outdir= ', cn_ocerst_outdir
-         WRITE(numout,*) '      restart logical                 ln_rstart  = ', ln_rstart
-         WRITE(numout,*) '      restart but zero for current for T ln_rstart_ts = ', ln_rstart_ts
-         WRITE(numout,*) '      start with forward time step    nn_euler   = ', nn_euler
-         WRITE(numout,*) '      control of time step            nn_rstctl  = ', nn_rstctl
-         WRITE(numout,*) '      number of the first time step   nn_it000   = ', nn_it000
-         WRITE(numout,*) '      number of the last time step    nn_itend   = ', nn_itend
-         WRITE(numout,*) '      initial calendar date aammjj    nn_date0   = ', nn_date0
-         WRITE(numout,*) '      leap year calendar (0/1)        nn_leapy   = ', nn_leapy
-         WRITE(numout,*) '      initial state output            nn_istate  = ', nn_istate
-         IF( ln_rst_list ) THEN
-            WRITE(numout,*) '      list of restart dump times      nn_stocklist   =', nn_stocklist
-         ELSE
-            WRITE(numout,*) '      frequency of restart file       nn_stock   = ', nn_stock
-         ENDIF
-         WRITE(numout,*) '      frequency of output file        nn_write   = ', nn_write
-         WRITE(numout,*) '      multi file dimgout              ln_dimgnnn = ', ln_dimgnnn
-         WRITE(numout,*) '      mask land points                ln_mskland = ', ln_mskland
-         WRITE(numout,*) '      additional CF standard metadata ln_cfmeta  = ', ln_cfmeta
-         WRITE(numout,*) '      overwrite an existing file      ln_clobber = ', ln_clobber
-         WRITE(numout,*) '      NetCDF chunksize (bytes)        nn_chunksz = ', nn_chunksz
-      ENDIF
-
-      no = nn_no                    ! conversion DOCTOR names into model names (this should disappear soon)
-      cexper = cn_exp
-      nrstdt = nn_rstctl
-      nit000 = nn_it000
-      nitend = nn_itend
-      ndate0 = nn_date0
-      nleapy = nn_leapy
-      ninist = nn_istate
-      nstock = nn_stock
-      nstocklist = nn_stocklist
-      nwrite = nn_write
-      neuler = nn_euler
-      IF ( neuler == 1 .AND. .NOT. ln_rstart ) THEN
-         WRITE(ctmp1,*) 'ln_rstart =.FALSE., nn_euler is forced to 0 '
-         CALL ctl_warn( ctmp1 )
-         neuler = 0
-      ENDIF
-
-      !                             ! control of output frequency
-      IF ( nstock == 0 .OR. nstock > nitend ) THEN
-         WRITE(ctmp1,*) 'nstock = ', nstock, ' it is forced to ', nitend
-         CALL ctl_warn( ctmp1 )
-         nstock = nitend
-      ENDIF
-      IF ( nwrite == 0 ) THEN
-         WRITE(ctmp1,*) 'nwrite = ', nwrite, ' it is forced to ', nitend
-         CALL ctl_warn( ctmp1 )
-         nwrite = nitend
-      ENDIF
-
-#if defined key_agrif
-      IF( Agrif_Root() ) THEN
-#endif
-      SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL
-      CASE (  1 ) 
-         CALL ioconf_calendar('gregorian')
-         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "gregorian", i.e. leap year'
-      CASE (  0 )
-         CALL ioconf_calendar('noleap')
-         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "noleap", i.e. no leap year'
-      CASE ( 30 )
-         CALL ioconf_calendar('360d')
-         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "360d", i.e. 360 days in a year'
-      END SELECT
-#if defined key_agrif
-      ENDIF
-#endif
-
-      REWIND( numnam_ref )              ! Namelist namdom in reference namelist : space & time domain (bathymetry, mesh, timestep)
-      READ  ( numnam_ref, namdom, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdom in reference namelist', lwp )
-  
-      !
-      REWIND( numnam_cfg )              ! Namelist namdom in configuration namelist : space & time domain (bathymetry, mesh, timestep)
-      READ  ( numnam_cfg, namdom, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdom in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namdom )
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) '   Namelist namdom : space & time domain'
-         WRITE(numout,*) '      flag read/compute bathymetry      nn_bathy     = ', nn_bathy
-         WRITE(numout,*) '      Depth (if =0 bathy=jpkm1)         rn_bathy     = ', rn_bathy
-         WRITE(numout,*) '      min depth of the ocean    (>0) or    rn_hmin   = ', rn_hmin
-         WRITE(numout,*) '      min number of ocean level (<0)       '
-         WRITE(numout,*) '      minimum thickness of partial      rn_e3zps_min = ', rn_e3zps_min, ' (m)'
-         WRITE(numout,*) '         step level                     rn_e3zps_rat = ', rn_e3zps_rat
-         WRITE(numout,*) '      create mesh/mask file(s)          nn_msh       = ', nn_msh
-         WRITE(numout,*) '           = 0   no file created           '
-         WRITE(numout,*) '           = 1   mesh_mask                 '
-         WRITE(numout,*) '           = 2   mesh and mask             '
-         WRITE(numout,*) '           = 3   mesh_hgr, msh_zgr and mask'
-         WRITE(numout,*) '      ocean time step                       rn_rdt    = ', rn_rdt
-         WRITE(numout,*) '      asselin time filter parameter         rn_atfp   = ', rn_atfp
-         WRITE(numout,*) '      acceleration of converge              nn_acc    = ', nn_acc
-         WRITE(numout,*) '        nn_acc=1: surface tracer rdt        rn_rdtmin = ', rn_rdtmin
-         WRITE(numout,*) '                  bottom  tracer rdt        rdtmax    = ', rn_rdtmax
-         WRITE(numout,*) '                  depth of transition       rn_rdth   = ', rn_rdth
-         WRITE(numout,*) '      suppression of closed seas (=0)       nn_closea = ', nn_closea
-         WRITE(numout,*) '      online coarsening of dynamical fields ln_crs    = ', ln_crs
-         WRITE(numout,*) '      type of horizontal mesh jphgr_msh           = ', jphgr_msh
-         WRITE(numout,*) '      longitude of first raw and column T-point ppglam0 = ', ppglam0
-         WRITE(numout,*) '      latitude  of first raw and column T-point ppgphi0 = ', ppgphi0
-         WRITE(numout,*) '      zonal      grid-spacing (degrees) ppe1_deg        = ', ppe1_deg
-         WRITE(numout,*) '      meridional grid-spacing (degrees) ppe2_deg        = ', ppe2_deg
-         WRITE(numout,*) '      zonal      grid-spacing (degrees) ppe1_m          = ', ppe1_m
-         WRITE(numout,*) '      meridional grid-spacing (degrees) ppe2_m          = ', ppe2_m
-         WRITE(numout,*) '      ORCA r4, r2 and r05 coefficients  ppsur           = ', ppsur
-         WRITE(numout,*) '                                        ppa0            = ', ppa0
-         WRITE(numout,*) '                                        ppa1            = ', ppa1
-         WRITE(numout,*) '                                        ppkth           = ', ppkth
-         WRITE(numout,*) '                                        ppacr           = ', ppacr
-         WRITE(numout,*) '      Minimum vertical spacing ppdzmin                  = ', ppdzmin
-         WRITE(numout,*) '      Maximum depth pphmax                              = ', pphmax
-         WRITE(numout,*) '      Use double tanf function for vertical coordinates ldbletanh = ', ldbletanh
-         WRITE(numout,*) '      Double tanh function parameters ppa2              = ', ppa2
-         WRITE(numout,*) '                                      ppkth2            = ', ppkth2
-         WRITE(numout,*) '                                      ppacr2            = ', ppacr2
-      ENDIF
-
-      ntopo     = nn_bathy          ! conversion DOCTOR names into model names (this should disappear soon)
-      e3zps_min = rn_e3zps_min
-      e3zps_rat = rn_e3zps_rat
-      nmsh      = nn_msh
-      nacc      = nn_acc
-      atfp      = rn_atfp
-      rdt       = rn_rdt
-      rdtmin    = rn_rdtmin
-      rdtmax    = rn_rdtmin
-      rdth      = rn_rdth
-
-      REWIND( numnam_ref )              ! Namelist namcla in reference namelist : Cross land advection
-      READ  ( numnam_ref, namcla, IOSTAT = ios, ERR = 905)
-905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcla in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namcla in configuration namelist : Cross land advection
-      READ  ( numnam_cfg, namcla, IOSTAT = ios, ERR = 906 )
-906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcla in configuration namelist', lwp )
-      IF(lwm) WRITE( numond, namcla )
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) '   Namelist namcla'
-         WRITE(numout,*) '      cross land advection                 nn_cla    = ', nn_cla
-      ENDIF
-      IF ( nn_cla .EQ. 1 ) THEN
-         IF  ( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN   ! ORCA R2 
-            CONTINUE
-         ELSE
-            CALL ctl_stop( 'STOP', 'Cross land advation iplemented only for ORCA2 configuration: cp_cfg = "orca" and jp_cfg = 2 ' )
-         ENDIF
-      ENDIF
-
-#if defined key_netcdf4
-      !                             ! NetCDF 4 case   ("key_netcdf4" defined)
-      REWIND( numnam_ref )              ! Namelist namnc4 in reference namelist : NETCDF
-      READ  ( numnam_ref, namnc4, IOSTAT = ios, ERR = 907)
-907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namnc4 in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namnc4 in configuration namelist : NETCDF
-      READ  ( numnam_cfg, namnc4, IOSTAT = ios, ERR = 908 )
-908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namnc4 in configuration namelist', lwp )
-      IF(lwm) WRITE( numond, namnc4 )
-
-      IF(lwp) THEN                        ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) '   Namelist namnc4 - Netcdf4 chunking parameters'
-         WRITE(numout,*) '      number of chunks in i-dimension      nn_nchunks_i   = ', nn_nchunks_i
-         WRITE(numout,*) '      number of chunks in j-dimension      nn_nchunks_j   = ', nn_nchunks_j
-         WRITE(numout,*) '      number of chunks in k-dimension      nn_nchunks_k   = ', nn_nchunks_k
-         WRITE(numout,*) '      apply netcdf4/hdf5 chunking & compression ln_nc4zip = ', ln_nc4zip
-      ENDIF
-
-      ! Put the netcdf4 settings into a simple structure (snc4set, defined in in_out_manager module)
-      ! Note the chunk size in the unlimited (time) dimension will be fixed at 1
-      snc4set%ni   = nn_nchunks_i
-      snc4set%nj   = nn_nchunks_j
-      snc4set%nk   = nn_nchunks_k
-      snc4set%luse = ln_nc4zip
-#else
-      snc4set%luse = .FALSE.        ! No NetCDF 4 case
-#endif
-      !
-   END SUBROUTINE dom_nam
-
-
-   SUBROUTINE dom_ctl
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE dom_ctl  ***
-      !!
-      !! ** Purpose :   Domain control.
-      !!
-      !! ** Method  :   compute and print extrema of masked scale factors
-      !!----------------------------------------------------------------------
-      INTEGER ::   iimi1, ijmi1, iimi2, ijmi2, iima1, ijma1, iima2, ijma2
-      INTEGER, DIMENSION(2) ::   iloc   ! 
-      REAL(wp) ::   ze1min, ze1max, ze2min, ze2max
-      !!----------------------------------------------------------------------
-      !
-      IF(lk_mpp) THEN
-         CALL mpp_minloc( e1t(:,:), tmask_i(:,:), ze1min, iimi1,ijmi1 )
-         CALL mpp_minloc( e2t(:,:), tmask_i(:,:), ze2min, iimi2,ijmi2 )
-         CALL mpp_maxloc( e1t(:,:), tmask_i(:,:), ze1max, iima1,ijma1 )
-         CALL mpp_maxloc( e2t(:,:), tmask_i(:,:), ze2max, iima2,ijma2 )
-      ELSE
-         ze1min = MINVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp )    
-         ze2min = MINVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp )    
-         ze1max = MAXVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp )    
-         ze2max = MAXVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp )    
-
-         iloc  = MINLOC( e1t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iimi1 = iloc(1) + nimpp - 1
-         ijmi1 = iloc(2) + njmpp - 1
-         iloc  = MINLOC( e2t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iimi2 = iloc(1) + nimpp - 1
-         ijmi2 = iloc(2) + njmpp - 1
-         iloc  = MAXLOC( e1t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iima1 = iloc(1) + nimpp - 1
-         ijma1 = iloc(2) + njmpp - 1
-         iloc  = MAXLOC( e2t(:,:), mask = tmask_i(:,:) == 1._wp )
-         iima2 = iloc(1) + nimpp - 1
-         ijma2 = iloc(2) + njmpp - 1
-      ENDIF
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_ctl : extrema of the masked scale factors'
-         WRITE(numout,*) '~~~~~~~'
-         WRITE(numout,"(14x,'e1t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1max, iima1, ijma1
-         WRITE(numout,"(14x,'e1t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze1min, iimi1, ijmi1
-         WRITE(numout,"(14x,'e2t maxi: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2max, iima2, ijma2
-         WRITE(numout,"(14x,'e2t mini: ',1f10.2,' at i = ',i5,' j= ',i5)") ze2min, iimi2, ijmi2
-      ENDIF
-      !
-   END SUBROUTINE dom_ctl
-
-   SUBROUTINE dom_stiff
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dom_stiff  ***
-      !!                     
-      !! ** Purpose :   Diagnose maximum grid stiffness/hydrostatic consistency
-      !!
-      !! ** Method  :   Compute Haney (1991) hydrostatic condition ratio
-      !!                Save the maximum in the vertical direction
-      !!                (this number is only relevant in s-coordinates)
-      !!
-      !!                Haney, R. L., 1991: On the pressure gradient force
-      !!                over steep topography in sigma coordinate ocean models. 
-      !!                J. Phys. Oceanogr., 21, 610???619.
-      !!----------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jk 
-      REAL(wp) ::   zrxmax
-      REAL(wp), DIMENSION(4) :: zr1
-      !!----------------------------------------------------------------------
-      rx1(:,:) = 0.e0
-      zrxmax   = 0.e0
-      zr1(:)   = 0.e0
-      
-      DO ji = 2, jpim1
-         DO jj = 2, jpjm1
-            DO jk = 1, jpkm1
-               zr1(1) = umask(ji-1,jj  ,jk) *abs( (gdepw_0(ji  ,jj  ,jk  )-gdepw_0(ji-1,jj  ,jk  )  & 
-                    &                         +gdepw_0(ji  ,jj  ,jk+1)-gdepw_0(ji-1,jj  ,jk+1)) &
-                    &                        /(gdepw_0(ji  ,jj  ,jk  )+gdepw_0(ji-1,jj  ,jk  )  &
-                    &                         -gdepw_0(ji  ,jj  ,jk+1)-gdepw_0(ji-1,jj  ,jk+1) + rsmall) )
-               zr1(2) = umask(ji  ,jj  ,jk) *abs( (gdepw_0(ji+1,jj  ,jk  )-gdepw_0(ji  ,jj  ,jk  )  &
-                    &                         +gdepw_0(ji+1,jj  ,jk+1)-gdepw_0(ji  ,jj  ,jk+1)) &
-                    &                        /(gdepw_0(ji+1,jj  ,jk  )+gdepw_0(ji  ,jj  ,jk  )  &
-                    &                         -gdepw_0(ji+1,jj  ,jk+1)-gdepw_0(ji  ,jj  ,jk+1) + rsmall) )
-               zr1(3) = vmask(ji  ,jj  ,jk) *abs( (gdepw_0(ji  ,jj+1,jk  )-gdepw_0(ji  ,jj  ,jk  )  &
-                    &                         +gdepw_0(ji  ,jj+1,jk+1)-gdepw_0(ji  ,jj  ,jk+1)) &
-                    &                        /(gdepw_0(ji  ,jj+1,jk  )+gdepw_0(ji  ,jj  ,jk  )  &
-                    &                         -gdepw_0(ji  ,jj+1,jk+1)-gdepw_0(ji  ,jj  ,jk+1) + rsmall) )
-               zr1(4) = vmask(ji  ,jj-1,jk) *abs( (gdepw_0(ji  ,jj  ,jk  )-gdepw_0(ji  ,jj-1,jk  )  &
-                    &                         +gdepw_0(ji  ,jj  ,jk+1)-gdepw_0(ji  ,jj-1,jk+1)) &
-                    &                        /(gdepw_0(ji  ,jj  ,jk  )+gdepw_0(ji  ,jj-1,jk  )  &
-                    &                         -gdepw_0(ji,  jj  ,jk+1)-gdepw_0(ji  ,jj-1,jk+1) + rsmall) )
-               zrxmax = MAXVAL(zr1(1:4))
-               rx1(ji,jj) = MAX(rx1(ji,jj), zrxmax)
-            END DO
-         END DO
-      END DO
-
-      CALL lbc_lnk( rx1, 'T', 1. )
-
-      zrxmax = MAXVAL(rx1)
-
-      IF( lk_mpp )   CALL mpp_max( zrxmax ) ! max over the global domain
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_stiff : maximum grid stiffness ratio: ', zrxmax
-         WRITE(numout,*) '~~~~~~~~~'
-      ENDIF
-
-   END SUBROUTINE dom_stiff
-
-
-
-   !!======================================================================
-END MODULE domain
Index: NFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/in_out_manager.F90
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/in_out_manager.F90	(revision 4865)
+++ 	(revision )
@@ -1,161 +1,0 @@
-MODULE in_out_manager   
-   !!======================================================================
-   !!                       ***  MODULE  in_out_manager  ***
-   !! I/O manager utilities : Defines run parameters together with logical units
-   !!=====================================================================
-   !! History :   1.0  !  2002-06  (G. Madec)   original code
-   !!             2.0  !  2006-07  (S. Masson)  iom, add ctl_stop, ctl_warn
-   !!             3.0  !  2008-06  (G. Madec)   add ctmp4 to ctmp10
-   !!             3.2  !  2009-08  (S. MAsson)  add new ctl_opn
-   !!             3.3  !  2010-10  (A. Coward)  add NetCDF4 usage
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   USE par_oce       ! ocean parameter
-   USE lib_print     ! formated print library
-   USE nc4interface  ! NetCDF4 interface
-
-   IMPLICIT NONE
-   PUBLIC
-
- 
-   !
-   !!----------------------------------------------------------------------
-   !!                   namrun namelist parameters
-   !!----------------------------------------------------------------------
-   CHARACTER(lc) ::   cn_exp           !: experiment name used for output filename
-   CHARACTER(lc) ::   cn_ocerst_in     !: suffix of ocean restart name (input)
-   CHARACTER(lc) ::   cn_ocerst_indir  !: restart input directory
-   CHARACTER(lc) ::   cn_ocerst_out    !: suffix of ocean restart name (output)
-   CHARACTER(lc) ::   cn_ocerst_outdir !: restart output directory
-   LOGICAL       ::   ln_rstart        !: start from (F) rest or (T) a restart file
-   LOGICAL       ::   ln_rstart_ts     !: start from (F) rest for current only or (T) 
-   LOGICAL       ::   ln_rst_list      !: output restarts at list of times (T) or by frequency (F)
-   INTEGER       ::   nn_no            !: job number
-   INTEGER       ::   nn_rstctl        !: control of the time step (0, 1 or 2)
-   INTEGER       ::   nn_rstssh   = 0  !: hand made initilization of ssh or not (1/0)
-   INTEGER       ::   nn_it000         !: index of the first time step
-   INTEGER       ::   nn_itend         !: index of the last time step
-   INTEGER       ::   nn_date0         !: initial calendar date aammjj
-   INTEGER       ::   nn_leapy         !: Leap year calendar flag (0/1 or 30)
-   INTEGER       ::   nn_istate        !: initial state output flag (0/1)
-   INTEGER       ::   nn_write         !: model standard output frequency
-   INTEGER       ::   nn_stock         !: restart file frequency
-   INTEGER, DIMENSION(10) :: nn_stocklist  !: restart dump times
-   LOGICAL       ::   ln_dimgnnn       !: type of dimgout. (F): 1 file for all proc
-                                                       !:                  (T): 1 file per proc
-   LOGICAL       ::   ln_mskland       !: mask land points in NetCDF outputs (costly: + ~15%)
-   LOGICAL       ::   ln_mskutil       !: output data excluding halos
-   LOGICAL       ::   ln_cfmeta        !: output additional data to netCDF files required for compliance with the CF metadata standard
-   LOGICAL       ::   ln_clobber       !: clobber (overwrite) an existing file
-   INTEGER       ::   nn_chunksz       !: chunksize (bytes) for NetCDF file (works only with iom_nf90 routines)
-#if defined key_netcdf4
-   !!----------------------------------------------------------------------
-   !!                   namnc4 namelist parameters                         (key_netcdf4)
-   !!----------------------------------------------------------------------
-   ! The following four values determine the partitioning of the output fields
-   ! into netcdf4 chunks. They are unrelated to the nn_chunk_sz setting which is
-   ! for runtime optimisation. The individual netcdf4 chunks can be optionally 
-   ! gzipped (recommended) leading to significant reductions in I/O volumes 
-   !                         !!!**  variables only used with iom_nf90 routines and key_netcdf4 **
-   INTEGER ::   nn_nchunks_i   !: number of chunks required in the i-dimension 
-   INTEGER ::   nn_nchunks_j   !: number of chunks required in the j-dimension 
-   INTEGER ::   nn_nchunks_k   !: number of chunks required in the k-dimension 
-   INTEGER ::   nn_nchunks_t   !: number of chunks required in the t-dimension 
-   LOGICAL ::   ln_nc4zip      !: netcdf4 usage: (T) chunk and compress output using the HDF5 sublayers of netcdf4
-   !                           !                 (F) ignore chunking request and use the netcdf4 library 
-   !                           !                     to produce netcdf3-compatible files 
-#endif
-!$AGRIF_DO_NOT_TREAT
-   TYPE(snc4_ctl)     :: snc4set        !: netcdf4 chunking control structure (always needed for decision making)
-!$AGRIF_END_DO_NOT_TREAT
-
-
-   !! conversion of DOCTOR norm namelist name into model name
-   !! (this should disappear in a near futur)
-
-   CHARACTER(lc) ::   cexper                      !: experiment name used for output filename
-   INTEGER       ::   no                          !: job number
-   INTEGER       ::   nrstdt                      !: control of the time step (0, 1 or 2)
-   INTEGER       ::   nit000                      !: index of the first time step
-   INTEGER       ::   nitend                      !: index of the last time step
-   INTEGER       ::   ndate0                      !: initial calendar date aammjj
-   INTEGER       ::   nleapy                      !: Leap year calendar flag (0/1 or 30)
-   INTEGER       ::   ninist                      !: initial state output flag (0/1)
-   INTEGER       ::   nwrite                      !: model standard output frequency
-   INTEGER       ::   nstock                      !: restart file frequency
-   INTEGER, DIMENSION(10) :: nstocklist           !: restart dump times
-
-   !!----------------------------------------------------------------------
-   !! was in restart but moved here because of the OFF line... better solution should be found...
-   !!----------------------------------------------------------------------
-   INTEGER ::   nitrst                !: time step at which restart file should be written
-   LOGICAL ::   lrst_oce              !: logical to control the oce restart write 
-   INTEGER ::   numror = 0            !: logical unit for ocean restart (read). Init to 0 is needed for SAS (in daymod.F90)
-   INTEGER ::   numrow                !: logical unit for ocean restart (write)
-   INTEGER ::   nrst_lst              !: number of restart to output next
-
-   !!----------------------------------------------------------------------
-   !!                    output monitoring
-   !!----------------------------------------------------------------------
-   LOGICAL ::   ln_ctl       !: run control for debugging
-   INTEGER ::   nn_timing    !: run control for timing
-   INTEGER ::   nn_print     !: level of print (0 no print)
-   INTEGER ::   nn_ictls     !: Start i indice for the SUM control
-   INTEGER ::   nn_ictle     !: End   i indice for the SUM control
-   INTEGER ::   nn_jctls     !: Start j indice for the SUM control
-   INTEGER ::   nn_jctle     !: End   j indice for the SUM control
-   INTEGER ::   nn_isplt     !: number of processors following i
-   INTEGER ::   nn_jsplt     !: number of processors following j
-   INTEGER ::   nn_bench     !: benchmark parameter (0/1)
-   INTEGER ::   nn_bit_cmp   =    0    !: bit reproducibility  (0/1)
-
-   !                                          
-   INTEGER ::   nprint, nictls, nictle, njctls, njctle, isplt, jsplt, nbench    !: OLD namelist names
-
-   INTEGER ::   ijsplt     =    1      !: nb of local domain = nb of processors
-
-   !!----------------------------------------------------------------------
-   !!                        logical units
-   !!----------------------------------------------------------------------
-   INTEGER ::   numstp          =   -1      !: logical unit for time step
-   INTEGER ::   numtime         =   -1      !: logical unit for timing
-   INTEGER ::   numout          =    6      !: logical unit for output print; Set to stdout to ensure any early
-                                            !  output can be collected; do not change
-   INTEGER ::   numnam_ref      =   -1      !: logical unit for reference namelist
-   INTEGER ::   numnam_cfg      =   -1      !: logical unit for configuration specific namelist
-   INTEGER ::   numond          =   -1      !: logical unit for Output Namelist Dynamics
-   INTEGER ::   numnam_ice_ref  =   -1      !: logical unit for ice reference namelist
-   INTEGER ::   numnam_ice_cfg  =   -1      !: logical unit for ice reference namelist
-   INTEGER ::   numoni          =   -1      !: logical unit for Output Namelist Ice
-   INTEGER ::   numevo_ice      =   -1      !: logical unit for ice variables (temp. evolution)
-   INTEGER ::   numsol          =   -1      !: logical unit for solver statistics
-   INTEGER ::   numdct_in       =   -1      !: logical unit for transports computing
-   INTEGER ::   numdct_vol      =   -1      !: logical unit for voulume transports output
-   INTEGER ::   numdct_heat     =   -1      !: logical unit for heat    transports output
-   INTEGER ::   numdct_salt     =   -1      !: logical unit for salt    transports output
-   INTEGER ::   numfl           =   -1      !: logical unit for floats ascii output
-   INTEGER ::   numflo          =   -1      !: logical unit for floats ascii output
-
-   !!----------------------------------------------------------------------
-   !!                          Run control  
-   !!----------------------------------------------------------------------
-   INTEGER       ::   nstop = 0             !: error flag (=number of reason for a premature stop run)
-   INTEGER       ::   nwarn = 0             !: warning flag (=number of warning found during the run)
-   CHARACTER(lc) ::   ctmp1, ctmp2, ctmp3   !: temporary characters 1 to 3
-   CHARACTER(lc) ::   ctmp4, ctmp5, ctmp6   !: temporary characters 4 to 6
-   CHARACTER(lc) ::   ctmp7, ctmp8, ctmp9   !: temporary characters 7 to 9
-   CHARACTER(lc) ::   ctmp10                !: temporary character 10
-   CHARACTER(lc) ::   cform_err = "(/,' ===>>> : E R R O R',     /,'         ===========',/)"       !:
-   CHARACTER(lc) ::   cform_war = "(/,' ===>>> : W A R N I N G', /,'         ===============',/)"   !:
-   LOGICAL       ::   lwm      = .FALSE.    !: boolean : true on the 1st processor only (always)
-   LOGICAL       ::   lwp      = .FALSE.    !: boolean : true on the 1st processor only .OR. ln_ctl
-   LOGICAL       ::   lsp_area = .TRUE.     !: to make a control print over a specific area
-   CHARACTER(lc) ::   cxios_context         !: context name used in xios
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: in_out_manager.F90 5518 2015-06-30 13:11:42Z clem $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!=====================================================================
-END MODULE in_out_manager
Index: NFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/restart.F90
===================================================================
--- /CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/restart.F90	(revision 4865)
+++ 	(revision )
@@ -1,287 +1,0 @@
-MODULE restart
-   !!======================================================================
-   !!                     ***  MODULE  restart  ***
-   !! Ocean restart :  write the ocean restart file
-   !!======================================================================
-   !! History :  OPA  !  1999-11  (M. Imbard)  Original code
-   !!   NEMO     1.0  !  2002-08  (G. Madec)  F90: Free form
-   !!            2.0  !  2006-07  (S. Masson)  use IOM for restart
-   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  modified LF-RA
-   !!            - -  !  2010-10  (C. Ethe, G. Madec) TRC-TRA merge (T-S in 4D)
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   rst_opn    : open the ocean restart file
-   !!   rst_write  : write the ocean restart file
-   !!   rst_read   : read the ocean restart file
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers 
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE iom             ! I/O module
-   USE eosbn2          ! equation of state            (eos bn2 routine)
-   USE trdmxl_oce      ! ocean active mixed layer tracers trends variables
-   USE divcur          ! hor. divergence and curl      (div & cur routines)
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   rst_opn         ! routine called by step module
-   PUBLIC   rst_write       ! routine called by step module
-   PUBLIC   rst_read        ! routine called by istate module
-   PUBLIC   rst_read_open   ! routine called in rst_read and (possibly) in dom_vvl_init
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: restart.F90 5407 2015-06-11 19:13:22Z smasson $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE rst_opn( kt )
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE rst_opn  ***
-      !!                     
-      !! ** Purpose : + initialization (should be read in the namelist) of nitrst 
-      !!              + open the restart when we are one time step before nitrst
-      !!                   - restart header is defined when kt = nitrst-1
-      !!                   - restart data  are written when kt = nitrst
-      !!              + define lrst_oce to .TRUE. when we need to define or write the restart
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt     ! ocean time-step
-      !!
-      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character
-      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name
-      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file
-      !!----------------------------------------------------------------------
-      !
-      IF( kt == nit000 ) THEN   ! default definitions
-         lrst_oce = .FALSE.   
-         IF( ln_rst_list ) THEN
-            nrst_lst = 1
-            nitrst = nstocklist( nrst_lst )
-         ELSE
-            nitrst = nitend
-         ENDIF
-      ENDIF
-
-      ! frequency-based restart dumping (nn_stock)
-      IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN   
-         ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment
-         nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing
-         IF( nitrst > nitend )   nitrst = nitend   ! make sure we write a restart at the end of the run
-      ENDIF
-      ! to get better performances with NetCDF format:
-      ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1)
-      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1
-      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN
-         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 
-            ! beware of the format used to write kt (default is i8.8, that should be large enough...)
-            IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst
-            ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst
-            ENDIF
-            ! create the file
-            clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out)
-            clpath = TRIM(cn_ocerst_outdir)
-            IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/'
-            IF(lwp) THEN
-               WRITE(numout,*)
-               SELECT CASE ( jprstlib )
-               CASE ( jprstdimg )   ;   WRITE(numout,*)                            &
-                   '             open ocean restart binary file: ',TRIM(clpath)//clname
-               CASE DEFAULT         ;   WRITE(numout,*)                            &
-                   '             open ocean restart NetCDF file: ',TRIM(clpath)//clname
-               END SELECT
-               IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression'
-               IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt
-               ELSE                          ;   WRITE(numout,*) '             kt = '             , kt
-               ENDIF
-            ENDIF
-            !
-            CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib )
-            lrst_oce = .TRUE.
-         ENDIF
-      ENDIF
-      !
-   END SUBROUTINE rst_opn
-
-
-   SUBROUTINE rst_write( kt )
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE rstwrite  ***
-      !!                     
-      !! ** Purpose :   Write restart fields in the format corresponding to jprstlib
-      !!
-      !! ** Method  :   Write in numrow when kt == nitrst in NetCDF
-      !!              file, save fields which are necessary for restart
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step
-      !!----------------------------------------------------------------------
-
-                     CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rdt       )   ! dynamics time step
-                     CALL iom_rstput( kt, nitrst, numrow, 'rdttra1', rdttra(1) )   ! surface tracer time step
-
-                     CALL iom_rstput( kt, nitrst, numrow, 'ub'     , ub        )     ! before fields
-                     CALL iom_rstput( kt, nitrst, numrow, 'vb'     , vb        )
-                     CALL iom_rstput( kt, nitrst, numrow, 'tb'     , tsb(:,:,:,jp_tem) )
-                     CALL iom_rstput( kt, nitrst, numrow, 'sb'     , tsb(:,:,:,jp_sal) )
-                     CALL iom_rstput( kt, nitrst, numrow, 'rotb'   , rotb      )
-                     CALL iom_rstput( kt, nitrst, numrow, 'hdivb'  , hdivb     )
-                     CALL iom_rstput( kt, nitrst, numrow, 'sshb'   , sshb      )
-                     !
-                     CALL iom_rstput( kt, nitrst, numrow, 'un'     , un        )     ! now fields
-                     CALL iom_rstput( kt, nitrst, numrow, 'vn'     , vn        )
-                     CALL iom_rstput( kt, nitrst, numrow, 'tn'     , tsn(:,:,:,jp_tem) )
-                     CALL iom_rstput( kt, nitrst, numrow, 'sn'     , tsn(:,:,:,jp_sal) )
-                     CALL iom_rstput( kt, nitrst, numrow, 'rotn'   , rotn      )
-                     CALL iom_rstput( kt, nitrst, numrow, 'hdivn'  , hdivn     )
-                     CALL iom_rstput( kt, nitrst, numrow, 'sshn'   , sshn      )
-                     CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop      )
-#if defined key_zdfkpp
-                     CALL iom_rstput( kt, nitrst, numrow, 'rhd'    , rhd       )
-#endif
-      IF( kt == nitrst ) THEN
-         CALL iom_close( numrow )     ! close the restart file (only at last time step)
-!!gm         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE.
-!!gm  not sure what to do here   ===>>>  ask to Sebastian
-         lrst_oce = .FALSE.
-            IF( ln_rst_list ) THEN
-               nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1))
-               nitrst = nstocklist( nrst_lst )
-            ENDIF
-            lrst_oce = .FALSE.
-      ENDIF
-      !
-   END SUBROUTINE rst_write
-
-
-   SUBROUTINE rst_read_open
-      !!---------------------------------------------------------------------- 
-      !!                   ***  ROUTINE rst_read_open  ***
-      !! 
-      !! ** Purpose :   Open read files for restart (format fixed by jprstlib )
-      !! 
-      !! ** Method  :   Use a non-zero, positive value of numror to assess whether or not
-      !!                the file has already been opened
-      !!----------------------------------------------------------------------
-      INTEGER        ::   jlibalt = jprstlib
-      LOGICAL        ::   llok
-      CHARACTER(lc)  ::   clpath   ! full path to ocean output restart file
-      !!----------------------------------------------------------------------
-      !
-      IF( numror <= 0 ) THEN
-         IF(lwp) THEN                                             ! Contol prints
-            WRITE(numout,*)
-            SELECT CASE ( jprstlib )
-            CASE ( jpnf90    )   ;   WRITE(numout,*) 'rst_read : read oce NetCDF restart file'
-            CASE ( jprstdimg )   ;   WRITE(numout,*) 'rst_read : read oce binary restart file'
-            END SELECT
-            IF ( snc4set%luse )      WRITE(numout,*) 'rst_read : configured with NetCDF4 support'
-            WRITE(numout,*) '~~~~~~~~'
-         ENDIF
-
-         clpath = TRIM(cn_ocerst_indir)
-         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/'
-         IF ( jprstlib == jprstdimg ) THEN
-           ! eventually read netcdf file (monobloc)  for restarting on different number of processors
-           ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90
-           INQUIRE( FILE = TRIM(cn_ocerst_indir)//'/'//TRIM(cn_ocerst_in)//'.nc', EXIST = llok )
-           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF
-         ENDIF
-         CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt )
-      ENDIF
-   END SUBROUTINE rst_read_open
-
-   SUBROUTINE rst_read
-      !!---------------------------------------------------------------------- 
-      !!                   ***  ROUTINE rst_read  ***
-      !! 
-      !! ** Purpose :   Read files for restart (format fixed by jprstlib )
-      !! 
-      !! ** Method  :   Read in restart.nc file fields which are necessary for restart
-      !!----------------------------------------------------------------------
-      REAL(wp) ::   zrdt, zrdttra1
-      INTEGER  ::   jk
-      LOGICAL  ::   llok
-      !!----------------------------------------------------------------------
-
-      CALL rst_read_open           ! open restart for reading (if not already opened)
-
-      ! Check dynamics and tracer time-step consistency and force Euler restart if changed
-      IF( iom_varid( numror, 'rdt', ldstop = .FALSE. ) > 0 )   THEN
-         CALL iom_get( numror, 'rdt', zrdt )
-         IF( zrdt /= rdt )   neuler = 0
-      ENDIF
-      IF( iom_varid( numror, 'rdttra1', ldstop = .FALSE. ) > 0 )   THEN
-         CALL iom_get( numror, 'rdttra1', zrdttra1 )
-         IF( zrdttra1 /= rdttra(1) )   neuler = 0
-      ENDIF
-      ! 
-      IF( iom_varid( numror, 'ub', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_autoglo, 'ub'     , ub      )   ! before fields
-         CALL iom_get( numror, jpdom_autoglo, 'vb'     , vb      )
-         CALL iom_get( numror, jpdom_autoglo, 'tb'     , tsb(:,:,:,jp_tem) )
-         CALL iom_get( numror, jpdom_autoglo, 'sb'     , tsb(:,:,:,jp_sal) )
-         CALL iom_get( numror, jpdom_autoglo, 'rotb'   , rotb    )
-         CALL iom_get( numror, jpdom_autoglo, 'hdivb'  , hdivb   )
-         CALL iom_get( numror, jpdom_autoglo, 'sshb'   , sshb    )
-      ELSE
-         neuler = 0
-      ENDIF
-      !
-      CALL iom_get( numror, jpdom_autoglo, 'un'     , un      )   ! now    fields
-      CALL iom_get( numror, jpdom_autoglo, 'vn'     , vn      )
-      CALL iom_get( numror, jpdom_autoglo, 'tn'     , tsn(:,:,:,jp_tem) )
-      CALL iom_get( numror, jpdom_autoglo, 'sn'     , tsn(:,:,:,jp_sal) )
-      CALL iom_get( numror, jpdom_autoglo, 'sshn'   , sshn    )
-      IF( iom_varid( numror, 'rotn', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_autoglo, 'rotn'   , rotn    )
-         CALL iom_get( numror, jpdom_autoglo, 'hdivn'  , hdivn   )
-      ELSE
-         CALL div_cur( 0 )                              ! Horizontal divergence & Relative vorticity
-      ENDIF
-      IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_autoglo, 'rhop'   , rhop    )   ! now    potential density
-      ELSE
-         CALL eos    ( tsn, rhd, rhop, fsdept_n(:,:,:) )   
-      ENDIF
-#if defined key_zdfkpp
-      IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_autoglo, 'rhd'    , rhd     )   ! now    in situ density anomaly
-      ELSE
-         CALL eos( tsn, rhd, fsdept_n(:,:,:) )   ! compute rhd
-      ENDIF
-#endif
-      IF( ln_rstart_ts ) THEN    ! ocean is forced to rest
-         neuler = 0
-         sshn (:,:)   = 0._wp
-         un   (:,:,:) = 0._wp
-         vn   (:,:,:) = 0._wp  
-         rotn (:,:,:) = 0._wp
-         hdivn(:,:,:) = 0._wp
-      ENDIF
-      !
-      IF( neuler == 0 ) THEN                                  ! Euler restart (neuler=0)
-         tsb  (:,:,:,:) = tsn  (:,:,:,:)                             ! all before fields set to now values
-         ub   (:,:,:)   = un   (:,:,:)
-         vb   (:,:,:)   = vn   (:,:,:)
-         rotb (:,:,:)   = rotn (:,:,:)
-         hdivb(:,:,:)   = hdivn(:,:,:)
-         sshb (:,:)     = sshn (:,:)
-
-         IF( lk_vvl ) THEN
-            DO jk = 1, jpk
-               fse3t_b(:,:,jk) = fse3t_n(:,:,jk)
-            END DO
-         ENDIF
-
-      ENDIF
-      !
-   END SUBROUTINE rst_read
-
-   !!=====================================================================
-END MODULE restart
