Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/INSTALL.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/INSTALL.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/INSTALL.rst	(revision 14676)
@@ -5,5 +5,5 @@
 .. todo::
 
-
+   TBD
 
 .. contents::
@@ -122,5 +122,5 @@
 .. code:: console
 
-   $ svn co https://forge.ipsl.jussieu.fr/nemo/svn/NEMO/releases/r4.0/r4.0.4
+   $ svn co https://forge.ipsl.jussieu.fr/nemo/svn/NEMO/trunk
 
 Description of 1\ :sup:`st` level tree structure
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/README.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/README.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/README.rst	(revision 14676)
@@ -62,5 +62,5 @@
  |NEMO-OCE|   |DOI man OCE|_     |DOI qsg|
  |NEMO-ICE|   |DOI man ICE|
- |NEMO-TOP|   |DOI man TOP|
+ |NEMO-MBG|   |DOI man MBG|
 ============ ================== ===================
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/C1D_PAPA/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -39,5 +39,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -51,8 +51,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -74,5 +76,6 @@
       kpk = 75 
       !                             ! Set the lateral boundary condition of the global domain
-      kperio =  7                   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldIperio =  .TRUE.   ;   ldJperio = .TRUE.   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -90,6 +93,5 @@
          WRITE(numout,*) '                                               jpjglo = ', kpj
          WRITE(numout,*) '                                               jpkglo = ', kpk
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      C1D : closed basin                       jperio = ', kperio
+         WRITE(numout,*) '   '
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg	(revision 14676)
@@ -110,8 +110,8 @@
 !                !  file name        ! frequency (hours) ! variable      ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !                !                   !  (if <0  months)  !   name        !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   sn_trcsbc(5)  = 'dust.orca.new'   ,       -1          , 'dustpo4'     ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep2'       ,  .false.     , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
+   sn_trcsbc(5)  = 'dust.orca.new'   ,       -1          , 'dustpo4'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
    rn_trsfac(5)  = 8.264e-02   !  (  0.021 / 31. * 122 )
    rn_trsfac(7)  = 3.313e-01     !  ( 8.8   / 28.1 )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg	(revision 14676)
@@ -110,8 +110,8 @@
 !                !  file name        ! frequency (hours) ! variable      ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !                !                   !  (if <0  months)  !   name        !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   sn_trcsbc(5)  = 'dust.orca.new'   ,       -1          , 'dustpo4'     ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
-   sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep2'       ,  .false.     , .true. , 'yearly'  , 'weights_2D_r360x180_bilin.nc'       , ''    , ''
+   sn_trcsbc(5)  = 'dust.orca.new'   ,       -1          , 'dustpo4'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
+   sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
    rn_trsfac(5)  = 8.264e-02   !  (  0.021 / 31. * 122 )
    rn_trsfac(7)  = 3.313e-01     !  ( 8.8   / 28.1 )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/README.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/README.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/README.rst	(revision 14676)
@@ -240,5 +240,5 @@
    The vertical eddy viscosity and diffusivity coefficients are increased to 1 m\ :sup:`2`/s in
    case of static instability.
-:time step: is 5760sec (1h36') so that there is 15 time steps in one day.
+:time step: is 5400sec (1h30') so that there is 16 time steps in one day.
 
 ORCA2_OFF_PISCES
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-ice.xml
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-ice.xml	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-ice.xml	(revision 14676)
@@ -178,4 +178,10 @@
       <field id="hfxcndtop"    long_name="Net conductive heat flux at the ice surface (neg = ice cooling)"  standard_name="conductive_heat_flux_at_sea_ice_surface"    unit="W/m2" />
       <field id="hfxcndbot"    long_name="Net conductive heat flux at the ice bottom (neg = ice cooling)"   standard_name="conductive_heat_flux_at_sea_ice_bottom"     unit="W/m2" />
+      <!-- clem: uncomment when uncommented in iceupdate.F90 -->
+      <!--
+      <field id="hfxmelt"      long_name="Melt heat flux at the ice surface"       unit="W/m2" />
+      <field id="hfxldmelt"    long_name="Heat flux in the lead for ice melting"   unit="W/m2" />
+      <field id="hfxldgrow"    long_name="Heat flux in the lead for ice growth"    unit="W/m2" />
+      -->
 
       <!-- diags -->
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-innerttrc.xml
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-innerttrc.xml	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/field_def_nemo-innerttrc.xml	(revision 14676)
@@ -43,6 +43,6 @@
     <field id="C14Age"       long_name="Radiocarbon age"                          unit="yr"        grid_ref="grid_T_3D"  />
     <field id="RAge"         long_name="Reservoir Age"                            unit="yr"       />
-    <field id="qtr_C14"      long_name="Air-sea flux of C14"                      unit="1/m2/s"   />
-    <field id="qint_C14"     long_name="Cumulative air-sea flux of C14"           unit="1/m2"     />
+    <field id="qtr_c14"      long_name="Air-sea flux of C14"                      unit="1/m2/s"   />
+    <field id="qint_c14"     long_name="Cumulative air-sea flux of C14"           unit="1/m2"     />
     <field id="AtmCO2"       long_name="Global atmospheric CO2"                   unit="ppm"      />
     <field id="AtmC14"       long_name="Global atmospheric DeltaC14"              unit="permil"   />
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/namelist_ref
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/namelist_ref	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/cfgs/SHARED/namelist_ref	(revision 14676)
@@ -644,5 +644,5 @@
    rn_test_box             = 108.0,  116.0, -66.0, -58.0
    ln_use_calving          = .false. ! Use calving data even when nn_test_icebergs > 0
-   rn_speed_limit          = 0.      ! CFL speed limit for a berg
+   rn_speed_limit          = 0.      ! CFL speed limit for a berg (safe value is 0.4, see #2581)
    !
    ln_M2016                = .false. ! use Merino et al. (2016) modification (use of 3d ocean data instead of only sea surface data)
@@ -1498,4 +1498,5 @@
    jpnj        =   0       !  number of processors following j (set automatically if < 1), see also ln_listonly = T
    nn_hls      =   1       !  halo width (applies to both rows and columns)
+   nn_comm     =   1       !  comm choice
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/NEMO_manual_state.txt
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/NEMO_manual_state.txt	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/NEMO_manual_state.txt	(revision 14676)
@@ -15,6 +15,6 @@
 chap_misc.tex: key{mpp\_mpi} key{nosignedzero} key{vectopt\_loop} np{iom\_get} np{jpjdta} np{jpjglo} np{nn\_bench} np{nn\_bit\_cmp} np{open\_ocean\_jstart} 
 chap_LDF.tex: hf{dynldf\_cNd} hf{ldfdyn\_substitute} hf{ldftra\_substitute} hf{traldf\_c1d} hf{traldf\_cNd} key{dynldf\_c1d} key{dynldf\_c2d} key{dynldf\_c3d} key{traldf\_c1d} key{traldf\_c2d} key{traldf\_c3d} key{traldf\_cNd} key{traldf\_eiv} mdl{ldfdyn\_c2d} mdl{ldfeiv} mdl{traadv\_eiv} np{ln\_dynldf\_bilap} np{ln\_sco} np{nn\_eos} np{rn\_aeih\_0} np{rn\_aeiv} np{rn\_aeiv\_0} np{rn\_ahm0} np{rn\_ahmb0} np{rn\_aht0} np{rn\_ahtb0} np{traldf\_grif} np{traldf\_grif\_iso} rou{ldf\_dyn\_c2d\_orca} rou{ldfslp\_init} 
-chap_LBC.tex: jp{jpreci} key{mpp\_mpi} np{jperio} np{jpiglo} np{jpindt} np{jpinft} np{jpjglo} np{jpjnob} np{nbdysegn} np{nn\_bdy\_jpk} np{nn\_msh} np{nn\_tra} rou{inimpp2} 
-chap_DOM.tex: key{mpp\_mpi} ngn{namzgr} ngn{namzgr\_sco} nlst{namzgr} nlst{namzgr_sco} np{jperio} np{jpiglo} np{jpjglo} np{jpkglo} np{ln\_sco} np{ln\_sigcrit} np{ln\_s\_SF12} np{ln\_s\_SH94} np{ln\_tsd\_ini} np{ln\_zco} np{ln\_zps} np{nn\_bathy} np{nn\_msh} np{ppa0} np{ppa1} np{ppacr} np{ppdzmin} np{pphmax} np{ppkth} np{ppsur} np{rn\_alpha} np{rn\_bb} np{rn\_e3zps\_min} np{rn\_e3zps\_rat} np{rn\_hc} np{rn\_rmax} np{rn\_sbot\_max} np{rn\_sbot\_min} np{rn\_theta} np{rn\_zb\_a} np{rn\_zb\_b} np{rn\_zs} rou{istate\_t\_s} 
+chap_LBC.tex: jp{jpreci} key{mpp\_mpi} np{jpiglo} np{jpindt} np{jpinft} np{jpjglo} np{jpjnob} np{nbdysegn} np{nn\_bdy\_jpk} np{nn\_msh} np{nn\_tra} rou{inimpp2} 
+chap_DOM.tex: key{mpp\_mpi} ngn{namzgr} ngn{namzgr\_sco} nlst{namzgr} nlst{namzgr_sco} np{jpiglo} np{jpjglo} np{jpkglo} np{ln\_sco} np{ln\_sigcrit} np{ln\_s\_SF12} np{ln\_s\_SH94} np{ln\_tsd\_ini} np{ln\_zco} np{ln\_zps} np{nn\_bathy} np{nn\_msh} np{ppa0} np{ppa1} np{ppacr} np{ppdzmin} np{pphmax} np{ppkth} np{ppsur} np{rn\_alpha} np{rn\_bb} np{rn\_e3zps\_min} np{rn\_e3zps\_rat} np{rn\_hc} np{rn\_rmax} np{rn\_sbot\_max} np{rn\_sbot\_min} np{rn\_theta} np{rn\_zb\_a} np{rn\_zb\_b} np{rn\_zs} rou{istate\_t\_s} 
 chap_conservation.tex: key{\_} 
 annex_iso.tex: key{trabbl} key{traldf\_eiv} np{ln\_traldf\_eiv} np{ln\_traldf\_gdia} 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/.svnignore
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/.svnignore	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/.svnignore	(revision 14676)
@@ -9,4 +9,7 @@
 *.lo*
 *.out
+*.pdf
+*.pyg
+*.tdo
 *.toc
 *.xdv
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/main/settings.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/main/settings.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/main/settings.tex	(revision 14676)
@@ -5,12 +5,10 @@
 \def\spcup{\vspace*{2.15cm}}
 \def\hdg{NEMO ocean engine}
-%\def\shdg{}
-\def\spcdn{\vspace*{1cm}}
-\def\autwd{0.25\linewidth}
-\def\lnlg{270pt}
-\def\abswd{0.65\linewidth}
+%\def\shdg{} %% No subheading
+\def\spcdn{\vspace*{1.00cm}}
+\def\autwd{0.25\linewidth}\def\lnlg{270pt}\def\abswd{0.65\linewidth}
 
 %% Color in cmyk model for manual theme (frontpage banner, links and chapter boxes)
-\def\clr{1,.60,0,.4}
+\def\clr{1.0,0.6,0.0,0.4}
 
 %% IPSL publication number
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_DOMAINcfg.tex	(revision 14676)
@@ -6,6 +6,4 @@
 \label{apdx:DOMCFG}
 
-%    {\em 4.0} & {\em Andrew Coward} & {\em Created at v4.0 from materials removed from chap\_DOM that are still relevant to the \forcode{DOMAINcfg} tool and which illustrate and explain the choices to be made by the user when setting up new domains }  \\
-
 \chaptertoc
 
@@ -14,11 +12,10 @@
 {\footnotesize
   \begin{tabularx}{\textwidth}{l||X|X}
-    Release & Author(s) & Modifications \\
-    \hline
-    {\em   next}& {\em Pierre Mathiot} & {\em add ice shelf and closed sea option description } \\
-    {\em   4.0} & {\em Andrew Coward}  & {\em Created at v4.0 from materials removed from chap\_DOM that are still relevant to the \forcode{DOMAINcfg} tool and which illustrate and explain the choices to be made by the user when setting up new domains }  \\
-    {\em   3.6} & {\em ...} & {\em ...} \\
-    {\em   3.4} & {\em ...} & {\em ...} \\
-    {\em <=3.4} & {\em ...} & {\em ...}
+    Release     & Author(s)            & Modifications                                                 \\
+    \hline
+    {\em  next} & {\em Pierre Mathiot} & {\em Add ice shelf and closed sea option description        } \\
+    {\em   4.0} & {\em  Andrew Coward} & {\em Creation from materials removed from \autoref{chap:DOM}
+                                              that are still relevant to the DOMAINcfg tool
+                                              when setting up new domains                            }
   \end{tabularx}
 }
@@ -45,5 +42,4 @@
 
 \begin{listing}
-%  \nlst{namdom_domcfg}
   \begin{forlines}
 !-----------------------------------------------------------------------
@@ -412,5 +408,4 @@
 
 \begin{listing}
-%  \nlst{namzgr_sco_domcfg}
   \caption{\forcode{&namzgr_sco_domcfg}}
   \label{lst:namzgr_sco_domcfg}
@@ -592,5 +587,5 @@
   the \textit{isfdraft\_meter} file (Netcdf format). This file need to include the \textit{isf\_draft} variable. 
   A positive value will mean ice shelf/ocean or ice shelf bedrock interface below the reference 0m ssh. 
-  The exact shape of the ice shelf cavity (grounding line position and minimum thickness of the water column under an ice shelf, ...) can be specify in \nam{zgr_isf}{zgr_isf}.
+  The exact shape of the ice shelf cavity (grounding line position and minimum thickness of the water column under an ice shelf, ...) can be specify in \nam{zgr_isf}{zgr\_isf}.
 
 \begin{listing}
@@ -616,64 +611,64 @@
 \end{listing}
 
-   The options available to define the shape of the under ice shelf cavities are listed in \nam{zgr_isf}{zgr_isf} (\texttt{DOMAINcfg} only, \autoref{lst:namzgr_isf}).
-
-   \subsection{Model ice shelf draft definition}
-   \label{subsec:zgrisf_isfd}
-
-   First of all, the tool make sure, the ice shelf draft ($h_{isf}$) is sensible and compatible with the bathymetry.
-   There are 3 compulsory steps to achieve this:
-
-   \begin{description}
-   \item{\np{rn_isfdep_min}{rn\_isfdep\_min}:} this is the minimum ice shelf draft. This is to make sure there is no ridiculous thin ice shelf. If \np{rn_isfdep_min}{rn\_isfdep\_min} is smaller than the surface level, \np{rn_isfdep_min}{rn\_isfdep\_min} is set to $e3t\_1d(1)$. 
-   Where $h_{isf} < MAX(e3t\_1d(1),\np{rn_isfdep_min}{rn\_isfdep\_min}$), $h_{isf}$ is set to \np{rn_isfdep_min}{rn\_isfdep\_min}.
-
-   \item{\np{rn_glhw_min}{rn\_glhw\_min}:} This parameter is used to define the grounding line position.
-   Where the difference between the bathymetry and the ice shelf draft is smaller than \np{rn_glhw_min}{rn\_glhw\_min}, the cell are grounded (ie masked). 
-   This step is needed to take into account possible small mismatch between ice shelf draft value and bathymetry value (sources are coming from different grid, different data processes, rounding error, ...).
-
-   \item{\np{rn_isfhw_min}{rn\_isfhw\_min}:} This parameter is the minimum water column thickness in the cavity. 
-   Where the water column thickness is lower than \np{rn_isfhw_min}{rn\_isfhw\_min}, the ice shelf draft is adjusted to match this criterion. 
-   If for any reason, this adjustement break the minimum ice shelf draft allowed (\np{rn_isfdep_min}{rn\_isfdep\_min}), the cell is masked.
-   \end{description}
-
-   Once all these adjustements are made, if the water column thickness contains one cell wide channels, these channels can be closed using \np{ln_isfchannel}{ln\_isfchannel}.  
+   The options available to define the shape of the under ice shelf cavities are listed in \nam{zgr_isf}{zgr\_isf} (\texttt{DOMAINcfg} only, \autoref{lst:namzgr_isf}).
+
+\subsection{Model ice shelf draft definition}
+\label{subsec:zgrisf_isfd}
+
+First of all, the tool make sure, the ice shelf draft ($h_{isf}$) is sensible and compatible with the bathymetry.
+There are 3 compulsory steps to achieve this:
+
+\begin{description}
+\item{\np{rn_isfdep_min}{rn\_isfdep\_min}:} this is the minimum ice shelf draft. This is to make sure there is no ridiculous thin ice shelf. If \np{rn_isfdep_min}{rn\_isfdep\_min} is smaller than the surface level, \np{rn_isfdep_min}{rn\_isfdep\_min} is set to $e3t\_1d(1)$. 
+  Where $h_{isf} < MAX(e3t\_1d(1),rn\_isfdep\_min)$, $h_{isf}$ is set to \np{rn_isfdep_min}{rn\_isfdep\_min}.
+
+\item{\np{rn_glhw_min}{rn\_glhw\_min}:} This parameter is used to define the grounding line position.
+  Where the difference between the bathymetry and the ice shelf draft is smaller than \np{rn_glhw_min}{rn\_glhw\_min}, the cell are grounded (ie masked). 
+  This step is needed to take into account possible small mismatch between ice shelf draft value and bathymetry value (sources are coming from different grid, different data processes, rounding error, ...).
+
+\item{\np{rn_isfhw_min}{rn\_isfhw\_min}:} This parameter is the minimum water column thickness in the cavity. 
+  Where the water column thickness is lower than \np{rn_isfhw_min}{rn\_isfhw\_min}, the ice shelf draft is adjusted to match this criterion. 
+  If for any reason, this adjustement break the minimum ice shelf draft allowed (\np{rn_isfdep_min}{rn\_isfdep\_min}), the cell is masked.
+\end{description}
+
+Once all these adjustements are made, if the water column thickness contains one cell wide channels, these channels can be closed using \np{ln_isfchannel}{ln\_isfchannel}.  
  
-   \subsection{Model top level definition}
-   After the definition of the ice shelf draft, the tool defines the top level. 
-   The compulsory criterion is that the water column needs at least 2 wet cells in the water column at U- and V-points.
-   To do so, if there one cell wide water column, the tools adjust the ice shelf draft to fillful the requierement.\\
-
-   The process is the following:
-   \begin{description}
-   \item{step 1:} The top level is defined in the same way as the bottom level is defined.
-   \item{step 2:} The isolated grid point in the bathymetry are filled (as it is done in a domain without ice shelf)
-   \item{step 3:} The tools make sure, the top level is above or equal to the bottom level
-   \item{step 4:} If the water column at a U- or V- point is one wet cell wide, the ice shelf draft is adjusted. So the actual top cell become fully open and the new
-   top cell thickness is set to the minimum cell thickness allowed (following the same logic as for the bottom partial cell). This step is iterated 4 times to ensure the condition is fullfill along the 4 sides of the cell.
-   \end{description}
-
-   In case of steep slope and shallow water column, it likely that 2 cells are disconnected (bathymetry above its neigbourging ice shelf draft). 
-   The option \np{ln_isfconnect}{ln\_isfconnect} allow the tool to force the connection between these 2 cells.
-   Some limiters in meter or levels on the digging allowed by the tool are available (respectively, \np{rn_zisfmax}{rn\_zisfmax} or \np{rn_kisfmax}{rn\_kisfmax}).
-   This will prevent the formation of subglacial lakes at the expense of long vertical pipe to connect cells at very different levels.
-
-   \subsection{Subglacial lakes}
-   Despite careful setting of your ice shelf draft and bathymetry input file as well as setting described in \autoref{subsec:zgrisf_isfd}, some situation are unavoidable.
-   For exemple if you setup your ice shelf draft and bathymetry to do ocean/ice sheet coupling, 
-   you may decide to fill the whole antarctic with a bathymetry and an ice shelf draft value (ice/bedrock interface depth when grounded). 
-   If you do so, the subglacial lakes will show up (Vostock for example). An other possibility is with coarse vertical resolution, some ice shelves could be cut in 2 parts: 
-   one connected to the main ocean and an other one closed which can be considered as a subglacial sea be the model.\\
-
-   The namelist option \np{ln_isfsubgl}{ln\_isfsubgl} allow you to remove theses subglacial lakes.
-   This may be useful for esthetical reason or for stability reasons:
-
-   \begin{description}
-   \item $\bullet$ In a subglacial lakes, in case of very weak circulation (often the case), the only heat flux is the conductive heat flux through the ice sheet. 
-         This will lead to constant freezing until water reaches -20C. 
-         This is one of the defitiency of the 3 equation melt formulation (for details on this formulation, see: \autoref{sec:isf}).
-   \item $\bullet$ In case of coupling with an ice sheet model, 
-         the ssh in the subglacial lakes and the main ocean could be very different (ssh initial adjustement for example), 
-         and so if for any reason both a connected at some point, the model is likely to fall over.\\
-   \end{description}
+\subsection{Model top level definition}
+After the definition of the ice shelf draft, the tool defines the top level. 
+The compulsory criterion is that the water column needs at least 2 wet cells in the water column at U- and V-points.
+To do so, if there one cell wide water column, the tools adjust the ice shelf draft to fillful the requierement.\\
+
+The process is the following:
+\begin{description}
+\item{step 1:} The top level is defined in the same way as the bottom level is defined.
+\item{step 2:} The isolated grid point in the bathymetry are filled (as it is done in a domain without ice shelf)
+\item{step 3:} The tools make sure, the top level is above or equal to the bottom level
+\item{step 4:} If the water column at a U- or V- point is one wet cell wide, the ice shelf draft is adjusted. So the actual top cell become fully open and the new
+  top cell thickness is set to the minimum cell thickness allowed (following the same logic as for the bottom partial cell). This step is iterated 4 times to ensure the condition is fullfill along the 4 sides of the cell.
+\end{description}
+
+In case of steep slope and shallow water column, it likely that 2 cells are disconnected (bathymetry above its neigbourging ice shelf draft). 
+The option \np{ln_isfconnect}{ln\_isfconnect} allow the tool to force the connection between these 2 cells.
+Some limiters in meter or levels on the digging allowed by the tool are available (respectively, \np{rn_zisfmax}{rn\_zisfmax} or \np{rn_kisfmax}{rn\_kisfmax}).
+This will prevent the formation of subglacial lakes at the expense of long vertical pipe to connect cells at very different levels.
+
+\subsection{Subglacial lakes}
+Despite careful setting of your ice shelf draft and bathymetry input file as well as setting described in \autoref{subsec:zgrisf_isfd}, some situation are unavoidable.
+For exemple if you setup your ice shelf draft and bathymetry to do ocean/ice sheet coupling, 
+you may decide to fill the whole antarctic with a bathymetry and an ice shelf draft value (ice/bedrock interface depth when grounded). 
+If you do so, the subglacial lakes will show up (Vostock for example). An other possibility is with coarse vertical resolution, some ice shelves could be cut in 2 parts: 
+one connected to the main ocean and an other one closed which can be considered as a subglacial sea be the model.\\
+
+The namelist option \np{ln_isfsubgl}{ln\_isfsubgl} allow you to remove theses subglacial lakes.
+This may be useful for esthetical reason or for stability reasons:
+
+\begin{description}
+\item $\bullet$ In a subglacial lakes, in case of very weak circulation (often the case), the only heat flux is the conductive heat flux through the ice sheet. 
+  This will lead to constant freezing until water reaches -20C. 
+  This is one of the defitiency of the 3 equation melt formulation (for details on this formulation, see: \autoref{sec:isf}).
+\item $\bullet$ In case of coupling with an ice sheet model, 
+  the ssh in the subglacial lakes and the main ocean could be very different (ssh initial adjustement for example), 
+  and so if for any reason both a connected at some point, the model is likely to fall over.\\
+\end{description}
 
 \section{Closed sea definition}
@@ -707,5 +702,5 @@
 \end{listing}
 
-The options available to define the closed seas and how closed sea net fresh water input will be redistributed by NEMO are listed in \nam{clo}{dom_clo} (\texttt{DOMAINcfg} only).
+The options available to define the closed seas and how closed sea net fresh water input will be redistributed by NEMO are listed in \nam{dom_clo}{dom\_clo} (\texttt{DOMAINcfg} only).
 The individual definition of each closed sea is managed by \np{sn_lake}{sn\_lake}. In this fields the user needs to define:\\
    \begin{description}
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_triads.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_triads.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/apdx_triads.tex	(revision 14676)
@@ -2,14 +2,4 @@
 
 \begin{document}
-
-%% Local cmds
-\newcommand{\rML}[1][i]{\ensuremath{_{\mathrm{ML}\,#1}}}
-\newcommand{\rMLt}[1][i]{\tilde{r}_{\mathrm{ML}\,#1}}
-%% Move to ../../global/new_cmds.tex to avoid error with \listoffigures
-%\newcommand{\triad}[6][]{\ensuremath{{}_{#2}^{#3}{\mathbb{#4}_{#1}}_{#5}^{\,#6}}
-\newcommand{\triadd}[5]{\ensuremath{{}_{#1}^{#2}{\mathbb{#3}}_{#4}^{\,#5}}}
-\newcommand{\triadt}[5]{\ensuremath{{}_{#1}^{#2}{\tilde{\mathbb{#3}}}_{#4}^{\,#5}}}
-\newcommand{\rtriad}[2][]{\ensuremath{\triad[#1]{i}{k}{#2}{i_p}{k_p}}}
-\newcommand{\rtriadt}[1]{\ensuremath{\triadt{i}{k}{#1}{i_p}{k_p}}}
 
 \chapter{Iso-Neutral Diffusion and Eddy Advection using Triads}
@@ -34,5 +24,5 @@
 
 %% =================================================================================================
-\section[Choice of \forcode{namtra\_ldf} namelist parameters]{Choice of \protect\nam{tra_ldf}{tra\_ldf} namelist parameters}
+\section[Choice of \forcode{namtra_ldf} namelist parameters]{Choice of \protect\nam{tra_ldf}{tra\_ldf} namelist parameters}
 
 Two scheme are available to perform the iso-neutral diffusion.
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DIU.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DIU.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DIU.tex	(revision 14676)
@@ -50,4 +50,5 @@
 
 This namelist contains only two variables:
+
 \begin{description}
 \item [{\np{ln_diurnal}{ln\_diurnal}}] A logical switch for turning on/off both the cool skin and warm layer.
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DOM.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DOM.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_DOM.tex	(revision 14676)
@@ -377,7 +377,7 @@
 in which case \np{cn_cfg}{cn\_cfg} and \np{nn_cfg}{nn\_cfg} are set from these values accordingly).
 
-The global lateral boundary condition type is selected from 8 options using parameter \texttt{jperio}.
+The global lateral boundary condition type is selected from 8 options using parameters \texttt{l\_Iperio}, \texttt{l\_Jperio}, \texttt{l\_NFold} and \texttt{c\_NFtype}.
 See \autoref{sec:LBC_jperio} for details on the available options and
-the corresponding values for \texttt{jperio}.
+the corresponding values for \texttt{l\_Iperio}, \texttt{l\_Jperio}, \texttt{l\_NFold} and \texttt{c\_NFtype}.
 
 %% =================================================================================================
@@ -394,10 +394,12 @@
 
 \begin{clines}
-int    jpiglo, jpjglo, jpkglo     /* global domain sizes                                    */
-int    jperio                     /* lateral global domain b.c.                             */
-double glamt, glamu, glamv, glamf /* geographic longitude (t,u,v and f points respectively) */
-double gphit, gphiu, gphiv, gphif /* geographic latitude                                    */
-double e1t, e1u, e1v, e1f         /* horizontal scale factors                               */
-double e2t, e2u, e2v, e2f         /* horizontal scale factors                               */
+integer   Ni0glo, NjOglo, jpkglo       /* global domain sizes (without MPI halos)                */
+logical   l\_Iperio, l\_Jperio         /* lateral global domain b.c.: i- j-periodicity           */
+logical   l\_NFold                     /* lateral global domain b.c.: North Pole folding         */
+char(1)   c\_NFtype                    /*    type of North pole Folding: T or F point            */
+real      glamt, glamu, glamv, glamf   /* geographic longitude (t,u,v and f points respectively) */
+real      gphit, gphiu, gphiv, gphif   /* geographic latitude                                    */
+real      e1t, e1u, e1v, e1f           /* horizontal scale factors                               */
+real      e2t, e2u, e2v, e2f           /* horizontal scale factors                               */
 \end{clines}
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_LBC.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_LBC.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_LBC.tex	(revision 14676)
@@ -159,5 +159,5 @@
 
 %% =================================================================================================
-\section{Model domain boundary condition (\forcode{jperio})}
+\section{Model domain boundary condition}
 \label{sec:LBC_jperio}
 
@@ -168,9 +168,9 @@
 
 %% =================================================================================================
-\subsection{Closed, cyclic (\forcode{jperio={0,1,2,7}})}
+\subsection{Closed, cyclic (\forcode{l_Iperio,l_jperio})}
 \label{subsec:LBC_jperio012}
 
 The choice of closed or cyclic model domain boundary condition is made by
-setting \forcode{jperio} to 0, 1, 2 or 7 in namelist \nam{cfg}{cfg}.
+setting \forcode{l_Iperio,l_jperio} to true or false in namelist \nam{cfg}{cfg}.
 Each time such a boundary condition is needed, it is set by a call to routine \mdl{lbclnk}.
 The computation of momentum and tracer trends proceeds from $i=2$ to $i=jpi-1$ and from $j=2$ to $j=jpj-1$,
@@ -181,18 +181,18 @@
 \begin{description}
 
-\item [For closed boundary (\forcode{jperio=0})], solid walls are imposed at all model boundaries:
+\item [For closed boundary (\forcode{l_Iperio = .false.,l_jperio = .false.})], solid walls are imposed at all model boundaries:
   first and last rows and columns are set to zero.
 
-\item [For cyclic east-west boundary (\forcode{jperio=1})], first and last rows are set to zero (closed) whilst the first column is set to
+\item [For cyclic east-west boundary (\forcode{l_Iperio = .true.,l_jperio = .false.})], first and last rows are set to zero (closed) whilst the first column is set to
   the value of the last-but-one column and the last column to the value of the second one
   (\autoref{fig:LBC_jperio}-a).
   Whatever flows out of the eastern (western) end of the basin enters the western (eastern) end.
 
-\item [For cyclic north-south boundary (\forcode{jperio=2})], first and last columns are set to zero (closed) whilst the first row is set to
+\item [For cyclic north-south boundary (\forcode{l_Iperio = .false.,l_jperio = .true.})], first and last columns are set to zero (closed) whilst the first row is set to
   the value of the last-but-one row and the last row to the value of the second one
   (\autoref{fig:LBC_jperio}-a).
   Whatever flows out of the northern (southern) end of the basin enters the southern (northern) end.
 
-\item [Bi-cyclic east-west and north-south boundary (\forcode{jperio=7})] combines cases 1 and 2.
+\item [Bi-cyclic east-west and north-south boundary (\forcode{l_Iperio = .true.,l_jperio = .true.})] combines cases 1 and 2.
 
 \end{description}
@@ -207,5 +207,5 @@
 
 %% =================================================================================================
-\subsection{North-fold (\forcode{jperio={3,6}})}
+\subsection{North-fold (\forcode{l_NFold = .true.})}
 \label{subsec:LBC_north_fold}
 
@@ -220,5 +220,5 @@
   \includegraphics[width=0.66\textwidth]{LBC_North_Fold_T}
   \caption[North fold boundary in ORCA 2\deg, 1/4\deg and 1/12\deg]{
-    North fold boundary with a $T$-point pivot and cyclic east-west boundary condition ($jperio=4$),
+    North fold boundary with a $T$-point pivot and cyclic east-west boundary condition ($c\_NFtype='T'$),
     as used in ORCA 2\deg, 1/4\deg and 1/12\deg.
     Pink shaded area corresponds to the inner domain mask (see text).}
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_OBS.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_OBS.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_OBS.tex	(revision 14676)
@@ -913,5 +913,4 @@
 
 \begin{listing}
-%  \nlst{namsao}
   \begin{forlines}
 !----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_SBC.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_SBC.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_SBC.tex	(revision 14676)
@@ -975,5 +975,5 @@
 M2, S2, N2, K2, nu2, mu2, 2N2, L2, T2, eps2, lam2, R2, M3, MKS2, MN4, MS4, M4,
 N4, S4, M6, and M8; see file \textit{tide.h90} and \mdl{tide\_mod} for further
-information and references\footnote{As a legacy option \np{ln_tide_var} can be
+information and references\footnote{As a legacy option \np{ln_tide_var}{ln\_tide\_var} can be
   set to \forcode{0}, in which case the 19 tidal constituents (M2, N2, 2N2, S2,
   K2, K1, O1, Q1, P1, M4, Mf, Mm, Msqm, Mtm, S1, MU2, NU2, L2, and T2; see file
@@ -1179,5 +1179,5 @@
 %% =================================================================================================
 \section[Ice Shelf (ISF)]{Interaction with ice shelves (ISF)}
-\label{sec:isf}
+\label{sec:SBC_isf}
 
 \begin{listing}
@@ -1197,20 +1197,20 @@
 
      \np{ln_isfcav_mlt}{ln\_isfcav\_mlt}\forcode{ = .true.} activates the ocean/ice shelf thermodynamics interactions at the ice shelf/ocean interface. 
-     If \np{ln_isfcav_mlt}\forcode{ = .false.}, thermodynamics interactions are desctivated but the ocean dynamics inside the cavity is still active.
+     If \np{ln_isfcav_mlt}{ln\_isfcav\_mlt}\forcode{ = .false.}, thermodynamics interactions are desctivated but the ocean dynamics inside the cavity is still active.
      The logical flag \np{ln_isfcav}{ln\_isfcav} control whether or not the ice shelf cavities are closed. \np{ln_isfcav}{ln\_isfcav} is not defined in the namelist but in the domcfg.nc input file.\\
 
      3 options are available to represent to ice-shelf/ocean fluxes at the interface:
      \begin{description}
-        \item[\np{cn_isfcav_mlt}\forcode{ = 'spe'}]:
+        \item[\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = 'spe'}]:
         The fresh water flux is specified by a forcing fields \np{sn_isfcav_fwf}{sn\_isfcav\_fwf}. Convention of the input file is: positive toward the ocean (i.e. positive for melting and negative for freezing).
         The latent heat fluxes is derived from the fresh water flux. 
         The heat content flux is derived from the fwf flux assuming a temperature set to the freezing point in the top boundary layer (\np{rn_htbl}{rn\_htbl})
 
-        \item[\np{cn_isfcav_mlt}\forcode{ = 'oasis'}]:
+        \item[\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = 'oasis'}]:
         The \forcode{'oasis'} is a prototype of what could be a method to spread precipitation on Antarctic ice sheet as ice shelf melt inside the cavity when a coupled model Atmosphere/Ocean is used. 
         It has not been tested and therefore the model will stop if you try to use it. 
         Actions will be undertake in 2020 to build a comprehensive interface to do so for Greenland, Antarctic and ice shelf (cav), ice shelf (par), icebergs, subglacial runoff and runoff.
 
-        \item[\np{cn_isfcav_mlt}\forcode{ = '2eq'}]:
+        \item[\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '2eq'}]:
         The heat flux and the fresh water flux (negative for melting) resulting from ice shelf melting/freezing are parameterized following \citet{Grosfeld1997}. 
         This formulation is based on a balance between the vertical diffusive heat flux across the ocean top boundary layer (\autoref{eq:ISOMIP1}) 
@@ -1231,5 +1231,5 @@
         and $\gamma$ the thermal exchange coefficient.
 
-        \item[\np{cn_isfcav_mlt}\forcode{ = '3eq'}]:
+        \item[\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '3eq'}]:
         For realistic studies, the heat and freshwater fluxes are parameterized following \citep{Jenkins2001}. This formulation is based on three equations: 
         a balance between the vertical diffusive heat flux across the boundary layer 
@@ -1287,10 +1287,10 @@
      If \np{rn_htbl}{rn\_htbl} smaller than top $e_{3}t$, the top boundary layer thickness is set to the top cell thickness.\\
 
-     Each melt formula (\np{cn_isfcav_mlt}\forcode{ = '3eq'} or \np{cn_isfcav_mlt}\forcode{ = '2eq'}) depends on an exchange coeficient ($\Gamma^{T,S}$) between the ocean and the ice.
+     Each melt formula (\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '3eq'} or \np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '2eq'}) depends on an exchange coeficient ($\Gamma^{T,S}$) between the ocean and the ice.
      Below, the exchange coeficient $\Gamma^{T}$ and $\Gamma^{S}$ are respectively defined by \np{rn_gammat0}{rn\_gammat0} and \np{rn_gammas0}{rn\_gammas0}. 
      There are 3 different ways to compute the exchange velocity:
 
      \begin{description}
-        \item[\np{cn_gammablk}\forcode{='spe'}]:
+        \item[\np{cn_gammablk}{cn\_gammablk}\forcode{='spe'}]:
         The salt and heat exchange coefficients are constant and defined by:
 \[
@@ -1302,5 +1302,5 @@
         This is the recommended formulation for ISOMIP.
 
-	\item[\np{cn_gammablk}\forcode{='vel'}]:
+	\item[\np{cn_gammablk}{cn\_gammablk}\forcode{='vel'}]:
         The salt and heat exchange coefficients are velocity dependent and defined as
 \[
@@ -1313,5 +1313,5 @@
         See \citet{jenkins.nicholls.ea_JPO10} for all the details on this formulation. It is the recommended formulation for realistic application and ISOMIP+/MISOMIP configuration.
 
-	\item[\np{cn_gammablk}\forcode{'vel\_stab'}]:
+	\item[\np{cn_gammablk}{cn\_gammablk}\forcode{'vel\_stab'}]:
         The salt and heat exchange coefficients are velocity and stability dependent and defined as:
 \[
@@ -1329,15 +1329,15 @@
   \begin{description}
 
-     \item[\np{cn_isfpar_mlt}\forcode{ = 'bg03'}]:
+     \item[\np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'bg03'}]:
      The ice shelf cavities are not represented.
      The fwf and heat flux are computed using the \citet{beckmann.goosse_OM03} parameterisation of isf melting.
      The fluxes are distributed along the ice shelf edge between the depth of the average grounding line (GL)
      (\np{sn_isfpar_zmax}{sn\_isfpar\_zmax}) and the base of the ice shelf along the calving front
-     (\np{sn_isfpar_zmin}{sn\_isfpar\_zmin}) as in (\np{cn_isfpar_mlt}\forcode{ = 'spe'}).
+     (\np{sn_isfpar_zmin}{sn\_isfpar\_zmin}) as in (\np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'spe'}).
      The effective melting length (\np{sn_isfpar_Leff}{sn\_isfpar\_Leff}) is read from a file.
      This parametrisation has not been tested since a while and based on \citet{Favier2019}, 
      this parametrisation should probably not be used.
 
-     \item[\np{cn_isfpar_mlt}\forcode{ = 'spe'}]:
+     \item[\np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'spe'}]:
      The ice shelf cavity is not represented.
      The fwf (\np{sn_isfpar_fwf}{sn\_isfpar\_fwf}) is prescribed and distributed along the ice shelf edge between
@@ -1346,5 +1346,5 @@
      The heat flux ($Q_h$) is computed as $Q_h = fwf \times L_f$.
 
-     \item[\np{cn_isfpar_mlt}\forcode{ = 'oasis'}]:
+     \item[\np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'oasis'}]:
      The \forcode{'oasis'} is a prototype of what could be a method to spread precipitation on Antarctic ice sheet as ice shelf melt inside the cavity when a coupled model Atmosphere/Ocean is used. 
      It has not been tested and therefore the model will stop if you try to use it. 
@@ -1353,10 +1353,10 @@
   \end{description}
 
-\np{cn_isfcav_mlt}\forcode{ = '2eq'}, \np{cn_isfcav_mlt}\forcode{ = '3eq'} and \np{cn_isfpar_mlt}\forcode{ = 'bg03'} compute a melt rate based on
+\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '2eq'}, \np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = '3eq'} and \np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'bg03'} compute a melt rate based on
 the water mass properties, ocean velocities and depth.
 The resulting fluxes are thus highly dependent of the model resolution (horizontal and vertical) and 
 realism of the water masses onto the shelf.\\
 
-\np{cn_isfcav_mlt}\forcode{ = 'spe'} and \np{cn_isfpar_mlt}\forcode{ = 'spe'} read the melt rate from a file.
+\np{cn_isfcav_mlt}{cn\_isfcav\_mlt}\forcode{ = 'spe'} and \np{cn_isfpar_mlt}{cn\_isfpar\_mlt}\forcode{ = 'spe'} read the melt rate from a file.
 You have total control of the fwf forcing.
 This can be useful if the water masses on the shelf are not realistic or
@@ -1437,5 +1437,5 @@
 \end{description}
 
-If \np{ln_iscpl}\forcode{ = .true.}, the isf draft is assume to be different at each restart step with
+If \np{ln_iscpl}{ln\_iscpl}\forcode{ = .true.}, the isf draft is assume to be different at each restart step with
 potentially some new wet/dry cells due to the ice sheet dynamics/thermodynamics.
 The wetting and drying scheme, applied on the restart, is very simple. The 6 different possible cases for the tracer and ssh are:
@@ -1482,5 +1482,5 @@
 
 In order to remove the trend and keep the conservation level as close to 0 as possible,
-a simple conservation scheme is available with \np{ln_isfcpl_cons}\forcode{ = .true.}.
+a simple conservation scheme is available with \np{ln_isfcpl_cons}{ln\_isfcpl\_cons}\forcode{ = .true.}.
 The heat/salt/vol. gain/loss are diagnosed, as well as the location.
 A correction increment is computed and applied each time step during the model run.
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_TRA.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_TRA.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_TRA.tex	(revision 14676)
@@ -733,5 +733,5 @@
   (see \autoref{sec:SBC_rnf} for further detail of how it acts on temperature and salinity tendencies)
 \item [\textit{fwfisf}] The mass flux associated with ice shelf melt,
-  (see \autoref{sec:isf} for further details on how the ice shelf melt is computed and applied).
+  (see \autoref{sec:SBC_isf} for further details on how the ice shelf melt is computed and applied).
 \end{labeling}
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_ZDF.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_ZDF.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_ZDF.tex	(revision 14676)
@@ -2,7 +2,4 @@
 
 \begin{document}
-
-%% Custom aliases
-\newcommand{\cf}{\ensuremath{C\kern-0.14em f}}
 
 \chapter{Vertical Ocean Physics (ZDF)}
@@ -1083,4 +1080,5 @@
   \label{lst:namdrg}
 \end{listing}
+
 \begin{listing}
   \nlst{namdrg_top}
@@ -1088,4 +1086,5 @@
   \label{lst:namdrg_top}
 \end{listing}
+
 \begin{listing}
   \nlst{namdrg_bot}
@@ -1562,5 +1561,5 @@
 by only a few extra physics choices namely:
 
-\begin{verbatim}
+\begin{forlines}
      ln_dynldf_OFF = .false.
      ln_dynldf_lap = .true.
@@ -1570,5 +1569,5 @@
         nn_fct_h   =  2
         nn_fct_v   =  2
-\end{verbatim}
+\end{forlines}
 
 \noindent which were chosen to provide a slightly more stable and less noisy solution. The
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_misc.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_misc.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_misc.tex	(revision 14676)
@@ -12,11 +12,11 @@
 {\footnotesize
   \begin{tabularx}{\textwidth}{l||X|X}
-    Release & Author(s) & Modifications \\
+    Release     & Author(s)            & Modifications                      \\
     \hline
-    {\em   X.X} & {\em Pierre Mathiot} & {update of the closed sea section}
-    {\em   4.0} & {\em ...} & {\em ...} \\
-    {\em   3.6} & {\em ...} & {\em ...} \\
-    {\em   3.4} & {\em ...} & {\em ...} \\
-    {\em <=3.4} & {\em ...} & {\em ...}
+    {\em   X.X} & {\em Pierre Mathiot} & {Update of the closed sea section} \\
+    {\em   4.0} & {\em ...           } & {\em ...                         } \\
+    {\em   3.6} & {\em ...           } & {\em ...                         } \\
+    {\em   3.4} & {\em ...           } & {\em ...                         } \\
+    {\em <=3.4} & {\em ...           } & {\em ...                         }
   \end{tabularx}
 }
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_model_basics_zstar.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_model_basics_zstar.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_model_basics_zstar.tex	(revision 14676)
@@ -83,4 +83,5 @@
 
 %\nlst{nam_dynspg}
+
 Options are defined through the \nam{_dynspg}{\_dynspg} namelist variables.
 The surface pressure gradient term is related to the representation of the free surface (\autoref{sec:MB_hor_pg}).
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_time_domain.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_time_domain.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/NEMO/subfiles/chap_time_domain.tex	(revision 14676)
@@ -12,12 +12,12 @@
 {\footnotesize
   \begin{tabularx}{0.5\textwidth}{l||X|X}
-    Release          & Author(s)                                       &
+    Release          & Author(s)                                       & 
     Modifications                                                      \\
     \hline
-    {\em        4.0} & {\em J\'{e}r\^{o}me Chanut \newline Tim Graham} &
+    {\em        4.0} & {\em J\'{e}r\^{o}me Chanut \newline Tim Graham} & 
     {\em Review \newline Update                                      } \\
-    {\em        3.6} & {\em Christian \'{E}th\'{e}                   } &
+    {\em        3.6} & {\em Christian \'{E}th\'{e}                   } & 
     {\em Update                                                      } \\
-    {\em $\leq$ 3.4} & {\em Gurvan Madec                             } &
+    {\em $\leq$ 3.4} & {\em Gurvan Madec                             } & 
     {\em First version                                               } \\
   \end{tabularx}
@@ -44,8 +44,10 @@
 
 The time stepping used in \NEMO\ is a three level scheme that can be represented as follows:
+
 \begin{equation}
   \label{eq:TD}
   x^{t + \rdt} = x^{t - \rdt} + 2 \, \rdt \ \text{RHS}_x^{t - \rdt, \, t, \, t + \rdt}
 \end{equation}
+
 where $x$ stands for $u$, $v$, $T$ or $S$;
 RHS is the \textbf{R}ight-\textbf{H}and-\textbf{S}ide of the corresponding time evolution equation;
@@ -97,8 +99,10 @@
 first designed by \citet{robert_JMSJ66} and more comprehensively studied by \citet{asselin_MWR72},
 is a kind of laplacian diffusion in time that mixes odd and even time steps:
+
 \begin{equation}
   \label{eq:TD_asselin}
   x_F^t = x^t + \gamma \, \lt[ x_F^{t - \rdt} - 2 x^t + x^{t + \rdt} \rt]
 \end{equation}
+
 where the subscript $F$ denotes filtered values and $\gamma$ is the Asselin coefficient.
 $\gamma$ is initialized as \np{rn_atfp}{rn\_atfp} (namelist parameter).
@@ -132,4 +136,5 @@
 The conditions for stability of second and fourth order horizontal diffusion schemes are
 \citep{griffies_bk04}:
+
 \begin{equation}
   \label{eq:TD_euler_stability}
@@ -140,4 +145,5 @@
   \end{cases}
 \end{equation}
+
 where $e$ is the smallest grid size in the two horizontal directions and
 $A^h$ is the mixing coefficient.
@@ -151,4 +157,5 @@
 To overcome the stability constraint, a backward (or implicit) time differencing scheme is used.
 This scheme is unconditionally stable but diffusive and can be written as follows:
+
 \begin{equation}
   \label{eq:TD_imp}
@@ -168,9 +175,12 @@
 where RHS is the right hand side of the equation except for the vertical diffusion term.
 We rewrite \autoref{eq:TD_imp} as:
+
 \begin{equation}
   \label{eq:TD_imp_mat}
   -c(k + 1) \; T^{t + 1}(k + 1) + d(k) \; T^{t + 1}(k) - \; c(k) \; T^{t + 1}(k - 1) \equiv b(k)
 \end{equation}
+
 where
+
 \[
   c(k) = A_w^{vT} (k) \, / \, e_{3w} (k) \text{,} \quad
@@ -239,4 +249,5 @@
 $Q$ is redistributed over several time step.
 In the modified LF-RA environment, these two formulations have been replaced by:
+
 \begin{gather}
   \label{eq:TD_forcing}
@@ -246,4 +257,5 @@
                     - \gamma \, \rdt \, \lt( Q^{t + \rdt / 2} - Q^{t - \rdt / 2} \rt)
 \end{gather}
+
 The change in the forcing formulation given by \autoref{eq:TD_forcing}
 (see \autoref{fig:TD_MLF_forcing}) has a significant effect:
@@ -375,4 +387,5 @@
   %
 \end{flalign*}
+
 \begin{flalign*}
   \allowdisplaybreaks
@@ -387,4 +400,5 @@
   %
 \end{flalign*}
+
 \begin{flalign*}
   \allowdisplaybreaks
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/SI3/main/settings.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/SI3/main/settings.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/SI3/main/settings.tex	(revision 14676)
@@ -1,20 +1,18 @@
-%% Engine (folder name)
-\def \engine{SI3}
+%% Engine
+\def\eng{SI3}
 
-%% Title and cover page settings
-\def \spacetop{  \vspace*{1.2cm} }
-\def \heading{Sea Ice modelling Integrated Initiative (SI$^3$)}
-\def \subheading{The NEMO sea ice engine}
-\def \spacedown{ \vspace*{  1cm} }
-\def \authorswidth{0.2\linewidth}
-\def \rulelenght{230pt}
-\def \abstractwidth{0.65\linewidth}
+%% Cover page
+\def\spcup{\vspace*{1.20cm}}
+\def \hdg{Sea Ice modelling Integrated Initiative (SI$^3$)}
+\def\shdg{The NEMO sea ice engine                         }
+\def\spcdn{\vspace*{1.00cm}}
+\def\autwd{0.20\linewidth}\def\lnlg{230pt}\def\abswd{0.65\linewidth}
 
-%% Color for document (frontpage banner, links and chapter boxes)
-\def \setmanualcolor{ \definecolor{manualcolor}{cmyk}{0, 0, 0, 0.4} }
+%% Color in cmyk model for manual theme (frontpage banner, links and chapter boxes)
+\def\clr{0.0,0.0,0.0,0.4}
 
 %% IPSL publication number
-\def \ipslnum{31}
+\def\ipsl{31}
 
-%% Zenodo ID, i.e. doi:10.5281/zenodo.\([0-9]*\)
-\def \zid{1471689}
+%% Zenodo ID, i.e. doi:10.5281/zenodo.\zid
+\def\zid{1471689}
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/bibliography.bib
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/bibliography.bib	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/bibliography.bib	(revision 14676)
@@ -185,4 +185,16 @@
   journal	= {Global Biogeochemical Cycles},
   publisher	= {American Geophysical Union (AGU)}
+}
+
+@techreport{      gibson_trpt86,
+  title         = "Standards for software development and maintenance",
+  pages         = "21",
+  series        = "ECMWF Technical Memoranda",
+  number        = "120",
+  author        = "J. K. Gibson",
+  institution   = "ECMWF Operations Department; Reading, United Kingdom",
+  year          = "1986",
+  month         = "aug",
+  doi           = "10.21957/gi113q4gn"
 }
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/settings.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/settings.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/main/settings.tex	(revision 14676)
@@ -1,20 +1,18 @@
-%% Engine (folder name)
-\def \engine{TOP}
+%% Engine
+\def\eng{TOP}
 
-%% Title and cover page settings
-\def \spacetop{  \vspace*{1.3cm} }
-\def \heading{Tracers in Ocean Paradigm (TOP)}
-\def \subheading{The NEMO passive tracers engine}
-\def \spacedown{ \vspace*{  1cm} }
-\def \authorswidth{0.15\linewidth}
-\def \rulelenght{110pt}
-\def \abstractwidth{0.7\linewidth}
+%% Cover page
+\def\spcup{\vspace*{1.30cm}}
+\def \hdg{Tracers in Ocean Paradigm (TOP)}
+\def\shdg{The NEMO passive tracers engine}
+\def\spcdn{\vspace*{1.00cm}}
+\def\autwd{0.15\linewidth}\def\lnlg{110pt}\def\abswd{0.70\linewidth}
 
-%% Color for document (frontpage banner, links and chapter boxes)
-\def \setmanualcolor{ \definecolor{manualcolor}{cmyk}{1, 0, 1, .4} }
+%% Color in cmyk model for manual theme (frontpage banner, links and chapter boxes)
+\def\clr{1.0,0.0,1.0,0.4}
 
 %% IPSL publication number
-\def \ipslnum{28}
+\def\ipsl{28}
 
-%% Zenodo ID, i.e. doi:10.5281/zenodo.\([0-9]*\)
-\def \zid{1471700}
+%% Zenodo ID, i.e. doi:10.5281/zenodo.\zid
+\def\zid{1471700}
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/subfiles/model_description.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/subfiles/model_description.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/TOP/subfiles/model_description.tex	(revision 14676)
@@ -9,6 +9,4 @@
 \newcommand{\Dcq}{\Delta ^{14}\mathrm{C}}
 \newcommand{\Rq}{\mathrm{^{14}{R}}}
-\newcommand{\CODE}[1]{\textsc{#1}}
-%\newcommand{\CODE}[1]{\textcolor{black}{\textsc{#1}}\xspace}
 
 \chapter{Model Description}
@@ -28,7 +26,11 @@
 where expressions of $D^{lC}$ and $D^{vC}$ depend on the choice for the lateral and vertical subgrid scale parameterizations, see equations 5.10 and 5.11 in \citep{nemo_manual}
 
-{S(C)} , the first term on the right hand side of \ref{Eq_tracer}; is the SMS - Source Minus Sink - inherent to the tracer.  In the case of biological tracer such as phytoplankton, {S(C)} is the balance between phytoplankton growth and its decay through mortality and grazing. In the case of a tracer comprising carbon,  {S(C)} accounts for gas exchange, river discharge, flux to the sediments, gravitational sinking and other biological processes. In the case of a radioactive tracer, {S(C)} is simply loss due to radioactive decay.
-
-The second term (within brackets) represents the advection of the tracer in the three directions. It can be interpreted as the budget between the incoming and outgoing tracer fluxes in a volume $T$-cells $b_t= e_{1t}\,e_{2t}\,e_{3t}$
+{S(C)} , the first term on the right hand side of \autoref{Eq_tracer}; is the SMS - Source Minus Sink - inherent to the tracer.
+In the case of biological tracer such as phytoplankton, {S(C)} is the balance between phytoplankton growth and its decay through mortality and grazing.
+In the case of a tracer comprising carbon,  {S(C)} accounts for gas exchange, river discharge, flux to the sediments, gravitational sinking and other biological processes.
+In the case of a radioactive tracer, {S(C)} is simply loss due to radioactive decay.
+
+The second term (within brackets) represents the advection of the tracer in the three directions.
+It can be interpreted as the budget between the incoming and outgoing tracer fluxes in a volume $T$-cells $b_t= e_{1t}\,e_{2t}\,e_{3t}$
 
 The third term  represents the change due to lateral diffusion.
@@ -46,5 +48,6 @@
 \label{sec:TopInt}
 
-TOP is the NEMO hardwired interface toward biogeochemical models and provide the physical constraints/boundaries for oceanic tracers. It consists of a modular framework to handle multiple ocean tracers, including also a variety of built-in modules.
+TOP is the NEMO hardwired interface toward biogeochemical models and provide the physical constraints/boundaries for oceanic tracers.
+It consists of a modular framework to handle multiple ocean tracers, including also a variety of built-in modules.
 
 This component of the NEMO framework allows one to exploit available modules  and further develop a range of applications, spanning from the implementation of a dye passive tracer to evaluate dispersion processes (by means of MY\_TRC), track water masses age (AGE module), assess the ocean interior penetration of persistent chemical compounds (e.g., gases like CFC or even PCBs), up to the full set of equations involving marine biogeochemical cycles.
@@ -61,5 +64,6 @@
         \item \textbf{AGE}	    :    Water age tracking
         \item \textbf{MY\_TRC}  :	Template for creation of new modules and external BGC models coupling
-        \item \textbf{PISCES}    :	 Built in BGC model. See \citep{aumont_2015} for a throughout description.
+        \item \textbf{PISCES}    :	 Built in BGC model.
+See \citep{aumont_2015} for a throughout description.
 \end{itemize}
 %  ----------------------------------------------------------
@@ -69,17 +73,21 @@
 The passive tracer transport component  shares the same advection/diffusion routines with the dynamics, with specific treatment of some features like the surface boundary conditions, or the positivity of passive tracers concentrations.
 
- \subsection{ Advection}
+\subsection{Advection}
 %------------------------------------------namtrc_adv----------------------------------------------------
 \nlst{namtrc_adv}
 %-------------------------------------------------------------------------------------------------------------
-The advection schemes used for the passive tracers are the same than the ones for $T$ and $S$ and described in section 5.1 of \citep{nemo_manual}. The choice of an advection scheme  can be selected independently and  can differ from the ones used for active tracers. This choice is made in the \textit{namtrc\_adv} namelist, by  setting to \textit{true} one and only one of the logicals \textit{ln\_trcadv\_xxx}, the same way of what is done for dynamics.
-cen2, MUSCL2, and UBS are not \textit{positive} schemes meaning that negative values can appear in an initially strictly positive tracer field which is advected, implying that false extrema are permitted. Their use is not recommended on passive tracers
-
- \subsection{ Lateral diffusion}
+The advection schemes used for the passive tracers are the same than the ones for $T$ and $S$ and described in section 5.1 of \citep{nemo_manual}.
+The choice of an advection scheme  can be selected independently and  can differ from the ones used for active tracers.
+This choice is made in the \textit{namtrc\_adv} namelist, by  setting to \textit{true} one and only one of the logicals \textit{ln\_trcadv\_xxx}, the same way of what is done for dynamics.
+cen2, MUSCL2, and UBS are not \textit{positive} schemes meaning that negative values can appear in an initially strictly positive tracer field which is advected, implying that false extrema are permitted.
+Their use is not recommended on passive tracers
+
+\subsection{Lateral diffusion}
 %------------------------------------------namtrc_ldf----------------------------------------------------
 \nlst{namtrc_ldf}
 %-------------------------------------------------------------------------------------------------------------
-In NEMO v4.0, the passive tracer diffusion has necessarily the same form as the active tracer diffusion, meaning that the numerical scheme must be the same. However the passive tracer mixing coefficient can be chosen as a multiple of the active ones by changing the value of \textit{rn\_ldf\_multi} in namelist \textit{namtrc\_ldf}. The choice of numerical scheme is then set  in the \nam{namtra_ldf}{namtra\_ldf} namelist for the dynamic described in section 5.2 of \citep{nemo_manual}.
-
+In NEMO v4.0, the passive tracer diffusion has necessarily the same form as the active tracer diffusion, meaning that the numerical scheme must be the same.
+However the passive tracer mixing coefficient can be chosen as a multiple of the active ones by changing the value of \textit{rn\_ldf\_multi} in namelist \textit{namtrc\_ldf}.
+The choice of numerical scheme is then set in the \forcode{&namtra_ldf} namelist for the dynamic described in section 5.2 of \citep{nemo_manual}.
 
 %-----------------We also offers the possibility to increase zonal equatorial diffusion for passive tracers by introducing an enhanced zonal diffusivity coefficent in the equatorial domain which can be defined by the equation below :
@@ -88,5 +96,5 @@
 %-----------------\end{equation}
 
- \subsection{ Tracer damping}
+\subsection{Tracer damping}
 
 %------------------------------------------namtrc_dmp----------------------------------------------------
@@ -94,8 +102,12 @@
 %-------------------------------------------------------------------------------------------------------------
 
-The use of newtonian damping  to climatological fields or observations is also coded, sharing the same routine dans active tracers. Boolean variables are defined in the namelist\_top\_ref to select the tracers on which restoring is applied
-Options are defined through the \nam{namtrc_dmp}{namtrc\_dmp} namelist variables. The restoring term is added when the namelist parameter \np{ln\_trcdmp} is set to true. The restoring coefficient is a three-dimensional array read in a file, which name is specified by the namelist variable \np{cn\_resto\_tr}. This netcdf file can be generated using the DMP\_TOOLS tool.
-
- \subsection{ Tracer positivity}
+The use of newtonian damping  to climatological fields or observations is also coded, sharing the same routine dans active tracers.
+Boolean variables are defined in the namelist\_top\_ref to select the tracers on which restoring is applied
+Options are defined through the \nam{trc_dmp}{trc\_dmp} namelist variables.
+The restoring term is added when the namelist parameter \np{ln\_trcdmp} is set to true.
+The restoring coefficient is a three-dimensional array read in a file, which name is specified by the namelist variable \np{cn\_resto\_tr}.
+This netcdf file can be generated using the DMP\_TOOLS tool.
+
+\subsection{Tracer positivity}
 
 %------------------------------------------namtrc_rad----------------------------------------------------
@@ -103,6 +115,8 @@
 %-------------------------------------------------------------------------------------------------------------
 
-Sometimes, numerical scheme can generates negative values of passive tracers concentration that must be positive. For exemple,  isopycnal diffusion can created extrema. The trcrad routine artificially corrects negative concentrations with a very crude solution that either sets negative concentration to zero without adjusting the tracer budget, or by removing negative concentration and keeping mass conservation.
-The treatment of negative concentrations is an option and can be selected in the namelist \nam{namtrc_rad}{namtrc\_rad} by setting the parameter \np{ln\_trcrad}  to true.
+Sometimes, numerical scheme can generates negative values of passive tracers concentration that must be positive.
+For exemple,  isopycnal diffusion can created extrema.
+The trcrad routine artificially corrects negative concentrations with a very crude solution that either sets negative concentration to zero without adjusting the tracer budget, or by removing negative concentration and keeping mass conservation.
+The treatment of negative concentrations is an option and can be selected in the namelist \nam{trc_rad}{trc\_rad} by setting the parameter \np{ln\_trcrad}  to true.
 
 \section{The SMS modules}
@@ -119,31 +133,42 @@
 %----------------------------------------------------------------------------------------------------------
 
-
- An `ideal age' tracer is integrated online in TOP when \textit{ln\_age} = \texttt{.true.} in namelist \textit{namtrc}. This tracer marks the length of time in units of years that fluid has spent in the interior of the ocean, insulated from exposure to the atmosphere. Thus, away from the surface for $z<-H_{\mathrm{Age}}$ where $H_{\mathrm{Age}}$ is specified by the \textit{namage} namelist variable \textit{rn\_age\_depth}, whose default value is 10~m, there is a source $\mathrm{SMS_{\mathrm{Age}}}$ of the age tracer $A$:
+An `ideal age' tracer is integrated online in TOP when \textit{ln\_age} = \texttt{.true.} in namelist \textit{namtrc}.
+This tracer marks the length of time in units of years that fluid has spent in the interior of the ocean, insulated from exposure to the atmosphere.
+Thus, away from the surface for $z<-H_{\mathrm{Age}}$ where $H_{\mathrm{Age}}$ is specified by the \textit{namage} namelist variable \textit{rn\_age\_depth}, whose default value is 10~m, there is a source $\mathrm{SMS_{\mathrm{Age}}}$ of the age tracer $A$:
+
 \begin{equation}
   \label{eq:TOP-age-interior}
   \mathrm{SMS_{\mathrm{Age}}} = 1 \mathrm{yr}\;^{-1} = 1/T_{\mathrm{year}},
- \end{equation}
- where the length of the current year $T_{\mathrm{year}} = 86400*N_{\mathrm{days\;in\;current\; year}}\;\mathrm{s}$, where $N_{\mathrm{days\;in\;current\; year}}$ may be 366 or 365 depending on whether the current year is a leap year or not.
- Near the surface, for $z>-H_{\mathrm{Age}}$, ideal age is relaxed back to zero:
+\end{equation}
+
+where the length of the current year $T_{\mathrm{year}} = 86400*N_{\mathrm{days\;in\;current\; year}}\;\mathrm{s}$, where $N_{\mathrm{days\;in\;current\; year}}$ may be 366 or 365 depending on whether the current year is a leap year or not.
+Near the surface, for $z>-H_{\mathrm{Age}}$, ideal age is relaxed back to zero:
+
 \begin{equation}
   \label{eq:TOP-age-surface}
    \mathrm{SMS_{\mathrm{Age}}} = -\lambda_{\mathrm{Age}}A,
- \end{equation}
- where the relaxation rate $\lambda_{\mathrm{Age}}$  (units $\mathrm{s}\;^{-1}$) is specified by the \textit{namage} namelist variable \textit{rn\_age\_kill\_rate} and has a default value of 1/7200~s. Since this relaxation is applied explicitly, this relaxation rate in principle should not exceed $1/\Delta t$, where $\Delta t$ is the time step used to step forward passive tracers (2 * \textit{nn\_dttrc * rn\_rdt} when the default  leapfrog time-stepping scheme is employed).
-
- Currently the 1-dimensional reference depth of the grid boxes is used rather than the dynamically evolving depth to determine whether the age tracer is incremented or relaxed to zero. This means that the tracer only works correctly in z-coordinates. To ensure that the forcing is independent of the level thicknesses, where the tracer cell at level $k$ has its upper face $z=-depw(k)$ above the depth $-H_{\mathrm{Age}}$, but its lower face $z=-depw(k+1)$ below that depth, then the age source
- \begin{equation}
+\end{equation}
+
+where the relaxation rate $\lambda_{\mathrm{Age}}$  (units $\mathrm{s}\;^{-1}$) is specified by the \textit{namage} namelist variable \textit{rn\_age\_kill\_rate} and has a default value of 1/7200~s.
+Since this relaxation is applied explicitly, this relaxation rate in principle should not exceed $1/\Delta t$, where $\Delta t$ is the time step used to step forward passive tracers (2 * \textit{nn\_dttrc * rn\_rdt} when the default  leapfrog time-stepping scheme is employed).
+
+Currently the 1-dimensional reference depth of the grid boxes is used rather than the dynamically evolving depth to determine whether the age tracer is incremented or relaxed to zero.
+This means that the tracer only works correctly in z-coordinates.
+To ensure that the forcing is independent of the level thicknesses, where the tracer cell at level $k$ has its upper face $z=-depw(k)$ above the depth $-H_{\mathrm{Age}}$, but its lower face $z=-depw(k+1)$ below that depth, then the age source
+
+\begin{equation}
   \label{eq:TOP-age-mixed}
    \mathrm{SMS_{\mathrm{Age}}} = -f_{\mathrm{kill}}\lambda_{\mathrm{Age}}A +f_{\mathrm{add}}/T_{\mathrm{year}} ,
- \end{equation}
- where
- \begin{align}
+\end{equation}
+
+where
+
+\begin{align}
     f_{\mathrm{kill}} &= e3t_k^{-1}(H_{\mathrm{Age}} - depw(k)) , \\
     f_{\mathrm{add}} &= 1 - f_{\mathrm{kill}}.
- \end{align}
-
-
- This implementation was first used in the CORE-II intercomparison runs described e.g.\ in \citet{danabasoglu_2014}.
+\end{align}
+
+
+This implementation was first used in the CORE-II intercomparison runs described e.g.\ in \citet{danabasoglu_2014}.
 
 \subsection{Inert carbons tracer}
@@ -155,10 +180,14 @@
 
 Chlorofluorocarbons 11 and 12 (CFC-11 and CFC-12), and sulfur hexafluoride (SF6), are synthetic chemicals manufactured for industrial and domestic applications from the early 20th century onwards.
-CFC-11 (CCl$_{3}$F) is a volatile liquid at room temperature, and was widely used in refrigeration. CFC-12 (CCl$_{2}$F$_{2}$) is a gas at room temperature, and, like CFC-11, was widely used as a refrigerant,
-and additionally as an aerosol propellant. SF6 (SF$_{6}$) is also a gas at room temperature, with a range of applications based around its property as an excellent electrical insulator (often replacing more toxic alternatives).
-All three are relatively inert chemicals that are both non-toxic and non-flammable, and their wide use has led to their accumulation within the Earth's atmosphere. Large-scale production of CFC-11 and CFC-12 began in the 1930s, while production of SF6 began in the 1950s, and their atmospheric concentration time-histories are shown in Figure \ref{img_cfcatm}.
+CFC-11 (CCl$_{3}$F) is a volatile liquid at room temperature, and was widely used in refrigeration.
+CFC-12 (CCl$_{2}$F$_{2}$) is a gas at room temperature, and, like CFC-11, was widely used as a refrigerant,
+and additionally as an aerosol propellant.
+SF6 (SF$_{6}$) is also a gas at room temperature, with a range of applications based around its property as an excellent electrical insulator (often replacing more toxic alternatives).
+All three are relatively inert chemicals that are both non-toxic and non-flammable, and their wide use has led to their accumulation within the Earth's atmosphere.
+Large-scale production of CFC-11 and CFC-12 began in the 1930s, while production of SF6 began in the 1950s, and their atmospheric concentration time-histories are shown in Figure \autoref{img_cfcatm}.
 As can be seen in the figure, while the concentration of SF6 continues to rise to the present  day, the concentrations of both CFC-11 and CFC-12 have levelled off and declined since around the 1990s.
 These declines have been driven by the Montreal Protocol (effective since August 1989), which has banned the production of CFC-11 and CFC-12 (as well as other CFCs) because of their role in the depletion of
-stratospheric ozone (O$_{3}$), critical in decreasing the flux of ultraviolet radiation to the Earth's surface. Separate to this role in ozone-depletion, all three chemicals are significantly more potent greenhouse gases
+stratospheric ozone (O$_{3}$), critical in decreasing the flux of ultraviolet radiation to the Earth's surface.
+Separate to this role in ozone-depletion, all three chemicals are significantly more potent greenhouse gases
 than CO$_{2}$ (especially SF6), although their relatively low atmospheric concentrations limit their role in climate change. \\
 
@@ -171,5 +200,5 @@
 % This release began in the 1930s for CFC-11 and CFC-12, and the 1950s for SF6, and
 % regularly increasing their atmospheric concentration until the 1090s, 2000s for respectively CFC11, CFC12,
-% and is still increasing, and SF6 (see Figure \ref{img_cfcatm}).  \\
+% and is still increasing, and SF6 (see Figure \autoref{img_cfcatm}).  \\
 
 The ocean is a notable sink for all three gases, and their relatively recent occurrence in the atmosphere, coupled to the ease of making high precision measurements of their dissolved concentrations, has made them
@@ -177,8 +206,10 @@
 Because they only enter the ocean via surface air-sea exchange, and are almost completely chemically and biologically inert, their distribution within the ocean interior reveals its ventilation via transport and mixing.
 Measuring the dissolved concentrations of the gases -- as well as the mixing ratios between them -- shows circulation pathways within the ocean as well as water mass ages (i.e. the time since last contact with the
-atmosphere). This feature of the gases has made them valuable across a wide range of oceanographic problems. One use lies in ocean modelling, where they can be used to evaluate the realism of the circulation and
+atmosphere).
+This feature of the gases has made them valuable across a wide range of oceanographic problems.
+One use lies in ocean modelling, where they can be used to evaluate the realism of the circulation and
 ventilation of models, key for understanding the behaviour of wider modelled marine biogeochemistry (e.g. \citep{dutay_2002,palmieri_2015}). \\
 
-Modelling these gases (henceforth CFCs) in NEMO is done within the passive tracer transport module, TOP, using the conservation state equation \ref{Eq_tracer}
+Modelling these gases (henceforth CFCs) in NEMO is done within the passive tracer transport module, TOP, using the conservation state equation \autoref{Eq_tracer}
 
 Advection and diffusion of the CFCs in NEMO are calculated by the physical module, OPA,
@@ -198,6 +229,6 @@
 \end{eqnarray}
 
-Where $K_{w}$ is the piston velocity (in m~s$^{-1}$), as defined in Equation \ref{equ_Kw};
-$C_{sat}$ is the saturation concentration of the CFC tracer, as defined in Equation \ref{equ_C_sat};
+Where $K_{w}$ is the piston velocity (in m~s$^{-1}$), as defined in Equation \autoref{equ_Kw};
+$C_{sat}$ is the saturation concentration of the CFC tracer, as defined in Equation \autoref{equ_C_sat};
 $C_{surf}$ is the local surface concentration of the CFC tracer within the model (in mol~m$^{-3}$);
 and $f_{i}$ is the fractional sea-ice cover of the local ocean (ranging between 0.0 for ice-free ocean,
@@ -211,5 +242,5 @@
 \end{eqnarray}
 
-Where $Sol$ is the gas solubility in mol~m$^{-3}$~pptv$^{-1}$, as defined in Equation \ref{equ_Sol_CFC};
+Where $Sol$ is the gas solubility in mol~m$^{-3}$~pptv$^{-1}$, as defined in Equation \autoref{equ_Sol_CFC};
 and $P_{cfc}$ is the atmosphere concentration of the CFC (in parts per trillion by volume, pptv).
 This latter concentration is provided to the model by the historical time-series of \citet{bullister_2017}.
@@ -231,5 +262,5 @@
 $a$ is a constant re-estimated by \citet{wanninkhof_2014} to 0.251 (in $\frac{cm~h^{-1}}{(m~s^{-1})^{2}}$);
 and $u$ is the 10~m wind speed in m~s$^{-1}$ from either an atmosphere model or reanalysis atmospheric forcing.
-$Sc$ is the Schmidt number, and is calculated as follow, using coefficients from \citet{wanninkhof_2014} (see Table \ref{tab_Sc}).
+$Sc$ is the Schmidt number, and is calculated as follow, using coefficients from \citet{wanninkhof_2014} (see Table \autoref{tab_Sc}).
 
 \begin{eqnarray}
@@ -238,5 +269,5 @@
 \end{eqnarray}
 
-The solubility, $Sol$, used in Equation \ref{equ_C_sat} is calculated in mol~l$^{-1}$~atm$^{-1}$,
+The solubility, $Sol$, used in Equation \autoref{equ_C_sat} is calculated in mol~l$^{-1}$~atm$^{-1}$,
 and is specific for each gas.
 It has been experimentally estimated by \citet{warner_1985} as a function of temperature
@@ -260,13 +291,13 @@
 
 Where $T_{X}$ is $\frac{T + 273.16}{100}$, a function of temperature;
-and the $a_{x}$ and $b_{x}$ coefficients are specific for each gas (see Table \ref{tab_ref_CFC}).
+and the $a_{x}$ and $b_{x}$ coefficients are specific for each gas (see Table \autoref{tab_ref_CFC}).
 This is then converted to mol~m$^{-3}$~pptv$^{-1}$ assuming a constant atmospheric surface pressure of 1~atm.
 The solubility of CFCs thus decreases with rising $T$ while being relatively insensitive to salinity changes.
-Consequently, this translates to a pattern of solubility where it is greatest in cold, polar regions (see Figure \ref{img_cfcsol}).
+Consequently, this translates to a pattern of solubility where it is greatest in cold, polar regions (see Figure \autoref{img_cfcsol}).
 
 % AXY: not 100% sure about the units below; they might be in nanomol, or in seconds or years
 
 The standard outputs of the CFC module are seawater CFC concentrations (in mol~m$^{-3}$), the net air-sea flux (in mol~m$^{-2}$~d$^{-1}$) and the cumulative net air-sea flux (in mol~m$^{-2}$).
-Using XIOS, it is possible to obtain outputs such as the vertical integral of CFC concentrations (in mol~m$^{-2}$; see Figure \ref{img_cfcinv}).
+Using XIOS, it is possible to obtain outputs such as the vertical integral of CFC concentrations (in mol~m$^{-2}$; see Figure \autoref{img_cfcinv}).
 This property, when divided by the surface CFC concentration, estimates the local penetration depth (in m) of the CFC.
 
@@ -285,5 +316,5 @@
 
 \begin{table}[!t]
-\caption{Coefficients for fit of the CFCs solubility (Eq. \ref{equ_Sol_CFC}).}
+\caption{Coefficients for fit of the CFCs solubility (Eq. \autoref{equ_Sol_CFC}).}
 \vskip4mm
 \centering
@@ -302,5 +333,5 @@
 
 \begin{table}[!t]
-\caption{Coefficients for fit of the CFCs Schmidt number (Eq. \ref{equ_Sc}). }
+\caption{Coefficients for fit of the CFCs Schmidt number (Eq. \autoref{equ_Sc}). }
 \vskip4mm
 \centering
@@ -353,19 +384,28 @@
 %----------------------------------------------------------------------------------------------------------
 
-The C14 package implemented in NEMO by Anne Mouchet models ocean $\Dcq$. It offers several possibilities: $\Dcq$ as a physical tracer of the ocean ventilation (natural $\cq$), assessment of bomb radiocarbon uptake, as well as transient studies of paleo-historical ocean radiocarbon distributions.
+The C14 package implemented in NEMO by Anne Mouchet models ocean $\Dcq$.
+It offers several possibilities: $\Dcq$ as a physical tracer of the ocean ventilation (natural $\cq$), assessment of bomb radiocarbon uptake, as well as transient studies of paleo-historical ocean radiocarbon distributions.
 
 \subsubsection{Method}
 
- Let  $\Rq$ represent the ratio of $\cq$ atoms to the total number of carbon atoms in the sample, i.e. $\cq/\mathrm{C}$. Then, radiocarbon anomalies are reported as
+Let  $\Rq$ represent the ratio of $\cq$ atoms to the total number of carbon atoms in the sample, i.e. $\cq/\mathrm{C}$.
+Then, radiocarbon anomalies are reported as
+
 \begin{equation}
 \Dcq = \left( \frac{\Rq}{\Rq_\mathrm{ref}} - 1 \right) 10^3, \label{eq:c14dcq}
 \end{equation}
-where $\Rq_{\textrm{ref}}$ is a reference ratio. For the purpose of ocean ventilation studies $\Rq_{\textrm{ref}}$ is set to one.
+
+where $\Rq_{\textrm{ref}}$ is a reference ratio.
+For the purpose of ocean ventilation studies $\Rq_{\textrm{ref}}$ is set to one.
 
 Here we adopt the approach of \cite{fiadeiro_1982} and \cite{toggweiler_1989a,toggweiler_1989b} in which  the ratio $\Rq$ is transported rather than the individual concentrations C and $\cq$.
-This approach calls for a strong assumption, i.e., that of a homogeneous and constant dissolved inorganic carbon (DIC) field \citep{toggweiler_1989a,mouchet_2013}. While in terms of
-oceanic $\Dcq$, it yields similar results to approaches involving carbonate chemistry, it underestimates the bomb radiocarbon inventory because it assumes a constant air-sea $\cd$ disequilibrium (Mouchet, 2013). Yet, field reconstructions of the ocean bomb $\cq$ inventory are also biased low \citep{naegler_2009} since they assume that the anthropogenic perturbation did not affect ocean DIC since the pre-bomb epoch. For these reasons, bomb $\cq$ inventories obtained with the present method are directly comparable to reconstructions based on field measurements.
-
-This simplified approach also neglects the effects of fractionation (e.g.,  air-sea exchange) and of biological processes. Previous studies by \cite{bacastow_1990} and \cite{joos_1997} resulted in nearly identical $\Dcq$ distributions among experiments considering biology or not.
+This approach calls for a strong assumption, i.e., that of a homogeneous and constant dissolved inorganic carbon (DIC) field \citep{toggweiler_1989a,mouchet_2013}.
+While in terms of
+oceanic $\Dcq$, it yields similar results to approaches involving carbonate chemistry, it underestimates the bomb radiocarbon inventory because it assumes a constant air-sea $\cd$ disequilibrium (Mouchet, 2013).
+Yet, field reconstructions of the ocean bomb $\cq$ inventory are also biased low \citep{naegler_2009} since they assume that the anthropogenic perturbation did not affect ocean DIC since the pre-bomb epoch.
+For these reasons, bomb $\cq$ inventories obtained with the present method are directly comparable to reconstructions based on field measurements.
+
+This simplified approach also neglects the effects of fractionation (e.g.,  air-sea exchange) and of biological processes.
+Previous studies by \cite{bacastow_1990} and \cite{joos_1997} resulted in nearly identical $\Dcq$ distributions among experiments considering biology or not.
 Since observed $\Rq$ ratios are corrected for the isotopic fractionation when converted to the standard $\Dcq$ notation \citep{stuiver_1977} the model results are directly comparable to observations.
 
@@ -373,28 +413,37 @@
 
 The equation governing the transport of $\Rq$  in the ocean is
+
 \begin{equation}
 \frac{\partial}{\partial t} {\Rq} =  - \bigtriangledown \cdot ( \mathbf{u} \Rq - \mathbf{K} \cdot \bigtriangledown \Rq )  - \lambda \Rq, \label{eq:quick}
 \end{equation}
+
 where $\lambda$ is the radiocarbon decay rate, ${\mathbf{u}}$ the 3-D velocity field, and $\mathbf{K}$ the diffusivity tensor.
 
-At the air-sea interface a Robin boundary condition \citep{haine_2006} is applied to \eqref{eq:quick}, i.e., the flux
+At the air-sea interface a Robin boundary condition \citep{haine_2006} is applied to \autoref{eq:quick}, i.e., the flux
 through the interface is proportional to the difference in the ratios between
 the ocean and the atmosphere
+
 \begin{equation}
 \mathcal{\!F} =  \kappa_{R}  (\Rq  - \Rq_{a} ), \label{eq:BCR}
 \end{equation}
-where $\mathcal{\!F}$ is the flux out of the ocean, and $\Rq_{a}$ is the atmospheric $\cq/\mathrm{C}$ ratio. The transfer velocity $ \kappa_{R} $ for the radiocarbon ratio in \eqref{eq:BCR} is computed as
+
+where $\mathcal{\!F}$ is the flux out of the ocean, and $\Rq_{a}$ is the atmospheric $\cq/\mathrm{C}$ ratio.
+The transfer velocity $ \kappa_{R} $ for the radiocarbon ratio in \autoref{eq:BCR} is computed as
+
 \begin{equation}
  \kappa_{R} =  \frac{\kappa_{\cd} K_0}{\overline{\Ct}} \, \pacd   \label{eq:Rspeed}
 \end{equation}
+
 with $\kappa_{\cd}$ the carbon dioxide transfer or piston velocity, $K_0$ the $\cd$ solubility in seawater, $\pacd$ the atmospheric $\cd$ pressure at sea level, and $\overline{\Ct}$ the average sea-surface dissolved inorganic carbon concentration.
 
-
-The $\cd$ transfer velocity is based on the empirical formulation of \cite{wanninkhof_1992} with chemical enhancement \citep{wanninkhof_1996,wanninkhof_2014}. The original formulation is modified to account for the reduction of the  air-sea exchange rate in the presence of sea ice. Hence
+The $\cd$ transfer velocity is based on the empirical formulation of \cite{wanninkhof_1992} with chemical enhancement \citep{wanninkhof_1996,wanninkhof_2014}.
+The original formulation is modified to account for the reduction of the  air-sea exchange rate in the presence of sea ice.
+Hence
+
 \begin{equation}
 \kappa_\cd=\left( K_W\,\mathrm{w}^2 + b  \right)\, (1-f_\mathrm{ice})\,\sqrt{660/Sc}, \label{eq:wanc14}
 \end{equation}
 with $\mathrm{w}$ the wind magnitude, $f_\mathrm{ice}$ the fractional ice cover, and $Sc$ the Schmidt number.
-$K_W$ in \eqref{eq:wanc14} is an empirical coefficient with dimension of an inverse velocity.
+$K_W$ in \autoref{eq:wanc14} is an empirical coefficient with dimension of an inverse velocity.
 The chemical enhancement term $b$ is represented as a function of temperature $T$ \citep{wanninkhof_1992}
 \begin{equation}
@@ -402,5 +451,5 @@
 \end{equation}
 
-%We compare the results of equilibrium and transient experiments obtained with both methods in section \ref{sec:UNDEU}.
+%We compare the results of equilibrium and transient experiments obtained with both methods in section \autoref{sec:UNDEU}.
 
 %
@@ -413,35 +462,41 @@
 \label{sec:param}
  %
-The radiocarbon decay rate (\CODE{rlam14}; in \texttt{trcnam\_c14} module) is set to $\lambda=(1/8267)$ yr$^{-1}$ \citep{stuiver_1977}, which corresponds to a half-life of 5730 yr.\\[1pt]
-%
-The Schmidt number $Sc$, Eq. \eqref{eq:wanc14}, is calculated with the help of the formulation of \cite{wanninkhof_2014}. The $\cd$ solubility $K_0$ in \eqref{eq:Rspeed} is taken from \cite{weiss_1974}. $K_0$ and $Sc$ are computed with the OGCM temperature and salinity fields (\texttt{trcsms\_c14} module).\\[1pt]
+The radiocarbon decay rate (\forcode{rlam14}; in \texttt{trcnam\_c14} module) is set to $\lambda=(1/8267)$ yr$^{-1}$ \citep{stuiver_1977}, which corresponds to a half-life of 5730 yr.\\[1pt]
+%
+The Schmidt number $Sc$, Eq. \autoref{eq:wanc14}, is calculated with the help of the formulation of \cite{wanninkhof_2014}.
+The $\cd$ solubility $K_0$ in \autoref{eq:Rspeed} is taken from \cite{weiss_1974}. $K_0$ and $Sc$ are computed with the OGCM temperature and salinity fields (\texttt{trcsms\_c14} module).\\[1pt]
 %
 The following parameters intervening in the air-sea exchange rate are set in \texttt{namelist\_c14}:
+
 \begin{itemize}
-\item The reference DIC concentration $\overline{\Ct}$ (\CODE{xdicsur}) intervening in \eqref{eq:Rspeed} is classically set to 2 mol m$^{-3}$ \citep{toggweiler_1989a,orr_2001,butzin_2005}.
-%
-\item The value of the empirical coefficient $K_W$ (\CODE{xkwind}) in \eqref{eq:wanc14} depends on the wind field and on the model upper ocean mixing rate \citep{toggweiler_1989a,wanninkhof_1992,naegler_2009,wanninkhof_2014}.
+\item The reference DIC concentration $\overline{\Ct}$ (\forcode{xdicsur}) intervening in \autoref{eq:Rspeed} is classically set to 2 mol m$^{-3}$ \citep{toggweiler_1989a,orr_2001,butzin_2005}.
+%
+\item The value of the empirical coefficient $K_W$ (\forcode{xkwind}) in \autoref{eq:wanc14} depends on the wind field and on the model upper ocean mixing rate \citep{toggweiler_1989a,wanninkhof_1992,naegler_2009,wanninkhof_2014}.
 It should be adjusted so that the globally averaged $\cd$ piston velocity is $\kappa_\cd = 16.5\pm 3.2$ cm/h \citep{naegler_2009}.
-%The sensitivity to this parametrization is discussed in section \ref{sec:result}.
-%
-\item Chemical enhancement (term $b$  in Eq. \ref{eq:wanchem}) may be set on/off by means of the logical variable \CODE{ln\_chemh}.
+%The sensitivity to this parametrization is discussed in section \autoref{sec:result}.
+%
+\item Chemical enhancement (term $b$  in Eq. \autoref{eq:wanchem}) may be set on/off by means of the logical variable \forcode{ln\_chemh}.
 \end{itemize}
 
 %
 \paragraph{Experiment type}
-The type of experiment is determined by the value given to \CODE{kc14typ} in \texttt{namelist\_c14}. There are three possibilities:
+The type of experiment is determined by the value given to \forcode{kc14typ} in \texttt{namelist\_c14}.
+There are three possibilities:
+
 \begin{enumerate}
-\item natural $\Dcq$: \CODE{kc14typ}=0
-\item bomb $\Dcq$: \CODE{kc14typ}=1
-\item transient paleo-historical $\Dcq$: \CODE{kc14typ}=2
+\item natural                    $\Dcq$: \forcode{kc14typ}=0
+\item bomb                       $\Dcq$: \forcode{kc14typ}=1
+\item transient paleo-historical $\Dcq$: \forcode{kc14typ}=2
 \end{enumerate}
-%
+
+% 
 \textbf{Natural or Equilibrium radiocarbon}
-\CODE{kc14typ}=0
-
-Unless otherwise specified in \texttt{namelist\_c14}, the atmospheric $\Rq_a$ (\CODE{rc14at}) is set to one, the atmospheric $\cd$ (\CODE{pco2at}) to 280 ppm, and the ocean $\Rq$ is initialized with \CODE{rc14init=0.85}, i.e., $\Dcq=$-150\textperthousand  \cite[typical for deep-ocean, Fig 6 in][]{key_2004}.
-
-Equilibrium experiment should last until 98\% of the ocean volume exhibit a drift of less than 0.001\textperthousand/year \citep{orr_2000}; this is usually achieved after few kyr (Fig. \ref{fig:drift}).
-%
+\forcode{kc14typ}=0
+
+Unless otherwise specified in \texttt{namelist\_c14}, the atmospheric $\Rq_a$ (\forcode{rc14at}) is set to one, the atmospheric $\cd$ (\forcode{pco2at}) to 280 ppm, and the ocean $\Rq$ is initialized with \forcode{rc14init=0.85}, i.e., $\Dcq=$-150\textperthousand \cite[typical for deep-ocean, Fig 6 in][]{key_2004}.
+
+Equilibrium experiment should last until 98\% of the ocean volume exhibit a drift of less than 0.001\textperthousand/year \citep{orr_2000}; this is usually achieved after few kyr (Fig. \autoref{fig:drift}).
+%
+
 \begin{figure}[!h]
 \begin{center}
@@ -449,10 +504,12 @@
 \end{center}
 \vspace{-4ex}
-\caption{ Time evolution of $\Rq$ inventory anomaly for equilibrium run with homogeneous ocean initial state. The anomaly (or drift) is given in \%  change in total ocean inventory per 50 years. Time on x-axis is in simulation year.\label{fig:drift} }
+\caption{ Time evolution of $\Rq$ inventory anomaly for equilibrium run with homogeneous ocean initial state.
+The anomaly (or drift) is given in \%  change in total ocean inventory per 50 years.
+Time on x-axis is in simulation year.\label{fig:drift} }
 \end{figure}
 
 \textbf{Transient: Bomb}
 \label{sec:bomb}
-\CODE{kc14typ}=1
+\forcode{kc14typ}=1
 
 \begin{figure}[!h]
@@ -461,27 +518,35 @@
 \end{center}
 \vspace{-4ex}
-\caption{Atmospheric $\Dcq$ (solid; left axis) and $\cd$ (dashed; right axis)  forcing for the $\cq$-bomb experiments. The $\Dcq$ is illustrated for the three zonal bands (upper, middle, and lower curves correspond to latitudes $> 20$N, $\in [20\mathrm{S},20\mathrm{N}]$, and $< 20$S, respectively.} \label{fig:bomb}
+\caption{Atmospheric $\Dcq$ (solid; left axis) and $\cd$ (dashed; right axis)  forcing for the $\cq$-bomb experiments.
+The $\Dcq$ is illustrated for the three zonal bands (upper, middle, and lower curves correspond to latitudes $> 20$N, $\in [20\mathrm{S},20\mathrm{N}]$, and $< 20$S, respectively.} \label{fig:bomb}
 \end{figure}
 
-Performing this type of experiment requires that a pre-industrial equilibrium run be performed beforehand (\CODE{ln\_rsttr} should be set to \texttt{.TRUE.}).
-
-An exception to this rule is when wishing to perform a perturbation bomb experiment as was possible with the package \texttt{C14b}. It is still possible to easily set-up that type of transient experiment for which no previous run is needed.  In addition to the instructions as given in this section it is however necessary to adapt the \texttt{atmc14.dat} file so that it does no longer contain any negative $\Dcq$ values (Suess effect in the pre-bomb period).
-
-The model  is integrated from a given initial date following the observed records provided from 1765 AD on ( Fig. \ref{fig:bomb}).
-The file \texttt{atmc14.dat}  \cite[][\& I. Levin, personal comm.]{enting_1994} provides atmospheric $\Dcq$ for three latitudinal bands: 90S-20S,    20S-20N \&    20N-90N.
-Atmospheric $\cd$ in the file \texttt{splco2.dat} is obtained from a spline fit through ice core data and direct atmospheric measurements \cite[][\& J. Orr, personal comm.]{orr_2000}.
+Performing this type of experiment requires that a pre-industrial equilibrium run be performed beforehand (\forcode{ln\_rsttr} should be set to \texttt{.TRUE.}).
+
+An exception to this rule is when wishing to perform a perturbation bomb experiment as was possible with the package \texttt{C14b}.
+It is still possible to easily set-up that type of transient experiment for which no previous run is needed.
+In addition to the instructions as given in this section it is however necessary to adapt the \texttt{atmc14.dat} file so that it does no longer contain any negative $\Dcq$ values (Suess effect in the pre-bomb period).
+
+The model  is integrated from a given initial date following the observed records provided from 1765 AD on ( Fig. \autoref{fig:bomb}).
+The file \texttt{atmc14.dat}  \cite[][\& I.
+Levin, personal comm.]{enting_1994} provides atmospheric $\Dcq$ for three latitudinal bands: 90S-20S,    20S-20N \&    20N-90N.
+Atmospheric $\cd$ in the file \texttt{splco2.dat} is obtained from a spline fit through ice core data and direct atmospheric measurements \cite[][\& J.
+Orr, personal comm.]{orr_2000}.
 Dates in these forcing files are expressed as yr AD.
 
 To ensure that the atmospheric forcing is applied properly as well as that output files contain consistent dates and inventories the experiment should be set up carefully:
+
 \begin{itemize}
-\item Specify the starting date of the experiment: \CODE{nn\_date0} in \texttt{namelist}.  \CODE{nn\_date0} is written as Year0101 where Year may take any positive value (AD).
-\item Then the parameters \CODE{nn\_rstctl} in  \texttt{namelist} (on-line) and \CODE{nn\_rsttr} in \texttt{namelist\_top} (off-line)  must be \textbf{set to 0} at the start of the experiment (force the date to \CODE{nn\_date0} for the \textbf{first} experiment year).
-\item These two parameters (\CODE{nn\_rstctl} and \CODE{nn\_rsttr}) have then to be \textbf{set to 2} for the following years (the date must be read in the restart file).
+\item Specify the starting date of the experiment: \forcode{nn\_date0} in \texttt{namelist}.  \forcode{nn\_date0} is written as Year0101 where Year may take any positive value (AD).
+\item Then the parameters \forcode{nn\_rstctl} in  \texttt{namelist} (on-line) and \forcode{nn\_rsttr} in \texttt{namelist\_top} (off-line)  must be \textbf{set to 0} at the start of the experiment (force the date to \forcode{nn\_date0} for the \textbf{first} experiment year).
+\item These two parameters (\forcode{nn\_rstctl} and \forcode{nn\_rsttr}) have then to be \textbf{set to 2} for the following years (the date must be read in the restart file).
 \end{itemize}
- If the experiment date is outside the data time span then the first or last atmospheric concentrations are prescribed depending on whether the date is earlier or later. Note that \CODE{tyrc14\_beg} (\texttt{namelist\_c14}) is not used in this context.
+
+If the experiment date is outside the data time span then the first or last atmospheric concentrations are prescribed depending on whether the date is earlier or later.
+Note that \forcode{tyrc14\_beg} (\texttt{namelist\_c14}) is not used in this context.
 
 %
 \textbf{Transient: Past}
-\CODE{kc14typ}=2
+\forcode{kc14typ}=2
 %
 \begin{figure}[!h]
@@ -490,43 +555,52 @@
 \end{center}
 \vspace{-4ex}
-\caption{Atmospheric $\Dcq$ (solid) and $\cd$ (dashed)  forcing for the Paleo experiments. The $\cd$ scale is given on the right axis.} \label{fig:paleo}
+\caption{Atmospheric $\Dcq$ (solid) and $\cd$ (dashed)  forcing for the Paleo experiments.
+The $\cd$ scale is given on the right axis.} \label{fig:paleo}
 \end{figure}
 
-This experiment type does not need a previous equilibrium run. It should start 5--6 kyr earlier than the period to be analyzed.
-Atmospheric $\Rq_a$ and $\cd$ are prescribed from forcing files. The ocean $\Rq$ is initialized with the value attributed to \CODE{rc14init} in \texttt{namelist\_c14}.
+This experiment type does not need a previous equilibrium run.
+It should start 5--6 kyr earlier than the period to be analyzed.
+Atmospheric $\Rq_a$ and $\cd$ are prescribed from forcing files.
+The ocean $\Rq$ is initialized with the value attributed to \forcode{rc14init} in \texttt{namelist\_c14}.
 
 The file \texttt{intcal13.14c} \citep{reimer_2013} contains atmospheric $\Dcq$ from 0 to 50 kyr cal BP\footnote{cal BP: number of years before 1950 AD}.
-The $\cd$ forcing is provided in file \texttt{ByrdEdcCO2.txt}. The content of this file is based on  the high resolution record from EPICA Dome C \citep{monnin_2004} for the Holocene and the Transition, and on Byrd Ice Core CO2 Data for 20--90 kyr BP  \citep{ahn_2008}. These atmospheric values are reproduced in Fig. \ref{fig:paleo}. Dates in these files are expressed as yr BP.
+The $\cd$ forcing is provided in file \texttt{ByrdEdcCO2.txt}.
+The content of this file is based on  the high resolution record from EPICA Dome C \citep{monnin_2004} for the Holocene and the Transition, and on Byrd Ice Core CO2 Data for 20--90 kyr BP  \citep{ahn_2008}.
+These atmospheric values are reproduced in Fig. \autoref{fig:paleo}.
+Dates in these files are expressed as yr BP.
 
 To ensure that the atmospheric forcing is applied properly as well as that output files contain consistent dates and inventories the experiment should be set up carefully.
-The true experiment starting date is given by \CODE{tyrc14\_beg} (in yr BP) in \texttt{namelist\_c14}. In consequence, \CODE{nn\_date0} in \texttt{namelist} MUST be set to 00010101.\\
-Then the parameters \CODE{nn\_rstctl} in  \texttt{namelist} (on-line) and \CODE{nn\_rsttr} in \texttt{namelist\_top} (off-line)  must be set to 0 at the start of the experiment (force the date to \CODE{nn\_date0} for the first experiment year). These two parameters have then to be set to 2 for the following years (read the date in the restart file). \\
- If the experiment date is outside the data time span then the first or last atmospheric concentrations are prescribed depending on whether the date is earlier or later.
+The true experiment starting date is given by \forcode{tyrc14\_beg} (in yr BP) in \texttt{namelist\_c14}.
+In consequence, \forcode{nn\_date0} in \texttt{namelist} MUST be set to 00010101.\\
+Then the parameters \forcode{nn\_rstctl} in  \texttt{namelist} (on-line) and \forcode{nn\_rsttr} in \texttt{namelist\_top} (off-line)  must be set to 0 at the start of the experiment (force the date to \forcode{nn\_date0} for the first experiment year).
+These two parameters have then to be set to 2 for the following years (read the date in the restart file). \\
+If the experiment date is outside the data time span then the first or last atmospheric concentrations are prescribed depending on whether the date is earlier or later.
 
 %
 \paragraph{Model output}
 \label{sec:output}
-All output fields in Table \ref{tab:out} are routinely computed. It depends on the actual settings in \texttt{iodef.xml} whether they are stored or not.
+
+All output fields in Table \autoref{tab:out} are routinely computed.
+It depends on the actual settings in \texttt{iodef.xml} whether they are stored or not.
 %
 \begin{table}[!h]
 \begin{center}
-\caption{Standard output fields for the C14 package \label{tab:out}.
-}
+\caption{Standard output fields for the C14 package \label{tab:out}.}
 %\begin{small}
 \renewcommand{\arraystretch}{1.3}%
 \begin{tabular}[h]{|l*{3}{|c}|l|}
 \hline
-Field & Type & Dim & Units & Description \\ \hline
-RC14 & ptrc & 3-D & -        & Radiocarbon ratio \\
-DeltaC14 & diad & 3-D & \textperthousand & $\Dcq$\\
-C14Age & diad & 3-D & yr &   Radiocarbon age \\
-RAge & diad & 2-D & yr & Reservoir age\\
-qtr\_c14 &  diad & 2-D & m$^{-2}$ yr$^{-1}$ & Air-to-sea net $\Rq$ flux\\
-qint\_c14 & diad & 2-D &   m$^{-2}$ &  Cumulative air-to-sea $\Rq$ flux \\
-AtmCO2 & scalar & 0-D & ppm & Global atmospheric $\cd$ \\
-AtmC14 & scalar & 0-D & \textperthousand  & Global atmospheric $\Dcq$\\
-K\_CO2 & scalar & 0-D & cm h$^{-1}$  & Global $\cd$ piston velocity ($ \overline{\kappa_{\cd}}$) \\
-K\_C14 & scalar & 0-D &m yr$^{-1}$ & Global $\Rq$ transfer velocity  ($ \overline{\kappa_R}$)\\
-C14Inv & scalar & 0-D & $10^{26}$ atoms & Ocean radiocarbon inventory \\ \hline
+Field     & Type   & Dim & Units              & Description                                               \\ \hline
+RC14      & ptrc   & 3-D & -                  & Radiocarbon ratio                                         \\
+DeltaC14  & diad   & 3-D & \textperthousand   & $\Dcq$                                                    \\
+C14Age    & diad   & 3-D & yr                 & Radiocarbon age                                           \\
+RAge      & diad   & 2-D & yr                 & Reservoir age                                             \\
+qtr\_c14  & diad   & 2-D & m$^{-2}$ yr$^{-1}$ & Air-to-sea net $\Rq$ flux                                 \\
+qint\_c14 & diad   & 2-D & m$^{-2}$           & Cumulative air-to-sea $\Rq$ flux                          \\
+AtmCO2    & scalar & 0-D & ppm                & Global atmospheric $\cd$                                  \\
+AtmC14    & scalar & 0-D & \textperthousand   & Global atmospheric $\Dcq$                                 \\
+K\_CO2    & scalar & 0-D & cm h$^{-1}$        & Global $\cd$ piston velocity ($ \overline{\kappa_{\cd}}$) \\
+K\_C14    & scalar & 0-D & m yr$^{-1}$        & Global $\Rq$ transfer velocity  ($ \overline{\kappa_R}$)  \\
+C14Inv    & scalar & 0-D & $10^{26}$ atoms    & Ocean radiocarbon inventory                               \\ \hline
 \end{tabular}
 %\end{small}
@@ -539,20 +613,30 @@
 The radiocarbon age is computed as  $(-1/\lambda) \ln{ \left( \Rq \right)}$, with zero age corresponding to $\Rq=1$.
 
-The reservoir age is the age difference between the ocean uppermost layer and the atmosphere. It is usually reported as conventional radiocarbon age; i.e., computed by means of the Libby radiocarbon mean life \cite[8033 yr;][]{stuiver_1977}
+The reservoir age is the age difference between the ocean uppermost layer and the atmosphere.
+It is usually reported as conventional radiocarbon age; i.e., computed by means of the Libby radiocarbon mean life \cite[8033 yr;][]{stuiver_1977}
+
 \begin{align}
 {^{14}\tau_\mathrm{c}}= -8033 \; \ln \left(1 + \frac{\Dcq}{10^3}\right), \label{eq:convage}
 \end{align}
-where ${^{14}\tau_\mathrm{c}}$ is expressed in years B.P. Here we do not use that convention and compute reservoir ages with the mean lifetime $1/\lambda$. Conversion from one scale to the other is readily performed. The conventional radiocarbon age is lower than the radiocarbon age by $\simeq3\%$.
+
+where ${^{14}\tau_\mathrm{c}}$ is expressed in years B.P.
+Here we do not use that convention and compute reservoir ages with the mean lifetime $1/\lambda$.
+Conversion from one scale to the other is readily performed.
+The conventional radiocarbon age is lower than the radiocarbon age by $\simeq3\%$.
 
 The ocean radiocarbon  inventory is computed as
+
 \begin{equation}
 N_A \Rq_\mathrm{oxa} \overline{\Ct} \left( \int_\Omega \Rq d\Omega \right) /10^{26}, \label{eq:inv}
 \end{equation}
-where $N_A$ is the Avogadro's number ($N_A=6.022\times10^{23}$ at/mol), $\Rq_\mathrm{oxa}$ is the oxalic acid radiocarbon standard \cite[$\Rq_\mathrm{oxa}=1.176\times10^{-12}$;][]{stuiver_1977}, and $\Omega$ is the ocean volume.  Bomb $\cq$ inventories are traditionally reported in units of $10^{26}$ atoms, hence the denominator in \eqref{eq:inv}.
-
-All transformations from second to year, and inversely, are performed with the help of the physical constant \CODE{rsiyea} the sideral year length expressed in seconds\footnote{The variable (\CODE{nyear\_len}) which reports the length in days of the previous/current/future year (see \textrm{oce\_trc.F90}) is not a constant. }.
+
+where $N_A$ is the Avogadro's number ($N_A=6.022\times10^{23}$ at/mol), $\Rq_\mathrm{oxa}$ is the oxalic acid radiocarbon standard \cite[$\Rq_\mathrm{oxa}=1.176\times10^{-12}$;][]{stuiver_1977}, and $\Omega$ is the ocean volume.
+Bomb $\cq$ inventories are traditionally reported in units of $10^{26}$ atoms, hence the denominator in \autoref{eq:inv}.
+
+All transformations from second to year, and inversely, are performed with the help of the physical constant \forcode{rsiyea} the sideral year length expressed in seconds\footnote{The variable (\forcode{nyear\_len}) which reports the length in days of the previous/current/future year (see \textrm{oce\_trc.F90}) is not a constant. }.
 
 The global transfer velocities represent time-averaged\footnote{the actual duration is set in \texttt{iodef.xml}} global integrals of the transfer rates:
- \begin{equation}
+
+\begin{equation}
  \overline{\kappa_{\cd}}= \int_\mathcal{S} \kappa_{\cd} d\mathcal{S}  \text{ and } \overline{\kappa_R}= \int_\mathcal{S} \kappa_R d\mathcal{S}
 \end{equation}
@@ -561,19 +645,41 @@
 \subsection{PISCES biogeochemical model}
 
-PISCES is a biogeochemical model which simulates the lower trophic levels of marine ecosystem (phytoplankton, microzooplankton and mesozooplankton) and the biogeochemical cycles of carbonand of the main nutrients (P, N, Fe, and Si). The  model is intended to be used for both regional and global configurations at high or low spatial resolutions as well as for  short-term (seasonal, interannual) and long-term (climate change, paleoceanography) analyses.
+PISCES is a biogeochemical model which simulates the lower trophic levels of marine ecosystem (phytoplankton, microzooplankton and mesozooplankton) and the biogeochemical cycles of carbonand of the main nutrients (P, N, Fe, and Si).
+The  model is intended to be used for both regional and global configurations at high or low spatial resolutions as well as for  short-term (seasonal, interannual) and long-term (climate change, paleoceanography) analyses.
 Two versions of PISCES are available in NEMO v4.0 :
 
-PISCES-v2, by setting in namelist\_pisces\_ref  \np{ln\_p4z} to true,  can be seen as one of the many Monod models \citep{monod_1958}. It assumes a constant Redfield ratio and phytoplankton growth depends on the external concentration in nutrients. There are twenty-four prognostic variables (tracers) including two phytoplankton compartments  (diatoms and nanophytoplankton), two zooplankton size-classes (microzooplankton and  mesozooplankton) and a description of the carbonate chemistry. Formulations in PISCES-v2 are based on a mixed Monod/Quota formalism: On one hand, stoichiometry of C/N/P is fixed and growth rate of phytoplankton is limited by the external availability in N, P and Si. On the other hand, the iron and silicium quotas are variable and growth rate of phytoplankton is limited by the internal availability in Fe. Various parameterizations can be activated in PISCES-v2, setting for instance the complexity of iron chemistry or the description of particulate organic materials.
-
-PISCES-QUOTA has been built on the PISCES-v2 model described in \citet{aumont_2015}. PISCES-QUOTA has thirty-nine prognostic compartments. Phytoplankton growth can be controlled by five modeled limiting nutrients: Nitrate and Ammonium, Phosphate, Silicate and Iron. Five living compartments are represented: Three phytoplankton size classes/groups corresponding to picophytoplankton, nanophytoplankton and diatoms, and two zooplankton size classes which are microzooplankton and mesozooplankton. For phytoplankton, the prognostic variables are the carbon, nitrogen, phosphorus,  iron, chlorophyll and silicon biomasses (the latter only for diatoms). This means that the N/C, P/C, Fe/C and Chl/C ratios of both phytoplankton groups as well as the Si/C ratio of diatoms are prognostically predicted  by the model. Zooplankton are assumed to be strictly homeostatic \citep[e.g.,][]{sterner_2003,woods_2013,meunier_2014}. As a consequence, the C/N/P/Fe ratios of these groups are maintained constant and are not allowed to vary. In PISCES, the Redfield ratios C/N/P are set to 122/16/1 \citep{takahashi_1985} and the -O/C ratio is set to 1.34 \citep{kortzinger_2001}. No silicified zooplankton is assumed. The bacterial pool is not yet explicitly modeled.
-
-There are three non-living compartments: Semi-labile dissolved organic matter, small sinking particles, and large sinking particles. As a consequence of the variable stoichiometric ratios of phytoplankton and of the stoichiometric regulation of zooplankton, elemental ratios in organic matter cannot be supposed constant anymore as that was the case in PISCES-v2. Indeed, the nitrogen, phosphorus, iron, silicon and calcite pools of the particles are now all explicitly modeled. The sinking speed of the particles is not altered by their content in calcite and biogenic silicate (''The ballast effect'', \citep{honjo_1996,armstrong_2001}). The latter particles are assumed to sink at the same speed as the large organic matter particles. All the non-living compartments experience aggregation due to turbulence and differential settling as well as Brownian coagulation for DOM.
-
+PISCES-v2, by setting in namelist\_pisces\_ref  \np{ln\_p4z} to true,  can be seen as one of the many Monod models \citep{monod_1958}.
+It assumes a constant Redfield ratio and phytoplankton growth depends on the external concentration in nutrients.
+There are twenty-four prognostic variables (tracers) including two phytoplankton compartments  (diatoms and nanophytoplankton), two zooplankton size-classes (microzooplankton and  mesozooplankton) and a description of the carbonate chemistry.
+Formulations in PISCES-v2 are based on a mixed Monod/Quota formalism: On one hand, stoichiometry of C/N/P is fixed and growth rate of phytoplankton is limited by the external availability in N, P and Si.
+On the other hand, the iron and silicium quotas are variable and growth rate of phytoplankton is limited by the internal availability in Fe.
+Various parameterizations can be activated in PISCES-v2, setting for instance the complexity of iron chemistry or the description of particulate organic materials.
+
+PISCES-QUOTA has been built on the PISCES-v2 model described in \citet{aumont_2015}.
+PISCES-QUOTA has thirty-nine prognostic compartments.
+Phytoplankton growth can be controlled by five modeled limiting nutrients: Nitrate and Ammonium, Phosphate, Silicate and Iron.
+Five living compartments are represented: Three phytoplankton size classes/groups corresponding to picophytoplankton, nanophytoplankton and diatoms, and two zooplankton size classes which are microzooplankton and mesozooplankton.
+For phytoplankton, the prognostic variables are the carbon, nitrogen, phosphorus,  iron, chlorophyll and silicon biomasses (the latter only for diatoms).
+This means that the N/C, P/C, Fe/C and Chl/C ratios of both phytoplankton groups as well as the Si/C ratio of diatoms are prognostically predicted  by the model.
+Zooplankton are assumed to be strictly homeostatic \citep[e.g.,][]{sterner_2003,woods_2013,meunier_2014}.
+As a consequence, the C/N/P/Fe ratios of these groups are maintained constant and are not allowed to vary.
+In PISCES, the Redfield ratios C/N/P are set to 122/16/1 \citep{takahashi_1985} and the -O/C ratio is set to 1.34 \citep{kortzinger_2001}.
+No silicified zooplankton is assumed.
+The bacterial pool is not yet explicitly modeled.
+
+There are three non-living compartments: Semi-labile dissolved organic matter, small sinking particles, and large sinking particles.
+As a consequence of the variable stoichiometric ratios of phytoplankton and of the stoichiometric regulation of zooplankton, elemental ratios in organic matter cannot be supposed constant anymore as that was the case in PISCES-v2.
+Indeed, the nitrogen, phosphorus, iron, silicon and calcite pools of the particles are now all explicitly modeled.
+The sinking speed of the particles is not altered by their content in calcite and biogenic silicate (''The ballast effect'', \citep{honjo_1996,armstrong_2001}).
+The latter particles are assumed to sink at the same speed as the large organic matter particles.
+All the non-living compartments experience aggregation due to turbulence and differential settling as well as Brownian coagulation for DOM.
 
 \subsection{MY\_TRC interface for coupling external BGC models}
 \label{Mytrc}
 
-The NEMO-TOP has only one built-in biogeochemical model - PISCES - but there are several BGC models - MEDUSA, ERSEM, BFM or ECO3M - which are meant to be coupled with the NEMO dynamics. Therefore it was necessary to provide to the users a framework for easily add their own BGCM model, that can be a single passive tracer.
-The generalized interface is pivoted on MY\_TRC module that contains template files to build the coupling between NEMO and any external BGC model. The call to MY\_TRC is activated by setting  \textit{ln\_my\_trc} = \texttt{.true.} in namelist \textit{namtrc}
+The NEMO-TOP has only one built-in biogeochemical model - PISCES - but there are several BGC models - MEDUSA, ERSEM, BFM or ECO3M - which are meant to be coupled with the NEMO dynamics.
+Therefore it was necessary to provide to the users a framework for easily add their own BGCM model, that can be a single passive tracer.
+The generalized interface is pivoted on MY\_TRC module that contains template files to build the coupling between NEMO and any external BGC model.
+The call to MY\_TRC is activated by setting  \textit{ln\_my\_trc} = \texttt{.true.} in namelist \textit{namtrc}
 
 The following 6 fortran files are available in MY\_TRC with the specific purposes here described.
@@ -581,11 +687,15 @@
 \begin{itemize}
    \item \textit{par\_my\_trc.F90} :  This module allows to define additional arrays and public variables to be used within the MY\_TRC interface
-   \item \textit{trcini\_my\_trc.F90} :  Here are initialized user defined namelists and the call to the external BGC model initialization procedures to populate general tracer array (trn and trb). Here are also likely to be defined suport arrays related to system metrics that could be needed by the BGC model.
+   \item \textit{trcini\_my\_trc.F90} :  Here are initialized user defined namelists and the call to the external BGC model initialization procedures to populate general tracer array (trn and trb).
+Here are also likely to be defined suport arrays related to system metrics that could be needed by the BGC model.
   \item \textit{trcnam\_my\_trc.F90} :  This routine is called at the beginning of trcini\_my\_trc and should contain the initialization of additional namelists for the BGC model or user-defined code.
-  \item \textit{trcsms\_my\_trc.F90} :  The routine performs the call to Boundary Conditions and its main purpose is to contain the Source-Minus-Sinks terms due to the biogeochemical processes of the external model. Be aware that lateral boundary conditions are applied in trcnxt routine. IMPORTANT: the routines to compute the light penetration along the water column and the tracer vertical sinking should be defined/called in here, as generalized modules are still missing in the code.
- \item \textit{trcice\_my\_trc.F90} : Here it is possible to prescribe the tracers concentrations in the seaice that will be used as boundary conditions when ice melting occurs (nn\_ice\_tr =1 in namtrc\_ice). See e.g. the correspondent PISCES subroutine.
- \item \textit{trcwri\_my\_trc.F90} : This routine performs the output of the model tracers using IOM module (see Manual Chapter Output and Diagnostics). It is possible to place here the output of additional variables produced by the model, if not done elsewhere in the code, using the call to \textit{iom\_put}.
+  \item \textit{trcsms\_my\_trc.F90} :  The routine performs the call to Boundary Conditions and its main purpose is to contain the Source-Minus-Sinks terms due to the biogeochemical processes of the external model.
+Be aware that lateral boundary conditions are applied in trcnxt routine.
+IMPORTANT: the routines to compute the light penetration along the water column and the tracer vertical sinking should be defined/called in here, as generalized modules are still missing in the code.
+ \item \textit{trcice\_my\_trc.F90} : Here it is possible to prescribe the tracers concentrations in the seaice that will be used as boundary conditions when ice melting occurs (nn\_ice\_tr =1 in namtrc\_ice).
+See e.g. the correspondent PISCES subroutine.
+ \item \textit{trcwri\_my\_trc.F90} : This routine performs the output of the model tracers using IOM module (see Manual Chapter Output and Diagnostics).
+It is possible to place here the output of additional variables produced by the model, if not done elsewhere in the code, using the call to \textit{iom\_put}.
 \end{itemize}
-
 
 \section{The Offline Option}
@@ -596,9 +706,12 @@
 %-------------------------------------------------------------------------------------------------------------
 
-Coupling passive tracers offline with NEMO requires precomputed  physical fields from OGCM. Those fields are read from files and interpolated on-the-fly at each model time step
+Coupling passive tracers offline with NEMO requires precomputed  physical fields from OGCM.
+Those fields are read from files and interpolated on-the-fly at each model time step
 At least the following dynamical parameters should be absolutely passed to the transport : ocean velocities, temperature, salinity, mixed layer depth and for ecosystem models like PISCES, sea ice concentration, short wave radiation at the ocean surface, wind speed (or at least, wind stress).
 The so-called offline mode is useful since it has lower computational costs for example to perform very longer simulations - about 3000 years - to reach equilibrium of CO2 sinks for climate-carbon studies.
 
-The offline interface is located in the code repository : \path{<repository>/src/OFF/}. It is activated by adding the CPP key  \textit{key\_offline} to the CPP keys list. There are two specifics routines for the Offline code :
+The offline interface is located in the code repository : \path{<repository>/src/OFF/}.
+It is activated by adding the CPP key  \textit{key\_offline} to the CPP keys list.
+There are two specifics routines for the Offline code :
 
 \begin{itemize}
@@ -606,5 +719,4 @@
    \item \textit{nemogcm.F90} :  a degraded version of the main nemogcm.F90 code of NEMO to manage the time-stepping
 \end{itemize}
-
 
 %-
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/document.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/document.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/document.tex	(revision 14676)
@@ -7,6 +7,6 @@
 
 %% Layout
-%\documentclass[fontsize=10pt,twoside,abstract,draft]{scrreprt}
-\documentclass[fontsize=10pt,twoside,abstract      ]{scrreprt}
+\documentclass[fontsize=10pt,twoside,abstract,draft]{scrreprt}
+%\documentclass[fontsize=10pt,twoside,abstract      ]{scrreprt}
 
 %% Overall configuration 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/highlighting.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/highlighting.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/highlighting.tex	(revision 14676)
@@ -30,9 +30,3 @@
 %% Namelists inclusion
 \newcommand{\nlst}[1]{\forfile{../../../namelists/#1}}
-%\newcommand{\nlst}[1]{
-%   \begin{listing}
-%      \newmintedfile{fortran}{../../../namelists/#1}
-%      \caption{\forcode{&#1}}
-%      \label{lst:#1}
-%   \end{listing}
-%}
+
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/latexmk.pl
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/latexmk.pl	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/latexmk.pl	(revision 14676)
@@ -9,5 +9,9 @@
 
 ## Custom cmds
-set_tex_cmds('-shell-escape -interaction=batchmode');
-#set_tex_cmds('-shell-escape');
-$makeindex = 'makeindex -s %R.ist %O -o %D %S';
+set_tex_cmds('-shell-escape -file-line-error -interaction=nonstopmode');
+#set_tex_cmds('-shell-escape -file-line-error');
+$makeindex = 'makeindex %O -s %R.ist -o %D %S';
+## %D: Destination file (.ind for index)
+## %O: Options
+## %R: Root filename (${model}_manual)
+## %S: Source file      (.idx for index)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/new_cmds.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/new_cmds.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/new_cmds.tex	(revision 14676)
@@ -57,8 +57,13 @@
 }
 
-%% Workaround for \listoffigures issue
-\DeclareRobustCommand{\triad}[6]{
-  \ensuremath{{}_{#2}^{#3}{\mathbb{#4}_{#1}}_{#5}^{\,#6}}
-}
+%% Custom aliases
+\newcommand{\cf}{\ensuremath{C\kern-0.14em f}}
+\newcommand{\rML}[1][i]{\ensuremath{_{\mathrm{ML}\,#1}}}
+\newcommand{\rMLt}[1][i]{\tilde{r}_{\mathrm{ML}\,#1}}
+\newcommand{\triad}[6][]{\ensuremath{{}_{#2}^{#3}{\mathbb{#4}_{#1}}_{#5}^{\,#6}}}
+\newcommand{\triadd}[5]{\ensuremath{{}_{#1}^{#2}{\mathbb{#3}}_{#4}^{\,#5}}}
+\newcommand{\triadt}[5]{\ensuremath{{}_{#1}^{#2}{\tilde{\mathbb{#3}}}_{#4}^{\,#5}}}
+\newcommand{\rtriad}[2][]{\ensuremath{\triad[#1]{i}{k}{#2}{i_p}{k_p}}}
+\newcommand{\rtriadt}[1]{\ensuremath{\triadt{i}{k}{#1}{i_p}{k_p}}}
 
 %% New command for ToC (?)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/styles.tex
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/styles.tex	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/latex/global/styles.tex	(revision 14676)
@@ -10,6 +10,5 @@
 %% Cover page
 \backgroundsetup{
-   firstpage=true,scale  =1,
-   angle    =0   ,opacity=1,
+   firstpage=true,scale=1,angle=0,opacity=1,
    contents ={
       \begin{tikzpicture}[remember picture,overlay]
@@ -22,5 +21,5 @@
 %\pagestyle{scrheadings}
 %\renewcommand{\chapterpagestyle}{empty}
-\renewcommand{\chaptermark}[1]{ \markboth{#1}{}} %% Convert mark to lowercase
+\renewcommand{\chaptermark}[1]{\markboth{ #1}{}} %% Convert mark to lowercase
 \renewcommand{\sectionmark}[1]{\markright{#1}{}} %%    "     ""  ""     "  
 \ohead{} %% Clear default headings
@@ -37,10 +36,7 @@
 %% Cross-referencing
 \hypersetup{
-   pdftitle=\hdg                                          ,
-   pdfauthor=Gurvan Madec and NEMO System Team            ,
-   pdfsubject=Reference manual of NEMO modelling framework,
-   pdfkeywords=ocean circulation modelling                ,
-   colorlinks                                             ,
-   allcolors=manclr
+   pdftitle=\hdg,pdfauthor=Gurvan Madec and NEMO System Team,
+   pdfsubject=Reference manual of NEMO modelling framework,pdfkeywords=ocean circulation modelling,
+   colorlinks,allcolors=manclr
 }
 \renewcommand{\appendixautorefname}{appendix}          %% `\autoref` uncapitalization
@@ -63,6 +59,4 @@
 %% Catcodes (between `\makeatletter` and `\makeatother`)
 \makeatletter
-
-%\global\let\tikz@ensure@dollar@catcode=\relax %% Prevent error with tikz and namelist inclusion
 
 %% Apply manual color for chap. headings (original snippets from fncychap.sty)
@@ -93,14 +87,3 @@
 }
 
-%% Temporary fix?
-%\def\set@curr@file#1{
-%  \begingroup
-%    \escapechar\m@ne
-%    \xdef\@curr@file{\expandafter\string\csname #1\endcsname}
-%  \endgroup
-%}
-%\def\quote@name#1{"\quote@@name#1\@gobble""}
-%\def\quote@@name#1"{#1\quote@@name}
-%\def\unquote@name#1{\quote@@name#1\@gobble"}
-
 \makeatother
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/conf.py
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/conf.py	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/conf.py	(revision 14676)
@@ -43,5 +43,5 @@
 # General information about the project.
 project = u'NEMO'
-copyright = u'2019, NEMO Consortium'
+copyright = u'2020, NEMO Consortium'
 
 # The version info for the project you're documenting, acts as replacement for
@@ -50,5 +50,5 @@
 #
 # The short X.Y version.
-version = 'trk'
+version = 'trunk'
 # The full version, including alpha/beta/rc tags.
 release = 'trunk'
@@ -279,2 +279,5 @@
 # Default language to highlight set to fortran
 highlight_language = 'fortran'
+
+# Extra setting for sphinxcontrib.bibtex upgrade to 2.X.X branche
+bibtex_bibfiles = ['cfgs.bib', 'ref.bib', 'tests.bib', 'zooms.bib']
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/guide.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/guide.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/doc/rst/source/guide.rst	(revision 14676)
@@ -16,5 +16,6 @@
 .. toctree::
    :hidden:
-.. todos::
+
+   todos
 
 .. Only displayed with 'make drafthtml'
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablmod.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablmod.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablmod.F90	(revision 14676)
@@ -534,6 +534,6 @@
       !                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
       !
-      CALL lbc_lnk_multi( 'ablmod',  u_abl(:,:,:,nt_a      ), 'T', -1._wp,  v_abl(:,:,:,nt_a)      , 'T', -1._wp                            )
-      CALL lbc_lnk_multi( 'ablmod', tq_abl(:,:,:,nt_a,jp_ta), 'T', 1._wp , tq_abl(:,:,:,nt_a,jp_qa), 'T',  1._wp , kfillmode = jpfillnothing )   ! ++++ this should not be needed...
+      CALL lbc_lnk( 'ablmod',  u_abl(:,:,:,nt_a      ), 'T', -1._wp,  v_abl(:,:,:,nt_a)      , 'T', -1._wp                            )
+      CALL lbc_lnk( 'ablmod', tq_abl(:,:,:,nt_a,jp_ta), 'T', 1._wp , tq_abl(:,:,:,nt_a,jp_qa), 'T',  1._wp , kfillmode = jpfillnothing )   ! ++++ this should not be needed...
       !
 #if defined key_xios
@@ -600,5 +600,5 @@
       END_2D
       !
-      CALL lbc_lnk_multi( 'ablmod', zwnd_i(:,:) , 'T', -1.0_wp, zwnd_j(:,:) , 'T', -1.0_wp )
+      CALL lbc_lnk( 'ablmod', zwnd_i(:,:) , 'T', -1.0_wp, zwnd_j(:,:) , 'T', -1.0_wp )
       !
       ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked)
@@ -625,5 +625,5 @@
       END_2D
       !
-      CALL lbc_lnk_multi( 'ablmod', ptaui(:,:), 'U', -1.0_wp, ptauj(:,:), 'V', -1.0_wp )
+      CALL lbc_lnk( 'ablmod', ptaui(:,:), 'U', -1.0_wp, ptauj(:,:), 'V', -1.0_wp )
 
       CALL iom_put( "taum_oce", ptaum )
@@ -645,5 +645,5 @@
             &                      * ( 0.5_wp * ( v_abl(ji,jj+1,2,nt_a) + v_abl(ji,jj,2,nt_a) ) - pssv_ice(ji,jj) )
       END_2D
-      CALL lbc_lnk_multi( 'ablmod', ptaui_ice, 'U', -1.0_wp, ptauj_ice, 'V', -1.0_wp )
+      CALL lbc_lnk( 'ablmod', ptaui_ice, 'U', -1.0_wp, ptauj_ice, 'V', -1.0_wp )
       !
       IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=ptaui_ice  , clinfo1=' abl_stp: putaui : '   &
@@ -664,5 +664,5 @@
             &         * ( zztmp2 - pssv_ice(ji,jj) )
       END_2D
-      CALL lbc_lnk_multi( 'ablmod', ptaui_ice, 'U', -1.0_wp, ptauj_ice,'V', -1.0_wp )
+      CALL lbc_lnk( 'ablmod', ptaui_ice, 'U', -1.0_wp, ptauj_ice,'V', -1.0_wp )
       !
       IF(sn_cfctl%l_prtctl) THEN
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablrst.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablrst.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ABL/ablrst.F90	(revision 14676)
@@ -45,4 +45,5 @@
       CHARACTER(len=50)   ::   clname   ! abl output restart file name
       CHARACTER(len=256)  ::   clpath   ! full path to abl output restart file 
+      CHARACTER(LEN=52)   ::   clpname  ! abl output restart file name including prefix for AGRIF
       !!----------------------------------------------------------------------
       !
@@ -74,5 +75,21 @@
             ENDIF
             !
-            CALL iom_open( TRIM(clpath)//TRIM(clname), numraw, ldwrt = .TRUE., kdlev = jpka, cdcomp = 'ABL' )
+            IF(.NOT.lwxios) THEN
+               CALL iom_open( TRIM(clpath)//TRIM(clname), numraw, ldwrt = .TRUE., kdlev = jpka, cdcomp = 'ABL' )
+            ELSE
+#if defined key_xios
+               cw_ablrst_cxt = "rstwa_"//TRIM(ADJUSTL(clkt))
+               IF( TRIM(Agrif_CFixed()) == '0' ) THEN
+                  clpname = clname
+               ELSE
+                  clpname = TRIM(Agrif_CFixed())//"_"//clname
+               ENDIF
+               numraw = iom_xios_setid(TRIM(clpath)//TRIM(clpname))
+               CALL iom_init( cw_ablrst_cxt, kdid = numraw, ld_closedef = .FALSE. )
+               CALL iom_swap( cxios_context )
+#else
+               CALL ctl_stop( 'Can not use XIOS in rst_opn' )
+#endif
+            ENDIF
             lrst_abl = .TRUE.
          ENDIF
@@ -103,9 +120,10 @@
 
       ! Write in numraw (if iter == nitrst)
-      ! ------------------ 
+      ! ------------------
       !                                                                        ! calendar control
       CALL iom_rstput( iter, nitrst, numraw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step 
       CALL iom_rstput( iter, nitrst, numraw, 'kt_abl' , REAL( iter   , wp ) )      ! date
-      CALL iom_delay_rst( 'WRITE', 'ABL', numraw )   ! save only abl delayed global communication variables
+
+      IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'ABL', numraw )   ! save only abl delayed global communication variables
 
       ! Prognostic (after timestep + swap time indices = now timestep) variables
@@ -124,5 +142,11 @@
       ! ------------------
       IF( iter == nitrst ) THEN
-         CALL iom_close( numraw )
+         IF(.NOT.lwxios) THEN
+            CALL iom_close( numraw )
+         ELSE
+            CALL iom_context_finalize(      cw_ablrst_cxt          )
+            iom_file(numraw)%nfid       = 0
+            numraw = 0
+         ENDIF
          lrst_abl = .FALSE.
       ENDIF
@@ -146,5 +170,17 @@
       ENDIF
 
+      lxios_sini = .FALSE.
       CALL iom_open ( TRIM(cn_ablrst_indir)//'/'//cn_ablrst_in, numrar )
+
+      IF( lrxios) THEN
+          cr_ablrst_cxt = 'abl_rst'
+          IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for ABL'
+!         IF( TRIM(Agrif_CFixed()) == '0' ) THEN
+!            clpname = cn_ablrst_in
+!         ELSE
+!            clpname = TRIM(Agrif_CFixed())//"_"//cn_ablrst_in
+!         ENDIF
+          CALL iom_init( cr_ablrst_cxt, kdid = numrar, ld_closedef = .TRUE. )
+      ENDIF
 
       ! Time info
@@ -174,5 +210,6 @@
       CALL iom_get( numrar, jpdom_auto,'mxld_abl',mxld_abl(:,:,:           ) )
       CALL iom_get( numrar, jpdom_auto,    'pblh',    pblh(:,:             ) )
-      CALL iom_delay_rst( 'READ', 'ABL', numrar )   ! read only abl delayed global communication variables
+
+      IF(.NOT.lrxios) CALL iom_delay_rst( 'READ', 'ABL', numrar )   ! read only abl delayed global communication variables
 
    END SUBROUTINE abl_rst_read
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icecor.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icecor.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icecor.F90	(revision 14676)
@@ -116,5 +116,5 @@
             ENDIF
          END_2D
-         CALL lbc_lnk_multi( 'icecor', u_ice, 'U', -1.0_wp, v_ice, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icecor', u_ice, 'U', -1.0_wp, v_ice, 'V', -1.0_wp )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icectl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icectl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icectl.F90	(revision 14676)
@@ -776,6 +776,6 @@
       IF( iom_use('icedrift_mass') .OR. iom_use('icedrift_salt') .OR. iom_use('icedrift_heat') ) THEN
          DO_2D( 1, 1, 1, 1 )
-            zdiag_mass2D(ji,jj) =   wfx_ice(ji,jj)   + wfx_snw(ji,jj)   + wfx_spr(ji,jj) + wfx_sub(ji,jj) &
-               &                  + diag_vice(ji,jj) + diag_vsnw(ji,jj) - diag_adv_mass(ji,jj)
+            zdiag_mass2D(ji,jj) = wfx_ice(ji,jj)   + wfx_snw(ji,jj)   + wfx_spr(ji,jj)   + wfx_sub(ji,jj) + wfx_pnd(ji,jj) &
+               &                + diag_vice(ji,jj) + diag_vsnw(ji,jj) + diag_vpnd(ji,jj) - diag_adv_mass(ji,jj)
             zdiag_salt2D(ji,jj) = sfx(ji,jj) + diag_sice(ji,jj) - diag_adv_salt(ji,jj)
             zdiag_heat2D(ji,jj) = qt_oce_ai(ji,jj) - qt_atm_oi(ji,jj) + diag_heat(ji,jj) - diag_adv_heat(ji,jj)
@@ -789,6 +789,6 @@
 
       ! -- mass diag -- !
-      zdiag_mass     = glob_sum( 'icectl', (  wfx_ice   + wfx_snw   + wfx_spr + wfx_sub &
-         &                                  + diag_vice + diag_vsnw - diag_adv_mass ) * e1e2t ) * rDt_ice
+      zdiag_mass     = glob_sum( 'icectl', (  wfx_ice   + wfx_snw   + wfx_spr   + wfx_sub + wfx_pnd &
+         &                                  + diag_vice + diag_vsnw + diag_vpnd - diag_adv_mass ) * e1e2t ) * rDt_ice
       zdiag_adv_mass = glob_sum( 'icectl', diag_adv_mass * e1e2t ) * rDt_ice
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_pra.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_pra.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_pra.F90	(revision 14676)
@@ -115,5 +115,5 @@
       CALL icemax3D( ph_ip, zhip_max)
       CALL icemax3D( zs_i , zsi_max )
-      CALL lbc_lnk_multi( 'icedyn_adv_pra', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+      CALL lbc_lnk( 'icedyn_adv_pra', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
       !
       ! enthalpies
@@ -265,26 +265,26 @@
          ! --- Lateral boundary conditions --- !
          !     caution: for gradients (sx and sy) the sign changes
-         CALL lbc_lnk_multi( 'icedyn_adv_pra', z0ice , 'T', 1._wp, sxice , 'T', -1._wp, syice , 'T', -1._wp  & ! ice volume
-            &                                , sxxice, 'T', 1._wp, syyice, 'T',  1._wp, sxyice, 'T',  1._wp  &
-            &                                , z0snw , 'T', 1._wp, sxsn  , 'T', -1._wp, sysn  , 'T', -1._wp  & ! snw volume
-            &                                , sxxsn , 'T', 1._wp, syysn , 'T',  1._wp, sxysn , 'T',  1._wp  )
-         CALL lbc_lnk_multi( 'icedyn_adv_pra', z0smi , 'T', 1._wp, sxsal , 'T', -1._wp, sysal , 'T', -1._wp  & ! ice salinity
-            &                                , sxxsal, 'T', 1._wp, syysal, 'T',  1._wp, sxysal, 'T',  1._wp  &
-            &                                , z0ai  , 'T', 1._wp, sxa   , 'T', -1._wp, sya   , 'T', -1._wp  & ! ice concentration
-            &                                , sxxa  , 'T', 1._wp, syya  , 'T',  1._wp, sxya  , 'T',  1._wp  )
-         CALL lbc_lnk_multi( 'icedyn_adv_pra', z0oi  , 'T', 1._wp, sxage , 'T', -1._wp, syage , 'T', -1._wp  & ! ice age
-            &                                , sxxage, 'T', 1._wp, syyage, 'T',  1._wp, sxyage, 'T',  1._wp  )
-         CALL lbc_lnk_multi( 'icedyn_adv_pra', z0es  , 'T', 1._wp, sxc0  , 'T', -1._wp, syc0  , 'T', -1._wp  & ! snw enthalpy
-            &                                , sxxc0 , 'T', 1._wp, syyc0 , 'T',  1._wp, sxyc0 , 'T',  1._wp  )
-         CALL lbc_lnk_multi( 'icedyn_adv_pra', z0ei  , 'T', 1._wp, sxe   , 'T', -1._wp, sye   , 'T', -1._wp  & ! ice enthalpy
-            &                                , sxxe  , 'T', 1._wp, syye  , 'T',  1._wp, sxye  , 'T',  1._wp  )
+         CALL lbc_lnk( 'icedyn_adv_pra', z0ice , 'T', 1._wp, sxice , 'T', -1._wp, syice , 'T', -1._wp  & ! ice volume
+            &                          , sxxice, 'T', 1._wp, syyice, 'T',  1._wp, sxyice, 'T',  1._wp  &
+            &                          , z0snw , 'T', 1._wp, sxsn  , 'T', -1._wp, sysn  , 'T', -1._wp  & ! snw volume
+            &                          , sxxsn , 'T', 1._wp, syysn , 'T',  1._wp, sxysn , 'T',  1._wp  )
+         CALL lbc_lnk( 'icedyn_adv_pra', z0smi , 'T', 1._wp, sxsal , 'T', -1._wp, sysal , 'T', -1._wp  & ! ice salinity
+            &                          , sxxsal, 'T', 1._wp, syysal, 'T',  1._wp, sxysal, 'T',  1._wp  &
+            &                          , z0ai  , 'T', 1._wp, sxa   , 'T', -1._wp, sya   , 'T', -1._wp  & ! ice concentration
+            &                          , sxxa  , 'T', 1._wp, syya  , 'T',  1._wp, sxya  , 'T',  1._wp  )
+         CALL lbc_lnk( 'icedyn_adv_pra', z0oi  , 'T', 1._wp, sxage , 'T', -1._wp, syage , 'T', -1._wp  & ! ice age
+            &                          , sxxage, 'T', 1._wp, syyage, 'T',  1._wp, sxyage, 'T',  1._wp  )
+         CALL lbc_lnk( 'icedyn_adv_pra', z0es  , 'T', 1._wp, sxc0  , 'T', -1._wp, syc0  , 'T', -1._wp  & ! snw enthalpy
+            &                          , sxxc0 , 'T', 1._wp, syyc0 , 'T',  1._wp, sxyc0 , 'T',  1._wp  )
+         CALL lbc_lnk( 'icedyn_adv_pra', z0ei  , 'T', 1._wp, sxe   , 'T', -1._wp, sye   , 'T', -1._wp  & ! ice enthalpy
+            &                          , sxxe  , 'T', 1._wp, syye  , 'T',  1._wp, sxye  , 'T',  1._wp  )
          IF ( ln_pnd_LEV .OR. ln_pnd_TOPO ) THEN
-            CALL lbc_lnk_multi( 'icedyn_adv_pra', z0ap , 'T', 1._wp, sxap , 'T', -1._wp, syap , 'T', -1._wp  & ! melt pond fraction
-               &                                , sxxap, 'T', 1._wp, syyap, 'T',  1._wp, sxyap, 'T',  1._wp  &
-               &                                , z0vp , 'T', 1._wp, sxvp , 'T', -1._wp, syvp , 'T', -1._wp  & ! melt pond volume
-               &                                , sxxvp, 'T', 1._wp, syyvp, 'T',  1._wp, sxyvp, 'T',  1._wp  )
+            CALL lbc_lnk( 'icedyn_adv_pra', z0ap , 'T', 1._wp, sxap , 'T', -1._wp, syap , 'T', -1._wp  & ! melt pond fraction
+               &                          , sxxap, 'T', 1._wp, syyap, 'T',  1._wp, sxyap, 'T',  1._wp  &
+               &                          , z0vp , 'T', 1._wp, sxvp , 'T', -1._wp, syvp , 'T', -1._wp  & ! melt pond volume
+               &                          , sxxvp, 'T', 1._wp, syyvp, 'T',  1._wp, sxyvp, 'T',  1._wp  )
             IF ( ln_pnd_lids ) THEN
-               CALL lbc_lnk_multi( 'icedyn_adv_pra', z0vl ,'T', 1._wp, sxvl ,'T', -1._wp, syvl ,'T', -1._wp  & ! melt pond lid volume
-                  &                                , sxxvl,'T', 1._wp, syyvl,'T',  1._wp, sxyvl,'T',  1._wp  )
+               CALL lbc_lnk( 'icedyn_adv_pra', z0vl ,'T', 1._wp, sxvl ,'T', -1._wp, syvl ,'T', -1._wp  & ! melt pond lid volume
+                  &                          , sxxvl,'T', 1._wp, syyvl,'T',  1._wp, sxyvl,'T',  1._wp  )
             ENDIF
          ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_umx.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_umx.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_adv_umx.F90	(revision 14676)
@@ -119,5 +119,5 @@
       CALL icemax3D( ph_ip, zhip_max)
       CALL icemax3D( zs_i , zsi_max )
-      CALL lbc_lnk_multi( 'icedyn_adv_umx', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
+      CALL lbc_lnk( 'icedyn_adv_umx', zhi_max, 'T', 1._wp, zhs_max, 'T', 1._wp, zhip_max, 'T', 1._wp, zsi_max, 'T', 1._wp )
       !
       ! enthalpies
@@ -360,11 +360,11 @@
          ! --- Lateral boundary conditions --- !
          IF    ( ( ln_pnd_LEV .OR. ln_pnd_TOPO ) .AND. ln_pnd_lids ) THEN
-            CALL lbc_lnk_multi( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp &
-               &                                , pa_ip,'T',1._wp, pv_ip,'T',1._wp, pv_il,'T',1._wp )
+            CALL lbc_lnk( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp &
+               &                          , pa_ip,'T',1._wp, pv_ip,'T',1._wp, pv_il,'T',1._wp )
          ELSEIF( ( ln_pnd_LEV .OR. ln_pnd_TOPO ) .AND. .NOT.ln_pnd_lids ) THEN
-            CALL lbc_lnk_multi( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp &
-               &                                , pa_ip,'T',1._wp, pv_ip,'T',1._wp )
+            CALL lbc_lnk( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp &
+               &                          , pa_ip,'T',1._wp, pv_ip,'T',1._wp )
          ELSE
-            CALL lbc_lnk_multi( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp )
+            CALL lbc_lnk( 'icedyn_adv_umx', pa_i,'T',1._wp, pv_i,'T',1._wp, pv_s,'T',1._wp, psv_i,'T',1._wp, poa_i,'T',1._wp )
          ENDIF
          CALL lbc_lnk( 'icedyn_adv_umx', pe_i, 'T', 1._wp )
@@ -1169,5 +1169,5 @@
             END_2D
          END DO
-         CALL lbc_lnk_multi( 'icedyn_adv_umx', zti_ups, 'T', 1.0_wp, ztj_ups, 'T', 1.0_wp )
+         CALL lbc_lnk( 'icedyn_adv_umx', zti_ups, 'T', 1.0_wp, ztj_ups, 'T', 1.0_wp )
 
          DO jl = 1, jpl
@@ -1191,5 +1191,5 @@
             END_2D
          END DO
-         CALL lbc_lnk_multi( 'icedyn_adv_umx', pfu_ho, 'U', -1.0_wp, pfv_ho, 'V', -1.0_wp )   ! lateral boundary cond.
+         CALL lbc_lnk( 'icedyn_adv_umx', pfu_ho, 'U', -1.0_wp, pfv_ho, 'V', -1.0_wp )   ! lateral boundary cond.
 
       ENDIF
@@ -1248,5 +1248,5 @@
          END_2D
       END DO
-      CALL lbc_lnk_multi( 'icedyn_adv_umx', zbetup, 'T', 1.0_wp, zbetdo, 'T', 1.0_wp )   ! lateral boundary cond. (unchanged sign)
+      CALL lbc_lnk( 'icedyn_adv_umx', zbetup, 'T', 1.0_wp, zbetdo, 'T', 1.0_wp )   ! lateral boundary cond. (unchanged sign)
 
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_eap.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_eap.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_eap.F90	(revision 14676)
@@ -350,5 +350,5 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_eap', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_eap', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
       !
       !                                  !== Landfast ice parameterization ==!
@@ -488,5 +488,5 @@
             zs2(ji,jj) = ( zs2(ji,jj) * zalph1 + zstressmtmp ) * z1_alph1
          END_2D
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zstress12tmp, 'T', 1.0_wp , paniso_11, 'T', 1.0_wp , paniso_12, 'T', 1.0_wp)
+         CALL lbc_lnk( 'icedyn_rhg_eap', zstress12tmp, 'T', 1.0_wp , paniso_11, 'T', 1.0_wp , paniso_12, 'T', 1.0_wp)
 
         ! Save beta at T-points for further computations
@@ -516,5 +516,5 @@
 
          END_2D
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zs1, 'T', 1.0_wp, zs2, 'T', 1.0_wp, zs12, 'F', 1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zs1, 'T', 1.0_wp, zs2, 'T', 1.0_wp, zs12, 'F', 1.0_wp )
 
          ! --- Ice internal stresses (Appendix C of Hunke and Dukowicz, 2002) --- !
@@ -810,7 +810,7 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_eap', pshear_i, 'T', 1.0_wp, pdivu_i, 'T', 1.0_wp, pdelta_i, 'T', 1.0_wp, &
-         &                                    zten_i, 'T', 1.0_wp, zs1    , 'T', 1.0_wp, zs2     , 'T', 1.0_wp, &
-         &                                      zs12, 'F', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_eap', pshear_i, 'T', 1.0_wp, pdivu_i, 'T', 1.0_wp, pdelta_i, 'T', 1.0_wp, &
+         &                              zten_i, 'T', 1.0_wp, zs1    , 'T', 1.0_wp, zs2     , 'T', 1.0_wp, &
+         &                                zs12, 'F', 1.0_wp )
 
       ! --- Store the stress tensor for the next time step --- !
@@ -827,6 +827,6 @@
          & iom_use('utau_bi') .OR. iom_use('vtau_bi') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, &
-            &                                  ztauy_ai, 'V', -1.0_wp, ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, &
+            &                            ztauy_ai, 'V', -1.0_wp, ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
          !
          CALL iom_put( 'utau_oi' , ztaux_oi * aimsk00 )
@@ -912,5 +912,5 @@
       IF( iom_use('yield11') .OR. iom_use('yield12') .OR. iom_use('yield22')) THEN
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zyield11, 'T', 1.0_wp, zyield22, 'T', 1.0_wp, zyield12, 'T', 1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zyield11, 'T', 1.0_wp, zyield22, 'T', 1.0_wp, zyield12, 'T', 1.0_wp )
 
          CALL iom_put( 'yield11', zyield11 * aimsk00 )
@@ -929,7 +929,7 @@
          & iom_use('corstrx') .OR. iom_use('corstry') .OR. iom_use('intstrx') .OR. iom_use('intstry') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
-            &                                  zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, &
-            &                                    zfU, 'U', -1.0_wp,   zfV, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
+            &                            zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, &
+            &                              zfU, 'U', -1.0_wp,   zfV, 'V', -1.0_wp )
 
          CALL iom_put( 'dssh_dx' , zspgU * aimsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -963,7 +963,7 @@
          END_2D
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
-            &                                  zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
-            &                                  zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
+            &                            zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
+            &                            zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_evp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_evp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_evp.F90	(revision 14676)
@@ -316,5 +316,5 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
       !
       !                                  !== Landfast ice parameterization ==!
@@ -750,6 +750,6 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_evp', pshear_i, 'T', 1._wp, pdivu_i, 'T', 1._wp, pdelta_i, 'T', 1._wp, zten_i, 'T', 1._wp, &
-         &                                  zs1     , 'T', 1._wp, zs2    , 'T', 1._wp, zs12    , 'F', 1._wp )
+      CALL lbc_lnk( 'icedyn_rhg_evp', pshear_i, 'T', 1._wp, pdivu_i, 'T', 1._wp, pdelta_i, 'T', 1._wp, zten_i, 'T', 1._wp, &
+         &                            zs1     , 'T', 1._wp, zs2    , 'T', 1._wp, zs12    , 'F', 1._wp )
 
       ! --- Store the stress tensor for the next time step --- !
@@ -766,6 +766,7 @@
          & iom_use('utau_bi') .OR. iom_use('vtau_bi') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, ztauy_ai, 'V', -1.0_wp, &
-            &                                  ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, &
+            &                            ztaux_ai, 'U', -1.0_wp, ztauy_ai, 'V', -1.0_wp, &
+            &                            ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
          !
          CALL iom_put( 'utau_oi' , ztaux_oi * zmsk00 )
@@ -851,6 +852,6 @@
          & iom_use('corstrx') .OR. iom_use('corstry') .OR. iom_use('intstrx') .OR. iom_use('intstry') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
-            &                                  zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, zfU, 'U', -1.0_wp, zfV, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
+            &                            zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, zfU, 'U', -1.0_wp, zfV, 'V', -1.0_wp )
 
          CALL iom_put( 'dssh_dx' , zspgU * zmsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -884,7 +885,7 @@
          END_2D
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
-            &                                  zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
-            &                                  zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
+            &                            zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
+            &                            zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_vp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_vp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icedyn_rhg_vp.F90	(revision 14676)
@@ -461,5 +461,5 @@
 
          CALL lbc_lnk( 'icedyn_rhg_vp', zds, 'F', 1. ) ! MV TEST could be un-necessary according to Gurvan
-         CALL iom_put( 'zds'        , zds      )   ! MV DEBUG
+         CALL iom_put( 'zds'          , zds      )   ! MV DEBUG
 
          IF( lwp )   WRITE(numout,*) ' outer loop  1a i_out : ', i_out
@@ -506,5 +506,5 @@
          END DO
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zp_deltastar_t , 'T', 1. , zzt , 'T', 1., zet, 'T', 1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zp_deltastar_t , 'T', 1. , zzt , 'T', 1., zet, 'T', 1. )
 
          CALL iom_put( 'zzt'        , zzt      )   ! MV DEBUG
@@ -527,5 +527,5 @@
          
          CALL lbc_lnk( 'icedyn_rhg_vp', zef, 'F', 1. )
-         CALL iom_put( 'zef'           , zef            ) ! MV DEBUG
+         CALL iom_put( 'zef'          , zef            ) ! MV DEBUG
          IF( lwp )   WRITE(numout,*) ' outer loop  1c i_out : ', i_out
 
@@ -567,6 +567,6 @@
          IF( lwp )   WRITE(numout,*) ' outer loop  1d i_out : ', i_out
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCwU ,  'U', -1., zCwV, 'V', -1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCorU,  'U', -1., zCorV, 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zCwU ,  'U', -1., zCwV, 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zCorU,  'U', -1., zCorV, 'V', -1. )
 
          CALL iom_put( 'zCwU'          , zCwU           ) ! MV DEBUG
@@ -674,7 +674,7 @@
          END DO
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zrhsu, 'U', -1., zrhsv, 'V',  -1.)
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zmU_t, 'U', -1., zmV_t, 'V',  -1.)
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi_rhsu, 'U', -1., ztauy_oi_rhsv, 'V',  -1.)
+         CALL lbc_lnk( 'icedyn_rhg_vp', zrhsu, 'U', -1., zrhsv, 'V',  -1.)
+         CALL lbc_lnk( 'icedyn_rhg_vp', zmU_t, 'U', -1., zmV_t, 'V',  -1.)
+         CALL lbc_lnk( 'icedyn_rhg_vp', ztaux_oi_rhsu, 'U', -1., ztauy_oi_rhsv, 'V',  -1.)
 
          CALL iom_put( 'zmU_t'         , zmU_t          ) ! MV DEBUG
@@ -779,9 +779,9 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zAU  , 'U', 1., zAV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU  , 'U', 1., zBV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU  , 'U', 1., zCV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zDU  , 'U', 1., zDV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zEU  , 'U', 1., zEV  , 'V',  1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zAU  , 'U', 1., zAV  , 'V',  1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zBU  , 'U', 1., zBV  , 'V',  1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zCU  , 'U', 1., zCV  , 'V',  1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zDU  , 'U', 1., zDV  , 'V',  1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zEU  , 'U', 1., zEV  , 'V',  1. )
                
          CALL iom_put( 'zAU'           , zAU            ) ! MV DEBUG
@@ -885,5 +885,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime, 'U',  1., zBU_prime, 'U', 1. )
+                     CALL lbc_lnk( 'icedyn_rhg_vp', zFU_prime, 'U',  1., zBU_prime, 'U', 1. )
  
                      !-----------------------------
@@ -965,5 +965,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFV, 'V',  1.)
+                     CALL lbc_lnk( 'icedyn_rhg_vp', zFV, 'V',  1.)
                      
                      !---------------
@@ -983,5 +983,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFV_prime, 'V',  1., zBV_prime, 'V', 1. )
+                     CALL lbc_lnk( 'icedyn_rhg_vp', zFV_prime, 'V',  1., zBV_prime, 'V', 1. )
                      
                      !-----------------------------
@@ -1020,5 +1020,5 @@
                ENDIF !   ll_v_iterate
 
-               CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+               CALL lbc_lnk( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
                               
                !--------------------------------------------------------------------------------------
@@ -1110,8 +1110,8 @@
       IF ( lwp ) WRITE(numout,*) ' We are out of outer loop '
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU  , 'U',  1., zFV  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU_prime  , 'U',  1., zBV_prime  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime  , 'U',  1., zFV_prime  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU_prime  , 'U',  1., zCV_prime  , 'V',  1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', zFU  , 'U',  1., zFV  , 'V',  1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', zBU_prime  , 'U',  1., zBV_prime  , 'V',  1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', zFU_prime  , 'U',  1., zFV_prime  , 'V',  1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', zCU_prime  , 'U',  1., zCV_prime  , 'V',  1. )
 
       CALL iom_put( 'zFU'           , zFU            ) ! MV DEBUG
@@ -1125,5 +1125,5 @@
       CALL iom_put( 'zFV_prime'     , zFV_prime      ) ! MV DEBUG
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
 
       IF ( lwp ) WRITE(numout,*) ' We are about to output uice_dbg '
@@ -1161,5 +1161,5 @@
       END DO
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
 
       IF ( lwp ) WRITE(numout,*) ' Velocity replaced '
@@ -1222,5 +1222,5 @@
       IF ( lwp ) WRITE(numout,*) ' Deformation recalculated '
       
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', pshear_i, 'T', 1., pdivu_i, 'T', 1., pdelta_i, 'T', 1. )
+      CALL lbc_lnk( 'icedyn_rhg_vp', pshear_i, 'T', 1., pdivu_i, 'T', 1., pdelta_i, 'T', 1. )
       
       !------------------------------------------------------------------------------!
@@ -1249,5 +1249,5 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zs1, 'T', 1., zs2, 'T', 1., zs12, 'T', 1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zs1, 'T', 1., zs2, 'T', 1., zs12, 'T', 1. )
       
       ENDIF
@@ -1307,6 +1307,6 @@
          
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi, 'U', -1., ztauy_oi, 'V', -1., ztaux_ai, 'U', -1., ztauy_ai, 'V', -1. ) !, &
-!            &                                 ztaux_bi, 'U', -1., ztauy_bi, 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', ztaux_oi, 'U', -1., ztauy_oi, 'V', -1., ztaux_ai, 'U', -1., ztauy_ai, 'V', -1. ) !, &
+!            &                           ztaux_bi, 'U', -1., ztauy_bi, 'V', -1. )
          !
          CALL iom_put( 'utau_oi' , ztaux_oi * zmsk00 )
@@ -1348,5 +1348,5 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig_I, 'T', 1., zsig_II, 'T', 1.)
+         CALL lbc_lnk( 'icedyn_rhg_vp', zsig_I, 'T', 1., zsig_II, 'T', 1.)
          
          IF( iom_use('normstr') )   CALL iom_put( 'normstr' ,   zsig_I(:,:)  * zmsk00(:,:) ) ! Normal stress
@@ -1393,5 +1393,5 @@
          IF ( lwp ) WRITE(numout,*) 'Some shitty stress work done'
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig1_p, 'T', 1., zsig2_p, 'T', 1.)
+         CALL lbc_lnk( 'icedyn_rhg_vp', zsig1_p, 'T', 1., zsig2_p, 'T', 1.)
          !      
          IF ( lwp ) WRITE(numout,*) ' Beauaaaarflblbllll '
@@ -1423,6 +1423,6 @@
          END DO
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zspgU, 'U', -1., zspgV, 'V', -1., &
-            &                                 zCorU, 'U', -1., zCorV, 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zspgU, 'U', -1., zspgV, 'V', -1., &
+            &                           zCorU, 'U', -1., zCorV, 'V', -1. )
          !
          CALL iom_put( 'dssh_dx' , zspgU * zmsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -1453,5 +1453,5 @@
          END DO
             
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zfU, 'U', -1., zfV, 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zfU, 'U', -1., zfV, 'V', -1. )
          
          CALL iom_put( 'intstrx' , zfU   * zmsk00 )   ! Internal force term in force balance (x)
@@ -1485,7 +1485,7 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zdiag_xmtrp_ice, 'U', -1., zdiag_ymtrp_ice, 'V', -1., &
-            &                                 zdiag_xmtrp_snw, 'U', -1., zdiag_ymtrp_snw, 'V', -1., &
-            &                                 zdiag_xatrp    , 'U', -1., zdiag_yatrp    , 'V', -1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zdiag_xmtrp_ice, 'U', -1., zdiag_ymtrp_ice, 'V', -1., &
+            &                           zdiag_xmtrp_snw, 'U', -1., zdiag_ymtrp_snw, 'V', -1., &
+            &                           zdiag_xatrp    , 'U', -1., zdiag_yatrp    , 'V', -1. )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icesbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icesbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icesbc.F90	(revision 14676)
@@ -87,5 +87,5 @@
             vtau_ice(ji,jj) = vtau_ice(ji,jj) * xcplmask(ji,jj,0) + zvtau_ice(ji,jj) * ( 1. - xcplmask(ji,jj,0) )
          END_2D
-         CALL lbc_lnk_multi( 'icesbc', utau_ice, 'U', -1.0_wp, vtau_ice, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icesbc', utau_ice, 'U', -1.0_wp, vtau_ice, 'V', -1.0_wp )
       ENDIF
       !
@@ -147,5 +147,5 @@
             &                                         sf(jp_slp)%fnow(:,:,1), sf(jp_qlw)%fnow(:,:,1), &
             &                                         sf(jp_prec)%fnow(:,:,1), sf(jp_snow)%fnow(:,:,1) )
-         IF( ln_mixcpl        )   CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i )
+         IF( ln_mixcpl        )   CALL sbc_cpl_ice_flx( kt, picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i )
          IF( nn_flxdist /= -1 )   CALL ice_flx_dist   ( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_flxdist )
          !                        !    compute conduction flux and surface temperature (as in Jules surface module)
@@ -153,5 +153,5 @@
             &                     CALL blk_ice_qcn    ( ln_virtual_itd, t_su, t_bo, h_s, h_i )
       CASE ( jp_purecpl )         !--- coupled formulation
-                                  CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i )
+                                  CALL sbc_cpl_ice_flx( kt, picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su, phs=h_s, phi=h_i )
          IF( nn_flxdist /= -1 )   CALL ice_flx_dist   ( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_flxdist )
       END SELECT
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd.F90	(revision 14676)
@@ -136,5 +136,5 @@
          END_2D
       ENDIF
-      CALL lbc_lnk_multi( 'icethd', zfric, 'T',  1.0_wp, zvel, 'T', 1.0_wp )
+      CALL lbc_lnk( 'icethd', zfric, 'T',  1.0_wp, zvel, 'T', 1.0_wp )
       !
       !--------------------------------------------------------------------!
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd_do.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd_do.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/icethd_do.F90	(revision 14676)
@@ -193,5 +193,5 @@
          END_2D
          ! 
-         CALL lbc_lnk_multi( 'icethd_do', zvrel, 'T', 1.0_wp, ht_i_new, 'T', 1.0_wp  )
+         CALL lbc_lnk( 'icethd_do', zvrel, 'T', 1.0_wp, ht_i_new, 'T', 1.0_wp  )
 
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/iceupdate.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/iceupdate.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/ICE/iceupdate.F90	(revision 14676)
@@ -104,5 +104,10 @@
       ! Net heat flux on top of the ice-ocean (W.m-2)
       !----------------------------------------------
-      qt_atm_oi(:,:) = qns_tot(:,:) + qsr_tot(:,:)
+      IF( ln_cndflx ) THEN   ! ice-atm interface = conduction (and melting) fluxes
+         qt_atm_oi(:,:) = ( 1._wp - at_i_b(:,:) ) * ( qns_oce(:,:) + qsr_oce(:,:) ) + qemp_oce(:,:) + &
+            &             SUM( a_i_b * ( qcn_ice + qml_ice + qtr_ice_top ), dim=3 ) + qemp_ice(:,:)
+      ELSE                   ! ice-atm interface = solar and non-solar fluxes
+         qt_atm_oi(:,:) = qns_tot(:,:) + qsr_tot(:,:) 
+      ENDIF
 
       ! --- case we bypass ice thermodynamics --- !
@@ -119,13 +124,19 @@
          ! Solar heat flux reaching the ocean (max) = zqsr (W.m-2)
          !---------------------------------------------------
-         zqsr = qsr_tot(ji,jj) - SUM( a_i_b(ji,jj,:) * ( qsr_ice(ji,jj,:) - qtr_ice_bot(ji,jj,:) ) )
+         IF( ln_cndflx ) THEN   ! ice-atm interface = conduction (and melting) fluxes
+            zqsr = ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) + SUM( a_i_b (ji,jj,:) * qtr_ice_bot(ji,jj,:) )
+         ELSE                   ! ice-atm interface = solar and non-solar fluxes
+            zqsr = qsr_tot(ji,jj) - SUM( a_i_b(ji,jj,:) * ( qsr_ice(ji,jj,:) - qtr_ice_bot(ji,jj,:) ) )
+         ENDIF
 
          ! Total heat flux reaching the ocean = qt_oce_ai (W.m-2)
          !---------------------------------------------------
-         qt_oce_ai(ji,jj) = qt_atm_oi(ji,jj) - hfx_sum(ji,jj) - hfx_bom(ji,jj) - hfx_bog(ji,jj) &
-            &                                - hfx_dif(ji,jj) - hfx_opw(ji,jj) - hfx_snw(ji,jj) &
-            &                                + hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_res(ji,jj) &
-            &                                + hfx_sub(ji,jj) - SUM( qevap_ice(ji,jj,:) * a_i_b(ji,jj,:) ) + hfx_spr(ji,jj)
-
+         IF( ln_icethd ) THEN
+            qt_oce_ai(ji,jj) = qt_atm_oi(ji,jj) - hfx_sum(ji,jj) - hfx_bom(ji,jj) - hfx_bog(ji,jj) &
+               &                                - hfx_dif(ji,jj) - hfx_opw(ji,jj) - hfx_snw(ji,jj) &
+               &                                + hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_res(ji,jj) &
+               &                                + hfx_sub(ji,jj) - SUM( qevap_ice(ji,jj,:) * a_i_b(ji,jj,:) ) + hfx_spr(ji,jj)
+         ENDIF
+         
          ! New qsr and qns used to compute the oceanic heat flux at the next time step
          !----------------------------------------------------------------------------
@@ -144,5 +155,5 @@
          !
          ! the non-solar is simply derived from the solar flux
-         qns(ji,jj) = qt_oce_ai(ji,jj) - zqsr
+         qns(ji,jj) = qt_oce_ai(ji,jj) - qsr(ji,jj)
 
          ! Mass flux at the atm. surface
@@ -275,7 +286,10 @@
 
       ! other heat fluxes
-      IF( iom_use('hfxsensib'  ) )   CALL iom_put( 'hfxsensib'  ,     -qsb_ice_bot * at_i_b         )   ! Sensible oceanic heat flux
+      IF( iom_use('hfxsensib'  ) )   CALL iom_put( 'hfxsensib'  ,      qsb_ice_bot * at_i_b         )   ! Sensible oceanic heat flux
       IF( iom_use('hfxcndbot'  ) )   CALL iom_put( 'hfxcndbot'  , SUM( qcn_ice_bot * a_i_b, dim=3 ) )   ! Bottom conduction flux
       IF( iom_use('hfxcndtop'  ) )   CALL iom_put( 'hfxcndtop'  , SUM( qcn_ice_top * a_i_b, dim=3 ) )   ! Surface conduction flux
+!!    IF( iom_use('hfxmelt'    ) )   CALL iom_put( 'hfxmelt'    , SUM( qml_ice     * a_i_b, dim=3 ) )   ! Surface melt flux
+!!    IF( iom_use('hfxldmelt'  ) )   CALL iom_put( 'hfxldmelt'  ,      fhld        * at_i_b         )   ! Heat in lead for ice melting 
+!!    IF( iom_use('hfxldgrow'  ) )   CALL iom_put( 'hfxldgrow'  ,      qlead       * r1_Dt_ice      )   ! Heat in lead for ice growth
 
       ! controls
@@ -345,5 +359,5 @@
             tmod_io(ji,jj) = zrhoco * SQRT( zmodt )          ! rhoco * |U_ice-U_oce| at T-point
          END_2D
-         CALL lbc_lnk_multi( 'iceupdate', taum, 'T', 1.0_wp, tmod_io, 'T', 1.0_wp )
+         CALL lbc_lnk( 'iceupdate', taum, 'T', 1.0_wp, tmod_io, 'T', 1.0_wp )
          !
          utau_oce(:,:) = utau(:,:)                    !* save the air-ocean stresses at ice time-step
@@ -374,5 +388,5 @@
          vtau(ji,jj) = ( 1._wp - zat_v ) * vtau_oce(ji,jj) + zat_v * zvtau_ice
       END_2D
-      CALL lbc_lnk_multi( 'iceupdate', utau, 'U', -1.0_wp, vtau, 'V', -1.0_wp )   ! lateral boundary condition
+      CALL lbc_lnk( 'iceupdate', utau, 'U', -1.0_wp, vtau, 'V', -1.0_wp )   ! lateral boundary condition
       !
       IF( ln_timing )   CALL timing_stop('ice_update')
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_interp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_interp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_interp.F90	(revision 14676)
@@ -109,5 +109,5 @@
       vv(:,:,:,Kbb) = vv(:,:,:,Kbb) * vmask(:,:,:) 
 
-      CALL lbc_lnk_multi( 'agrif_istate_oce', uu(:,:,:  ,Kbb), 'U', -1.0_wp , vv(:,:,:,Kbb), 'V', -1.0_wp )
+      CALL lbc_lnk( 'agrif_istate_oce', uu(:,:,:  ,Kbb), 'U', -1.0_wp , vv(:,:,:,Kbb), 'V', -1.0_wp )
       CALL lbc_lnk( 'agrif_istate_oce', ts(:,:,:,:,Kbb), 'T',  1.0_wp )
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_sponge.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_sponge.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_oce_sponge.F90	(revision 14676)
@@ -236,5 +236,5 @@
       END_2D
       
-      CALL lbc_lnk_multi( 'agrif_Sponge', fspu, 'U', 1._wp, fspv, 'V', 1._wp, fspt, 'T', 1._wp, fspf, 'F', 1._wp )
+      CALL lbc_lnk( 'agrif_Sponge', fspu, 'U', 1._wp, fspv, 'V', 1._wp, fspt, 'T', 1._wp, fspf, 'F', 1._wp )
       !
       ! Remove vertical interpolation where not needed:
@@ -368,5 +368,5 @@
          fspf_2d(ji,jj) = ztabramp(ji,jj) * ssvmask(ji,jj) * ssvmask(ji,jj+1)
          END_2D
-      CALL lbc_lnk_multi( 'agrif_Sponge_2d', fspu_2d, 'U', 1._wp, fspv_2d, 'V', 1._wp, fspt_2d, 'T', 1._wp, fspf_2d, 'F', 1._wp )
+      CALL lbc_lnk( 'agrif_Sponge_2d', fspu_2d, 'U', 1._wp, fspv_2d, 'V', 1._wp, fspt_2d, 'T', 1._wp, fspf_2d, 'F', 1._wp )
       !
 #endif
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_user.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_user.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/agrif_user.F90	(revision 14676)
@@ -63,5 +63,5 @@
 ! In case of East-West periodicity, prevent AGRIF interpolation at east and west boundaries
 ! The procnames will not be called at these boundaries
-      IF (jperio == 1) THEN
+      IF (l_Iperio) THEN
          CALL Agrif_Set_NearCommonBorderX(.TRUE.)
          CALL Agrif_Set_DistantCommonBorderX(.TRUE.)
@@ -209,5 +209,5 @@
       ENDIF
       !
-      CALL lbc_lnk_multi( 'Agrif_Init_Domain', hu0_parent, 'U', 1.0_wp, hv0_parent, 'V', 1.0_wp )
+      CALL lbc_lnk( 'Agrif_Init_Domain', hu0_parent, 'U', 1.0_wp, hv0_parent, 'V', 1.0_wp )
       DO_2D( 0, 0, 0, 0 )
          zk(ji,jj) = REAL( mbku_parent(ji,jj), wp )
@@ -251,5 +251,5 @@
          ENDIF
 
-         CALL lbc_lnk_multi( 'Agrif_Init_Domain', e3u0_parent, 'U', 1.0_wp, e3v0_parent, 'V', 1.0_wp )
+         CALL lbc_lnk( 'Agrif_Init_Domain', e3u0_parent, 'U', 1.0_wp, e3v0_parent, 'V', 1.0_wp )
       ENDIF
 
@@ -872,5 +872,5 @@
       nbghostcells_y_n = nbghostcells
       !
-      IF(   jperio == 1  )   nbghostcells_x   = 0
+      IF(    l_Iperio    )   nbghostcells_x   = 0
       IF( .NOT. lk_south )   nbghostcells_y_s = 0
       IF( .NOT. lk_north )   nbghostcells_y_n = 0
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/vremap.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/vremap.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/NST/vremap.F90	(revision 14676)
@@ -1,3 +1,3 @@
-#undef PPR_LIB      /* USE PPR library */
+#define PPR_LIB      /* USE PPR library */
 MODULE vremap
 !$AGRIF_DO_NOT_TREAT
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn2d.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn2d.F90	(revision 14676)
@@ -18,4 +18,5 @@
    USE bdylib          ! BDY library routines
    USE phycst          ! physical constants
+   USE lib_mpp, ONLY: jpfillnothing
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE wet_dry         ! Use wet dry to get reference ssh level
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn3d.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn3d.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdydyn3d.F90	(revision 14676)
@@ -15,4 +15,5 @@
    USE bdy_oce         ! ocean open boundary conditions
    USE bdylib          ! for orlanski library routines
+   USE lib_mpp, ONLY: jpfillnothing
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager  !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyice.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyice.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyice.F90	(revision 14676)
@@ -92,11 +92,11 @@
          IF( ANY(llsend1) .OR. ANY(llrecv1) ) THEN   ! if need to send/recv in at least one direction
             ! exchange 3d arrays
-            CALL lbc_lnk_multi('bdyice', a_i , 'T', 1._wp, h_i , 'T', 1._wp, h_s , 'T', 1._wp, oa_i, 'T', 1._wp                   &
-               &                       , s_i , 'T', 1._wp, t_su, 'T', 1._wp, v_i , 'T', 1._wp, v_s , 'T', 1._wp, sv_i, 'T', 1._wp &
-               &                       , a_ip, 'T', 1._wp, v_ip, 'T', 1._wp, v_il, 'T', 1._wp                                     &
-               &                       , kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
+            CALL lbc_lnk('bdyice', a_i , 'T', 1._wp, h_i , 'T', 1._wp, h_s , 'T', 1._wp, oa_i, 'T', 1._wp                   &
+               &                 , s_i , 'T', 1._wp, t_su, 'T', 1._wp, v_i , 'T', 1._wp, v_s , 'T', 1._wp, sv_i, 'T', 1._wp &
+               &                 , a_ip, 'T', 1._wp, v_ip, 'T', 1._wp, v_il, 'T', 1._wp                                     &
+               &                 , kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
             ! exchange 4d arrays :   third dimension = 1   and then   third dimension = jpk
-            CALL lbc_lnk_multi('bdyice', t_s , 'T', 1._wp, e_s , 'T', 1._wp, kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
-            CALL lbc_lnk_multi('bdyice', t_i , 'T', 1._wp, e_i , 'T', 1._wp, kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
+            CALL lbc_lnk('bdyice', t_s , 'T', 1._wp, e_s , 'T', 1._wp, kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
+            CALL lbc_lnk('bdyice', t_i , 'T', 1._wp, e_i , 'T', 1._wp, kfillmode=jpfillnothing ,lsend=llsend1, lrecv=llrecv1 )
          END IF
       END DO   ! ir
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyini.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyini.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdyini.F90	(revision 14676)
@@ -166,7 +166,5 @@
       ! Check and write out namelist parameters
       ! -----------------------------------------
-      IF( jperio /= 0 )   CALL ctl_stop( 'bdy_segs: Cyclic or symmetric,',   &
-         &                               ' and general open boundary condition are not compatible' )
-
+      
       IF(lwp) WRITE(numout,*) 'Number of open boundary sets : ', nb_bdy
 
@@ -575,21 +573,21 @@
                ! check if point has to be sent     to   a neighbour
                ! W neighbour and on the inner left  side
-               IF( ii == 2     .and. (nbondi == 0 .or. nbondi ==  1) )   lsend_bdy(ib_bdy,igrd,1,ir) = .true.
+               IF( ii == 2     .AND. mpiSnei(nn_hls,jpwe) > -1 )   lsend_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.
                ! E neighbour and on the inner right side
-               IF( ii == jpi-1 .and. (nbondi == 0 .or. nbondi == -1) )   lsend_bdy(ib_bdy,igrd,2,ir) = .true.
+               IF( ii == jpi-1 .AND. mpiSnei(nn_hls,jpea) > -1 )   lsend_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.
                ! S neighbour and on the inner down side
-               IF( ij == 2     .and. (nbondj == 0 .or. nbondj ==  1) )   lsend_bdy(ib_bdy,igrd,3,ir) = .true.
+               IF( ij == 2     .AND. mpiSnei(nn_hls,jpso) > -1 )   lsend_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.
                ! N neighbour and on the inner up   side
-               IF( ij == jpj-1 .and. (nbondj == 0 .or. nbondj == -1) )   lsend_bdy(ib_bdy,igrd,4,ir) = .true.
+               IF( ij == jpj-1 .AND. mpiSnei(nn_hls,jpno) > -1 )   lsend_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.
                !
                ! check if point has to be received from a neighbour
                ! W neighbour and on the outter left  side
-               IF( ii == 1     .and. (nbondi == 0 .or. nbondi ==  1) )   lrecv_bdy(ib_bdy,igrd,1,ir) = .true.
+               IF( ii == 1     .AND. mpiRnei(nn_hls,jpwe) > -1 )   lrecv_bdy(ib_bdy,igrd,jpwe,ir) = .TRUE.
                ! E neighbour and on the outter right side
-               IF( ii == jpi   .and. (nbondi == 0 .or. nbondi == -1) )   lrecv_bdy(ib_bdy,igrd,2,ir) = .true.
+               IF( ii == jpi   .AND. mpiRnei(nn_hls,jpea) > -1 )   lrecv_bdy(ib_bdy,igrd,jpea,ir) = .TRUE.
                ! S neighbour and on the outter down side
-               IF( ij == 1     .and. (nbondj == 0 .or. nbondj ==  1) )   lrecv_bdy(ib_bdy,igrd,3,ir) = .true.
+               IF( ij == 1     .AND. mpiRnei(nn_hls,jpso) > -1 )   lrecv_bdy(ib_bdy,igrd,jpso,ir) = .TRUE.
                ! N neighbour and on the outter up   side
-               IF( ij == jpj   .and. (nbondj == 0 .or. nbondj == -1) )   lrecv_bdy(ib_bdy,igrd,4,ir) = .true.
+               IF( ij == jpj   .AND. mpiRnei(nn_hls,jpno) > -1 )   lrecv_bdy(ib_bdy,igrd,jpno,ir) = .TRUE.
                !
             END DO
@@ -654,5 +652,5 @@
          END DO
       END DO
-      CALL lbc_lnk_multi( 'bdyini', bdyumask, 'U', 1.0_wp , bdyvmask, 'V', 1.0_wp )   ! Lateral boundary cond. 
+      CALL lbc_lnk( 'bdyini', bdyumask, 'U', 1.0_wp , bdyvmask, 'V', 1.0_wp )   ! Lateral boundary cond. 
 
       ! bdy masks are now set to zero on rim 0 points:
@@ -739,19 +737,19 @@
                !      <--    (o exterior)     -->  
                ! (1)  o|x         OR    (2)   x|o
-               !       |___                 ___| 
-               IF( iibi == 0     .OR. ii1 == 0     .OR. ii2 == 0     .OR. ii3 == 0     )   lrecv_bdyint(ib_bdy,igrd,1,ir) = .true.
-               IF( iibi == jpi+1 .OR. ii1 == jpi+1 .OR. ii2 == jpi+1 .OR. ii3 == jpi+1 )   lrecv_bdyint(ib_bdy,igrd,2,ir) = .true.  
-               IF( iibe == 0                                                           )   lrecv_bdyext(ib_bdy,igrd,1,ir) = .true.
-               IF( iibe == jpi+1                                                       )   lrecv_bdyext(ib_bdy,igrd,2,ir) = .true.  
+               !       |___                 ___|
+               IF( iibi==0     .OR. ii1==0     .OR. ii2==0     .OR. ii3==0     )   lrecv_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE.
+               IF( iibi==jpi+1 .OR. ii1==jpi+1 .OR. ii2==jpi+1 .OR. ii3==jpi+1 )   lrecv_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE.  
+               IF( iibe==0                                                     )   lrecv_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE.
+               IF( iibe==jpi+1                                                 )   lrecv_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE.  
                ! Check if neighbour has its rim parallel to its mpi subdomain border and located next to its halo
                ! :¨¨¨¨¨|¨¨-->    |                                             |    <--¨¨|¨¨¨¨¨: 
                ! :     |  x:o    |    neighbour limited by ... would need o    |    o:x  |     :
                ! :.....|_._:_____|   (1) W neighbour         E neighbour (2)   |_____:_._|.....:
-               IF( ii == 2     .AND. ( nbondi ==  1 .OR. nbondi == 0 ) .AND. &
-                  & ( iibi == 3     .OR. ii1 == 3     .OR. ii2 == 3     .OR. ii3 == 3    ) )   lsend_bdyint(ib_bdy,igrd,1,ir)=.true.
-               IF( ii == jpi-1 .AND. ( nbondi == -1 .OR. nbondi == 0 ) .AND. &
-                  & ( iibi == jpi-2 .OR. ii1 == jpi-2 .OR. ii2 == jpi-2 .OR. ii3 == jpi-2) )   lsend_bdyint(ib_bdy,igrd,2,ir)=.true.
-               IF( ii == 2     .AND. ( nbondi ==  1 .OR. nbondi == 0 ) .AND. iibe == 3     )   lsend_bdyext(ib_bdy,igrd,1,ir)=.true.
-               IF( ii == jpi-1 .AND. ( nbondi == -1 .OR. nbondi == 0 ) .AND. iibe == jpi-2 )   lsend_bdyext(ib_bdy,igrd,2,ir)=.true.
+               IF( ii==2     .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. &
+                  & ( iibi==3     .OR. ii1==3     .OR. ii2==3     .OR. ii3==3    ) )   lsend_bdyint(ib_bdy,igrd,jpwe,ir) = .TRUE.
+               IF( ii==jpi-1 .AND. mpiSnei(nn_hls,jpea) > -1 .AND. &
+                  & ( iibi==jpi-2 .OR. ii1==jpi-2 .OR. ii2==jpi-2 .OR. ii3==jpi-2) )   lsend_bdyint(ib_bdy,igrd,jpea,ir) = .TRUE.
+               IF( ii==2     .AND. mpiSnei(nn_hls,jpwe) > -1 .AND. iibe==3     )   lsend_bdyext(ib_bdy,igrd,jpwe,ir) = .TRUE.
+               IF( ii==jpi-1 .AND. mpiSnei(nn_hls,jpea) > -1 .AND. iibe==jpi-2 )   lsend_bdyext(ib_bdy,igrd,jpea,ir) = .TRUE.
                !
                ! search neighbour in the north/south direction   
@@ -760,18 +758,18 @@
                !  |   |___x___|   OR    |  |   x   |
                !  v       o           (4)  |       |
-               IF( ijbi == 0     .OR. ij1 == 0     .OR. ij2 == 0     .OR. ij3 == 0     )   lrecv_bdyint(ib_bdy,igrd,3,ir) = .true.
-               IF( ijbi == jpj+1 .OR. ij1 == jpj+1 .OR. ij2 == jpj+1 .OR. ij3 == jpj+1 )   lrecv_bdyint(ib_bdy,igrd,4,ir) = .true.
-               IF( ijbe == 0                                                           )   lrecv_bdyext(ib_bdy,igrd,3,ir) = .true.
-               IF( ijbe == jpj+1                                                       )   lrecv_bdyext(ib_bdy,igrd,4,ir) = .true.
+               IF( ijbi==0     .OR. ij1==0     .OR. ij2==0     .OR. ij3==0     )   lrecv_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE.
+               IF( ijbi==jpj+1 .OR. ij1==jpj+1 .OR. ij2==jpj+1 .OR. ij3==jpj+1 )   lrecv_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE.
+               IF( ijbe==0                                                     )   lrecv_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE.
+               IF( ijbe==jpj+1                                                 )   lrecv_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE.
                ! Check if neighbour has its rim parallel to its mpi subdomain     _________  border and next to its halo
                !   ^  |    o    |                                                :         : 
                !   |  |¨¨¨¨x¨¨¨¨|   neighbour limited by ... would need o     |  |....x....|
                !      :_________:  (3) S neighbour          N neighbour (4)   v  |    o    |   
-               IF( ij == 2     .AND. ( nbondj ==  1 .OR. nbondj == 0 ) .AND. &
-                  & ( ijbi == 3     .OR. ij1 == 3     .OR. ij2 == 3     .OR. ij3 == 3    ) )   lsend_bdyint(ib_bdy,igrd,3,ir)=.true.
-               IF( ij == jpj-1 .AND. ( nbondj == -1 .OR. nbondj == 0 ) .AND. &
-                  & ( ijbi == jpj-2 .OR. ij1 == jpj-2 .OR. ij2 == jpj-2 .OR. ij3 == jpj-2) )   lsend_bdyint(ib_bdy,igrd,4,ir)=.true.
-               IF( ij == 2     .AND. ( nbondj ==  1 .OR. nbondj == 0 ) .AND. ijbe == 3     )   lsend_bdyext(ib_bdy,igrd,3,ir)=.true.
-               IF( ij == jpj-1 .AND. ( nbondj == -1 .OR. nbondj == 0 ) .AND. ijbe == jpj-2 )   lsend_bdyext(ib_bdy,igrd,4,ir)=.true.
+               IF( ij==2     .AND. mpiSnei(nn_hls,jpso) > -1 .AND. &
+                  & ( ijbi==3     .OR. ij1==3     .OR. ij2==3     .OR. ij3==3    ) )   lsend_bdyint(ib_bdy,igrd,jpso,ir) = .TRUE.
+               IF( ij==jpj-1 .AND. mpiSnei(nn_hls,jpno) > -1 .AND. &
+                  & ( ijbi==jpj-2 .OR. ij1==jpj-2 .OR. ij2==jpj-2 .OR. ij3==jpj-2) )   lsend_bdyint(ib_bdy,igrd,jpno,ir) = .TRUE.
+               IF( ij==2     .AND. mpiSnei(nn_hls,jpso) > -1 .AND. ijbe==3     )   lsend_bdyext(ib_bdy,igrd,jpso,ir) = .TRUE.
+               IF( ij==jpj-1 .AND. mpiSnei(nn_hls,jpno) > -1 .AND. ijbe==jpj-2 )   lsend_bdyext(ib_bdy,igrd,jpno,ir) = .TRUE.
             END DO
          END DO
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdytra.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdytra.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/BDY/bdytra.F90	(revision 14676)
@@ -18,4 +18,5 @@
    !
    USE in_out_manager ! I/O manager
+   USE lib_mpp, ONLY: jpfillnothing
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
    USE lib_mpp, ONLY: ctl_stop
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crs.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crs.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crs.F90	(revision 14676)
@@ -32,6 +32,6 @@
       INTEGER  ::  jpi_crsm1, jpj_crsm1         !: loop indices      
       INTEGER  ::  jpiglo_crsm1, jpjglo_crsm1   !: loop indices      
-      INTEGER  ::  nperio_full, nperio_crs      !: jperio of parent and coarse grids
-      INTEGER  ::  npolj_full, npolj_crs        !: north fold mark
+!!$      INTEGER  ::  nperio_full, nperio_crs      !: jperio of parent and coarse grids
+!!$      INTEGER  ::  npolj_full, npolj_crs        !: north fold mark
       INTEGER  ::  jpiglo_full, jpjglo_full     !: jpiglo / jpjglo
       INTEGER  ::  npiglo, npjglo               !: jpjglo
@@ -46,25 +46,5 @@
       INTEGER  ::  nimpp_full, njmpp_full       !: global position of point (1,1) of subdomain on parent grid
       INTEGER  ::  nimpp_crs, njmpp_crs         !: set to 1,1 for now .  Valid only for monoproc
-      !cc
-      INTEGER ::   noea_full, nowe_full        !: index of the local neighboring processors in
-      INTEGER ::   noso_full, nono_full        !: east, west, south and north directions
-      INTEGER ::   npne_full, npnw_full        !: index of north east and north west processor
-      INTEGER ::   npse_full, npsw_full        !: index of south east and south west processor
-      INTEGER ::   nbne_full, nbnw_full        !: logical of north east & north west processor
-      INTEGER ::   nbse_full, nbsw_full        !: logical of south east & south west processor
-      INTEGER ::   nidom_full                  !: ???
-      INTEGER ::   nproc_full                  !:number for local processor
-      INTEGER ::   nbondi_full, nbondj_full    !: mark of i- and j-direction local boundaries
-      INTEGER ::   noea_crs, nowe_crs          !: index of the local neighboring processors in
-      INTEGER ::   noso_crs, nono_crs          !: east, west, south and north directions
-      INTEGER ::   npne_crs, npnw_crs          !: index of north east and north west processor
-      INTEGER ::   npse_crs, npsw_crs          !: index of south east and south west processor
-      INTEGER ::   nbne_crs, nbnw_crs          !: logical of north east & north west processor
-      INTEGER ::   nbse_crs, nbsw_crs          !: logical of south east & south west processor
-      INTEGER ::   nidom_crs                   !: ???
-      INTEGER ::   nproc_crs                   !:number for local processor
-      INTEGER ::   nbondi_crs, nbondj_crs      !: mark of i- and j-direction local boundaries
-      
-
+     
       INTEGER, DIMENSION(:), ALLOCATABLE :: mis_crs, mie_crs, mis2_crs, mie2_crs  ! starting and ending i-indices of parent subset
       INTEGER, DIMENSION(:), ALLOCATABLE :: mjs_crs, mje_crs, mjs2_crs, mje2_crs ! starting and ending  j-indices of parent subset
@@ -72,12 +52,12 @@
       INTEGER, DIMENSION(:), ALLOCATABLE :: mi0_crs, mi1_crs, mj0_crs, mj1_crs
       INTEGER  :: mxbinctr, mybinctr            ! central point in grid box
-      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpiall_crs,  jpiall_full   !: dimensions of every subdomain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nis0all_crs, nis0all_full   !: first, last indoor index for each i-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nie0all_crs, nie0all_full   !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::    nimppt_crs,  nimppt_full   !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpjall_crs,  jpjall_full   !: dimensions of every subdomain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   njs0all_crs, njs0all_full   !: first, last indoor index for each i-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::   nje0all_crs, nje0all_full   !: first, last indoor index for each j-domain
-      INTEGER, DIMENSION(:), ALLOCATABLE ::    njmppt_crs,  njmppt_full   !: first, last indoor index for each j-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpiall_crs,  jpiall_full   !: dimensions of every subdomain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::   nis0all_crs, nis0all_full   !: first, last indoor index for each i-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::   nie0all_crs, nie0all_full   !: first, last indoor index for each j-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::    nimppt_crs,  nimppt_full   !: first, last indoor index for each j-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::    jpjall_crs,  jpjall_full   !: dimensions of every subdomain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::   njs0all_crs, njs0all_full   !: first, last indoor index for each i-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::   nje0all_crs, nje0all_full   !: first, last indoor index for each j-domain
+!!$      INTEGER, DIMENSION(:), ALLOCATABLE ::    njmppt_crs,  njmppt_full   !: first, last indoor index for each j-domain
 
  
@@ -231,8 +211,8 @@
          &      hmlp_crs(jpi_crs,jpj_crs) , hmlpt_crs(jpi_crs,jpj_crs) , STAT=ierr(14) )
          
-      ALLOCATE( nimppt_crs (jpnij) , jpiall_crs (jpnij) , nis0all_crs (jpnij) , nie0all_crs (jpnij),   &
-         &      nimppt_full(jpnij) , jpiall_full(jpnij) , nis0all_full(jpnij) , nie0all_full(jpnij),   &
-                njmppt_crs (jpnij) , jpjall_crs (jpnij) , njs0all_crs (jpnij) , nje0all_crs (jpnij),   &
-         &      njmppt_full(jpnij) , jpjall_full(jpnij) , njs0all_full(jpnij) , nje0all_full(jpnij)  , STAT=ierr(15) )
+!!$      ALLOCATE( nimppt_crs (jpnij) , jpiall_crs (jpnij) , nis0all_crs (jpnij) , nie0all_crs (jpnij),   &
+!!$         &      nimppt_full(jpnij) , jpiall_full(jpnij) , nis0all_full(jpnij) , nie0all_full(jpnij),   &
+!!$                njmppt_crs (jpnij) , jpjall_crs (jpnij) , njs0all_crs (jpnij) , nje0all_crs (jpnij),   &
+!!$         &      njmppt_full(jpnij) , jpjall_full(jpnij) , njs0all_full(jpnij) , nje0all_full(jpnij)  , STAT=ierr(15) )
    
       crs_dom_alloc = MAXVAL(ierr)
@@ -269,7 +249,7 @@
       jpim1  = jpim1_full
       jpjm1  = jpjm1_full
-      jperio = nperio_full
-
-      npolj  = npolj_full
+!!$      jperio = nperio_full
+
+!!$      npolj  = npolj_full
       jpiglo = jpiglo_full
       jpjglo = jpjglo_full
@@ -284,12 +264,12 @@
       njmpp = njmpp_full
       
-      jpiall (:) = jpiall_full (:)
-      nis0all(:) = nis0all_full(:)
-      nie0all(:) = nie0all_full(:)
-      nimppt (:) = nimppt_full (:)
-      jpjall (:) = jpjall_full (:)
-      njs0all(:) = njs0all_full(:)
-      nje0all(:) = nje0all_full(:)
-      njmppt (:) = njmppt_full (:)
+!!$      jpiall (:) = jpiall_full (:)
+!!$      nis0all(:) = nis0all_full(:)
+!!$      nie0all(:) = nie0all_full(:)
+!!$      nimppt (:) = nimppt_full (:)
+!!$      jpjall (:) = jpjall_full (:)
+!!$      njs0all(:) = njs0all_full(:)
+!!$      nje0all(:) = nje0all_full(:)
+!!$      njmppt (:) = njmppt_full (:)
 
    END SUBROUTINE dom_grid_glo
@@ -308,7 +288,7 @@
       jpim1  = jpi_crsm1
       jpjm1  = jpj_crsm1
-      jperio = nperio_crs
-
-      npolj  = npolj_crs
+!!$      jperio = nperio_crs
+
+!!$      npolj  = npolj_crs
       jpiglo = jpiglo_crs
       jpjglo = jpjglo_crs
@@ -324,12 +304,12 @@
       njmpp = njmpp_crs
       
-      jpiall (:) = jpiall_crs (:)
-      nis0all(:) = nis0all_crs(:)
-      nie0all(:) = nie0all_crs(:)
-      nimppt (:) = nimppt_crs (:)
-      jpjall (:) = jpjall_crs (:)
-      njs0all(:) = njs0all_crs(:)
-      nje0all(:) = nje0all_crs(:)
-      njmppt (:) = njmppt_crs (:)
+!!$      jpiall (:) = jpiall_crs (:)
+!!$      nis0all(:) = nis0all_crs(:)
+!!$      nie0all(:) = nie0all_crs(:)
+!!$      nimppt (:) = nimppt_crs (:)
+!!$      jpjall (:) = jpjall_crs (:)
+!!$      njs0all(:) = njs0all_crs(:)
+!!$      nje0all(:) = nje0all_crs(:)
+!!$      njmppt (:) = njmppt_crs (:)
       !
    END SUBROUTINE dom_grid_crs
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crsdom.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crsdom.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crsdom.F90	(revision 14676)
@@ -30,5 +30,5 @@
    !!       Original.   May 2012.  (J. Simeon, C. Calone, G. Madec, C. Ethe)
    !!===================================================================
-   USE dom_oce        ! ocean space and time domain and to get jperio
+   USE dom_oce        ! ocean space and time domain
    USE crs            ! domain for coarse grid
    !
@@ -1877,183 +1877,183 @@
  
   
-     ! 1.a. Define global domain indices  : take into account the interior domain only ( removes i/j=1 , i/j=jpiglo/jpjglo ) then add 2/3 grid points 
-      jpiglo_crs   = INT( (jpiglo - 2) / nn_factx ) + 2
-  !    jpjglo_crs   = INT( (jpjglo - 2) / nn_facty ) + 2  ! the -2 removes j=1, j=jpj
-  !    jpjglo_crs   = INT( (jpjglo - 2) / nn_facty ) + 3
-      jpjglo_crs   = INT( (jpjglo - MOD(jpjglo, nn_facty)) / nn_facty ) + 3
-      jpiglo_crsm1 = jpiglo_crs - 1
-      jpjglo_crsm1 = jpjglo_crs - 1  
-
-      jpi_crs = ( jpiglo_crs   - 2 * nn_hls + (jpni-1) ) / jpni + 2 * nn_hls
-      jpj_crs = ( jpjglo_crsm1 - 2 * nn_hls + (jpnj-1) ) / jpnj + 2 * nn_hls   
-              
-      IF( noso < 0 ) jpj_crs = jpj_crs + 1    ! add a local band on southern processors  
-       
-      jpi_crsm1   = jpi_crs - 1
-      jpj_crsm1   = jpj_crs - 1
-      nperio_crs  = jperio
-      npolj_crs   = npolj
-      
-      ierr = crs_dom_alloc()          ! allocate most coarse grid arrays
-
-      ! 2.a Define processor domain
-      IF( .NOT. lk_mpp ) THEN
-         nimpp_crs = 1
-         njmpp_crs = 1
-         Nis0_crs  = 1
-         Njs0_crs  = 1
-         Nie0_crs  = jpi_crs
-         Nje0_crs  = jpj_crs
-      ELSE
-         ! Initialisation of most local variables -
-         nimpp_crs = 1
-         njmpp_crs = 1
-         Nis0_crs  = 1
-         Njs0_crs  = 1
-         Nie0_crs  = jpi_crs
-         Nje0_crs  = jpj_crs
-         
-        ! Calculs suivant une découpage en j
-        DO jn = 1, jpnij, jpni
-           IF( jn < ( jpnij - jpni + 1 ) ) THEN
-              nje0all_crs(jn) = AINT( REAL( ( jpjglo - (njmppt(jn     ) - 1) ) / nn_facty, wp ) ) &
-                       &    - AINT( REAL( ( jpjglo - (njmppt(jn+jpni) - 1) ) / nn_facty, wp ) )
-           ELSE                                             
-              nje0all_crs(jn) = AINT( REAL(  nje0all(jn) / nn_facty, wp ) ) + 1            
-           ENDIF
-           IF( noso < 0 ) nje0all_crs(jn) = nje0all_crs(jn) + 1             
-           SELECT CASE( ibonjt(jn) )
-              CASE ( -1 )
-                IF( MOD( jpjglo - njmppt(jn), nn_facty) > 0 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
-                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
-                njs0all_crs(jn) = njs0all(jn)
-              
-              CASE ( 0 )
-              
-                njs0all_crs(jn) = njs0all(jn)
-                IF( njs0all(jn) == 1 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
-                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
-                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
-                
-              CASE ( 1, 2 )
-              
-                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
-                jpjall_crs (jn) = nje0all_crs(jn)
-                njs0all_crs(jn) = njs0all(jn)
-                
-              CASE DEFAULT
-                 CALL ctl_stop( 'STOP', 'error from crs_dom_def, you should not be there (1) ...' )
-           END SELECT
-           IF( jpjall_crs(jn) > jpj_crs )     jpj_crs = jpj_crs + 1
-
-           IF(njs0all_crs(jn) == 1 ) THEN
-              njmppt_crs(jn) = 1
-           ELSE
-              njmppt_crs(jn) = 2 + ANINT(REAL((njmppt(jn) + 1 - MOD( jpjglo , nn_facty )) / nn_facty, wp ) )
-           ENDIF           
-           
-           DO jj = jn + 1, jn + jpni - 1
-              nje0all_crs(jj) = nje0all_crs(jn) 
-              jpjall_crs (jj) = jpjall_crs(jn)
-              njs0all_crs(jj) = njs0all_crs(jn)
-              njmppt_crs (jj) = njmppt_crs(jn)
-           ENDDO
-        ENDDO 
-        Nje0_crs  = nje0all_crs(narea) 
-        jpj_crs   = jpjall_crs (narea)
-        Njs0_crs  = njs0all_crs(narea)
-        njmpp_crs = njmppt_crs (narea)
-
-        ! Calcul suivant un decoupage en i
-        DO jn = 1, jpni
-           IF( jn == 1 ) THEN          
-              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) )
-           ELSE
-              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) ) &
-                 &            - AINT( REAL( ( nimppt(jn-1) - 1 + jpiall(jn-1) )  / nn_factx, wp) )
-           ENDIF
-
-           SELECT CASE( ibonit(jn) )
-              CASE ( -1 )
-                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls           
-                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
-                 nis0all_crs(jn) = nis0all(jn) 
-              
-              CASE ( 0 )
-                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
-                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
-                 nis0all_crs(jn) = nis0all(jn) 
-                
-              CASE ( 1, 2 )
-                 IF( MOD( jpiglo - nimppt(jn), nn_factx) > 0 )  nie0all_crs(jn) = nie0all_crs(jn) + 1
-                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
-                 jpiall_crs (jn) = nie0all_crs(jn)
-                 nis0all_crs(jn) = nis0all(jn) 
-
-              CASE DEFAULT
-                 CALL ctl_stop( 'STOP', 'error from crs_dom_def, you should not be there (2) ...' )
-           END SELECT
-
-           nimppt_crs(jn) = ANINT( REAL( (nimppt(jn) + 1 ) / nn_factx, wp ) ) + 1
-           DO jj = jn + jpni , jpnij, jpni
-              nie0all_crs(jj) = nie0all_crs(jn) 
-              jpiall_crs (jj) = jpiall_crs (jn)
-              nis0all_crs(jj) = nis0all_crs(jn)
-              nimppt_crs (jj) = nimppt_crs (jn)
-           ENDDO
-         ENDDO 
-        
-         Nie0_crs  = nie0all_crs(narea) 
-         jpi_crs   = jpiall_crs (narea)
-         Nis0_crs  = nis0all_crs(narea)
-         nimpp_crs = nimppt_crs (narea)
-
-         DO ji = 1, jpi_crs
-            mig_crs(ji) = ji + nimpp_crs - 1
-         ENDDO
-         DO jj = 1, jpj_crs
-            mjg_crs(jj) = jj + njmpp_crs - 1!
-         ENDDO
-       
-         DO ji = 1, jpiglo_crs
-            mi0_crs(ji) = MAX( 1, MIN( ji - nimpp_crs + 1 , jpi_crs + 1 ) )
-            mi1_crs(ji) = MAX( 0, MIN( ji - nimpp_crs + 1 , jpi_crs     ) )
-         ENDDO
-         
-         DO jj = 1, jpjglo_crs
-            mj0_crs(jj) = MAX( 1, MIN( jj - njmpp_crs + 1 , jpj_crs + 1 ) )
-            mj1_crs(jj) = MAX( 0, MIN( jj - njmpp_crs + 1 , jpj_crs     ) )
-         ENDDO
-
-      ENDIF
-      
-      !                         Save the parent grid information
-      jpi_full    = jpi
-      jpj_full    = jpj
-      jpim1_full  = jpim1
-      jpjm1_full  = jpjm1
-      nperio_full = jperio
-
-      npolj_full  = npolj
-      jpiglo_full = jpiglo
-      jpjglo_full = jpjglo
-
-      jpj_full   = jpj
-      jpi_full   = jpi
-      Nis0_full  = Nis0
-      Njs0_full  = Njs0
-      Nie0_full  = Nie0
-      Nje0_full  = Nje0
-      nimpp_full = nimpp     
-      njmpp_full = njmpp
-      
-      jpiall_full (:) = jpiall (:)
-      nis0all_full(:) = nis0all(:)
-      nie0all_full(:) = nie0all(:)
-      nimppt_full (:) = nimppt (:)
-      jpjall_full (:) = jpjall (:)
-      njs0all_full(:) = njs0all(:)
-      nje0all_full(:) = nje0all(:)
-      njmppt_full (:) = njmppt (:)
+!!$     ! 1.a. Define global domain indices  : take into account the interior domain only ( removes i/j=1 , i/j=jpiglo/jpjglo ) then add 2/3 grid points 
+!!$      jpiglo_crs   = INT( (jpiglo - 2) / nn_factx ) + 2
+!!$  !    jpjglo_crs   = INT( (jpjglo - 2) / nn_facty ) + 2  ! the -2 removes j=1, j=jpj
+!!$  !    jpjglo_crs   = INT( (jpjglo - 2) / nn_facty ) + 3
+!!$      jpjglo_crs   = INT( (jpjglo - MOD(jpjglo, nn_facty)) / nn_facty ) + 3
+!!$      jpiglo_crsm1 = jpiglo_crs - 1
+!!$      jpjglo_crsm1 = jpjglo_crs - 1  
+!!$
+!!$      jpi_crs = ( jpiglo_crs   - 2 * nn_hls + (jpni-1) ) / jpni + 2 * nn_hls
+!!$      jpj_crs = ( jpjglo_crsm1 - 2 * nn_hls + (jpnj-1) ) / jpnj + 2 * nn_hls   
+!!$              
+!!$      IF( noso < 0 ) jpj_crs = jpj_crs + 1    ! add a local band on southern processors  
+!!$       
+!!$      jpi_crsm1   = jpi_crs - 1
+!!$      jpj_crsm1   = jpj_crs - 1
+!!$      nperio_crs  = jperio
+!!$      npolj_crs   = npolj
+!!$      
+!!$      ierr = crs_dom_alloc()          ! allocate most coarse grid arrays
+!!$
+!!$      ! 2.a Define processor domain
+!!$      IF( .NOT. lk_mpp ) THEN
+!!$         nimpp_crs = 1
+!!$         njmpp_crs = 1
+!!$         Nis0_crs  = 1
+!!$         Njs0_crs  = 1
+!!$         Nie0_crs  = jpi_crs
+!!$         Nje0_crs  = jpj_crs
+!!$      ELSE
+!!$         ! Initialisation of most local variables -
+!!$         nimpp_crs = 1
+!!$         njmpp_crs = 1
+!!$         Nis0_crs  = 1
+!!$         Njs0_crs  = 1
+!!$         Nie0_crs  = jpi_crs
+!!$         Nje0_crs  = jpj_crs
+!!$         
+!!$        ! Calculs suivant une découpage en j
+!!$        DO jn = 1, jpnij, jpni
+!!$           IF( jn < ( jpnij - jpni + 1 ) ) THEN
+!!$              nje0all_crs(jn) = AINT( REAL( ( jpjglo - (njmppt(jn     ) - 1) ) / nn_facty, wp ) ) &
+!!$                       &    - AINT( REAL( ( jpjglo - (njmppt(jn+jpni) - 1) ) / nn_facty, wp ) )
+!!$           ELSE                                             
+!!$              nje0all_crs(jn) = AINT( REAL(  nje0all(jn) / nn_facty, wp ) ) + 1            
+!!$           ENDIF
+!!$           IF( noso < 0 ) nje0all_crs(jn) = nje0all_crs(jn) + 1             
+!!$           SELECT CASE( ibonjt(jn) )
+!!$              CASE ( -1 )
+!!$                IF( MOD( jpjglo - njmppt(jn), nn_facty) > 0 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
+!!$                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
+!!$                njs0all_crs(jn) = njs0all(jn)
+!!$              
+!!$              CASE ( 0 )
+!!$              
+!!$                njs0all_crs(jn) = njs0all(jn)
+!!$                IF( njs0all(jn) == 1 )  nje0all_crs(jn) = nje0all_crs(jn) + 1
+!!$                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
+!!$                jpjall_crs (jn) = nje0all_crs(jn) + nn_hls
+!!$                
+!!$              CASE ( 1, 2 )
+!!$              
+!!$                nje0all_crs(jn) = nje0all_crs(jn) + nn_hls
+!!$                jpjall_crs (jn) = nje0all_crs(jn)
+!!$                njs0all_crs(jn) = njs0all(jn)
+!!$                
+!!$              CASE DEFAULT
+!!$                 CALL ctl_stop( 'STOP', 'error from crs_dom_def, you should not be there (1) ...' )
+!!$           END SELECT
+!!$           IF( jpjall_crs(jn) > jpj_crs )     jpj_crs = jpj_crs + 1
+!!$
+!!$           IF(njs0all_crs(jn) == 1 ) THEN
+!!$              njmppt_crs(jn) = 1
+!!$           ELSE
+!!$              njmppt_crs(jn) = 2 + ANINT(REAL((njmppt(jn) + 1 - MOD( jpjglo , nn_facty )) / nn_facty, wp ) )
+!!$           ENDIF           
+!!$           
+!!$           DO jj = jn + 1, jn + jpni - 1
+!!$              nje0all_crs(jj) = nje0all_crs(jn) 
+!!$              jpjall_crs (jj) = jpjall_crs(jn)
+!!$              njs0all_crs(jj) = njs0all_crs(jn)
+!!$              njmppt_crs (jj) = njmppt_crs(jn)
+!!$           ENDDO
+!!$        ENDDO 
+!!$        Nje0_crs  = nje0all_crs(narea) 
+!!$        jpj_crs   = jpjall_crs (narea)
+!!$        Njs0_crs  = njs0all_crs(narea)
+!!$        njmpp_crs = njmppt_crs (narea)
+!!$
+!!$        ! Calcul suivant un decoupage en i
+!!$        DO jn = 1, jpni
+!!$           IF( jn == 1 ) THEN          
+!!$              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) )
+!!$           ELSE
+!!$              nie0all_crs(jn) = AINT( REAL( ( nimppt(jn  ) - 1 + jpiall(jn  ) )  / nn_factx, wp) ) &
+!!$                 &            - AINT( REAL( ( nimppt(jn-1) - 1 + jpiall(jn-1) )  / nn_factx, wp) )
+!!$           ENDIF
+!!$
+!!$           SELECT CASE( ibonit(jn) )
+!!$              CASE ( -1 )
+!!$                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls           
+!!$                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
+!!$                 nis0all_crs(jn) = nis0all(jn) 
+!!$              
+!!$              CASE ( 0 )
+!!$                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
+!!$                 jpiall_crs (jn) = nie0all_crs(jn) + nn_hls
+!!$                 nis0all_crs(jn) = nis0all(jn) 
+!!$                
+!!$              CASE ( 1, 2 )
+!!$                 IF( MOD( jpiglo - nimppt(jn), nn_factx) > 0 )  nie0all_crs(jn) = nie0all_crs(jn) + 1
+!!$                 nie0all_crs(jn) = nie0all_crs(jn) + nn_hls
+!!$                 jpiall_crs (jn) = nie0all_crs(jn)
+!!$                 nis0all_crs(jn) = nis0all(jn) 
+!!$
+!!$              CASE DEFAULT
+!!$                 CALL ctl_stop( 'STOP', 'error from crs_dom_def, you should not be there (2) ...' )
+!!$           END SELECT
+!!$
+!!$           nimppt_crs(jn) = ANINT( REAL( (nimppt(jn) + 1 ) / nn_factx, wp ) ) + 1
+!!$           DO jj = jn + jpni , jpnij, jpni
+!!$              nie0all_crs(jj) = nie0all_crs(jn) 
+!!$              jpiall_crs (jj) = jpiall_crs (jn)
+!!$              nis0all_crs(jj) = nis0all_crs(jn)
+!!$              nimppt_crs (jj) = nimppt_crs (jn)
+!!$           ENDDO
+!!$         ENDDO 
+!!$        
+!!$         Nie0_crs  = nie0all_crs(narea) 
+!!$         jpi_crs   = jpiall_crs (narea)
+!!$         Nis0_crs  = nis0all_crs(narea)
+!!$         nimpp_crs = nimppt_crs (narea)
+!!$
+!!$         DO ji = 1, jpi_crs
+!!$            mig_crs(ji) = ji + nimpp_crs - 1
+!!$         ENDDO
+!!$         DO jj = 1, jpj_crs
+!!$            mjg_crs(jj) = jj + njmpp_crs - 1!
+!!$         ENDDO
+!!$       
+!!$         DO ji = 1, jpiglo_crs
+!!$            mi0_crs(ji) = MAX( 1, MIN( ji - nimpp_crs + 1 , jpi_crs + 1 ) )
+!!$            mi1_crs(ji) = MAX( 0, MIN( ji - nimpp_crs + 1 , jpi_crs     ) )
+!!$         ENDDO
+!!$         
+!!$         DO jj = 1, jpjglo_crs
+!!$            mj0_crs(jj) = MAX( 1, MIN( jj - njmpp_crs + 1 , jpj_crs + 1 ) )
+!!$            mj1_crs(jj) = MAX( 0, MIN( jj - njmpp_crs + 1 , jpj_crs     ) )
+!!$         ENDDO
+!!$
+!!$      ENDIF
+!!$      
+!!$      !                         Save the parent grid information
+!!$      jpi_full    = jpi
+!!$      jpj_full    = jpj
+!!$      jpim1_full  = jpim1
+!!$      jpjm1_full  = jpjm1
+!!$      nperio_full = jperio
+!!$
+!!$      npolj_full  = npolj
+!!$      jpiglo_full = jpiglo
+!!$      jpjglo_full = jpjglo
+!!$
+!!$      jpj_full   = jpj
+!!$      jpi_full   = jpi
+!!$      Nis0_full  = Nis0
+!!$      Njs0_full  = Njs0
+!!$      Nie0_full  = Nie0
+!!$      Nje0_full  = Nje0
+!!$      nimpp_full = nimpp     
+!!$      njmpp_full = njmpp
+!!$      
+!!$      jpiall_full (:) = jpiall (:)
+!!$      nis0all_full(:) = nis0all(:)
+!!$      nie0all_full(:) = nie0all(:)
+!!$      nimppt_full (:) = nimppt (:)
+!!$      jpjall_full (:) = jpjall (:)
+!!$      njs0all_full(:) = njs0all(:)
+!!$      nje0all_full(:) = nje0all(:)
+!!$      njmppt_full (:) = njmppt (:)
       
       CALL dom_grid_crs  !swich de grille
@@ -2097,9 +2097,9 @@
       IF ( nresty == 0 ) THEN
          mybinctr = mybinctr - 1
-         IF ( jperio == 3 .OR. jperio == 4 )  nperio_crs = jperio + 2
-         IF ( jperio == 5 .OR. jperio == 6 )  nperio_crs = jperio - 2 
-
-         IF ( npolj == 3 ) npolj_crs = 5
-         IF ( npolj == 5 ) npolj_crs = 3
+!!$         IF ( jperio == 3 .OR. jperio == 4 )  nperio_crs = jperio + 2
+!!$         IF ( jperio == 5 .OR. jperio == 6 )  nperio_crs = jperio - 2 
+!!$
+!!$         IF ( npolj == 3 ) npolj_crs = 5
+!!$         IF ( npolj == 5 ) npolj_crs = 3
       ENDIF     
       
@@ -2117,64 +2117,64 @@
       CASE ( 0 ) 
 
-         SELECT CASE ( jperio )
-     
- 
-        CASE ( 0, 1, 3, 4 )    !   3, 4 : T-Pivot at North Fold
-        
-            DO ji = 2, jpiglo_crsm1
-               ijie = ( ji * nn_factx ) - nn_factx   !cc
-               ijis = ijie - nn_factx + 1
-               mis2_crs(ji) = ijis
-               mie2_crs(ji) = ijie
-            ENDDO
-            IF ( jpiglo - 1 - mie2_crs(jpiglo_crsm1) <= nn_factx ) mie2_crs(jpiglo_crsm1) = jpiglo - 2  
-
-            ! Handle first the northernmost bin
-            IF ( nn_facty == 2 ) THEN   ;    ijjgloT = jpjglo - 1 
-            ELSE                        ;    ijjgloT = jpjglo
-            ENDIF
-
-            DO jj = 2, jpjglo_crs
-                ijje = ijjgloT - nn_facty * ( jj - 3 )
-                ijjs = ijje - nn_facty + 1                   
-                mjs2_crs(jpjglo_crs-jj+2) = ijjs
-                mje2_crs(jpjglo_crs-jj+2) = ijje
-            ENDDO
-
-         CASE ( 2 ) 
-            WRITE(numout,*)  'crs_init, jperio=2 not supported' 
-        
-         CASE ( 5, 6 )    ! F-pivot at North Fold
-
-            DO ji = 2, jpiglo_crsm1
-               ijie = ( ji * nn_factx ) - nn_factx 
-               ijis = ijie - nn_factx + 1
-               mis2_crs(ji) = ijis
-               mie2_crs(ji) = ijie
-            ENDDO
-            IF ( jpiglo - 1 - mie2_crs(jpiglo_crsm1) <= nn_factx ) mie_crs(jpiglo_crsm1)  = jpiglo - 2 
-
-            ! Treat the northernmost bin separately.
-            jj = 2
-            ijje = jpj - nn_facty * ( jj - 2 )
-            IF ( nn_facty == 3 ) THEN   ;  ijjs = ijje - 1 
-            ELSE                        ;  ijjs = ijje - nn_facty + 1
-            ENDIF
-            mjs2_crs(jpj_crs-jj+1) = ijjs
-            mje2_crs(jpj_crs-jj+1) = ijje
-
-            ! Now bin the rest, any remainder at the south is lumped in the southern bin
-            DO jj = 3, jpjglo_crsm1
-                ijje = jpjglo - nn_facty * ( jj - 2 )
-                ijjs = ijje - nn_facty + 1                  
-                IF ( ijjs <= nn_facty )  ijjs = 2
-                mjs2_crs(jpj_crs-jj+1)   = ijjs
-                mje2_crs(jpj_crs-jj+1)   = ijje
-            ENDDO
-
-         CASE DEFAULT
-            WRITE(numout,*) 'crs_init. Only jperio = 0, 1, 3, 4, 5, 6 supported' 
- 
-         END SELECT
+!!$         SELECT CASE ( jperio )
+!!$     
+!!$ 
+!!$        CASE ( 0, 1, 3, 4 )    !   3, 4 : T-Pivot at North Fold
+!!$        
+!!$            DO ji = 2, jpiglo_crsm1
+!!$               ijie = ( ji * nn_factx ) - nn_factx   !cc
+!!$               ijis = ijie - nn_factx + 1
+!!$               mis2_crs(ji) = ijis
+!!$               mie2_crs(ji) = ijie
+!!$            ENDDO
+!!$            IF ( jpiglo - 1 - mie2_crs(jpiglo_crsm1) <= nn_factx ) mie2_crs(jpiglo_crsm1) = jpiglo - 2  
+!!$
+!!$            ! Handle first the northernmost bin
+!!$            IF ( nn_facty == 2 ) THEN   ;    ijjgloT = jpjglo - 1 
+!!$            ELSE                        ;    ijjgloT = jpjglo
+!!$            ENDIF
+!!$
+!!$            DO jj = 2, jpjglo_crs
+!!$                ijje = ijjgloT - nn_facty * ( jj - 3 )
+!!$                ijjs = ijje - nn_facty + 1                   
+!!$                mjs2_crs(jpjglo_crs-jj+2) = ijjs
+!!$                mje2_crs(jpjglo_crs-jj+2) = ijje
+!!$            ENDDO
+!!$
+!!$         CASE ( 2 ) 
+!!$            WRITE(numout,*)  'crs_init, jperio=2 not supported' 
+!!$        
+!!$         CASE ( 5, 6 )    ! F-pivot at North Fold
+!!$
+!!$            DO ji = 2, jpiglo_crsm1
+!!$               ijie = ( ji * nn_factx ) - nn_factx 
+!!$               ijis = ijie - nn_factx + 1
+!!$               mis2_crs(ji) = ijis
+!!$               mie2_crs(ji) = ijie
+!!$            ENDDO
+!!$            IF ( jpiglo - 1 - mie2_crs(jpiglo_crsm1) <= nn_factx ) mie_crs(jpiglo_crsm1)  = jpiglo - 2 
+!!$
+!!$            ! Treat the northernmost bin separately.
+!!$            jj = 2
+!!$            ijje = jpj - nn_facty * ( jj - 2 )
+!!$            IF ( nn_facty == 3 ) THEN   ;  ijjs = ijje - 1 
+!!$            ELSE                        ;  ijjs = ijje - nn_facty + 1
+!!$            ENDIF
+!!$            mjs2_crs(jpj_crs-jj+1) = ijjs
+!!$            mje2_crs(jpj_crs-jj+1) = ijje
+!!$
+!!$            ! Now bin the rest, any remainder at the south is lumped in the southern bin
+!!$            DO jj = 3, jpjglo_crsm1
+!!$                ijje = jpjglo - nn_facty * ( jj - 2 )
+!!$                ijjs = ijje - nn_facty + 1                  
+!!$                IF ( ijjs <= nn_facty )  ijjs = 2
+!!$                mjs2_crs(jpj_crs-jj+1)   = ijjs
+!!$                mje2_crs(jpj_crs-jj+1)   = ijje
+!!$            ENDDO
+!!$
+!!$         CASE DEFAULT
+!!$            WRITE(numout,*) 'crs_init. Only jperio = 0, 1, 3, 4, 5, 6 supported' 
+!!$ 
+!!$         END SELECT
 
       CASE (1 )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crslbclnk.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crslbclnk.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/CRS/crslbclnk.F90	(revision 14676)
@@ -50,5 +50,5 @@
       IF( .NOT.ll_grid_crs )   CALL dom_grid_crs   ! Save the parent grid information  & Switch to coarse grid domain
       !
-      CALL lbc_lnk( 'crslbclnk', pt3d1, cd_type1, psgn, kfillmode, pfillval )
+      CALL lbc_lnk( 'crslbclnk', pt3d1, cd_type1, psgn, kfillmode = kfillmode, pfillval = pfillval )
       !
       IF( .NOT.ll_grid_crs )   CALL dom_grid_glo   ! Return to parent grid domain
@@ -80,5 +80,5 @@
       IF( .NOT.ll_grid_crs )   CALL dom_grid_crs   ! Save the parent grid information  & Switch to coarse grid domain
       !
-      CALL lbc_lnk( 'crslbclnk', pt2d, cd_type, psgn, kfillmode, pfillval )
+      CALL lbc_lnk( 'crslbclnk', pt2d, cd_type, psgn, kfillmode = kfillmode, pfillval = pfillval )
       !
       IF( .NOT.ll_grid_crs )   CALL dom_grid_glo   ! Return to parent grid domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diacfl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diacfl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diacfl.F90	(revision 14676)
@@ -61,8 +61,8 @@
       IF( ln_timing )   CALL timing_start('dia_cfl')
       !
-      llmsk(   1:Nis1,:,:) = .FALSE.                                              ! exclude halos from the checked region
-      llmsk(Nie1: jpi,:,:) = .FALSE.
-      llmsk(:,   1:Njs1,:) = .FALSE.
-      llmsk(:,Nje1: jpj,:) = .FALSE.
+      llmsk(     1:nn_hls,:,:) = .FALSE.   ! exclude halos from the checked region
+      llmsk(Nie0+1:   jpi,:,:) = .FALSE.
+      llmsk(:,     1:nn_hls,:) = .FALSE.
+      llmsk(:,Nje0+1:   jpj,:) = .FALSE.
       !
       DO_3D( 0, 0, 0, 0, 1, jpk )      ! calculate Courant numbers
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diawri.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diawri.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DIA/diawri.F90	(revision 14676)
@@ -251,18 +251,21 @@
       ENDIF
 
-      IF( ln_zad_Aimp ) ww = ww + wi               ! Recombine explicit and implicit parts of vertical velocity for diagnostic output
-      CALL iom_put( "woce", ww )                   ! vertical velocity
+      !                                            ! vertical velocity
+      IF( ln_zad_Aimp ) THEN   ;   CALL iom_put( "woce", ww + wi )   ! explicit plus implicit parts
+      ELSE                     ;   CALL iom_put( "woce", ww )
+      ENDIF
 
       IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value
-         ! Caution: in the VVL case, it only correponds to the baroclinic mass transport.
-         z2d(:,:) = rho0 * e1e2t(:,:)
+         !                     ! Caution: in the VVL case, it only correponds to the baroclinic mass transport.
          DO jk = 1, jpk
-            z3d(:,:,jk) = ww(:,:,jk) * z2d(:,:)
+            IF( ln_zad_Aimp ) THEN
+               z3d(:,:,jk) = rho0 * e1e2t(:,:) * ( ww(:,:,jk) + wi(:,:,jk) )
+            ELSE
+               z3d(:,:,jk) = rho0 * e1e2t(:,:) * ww(:,:,jk)
+            ENDIF
          END DO
          CALL iom_put( "w_masstr" , z3d )  
-         IF( iom_use('w_masstr2') )   CALL iom_put( "w_masstr2", z3d(:,:,:) * z3d(:,:,:) )
-      ENDIF
-      !
-      IF( ln_zad_Aimp ) ww = ww - wi               ! Remove implicit part of vertical velocity that was added for diagnostic output
+         IF( iom_use('w_masstr2') )   CALL iom_put( "w_masstr2", z3d * z3d )
+      ENDIF
 
       CALL iom_put( "avt" , avt )                  ! T vert. eddy diff. coef.
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dom_oce.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dom_oce.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dom_oce.F90	(revision 14676)
@@ -65,12 +65,7 @@
    !! space domain parameters
    !!----------------------------------------------------------------------
-   INTEGER, PUBLIC ::   jperio   !: Global domain lateral boundary type (between 0 and 7)
-   !                                !  = 0 closed                 ;   = 1 cyclic East-West
-   !                                !  = 2 cyclic North-South     ;   = 3 North fold T-point pivot
-   !                                !  = 4 cyclic East-West AND North fold T-point pivot
-   !                                !  = 5 North fold F-point pivot
-   !                                !  = 6 cyclic East-West AND North fold F-point pivot
-   !                                !  = 7 bi-cyclic East-West AND North-South
-   LOGICAL, PUBLIC ::   l_Iperio, l_Jperio   !   should we explicitely take care I/J periodicity
+   LOGICAL         , PUBLIC ::   l_Iperio, l_Jperio   ! i- j-periodicity
+   LOGICAL         , PUBLIC ::   l_NFold              ! North Pole folding
+   CHARACTER(len=1), PUBLIC ::   c_NFtype             ! type of North pole Folding: T or F point
 
    ! Tiling namelist
@@ -85,20 +80,7 @@
 
    !                             !: domain MPP decomposition parameters
-   INTEGER             , PUBLIC ::   nimpp, njmpp     !: i- & j-indexes for mpp-subdomain left bottom
-   INTEGER             , PUBLIC ::   narea            !: number for local area = MPI rank + 1
-   INTEGER             , PUBLIC ::   nbondi, nbondj   !: mark of i- and j-direction local boundaries
-   INTEGER, ALLOCATABLE, PUBLIC ::   nbondi_bdy(:)    !: mark i-direction local boundaries for BDY open boundaries
-   INTEGER, ALLOCATABLE, PUBLIC ::   nbondj_bdy(:)    !: mark j-direction local boundaries for BDY open boundaries
-   INTEGER, ALLOCATABLE, PUBLIC ::   nbondi_bdy_b(:)  !: mark i-direction of neighbours local boundaries for BDY open boundaries
-   INTEGER, ALLOCATABLE, PUBLIC ::   nbondj_bdy_b(:)  !: mark j-direction of neighbours local boundaries for BDY open boundaries
-
-   INTEGER, PUBLIC ::   npolj             !: north fold mark (0, 3 or 4)
-   INTEGER, PUBLIC ::   noea, nowe        !: index of the local neighboring processors in
-   INTEGER, PUBLIC ::   noso, nono        !: east, west, south and north directions
-   INTEGER, PUBLIC ::   nones, nonws        !: north-east, north-west directions for sending
-   INTEGER, PUBLIC ::   noses, nosws        !: south-east, south-west directions for sending
-   INTEGER, PUBLIC ::   noner, nonwr        !: north-east, north-west directions for receiving
-   INTEGER, PUBLIC ::   noser, noswr        !: south-east, south-west directions for receiving
-   INTEGER, PUBLIC ::   nidom             !: ???
+   INTEGER              , PUBLIC ::   nimpp, njmpp     !: i- & j-indexes for mpp-subdomain left bottom
+   INTEGER              , PUBLIC ::   narea            !: number for local area (starting at 1) = MPI rank + 1
+   INTEGER,               PUBLIC ::   nidom      !: IOIPSL things...
 
    INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   mig        !: local ==> global domain, including halos (jpiglo), i-index
@@ -110,9 +92,4 @@
    INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   mj0, mj1   !: global, including halos (jpjglo) ==> local domain j-index
    !                                                                !:    (mj0=1 and mj1=0 if global index not in local domain)
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nimppt,  njmppt   !: i-, j-indexes for each processor
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ibonit,  ibonjt   !: i-, j- processor neighbour existence
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   jpiall,  jpjall   !: dimensions of all subdomain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nis0all, njs0all  !: first, last indoor index for all i-subdomain
-   INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nie0all, nje0all  !: first, last indoor index for all j-subdomain
    INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   nfimpp, nfproc, nfjpi
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domain.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domain.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domain.F90	(revision 14676)
@@ -113,19 +113,11 @@
          WRITE(numout,*)     '              jpnj    : ', jpnj, '   nn_hls  : ', nn_hls
          WRITE(numout,*)     '              jpnij   : ', jpnij
-         WRITE(numout,*)     '      lateral boundary of the Global domain : jperio  = ', jperio
-         SELECT CASE ( jperio )
-         CASE( 0 )   ;   WRITE(numout,*) '         (i.e. closed)'
-         CASE( 1 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west)'
-         CASE( 2 )   ;   WRITE(numout,*) '         (i.e. cyclic north-south)'
-         CASE( 3 )   ;   WRITE(numout,*) '         (i.e. north fold with T-point pivot)'
-         CASE( 4 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north fold with T-point pivot)'
-         CASE( 5 )   ;   WRITE(numout,*) '         (i.e. north fold with F-point pivot)'
-         CASE( 6 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north fold with F-point pivot)'
-         CASE( 7 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north-south)'
-         CASE DEFAULT
-            CALL ctl_stop( 'dom_init:   jperio is out of range' )
-         END SELECT
+         WRITE(numout,*)     '      lateral boundary of the Global domain:'
+         WRITE(numout,*)     '              cyclic east-west             :', l_Iperio
+         WRITE(numout,*)     '              cyclic north-south           :', l_Jperio
+         WRITE(numout,*)     '              North Pole folding           :', l_NFold
+         WRITE(numout,*)     '                 type of North pole Folding:', c_NFtype
          WRITE(numout,*)     '      Ocean model configuration used:'
-         WRITE(numout,*)     '         cn_cfg = ', TRIM( cn_cfg ), '   nn_cfg = ', nn_cfg
+         WRITE(numout,*)     '              cn_cfg = ', TRIM( cn_cfg ), '   nn_cfg = ', nn_cfg
       ENDIF
 
@@ -622,5 +614,5 @@
 
 
-   SUBROUTINE domain_cfg( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE domain_cfg( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE domain_cfg  ***
@@ -630,10 +622,13 @@
       !! ** Method  :   read the cn_domcfg NetCDF file
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.
-      !
-      INTEGER ::   inum   ! local integer
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
+      !
+      CHARACTER(len=7) ::   catt                  ! 'T', 'F', '-' or 'UNKNOWN'
+      INTEGER ::   inum, iperio, iatt             ! local integer
       REAL(wp) ::   zorca_res                     ! local scalars
       REAL(wp) ::   zperio                        !   -      -
@@ -649,42 +644,58 @@
       CALL iom_open( cn_domcfg, inum )
       !
-      !                                   !- ORCA family specificity
-      IF(  iom_varid( inum, 'ORCA'       , ldstop = .FALSE. ) > 0  .AND.  &
-         & iom_varid( inum, 'ORCA_index' , ldstop = .FALSE. ) > 0    ) THEN
-         !
-         cd_cfg = 'ORCA'
-         CALL iom_get( inum, 'ORCA_index', zorca_res )   ;   kk_cfg = NINT( zorca_res )
-         !
-         IF(lwp) THEN
-            WRITE(numout,*) '   .'
-            WRITE(numout,*) '   ==>>>   ORCA configuration '
-            WRITE(numout,*) '   .'
+      CALL iom_getatt( inum,  'CfgName', cd_cfg )   ! returns 'UNKNOWN' if not found
+      CALL iom_getatt( inum, 'CfgIndex', kk_cfg )   ! returns      -999 if not found
+      !
+      ! ------- keep compatibility with OLD VERSION... start -------
+      IF( cd_cfg == 'UNKNOWN' .AND. kk_cfg == -999 ) THEN
+         IF(  iom_varid( inum, 'ORCA'       , ldstop = .FALSE. ) > 0  .AND.  &
+            & iom_varid( inum, 'ORCA_index' , ldstop = .FALSE. ) > 0    ) THEN
+            !
+            cd_cfg = 'ORCA'
+            CALL iom_get( inum, 'ORCA_index', zorca_res )   ;   kk_cfg = NINT( zorca_res )
+            !
+         ELSE
+            CALL iom_getatt( inum, 'cn_cfg', cd_cfg )  ! returns 'UNKNOWN' if not found
+            CALL iom_getatt( inum, 'nn_cfg', kk_cfg )  ! returns      -999 if not found
          ENDIF
-         !
-      ELSE                                !- cd_cfg & k_cfg are not used
-         cd_cfg = 'UNKNOWN'
-         kk_cfg = -9999999
-                                          !- or they may be present as global attributes
-                                          !- (netcdf only)
-         CALL iom_getatt( inum, 'cn_cfg', cd_cfg )  ! returns   !  if not found
-         CALL iom_getatt( inum, 'nn_cfg', kk_cfg )  ! returns -999 if not found
-         IF( TRIM(cd_cfg) == '!') cd_cfg = 'UNKNOWN'
-         IF( kk_cfg == -999     ) kk_cfg = -9999999
-         !
-      ENDIF
-       !
+      ENDIF
+      ! ------- keep compatibility with OLD VERSION... end -------
+      !
       idvar = iom_varid( inum, 'e3t_0', kdimsz = idimsz )   ! use e3t_0, that must exist, to get jp(ijk)glo
       kpi = idimsz(1)
       kpj = idimsz(2)
       kpk = idimsz(3)
-      CALL iom_get( inum, 'jperio', zperio )   ;   kperio = NINT( zperio )
+      !
+      CALL iom_getatt( inum, 'Iperio', iatt )   ;   ldIperio = iatt == 1   ! returns      -999 if not found -> default = .false.
+      CALL iom_getatt( inum, 'Jperio', iatt )   ;   ldJperio = iatt == 1   ! returns      -999 if not found -> default = .false.
+      CALL iom_getatt( inum,  'NFold', iatt )   ;   ldNFold  = iatt == 1   ! returns      -999 if not found -> default = .false.
+      CALL iom_getatt( inum, 'NFtype', catt )                              ! returns 'UNKNOWN' if not found
+      IF( LEN_TRIM(catt) == 1 ) THEN   ;   cdNFtype = TRIM(catt)
+      ELSE                             ;   cdNFtype = '-'
+      ENDIF
+      !
+      ! ------- keep compatibility with OLD VERSION... start -------
+      IF( iatt == -999 .AND. catt == 'UNKNOWN' .AND. iom_varid( inum, 'jperio', ldstop = .FALSE. ) > 0 ) THEN                    
+         CALL iom_get( inum, 'jperio', zperio )   ;   iperio = NINT( zperio )
+         ldIperio = iperio == 1  .OR. iperio == 4 .OR. iperio == 6 .OR. iperio == 7   ! i-periodicity
+         ldJperio = iperio == 2  .OR. iperio == 7                                     ! j-periodicity
+         ldNFold  = iperio >= 3 .AND. iperio <= 6                                     ! North pole folding
+         IF(     iperio == 3 .OR. iperio == 4 ) THEN   ;   cdNFtype = 'T'             !    folding at T point
+         ELSEIF( iperio == 5 .OR. iperio == 6 ) THEN   ;   cdNFtype = 'F'             !    folding at F point
+         ELSE                                          ;   cdNFtype = '-'             !    default value
+         ENDIF
+      ENDIF
+      ! ------- keep compatibility with OLD VERSION... end -------
+      !
       CALL iom_close( inum )
       !
       IF(lwp) THEN
-         WRITE(numout,*) '      cn_cfg = ', TRIM(cd_cfg), '   nn_cfg = ', kk_cfg
+         WRITE(numout,*) '   .'
+         WRITE(numout,*) '   ==>>>   ', TRIM(cn_cfg), ' configuration '
+         WRITE(numout,*) '   .'
+         WRITE(numout,*) '      nn_cfg = ', kk_cfg
          WRITE(numout,*) '      Ni0glo = ', kpi
          WRITE(numout,*) '      Nj0glo = ', kpj
          WRITE(numout,*) '      jpkglo = ', kpk
-         WRITE(numout,*) '      type of global domain lateral boundary   jperio = ', kperio
       ENDIF
       !
@@ -724,22 +735,24 @@
       CALL iom_open( TRIM(clnam), inum, ldwrt = .TRUE. )
       !
-      !                             !==  ORCA family specificities  ==!
-      IF( TRIM(cn_cfg) == "orca" .OR. TRIM(cn_cfg) == "ORCA" ) THEN
-         CALL iom_rstput( 0, 0, inum, 'ORCA'      , 1._wp            , ktype = jp_i4 )
-         CALL iom_rstput( 0, 0, inum, 'ORCA_index', REAL( nn_cfg, wp), ktype = jp_i4 )
-      ENDIF
+      !                             !==  Configuration specificities  ==!
+      !
+      CALL iom_putatt( inum,  'CfgName', TRIM(cn_cfg) )
+      CALL iom_putatt( inum, 'CfgIndex',      nn_cfg  )
       !
       !                             !==  domain characteristics  ==!
       !
       !                                   ! lateral boundary of the global domain
-      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, wp), ktype = jp_i4 )
-      !
+      CALL iom_putatt( inum, 'Iperio', COUNT( (/l_Iperio/) ) )
+      CALL iom_putatt( inum, 'Jperio', COUNT( (/l_Jperio/) ) )
+      CALL iom_putatt( inum,  'NFold', COUNT( (/l_NFold /) ) )
+      CALL iom_putatt( inum, 'NFtype',          c_NFtype     )
+
       !                                   ! type of vertical coordinate
-      CALL iom_rstput( 0, 0, inum, 'ln_zco', REAL(COUNT((/ln_zco/)), wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_zps', REAL(COUNT((/ln_zps/)), wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_sco', REAL(COUNT((/ln_sco/)), wp), ktype = jp_i4 )
-      !
+      IF(ln_zco)   CALL iom_putatt( inum, 'VertCoord', 'zco' )
+      IF(ln_zps)   CALL iom_putatt( inum, 'VertCoord', 'zps' )
+      IF(ln_sco)   CALL iom_putatt( inum, 'VertCoord', 'sco' )
+      
       !                                   ! ocean cavities under iceshelves
-      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL(COUNT((/ln_isfcav/)), wp), ktype = jp_i4 )
+      CALL iom_putatt( inum, 'IsfCav', COUNT( (/ln_isfcav/) ) )
       !
       !                             !==  horizontal mesh  !
@@ -794,12 +807,7 @@
          CALL iom_rstput( 0, 0, inum, 'ht_0'   , ht_0   , ktype = jp_r8 )
       ENDIF
-      !
-      ! Add some global attributes ( netcdf only )
-      CALL iom_putatt( inum, 'nn_cfg', nn_cfg )
-      CALL iom_putatt( inum, 'cn_cfg', TRIM(cn_cfg) )
-      !
-      !                                ! ============================
-      !                                !        close the files
-      !                                ! ============================
+      !                       ! ============================ !
+      !                       !        close the files
+      !                       ! ============================ !
       CALL iom_close( inum )
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dommsk.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dommsk.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/dommsk.F90	(revision 14676)
@@ -162,5 +162,5 @@
             &            * tmask(ji,jj+1,jk) * tmask(ji+1,jj+1,jk)
       END_3D
-      CALL lbc_lnk_multi( 'dommsk', umask, 'U', 1.0_wp, vmask, 'V', 1.0_wp, fmask, 'F', 1.0_wp )      ! Lateral boundary conditions
+      CALL lbc_lnk( 'dommsk', umask, 'U', 1.0_wp, vmask, 'V', 1.0_wp, fmask, 'F', 1.0_wp )      ! Lateral boundary conditions
  
       ! Ocean/land mask at wu-, wv- and w points    (computed from tmask)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domqco.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domqco.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domqco.F90	(revision 14676)
@@ -170,5 +170,5 @@
       !
       IF( .NOT.PRESENT( pr3f ) ) THEN              !- lbc on ratio at u-, v-points only
-         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp )
+         CALL lbc_lnk( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp )
          !
          !
@@ -194,5 +194,5 @@
 #endif
          !                                                 ! lbc on ratio at u-,v-,f-points
-         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp, pr3f, 'F', 1._wp )
+         CALL lbc_lnk( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp, pr3f, 'F', 1._wp )
          !
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domvvl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domvvl.F90	(revision 14676)
@@ -423,5 +423,5 @@
          !                               ! d - thickness diffusion transport: boundary conditions
          !                             (stored for tracer advction and continuity equation)
-         CALL lbc_lnk_multi( 'domvvl', un_td , 'U' , -1._wp, vn_td , 'V' , -1._wp)
+         CALL lbc_lnk( 'domvvl', un_td , 'U' , -1._wp, vn_td , 'V' , -1._wp)
          ! 4 - Time stepping of baroclinic scale factors
          ! ---------------------------------------------
@@ -436,8 +436,8 @@
          END_3D
          !
-         llmsk(   1:Nis1,:,:) = .FALSE.   ! exclude halos from the checked region
-         llmsk(Nie1: jpi,:,:) = .FALSE.
-         llmsk(:,   1:Njs1,:) = .FALSE.
-         llmsk(:,Nje1: jpj,:) = .FALSE.
+         llmsk(     1:nn_hls,:,:) = .FALSE.   ! exclude halos from the checked region
+         llmsk(Nie0+1:   jpi,:,:) = .FALSE.
+         llmsk(:,     1:nn_hls,:) = .FALSE.
+         llmsk(:,Nje0+1:   jpj,:) = .FALSE.
          !
          llmsk(Nis0:Nie0,Njs0:Nje0,:) = tmask(Nis0:Nie0,Njs0:Nje0,:) == 1._wp                  ! define only the inner domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domwri.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domwri.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domwri.F90	(revision 14676)
@@ -58,6 +58,4 @@
       CHARACTER(len=21) ::   clnam   ! filename (mesh and mask informations)
       INTEGER           ::   ji, jj, jk   ! dummy loop indices
-      INTEGER           ::   izco, izps, isco, icav
-      !                               
       REAL(wp), DIMENSION(jpi,jpj)     ::   zprt, zprw     ! 2D workspace
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdepu, zdepv   ! 3D workspace
@@ -74,17 +72,18 @@
       !                                  ! ============================
       CALL iom_open( TRIM(clnam), inum, ldwrt = .TRUE. )
-      !                                                         ! domain characteristics
-      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, wp), ktype = jp_i4 )
+      !                                                         ! Configuration specificities
+      CALL iom_putatt( inum,  'CfgName', TRIM(cn_cfg) )
+      CALL iom_putatt( inum, 'CfgIndex',      nn_cfg  )
+      !                                                         ! lateral boundary of the global domain
+      CALL iom_putatt( inum,   'Iperio', COUNT( (/l_Iperio/) ) )
+      CALL iom_putatt( inum,   'Jperio', COUNT( (/l_Jperio/) ) )
+      CALL iom_putatt( inum,    'NFold', COUNT( (/l_NFold /) ) )
+      CALL iom_putatt( inum,   'NFtype',          c_NFtype     )
       !                                                         ! type of vertical coordinate
-      IF( ln_zco    ) THEN   ;   izco = 1   ;   ELSE   ;   izco = 0   ;   ENDIF
-      IF( ln_zps    ) THEN   ;   izps = 1   ;   ELSE   ;   izps = 0   ;   ENDIF
-      IF( ln_sco    ) THEN   ;   isco = 1   ;   ELSE   ;   isco = 0   ;   ENDIF
-      CALL iom_rstput( 0, 0, inum, 'ln_zco'   , REAL( izco, wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_zps'   , REAL( izps, wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_sco'   , REAL( isco, wp), ktype = jp_i4 )
+      IF(ln_zco)   CALL iom_putatt( inum, 'VertCoord', 'zco' )
+      IF(ln_zps)   CALL iom_putatt( inum, 'VertCoord', 'zps' )
+      IF(ln_sco)   CALL iom_putatt( inum, 'VertCoord', 'sco' )
       !                                                         ! ocean cavities under iceshelves
-      IF( ln_isfcav ) THEN   ;   icav = 1   ;   ELSE   ;   icav = 0   ;   ENDIF
-      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL( icav, wp), ktype = jp_i4 )
-  
+      CALL iom_putatt( inum,   'IsfCav', COUNT( (/ln_isfcav/) ) )  
       !                                                         ! masks
       CALL iom_rstput( 0, 0, inum, 'tmask', tmask, ktype = jp_i1 )     !    ! land-sea mask
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domzgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domzgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DOM/domzgr.F90	(revision 14676)
@@ -115,12 +115,12 @@
       !
       zmsk(:,:) = 1._wp                                       ! default: no closed boundaries
-      IF( jperio == 0 .OR. jperio == 2 .OR. jperio == 3 .OR. jperio == 5 ) THEN   ! E-W closed
+      IF( .NOT. l_Iperio ) THEN                                    ! E-W closed:
          zmsk(  mi0(     1+nn_hls):mi1(     1+nn_hls),:) = 0._wp   ! first column of inner global domain at 0
          zmsk(  mi0(jpiglo-nn_hls):mi1(jpiglo-nn_hls),:) = 0._wp   ! last  column of inner global domain at 0 
       ENDIF
-      IF( .NOT. ( jperio == 2 .OR. jperio == 7 ) ) THEN                           ! S closed
+      IF( .NOT. l_Jperio ) THEN                                    ! S closed:
          zmsk(:,mj0(     1+nn_hls):mj1(     1+nn_hls)  ) = 0._wp   ! first   line of inner global domain at 0
       ENDIF
-      IF( jperio == 0 .OR. jperio == 1 ) THEN                                     ! N closed
+      IF( .NOT. ( l_Jperio .OR. l_NFold ) ) THEN                   ! N closed:
          zmsk(:,mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls)  ) = 0._wp   ! last    line of inner global domain at 0
       ENDIF
@@ -225,7 +225,8 @@
       !
       INTEGER  ::   jk     ! dummy loop index
-      INTEGER  ::   inum   ! local logical unit
+      INTEGER  ::   inum, iatt
       REAL(WP) ::   z_zco, z_zps, z_sco, z_cav
       REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace
+      CHARACTER(len=7) ::   catt   ! 'zco', 'zps, 'sco' or 'UNKNOWN'
       !!----------------------------------------------------------------------
       !
@@ -239,14 +240,22 @@
       !
       !                          !* type of vertical coordinate
-      CALL iom_get( inum, 'ln_zco'   , z_zco )
-      CALL iom_get( inum, 'ln_zps'   , z_zps )
-      CALL iom_get( inum, 'ln_sco'   , z_sco )
-      IF( z_zco == 0._wp ) THEN   ;   ld_zco = .false.   ;   ELSE   ;   ld_zco = .true.   ;   ENDIF
-      IF( z_zps == 0._wp ) THEN   ;   ld_zps = .false.   ;   ELSE   ;   ld_zps = .true.   ;   ENDIF
-      IF( z_sco == 0._wp ) THEN   ;   ld_sco = .false.   ;   ELSE   ;   ld_sco = .true.   ;   ENDIF
-      !
+      CALL iom_getatt( inum, 'VertCoord', catt )   ! returns 'UNKNOWN' if not found
+      ld_zco = catt == 'zco'          ! default = .false.
+      ld_zps = catt == 'zps'          ! default = .false.
+      ld_sco = catt == 'sco'          ! default = .false.
       !                          !* ocean cavities under iceshelves
-      CALL iom_get( inum, 'ln_isfcav', z_cav )
-      IF( z_cav == 0._wp ) THEN   ;   ld_isfcav = .false.   ;   ELSE   ;   ld_isfcav = .true.   ;   ENDIF
+      CALL iom_getatt( inum,    'IsfCav', iatt )   ! returns -999 if not found
+      ld_isfcav = iatt == 1           ! default = .false.
+      !
+      ! ------- keep compatibility with OLD VERSION... start -------
+      IF( catt == 'UNKNOWN' ) THEN
+         CALL iom_get( inum,    'ln_zco', z_zco )   ;   ld_zco = z_zco /= 0._wp
+         CALL iom_get( inum,    'ln_zps', z_zps )   ;   ld_zps = z_zps /= 0._wp
+         CALL iom_get( inum,    'ln_sco', z_sco )   ;   ld_sco = z_sco /= 0._wp
+      ENDIF
+      IF( iatt == -999 ) THEN
+         CALL iom_get( inum, 'ln_isfcav', z_cav )   ;   ld_isfcav = z_cav /= 0._wp
+      ENDIF
+      ! ------- keep compatibility with OLD VERSION... end -------
       !
       !                          !* vertical scale factors
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynadv_ubs.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynadv_ubs.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynadv_ubs.F90	(revision 14676)
@@ -124,8 +124,8 @@
          END_2D
       END DO
-      CALL lbc_lnk_multi( 'dynadv_ubs', zlu_uu(:,:,:,1), 'U', 1.0_wp , zlu_uv(:,:,:,1), 'U', 1.0_wp,  &
-                      &   zlu_uu(:,:,:,2), 'U', 1.0_wp , zlu_uv(:,:,:,2), 'U', 1.0_wp,  & 
-                      &   zlv_vv(:,:,:,1), 'V', 1.0_wp , zlv_vu(:,:,:,1), 'V', 1.0_wp,  &
-                      &   zlv_vv(:,:,:,2), 'V', 1.0_wp , zlv_vu(:,:,:,2), 'V', 1.0_wp   )
+      CALL lbc_lnk( 'dynadv_ubs', zlu_uu(:,:,:,1), 'U', 1.0_wp , zlu_uv(:,:,:,1), 'U', 1.0_wp,  &
+         &                        zlu_uu(:,:,:,2), 'U', 1.0_wp , zlu_uv(:,:,:,2), 'U', 1.0_wp,  & 
+         &                        zlv_vv(:,:,:,1), 'V', 1.0_wp , zlv_vu(:,:,:,1), 'V', 1.0_wp,  &
+         &                        zlv_vv(:,:,:,2), 'V', 1.0_wp , zlv_vu(:,:,:,2), 'V', 1.0_wp   )
       !
       !                                      ! ====================== !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf.F90	(revision 14676)
@@ -169,5 +169,5 @@
 # endif
       !
-      CALL lbc_lnk_multi( 'dynatf', puu(:,:,:,Kaa), 'U', -1.0_wp, pvv(:,:,:,Kaa), 'V', -1.0_wp )     !* local domain boundaries
+      CALL lbc_lnk( 'dynatf', puu(:,:,:,Kaa), 'U', -1.0_wp, pvv(:,:,:,Kaa), 'V', -1.0_wp )     !* local domain boundaries
       !
       !                                !* BDY open boundaries
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf_qco.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf_qco.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynatf_qco.F90	(revision 14676)
@@ -43,4 +43,5 @@
    USE isf_oce   , ONLY: ln_isf     ! ice shelf
    USE isfdynatf , ONLY: isf_dynatf ! ice shelf volume filter correction subroutine
+   USE zdfdrg    , ONLY: ln_drgice_imp, rCdU_top
    !
    USE in_out_manager ! I/O manager
@@ -101,4 +102,5 @@
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zue, zve
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zua, zva
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zutau, zvtau
       !!----------------------------------------------------------------------
       !
@@ -239,4 +241,32 @@
       ENDIF
       !
+      IF ( iom_use("utau") ) THEN
+         IF ( ln_drgice_imp.OR.ln_isfcav ) THEN
+            ALLOCATE(zutau(jpi,jpj))
+            DO_2D( 0, 0, 0, 0 )
+               jk = miku(ji,jj)
+               zutau(ji,jj) = utau(ji,jj) + 0.5_wp * rho0 * ( rCdU_top(ji+1,jj)+rCdU_top(ji,jj) ) * puu(ji,jj,jk,Kaa)
+            END_2D
+            CALL iom_put(  "utau", zutau(:,:) )
+            DEALLOCATE(zutau)
+         ELSE
+            CALL iom_put(  "utau", utau(:,:) )
+         ENDIF
+      ENDIF
+      !
+      IF ( iom_use("vtau") ) THEN
+         IF ( ln_drgice_imp.OR.ln_isfcav ) THEN
+            ALLOCATE(zvtau(jpi,jpj))
+            DO_2D( 0, 0, 0, 0 )
+               jk = mikv(ji,jj)
+               zvtau(ji,jj) = vtau(ji,jj) + 0.5_wp * rho0 * ( rCdU_top(ji,jj+1)+rCdU_top(ji,jj) ) * pvv(ji,jj,jk,Kaa)
+            END_2D
+            CALL iom_put(  "vtau", zvtau(:,:) )
+            DEALLOCATE(zvtau)
+         ELSE
+            CALL iom_put(  "vtau", vtau(:,:) )
+         ENDIF
+      ENDIF
+      !
       IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Kaa), clinfo1=' nxt  - puu(:,:,:,Kaa): ', mask1=umask,   &
          &                                  tab3d_2=pvv(:,:,:,Kaa), clinfo2=' pvv(:,:,:,Kaa): '       , mask2=vmask )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynhpg.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynhpg.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynhpg.F90	(revision 14676)
@@ -462,5 +462,5 @@
           END IF
         END_2D
-        CALL lbc_lnk_multi( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
+        CALL lbc_lnk( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
       END IF
       !
@@ -689,5 +689,5 @@
           END IF
         END_2D
-        CALL lbc_lnk_multi( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
+        CALL lbc_lnk( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
       END IF
 
@@ -793,5 +793,5 @@
       END_3D
 
-      CALL lbc_lnk_multi( 'dynhpg', zdrhox, 'U', 1., zdzx, 'U', 1., zdrhoy, 'V', 1., zdzy, 'V', 1. ) 
+      CALL lbc_lnk( 'dynhpg', zdrhox, 'U', 1., zdzx, 'U', 1., zdrhoy, 'V', 1., zdzy, 'V', 1. ) 
 
       !-------------------------------------------------------------------------
@@ -1043,5 +1043,5 @@
             ENDIF
          END_2D
-         CALL lbc_lnk_multi( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
+         CALL lbc_lnk( 'dynhpg', zcpx, 'U', 1.0_wp, zcpy, 'V', 1.0_wp )
       ENDIF
 
@@ -1113,5 +1113,5 @@
       END_2D
 
-      CALL lbc_lnk_multi ('dynhpg', zsshu_n, 'U', 1.0_wp, zsshv_n, 'V', 1.0_wp )
+      CALL lbc_lnk ('dynhpg', zsshu_n, 'U', 1.0_wp, zsshv_n, 'V', 1.0_wp )
 
       DO_2D( 0, 0, 0, 0 )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_iso.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_iso.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_iso.F90	(revision 14676)
@@ -135,5 +135,5 @@
          END_3D
          ! Lateral boundary conditions on the slopes
-         CALL lbc_lnk_multi( 'dynldf_iso', uslp , 'U', -1.0_wp, vslp , 'V', -1.0_wp, wslpi, 'W', -1.0_wp, wslpj, 'W', -1.0_wp )
+         CALL lbc_lnk( 'dynldf_iso', uslp , 'U', -1.0_wp, vslp , 'V', -1.0_wp, wslpi, 'W', -1.0_wp, wslpj, 'W', -1.0_wp )
          !
        ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_lap_blp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_lap_blp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynldf_lap_blp.F90	(revision 14676)
@@ -185,5 +185,5 @@
       CALL dyn_ldf_lap( kt, Kbb, Kmm, pu, pv, zulap, zvlap, 1 )   ! rotated laplacian applied to pt (output in zlap,Kbb)
       !
-      CALL lbc_lnk_multi( 'dynldf_lap_blp', zulap, 'U', -1.0_wp, zvlap, 'V', -1.0_wp )             ! Lateral boundary conditions
+      CALL lbc_lnk( 'dynldf_lap_blp', zulap, 'U', -1.0_wp, zvlap, 'V', -1.0_wp )             ! Lateral boundary conditions
       !
       CALL dyn_ldf_lap( kt, Kbb, Kmm, zulap, zvlap, pu_rhs, pv_rhs, 2 )   ! rotated laplacian applied to zlap (output in pt(:,:,:,:,Krhs))
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynspg_ts.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynspg_ts.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynspg_ts.F90	(revision 14676)
@@ -524,5 +524,5 @@
          END_2D
          !
-         CALL lbc_lnk_multi( 'dynspg_ts', ssha_e, 'T', 1._wp,  zhU, 'U', -1._wp,  zhV, 'V', -1._wp )
+         CALL lbc_lnk( 'dynspg_ts', ssha_e, 'T', 1._wp,  zhU, 'U', -1._wp,  zhV, 'V', -1._wp )
          !
          ! Duplicate sea level across open boundaries (this is only cosmetic if linssh=T)
@@ -677,9 +677,9 @@
          !
          IF( .NOT.ln_linssh ) THEN   !* Update ocean depth (variable volume case only)
-            CALL lbc_lnk_multi( 'dynspg_ts', ua_e , 'U', -1._wp, va_e , 'V', -1._wp  &
-                 &                         , hu_e , 'U',  1._wp, hv_e , 'V',  1._wp  &
-                 &                         , hur_e, 'U',  1._wp, hvr_e, 'V',  1._wp  )
+            CALL lbc_lnk( 'dynspg_ts', ua_e , 'U', -1._wp, va_e , 'V', -1._wp  &
+                 &                   , hu_e , 'U',  1._wp, hv_e , 'V',  1._wp  &
+                 &                   , hur_e, 'U',  1._wp, hvr_e, 'V',  1._wp  )
          ELSE
-            CALL lbc_lnk_multi( 'dynspg_ts', ua_e , 'U', -1._wp, va_e , 'V', -1._wp  )
+            CALL lbc_lnk( 'dynspg_ts', ua_e , 'U', -1._wp, va_e , 'V', -1._wp  )
          ENDIF
          !                                                 ! open boundaries
@@ -775,5 +775,5 @@
          END_2D
 #endif   
-         CALL lbc_lnk_multi( 'dynspg_ts', zsshu_a, 'U', 1._wp, zsshv_a, 'V', 1._wp ) ! Boundary conditions
+         CALL lbc_lnk( 'dynspg_ts', zsshu_a, 'U', 1._wp, zsshv_a, 'V', 1._wp ) ! Boundary conditions
          !
          DO jk=1,jpkm1
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynvor.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynvor.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/dynvor.F90	(revision 14676)
@@ -940,5 +940,5 @@
                dj_e1v_2(ji,jj) = ( e1v(ji,jj) - e1v(ji  ,jj-1) ) * 0.5_wp
             END_2D
-            CALL lbc_lnk_multi( 'dynvor', di_e2u_2, 'T', -1.0_wp , dj_e1v_2, 'T', -1.0_wp )   ! Lateral boundary conditions
+            CALL lbc_lnk( 'dynvor', di_e2u_2, 'T', -1.0_wp , dj_e1v_2, 'T', -1.0_wp )   ! Lateral boundary conditions
             !
          CASE DEFAULT                        !* F-point metric term :   pre-compute di(e2u)/(2*e1e2f) and dj(e1v)/(2*e1e2f)
@@ -948,5 +948,5 @@
                dj_e1u_2e1e2f(ji,jj) = ( e1u(ji  ,jj+1) - e1u(ji,jj) )  * 0.5 * r1_e1e2f(ji,jj)
             END_2D
-            CALL lbc_lnk_multi( 'dynvor', di_e2v_2e1e2f, 'F', -1.0_wp , dj_e1u_2e1e2f, 'F', -1.0_wp )   ! Lateral boundary conditions
+            CALL lbc_lnk( 'dynvor', di_e2v_2e1e2f, 'F', -1.0_wp , dj_e1u_2e1e2f, 'F', -1.0_wp )   ! Lateral boundary conditions
          END SELECT
          !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/wet_dry.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/wet_dry.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/DYN/wet_dry.F90	(revision 14676)
@@ -241,5 +241,5 @@
             ENDIF
          END_2D
-         CALL lbc_lnk_multi( 'wet_dry', zwdlmtu, 'U', 1.0_wp, zwdlmtv, 'V', 1.0_wp )
+         CALL lbc_lnk( 'wet_dry', zwdlmtu, 'U', 1.0_wp, zwdlmtv, 'V', 1.0_wp )
          !
          CALL mpp_max('wet_dry', jflag)   !max over the global domain
@@ -257,6 +257,6 @@
       !
 !!gm TO BE SUPPRESSED ?  these lbc_lnk are useless since zwdlmtu and zwdlmtv are defined everywhere !
-      CALL lbc_lnk_multi( 'wet_dry', puu(:,:,:,Kmm)  , 'U', -1.0_wp, pvv(:,:,:,Kmm)  , 'V', -1.0_wp )
-      CALL lbc_lnk_multi( 'wet_dry', uu_b(:,:,Kmm), 'U', -1.0_wp, vv_b(:,:,Kmm), 'V', -1.0_wp )
+      CALL lbc_lnk( 'wet_dry', puu(:,:,:,Kmm)  , 'U', -1.0_wp, pvv(:,:,:,Kmm)  , 'V', -1.0_wp )
+      CALL lbc_lnk( 'wet_dry', uu_b(:,:,Kmm), 'U', -1.0_wp, vv_b(:,:,Kmm), 'V', -1.0_wp )
 !!gm
       !
@@ -366,5 +366,5 @@
          END_2D
          !
-         CALL lbc_lnk_multi( 'wet_dry', zwdlmtu, 'U', 1.0_wp, zwdlmtv, 'V', 1.0_wp )
+         CALL lbc_lnk( 'wet_dry', zwdlmtu, 'U', 1.0_wp, zwdlmtv, 'V', 1.0_wp )
          !
          CALL mpp_max('wet_dry', jflag)   !max over the global domain
@@ -378,5 +378,5 @@
       !
 !!gm THIS lbc_lnk is useless since it is already done at the end of the jk1-loop
-      CALL lbc_lnk_multi( 'wet_dry', zflxu, 'U', -1.0_wp, zflxv, 'V', -1.0_wp )
+      CALL lbc_lnk( 'wet_dry', zflxu, 'U', -1.0_wp, zflxv, 'V', -1.0_wp )
 !!gm end
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdia.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdia.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdia.F90	(revision 14676)
@@ -86,5 +86,5 @@
    INTEGER                       ::  nbergs_start, nbergs_end, nbergs_calved
    INTEGER                       ::  nbergs_melted
-   INTEGER                       ::  nspeeding_tickets
+   INTEGER                       ::  nspeeding_tickets, nspeeding_tickets_all
    INTEGER , DIMENSION(nclasses) ::  nbergs_calved_by_class
 
@@ -125,4 +125,5 @@
       nbergs_calved_by_class(:) = 0
       nspeeding_tickets         = 0
+      nspeeding_tickets_all     = 0
       stored_heat_end           = 0._wp
       floating_heat_end         = 0._wp
@@ -271,8 +272,8 @@
             CALL mpp_sum( 'icbdia', nsumbuf(1:nclasses+4), nclasses+4 )
             !
-            nbergs_end        = nsumbuf(1)
-            nbergs_calved     = nsumbuf(2)
-            nbergs_melted     = nsumbuf(3)
-            nspeeding_tickets = nsumbuf(4)
+            nbergs_end            = nsumbuf(1)
+            nbergs_calved         = nsumbuf(2)
+            nbergs_melted         = nsumbuf(3)
+            nspeeding_tickets_all = nsumbuf(4)
             DO ik = 1,nclasses
                nbergs_calved_by_class(ik)= nsumbuf(4+ik)
@@ -329,5 +330,8 @@
          IF (nn_verbose_level > 0) THEN
             WRITE( numicb, '("calved by class = ",i6,20(",",i6))') (nbergs_calved_by_class(ik),ik=1,nclasses)
-            IF( nspeeding_tickets > 0 )   WRITE( numicb, '("speeding tickets issued = ",i6)') nspeeding_tickets
+            IF( nspeeding_tickets_all > 0 ) THEN
+                WRITE( numicb, '("speeding tickets issued (this domain)  = ",i6)') nspeeding_tickets
+                WRITE( numicb, '("speeding tickets issued (all domains)  = ",i6)') nspeeding_tickets_all
+            END IF
          ENDIF
          !
@@ -338,4 +342,5 @@
          nbergs_calved_by_class(:) = 0
          nspeeding_tickets         = 0
+         nspeeding_tickets_all     = 0
          stored_heat_start         = stored_heat_end
          floating_heat_start       = floating_heat_end
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdyn.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdyn.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbdyn.F90	(revision 14676)
@@ -85,6 +85,6 @@
 
          !                                         !**   A1 = A(X1,V1)
-         CALL icb_accel( berg , zxi1, ze1, zuvel1, zuvel1, zax1,     &
-            &                   zyj1, ze2, zvvel1, zvvel1, zay1, zdt_2 )
+         CALL icb_accel( kt, berg , zxi1, ze1, zuvel1, zuvel1, zax1,     &
+            &                   zyj1, ze2, zvvel1, zvvel1, zay1, zdt_2, 0.5_wp )
          !
          zu1 = zuvel1 / ze1                           !**   V1 in d(i,j)/dt
@@ -102,6 +102,6 @@
 
          !                                         !**   A2 = A(X2,V2)
-         CALL icb_accel( berg , zxi2, ze1, zuvel2, zuvel1, zax2,    &
-            &                   zyj2, ze2, zvvel2, zvvel1, zay2, zdt_2 )
+         CALL icb_accel( kt, berg , zxi2, ze1, zuvel2, zuvel1, zax2,    &
+            &                   zyj2, ze2, zvvel2, zvvel1, zay2, zdt_2, 0.5_wp )
          !
          zu2 = zuvel2 / ze1                           !**   V2 in d(i,j)/dt
@@ -114,10 +114,10 @@
          zyj3  = zyj1  + zdt_2 * zv2   ;   zvvel3 = zvvel1 + zdt_2 * zay2
          !
-         CALL icb_ground( berg, zxi3, zxi1, zu3,   &
-            &                   zyj3, zyj1, zv3, ll_bounced )
+         CALL icb_ground( berg, zxi3, zxi1, zu2,   &
+            &                   zyj3, zyj1, zv2, ll_bounced )
 
          !                                         !**   A3 = A(X3,V3)
-         CALL icb_accel( berg , zxi3, ze1, zuvel3, zuvel1, zax3,    &
-            &                   zyj3, ze2, zvvel3, zvvel1, zay3, zdt )
+         CALL icb_accel( kt, berg , zxi3, ze1, zuvel3, zuvel1, zax3,    &
+            &                   zyj3, ze2, zvvel3, zvvel1, zay3, zdt, 1._wp )
          !
          zu3 = zuvel3 / ze1                           !**   V3 in d(i,j)/dt
@@ -130,10 +130,10 @@
          zyj4 = zyj1 + zdt * zv3   ;   zvvel4 = zvvel1 + zdt * zay3
 
-         CALL icb_ground( berg, zxi4, zxi1, zu4,   &
-            &                   zyj4, zyj1, zv4, ll_bounced )
+         CALL icb_ground( berg, zxi4, zxi1, zu3,   &
+            &                   zyj4, zyj1, zv3, ll_bounced )
 
          !                                         !**   A4 = A(X4,V4)
-         CALL icb_accel( berg , zxi4, ze1, zuvel4, zuvel1, zax4,    &
-            &                   zyj4, ze2, zvvel4, zvvel1, zay4, zdt )
+         CALL icb_accel( kt, berg , zxi4, ze1, zuvel4, zuvel1, zax4,    &
+            &                   zyj4, ze2, zvvel4, zvvel1, zay4, zdt, 1._wp )
 
          zu4 = zuvel4 / ze1                           !**   V4 in d(i,j)/dt
@@ -255,6 +255,6 @@
 
 
-   SUBROUTINE icb_accel( berg , pxi, pe1, puvel, puvel0, pax,                &
-      &                         pyj, pe2, pvvel, pvvel0, pay, pdt )
+   SUBROUTINE icb_accel( kt, berg , pxi, pe1, puvel, puvel0, pax,                 &
+      &                             pyj, pe2, pvvel, pvvel0, pay, pdt, pcfl_scale )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE icb_accel  ***
@@ -265,4 +265,6 @@
       !!----------------------------------------------------------------------
       TYPE(iceberg ), POINTER, INTENT(in   ) ::   berg             ! berg
+      INTEGER                , INTENT(in   ) ::   kt               ! time step
+      REAL(wp)               , INTENT(in   ) ::   pcfl_scale
       REAL(wp)               , INTENT(in   ) ::   pxi   , pyj      ! berg position in (i,j) referential
       REAL(wp)               , INTENT(in   ) ::   puvel , pvvel    ! berg velocity [m/s]
@@ -404,9 +406,20 @@
          zspeed = SQRT( zuveln*zuveln + zvveln*zvveln )    ! Speed of berg
          IF( zspeed > 0._wp ) THEN
-            zloc_dx = MIN( pe1, pe2 )                          ! minimum grid spacing
-            zspeed_new = zloc_dx / pdt * rn_speed_limit        ! Speed limit as a factor of dx / dt
+            zloc_dx = MIN( pe1, pe2 )                                ! minimum grid spacing
+            ! cfl scale is function of the RK4 step
+            zspeed_new = zloc_dx / pdt * rn_speed_limit * pcfl_scale ! Speed limit as a factor of dx / dt
             IF( zspeed_new < zspeed ) THEN
-               zuveln = zuveln * ( zspeed_new / zspeed )        ! Scale velocity to reduce speed
-               zvveln = zvveln * ( zspeed_new / zspeed )        ! without changing the direction
+               zuveln = zuveln * ( zspeed_new / zspeed )             ! Scale velocity to reduce speed
+               zvveln = zvveln * ( zspeed_new / zspeed )             ! without changing the direction
+               pax = (zuveln - puvel0)/pdt
+               pay = (zvveln - pvvel0)/pdt
+               !
+               ! print speeding ticket
+               IF (nn_verbose_level > 0) THEN
+                  WRITE(numicb, 9200) 'icb speeding : ',kt, nknberg, zspeed, &
+                       &                pxi, pyj, zuo, zvo, zua, zva, zui, zvi
+                  9200 FORMAT(a,i9,i6,f9.2,1x,4(1x,2f9.2))
+               END IF
+               !
                CALL icb_dia_speed()
             ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbini.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbini.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbini.F90	(revision 14676)
@@ -189,5 +189,5 @@
       
       ! north fold
-      IF( npolj > 0 ) THEN
+      IF( l_IdoNFold ) THEN
          !
          ! icebergs in row nicbej+1 get passed across fold
@@ -235,5 +235,5 @@
          WRITE(numicb,*) "j point"
          WRITE(numicb,*) (INT(src_calving(ji,jj)), jj=1,jpj)
-         IF( npolj > 0 ) THEN
+         IF( l_IdoNFold ) THEN
             WRITE(numicb,*) 'north fold destination points '
             WRITE(numicb,*) nicbfldpts
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icblbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icblbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icblbc.F90	(revision 14676)
@@ -105,5 +105,5 @@
       IF( l_Jperio)      CALL ctl_stop(' north-south periodicity not implemented for icebergs')
       ! north fold
-      IF( npolj /= 0 )   CALL icb_lbc_nfld()
+      IF( l_IdoNFold )   CALL icb_lbc_nfld()
       !
    END SUBROUTINE icb_lbc
@@ -179,11 +179,11 @@
       ipe_W = -1
       ipe_E = -1
-      IF( nbondi .EQ.  0 .OR. nbondi .EQ. 1) ipe_W = nowe
-      IF( nbondi .EQ. -1 .OR. nbondi .EQ. 0) ipe_E = noea
-      IF( nbondj .EQ.  0 .OR. nbondj .EQ. 1) ipe_S = noso
-      IF( nbondj .EQ. -1 .OR. nbondj .EQ. 0) ipe_N = nono
+      IF( mpinei(jpwe) >= 0 ) ipe_W = mpinei(jpwe)
+      IF( mpinei(jpea) >= 0 ) ipe_E = mpinei(jpea)
+      IF( mpinei(jpso) >= 0 ) ipe_S = mpinei(jpso)
+      IF( mpinei(jpno) >= 0 ) ipe_N = mpinei(jpno)
       !
       ! at northern line of processors with north fold handle bergs differently
-      IF( npolj > 0 ) ipe_N = -1
+      IF( l_IdoNFold )   ipe_N = -1
 
       ! if there's only one processor in x direction then don't let mpp try to handle periodicity
@@ -200,6 +200,4 @@
          WRITE(numicb,*) 'processor nimpp : ', nimpp
          WRITE(numicb,*) 'processor njmpp : ', njmpp
-         WRITE(numicb,*) 'processor nbondi: ', nbondi
-         WRITE(numicb,*) 'processor nbondj: ', nbondj
          CALL flush( numicb )
       ENDIF
@@ -271,91 +269,46 @@
       ! pattern here is copied from lib_mpp code
 
-      SELECT CASE ( nbondi )
-      CASE( -1 )
-         zwebergs(1) = ibergs_to_send_e
-         CALL mppsend( 12, zwebergs(1), 1, ipe_E, iml_req1)
-         CALL mpprecv( 11, zewbergs(2), 1, ipe_E )
-         CALL mpi_wait( iml_req1, iml_stat, iml_err )
-         ibergs_rcvd_from_e = INT( zewbergs(2) )
-      CASE(  0 )
-         zewbergs(1) = ibergs_to_send_w
-         zwebergs(1) = ibergs_to_send_e
-         CALL mppsend( 11, zewbergs(1), 1, ipe_W, iml_req2)
-         CALL mppsend( 12, zwebergs(1), 1, ipe_E, iml_req3)
-         CALL mpprecv( 11, zewbergs(2), 1, ipe_E )
-         CALL mpprecv( 12, zwebergs(2), 1, ipe_W )
-         CALL mpi_wait( iml_req2, iml_stat, iml_err )
-         CALL mpi_wait( iml_req3, iml_stat, iml_err )
-         ibergs_rcvd_from_e = INT( zewbergs(2) )
-         ibergs_rcvd_from_w = INT( zwebergs(2) )
-      CASE(  1 )
-         zewbergs(1) = ibergs_to_send_w
-         CALL mppsend( 11, zewbergs(1), 1, ipe_W, iml_req4)
-         CALL mpprecv( 12, zwebergs(2), 1, ipe_W )
-         CALL mpi_wait( iml_req4, iml_stat, iml_err )
-         ibergs_rcvd_from_w = INT( zwebergs(2) )
-      END SELECT
+      IF( mpinei(jpwe) >= 0  )   zewbergs(1) = ibergs_to_send_w
+      IF( mpinei(jpea) >= 0  )   zwebergs(1) = ibergs_to_send_e
+      IF( mpinei(jpwe) >= 0  )   CALL mppsend( 11, zewbergs(1), 1, ipe_W, iml_req2)
+      IF( mpinei(jpea) >= 0  )   CALL mppsend( 12, zwebergs(1), 1, ipe_E, iml_req3)
+      IF( mpinei(jpea) >= 0  )   CALL mpprecv( 11, zewbergs(2), 1, ipe_E )
+      IF( mpinei(jpwe) >= 0  )   CALL mpprecv( 12, zwebergs(2), 1, ipe_W )
+      IF( mpinei(jpwe) >= 0  )   CALL mpi_wait( iml_req2, iml_stat, iml_err )
+      IF( mpinei(jpea) >= 0  )   CALL mpi_wait( iml_req3, iml_stat, iml_err )
+      IF( mpinei(jpea) >= 0  )   ibergs_rcvd_from_e = INT( zewbergs(2) )
+      IF( mpinei(jpwe) >= 0  )   ibergs_rcvd_from_w = INT( zwebergs(2) )
+      
       IF( nn_verbose_level >= 3) THEN
          WRITE(numicb,*) 'bergstep ',nktberg,' recv ew: ', ibergs_rcvd_from_w, ibergs_rcvd_from_e
          CALL flush(numicb)
       ENDIF
-
-      SELECT CASE ( nbondi )
-      CASE( -1 )
-         IF( ibergs_to_send_e > 0 ) CALL mppsend( 14, obuffer_e%data, ibergs_to_send_e*jp_buffer_width, ipe_E, iml_req1 )
-         IF( ibergs_rcvd_from_e > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_e, ibergs_rcvd_from_e)
-            CALL mpprecv( 13, ibuffer_e%data, ibergs_rcvd_from_e*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_e > 0 ) CALL mpi_wait( iml_req1, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_e
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_e%data(16,i)),' from east'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_e, i)
-         ENDDO
-      CASE(  0 )
-         IF( ibergs_to_send_w > 0 ) CALL mppsend( 13, obuffer_w%data, ibergs_to_send_w*jp_buffer_width, ipe_W, iml_req2 )
-         IF( ibergs_to_send_e > 0 ) CALL mppsend( 14, obuffer_e%data, ibergs_to_send_e*jp_buffer_width, ipe_E, iml_req3 )
-         IF( ibergs_rcvd_from_e > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_e, ibergs_rcvd_from_e)
-            CALL mpprecv( 13, ibuffer_e%data, ibergs_rcvd_from_e*jp_buffer_width )
-         ENDIF
-         IF( ibergs_rcvd_from_w > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_w, ibergs_rcvd_from_w)
-            CALL mpprecv( 14, ibuffer_w%data, ibergs_rcvd_from_w*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_w > 0 ) CALL mpi_wait( iml_req2, iml_stat, iml_err )
-         IF( ibergs_to_send_e > 0 ) CALL mpi_wait( iml_req3, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_e
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_e%data(16,i)),' from east'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_e, i)
-         END DO
-         DO i = 1, ibergs_rcvd_from_w
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_w%data(16,i)),' from west'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_w, i)
-         ENDDO
-      CASE(  1 )
-         IF( ibergs_to_send_w > 0 ) CALL mppsend( 13, obuffer_w%data, ibergs_to_send_w*jp_buffer_width, ipe_W, iml_req4 )
-         IF( ibergs_rcvd_from_w > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_w, ibergs_rcvd_from_w)
-            CALL mpprecv( 14, ibuffer_w%data, ibergs_rcvd_from_w*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_w > 0 ) CALL mpi_wait( iml_req4, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_w
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_w%data(16,i)),' from west'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_w, i)
-         END DO
-      END SELECT
+      
+      IF( ibergs_to_send_w > 0 ) CALL mppsend( 13, obuffer_w%data, ibergs_to_send_w*jp_buffer_width, ipe_W, iml_req2 )
+      IF( ibergs_to_send_e > 0 ) CALL mppsend( 14, obuffer_e%data, ibergs_to_send_e*jp_buffer_width, ipe_E, iml_req3 )
+      IF( ibergs_rcvd_from_e > 0 ) THEN
+         CALL icb_increase_ibuffer(ibuffer_e, ibergs_rcvd_from_e)
+         CALL mpprecv( 13, ibuffer_e%data, ibergs_rcvd_from_e*jp_buffer_width )
+      ENDIF
+      IF( ibergs_rcvd_from_w > 0 ) THEN
+         CALL icb_increase_ibuffer(ibuffer_w, ibergs_rcvd_from_w)
+         CALL mpprecv( 14, ibuffer_w%data, ibergs_rcvd_from_w*jp_buffer_width )
+      ENDIF
+      IF( ibergs_to_send_w > 0 ) CALL mpi_wait( iml_req2, iml_stat, iml_err )
+      IF( ibergs_to_send_e > 0 ) CALL mpi_wait( iml_req3, iml_stat, iml_err )
+      DO i = 1, ibergs_rcvd_from_e
+         IF( nn_verbose_level >= 4 ) THEN
+            WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_e%data(16,i)),' from east'
+            CALL FLUSH( numicb )
+         ENDIF
+         CALL icb_unpack_from_buffer(first_berg, ibuffer_e, i)
+      END DO
+      DO i = 1, ibergs_rcvd_from_w
+         IF( nn_verbose_level >= 4 ) THEN
+            WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_w%data(16,i)),' from west'
+            CALL FLUSH( numicb )
+         ENDIF
+         CALL icb_unpack_from_buffer(first_berg, ibuffer_w, i)
+      END DO
 
       ! Find number of bergs that headed north/south
@@ -400,93 +353,48 @@
       ! send bergs north
       ! and receive bergs from south (ie ones sent north)
-
-      SELECT CASE ( nbondj )
-      CASE( -1 )
-         zsnbergs(1) = ibergs_to_send_n
-         CALL mppsend( 16, zsnbergs(1), 1, ipe_N, iml_req1)
-         CALL mpprecv( 15, znsbergs(2), 1, ipe_N )
-         CALL mpi_wait( iml_req1, iml_stat, iml_err )
-         ibergs_rcvd_from_n = INT( znsbergs(2) )
-      CASE(  0 )
-         znsbergs(1) = ibergs_to_send_s
-         zsnbergs(1) = ibergs_to_send_n
-         CALL mppsend( 15, znsbergs(1), 1, ipe_S, iml_req2)
-         CALL mppsend( 16, zsnbergs(1), 1, ipe_N, iml_req3)
-         CALL mpprecv( 15, znsbergs(2), 1, ipe_N )
-         CALL mpprecv( 16, zsnbergs(2), 1, ipe_S )
-         CALL mpi_wait( iml_req2, iml_stat, iml_err )
-         CALL mpi_wait( iml_req3, iml_stat, iml_err )
-         ibergs_rcvd_from_n = INT( znsbergs(2) )
-         ibergs_rcvd_from_s = INT( zsnbergs(2) )
-      CASE(  1 )
-         znsbergs(1) = ibergs_to_send_s
-         CALL mppsend( 15, znsbergs(1), 1, ipe_S, iml_req4)
-         CALL mpprecv( 16, zsnbergs(2), 1, ipe_S )
-         CALL mpi_wait( iml_req4, iml_stat, iml_err )
-         ibergs_rcvd_from_s = INT( zsnbergs(2) )
-      END SELECT
-      if( nn_verbose_level >= 3) then
-         write(numicb,*) 'bergstep ',nktberg,' recv ns: ', ibergs_rcvd_from_s, ibergs_rcvd_from_n
-         call flush(numicb)
-      endif
-
-      SELECT CASE ( nbondj )
-      CASE( -1 )
-         IF( ibergs_to_send_n > 0 ) CALL mppsend( 18, obuffer_n%data, ibergs_to_send_n*jp_buffer_width, ipe_N, iml_req1 )
-         IF( ibergs_rcvd_from_n > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_n, ibergs_rcvd_from_n)
-            CALL mpprecv( 17, ibuffer_n%data, ibergs_rcvd_from_n*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_n > 0 ) CALL mpi_wait( iml_req1, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_n
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_n%data(16,i)),' from north'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_n, i)
-         END DO
-      CASE(  0 )
-         IF( ibergs_to_send_s > 0 ) CALL mppsend( 17, obuffer_s%data, ibergs_to_send_s*jp_buffer_width, ipe_S, iml_req2 )
-         IF( ibergs_to_send_n > 0 ) CALL mppsend( 18, obuffer_n%data, ibergs_to_send_n*jp_buffer_width, ipe_N, iml_req3 )
-         IF( ibergs_rcvd_from_n > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_n, ibergs_rcvd_from_n)
-            CALL mpprecv( 17, ibuffer_n%data, ibergs_rcvd_from_n*jp_buffer_width )
-         ENDIF
-         IF( ibergs_rcvd_from_s > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_s, ibergs_rcvd_from_s)
-            CALL mpprecv( 18, ibuffer_s%data, ibergs_rcvd_from_s*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_s > 0 ) CALL mpi_wait( iml_req2, iml_stat, iml_err )
-         IF( ibergs_to_send_n > 0 ) CALL mpi_wait( iml_req3, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_n
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_n%data(16,i)),' from north'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_n, i)
-         END DO
-         DO i = 1, ibergs_rcvd_from_s
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_s%data(16,i)),' from south'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_s, i)
-         ENDDO
-      CASE(  1 )
-         IF( ibergs_to_send_s > 0 ) CALL mppsend( 17, obuffer_s%data, ibergs_to_send_s*jp_buffer_width, ipe_S, iml_req4 )
-         IF( ibergs_rcvd_from_s > 0 ) THEN
-            CALL icb_increase_ibuffer(ibuffer_s, ibergs_rcvd_from_s)
-            CALL mpprecv( 18, ibuffer_s%data, ibergs_rcvd_from_s*jp_buffer_width )
-         ENDIF
-         IF( ibergs_to_send_s > 0 ) CALL mpi_wait( iml_req4, iml_stat, iml_err )
-         DO i = 1, ibergs_rcvd_from_s
-            IF( nn_verbose_level >= 4 ) THEN
-               WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_s%data(16,i)),' from south'
-               CALL flush( numicb )
-            ENDIF
-            CALL icb_unpack_from_buffer(first_berg, ibuffer_s, i)
-         END DO
-      END SELECT
-
+      
+      IF( mpinei(jpso) >= 0  )   znsbergs(1) = ibergs_to_send_s
+      IF( mpinei(jpno) >= 0  )   zsnbergs(1) = ibergs_to_send_n
+      IF( mpinei(jpso) >= 0  )   CALL mppsend( 15, znsbergs(1), 1, ipe_S, iml_req2)
+      IF( mpinei(jpno) >= 0  )   CALL mppsend( 16, zsnbergs(1), 1, ipe_N, iml_req3)
+      IF( mpinei(jpno) >= 0  )   CALL mpprecv( 15, znsbergs(2), 1, ipe_N )
+      IF( mpinei(jpso) >= 0  )   CALL mpprecv( 16, zsnbergs(2), 1, ipe_S )
+      IF( mpinei(jpso) >= 0  )   CALL mpi_wait( iml_req2, iml_stat, iml_err )
+      IF( mpinei(jpno) >= 0  )   CALL mpi_wait( iml_req3, iml_stat, iml_err )
+      IF( mpinei(jpno) >= 0  )   ibergs_rcvd_from_n = INT( znsbergs(2) )
+      IF( mpinei(jpso) >= 0  )   ibergs_rcvd_from_s = INT( zsnbergs(2) )
+      
+      IF( nn_verbose_level >= 3) THEN
+         WRITE(numicb,*) 'bergstep ',nktberg,' recv ns: ', ibergs_rcvd_from_s, ibergs_rcvd_from_n
+         CALL FLUSH(numicb)
+      ENDIF
+
+      IF( ibergs_to_send_s > 0 ) CALL mppsend( 17, obuffer_s%data, ibergs_to_send_s*jp_buffer_width, ipe_S, iml_req2 )
+      IF( ibergs_to_send_n > 0 ) CALL mppsend( 18, obuffer_n%data, ibergs_to_send_n*jp_buffer_width, ipe_N, iml_req3 )
+      IF( ibergs_rcvd_from_n > 0 ) THEN
+         CALL icb_increase_ibuffer(ibuffer_n, ibergs_rcvd_from_n)
+         CALL mpprecv( 17, ibuffer_n%data, ibergs_rcvd_from_n*jp_buffer_width )
+      ENDIF
+      IF( ibergs_rcvd_from_s > 0 ) THEN
+         CALL icb_increase_ibuffer(ibuffer_s, ibergs_rcvd_from_s)
+         CALL mpprecv( 18, ibuffer_s%data, ibergs_rcvd_from_s*jp_buffer_width )
+      ENDIF
+      IF( ibergs_to_send_s > 0 ) CALL mpi_wait( iml_req2, iml_stat, iml_err )
+      IF( ibergs_to_send_n > 0 ) CALL mpi_wait( iml_req3, iml_stat, iml_err )
+      DO i = 1, ibergs_rcvd_from_n
+         IF( nn_verbose_level >= 4 ) THEN
+            WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_n%data(16,i)),' from north'
+            CALL FLUSH( numicb )
+         ENDIF
+         CALL icb_unpack_from_buffer(first_berg, ibuffer_n, i)
+      END DO
+      DO i = 1, ibergs_rcvd_from_s
+         IF( nn_verbose_level >= 4 ) THEN
+            WRITE(numicb,*) 'bergstep ',nktberg,' unpacking berg ',INT(ibuffer_s%data(16,i)),' from south'
+            CALL FLUSH( numicb )
+         ENDIF
+         CALL icb_unpack_from_buffer(first_berg, ibuffer_s, i)
+      END DO
+      
       IF( nn_verbose_level > 0 ) THEN
          ! compare the number of icebergs on this processor from the start to the end
@@ -527,5 +435,5 @@
       ! deal with north fold if we necessary when there is more than one top row processor
       ! note that for jpni=1 north fold has been dealt with above in call to icb_lbc
-      IF( npolj /= 0 .AND. jpni > 1 ) CALL icb_lbc_mpp_nfld( )
+      IF( l_IdoNFold .AND. jpni > 1 ) CALL icb_lbc_mpp_nfld( )
 
       IF( nn_verbose_level > 0 ) THEN
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbutl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbutl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ICB/icbutl.F90	(revision 14676)
@@ -320,9 +320,12 @@
          !
          IF ( ierr > 0 ) THEN
-            WRITE(numout,*) 'bottom left corner T point out of bound'
-            WRITE(numout,*) pi, kii, mig( 1 ), mig(jpi)
-            WRITE(numout,*) pj, kij, mjg( 1 ), mjg(jpj)
-            WRITE(numout,*) pmsk
-            CALL ctl_stop('STOP','icb_utl_bilin_h: an icebergs coordinates is out of valid range (out of bound error)')
+            WRITE(numicb,*) 'bottom left corner T point out of bound'
+            WRITE(numicb,*) pi, kii, mig( 1 ), mig(jpi)
+            WRITE(numicb,*) pj, kij, mjg( 1 ), mjg(jpj)
+            WRITE(numicb,*) pmsk
+            CALL FLUSH(numicb)
+            CALL ctl_stop('STOP','icb_utl_bilin_e: an icebergs coordinates is out of valid range (out of bound error).'       , &
+                 &                                'This can be fixed using rn_speed_limit=0.4 in &namberg.'                   , &
+                 &                                'More details in the corresponding iceberg.stat file (nn_verbose_level > 0).' )
          END IF
       END IF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/in_out_manager.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/in_out_manager.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/in_out_manager.F90	(revision 14676)
@@ -175,4 +175,6 @@
    CHARACTER(LEN=lc) ::   cr_icerst_cxt     !: context name used in xios to read SI3 restart
    CHARACTER(LEN=lc) ::   cw_icerst_cxt     !: context name used in xios to write SI3 restart file
+   CHARACTER(LEN=lc) ::   cr_ablrst_cxt     !: context name used in xios to read ABL restart
+   CHARACTER(LEN=lc) ::   cw_ablrst_cxt     !: context name used in xios to write ABL restart file
    CHARACTER(LEN=lc) ::   cr_toprst_cxt     !: context name used in xios to read TOP restart
    CHARACTER(LEN=lc) ::   cw_toprst_cxt     !: context name used in xios to write TOP restart file
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom.F90	(revision 14676)
@@ -143,8 +143,10 @@
 
       llrstr = (cdname == cr_ocerst_cxt) .OR. (cdname == cr_icerst_cxt)
+      llrstr = llrstr .OR. (cdname == cr_ablrst_cxt)
       llrstr = llrstr .OR. (cdname == cr_toprst_cxt)
       llrstr = llrstr .OR. (cdname == cr_sedrst_cxt)
 
       llrstw = (cdname == cw_ocerst_cxt) .OR. (cdname == cw_icerst_cxt)
+      llrstw = llrstw .OR. (cdname == cw_ablrst_cxt)
       llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
       llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
@@ -315,4 +317,5 @@
          llrstw = (cdname == cw_ocerst_cxt)
          llrstw = llrstw .OR. (cdname == cw_icerst_cxt)
+         llrstw = llrstw .OR. (cdname == cw_ablrst_cxt)
          llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
          llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
@@ -357,5 +360,5 @@
       LOGICAL                                    :: lmeta
 !metadata in restart file for restart read with XIOS
-      INTEGER, PARAMETER                         :: NMETA = 10
+      INTEGER, PARAMETER                         :: NMETA = 11
       CHARACTER(LEN=lc)                          :: meta(NMETA)
 
@@ -371,4 +374,5 @@
       meta(9) = "y"
       meta(10) = "numcat"
+      meta(11) = "nav_hgt"
 
       clinfo = '          iom_set_vars_active, file: '//TRIM(iom_file(idnum)%name)
@@ -548,4 +552,6 @@
       IF(idlev == jpk) THEN
          axis_ref="nav_lev"
+      ELSEIF(idlev == jpka) THEN
+         axis_ref="nav_hgt"
 #if defined key_si3
       ELSEIF(idlev == jpl) THEN
@@ -615,4 +621,6 @@
       CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) )
 #endif
+      CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_hgt")
+      CALL iom_set_axis_attr( "nav_hgt", (/ (REAL(ji,wp), ji=1,jpka) /) )
       CALL xios_get_handle("scalar_definition", scalargroup_hdl)
       CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar")
@@ -638,4 +646,6 @@
          ELSEIF(kdid == numrir) THEN
             cdcont = cr_icerst_cxt
+         ELSEIF(kdid == numrar) THEN
+            cdcont = cr_ablrst_cxt
          ELSEIF(kdid == numrtr) THEN
             cdcont = cr_toprst_cxt
@@ -650,4 +660,6 @@
          ELSEIF(kdid == numriw) THEN
             cdcont = cw_icerst_cxt
+         ELSEIF(kdid == numraw) THEN
+            cdcont = cw_ablrst_cxt
          ELSEIF(kdid == numrtw) THEN
             cdcont = cw_toprst_cxt
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom_nf90.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom_nf90.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/IOM/iom_nf90.F90	(revision 14676)
@@ -443,10 +443,9 @@
          IF(PRESENT(cdatt0d))   CALL iom_nf90_check(NF90_GET_ATT(if90id, ivarid, cdatt, values = cdatt0d), clinfo)
       ELSE
-         CALL ctl_warn('iom_nf90_getatt: no attribute '//TRIM(cdatt)//' found')
          IF(PRESENT( katt0d))    katt0d    = -999
          IF(PRESENT( katt1d))    katt1d(:) = -999
          IF(PRESENT( patt0d))    patt0d    = -999._wp
          IF(PRESENT( patt1d))    patt1d(:) = -999._wp
-         IF(PRESENT(cdatt0d))   cdatt0d    = '!'
+         IF(PRESENT(cdatt0d))   cdatt0d    = 'UNKNOWN'
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcav.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcav.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcav.F90	(revision 14676)
@@ -136,5 +136,5 @@
       !
       ! lbclnk on melt
-      CALL lbc_lnk_multi( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp)
+      CALL lbc_lnk( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp)
       !
       ! output fluxes
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcpl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcpl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfcpl.F90	(revision 14676)
@@ -205,5 +205,5 @@
          zssmask0(:,:) = zssmask_b(:,:)
          !
-         CALL lbc_lnk_multi( 'iscplrst', zssh, 'T', 1.0_wp, zssmask0, 'T', 1.0_wp )
+         CALL lbc_lnk( 'iscplrst', zssh, 'T', 1.0_wp, zssmask0, 'T', 1.0_wp )
          !
       END DO
@@ -363,5 +363,5 @@
          ztmask0(:,:,:) = ztmask1(:,:,:)
          !
-         CALL lbc_lnk_multi( 'iscplrst', zts0(:,:,:,jp_tem), 'T', 1.0_wp, zts0(:,:,:,jp_sal), 'T', 1.0_wp, ztmask0, 'T', 1.0_wp)
+         CALL lbc_lnk( 'iscplrst', zts0(:,:,:,jp_tem), 'T', 1.0_wp, zts0(:,:,:,jp_sal), 'T', 1.0_wp, ztmask0, 'T', 1.0_wp)
          !
       END DO  ! nn_drown
@@ -691,6 +691,6 @@
       !
       ! add lbclnk
-      CALL lbc_lnk_multi( 'iscplrst', risfcpl_cons_tsc(:,:,:,jp_tem), 'T', 1.0_wp, risfcpl_cons_tsc(:,:,:,jp_sal), 'T', 1.0_wp, &
-         &                            risfcpl_cons_vol(:,:,:)       , 'T', 1.0_wp)
+      CALL lbc_lnk( 'iscplrst', risfcpl_cons_tsc(:,:,:,jp_tem), 'T', 1.0_wp, risfcpl_cons_tsc(:,:,:,jp_sal), 'T', 1.0_wp, &
+         &                      risfcpl_cons_vol(:,:,:)       , 'T', 1.0_wp)
       !
       ! ssh correction (for dynspg_ts)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfpar.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfpar.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ISF/isfpar.F90	(revision 14676)
@@ -82,5 +82,5 @@
       !
       ! lbclnk on melt and heat fluxes
-      CALL lbc_lnk_multi( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp)
+      CALL lbc_lnk( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp)
       !
       ! output fluxes
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_call_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_call_generic.h90	(revision 14676)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_call_generic.h90	(revision 14676)
@@ -0,0 +1,102 @@
+#if defined DIM_2d
+#   define XD     2d
+#   define DIMS   :,:
+#   define ISZ3   1 
+#   define ISZ4   1   
+#endif
+#if defined DIM_3d
+#   define XD     3d
+#   define DIMS   :,:,:
+#   define ISZ3   SIZE(ptab, dim=3)
+#   define ISZ4   1
+#endif
+#if defined DIM_4d
+#   define XD     4d
+#   define DIMS   :,:,:,:
+#   define ISZ3   SIZE(ptab, dim=3)
+#   define ISZ4   SIZE(ptab, dim=4)
+#endif
+
+   SUBROUTINE lbc_lnk_call_/**/XD/**/_/**/PRECISION(                                                              &
+      &                     cdname                                                                                  &
+      &                   , pt1 , cdna1 , psgn1 , pt2 , cdna2 , psgn2 , pt3 , cdna3 , psgn3 , pt4 , cdna4 , psgn4   &
+      &                   , pt5 , cdna5 , psgn5 , pt6 , cdna6 , psgn6 , pt7 , cdna7 , psgn7 , pt8 , cdna8 , psgn8   &
+      &                   , pt9 , cdna9 , psgn9 , pt10, cdna10, psgn10, pt11, cdna11, psgn11, pt12, cdna12, psgn12  &
+      &                   , pt13, cdna13, psgn13, pt14, cdna14, psgn14, pt15, cdna15, psgn15, pt16, cdna16, psgn16  &
+      &                   , kfillmode, pfillval, khls, lsend, lrecv, ld4only )
+      !!---------------------------------------------------------------------
+      CHARACTER(len=*)     ,                   INTENT(in   ) ::   cdname  ! name of the calling subroutine
+      REAL(PRECISION), DIMENSION(DIMS)          , TARGET, CONTIGUOUS, INTENT(inout) ::   pt1        ! arrays on which the lbc is applied
+      REAL(PRECISION), DIMENSION(DIMS), OPTIONAL, TARGET, CONTIGUOUS, INTENT(inout) ::   pt2 , pt3 , pt4 , pt5 , pt6 , pt7 , pt8 , pt9, &
+         &                                                                    pt10, pt11, pt12, pt13, pt14, pt15, pt16
+      CHARACTER(len=1)                       , INTENT(in   ) ::   cdna1   ! nature of pt2D. array grid-points
+      CHARACTER(len=1)     , OPTIONAL        , INTENT(in   ) ::   cdna2 , cdna3 , cdna4 , cdna5 , cdna6 , cdna7 , cdna8 , cdna9, &
+         &                                                        cdna10, cdna11, cdna12, cdna13, cdna14, cdna15, cdna16
+      REAL(PRECISION)                        , INTENT(in   ) ::   psgn1   ! sign used across the north fold
+      REAL(PRECISION)      , OPTIONAL        , INTENT(in   ) ::   psgn2 , psgn3 , psgn4 , psgn5 , psgn6 , psgn7 , psgn8 , psgn9, &
+         &                                                        psgn10, psgn11, psgn12, psgn13, psgn14, psgn15, psgn16
+      INTEGER              , OPTIONAL        , INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
+      REAL(PRECISION)      , OPTIONAL        , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
+      INTEGER              , OPTIONAL        , INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      LOGICAL, DIMENSION(4), OPTIONAL        , INTENT(in   ) ::   lsend, lrecv   ! indicate how communications are to be carried out
+      LOGICAL              , OPTIONAL        , INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners)
+      !!
+      INTEGER                          ::   kfld        ! number of elements that will be attributed
+      TYPE(PTR_4d_/**/PRECISION), DIMENSION(16) ::   ptab_ptr    ! pointer array
+      CHARACTER(len=1) , DIMENSION(16) ::   cdna_ptr    ! nature of ptab_ptr grid-points
+      REAL(PRECISION)  , DIMENSION(16) ::   psgn_ptr    ! sign used across the north fold boundary
+      !!---------------------------------------------------------------------
+      !
+      kfld = 0          ! initial array of pointer size
+      !
+      !                 ! Load the first array
+      CALL load_ptr_/**/XD/**/_/**/PRECISION( pt1, cdna1, psgn1, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      !
+      !                 ! Look if more arrays are added
+      IF( PRESENT(psgn2 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt2 , cdna2 , psgn2 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn3 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt3 , cdna3 , psgn3 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn4 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt4 , cdna4 , psgn4 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn5 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt5 , cdna5 , psgn5 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn6 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt6 , cdna6 , psgn6 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn7 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt7 , cdna7 , psgn7 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn8 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt8 , cdna8 , psgn8 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn9 ) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt9 , cdna9 , psgn9 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn10) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt10, cdna10, psgn10, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn11) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt11, cdna11, psgn11, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn12) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt12, cdna12, psgn12, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn13) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt13, cdna13, psgn13, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn14) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt14, cdna14, psgn14, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn15) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt15, cdna15, psgn15, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      IF( PRESENT(psgn16) )   CALL load_ptr_/**/XD/**/_/**/PRECISION( pt16, cdna16, psgn16, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      !     
+      IF( nn_comm == 1 ) THEN 
+         CALL lbc_lnk_pt2pt(   cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only )
+      ELSE
+         CALL lbc_lnk_neicoll( cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only )
+      ENDIF
+      !
+   END SUBROUTINE lbc_lnk_call_/**/XD/**/_/**/PRECISION
+
+
+   SUBROUTINE load_ptr_/**/XD/**/_/**/PRECISION( ptab, cdna, psgn, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
+      !!---------------------------------------------------------------------
+      REAL(PRECISION), DIMENSION(DIMS), TARGET, INTENT(inout), CONTIGUOUS ::   ptab       ! arrays on which the lbc is applied
+      CHARACTER(len=1)              , INTENT(in   ) ::   cdna       ! nature of pt2d array grid-points
+      REAL(PRECISION)               , INTENT(in   ) ::   psgn       ! sign used across the north fold boundary
+      TYPE(PTR_4d_/**/PRECISION), DIMENSION(:), INTENT(inout) ::   ptab_ptr   ! array of pointers
+      CHARACTER(len=1), DIMENSION(:), INTENT(inout) ::   cdna_ptr   ! nature of pt2d_array array grid-points
+      REAL(PRECISION) , DIMENSION(:), INTENT(inout) ::   psgn_ptr   ! sign used across the north fold boundary
+      INTEGER                       , INTENT(inout) ::   kfld       ! number of elements that has been attributed
+      !!---------------------------------------------------------------------
+      !
+      kfld                    =  kfld + 1
+      ptab_ptr(kfld)%pt4d(1:SIZE(ptab, dim=1),1:SIZE(ptab, dim=2),1:ISZ3,1:ISZ4) => ptab
+      cdna_ptr(kfld)          =  cdna
+      psgn_ptr(kfld)          =  psgn
+      !
+   END SUBROUTINE load_ptr_/**/XD/**/_/**/PRECISION
+
+#undef XD
+#undef DIMS
+#undef ISZ3
+#undef ISZ4
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_multi_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_multi_generic.h90	(revision 14675)
+++ 	(revision )
@@ -1,113 +1,0 @@
-#if defined SINGLE_PRECISION
-#   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j)
-#      define PTR_TYPE              TYPE(PTR_2D_sp)
-#      define PTR_ptab              pt2d
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j,k)
-#      define PTR_TYPE              TYPE(PTR_3D_sp)
-#      define PTR_ptab              pt3d
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j,k,l)
-#      define PTR_TYPE              TYPE(PTR_4D_sp)
-#      define PTR_ptab              pt4d
-#   endif
-#   define PRECISION sp
-#else
-#   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j)
-#      define PTR_TYPE              TYPE(PTR_2D_dp)
-#      define PTR_ptab              pt2d
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j,k)
-#      define PTR_TYPE              TYPE(PTR_3D_dp)
-#      define PTR_ptab              pt3d
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j,k,l)
-#      define PTR_TYPE              TYPE(PTR_4D_dp)
-#      define PTR_ptab              pt4d
-#   endif
-#   define PRECISION dp
-#endif
-
-   SUBROUTINE ROUTINE_MULTI( cdname                                                                               &
-      &                    , pt1 , cdna1 , psgn1 , pt2 , cdna2 , psgn2 , pt3 , cdna3 , psgn3 , pt4 , cdna4 , psgn4   &
-      &                    , pt5 , cdna5 , psgn5 , pt6 , cdna6 , psgn6 , pt7 , cdna7 , psgn7 , pt8 , cdna8 , psgn8   &
-      &                    , pt9 , cdna9 , psgn9 , pt10, cdna10, psgn10, pt11, cdna11, psgn11, pt12, cdna12, psgn12  &
-      &                    , pt13, cdna13, psgn13, pt14, cdna14, psgn14, pt15, cdna15, psgn15, pt16, cdna16, psgn16  &
-      &                    , kfillmode, pfillval, lsend, lrecv, ncsten )
-      !!---------------------------------------------------------------------
-      CHARACTER(len=*)     ,                   INTENT(in   ) ::   cdname  ! name of the calling subroutine
-      ARRAY_TYPE(:,:,:,:)            , TARGET, INTENT(inout) ::   pt1     ! arrays on which the lbc is applied
-      ARRAY_TYPE(:,:,:,:)  , OPTIONAL, TARGET, INTENT(inout) ::   pt2   , pt3   , pt4   , pt5   , pt6   , pt7   , pt8   , pt9  , &
-         &                                                        pt10  , pt11  , pt12  , pt13  , pt14  , pt15  , pt16
-      CHARACTER(len=1)                       , INTENT(in   ) ::   cdna1   ! nature of pt2D. array grid-points
-      CHARACTER(len=1)     , OPTIONAL        , INTENT(in   ) ::   cdna2 , cdna3 , cdna4 , cdna5 , cdna6 , cdna7 , cdna8 , cdna9, &
-         &                                                        cdna10, cdna11, cdna12, cdna13, cdna14, cdna15, cdna16
-      REAL(wp)                               , INTENT(in   ) ::   psgn1   ! sign used across the north fold
-      REAL(wp)             , OPTIONAL        , INTENT(in   ) ::   psgn2 , psgn3 , psgn4 , psgn5 , psgn6 , psgn7 , psgn8 , psgn9, &
-         &                                                        psgn10, psgn11, psgn12, psgn13, psgn14, psgn15, psgn16
-      INTEGER              , OPTIONAL        , INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
-      REAL(wp)             , OPTIONAL        , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
-      LOGICAL, DIMENSION(4), OPTIONAL        , INTENT(in   ) ::   lsend, lrecv   ! indicate how communications are to be carried out
-      LOGICAL              , OPTIONAL        , INTENT(in   ) ::   ncsten
-      !!
-      INTEGER                          ::   kfld        ! number of elements that will be attributed
-      PTR_TYPE         , DIMENSION(16) ::   ptab_ptr    ! pointer array
-      CHARACTER(len=1) , DIMENSION(16) ::   cdna_ptr    ! nature of ptab_ptr grid-points
-      REAL(wp)         , DIMENSION(16) ::   psgn_ptr    ! sign used across the north fold boundary
-      !!---------------------------------------------------------------------
-      !
-      kfld = 0          ! initial array of pointer size
-      !
-      !                 ! Load the first array
-      CALL ROUTINE_LOAD( pt1, cdna1, psgn1, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !
-      !                 ! Look if more arrays are added
-      IF( PRESENT(psgn2 ) )   CALL ROUTINE_LOAD( pt2 , cdna2 , psgn2 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn3 ) )   CALL ROUTINE_LOAD( pt3 , cdna3 , psgn3 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn4 ) )   CALL ROUTINE_LOAD( pt4 , cdna4 , psgn4 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn5 ) )   CALL ROUTINE_LOAD( pt5 , cdna5 , psgn5 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn6 ) )   CALL ROUTINE_LOAD( pt6 , cdna6 , psgn6 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn7 ) )   CALL ROUTINE_LOAD( pt7 , cdna7 , psgn7 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn8 ) )   CALL ROUTINE_LOAD( pt8 , cdna8 , psgn8 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn9 ) )   CALL ROUTINE_LOAD( pt9 , cdna9 , psgn9 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn10) )   CALL ROUTINE_LOAD( pt10, cdna10, psgn10, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn11) )   CALL ROUTINE_LOAD( pt11, cdna11, psgn11, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn12) )   CALL ROUTINE_LOAD( pt12, cdna12, psgn12, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn13) )   CALL ROUTINE_LOAD( pt13, cdna13, psgn13, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn14) )   CALL ROUTINE_LOAD( pt14, cdna14, psgn14, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn15) )   CALL ROUTINE_LOAD( pt15, cdna15, psgn15, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn16) )   CALL ROUTINE_LOAD( pt16, cdna16, psgn16, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !
-      CALL lbc_lnk_ptr( cdname, ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, lsend, lrecv, ncsten )
-      !
-   END SUBROUTINE ROUTINE_MULTI
-
-
-   SUBROUTINE ROUTINE_LOAD( ptab, cdna, psgn, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !!---------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:)   , TARGET, INTENT(inout) ::   ptab       ! arrays on which the lbc is applied
-      CHARACTER(len=1)              , INTENT(in   ) ::   cdna       ! nature of pt2d array grid-points
-      REAL(wp)                      , INTENT(in   ) ::   psgn       ! sign used across the north fold boundary
-      PTR_TYPE        , DIMENSION(:), INTENT(inout) ::   ptab_ptr   ! array of pointers
-      CHARACTER(len=1), DIMENSION(:), INTENT(inout) ::   cdna_ptr   ! nature of pt2d_array array grid-points
-      REAL(wp)        , DIMENSION(:), INTENT(inout) ::   psgn_ptr   ! sign used across the north fold boundary
-      INTEGER                       , INTENT(inout) ::   kfld       ! number of elements that has been attributed
-      !!---------------------------------------------------------------------
-      !
-      kfld                    =  kfld + 1
-      ptab_ptr(kfld)%PTR_ptab => ptab
-      cdna_ptr(kfld)          =  cdna
-      psgn_ptr(kfld)          =  psgn
-      !
-   END SUBROUTINE ROUTINE_LOAD
-
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef PTR_TYPE
-#undef PTR_ptab
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_nc_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_nc_generic.h90	(revision 14675)
+++ 	(revision )
@@ -1,113 +1,0 @@
-#if defined SINGLE_PRECISION
-#   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j)
-#      define PTR_TYPE              TYPE(PTR_2D_sp)
-#      define PTR_ptab              pt2d
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j,k)
-#      define PTR_TYPE              TYPE(PTR_3D_sp)
-#      define PTR_ptab              pt3d
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(sp), DIMENSION(i,j,k,l)
-#      define PTR_TYPE              TYPE(PTR_4D_sp)
-#      define PTR_ptab              pt4d
-#   endif
-#   define PRECISION sp
-#else
-#   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j)
-#      define PTR_TYPE              TYPE(PTR_2D_dp)
-#      define PTR_ptab              pt2d
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j,k)
-#      define PTR_TYPE              TYPE(PTR_3D_dp)
-#      define PTR_ptab              pt3d
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_TYPE(i,j,k,l)   REAL(dp), DIMENSION(i,j,k,l)
-#      define PTR_TYPE              TYPE(PTR_4D_dp)
-#      define PTR_ptab              pt4d
-#   endif
-#   define PRECISION dp
-#endif
-
-   SUBROUTINE ROUTINE_MULTI_NC( cdname                                                                             &
-      &                    , pt1 , cdna1 , psgn1 , pt2 , cdna2 , psgn2 , pt3 , cdna3 , psgn3 , pt4 , cdna4 , psgn4   &
-      &                    , pt5 , cdna5 , psgn5 , pt6 , cdna6 , psgn6 , pt7 , cdna7 , psgn7 , pt8 , cdna8 , psgn8   &
-      &                    , pt9 , cdna9 , psgn9 , pt10, cdna10, psgn10, pt11, cdna11, psgn11, pt12, cdna12, psgn12  &
-      &                    , pt13, cdna13, psgn13, pt14, cdna14, psgn14, pt15, cdna15, psgn15, pt16, cdna16, psgn16  &
-      &                    , kfillmode, pfillval, lsend, lrecv, ncsten )
-      !!---------------------------------------------------------------------
-      CHARACTER(len=*)   ,                   INTENT(in   ) :: cdname  ! name of the calling subroutine
-      ARRAY_TYPE(:,:,:,:)          , TARGET, INTENT(inout) :: pt1     ! arrays on which the lbc is applied
-      ARRAY_TYPE(:,:,:,:), OPTIONAL, TARGET, INTENT(inout) :: pt2  , pt3  , pt4  , pt5  , pt6  , pt7  , pt8  , pt9  , &
-         &                                                    pt10  , pt11  , pt12  , pt13  , pt14  , pt15  , pt16
-      CHARACTER(len=1)                     , INTENT(in   ) :: cdna1   ! nature of pt2D. array grid-points
-      CHARACTER(len=1)   , OPTIONAL        , INTENT(in   ) :: cdna2, cdna3, cdna4, cdna5, cdna6, cdna7, cdna8, cdna9, &
-         &                                                    cdna10, cdna11, cdna12, cdna13, cdna14, cdna15, cdna16
-      REAL(wp)                             , INTENT(in   ) :: psgn1   ! sign used across the north fold
-      REAL(wp)           , OPTIONAL        , INTENT(in   ) :: psgn2, psgn3, psgn4, psgn5, psgn6, psgn7, psgn8, psgn9, &
-         &                                                    psgn10, psgn11, psgn12, psgn13, psgn14, psgn15, psgn16
-      INTEGER            , OPTIONAL        , INTENT(in   ) :: kfillmode   ! filling method for halo over land (default = constant)
-      REAL(wp)           , OPTIONAL        , INTENT(in   ) :: pfillval    ! background value (used at closed boundaries)
-      LOGICAL, DIMENSION(4), OPTIONAL      , INTENT(in   ) :: lsend, lrecv   ! indicate how communications are to be carried out
-      LOGICAL            , OPTIONAL      , INTENT(in   ) :: ncsten
-      !!
-      INTEGER                          ::   kfld        ! number of elements that will be attributed
-      PTR_TYPE         , DIMENSION(16) ::   ptab_ptr    ! pointer array
-      CHARACTER(len=1) , DIMENSION(16) ::   cdna_ptr    ! nature of ptab_ptr grid-points
-      REAL(wp)         , DIMENSION(16) ::   psgn_ptr    ! sign used across the north fold boundary
-      !!---------------------------------------------------------------------
-      !
-      kfld = 0          ! initial array of pointer size
-      !
-      !                 ! Load the first array
-      CALL ROUTINE_NC_LOAD( pt1, cdna1, psgn1, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !
-      !                 ! Look if more arrays are added
-      IF( PRESENT(psgn2 ) )   CALL ROUTINE_NC_LOAD( pt2 , cdna2 , psgn2 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn3 ) )   CALL ROUTINE_NC_LOAD( pt3 , cdna3 , psgn3 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn4 ) )   CALL ROUTINE_NC_LOAD( pt4 , cdna4 , psgn4 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn5 ) )   CALL ROUTINE_NC_LOAD( pt5 , cdna5 , psgn5 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn6 ) )   CALL ROUTINE_NC_LOAD( pt6 , cdna6 , psgn6 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn7 ) )   CALL ROUTINE_NC_LOAD( pt7 , cdna7 , psgn7 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn8 ) )   CALL ROUTINE_NC_LOAD( pt8 , cdna8 , psgn8 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn9 ) )   CALL ROUTINE_NC_LOAD( pt9 , cdna9 , psgn9 , ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn10) )   CALL ROUTINE_NC_LOAD( pt10, cdna10, psgn10, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn11) )   CALL ROUTINE_NC_LOAD( pt11, cdna11, psgn11, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn12) )   CALL ROUTINE_NC_LOAD( pt12, cdna12, psgn12, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn13) )   CALL ROUTINE_NC_LOAD( pt13, cdna13, psgn13, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn14) )   CALL ROUTINE_NC_LOAD( pt14, cdna14, psgn14, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn15) )   CALL ROUTINE_NC_LOAD( pt15, cdna15, psgn15, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      IF( PRESENT(psgn16) )   CALL ROUTINE_NC_LOAD( pt16, cdna16, psgn16, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !
-      CALL lbc_lnk_nc    ( cdname,               ptab_ptr, cdna_ptr, psgn_ptr, kfld, kfillmode, pfillval, lsend, lrecv, ncsten )
-      !
-   END SUBROUTINE ROUTINE_MULTI_NC
-
-
-   SUBROUTINE ROUTINE_NC_LOAD( ptab, cdna, psgn, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
-      !!---------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:)   , TARGET, INTENT(inout) ::   ptab       ! arrays on which the lbc is applied
-      CHARACTER(len=1)              , INTENT(in   ) ::   cdna       ! nature of pt2d array grid-points
-      REAL(wp)                      , INTENT(in   ) ::   psgn       ! sign used across the north fold boundary
-      PTR_TYPE        , DIMENSION(:), INTENT(inout) ::   ptab_ptr   ! array of pointers
-      CHARACTER(len=1), DIMENSION(:), INTENT(inout) ::   cdna_ptr   ! nature of pt2d_array array grid-points
-      REAL(wp)        , DIMENSION(:), INTENT(inout) ::   psgn_ptr   ! sign used across the north fold boundary
-      INTEGER                       , INTENT(inout) ::   kfld       ! number of elements that has been attributed
-      !!---------------------------------------------------------------------
-      !
-      kfld                    =  kfld + 1
-      ptab_ptr(kfld)%PTR_ptab => ptab
-      cdna_ptr(kfld)          =  cdna
-      psgn_ptr(kfld)          =  psgn
-      !
-   END SUBROUTINE ROUTINE_NC_LOAD
-
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef PTR_TYPE
-#undef PTR_ptab
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_neicoll_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_neicoll_generic.h90	(revision 14676)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_neicoll_generic.h90	(revision 14676)
@@ -0,0 +1,260 @@
+
+   SUBROUTINE lbc_lnk_neicoll_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only )
+      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
+      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
+      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER                       , INTENT(in   ) ::   kfld        ! number of pt3d arrays
+      INTEGER ,             OPTIONAL, INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
+      REAL(PRECISION),      OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
+      INTEGER ,             OPTIONAL, INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
+      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners)
+      !
+      INTEGER  ::    ji,  jj,  jk , jl,  jf, jn      ! dummy loop indices
+      INTEGER  ::   ipi, ipj, ipk, ipl, ipf          ! dimension of the input array
+      INTEGER  ::   ip0i, ip1i, im0i, im1i
+      INTEGER  ::   ip0j, ip1j, im0j, im1j
+      INTEGER  ::   ishti, ishtj, ishti2, ishtj2
+      INTEGER  ::   iszS, iszR
+      INTEGER  ::   ierr
+      INTEGER  ::   ihls, idx
+      INTEGER  ::   impi_nc
+      INTEGER  ::   ifill_nfd
+      INTEGER, DIMENSION(4)  ::   iwewe, issnn
+      INTEGER, DIMENSION(8)  ::   isizei, ishtSi, ishtRi, ishtPi
+      INTEGER, DIMENSION(8)  ::   isizej, ishtSj, ishtRj, ishtPj
+      INTEGER, DIMENSION(8)  ::   ifill, iszall
+      INTEGER, DIMENSION(:), ALLOCATABLE  ::   iScnt, iRcnt    ! number of elements to be sent/received
+      INTEGER, DIMENSION(:), ALLOCATABLE  ::   iSdpl, iRdpl    ! displacement in halos arrays
+      LOGICAL, DIMENSION(8)  ::   llsend, llrecv
+      REAL(PRECISION) ::   zland
+      LOGICAL  ::   ll4only                                    ! default: 8 neighbourgs
+      LOGICAL  ::   ll_IdoNFold
+      !!----------------------------------------------------------------------
+      !
+      ! ----------------------------------------- !
+      !     1. local variables initialization     !
+      ! ----------------------------------------- !
+      !
+      ipi = SIZE(ptab(1)%pt4d,1)
+      ipj = SIZE(ptab(1)%pt4d,2)
+      ipk = SIZE(ptab(1)%pt4d,3)
+      ipl = SIZE(ptab(1)%pt4d,4)
+      ipf = kfld
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
+      !
+      ! take care of optional parameters
+      !
+      ihls = nn_hls       ! default definition
+      IF( PRESENT( khls ) )   ihls = khls
+      IF( ihls > n_hlsmax ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), '  is calling lbc_lnk with khls > n_hlsmax : ', khls, '>', n_hlsmax
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      IF( ipi /= Ni_0+2*ihls ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with an input array which does not match ihls along i: ', ipi, ihls, Ni_0
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      IF( ipj /= Nj_0+2*ihls ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with an input array which does not match ihls along j:', ipj, ihls , Nj_0
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      !
+      ll4only = .FALSE.    ! default definition
+      IF( PRESENT(ld4only) )   ll4only = ld4only
+      !
+      impi_nc = mpi_nc_com8(ihls)   ! default
+      IF( ll4only )   impi_nc = mpi_nc_com4(ihls)
+      !
+      zland = 0._wp                                     ! land filling value: zero by default
+      IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
+      !
+      ! define llsend and llrecv: logicals which say if mpi-neibourgs for send or receive exist or not.
+      IF     ( PRESENT(lsend) .AND. PRESENT(lrecv) ) THEN   ! localy defined neighbourgs 
+         CALL ctl_stop( 'STOP', 'mpp_nc_generic+BDY not yet implemented')
+!!$         ---> llsend(:) = lsend(:)   ;   llrecv(:) = lrecv(:) ???
+      ELSE IF( PRESENT(lsend) .OR.  PRESENT(lrecv) ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), '  is calling lbc_lnk with only one of the two arguments lsend or lrecv'
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ELSE                                              ! default neighbours
+         llsend(:) = mpiSnei(ihls,:) >= 0
+         IF( ll4only )   llsend(5:8) = .FALSE.          ! exclude corners
+         llrecv(:) = mpiRnei(ihls,:) >= 0
+         IF( ll4only )   llrecv(5:8) = .FALSE.          ! exclude corners
+      ENDIF
+      !
+      ! define ifill: which method should be used to fill each parts (sides+corners) of the halos
+      ! default definition
+      DO jn = 1, 8
+         IF(             llrecv(jn) ) THEN   ;   ifill(jn) = jpfillmpi    ! with an mpi communication
+         ELSEIF(    l_SelfPerio(jn) ) THEN   ;   ifill(jn) = jpfillperio  ! with self-periodicity
+         ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill(jn) = kfillmode    ! localy defined
+         ELSE                                ;   ifill(jn) = jpfillcst    ! constant value (zland)
+         ENDIF
+      END DO
+      ! take care of "indirect self-periodicity" for the corners
+      DO jn = 5, 8
+         IF(.NOT.l_SelfPerio(jn) .AND. l_SelfPerio(jpwe))   ifill(jn) = jpfillnothing   ! no bi-perio but ew-perio: do corners later
+         IF(.NOT.l_SelfPerio(jn) .AND. l_SelfPerio(jpso))   ifill(jn) = jpfillnothing   ! no bi-perio but ns-perio: do corners later
+      END DO
+      ! north fold treatment
+      ll_IdoNFold = l_IdoNFold .AND. ifill(jpno) /= jpfillnothing
+      IF( ll_IdoNFold ) THEN
+         ifill_nfd = ifill(jpno)             ! if we are here, this means llrecv(jpno) = .false. and l_SelfPerio(jpno) = .false.
+         ifill( (/jpno/) ) = jpfillnothing   ! we do north fold -> do nothing for northern halo
+      ENDIF
+      
+      ! We first define the localization and size of the parts of the array that will be sent (s), received (r)
+      ! or used for periodocity (p). The localization is defined as "the bottom left corner - 1" in i and j directions.
+      ! This is a shift that will be applied later in the do loops to pick-up the appropriate part of the array
+      !
+      ! all definitions bellow do not refer to N[ij][se]0 so we can use it with any local value of ihls
+      !                   !                       ________________________
+      ip0i =          0   !          im0j = inner |__|________________|__|
+      ip1i =       ihls   !   im1j = inner - halo |  |__|__________|__|  |
+      im1i = ipi-2*ihls   !                       |  |  |          |  |  |
+      im0i = ipi - ihls   !                       |  |  |          |  |  |
+      ip0j =          0   !                       |  |  |          |  |  |
+      ip1j =       ihls   !                       |  |__|__________|__|  |
+      im1j = ipj-2*ihls   !           ip1j = halo |__|__|__________|__|__|
+      im0j = ipj - ihls   !              ip0j = 0 |__|________________|__|
+      !                   !                    ip0i ip1i        im1i im0i
+      !
+      iwewe(:) = (/ jpwe,jpea,jpwe,jpea /)   ;   issnn(:) = (/ jpso,jpso,jpno,jpno /)
+      !     sides:     west  east south north      ;   corners: so-we, so-ea, no-we, no-ea
+      isizei(1:4) = (/ ihls, ihls, Ni_0, Ni_0 /)   ;   isizei(5:8) = ihls              ! i- count
+      isizej(1:4) = (/ Nj_0, Nj_0, ihls, ihls /)   ;   isizej(5:8) = ihls              ! j- count
+      ishtSi(1:4) = (/ ip1i, im1i, ip1i, ip1i /)   ;   ishtSi(5:8) = ishtSi( iwewe )   ! i- shift send data
+      ishtSj(1:4) = (/ ip1j, ip1j, ip1j, im1j /)   ;   ishtSj(5:8) = ishtSj( issnn )   ! j- shift send data
+      ishtRi(1:4) = (/ ip0i, im0i, ip1i, ip1i /)   ;   ishtRi(5:8) = ishtRi( iwewe )   ! i- shift received data location
+      ishtRj(1:4) = (/ ip1j, ip1j, ip0j, im0j /)   ;   ishtRj(5:8) = ishtRj( issnn )   ! j- shift received data location
+      ishtPi(1:4) = (/ im1i, ip1i, ip1i, ip1i /)   ;   ishtPi(5:8) = ishtPi( iwewe )   ! i- shift data used for periodicity
+      ishtPj(1:4) = (/ ip1j, ip1j, im1j, ip1j /)   ;   ishtPj(5:8) = ishtPj( issnn )   ! j- shift data used for periodicity
+      !
+      ! -------------------------------- !
+      !     2. Prepare MPI exchanges     !
+      ! -------------------------------- !
+      !
+      ! Allocate local temporary arrays to be sent/received.
+      iszS = COUNT( llsend )
+      iszR = COUNT( llrecv )
+      ALLOCATE( iScnt(iszS), iRcnt(iszR), iSdpl(iszS), iRdpl(iszR) )   ! ok if iszS = 0 or iszR = 0
+      iszall(:) = isizei(:) * isizej(:) * ipk * ipl * ipf
+      iScnt(:) = PACK( iszall, mask = llsend )                                       ! ok if mask = .false.
+      iRcnt(:) = PACK( iszall, mask = llrecv )
+      iSdpl(1) = 0
+      DO jn = 2,iszS
+         iSdpl(jn) = iSdpl(jn-1) + iScnt(jn-1)   ! with _alltoallv: in units of sendtype
+      END DO
+      iRdpl(1) = 0
+      DO jn = 2,iszR
+         iRdpl(jn) = iRdpl(jn-1) + iRcnt(jn-1)   ! with _alltoallv: in units of sendtype
+      END DO
+      
+      ! Allocate buffer arrays to be sent/received if needed
+      iszS = SUM(iszall, mask = llsend)                             ! send buffer size
+      IF( ALLOCATED(BUFFSND) ) THEN
+         IF( SIZE(BUFFSND) < iszS )    DEALLOCATE(BUFFSND)          ! send buffer is too small
+      ENDIF
+      IF( .NOT. ALLOCATED(BUFFSND) )   ALLOCATE( BUFFSND(iszS) )
+      iszR = SUM(iszall, mask = llrecv)                             ! recv buffer size
+      IF( ALLOCATED(BUFFRCV) ) THEN
+         IF( SIZE(BUFFRCV) < iszR )    DEALLOCATE(BUFFRCV)          ! recv buffer is too small
+      ENDIF
+      IF( .NOT. ALLOCATED(BUFFRCV) )   ALLOCATE( BUFFRCV(iszR) )
+
+      ! fill sending buffer with ptab(jf)%pt4d
+      idx = 1
+      DO jn = 1, 8
+         IF( llsend(jn) ) THEN
+            ishti = ishtSi(jn)
+            ishtj = ishtSj(jn)
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               BUFFSND(idx) = ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl)
+               idx = idx + 1
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         ENDIF
+      END DO
+      !
+      ! ------------------------------------------------ !
+      !     3. Do all MPI exchanges in 1 unique call     !
+      ! ------------------------------------------------ !
+      !
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
+      CALL mpi_neighbor_alltoallv (BUFFSND, iScnt, iSdpl, MPI_TYPE, BUFFRCV, iRcnt, iRdpl, MPI_TYPE, impi_nc, ierr)
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
+      !
+      ! ------------------------- !
+      !     4. Fill all halos     !
+      ! ------------------------- !
+      !
+      idx = 1
+      DO jn = 1, 8
+         ishti = ishtRi(jn)
+         ishtj = ishtRj(jn)
+         SELECT CASE ( ifill(jn) )
+         CASE ( jpfillnothing )               ! no filling 
+         CASE ( jpfillmpi   )                 ! fill with data received by MPI
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = BUFFRCV(idx)
+               idx = idx + 1
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         CASE ( jpfillperio )                 ! use periodicity
+            ishti2 = ishtPi(jn)
+            ishtj2 = ishtPj(jn)
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         CASE ( jpfillcopy  )                 ! filling with inner domain values
+            ishti2 = ishtSi(jn)
+            ishtj2 = ishtSj(jn)
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         CASE ( jpfillcst   )                 ! filling with constant value
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = zland
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         END SELECT
+      END DO
+
+      DEALLOCATE( iScnt, iRcnt, iSdpl, iRdpl )
+      IF( iszS > jpi*jpj )   DEALLOCATE(BUFFSND)                    ! blocking Send -> can directly deallocate
+      IF( iszR > jpi*jpj )   DEALLOCATE(BUFFRCV)                    ! blocking Recv -> can directly deallocate
+
+      ! potential "indirect self-periodicity" for the corners
+      DO jn = 5, 8
+         IF( .NOT. l_SelfPerio(jn) .AND. l_SelfPerio(jpwe)  ) THEN   ! no bi-perio but ew-perio: corners indirect definition
+            ishti  = ishtRi(jn)
+            ishtj  = ishtRj(jn)
+            ishti2 = ishtPi(jn)   ! use i- shift periodicity
+            ishtj2 = ishtRj(jn)   ! use j- shift recv location: use ew-perio -> ok as filling of the south and north halos now done
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         ENDIF
+         IF( .NOT. l_SelfPerio(jn) .AND. l_SelfPerio(jpso)  ) THEN   ! no bi-perio but ns-perio: corners indirect definition
+            ishti  = ishtRi(jn)
+            ishtj  = ishtRj(jn)
+            ishti2 = ishtRi(jn)   ! use i- shift recv location: use ns-perio -> ok as filling of the west and east halos now done
+            ishtj2 = ishtPj(jn)   ! use j- shift periodicity
+            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+               ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+         ENDIF
+      END DO
+      !
+      ! ------------------------------- !
+      !     5. north fold treatment     !
+      ! ------------------------------- !
+      !
+      IF( ll_IdoNFold ) THEN
+         IF( jpni == 1 )  THEN   ;   CALL lbc_nfd( ptab, cd_nat, psgn                  , ihls, ipf )   ! self NFold
+         ELSE                    ;   CALL mpp_nfd( ptab, cd_nat, psgn, ifill_nfd, zland, ihls, ipf )   ! mpi  NFold
+         ENDIF
+      ENDIF
+      !
+   END SUBROUTINE lbc_lnk_neicoll_/**/PRECISION
+
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_pt2pt_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_pt2pt_generic.h90	(revision 14676)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_lnk_pt2pt_generic.h90	(revision 14676)
@@ -0,0 +1,304 @@
+  
+#if ! defined BLOCK_ISEND && ! defined BLOCK_FILL
+   SUBROUTINE lbc_lnk_pt2pt_/**/PRECISION( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, khls, lsend, lrecv, ld4only )
+      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
+      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
+      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER                       , INTENT(in   ) ::   kfld        ! number of pt3d arrays
+      INTEGER ,             OPTIONAL, INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
+      REAL(PRECISION),      OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
+      INTEGER ,             OPTIONAL, INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
+      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ld4only     ! if .T., do only 4-neighbour comm (ignore corners)
+      !
+      INTEGER  ::     ji,   jj,  jk,  jl,  jf, jn     ! dummy loop indices
+      INTEGER  ::    ipi,  ipj, ipk, ipl, ipf         ! dimension of the input array
+      INTEGER  ::   ip0i, ip1i, im0i, im1i
+      INTEGER  ::   ip0j, ip1j, im0j, im1j
+      INTEGER  ::   ishti, ishtj, ishti2, ishtj2
+      INTEGER  ::   ifill_nfd, icomm, ierr
+      INTEGER  ::   ihls, idxs, idxr, iszS, iszR
+      INTEGER, DIMENSION(4)  ::   iwewe, issnn
+      INTEGER, DIMENSION(8)  ::   isizei, ishtSi, ishtRi, ishtPi
+      INTEGER, DIMENSION(8)  ::   isizej, ishtSj, ishtRj, ishtPj
+      INTEGER, DIMENSION(8)  ::   ifill, iszall, ishtS, ishtR
+      INTEGER, DIMENSION(8)  ::   ireq             ! mpi_request id
+      INTEGER, DIMENSION(8)  ::   iStag, iRtag     ! Send and Recv mpi_tag id
+      REAL(PRECISION) ::   zland
+      LOGICAL, DIMENSION(8)  ::   llsend, llrecv
+      LOGICAL  ::   ll4only                                        ! default: 8 neighbourgs
+      LOGICAL  ::   ll_IdoNFold
+      !!----------------------------------------------------------------------
+      !
+      ! ----------------------------------------- !
+      !     1. local variables initialization     !
+      ! ----------------------------------------- !
+      !
+      ipi = SIZE(ptab(1)%pt4d,1)
+      ipj = SIZE(ptab(1)%pt4d,2)
+      ipk = SIZE(ptab(1)%pt4d,3)
+      ipl = SIZE(ptab(1)%pt4d,4)
+      ipf = kfld
+      !
+      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
+      !
+      idxs = 1   ! initalize index for send buffer
+      idxr = 1   ! initalize index for recv buffer
+      icomm = mpi_comm_oce        ! shorter name
+      !
+      ! take care of optional parameters
+      !
+      ihls = nn_hls   ! default definition
+      IF( PRESENT( khls ) )   ihls = khls
+      IF( ihls > n_hlsmax ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with khls > n_hlsmax : ', khls, '>', n_hlsmax
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      IF( ipi /= Ni_0+2*ihls ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with an input array which does not match ihls along i: ', ipi, ihls, Ni_0
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      IF( ipj /= Nj_0+2*ihls ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with an input array which does not match ihls along j:', ipj, ihls , Nj_0
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
+      !
+      ll4only = .FALSE.    ! default definition
+      IF( PRESENT(ld4only) )   ll4only = ld4only
+      !
+      zland = 0._wp                                     ! land filling value: zero by default
+      IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
+      !
+      ! define llsend and llrecv: logicals which say if mpi-neibourgs for send or receive exist or not.
+      IF     ( PRESENT(lsend) .AND. PRESENT(lrecv) ) THEN   ! localy defined neighbourgs 
+         llsend(1:4) = lsend(1:4)   ;   llrecv(1:4) = lrecv(1:4)
+      ELSE IF( PRESENT(lsend) .OR.  PRESENT(lrecv) ) THEN
+         WRITE(ctmp1,*) TRIM(cdname), ' is calling lbc_lnk with only one of the two arguments lsend or lrecv'
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ELSE                                              ! default neighbours
+         llsend(:) = mpiSnei(ihls,:) >= 0
+         IF( ll4only )   llsend(5:8) = .FALSE.          ! exclude corners
+         llrecv(:) = mpiRnei(ihls,:) >= 0
+         IF( ll4only )   llrecv(5:8) = .FALSE.          ! exclude corners
+      ENDIF
+      !
+      ! define ifill: which method should be used to fill each parts (sides+corners) of the halos
+      ! default definition
+      DO jn = 1, 4
+         IF(             llrecv(jn) ) THEN   ;   ifill(jn) = jpfillmpi    ! with an mpi communication
+         ELSEIF(    l_SelfPerio(jn) ) THEN   ;   ifill(jn) = jpfillperio  ! with self-periodicity
+         ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill(jn) = kfillmode    ! localy defined
+         ELSE                                ;   ifill(jn) = jpfillcst    ! constant value (zland)
+         ENDIF
+      END DO
+      DO jn = 5, 8
+         IF(             llrecv(jn) ) THEN   ;   ifill(jn) = jpfillmpi    ! with an mpi communication
+         ELSE                                ;   ifill(jn) = jpfillnothing! do nothing
+         ENDIF
+      END DO
+         !
+      ! north fold treatment
+      ll_IdoNFold = l_IdoNFold .AND. ifill(jpno) /= jpfillnothing
+      IF( ll_IdoNFold ) THEN
+         ifill_nfd = ifill(jpno)             ! if we are here, this means llrecv(jpno) = .false. and l_SelfPerio(jpno) = .false.
+         ifill( (/jpno/) ) = jpfillnothing   ! we do north fold -> do nothing for northern halo
+      ENDIF
+      
+      ! We first define the localization and size of the parts of the array that will be sent (s), received (r)
+      ! or used for periodocity (p). The localization is defined as "the bottom left corner - 1" in i and j directions.
+      ! This is a shift that will be applied later in the do loops to pick-up the appropriate part of the array
+      !
+      ! all definitions bellow do not refer to N[ij][se]0 so we can use it with any local value of ihls
+      !                   !                       ________________________
+      ip0i =          0   !          im0j = inner |__|__|__________|__|__|
+      ip1i =       ihls   !   im1j = inner - halo |__|__|__________|__|__|
+      im1i = ipi-2*ihls   !                       |  |  |          |  |  |
+      im0i = ipi - ihls   !                       |  |  |          |  |  |
+      ip0j =          0   !                       |  |  |          |  |  |
+      ip1j =       ihls   !                       |__|__|__________|__|__|
+      im1j = ipj-2*ihls   !           ip1j = halo |__|__|__________|__|__|
+      im0j = ipj - ihls   !              ip0j = 0 |__|__|__________|__|__|
+      !                   !                    ip0i ip1i        im1i im0i
+      !
+      iwewe(:) = (/ jpwe,jpea,jpwe,jpea /)   ;   issnn(:) = (/ jpso,jpso,jpno,jpno /)
+      !cd     sides:     west  east south north      ;   corners: so-we, so-ea, no-we, no-ea
+      isizei(1:4) = (/ ihls, ihls,  ipi,  ipi /)   ;   isizei(5:8) = ihls              ! i- count
+      isizej(1:4) = (/  ipj,  ipj, ihls, ihls /)   ;   isizej(5:8) = ihls              ! j- count
+      ishtSi(1:4) = (/ ip1i, im1i, ip0i, ip0i /)   ;   ishtSi(5:8) = ishtSi( iwewe )   ! i- shift send data
+      ishtSj(1:4) = (/ ip0j, ip0j, ip1j, im1j /)   ;   ishtSj(5:8) = ishtSj( issnn )   ! j- shift send data
+      ishtRi(1:4) = (/ ip0i, im0i, ip0i, ip0i /)   ;   ishtRi(5:8) = ishtRi( iwewe )   ! i- shift received data location
+      ishtRj(1:4) = (/ ip0j, ip0j, ip0j, im0j /)   ;   ishtRj(5:8) = ishtRj( issnn )   ! j- shift received data location
+      ishtPi(1:4) = (/ im1i, ip1i, ip0i, ip0i /)   ;   ishtPi(5:8) = ishtPi( iwewe )   ! i- shift data used for periodicity
+      ishtPj(1:4) = (/ ip0j, ip0j, im1j, ip1j /)   ;   ishtPj(5:8) = ishtPj( issnn )   ! j- shift data used for periodicity
+      !
+      ! -------------------------------- !
+      !     2. Prepare MPI exchanges     !
+      ! -------------------------------- !
+      !
+      iStag = (/ 1, 2, 3, 4, 5, 6, 7, 8 /)   ! any value but each one must be different
+      ! define iRtag with the corresponding iStag, e.g. data received at west where sent at east.
+      iRtag(jpwe) = iStag(jpea)   ;   iRtag(jpea) = iStag(jpwe)   ;   iRtag(jpso) = iStag(jpno)   ;   iRtag(jpno) = iStag(jpso)
+      iRtag(jpsw) = iStag(jpne)   ;   iRtag(jpse) = iStag(jpnw)   ;   iRtag(jpnw) = iStag(jpse)   ;   iRtag(jpne) = iStag(jpsw)
+      !
+      iszall(:) = isizei(:) * isizej(:) * ipk * ipl * ipf
+      ishtS(1) = 0
+      DO jn = 2, 8
+         ishtS(jn) = ishtS(jn-1) + iszall(jn-1) * COUNT( (/llsend(jn-1)/) )
+      END DO
+      ishtR(1) = 0
+      DO jn = 2, 8
+         ishtR(jn) = ishtR(jn-1) + iszall(jn-1) * COUNT( (/llrecv(jn-1)/) )
+      END DO
+
+      ! Allocate buffer arrays to be sent/received if needed
+      iszS = SUM(iszall, mask = llsend)                             ! send buffer size
+      IF( ALLOCATED(BUFFSND) ) THEN
+         CALL mpi_waitall(8, nreq_p2p, MPI_STATUSES_IGNORE, ierr)   ! wait for Isend from the PREVIOUS call
+         IF( SIZE(BUFFSND) < iszS )    DEALLOCATE(BUFFSND)          ! send buffer is too small
+      ENDIF
+      IF( .NOT. ALLOCATED(BUFFSND) )   ALLOCATE( BUFFSND(iszS) )
+      iszR = SUM(iszall, mask = llrecv)                             ! recv buffer size
+      IF( ALLOCATED(BUFFRCV) ) THEN
+         IF( SIZE(BUFFRCV) < iszR )    DEALLOCATE(BUFFRCV)          ! recv buffer is too small
+      ENDIF
+      IF( .NOT. ALLOCATED(BUFFRCV) )   ALLOCATE( BUFFRCV(iszR) )
+      !
+      ! default definition when no communication is done. understood by mpi_waitall
+      nreq_p2p(:) = MPI_REQUEST_NULL   ! WARNING: Must be done after the call to mpi_waitall just above
+      !
+      ! ----------------------------------------------- !
+      !     3. Do east and west MPI_Isend if needed     !
+      ! ----------------------------------------------- !
+      !
+      DO jn = 1, 2
+#define BLOCK_ISEND
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_ISEND
+      END DO
+      !
+      ! ----------------------------------- !
+      !     4. Fill east and west halos     !
+      ! ----------------------------------- !
+      !
+      DO jn = 1, 2
+#define BLOCK_FILL
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_FILL
+      END DO
+      !
+      ! ------------------------------------------------- !
+      !     5. Do north and south MPI_Isend if needed     !
+      ! ------------------------------------------------- !
+      !
+      DO jn = 3, 4
+#define BLOCK_ISEND
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_ISEND
+      END DO
+      !
+      ! ------------------------------- !
+      !     6. north fold treatment     !
+      ! ------------------------------- !
+      !
+      ! Must be done after receiving data from East/West neighbourgs (as it is coded in mpp_nfd, to be changed one day...)
+      ! Do it after MPI_iSend to south/north neighbourgs so they won't wait (too much) to receive their data
+      ! Do if before MPI_Recv from south/north neighbourgs so we have more time to receive data
+      !
+      IF( ll_IdoNFold ) THEN
+         IF( jpni == 1 )  THEN   ;   CALL lbc_nfd( ptab, cd_nat, psgn                  , ihls, ipf )   ! self NFold
+         ELSE                    ;   CALL mpp_nfd( ptab, cd_nat, psgn, ifill_nfd, zland, ihls, ipf )   ! mpi  NFold
+         ENDIF
+      ENDIF
+      !
+      ! ------------------------------------- !
+      !     7. Fill south and north halos     !
+      ! ------------------------------------- !
+      !
+      DO jn = 3, 4
+#define BLOCK_FILL
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_FILL
+      END DO
+      !
+      ! ----------------------------------------------- !
+      !     8. Specific problem in corner treatment     !
+      !              ( very rate case... )              !
+      ! ----------------------------------------------- !
+      !
+      DO jn = 5, 8
+#define BLOCK_ISEND
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_ISEND
+      END DO
+      DO jn = 5, 8
+#define BLOCK_FILL
+#  include "lbc_lnk_pt2pt_generic.h90"         
+#undef BLOCK_FILL
+      END DO
+      !
+      ! -------------------------------------------- !
+      !     9. deallocate local temporary arrays     !
+      !        if they areg larger than jpi*jpj      !  <- arbitrary max size...
+      ! -------------------------------------------- !
+      !
+      IF( iszR > jpi*jpj )   DEALLOCATE(BUFFRCV)                    ! blocking receive -> can directly deallocate
+      IF( iszS > jpi*jpj ) THEN
+         CALL mpi_waitall(8, nreq_p2p, MPI_STATUSES_IGNORE, ierr)   ! must wait before deallocate send buffer
+         DEALLOCATE(BUFFSND)
+      ENDIF
+      !
+   END SUBROUTINE lbc_lnk_pt2pt_/**/PRECISION
+#endif
+
+#if defined BLOCK_ISEND
+   IF( llsend(jn) ) THEN
+      ishti = ishtSi(jn)
+      ishtj = ishtSj(jn)
+      DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+         BUFFSND(idxs) = ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl)
+         idxs = idxs + 1
+      END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+#if ! defined key_mpi_off
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
+      ! non-blocking send of the west/east side using local buffer
+      CALL MPI_ISEND( BUFFSND(ishtS(jn)+1), iszall(jn), MPI_TYPE, mpiSnei(ihls,jn), iStag(jn), icomm, nreq_p2p(jn), ierr )
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
+#endif
+   ENDIF
+#endif
+
+#if defined BLOCK_FILL
+   ishti = ishtRi(jn)
+   ishtj = ishtRj(jn)
+   SELECT CASE ( ifill(jn) )
+   CASE ( jpfillnothing )               ! no filling 
+   CASE ( jpfillmpi   )                 ! fill with data received by MPI
+#if ! defined key_mpi_off
+      IF( ln_timing ) CALL tic_tac(.TRUE.)
+      !                                 ! blocking receive of the west/east halo in local temporary arrays
+      CALL MPI_RECV( BUFFRCV(ishtR(jn)+1), iszall(jn), MPI_TYPE, mpiRnei(ihls,jn), iRtag(jn), icomm, MPI_STATUS_IGNORE, ierr )
+      IF( ln_timing ) CALL tic_tac(.FALSE.)
+#endif
+      DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+         ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = BUFFRCV(idxr)
+         idxr = idxr + 1
+      END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+   CASE ( jpfillperio )                 ! use periodicity
+      ishti2 = ishtPi(jn)
+      ishtj2 = ishtPj(jn)
+      DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+         ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+      END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+   CASE ( jpfillcopy  )                 ! filling with inner domain values
+      ishti2 = ishtSi(jn)
+      ishtj2 = ishtSj(jn)
+      DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+         ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = ptab(jf)%pt4d(ishti2+ji,ishtj2+jj,jk,jl)
+      END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+   CASE ( jpfillcst   )                 ! filling with constant value
+      DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1,isizej(jn)  ;  DO ji = 1,isizei(jn)
+         ptab(jf)%pt4d(ishti+ji,ishtj+jj,jk,jl) = zland
+      END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
+   END SELECT
+#endif
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_ext_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_ext_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_ext_generic.h90	(revision 14676)
@@ -1,35 +1,14 @@
-!                          !==  IN: ptab is an array  ==!
-#define NAT_IN(k)                cd_nat
-#define SGN_IN(k)                psgn
-#define F_SIZE(ptab)             1
-#if defined DIM_2d
-#   define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
-#   define K_SIZE(ptab)          1
-#   define L_SIZE(ptab)          1
-#endif
-#if defined SINGLE_PRECISION
-#   define ARRAY_TYPE(i,j,k,l,f)    REAL(sp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#   define PRECISION sp
-#else
-#   define ARRAY_TYPE(i,j,k,l,f)    REAL(dp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#   define PRECISION dp
-#endif
 
-   SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kextj )
+   SUBROUTINE lbc_nfd_ext_/**/PRECISION( ptab, cd_nat, psgn, kextj )
       !!----------------------------------------------------------------------
-      INTEGER          , INTENT(in   ) ::   kextj       ! extra halo width at north fold, declared before its use in ARRAY_TYPE
-      ARRAY_TYPE(:,1-kextj:,:,:,:)                      ! array or pointer of arrays on which the boundary condition is applied
-      CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
+      REAL(PRECISION), DIMENSION(:,1-kextj:),INTENT(inout) ::   ptab
+      CHARACTER(len=1), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION),  INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER,          INTENT(in   ) ::   kextj       ! extra halo width at north fold
       !
-      INTEGER  ::    ji,  jj,  jk,  jl, jh,  jf   ! dummy loop indices
-      INTEGER  ::   ipi, ipj, ipk, ipl,     ipf   ! dimension of the input array
+      INTEGER  ::    ji,  jj,  jh   ! dummy loop indices
+      INTEGER  ::   ipj
       INTEGER  ::   ijt, iju, ipjm1
       !!----------------------------------------------------------------------
-      !
-      ipk = K_SIZE(ptab)   ! 3rd dimension
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
-      !
       !
       SELECT CASE ( jpni )
@@ -39,126 +18,103 @@
       !
       ipjm1 = ipj-1
+      !
+      IF( c_NFtype == 'T' ) THEN            ! *  North fold  T-point pivot
+         !
+         SELECT CASE ( cd_nat  )
+         CASE ( 'T' , 'W' )                         ! T-, W-point
+            DO jh = 0, kextj
+               DO ji = 2, jpiglo
+                  ijt = jpiglo-ji+2
+                  ptab(ji,ipj+jh) = psgn * ptab(ijt,ipj-2-jh)
+               END DO
+               ptab(1,ipj+jh) = psgn * ptab(3,ipj-2-jh)
+            END DO
+            DO ji = jpiglo/2+1, jpiglo
+               ijt = jpiglo-ji+2
+               ptab(ji,ipjm1) = psgn * ptab(ijt,ipjm1)
+            END DO
+         CASE ( 'U' )                               ! U-point
+            DO jh = 0, kextj
+               DO ji = 2, jpiglo-1
+                  iju = jpiglo-ji+1
+                  ptab(ji,ipj+jh) = psgn * ptab(iju,ipj-2-jh)
+               END DO
+               ptab(   1  ,ipj+jh) = psgn * ptab(    2   ,ipj-2-jh)
+               ptab(jpiglo,ipj+jh) = psgn * ptab(jpiglo-1,ipj-2-jh) 
+            END DO
+            DO ji = jpiglo/2, jpiglo-1
+               iju = jpiglo-ji+1
+               ptab(ji,ipjm1) = psgn * ptab(iju,ipjm1)
+            END DO
+         CASE ( 'V' )                               ! V-point
+            DO jh = 0, kextj
+               DO ji = 2, jpiglo
+                  ijt = jpiglo-ji+2
+                  ptab(ji,ipj-1+jh) = psgn * ptab(ijt,ipj-2-jh)
+                  ptab(ji,ipj+jh  ) = psgn * ptab(ijt,ipj-3-jh)
+               END DO
+               ptab(1,ipj+jh) = psgn * ptab(3,ipj-3-jh) 
+            END DO
+         CASE ( 'F' )                               ! F-point
+            DO jh = 0, kextj
+               DO ji = 1, jpiglo-1
+                  iju = jpiglo-ji+1
+                  ptab(ji,ipj-1+jh) = psgn * ptab(iju,ipj-2-jh)
+                  ptab(ji,ipj+jh  ) = psgn * ptab(iju,ipj-3-jh)
+               END DO
+            END DO
+            DO jh = 0, kextj
+               ptab(   1  ,ipj+jh) = psgn * ptab(    2   ,ipj-3-jh)
+               ptab(jpiglo,ipj+jh) = psgn * ptab(jpiglo-1,ipj-3-jh)
+            END DO
+         END SELECT
+         !
+      ENDIF   ! c_NFtype == 'T'
+      !
+      IF( c_NFtype == 'F' ) THEN            ! *  North fold  F-point pivot
+         !
+         SELECT CASE ( cd_nat  )
+         CASE ( 'T' , 'W' )                         ! T-, W-point
+            DO jh = 0, kextj
+               DO ji = 1, jpiglo
+                  ijt = jpiglo-ji+1
+                  ptab(ji,ipj+jh) = psgn * ptab(ijt,ipj-1-jh)
+               END DO
+            END DO
+         CASE ( 'U' )                               ! U-point
+            DO jh = 0, kextj
+               DO ji = 1, jpiglo-1
+                  iju = jpiglo-ji
+                  ptab(ji,ipj+jh) = psgn * ptab(iju,ipj-1-jh)
+               END DO
+               ptab(jpiglo,ipj+jh) = psgn * ptab(jpiglo-2,ipj-1-jh)
+            END DO
+         CASE ( 'V' )                               ! V-point
+            DO jh = 0, kextj
+               DO ji = 1, jpiglo
+                  ijt = jpiglo-ji+1
+                  ptab(ji,ipj+jh) = psgn * ptab(ijt,ipj-2-jh)
+               END DO
+            END DO
+            DO ji = jpiglo/2+1, jpiglo
+               ijt = jpiglo-ji+1
+               ptab(ji,ipjm1) = psgn * ptab(ijt,ipjm1)
+            END DO
+         CASE ( 'F' )                               ! F-point
+            DO jh = 0, kextj
+               DO ji = 1, jpiglo-1
+                  iju = jpiglo-ji
+                  ptab(ji,ipj+jh  ) = psgn * ptab(iju,ipj-2-jh)
+               END DO
+               ptab(jpiglo,ipj+jh) = psgn * ptab(jpiglo-2,ipj-2-jh)
+            END DO
+            DO ji = jpiglo/2+1, jpiglo-1
+               iju = jpiglo-ji
+               ptab(ji,ipjm1) = psgn * ptab(iju,ipjm1)
+            END DO
+         END SELECT
+         !
+      ENDIF   ! c_NFtype == 'F'
+      !
+   END SUBROUTINE lbc_nfd_ext_/**/PRECISION
 
-      !
-      DO jf = 1, ipf                      ! Loop on the number of arrays to be treated
-         !
-         SELECT CASE ( npolj )
-         !
-         CASE ( 3 , 4 )                        ! *  North fold  T-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf)  )
-            CASE ( 'T' , 'W' )                         ! T-, W-point
-               DO jh = 0, kextj
-                  DO ji = 2, jpiglo
-                     ijt = jpiglo-ji+2
-                     ARRAY_IN(ji,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipj-2-jh,:,:,jf)
-                  END DO
-                  ARRAY_IN(1,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(3,ipj-2-jh,:,:,jf)
-               END DO
-               DO ji = jpiglo/2+1, jpiglo
-                  ijt = jpiglo-ji+2
-                  ARRAY_IN(ji,ipjm1,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipjm1,:,:,jf)
-               END DO
-            CASE ( 'U' )                               ! U-point
-               DO jh = 0, kextj
-                  DO ji = 2, jpiglo-1
-                     iju = jpiglo-ji+1
-                     ARRAY_IN(ji,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipj-2-jh,:,:,jf)
-                  END DO
-                 ARRAY_IN(   1  ,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(    2   ,ipj-2-jh,:,:,jf)
-                 ARRAY_IN(jpiglo,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(jpiglo-1,ipj-2-jh,:,:,jf) 
-               END DO
-               DO ji = jpiglo/2, jpiglo-1
-                  iju = jpiglo-ji+1
-                  ARRAY_IN(ji,ipjm1,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipjm1,:,:,jf)
-               END DO
-            CASE ( 'V' )                               ! V-point
-               DO jh = 0, kextj
-                  DO ji = 2, jpiglo
-                     ijt = jpiglo-ji+2
-                     ARRAY_IN(ji,ipj-1+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipj-2-jh,:,:,jf)
-                     ARRAY_IN(ji,ipj+jh  ,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipj-3-jh,:,:,jf)
-                  END DO
-                  ARRAY_IN(1,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(3,ipj-3-jh,:,:,jf) 
-               END DO
-            CASE ( 'F' )                               ! F-point
-               DO jh = 0, kextj
-                  DO ji = 1, jpiglo-1
-                     iju = jpiglo-ji+1
-                     ARRAY_IN(ji,ipj-1+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipj-2-jh,:,:,jf)
-                     ARRAY_IN(ji,ipj+jh  ,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipj-3-jh,:,:,jf)
-                  END DO
-               END DO
-               DO jh = 0, kextj
-                  ARRAY_IN(   1  ,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(    2   ,ipj-3-jh,:,:,jf)
-                  ARRAY_IN(jpiglo,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(jpiglo-1,ipj-3-jh,:,:,jf)
-               END DO
-            END SELECT
-            !
-         CASE ( 5 , 6 )                        ! *  North fold  F-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf)  )
-            CASE ( 'T' , 'W' )                         ! T-, W-point
-               DO jh = 0, kextj
-                  DO ji = 1, jpiglo
-                     ijt = jpiglo-ji+1
-                     ARRAY_IN(ji,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipj-1-jh,:,:,jf)
-                  END DO
-               END DO
-            CASE ( 'U' )                               ! U-point
-               DO jh = 0, kextj
-                  DO ji = 1, jpiglo-1
-                     iju = jpiglo-ji
-                     ARRAY_IN(ji,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipj-1-jh,:,:,jf)
-                  END DO
-                  ARRAY_IN(jpiglo,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(jpiglo-2,ipj-1-jh,:,:,jf)
-               END DO
-            CASE ( 'V' )                               ! V-point
-               DO jh = 0, kextj
-                  DO ji = 1, jpiglo
-                     ijt = jpiglo-ji+1
-                     ARRAY_IN(ji,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipj-2-jh,:,:,jf)
-                  END DO
-               END DO
-               DO ji = jpiglo/2+1, jpiglo
-                  ijt = jpiglo-ji+1
-                  ARRAY_IN(ji,ipjm1,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(ijt,ipjm1,:,:,jf)
-               END DO
-            CASE ( 'F' )                               ! F-point
-               DO jh = 0, kextj
-                  DO ji = 1, jpiglo-1
-                     iju = jpiglo-ji
-                     ARRAY_IN(ji,ipj+jh  ,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipj-2-jh,:,:,jf)
-                  END DO
-                  ARRAY_IN(jpiglo,ipj+jh,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(jpiglo-2,ipj-2-jh,:,:,jf)
-               END DO
-               DO ji = jpiglo/2+1, jpiglo-1
-                  iju = jpiglo-ji
-                  ARRAY_IN(ji,ipjm1,:,:,jf) = SGN_IN(jf)  * ARRAY_IN(iju,ipjm1,:,:,jf)
-               END DO
-            END SELECT
-            !
-         CASE DEFAULT                           ! *  closed : the code probably never go through
-            !
-            SELECT CASE ( NAT_IN(jf) )
-            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
-               ARRAY_IN(:,  1:1-kextj  ,:,:,jf) = 0._wp
-               ARRAY_IN(:,ipj:ipj+kextj,:,:,jf) = 0._wp
-            CASE ( 'F' )                               ! F-point
-               ARRAY_IN(:,ipj:ipj+kextj,:,:,jf) = 0._wp
-            END SELECT
-            !
-         END SELECT     !  npolj
-         !
-      END DO
-      !
-   END SUBROUTINE ROUTINE_NFD
-
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef ARRAY_IN
-#undef NAT_IN
-#undef SGN_IN
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_generic.h90	(revision 14676)
@@ -1,199 +1,282 @@
-#if defined MULTI
-#   define NAT_IN(k)                cd_nat(k)   
-#   define SGN_IN(k)                psgn(k)
-#   define F_SIZE(ptab)             kfld
-#   if defined DIM_2d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp),INTENT(inout)::ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#      define J_SIZE(ptab)             SIZE(ptab(1)%pt2d,2)
-#      define K_SIZE(ptab)             1
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_3d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp),INTENT(inout)::ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#      define J_SIZE(ptab)             SIZE(ptab(1)%pt3d,2)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_4d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp),INTENT(inout)::ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#      define J_SIZE(ptab)             SIZE(ptab(1)%pt4d,2)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#   endif
-#else
-!                          !==  IN: ptab is an array  ==!
-#   define NAT_IN(k)                cd_nat
-#   define SGN_IN(k)                psgn
-#   define F_SIZE(ptab)             1
-#   if defined DIM_2d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
-#      define J_SIZE(ptab)          SIZE(ptab,2)
-#      define K_SIZE(ptab)          1
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k)
-#      define J_SIZE(ptab)          SIZE(ptab,2)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l)
-#      define J_SIZE(ptab)          SIZE(ptab,2)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          SIZE(ptab,4)
-#   endif
-#   if defined SINGLE_PRECISION
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(sp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#   else
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(dp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#   endif
-#endif
 
-#   if defined SINGLE_PRECISION
-#      define PRECISION sp
-#   else
-#      define PRECISION dp
-#   endif
-
-#if defined MULTI
-   SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kfld )
-      INTEGER          , INTENT(in   ) ::   kfld        ! number of pt3d arrays
-#else
-   SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn       )
-#endif
-      ARRAY_TYPE(:,:,:,:,:)                             ! array or pointer of arrays on which the boundary condition is applied
-      CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
+   SUBROUTINE lbc_nfd_/**/PRECISION( ptab, cd_nat, psgn, khls, kfld )
+      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
+      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER                       , INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      INTEGER                       , INTENT(in   ) ::   kfld        ! number of pt3d arrays
       !
       INTEGER  ::    ji,  jj,  jk,  jl,  jf   ! dummy loop indices
-      INTEGER  ::        ipj, ipk, ipl, ipf   ! dimension of the input array
+      INTEGER  ::   ipi, ipj, ipk, ipl, ipf   ! dimension of the input array
       INTEGER  ::   ii1, ii2, ij1, ij2
       !!----------------------------------------------------------------------
       !
-      ipj = J_SIZE(ptab)   ! 2nd dimension
-      ipk = K_SIZE(ptab)   ! 3rd    -
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
+      ipi = SIZE(ptab(1)%pt4d,1)
+      ipj = SIZE(ptab(1)%pt4d,2)
+      ipk = SIZE(ptab(1)%pt4d,3)
+      ipl = SIZE(ptab(1)%pt4d,4)
+      ipf = kfld
+      !
+      IF( ipi /= Ni0glo+2*khls ) THEN
+         WRITE(ctmp1,*) 'lbc_nfd input array does not match khls', ipi, khls, Ni0glo
+         CALL ctl_stop( 'STOP', ctmp1 )
+      ENDIF
       !
       DO jf = 1, ipf                      ! Loop on the number of arrays to be treated
          !
-         SELECT CASE ( npolj )
+         IF( c_NFtype == 'T' ) THEN            ! *  North fold  T-point pivot
+            !
+            SELECT CASE ( cd_nat(jf) )
+            CASE ( 'T' , 'W' )                         ! T-, W-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - khls + 1
+                     ij2 = ipj - 2*khls + jj - 1         ! ends at: ipj - 2*khls + khls - 1 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 2 - ji            ! ends at: 2*khls + 2 - khls = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point khls+1
+                        ii1 = khls + ji
+                        ii2 = ii1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo - 1        ! points from khls+2 to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =   2 + khls + ji - 1        ! ends at: 2 + khls + ipi - 2*khls - 1 - 1 = ipi - khls
+                        ii2 = ipi - khls - ji + 1        ! ends at: ipi - khls - ( ipi - 2*khls - 1 ) + 1 = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point ipi - khls + 1
+                        ii1 = ipi - khls + ji
+                        ii2 =          khls + ji
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls-1            ! last khls-1 points
+                        ii1 = ipi - khls + 1 + ji        ! ends at: ipi - khls + 1 + khls - 1 = ipi
+                        ii2 = ipi - khls + 1 - ji        ! ends at: ipi - khls + 1 - khls + 1 = ipi - 2*khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO
+                  !
+                  ! line number ipj-khls : right half
+               	  DO jj = 1, 1
+                     ij1 = ipj - khls
+                     ij2 = ij1   ! same line
+                     !
+                     DO ji = 1, Ni0glo/2-1        ! points from ipi/2+2 to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 = ipi/2 + ji + 1             ! ends at: ipi/2 + (ipi/2 - khls - 1) + 1 = ipi - khls
+                        ii2 = ipi/2 - ji + 1             ! ends at: ipi/2 - (ipi/2 - khls - 1) + 1 = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! first khls points: redo them just in case (if e-w periodocity already done)
+                        !                         ! as we just changed points ipi-2khls+1 to ipi-khls  
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 2 - ji            ! ends at: 2*khls + 2 - khls = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     !                            ! last khls-1 points: have been / will done by e-w periodicity 
+                  END DO
+                  !
+               END DO; END DO
+            CASE ( 'U' )                               ! U-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - khls + 1
+                     ij2 = ipj - 2*khls + jj - 1         ! ends at: ipj - 2*khls + khls - 1 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo            ! points from khls to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji            ! ends at: khls + ipi - 2*khls = ipi - khls
+                        ii2 = ipi - khls - ji + 1        ! ends at: ipi - khls - ( ipi - 2*khls ) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! last khls points
+                        ii1 = ipi - khls + ji            ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls + 1 - ji        ! ends at: ipi - khls + 1 - khls = ipi - 2*khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO
+                  !
+                  ! line number ipj-khls : right half
+               	  DO jj = 1, 1
+                     ij1 = ipj - khls
+                     ij2 = ij1   ! same line
+                     !
+                     DO ji = 1, Ni0glo/2          ! points from ipi/2+1 to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 = ipi/2 + ji                 ! ends at: ipi/2 + (ipi/2 - khls) = ipi - khls
+                        ii2 = ipi/2 - ji + 1             ! ends at: ipi/2 - (ipi/2 - khls) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! first khls points: redo them just in case (if e-w periodocity already done)
+                        !                         ! as we just changed points ipi-2khls+1 to ipi-khls  
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     !                            ! last khls-1 points: have been / will done by e-w periodicity 
+                  END DO
+                  !
+               END DO; END DO
+            CASE ( 'V' )                               ! V-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls+1 lines (from ipj to ipj-khls) : full
+               	  DO jj = 1, khls+1
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - ( khls + 1 ) + 1 = ipj - khls
+                     ij2 = ipj - 2*khls + jj - 2         ! ends at: ipj - 2*khls + khls + 1 - 2 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 2 - ji            ! ends at: 2*khls + 2 - khls = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point khls+1
+                        ii1 = khls + ji
+                        ii2 = ii1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo - 1        ! points from khls+2 to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =   2 + khls + ji - 1        ! ends at: 2 + khls + ipi - 2*khls - 1 - 1 = ipi - khls
+                        ii2 = ipi - khls - ji + 1        ! ends at: ipi - khls - ( ipi - 2*khls - 1 ) + 1 = khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point ipi - khls + 1
+                        ii1 = ipi - khls + ji
+                        ii2 =          khls + ji
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls-1            ! last khls-1 points
+                        ii1 = ipi - khls + 1 + ji        ! ends at: ipi - khls + 1 + khls - 1 = ipi
+                        ii2 = ipi - khls + 1 - ji        ! ends at: ipi - khls + 1 - khls + 1 = ipi - 2*khls + 2
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO
+                  !
+               END DO; END DO
+            CASE ( 'F' )                               ! F-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls+1 lines (from ipj to ipj-khls) : full
+               	  DO jj = 1, khls+1
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - ( khls + 1 ) + 1 = ipj - khls
+                     ij2 = ipj - 2*khls + jj - 2         ! ends at: ipj - 2*khls + khls + 1 - 2 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo            ! points from khls to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji            ! ends at: khls + ipi - 2*khls = ipi - khls
+                        ii2 = ipi - khls - ji + 1        ! ends at: ipi - khls - ( ipi - 2*khls ) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! last khls points
+                        ii1 = ipi - khls + ji            ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls + 1 - ji        ! ends at: ipi - khls + 1 - khls = ipi - 2*khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO
+                  !
+               END DO; END DO
+            END SELECT   ! cd_nat(jf)
+            !
+         ENDIF   ! c_NFtype == 'T'
          !
-         CASE ( 3 , 4 )                        ! *  North fold  T-point pivot
+         IF( c_NFtype == 'F' ) THEN            ! *  North fold  F-point pivot
             !
-            SELECT CASE ( NAT_IN(jf)  )
+            SELECT CASE ( cd_nat(jf) )
             CASE ( 'T' , 'W' )                         ! T-, W-point
                DO jl = 1, ipl; DO jk = 1, ipk
                   !
-                  ! last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - nn_hls + 1
-                     ij2 = ipj - 2*nn_hls + jj - 1       ! ends at: ipj - 2*nn_hls + nn_hls - 1 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point nn_hls+1
-                        ii1 = nn_hls + ji
+                  ! first: line number ipj-khls : 3 points
+               	  DO jj = 1, 1
+                     ij1 = ipj - khls
+                     ij2 = ij1   ! same line
+                     !
+                     DO ji = 1, 1                 ! points from ipi/2+1
+                        ii1 = ipi/2 + ji
+                        ii2 = ipi/2 - ji + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =            ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
+                     END DO
+                     DO ji = 1, 1                 ! points ipi - khls
+                        ii1 = ipi - khls + ji - 1
+                        ii2 =          khls + ji
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =            ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
+                     END DO
+                     DO ji = 1, 1                 ! point khls: redo it just in case (if e-w periodocity already done)
+                        !                         ! as we just changed point ipi - khls
+                        ii1 = khls + ji - 1
+                        ii2 = khls + ji
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =            ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
+                     END DO
+                  END DO
+                  !
+                  ! Second: last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj + 1      - jj             ! ends at: ipj + 1 - khls
+                     ij2 = ipj - 2*khls + jj             ! ends at: ipj - 2*khls + khls = ipj - khls
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo            ! points from khls to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji            ! ends at: khls + ipi - 2*khls = ipi - khls
+                        ii2 = ipi - khls - ji + 1        ! ends at: ipi - khls - ( ipi - 2*khls ) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! last khls points
+                        ii1 = ipi - khls + ji            ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls + 1 - ji        ! ends at: ipi - khls + 1 - khls = ipi - 2*khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO
+                  !
+               END DO; END DO
+            CASE ( 'U' )                               ! U-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj + 1      - jj             ! ends at: ipj + 1 - khls
+                     ij2 = ipj - 2*khls + jj             ! ends at: ipj - 2*khls + khls = ipj - khls
+                     !
+                     DO ji = 1, khls-1            ! first khls-1 points
+                        ii1 =          ji                ! ends at: khls-1
+                        ii2 = 2*khls - ji                ! ends at: 2*khls - ( khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point khls
+                        ii1 = khls + ji - 1
+                        ii2 = ipi - ii1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo - 1        ! points from khls+1 to ipi - khls - 1  (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji            ! ends at: khls + ( ipi - 2*khls - 1 ) = ipi - khls - 1
+                        ii2 = ipi - khls - ji            ! ends at: ipi - khls - ( ipi - 2*khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point ipi - khls
+                        ii1 = ipi - khls + ji - 1
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo - 1        ! points from nn_hls+2 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = 2 + nn_hls      + ji - 1   ! ends at: 2 + nn_hls + jpiglo - 2*nn_hls - 1 - 1 = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point jpiglo - nn_hls + 1
-                        ii1 = jpiglo - nn_hls + ji
-                        ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls-1          ! last nn_hls-1 points
-                        ii1 = jpiglo - nn_hls + 1 + ji   ! ends at: jpiglo - nn_hls + 1 + nn_hls - 1 = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls + 1 = jpiglo - 2*nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-                  ! line number ipj-nn_hls : right half
-               	  DO jj = 1, 1
-                     ij1 = ipj - nn_hls
-                     ij2 = ij1   ! same line
-                     !
-                     DO ji = 1, Ni0glo/2-1        ! points from jpiglo/2+2 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = jpiglo/2 + ji + 1          ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls - 1) + 1 = jpiglo - nn_hls
-                        ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls - 1) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
-                        !                         ! as we just changed points jpiglo-2nn_hls+1 to jpiglo-nn_hls  
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     !                            ! last nn_hls-1 points: have been / will done by e-w periodicity 
-                  END DO
-                  !
-               END DO; END DO
-            CASE ( 'U' )                               ! U-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - nn_hls + 1
-                     ij2 = ipj - 2*nn_hls + jj - 1       ! ends at: ipj - 2*nn_hls + nn_hls - 1 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-                  ! line number ipj-nn_hls : right half
-               	  DO jj = 1, 1
-                     ij1 = ipj - nn_hls
-                     ij2 = ij1   ! same line
-                     !
-                     DO ji = 1, Ni0glo/2          ! points from jpiglo/2+1 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
-                        ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
-                        !                         ! as we just changed points jpiglo-2nn_hls+1 to jpiglo-nn_hls  
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     !                            ! last nn_hls-1 points: have been / will done by e-w periodicity 
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! last khls points
+                        ii1 = ipi - khls + ji            ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls - ji            ! ends at: ipi - khls - khls = ipi - 2*khls
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
                   END DO
                   !
@@ -202,268 +285,107 @@
                DO jl = 1, ipl; DO jk = 1, ipk
                   !
-                  ! last nn_hls+1 lines (from ipj to ipj-nn_hls) : full
-               	  DO jj = 1, nn_hls+1
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - ( nn_hls + 1 ) + 1 = ipj - nn_hls
-                     ij2 = ipj - 2*nn_hls + jj - 2       ! ends at: ipj - 2*nn_hls + nn_hls + 1 - 2 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point nn_hls+1
-                        ii1 = nn_hls + ji
+                  ! last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - khls + 1
+                     ij2 = ipj - 2*khls + jj - 1         ! ends at: ipj - 2*khls + khls - 1 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls              ! first khls points
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo            ! points from khls to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji          ! ends at: khls + ipi - 2*khls = ipi - khls
+                        ii2 = ipi - khls - ji + 1      ! ends at: ipi - khls - ( ipi - 2*khls ) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls            ! last khls points
+                        ii1 = ipi - khls + ji          ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls + 1 - ji      ! ends at: ipi - khls + 1 - khls = ipi - 2*khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO   
+                  !
+                  ! line number ipj-khls : right half
+               	  DO jj = 1, 1
+                     ij1 = ipj - khls
+                     ij2 = ij1   ! same line
+                     !
+                     DO ji = 1, Ni0glo/2          ! points from ipi/2+1 to ipi - khls   (note: Ni0glo = ipi - 2*khls)
+                        ii1 = ipi/2 + ji                 ! ends at: ipi/2 + (ipi/2 - khls) = ipi - khls
+                        ii2 = ipi/2 - ji + 1             ! ends at: ipi/2 - (ipi/2 - khls) + 1 = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! first khls points: redo them just in case (if e-w periodocity already done)
+                        !                         ! as we just changed points ipi-2khls+1 to ipi-khls  
+                        ii1 =              ji            ! ends at: khls
+                        ii2 = 2*khls + 1 - ji            ! ends at: 2*khls + 1 - khls = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     !                            ! last khls points: have been / will done by e-w periodicity 
+                  END DO
+                  !
+               END DO; END DO
+            CASE ( 'F' )                               ! F-point
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  !
+                  ! last khls lines (from ipj to ipj-khls+1) : full
+               	  DO jj = 1, khls
+               	     ij1 = ipj          - jj + 1         ! ends at: ipj - khls + 1
+                     ij2 = ipj - 2*khls + jj - 1         ! ends at: ipj - 2*khls + khls - 1 = ipj - khls - 1
+                     !
+                     DO ji = 1, khls-1            ! first khls-1 points
+                        ii1 =          ji                ! ends at: khls-1
+                        ii2 = 2*khls - ji                ! ends at: 2*khls - ( khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point khls
+                        ii1 = khls + ji - 1
+                        ii2 = ipi - ii1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, Ni0glo - 1        ! points from khls+1 to ipi - khls - 1  (note: Ni0glo = ipi - 2*khls)
+                        ii1 =       khls + ji            ! ends at: khls + ( ipi - 2*khls - 1 ) = ipi - khls - 1
+                        ii2 = ipi - khls - ji            ! ends at: ipi - khls - ( ipi - 2*khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, 1                 ! point ipi - khls
+                        ii1 = ipi - khls + ji - 1
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo - 1        ! points from nn_hls+2 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = 2 + nn_hls      + ji - 1   ! ends at: 2 + nn_hls + jpiglo - 2*nn_hls - 1 - 1 = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point jpiglo - nn_hls + 1
-                        ii1 = jpiglo - nn_hls + ji
-                        ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls-1          ! last nn_hls-1 points
-                        ii1 = jpiglo - nn_hls + 1 + ji   ! ends at: jpiglo - nn_hls + 1 + nn_hls - 1 = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls + 1 = jpiglo - 2*nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-               END DO; END DO
-            CASE ( 'F' )                               ! F-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! last nn_hls+1 lines (from ipj to ipj-nn_hls) : full
-               	  DO jj = 1, nn_hls+1
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - ( nn_hls + 1 ) + 1 = ipj - nn_hls
-                     ij2 = ipj - 2*nn_hls + jj - 2       ! ends at: ipj - 2*nn_hls + nn_hls + 1 - 2 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-               END DO; END DO
-            END SELECT   ! NAT_IN(jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls              ! last khls points
+                        ii1 = ipi - khls + ji            ! ends at: ipi - khls + khls = ipi
+                        ii2 = ipi - khls - ji            ! ends at: ipi - khls - khls = ipi - 2*khls
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                  END DO   
+                  !
+                  ! line number ipj-khls : right half
+               	  DO jj = 1, 1
+                     ij1 = ipj - khls
+                     ij2 = ij1   ! same line
+                     !
+                     DO ji = 1, Ni0glo/2-1        ! points from ipi/2+1 to ipi - khls-1  (note: Ni0glo = ipi - 2*khls)
+                        ii1 = ipi/2 + ji                 ! ends at: ipi/2 + (ipi/2 - khls) = ipi - khls
+                        ii2 = ipi/2 - ji                 ! ends at: ipi/2 - (ipi/2 - khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     DO ji = 1, khls-1            ! first khls-1 points: redo them just in case (if e-w periodocity already done)
+                        !                         ! as we just changed points ipi-2khls+1 to ipi-nn_hl-1  
+                        ii1 =          ji                ! ends at: khls
+                        ii2 = 2*khls - ji                ! ends at: 2*khls - ( khls - 1 ) = khls + 1
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
+                     END DO
+                     !                            ! last khls points: have been / will done by e-w periodicity 
+                  END DO
+                  !
+               END DO; END DO
+            END SELECT   ! cd_nat(jf)
             !
-         CASE ( 5 , 6 )                        ! *  North fold  F-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf)  )
-            CASE ( 'T' , 'W' )                         ! T-, W-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! first: line number ipj-nn_hls : 3 points
-               	  DO jj = 1, 1
-                     ij1 = ipj - nn_hls
-                     ij2 = ij1   ! same line
-                     !
-                     DO ji = 1, 1            ! points from jpiglo/2+1
-                        ii1 = jpiglo/2 + ji
-                        ii2 = jpiglo/2 - ji + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
-                     END DO
-                     DO ji = 1, 1            ! points jpiglo - nn_hls
-                        ii1 = jpiglo - nn_hls + ji - 1
-                        ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
-                     END DO
-                     DO ji = 1, 1            ! point nn_hls: redo it just in case (if e-w periodocity already done)
-                        !                    ! as we just changed point jpiglo - nn_hls
-                        ii1 = nn_hls + ji - 1
-                        ii2 = nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
-                     END DO
-                  END DO
-                  !
-                  ! Second: last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj + 1        - jj           ! ends at: ipj + 1 - nn_hls
-                     ij2 = ipj - 2*nn_hls + jj           ! ends at: ipj - 2*nn_hls + nn_hls = ipj - nn_hls
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-               END DO; END DO
-            CASE ( 'U' )                               ! U-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj + 1        - jj           ! ends at: ipj + 1 - nn_hls
-                     ij2 = ipj - 2*nn_hls + jj           ! ends at: ipj - 2*nn_hls + nn_hls = ipj - nn_hls
-                     !
-                     DO ji = 1, nn_hls-1          ! first nn_hls-1 points
-                        ii1 =            ji              ! ends at: nn_hls-1
-                        ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point nn_hls
-                        ii1 = nn_hls + ji - 1
-                        ii2 = jpiglo - ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo - 1        ! points from nn_hls+1 to jpiglo - nn_hls - 1  (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 =          nn_hls + ji       ! ends at: nn_hls + ( jpiglo - 2*nn_hls - 1 ) = jpiglo - nn_hls - 1
-                        ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point jpiglo - nn_hls
-                        ii1 = jpiglo - nn_hls + ji - 1
-                        ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - nn_hls = jpiglo - 2*nn_hls
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO
-                  !
-               END DO; END DO
-            CASE ( 'V' )                               ! V-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - nn_hls + 1
-                     ij2 = ipj - 2*nn_hls + jj - 1       ! ends at: ipj - 2*nn_hls + nn_hls - 1 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls            ! first nn_hls points
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
-                        ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO   
-                  !
-                  ! line number ipj-nn_hls : right half
-               	  DO jj = 1, 1
-                     ij1 = ipj - nn_hls
-                     ij2 = ij1   ! same line
-                     !
-                     DO ji = 1, Ni0glo/2          ! points from jpiglo/2+1 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
-                        ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
-                        !                         ! as we just changed points jpiglo-2nn_hls+1 to jpiglo-nn_hls  
-                        ii1 =                ji          ! ends at: nn_hls
-                        ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     !                            ! last nn_hls points: have been / will done by e-w periodicity 
-                  END DO
-                  !
-               END DO; END DO
-            CASE ( 'F' )                               ! F-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  !
-                  ! last nn_hls lines (from ipj to ipj-nn_hls+1) : full
-               	  DO jj = 1, nn_hls
-               	     ij1 = ipj            - jj + 1       ! ends at: ipj - nn_hls + 1
-                     ij2 = ipj - 2*nn_hls + jj - 1       ! ends at: ipj - 2*nn_hls + nn_hls - 1 = ipj - nn_hls - 1
-                     !
-                     DO ji = 1, nn_hls-1          ! first nn_hls-1 points
-                        ii1 =            ji              ! ends at: nn_hls-1
-                        ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point nn_hls
-                        ii1 = nn_hls + ji - 1
-                        ii2 = jpiglo - ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, Ni0glo - 1        ! points from nn_hls+1 to jpiglo - nn_hls - 1  (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 =          nn_hls + ji       ! ends at: nn_hls + ( jpiglo - 2*nn_hls - 1 ) = jpiglo - nn_hls - 1
-                        ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, 1                 ! point jpiglo - nn_hls
-                        ii1 = jpiglo - nn_hls + ji - 1
-                        ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls            ! last nn_hls points
-                        ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
-                        ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - nn_hls = jpiglo - 2*nn_hls
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                  END DO   
-                  !
-                  ! line number ipj-nn_hls : right half
-               	  DO jj = 1, 1
-                     ij1 = ipj - nn_hls
-                     ij2 = ij1   ! same line
-                     !
-                     DO ji = 1, Ni0glo/2-1        ! points from jpiglo/2+1 to jpiglo - nn_hls-1  (note: Ni0glo = jpiglo - 2*nn_hls)
-                        ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
-                        ii2 = jpiglo/2 - ji              ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     DO ji = 1, nn_hls-1          ! first nn_hls-1 points: redo them just in case (if e-w periodocity already done)
-                        !                         ! as we just changed points jpiglo-2nn_hls+1 to jpiglo-nn_hl-1  
-                        ii1 =            ji              ! ends at: nn_hls
-                        ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
-                     END DO
-                     !                            ! last nn_hls points: have been / will done by e-w periodicity 
-                  END DO
-                  !
-               END DO; END DO
-            END SELECT   ! NAT_IN(jf)
-            !
-         END SELECT   ! npolj
+         ENDIF   ! c_NFtype == 'F'
          !
       END DO   ! ipf
       !
-   END SUBROUTINE ROUTINE_NFD
+   END SUBROUTINE lbc_nfd_/**/PRECISION
 
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef ARRAY_IN
-#undef NAT_IN
-#undef SGN_IN
-#undef J_SIZE
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_nogather_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbc_nfd_nogather_generic.h90	(revision 14676)
@@ -1,79 +1,4 @@
-#if defined MULTI
-#   define NAT_IN(k)                cd_nat(k)   
-#   define SGN_IN(k)                psgn(k)
-#   define F_SIZE(ptab)             kfld
-#   if defined DIM_2d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp),INTENT(inout)::ptab(f)
-#      endif 
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#      define K_SIZE(ptab)             1
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_3d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp),INTENT(inout)::ptab(f)
-#      endif 
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_4d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp),INTENT(inout)::ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp),INTENT(inout)::ptab(f)
-#      endif 
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#   endif
-#   if defined SINGLE_PRECISION
-#      define ARRAY2_TYPE(i,j,k,l,f)   TYPE(PTR_4D_sp),INTENT(inout)::ptab2(f)
-#   else
-#      define ARRAY2_TYPE(i,j,k,l,f)   TYPE(PTR_4D_dp),INTENT(inout)::ptab2(f)
-#   endif
-#   define J_SIZE(ptab2)            SIZE(ptab2(1)%pt4d,2)
-#   define ARRAY2_IN(i,j,k,l,f)     ptab2(f)%pt4d(i,j,k,l)
-#else
-!                          !==  IN: ptab is an array  ==!
-#   define NAT_IN(k)                cd_nat
-#   define SGN_IN(k)                psgn
-#   define F_SIZE(ptab)             1
-#   if defined DIM_2d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
-#      define K_SIZE(ptab)          1
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          SIZE(ptab,4)
-#   endif
-#   define J_SIZE(ptab2)             SIZE(ptab2,2)
-#   define ARRAY2_IN(i,j,k,l,f)   ptab2(i,j,k,l)
-#   if defined SINGLE_PRECISION
-#      define ARRAY_TYPE(i,j,k,l,f)     REAL(sp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#      define ARRAY2_TYPE(i,j,k,l,f)    REAL(sp),INTENT(inout)::ARRAY2_IN(i,j,k,l,f)
-#   else
-#      define ARRAY_TYPE(i,j,k,l,f)     REAL(dp),INTENT(inout)::ARRAY_IN(i,j,k,l,f)
-#      define ARRAY2_TYPE(i,j,k,l,f)    REAL(dp),INTENT(inout)::ARRAY2_IN(i,j,k,l,f)
-#   endif
-#   endif
-#   ifdef SINGLE_PRECISION
-#      define PRECISION sp
-#   else
-#      define PRECISION dp
-#   endif
-   SUBROUTINE ROUTINE_NFD( ptab, ptab2, cd_nat, psgn, kfld )
+
+   SUBROUTINE lbc_nfd_nogather_/**/PRECISION( ptab, ptab2, cd_nat, psgn, khls )
       !!----------------------------------------------------------------------
       !!
@@ -82,131 +7,119 @@
       !!
       !!----------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:,:)
-      ARRAY2_TYPE(:,:,:,:,:) 
-      CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
-      INTEGER, OPTIONAL, INTENT(in   ) ::   kfld        ! number of pt3d arrays
-      !
-      INTEGER  ::    ji,  jj,   jk, jn, ii,   jl,   jh,  jf   ! dummy loop indices
-      INTEGER  ::   ipi, ipj,  ipk,    ipl,  ipf, iij, ijj   ! dimension of the input array
+      REAL(PRECISION),  DIMENSION(:,:,:,:), INTENT(inout) ::   ptab        ! 
+      REAL(PRECISION),  DIMENSION(:,:,:,:), INTENT(inout) ::   ptab2       ! 
+      CHARACTER(len=1)                    , INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION)                     , INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER                             , INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      !
+      INTEGER  ::    ji,  jj, jk,  jn,  jl, jh       ! dummy loop indices
+      INTEGER  ::   ipk, ipl, ii, iij, ijj      ! dimension of the input array
       INTEGER  ::   ijt, iju, ijta, ijua, jia, startloop, endloop
       LOGICAL  ::   l_fast_exchanges
       !!----------------------------------------------------------------------
-      ipj = J_SIZE(ptab2)  ! 2nd dimension of input array
-      ipk = K_SIZE(ptab)   ! 3rd dimension of output array
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
-      !
-      ! Security check for further developments
-      IF ( ipf > 1 ) CALL ctl_stop( 'STOP', 'lbc_nfd_nogather: multiple fields not allowed. Revise implementation...' )
+      ipk = SIZE(ptab,3)
+      ipl = SIZE(ptab,4)
+      !
       ! 2nd dimension determines exchange speed
-      IF (ipj == 1 ) THEN
-        l_fast_exchanges = .TRUE.
-      ELSE
-        l_fast_exchanges = .FALSE.
-      ENDIF
-      !
-      DO jf = 1, ipf                      ! Loop over the number of arrays to be processed
+      l_fast_exchanges = SIZE(ptab2,2) == 1
+      !
+      IF( c_NFtype == 'T' ) THEN          ! *  North fold  T-point pivot
          !
-         SELECT CASE ( npolj )
-         !
-         CASE ( 3, 4 )                       ! *  North fold  T-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf) )
-            !
-            CASE ( 'T' , 'W' )                         ! T-, W-point
-               IF ( nimpp /= 1 ) THEN  ;  startloop = 1 
-               ELSE                    ;  startloop = 1 + nn_hls
-               ENDIF
-               !
-               DO jl = 1, ipl; DO jk = 1, ipk
-               	  DO jj = 1, nn_hls
-               	     ijj = jpj -jj +1
+         SELECT CASE ( cd_nat )
+            !
+         CASE ( 'T' , 'W' )                         ! T-, W-point
+            IF ( nimpp /= 1 ) THEN  ;  startloop = 1 
+            ELSE                    ;  startloop = 1 + khls
+            ENDIF
+            !
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ji = startloop, jpi
+                     ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
+                     ptab(ji,ijj,jk,jl) = psgn * ptab2(ijt,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+            IF( nimpp == 1 ) THEN
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO jj = 1, khls
+                     ijj = jpj -jj +1
+                     DO ii = 0, khls-1
+                        ptab(ii+1,ijj,jk,jl) = psgn * ptab(2*khls-ii+1,jpj-2*khls+jj-1,jk,jl)
+                     END DO
+                  END DO
+               END DO; END DO
+            ENDIF
+            !
+            IF ( .NOT. l_fast_exchanges ) THEN
+               IF( nimpp >= Ni0glo/2+2 ) THEN
+                  startloop = 1
+               ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
+                  startloop = Ni0glo/2+2 - nimpp + khls
+               ELSE
+                  startloop = jpi + 1
+               ENDIF
+               IF( startloop <= jpi ) THEN
+                  DO jl = 1, ipl; DO jk = 1, ipk
                      DO ji = startloop, jpi
-                    	ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
-                     	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
-                     END DO
-                  END DO
-               END DO; END DO
-               IF( nimpp == 1 ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO jj = 1, nn_hls
-               	  	ijj = jpj -jj +1
-               	  	DO ii = 0, nn_hls-1
-                  	   ARRAY_IN(ii+1,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,jpj-2*nn_hls+jj-1,jk,jl,jf)
-                  	END DO
+                        ijt  = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
+                        jia  = ji + nimpp - 1
+                        ijta = jpiglo - jia + 2
+                        IF( ijta >= startloop+nimpp-1 .AND. ijta < jia ) THEN
+                           ptab(ji,jpj-khls,jk,jl) = psgn * ptab(ijta-nimpp+khls,jpj-khls,jk,jl)
+                        ELSE
+                           ptab(ji,jpj-khls,jk,jl) = psgn * ptab2(ijt,khls+1,jk,jl)
+                        ENDIF
                      END DO
                   END DO; END DO
-               ENDIF              
-               !
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp >= Ni0glo/2+2 ) THEN
-                     startloop = 1
-                  ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
-                     startloop = Ni0glo/2+2 - nimpp + nn_hls
-                  ELSE
-                     startloop = jpi + 1
-                  ENDIF
-                  IF( startloop <= jpi ) THEN
-                     DO jl = 1, ipl; DO jk = 1, ipk
-                        DO ji = startloop, jpi
-                           ijt  = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
-                           jia  = ji + nimpp - 1
-                           ijta = jpiglo - jia + 2
-                           IF( ijta >= startloop+nimpp-1 .AND. ijta < jia ) THEN
-                              ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijta-nimpp+nn_hls,jpj-nn_hls,jk,jl,jf)
-                           ELSE
-                              ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
-                           ENDIF
-                        END DO
-                     END DO; END DO
-                  ENDIF
-               ENDIF
-            CASE ( 'U' )                                     ! U-point
+               ENDIF
+            ENDIF
+         CASE ( 'U' )                                     ! U-point
+            IF( nimpp + jpi - 1 /= jpiglo ) THEN
+               endloop = jpi
+            ELSE
+               endloop = jpi - khls
+            ENDIF
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                     ptab(ji,ijj,jk,jl) = psgn * ptab2(iju,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+            IF (nimpp .eq. 1) THEN
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ii = 0, khls-1
+                     ptab(ii+1,ijj,:,:) = psgn * ptab(2*khls-ii,jpj-2*khls+jj-1,:,:)
+                  END DO
+               END DO
+            ENDIF
+            IF((nimpp + jpi - 1) .eq. jpiglo) THEN
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ii = 1, khls
+                     ptab(jpi-ii+1,ijj,:,:) = psgn * ptab(jpi-2*khls+ii,jpj-2*khls+jj-1,:,:)
+                  END DO
+               END DO
+            ENDIF
+            !
+            IF ( .NOT. l_fast_exchanges ) THEN
                IF( nimpp + jpi - 1 /= jpiglo ) THEN
                   endloop = jpi
                ELSE
-                  endloop = jpi - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
-        	     ijj = jpj -jj +1
-                     DO ji = 1, endloop
-                        iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                        ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
-                     END DO
-                  END DO
-               END DO; END DO
-               IF (nimpp .eq. 1) THEN
-		  DO jj = 1, nn_hls
-		     ijj = jpj -jj +1
-		     DO ii = 0, nn_hls-1
-		 	ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls+jj-1,:,:,jf)
-		     END DO
-                  END DO
-               ENDIF
-               IF((nimpp + jpi - 1) .eq. jpiglo) THEN
-                  DO jj = 1, nn_hls
-               	     ijj = jpj -jj +1
-			DO ii = 1, nn_hls
-		   	   ARRAY_IN(jpi-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls+jj-1,:,:,jf)
-			END DO
-		  END DO
-               ENDIF
-               !
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp + jpi - 1 /= jpiglo ) THEN
-                     endloop = jpi
-                  ELSE
-                     endloop = jpi - nn_hls
-                  ENDIF
-                  IF( nimpp >= Ni0glo/2+1 ) THEN
-                     startloop = nn_hls
-                  ELSEIF( ( nimpp + jpi - 1 >= Ni0glo/2+1 ) .AND. ( nimpp < Ni0glo/2+1 ) ) THEN
-                     startloop = Ni0glo/2+1 - nimpp + nn_hls 
-                  ELSE
-                     startloop = endloop + 1
-                  ENDIF
-                  IF( startloop <= endloop ) THEN
+                  endloop = jpi - khls
+               ENDIF
+               IF( nimpp >= Ni0glo/2+1 ) THEN
+                  startloop = khls
+               ELSEIF( ( nimpp + jpi - 1 >= Ni0glo/2+1 ) .AND. ( nimpp < Ni0glo/2+1 ) ) THEN
+                  startloop = Ni0glo/2+1 - nimpp + khls 
+               ELSE
+                  startloop = endloop + 1
+               ENDIF
+               IF( startloop <= endloop ) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
                      DO ji = startloop, endloop
@@ -215,235 +128,222 @@
                         ijua = jpiglo - jia + 1 
                         IF( ijua >= startloop+nimpp-1 .AND. ijua < jia ) THEN
-                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(ijua-nimpp+1,jpj-nn_hls,jk,jl,jf)
+                           ptab(ji,jpj-khls,jk,jl) = psgn * ptab(ijua-nimpp+1,jpj-khls,jk,jl)
                         ELSE
-                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
+                           ptab(ji,jpj-khls,jk,jl) = psgn * ptab2(iju,khls+1,jk,jl)
                         ENDIF
                      END DO
                   END DO; END DO
-                  ENDIF
-               ENDIF
-               !
-            CASE ( 'V' )                                     ! V-point
-               IF( nimpp /= 1 ) THEN
-                 startloop = 1 
-               ELSE
-                 startloop = 1 + nn_hls
-               ENDIF
+               ENDIF
+            ENDIF
+            !
+         CASE ( 'V' )                                     ! V-point
+            IF( nimpp /= 1 ) THEN
+               startloop = 1 
+            ELSE
+               startloop = 1 + khls
+            ENDIF
+            IF ( .NOT. l_fast_exchanges ) THEN
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO jj = 2, khls+1
+                     ijj = jpj -jj +1
+                     DO ji = startloop, jpi
+                        ijt=jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
+                        ptab(ji,ijj,jk,jl) = psgn * ptab2(ijt,jj,jk,jl)
+                     END DO
+                  END DO
+               END DO; END DO
+            ENDIF
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO ji = startloop, jpi
+                  ijt=jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
+                  ptab(ji,jpj,jk,jl) = psgn * ptab2(ijt,1,jk,jl)
+               END DO
+            END DO; END DO
+            IF (nimpp .eq. 1) THEN
+               DO jj = 1, khls
+                  ijj = jpj-jj+1
+                  DO ii = 0, khls-1
+                     ptab(ii+1,ijj,:,:) = psgn * ptab(2*khls-ii+1,jpj-2*khls+jj-1,:,:)
+                  END DO
+               END DO
+            ENDIF
+         CASE ( 'F' )                                     ! F-point
+            IF( nimpp + jpi - 1 /= jpiglo ) THEN
+               endloop = jpi
+            ELSE
+               endloop = jpi - khls
+            ENDIF
+            IF ( .NOT. l_fast_exchanges ) THEN
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO jj = 2, khls+1
+                     ijj = jpj -jj +1
+                     DO ji = 1, endloop
+                        iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                        ptab(ji,ijj,jk,jl) = psgn * ptab2(iju,jj,jk,jl)
+                     END DO
+                  END DO
+               END DO; END DO
+            ENDIF
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO ji = 1, endloop
+                  iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                  ptab(ji,jpj,jk,jl) = psgn * ptab2(iju,1,jk,jl)
+               END DO
+            END DO; END DO
+            IF (nimpp .eq. 1) THEN               
+               DO ii = 1, khls
+                  ptab(ii,jpj,:,:) = psgn * ptab(2*khls-ii,jpj-2*khls-1,:,:)
+               END DO
                IF ( .NOT. l_fast_exchanges ) THEN
+                  DO jj = 1, khls
+                     ijj = jpj -jj
+                     DO ii = 0, khls-1
+                        ptab(ii+1,ijj,:,:) = psgn * ptab(2*khls-ii,jpj-2*khls+jj-1,:,:)
+                     END DO
+                  END DO
+               ENDIF
+            ENDIF
+            IF((nimpp + jpi - 1 ) .eq. jpiglo) THEN
+               DO ii = 1, khls
+                  ptab(jpi-ii+1,jpj,:,:) = psgn * ptab(jpi-2*khls+ii,jpj-2*khls-1,:,:)
+               END DO
+               IF ( .NOT. l_fast_exchanges ) THEN
+                  DO jj = 1, khls
+                     ijj = jpj -jj
+                     DO ii = 1, khls
+                        ptab(jpi-ii+1,ijj,:,:) = psgn * ptab(jpi-2*khls+ii,jpj-2*khls+jj-1,:,:)
+                     END DO
+                  END DO
+               ENDIF
+            ENDIF
+            !
+         END SELECT
+         !
+      ENDIF   ! c_NFtype == 'T'
+      !
+      IF( c_NFtype == 'F' ) THEN           ! *  North fold  F-point pivot
+         !
+         SELECT CASE ( cd_nat )
+         CASE ( 'T' , 'W' )                               ! T-, W-point
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj-jj+1
+                  DO ji = 1, jpi
+                     ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                     ptab(ji,ijj,jk,jl) = psgn * ptab2(ijt,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+            !
+         CASE ( 'U' )                                     ! U-point
+            IF( nimpp + jpi - 1 /= jpiglo ) THEN
+               endloop = jpi
+            ELSE
+               endloop = jpi - khls
+            ENDIF
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj-jj+1
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
+                     ptab(ji,ijj,jk,jl) = psgn * ptab2(iju,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+            IF(nimpp + jpi - 1 .eq. jpiglo) THEN
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO jj = 1, khls
+                     ijj = jpj-jj+1
+                     DO ii = 1, khls
+                        iij = jpi-ii+1
+                        ptab(iij,ijj,jk,jl) = psgn * ptab(jpi-2*khls+ii-1,jpj-2*khls+jj,jk,jl)
+                     END DO
+                  END DO
+               END DO; END DO
+            ENDIF
+            !
+         CASE ( 'V' )                                     ! V-point
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ji = 1, jpi
+                     ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                     ptab(ji,ijj,jk,jl) = psgn * ptab2(ijt,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+
+            IF ( .NOT. l_fast_exchanges ) THEN
+               IF( nimpp >= Ni0glo/2+2 ) THEN
+                  startloop = 1
+               ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
+                  startloop = Ni0glo/2+2 - nimpp + khls
+               ELSE
+                  startloop = jpi + 1
+               ENDIF
+               IF( startloop <= jpi ) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
-               	     DO jj = 2, nn_hls+1
-               	  	ijj = jpj -jj +1
-                     	DO ji = startloop, jpi
-                           ijt=jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
-                           ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
-                     	END DO
-                    END DO
+                     DO ji = startloop, jpi
+                        ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
+                        ptab(ji,jpj-khls,jk,jl) = psgn * ptab2(ijt,khls+1,jk,jl)
+                     END DO
                   END DO; END DO
                ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = startloop, jpi
-                     ijt=jpiglo - ji - nimpp - nfimpp(isendto(1)) + 4
-                     ARRAY_IN(ji,jpj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,1,jk,jl,jf)
-                  END DO
-               END DO; END DO
-               IF (nimpp .eq. 1) THEN
-		  DO jj = 1, nn_hls
-               	     ijj = jpj-jj+1
-               	     DO ii = 0, nn_hls-1
-                        ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii+1,jpj-2*nn_hls+jj-1,:,:,jf)
-		     END DO
-		  END DO
-               ENDIF
-            CASE ( 'F' )                                     ! F-point
+            ENDIF
+            !
+         CASE ( 'F' )                               ! F-point
+            IF( nimpp + jpi - 1 /= jpiglo ) THEN
+               endloop = jpi
+            ELSE
+               endloop = jpi - khls
+            ENDIF
+            DO jl = 1, ipl; DO jk = 1, ipk
+               DO jj = 1, khls
+                  ijj = jpj -jj +1
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
+                     ptab(ji,ijj ,jk,jl) = psgn * ptab2(iju,jj,jk,jl)
+                  END DO
+               END DO
+            END DO; END DO
+            IF((nimpp + jpi - 1) .eq. jpiglo) THEN
+               DO jl = 1, ipl; DO jk = 1, ipk
+                  DO jj = 1, khls
+                     ijj = jpj -jj +1
+                     DO ii = 1, khls
+                        iij = jpi -ii+1
+                        ptab(iij,ijj,jk,jl) = psgn * ptab(jpi-2*khls+ii-1,jpj-2*khls+jj-1,jk,jl)
+                     END DO
+                  END DO
+               END DO; END DO
+            ENDIF
+            !
+            IF ( .NOT. l_fast_exchanges ) THEN
                IF( nimpp + jpi - 1 /= jpiglo ) THEN
                   endloop = jpi
                ELSE
-                  endloop = jpi - nn_hls
-               ENDIF
-               IF ( .NOT. l_fast_exchanges ) THEN
+                  endloop = jpi - khls
+               ENDIF
+               IF( nimpp >= Ni0glo/2+2 ) THEN
+                  startloop = 1 
+               ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
+                  startloop = Ni0glo/2+2 - nimpp + khls
+               ELSE
+                  startloop = endloop + 1
+               ENDIF
+               IF( startloop <= endloop ) THEN
                   DO jl = 1, ipl; DO jk = 1, ipk
-               	     DO jj = 2, nn_hls+1
-               	  	ijj = jpj -jj +1
-                     	DO ji = 1, endloop
-                           iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                           ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
-                     	END DO
-                    END DO
+                     DO ji = startloop, endloop
+                        iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
+                        ptab(ji,jpj-khls,jk,jl) = psgn * ptab2(iju,khls+1,jk,jl)
+                     END DO
                   END DO; END DO
                ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-                  DO ji = 1, endloop
-                     iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                     ARRAY_IN(ji,jpj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,1,jk,jl,jf)
-                  END DO
-               END DO; END DO
-		IF (nimpp .eq. 1) THEN               
-		   DO ii = 1, nn_hls
-	              ARRAY_IN(ii,jpj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls-1,:,:,jf)
-		   END DO
-		   IF ( .NOT. l_fast_exchanges ) THEN
-		      DO jj = 1, nn_hls
-               	 	 ijj = jpj -jj
-               		 DO ii = 0, nn_hls-1
-                    	    ARRAY_IN(ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(2*nn_hls-ii,jpj-2*nn_hls+jj-1,:,:,jf)
-                 	 END DO
-                      END DO
-               	   ENDIF
-		ENDIF
-		IF((nimpp + jpi - 1 ) .eq. jpiglo) THEN
-                   DO ii = 1, nn_hls
-	              ARRAY_IN(jpi-ii+1,jpj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls-1,:,:,jf)
-		   END DO
-		   IF ( .NOT. l_fast_exchanges ) THEN
-		      DO jj = 1, nn_hls
-               	         ijj = jpj -jj
-	               	 DO ii = 1, nn_hls
-                    	    ARRAY_IN(jpi-ii+1,ijj,:,:,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii,jpj-2*nn_hls+jj-1,:,:,jf)
-                     	 END DO
-                      END DO
-               	   ENDIF
-               	ENDIF
-               	!
-	    END SELECT
-            !
-         CASE ( 5, 6 )                        ! *  North fold  F-point pivot
-            !
-            SELECT CASE ( NAT_IN(jf) )
-            CASE ( 'T' , 'W' )                               ! T-, W-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
- 		     ijj = jpj-jj+1
-		     DO ji = 1, jpi
-                     	ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                     	ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
-                     END DO
-		  END DO
-               END DO; END DO
-               !
-            CASE ( 'U' )                                     ! U-point
-               IF( nimpp + jpi - 1 /= jpiglo ) THEN
-                  endloop = jpi
-               ELSE
-                  endloop = jpi - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
- 		     ijj = jpj-jj+1
-                     DO ji = 1, endloop
-                        iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
-                        ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
-                     END DO
-                  END DO
-               END DO; END DO
-               IF(nimpp + jpi - 1 .eq. jpiglo) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO jj = 1, nn_hls
-               	        ijj = jpj-jj+1
-                        DO ii = 1, nn_hls
-			   iij = jpi-ii+1
-                           ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii-1,jpj-2*nn_hls+jj,jk,jl,jf)
-                        END DO
-                     END DO
-                  END DO; END DO
-               ENDIF
-               !
-            CASE ( 'V' )                                     ! V-point
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
-		     ijj = jpj -jj +1
-                     DO ji = 1, jpi
-                        ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                        ARRAY_IN(ji,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,jj,jk,jl,jf)
-                     END DO
-                  END DO
-               END DO; END DO
+            ENDIF
+            !
+         END SELECT
+         !
+      ENDIF   ! c_NFtype == 'F'
+      !
+   END SUBROUTINE lbc_nfd_nogather_/**/PRECISION
 
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp >= Ni0glo/2+2 ) THEN
-                     startloop = 1
-                  ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
-                     startloop = Ni0glo/2+2 - nimpp + nn_hls
-                  ELSE
-                     startloop = jpi + 1
-                  ENDIF
-                  IF( startloop <= jpi ) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                        DO ji = startloop, jpi
-                   	   ijt = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 3
-                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(ijt,nn_hls+1,jk,jl,jf)
-                        END DO
-                  END DO; END DO
-                  ENDIF
-               ENDIF
-               !
-            CASE ( 'F' )                               ! F-point
-               IF( nimpp + jpi - 1 /= jpiglo ) THEN
-                  endloop = jpi
-               ELSE
-                  endloop = jpi - nn_hls
-               ENDIF
-               DO jl = 1, ipl; DO jk = 1, ipk
-		  DO jj = 1, nn_hls
-		    ijj = jpj -jj +1
-                    DO ji = 1, endloop
-                       iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
-                       ARRAY_IN(ji,ijj ,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,jj,jk,jl,jf)
-                     END DO
-                  END DO
-               END DO; END DO
-               IF((nimpp + jpi - 1) .eq. jpiglo) THEN
-                  DO jl = 1, ipl; DO jk = 1, ipk
-                     DO jj = 1, nn_hls
-                        ijj = jpj -jj +1
-                        DO ii = 1, nn_hls
-			   iij = jpi -ii+1
-                     	   ARRAY_IN(iij,ijj,jk,jl,jf) = SGN_IN(jf) * ARRAY_IN(jpi-2*nn_hls+ii-1,jpj-2*nn_hls+jj-1,jk,jl,jf)
-                        END DO
-                     END DO
-                  END DO; END DO
-               ENDIF
-               !
-               IF ( .NOT. l_fast_exchanges ) THEN
-                  IF( nimpp + jpi - 1 /= jpiglo ) THEN
-                     endloop = jpi
-                  ELSE
-                     endloop = jpi - nn_hls
-                  ENDIF
-                  IF( nimpp >= Ni0glo/2+2 ) THEN
-                     startloop = 1 
-                  ELSEIF( nimpp+jpi-1 >= Ni0glo/2+2 .AND. nimpp < Ni0glo/2+2 ) THEN
-                     startloop = Ni0glo/2+2 - nimpp + nn_hls
-                  ELSE
-                     startloop = endloop + 1
-                  ENDIF
-                  IF( startloop <= endloop ) THEN
-                     DO jl = 1, ipl; DO jk = 1, ipk
-                        DO ji = startloop, endloop
-                           iju = jpiglo - ji - nimpp - nfimpp(isendto(1)) + 2
-                           ARRAY_IN(ji,jpj-nn_hls,jk,jl,jf) = SGN_IN(jf) * ARRAY2_IN(iju,nn_hls+1,jk,jl,jf)
-                        END DO
-                     END DO; END DO
-                  ENDIF
-               ENDIF
-               !
-            END SELECT
-            !
-         CASE DEFAULT                           ! *  closed : the code probably never go through
-            !
-            WRITE(*,*) 'lbc_nfd_nogather_generic: You should not have seen this print! error?', npolj
-            !
-         END SELECT     !  npolj
-         !
-      END DO            ! End jf loop
-   END SUBROUTINE ROUTINE_NFD
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef ARRAY_IN
-#undef NAT_IN
-#undef SGN_IN
-#undef J_SIZE
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
-#undef ARRAY2_TYPE
-#undef ARRAY2_IN
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbclnk.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbclnk.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbclnk.F90	(revision 14676)
@@ -23,4 +23,7 @@
    USE lbcnfd         ! north fold
    USE in_out_manager ! I/O manager
+#if ! defined key_mpi_off
+   USE MPI
+#endif
 
    IMPLICIT NONE
@@ -28,22 +31,14 @@
 
    INTERFACE lbc_lnk
-      MODULE PROCEDURE   mpp_lnk_2d_sp   , mpp_lnk_3d_sp   , mpp_lnk_4d_sp
-      MODULE PROCEDURE   mpp_lnk_2d_dp   , mpp_lnk_3d_dp   , mpp_lnk_4d_dp
-   END INTERFACE
-   INTERFACE lbc_lnk_ptr
-      MODULE PROCEDURE   mpp_lnk_2d_ptr_sp , mpp_lnk_3d_ptr_sp , mpp_lnk_4d_ptr_sp
-      MODULE PROCEDURE   mpp_lnk_2d_ptr_dp , mpp_lnk_3d_ptr_dp , mpp_lnk_4d_ptr_dp
-   END INTERFACE
-   INTERFACE lbc_lnk_multi
-      MODULE PROCEDURE   lbc_lnk_2d_multi_sp , lbc_lnk_3d_multi_sp, lbc_lnk_4d_multi_sp
-      MODULE PROCEDURE   lbc_lnk_2d_multi_dp , lbc_lnk_3d_multi_dp, lbc_lnk_4d_multi_dp
-   END INTERFACE
-   INTERFACE lbc_lnk_nc_multi
-      MODULE PROCEDURE   lbc_lnk_nc_2d_sp, lbc_lnk_nc_3d_sp, lbc_lnk_nc_4d_sp
-      MODULE PROCEDURE   lbc_lnk_nc_2d_dp, lbc_lnk_nc_3d_dp, lbc_lnk_nc_4d_dp
-   END INTERFACE
-   INTERFACE lbc_lnk_nc
-      MODULE PROCEDURE   mpp_lnk_nc_2d_sp, mpp_lnk_nc_3d_sp, mpp_lnk_nc_4d_sp
-      MODULE PROCEDURE   mpp_lnk_nc_2d_dp, mpp_lnk_nc_3d_dp, mpp_lnk_nc_4d_dp
+      MODULE PROCEDURE   lbc_lnk_call_2d_sp, lbc_lnk_call_3d_sp, lbc_lnk_call_4d_sp
+      MODULE PROCEDURE   lbc_lnk_call_2d_dp, lbc_lnk_call_3d_dp, lbc_lnk_call_4d_dp
+   END INTERFACE
+
+   INTERFACE lbc_lnk_pt2pt
+      MODULE PROCEDURE   lbc_lnk_pt2pt_sp, lbc_lnk_pt2pt_dp
+   END INTERFACE
+
+   INTERFACE lbc_lnk_neicoll
+      MODULE PROCEDURE   lbc_lnk_neicoll_sp ,lbc_lnk_neicoll_dp
    END INTERFACE
    !
@@ -52,32 +47,13 @@
    END INTERFACE
 
-   INTERFACE mpp_nfd
-      MODULE PROCEDURE   mpp_nfd_2d_sp    , mpp_nfd_3d_sp    , mpp_nfd_4d_sp
-      MODULE PROCEDURE   mpp_nfd_2d_dp    , mpp_nfd_3d_dp    , mpp_nfd_4d_dp
-      MODULE PROCEDURE   mpp_nfd_2d_ptr_sp, mpp_nfd_3d_ptr_sp, mpp_nfd_4d_ptr_sp
-      MODULE PROCEDURE   mpp_nfd_2d_ptr_dp, mpp_nfd_3d_ptr_dp, mpp_nfd_4d_ptr_dp
-
-   END INTERFACE
-
    PUBLIC   lbc_lnk            ! ocean/ice lateral boundary conditions
-   PUBLIC   lbc_lnk_multi      ! modified ocean/ice lateral boundary conditions
    PUBLIC   lbc_lnk_icb        ! iceberg lateral boundary conditions
-   PUBLIC   lbc_lnk_nc         ! ocean/ice lateral boundary conditions (MPI3 version)
-   PUBLIC   lbc_lnk_nc_multi   ! modified ocean/ice lateral boundary conditions (MPI3 version)
-
-#if ! defined key_mpi_off
-!$AGRIF_DO_NOT_TREAT
-   INCLUDE 'mpif.h'
-!$AGRIF_END_DO_NOT_TREAT
-#endif
-
-   INTEGER, PUBLIC, PARAMETER ::   jpfillnothing = 1
-   INTEGER, PUBLIC, PARAMETER ::   jpfillcst     = 2
-   INTEGER, PUBLIC, PARAMETER ::   jpfillcopy    = 3
-   INTEGER, PUBLIC, PARAMETER ::   jpfillperio   = 4
-   INTEGER, PUBLIC, PARAMETER ::   jpfillmpi     = 5
-
+
+   REAL(dp), DIMENSION(:), ALLOCATABLE ::   buffsnd_dp, buffrcv_dp   ! MPI send/recv buffers
+   REAL(sp), DIMENSION(:), ALLOCATABLE ::   buffsnd_sp, buffrcv_sp   ! 
+   INTEGER,  DIMENSION(8)              ::   nreq_p2p                 ! request id for MPI_Isend in point-2-point communication
+   
    !! * Substitutions
-#  include "do_loop_substitute.h90"
+   !!#  include "do_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -88,8 +64,9 @@
 
    !!----------------------------------------------------------------------
-   !!                   ***   load_ptr_(2,3,4)d   ***
+   !!                   ***   lbc_lnk_call_[234]d_[sd]p   ***
    !!
    !!   * Dummy Argument :
-   !!       in    ==>   ptab       ! array to be loaded (2D, 3D or 4D)
+   !!       in    ==>   cdname     ! name of the calling subroutine (for monitoring)
+   !!                   ptab       ! array to be loaded (2D, 3D or 4D)
    !!                   cd_nat     ! nature of pt2d array grid-points
    !!                   psgn       ! sign used across the north fold boundary
@@ -99,406 +76,79 @@
    !!                   kfld       ! number of elements that has been attributed
    !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!                  ***   lbc_lnk_(2,3,4)d_multi   ***
-   !!                     ***   load_ptr_(2,3,4)d   ***
-   !!
-   !!   * Argument : dummy argument use in lbc_lnk_multi_... routines
-   !!
-   !!----------------------------------------------------------------------
-
+   !
+   !!----------------------------------------------------------------------
+   !!
+   !!                  ***   lbc_lnk_call_[234]d_[sd]p   ***
+   !!                  ***     load_ptr_[234]d_[sd]p     ***
+   !!
+   !!----------------------------------------------------------------------
    !!
    !!   ----   SINGLE PRECISION VERSIONS
    !!
-#  define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_LOAD           load_ptr_2d_sp
-#     define ROUTINE_MULTI          lbc_lnk_2d_multi_sp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_2d
-
-#  define DIM_3d
-#     define ROUTINE_LOAD           load_ptr_3d_sp
-#     define ROUTINE_MULTI          lbc_lnk_3d_multi_sp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_3d
-
-#  define DIM_4d
-#     define ROUTINE_LOAD           load_ptr_4d_sp
-#     define ROUTINE_MULTI          lbc_lnk_4d_multi_sp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_4d
-#  undef SINGLE_PRECISION
+#define PRECISION sp
+# define DIM_2d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_2d
+# define DIM_3d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_3d
+# define DIM_4d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_4d
+#undef PRECISION
    !!
    !!   ----   DOUBLE PRECISION VERSIONS
    !!
-
-#  define DIM_2d
-#     define ROUTINE_LOAD           load_ptr_2d_dp
-#     define ROUTINE_MULTI          lbc_lnk_2d_multi_dp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_2d
-
-#  define DIM_3d
-#     define ROUTINE_LOAD           load_ptr_3d_dp
-#     define ROUTINE_MULTI          lbc_lnk_3d_multi_dp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_3d
-
-#  define DIM_4d
-#     define ROUTINE_LOAD           load_ptr_4d_dp
-#     define ROUTINE_MULTI          lbc_lnk_4d_multi_dp
-#     include "lbc_lnk_multi_generic.h90"
-#     undef ROUTINE_MULTI
-#     undef ROUTINE_LOAD
-#  undef DIM_4d
-
-   !!----------------------------------------------------------------------
-   !!                   ***  routine mpp_lnk_(2,3,4)d  ***
-   !!
-   !!   * Argument : dummy argument use in mpp_lnk_... routines
-   !!                ptab      :   array or pointer of arrays on which the boundary condition is applied
+#define PRECISION dp
+# define DIM_2d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_2d
+# define DIM_3d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_3d
+# define DIM_4d
+#    include "lbc_lnk_call_generic.h90"
+# undef  DIM_4d
+#undef PRECISION
+   !
+   !!----------------------------------------------------------------------
+   !!                   ***  lbc_lnk_pt2pt_[sd]p  ***
+   !!                  ***  lbc_lnk_neicoll_[sd]p  ***
+   !!
+   !!   * Argument : dummy argument use in lbc_lnk_... routines
+   !!                cdname    :   name of the calling subroutine (for monitoring)
+   !!                ptab      :   pointer of arrays on which the boundary condition is applied
    !!                cd_nat    :   nature of array grid-points
    !!                psgn      :   sign used across the north fold boundary
-   !!                kfld      :   optional, number of pt3d arrays
+   !!                kfld      :   number of pt3d arrays
    !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
    !!                pfillval  :   optional, background value (used with jpfillcopy)
    !!----------------------------------------------------------------------
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
    !!
    !!   ----   SINGLE PRECISION VERSIONS
    !!
-# define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_LNK           mpp_lnk_2d_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_2d_ptr_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_LNK           mpp_lnk_3d_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_3d_ptr_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_LNK           mpp_lnk_4d_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_4d_ptr_sp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_4d
-# undef SINGLE_PRECISION
-
+#define PRECISION sp
+#  define MPI_TYPE MPI_REAL
+#  define BUFFSND buffsnd_sp
+#  define BUFFRCV buffrcv_sp
+#  include "lbc_lnk_pt2pt_generic.h90"
+#  include "lbc_lnk_neicoll_generic.h90"
+#  undef MPI_TYPE
+#  undef BUFFSND
+#  undef BUFFRCV
+#undef PRECISION
    !!
    !!   ----   DOUBLE PRECISION VERSIONS
    !!
-#  define DIM_2d
-#     define ROUTINE_LNK           mpp_lnk_2d_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_2d_ptr_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_LNK           mpp_lnk_3d_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_3d_ptr_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_LNK           mpp_lnk_4d_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     define MULTI
-#     define ROUTINE_LNK           mpp_lnk_4d_ptr_dp
-#     include "mpp_lnk_generic.h90"
-#     undef ROUTINE_LNK
-#     undef MULTI
-#  undef DIM_4d
-
-   !!----------------------------------------------------------------------
-   !!                   ***   load_ptr_(2,3,4)d   ***
-   !!
-   !!   * Dummy Argument :
-   !!       in    ==>   ptab       ! array to be loaded (2D, 3D or 4D)
-   !!                   cd_nat     ! nature of pt2d array grid-points
-   !!                   psgn       ! sign used across the north fold boundary
-   !!       inout <=>   ptab_ptr   ! array of 2D, 3D or 4D pointers
-   !!                   cdna_ptr   ! nature of ptab array grid-points
-   !!                   psgn_ptr   ! sign used across the north fold boundary
-   !!                   kfld       ! number of elements that has been attributed
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!                  ***   lbc_lnk_nc(2,3,4)d_multi   ***
-   !!                     ***   load_ptr_(2,3,4)d   ***
-   !!
-   !!   * Argument : dummy argument use in lbc_lnk_nc_multi_... routines
-   !!
-   !!----------------------------------------------------------------------
-
-   !!
-   !!   ----   SINGLE PRECISION VERSIONS
-   !!
-#  define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_2d_sp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_2d_sp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_2d
-
-#  define DIM_3d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_3d_sp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_3d_sp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_3d
-
-#  define DIM_4d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_4d_sp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_4d_sp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_4d
-#  undef SINGLE_PRECISION
-   !!
-   !!   ----   DOUBLE PRECISION VERSIONS
-   !!
-
-#  define DIM_2d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_2d_dp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_2d_dp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_2d
-
-#  define DIM_3d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_3d_dp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_3d_dp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_3d
-
-#  define DIM_4d
-#     define ROUTINE_NC_LOAD           load_ptr_nc_4d_dp
-#     define ROUTINE_MULTI_NC          lbc_lnk_nc_4d_dp
-#     include "lbc_lnk_nc_generic.h90"
-#     undef ROUTINE_MULTI_NC
-#     undef ROUTINE_NC_LOAD
-#  undef DIM_4d
-
-   !!----------------------------------------------------------------------
-   !!                   ***  routine mpp_lnk_nc_(2,3,4)d  ***
-   !!
-   !!   * Argument : dummy argument use in mpp_lnk_... routines
-   !!                ptab      :   array or pointer of arrays on which the boundary condition is applied
-   !!                cd_nat    :   nature of array grid-points
-   !!                psgn      :   sign used across the north fold boundary
-   !!                kfld      :   optional, number of pt3d arrays
-   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
-   !!                pfillval  :   optional, background value (used with jpfillcopy)
-   !!----------------------------------------------------------------------
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-   !!
-   !!   ----   SINGLE PRECISION VERSIONS
-   !!
-# define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_NC           mpp_lnk_nc_2d_sp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NC           mpp_lnk_nc_3d_sp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NC           mpp_lnk_nc_4d_sp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_4d
-# undef SINGLE_PRECISION
-
-   !!
-   !!   ----   DOUBLE PRECISION VERSIONS
-   !!
-#  define DIM_2d
-#     define ROUTINE_NC           mpp_lnk_nc_2d_dp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NC           mpp_lnk_nc_3d_dp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NC           mpp_lnk_nc_4d_dp
-#     include "mpp_nc_generic.h90"
-#     undef ROUTINE_NC
-#  undef DIM_4d
-
-   !!----------------------------------------------------------------------
-   !!                   ***  routine mpp_nfd_(2,3,4)d  ***
-   !!
-   !!   * Argument : dummy argument use in mpp_nfd_... routines
-   !!                ptab      :   array or pointer of arrays on which the boundary condition is applied
-   !!                cd_nat    :   nature of array grid-points
-   !!                psgn      :   sign used across the north fold boundary
-   !!                kfld      :   optional, number of pt3d arrays
-   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
-   !!                pfillval  :   optional, background value (used with jpfillcopy)
-   !!----------------------------------------------------------------------
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-   !!
-   !!   ----   SINGLE PRECISION VERSIONS
-   !!
-#  define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_NFD           mpp_nfd_2d_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_2d_ptr_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           mpp_nfd_3d_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_3d_ptr_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           mpp_nfd_4d_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_4d_ptr_sp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_4d
-#  undef SINGLE_PRECISION
-
-   !!
-   !!   ----   DOUBLE PRECISION VERSIONS
-   !!
-#  define DIM_2d
-#     define ROUTINE_NFD           mpp_nfd_2d_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_2d_ptr_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           mpp_nfd_3d_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_3d_ptr_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           mpp_nfd_4d_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           mpp_nfd_4d_ptr_dp
-#     include "mpp_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_4d
-
-   !!======================================================================
-
+#define PRECISION dp
+#  define MPI_TYPE MPI_DOUBLE_PRECISION
+#  define BUFFSND buffsnd_dp
+#  define BUFFRCV buffrcv_dp
+#  include "lbc_lnk_pt2pt_generic.h90"
+#  include "lbc_lnk_neicoll_generic.h90"
+#  undef MPI_TYPE
+#  undef BUFFSND
+#  undef BUFFRCV
+#undef PRECISION
 
    !!======================================================================
@@ -541,12 +191,5 @@
       !!                    jpi    : first dimension of the local subdomain
       !!                    jpj    : second dimension of the local subdomain
-      !!                    kexti  : number of columns for extra outer halo
-      !!                    kextj  : number of rows for extra outer halo
-      !!                    nbondi : mark for "east-west local boundary"
-      !!                    nbondj : mark for "north-south local boundary"
-      !!                    noea   : number for local neighboring processors
-      !!                    nowe   : number for local neighboring processors
-      !!                    noso   : number for local neighboring processors
-      !!                    nono   : number for local neighboring processors
+      !!                    mpinei : number of neighboring domains (starting at 0, -1 if no neighbourg)
       !!----------------------------------------------------------------------
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbcnfd.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbcnfd.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lbcnfd.F90	(revision 14676)
@@ -21,49 +21,25 @@
    USE in_out_manager ! I/O manager
    USE lib_mpp        ! MPP library
+#if ! defined key_mpi_off
+   USE MPI
+#endif
 
    IMPLICIT NONE
    PRIVATE
 
-   INTERFACE lbc_nfd
-      MODULE PROCEDURE   lbc_nfd_2d_sp    , lbc_nfd_3d_sp    , lbc_nfd_4d_sp
-      MODULE PROCEDURE   lbc_nfd_2d_ptr_sp, lbc_nfd_3d_ptr_sp, lbc_nfd_4d_ptr_sp
-      MODULE PROCEDURE   lbc_nfd_2d_ext_sp
-      MODULE PROCEDURE   lbc_nfd_2d_dp    , lbc_nfd_3d_dp    , lbc_nfd_4d_dp
-      MODULE PROCEDURE   lbc_nfd_2d_ptr_dp, lbc_nfd_3d_ptr_dp, lbc_nfd_4d_ptr_dp
-      MODULE PROCEDURE   lbc_nfd_2d_ext_dp
-   END INTERFACE
-   !
-   INTERFACE lbc_nfd_nogather
-!                        ! Currently only 4d array version is needed
-     MODULE PROCEDURE   lbc_nfd_nogather_2d_sp    , lbc_nfd_nogather_3d_sp
-     MODULE PROCEDURE   lbc_nfd_nogather_4d_sp
-     MODULE PROCEDURE   lbc_nfd_nogather_2d_ptr_sp, lbc_nfd_nogather_3d_ptr_sp
-     MODULE PROCEDURE   lbc_nfd_nogather_2d_dp    , lbc_nfd_nogather_3d_dp
-     MODULE PROCEDURE   lbc_nfd_nogather_4d_dp
-     MODULE PROCEDURE   lbc_nfd_nogather_2d_ptr_dp, lbc_nfd_nogather_3d_ptr_dp
-!     MODULE PROCEDURE   lbc_nfd_nogather_4d_ptr
+   INTERFACE lbc_nfd            ! called by mpp_nfd, lbc_lnk_pt2pt or lbc_lnk_neicoll
+      MODULE PROCEDURE   lbc_nfd_sp, lbc_nfd_ext_sp
+      MODULE PROCEDURE   lbc_nfd_dp, lbc_nfd_ext_dp
    END INTERFACE
 
-   TYPE, PUBLIC ::   PTR_2D_dp   !: array of 2D pointers (also used in lib_mpp)
-      REAL(dp), DIMENSION (:,:)    , POINTER ::   pt2d
-   END TYPE PTR_2D_dp
-   TYPE, PUBLIC ::   PTR_3D_dp   !: array of 3D pointers (also used in lib_mpp)
-      REAL(dp), DIMENSION (:,:,:)  , POINTER ::   pt3d
-   END TYPE PTR_3D_dp
-   TYPE, PUBLIC ::   PTR_4D_dp   !: array of 4D pointers (also used in lib_mpp)
-      REAL(dp), DIMENSION (:,:,:,:), POINTER ::   pt4d
-   END TYPE PTR_4D_dp
+   INTERFACE mpp_nfd            ! called by lbc_lnk_pt2pt or lbc_lnk_neicoll
+      MODULE PROCEDURE   mpp_nfd_sp, mpp_nfd_dp
+   END INTERFACE
 
-   TYPE, PUBLIC ::   PTR_2D_sp   !: array of 2D pointers (also used in lib_mpp)
-      REAL(sp), DIMENSION (:,:)    , POINTER ::   pt2d
-   END TYPE PTR_2D_sp
-   TYPE, PUBLIC ::   PTR_3D_sp   !: array of 3D pointers (also used in lib_mpp)
-      REAL(sp), DIMENSION (:,:,:)  , POINTER ::   pt3d
-   END TYPE PTR_3D_sp
-   TYPE, PUBLIC ::   PTR_4D_sp   !: array of 4D pointers (also used in lib_mpp)
-      REAL(sp), DIMENSION (:,:,:,:), POINTER ::   pt4d
-   END TYPE PTR_4D_sp
-
-
+   INTERFACE lbc_nfd_nogather   ! called by mpp_nfd
+      MODULE PROCEDURE   lbc_nfd_nogather_sp, lbc_nfd_nogather_dp
+   END INTERFACE
+   
+   PUBLIC   mpp_nfd            ! mpi north fold conditions
    PUBLIC   lbc_nfd            ! north fold conditions
    PUBLIC   lbc_nfd_nogather   ! north fold conditions (no allgather case)
@@ -82,5 +58,7 @@
 
    !!----------------------------------------------------------------------
-   !!                   ***  routine lbc_nfd_(2,3,4)d  ***
+   !!                   ***  routine lbc_nfd_[sd]p  ***
+   !!               ***  routine lbc_nfd_nogather_[sd]p  ***
+   !!                   ***  routine lbc_nfd_ext_[sd]p  ***
    !!----------------------------------------------------------------------
    !!
@@ -95,191 +73,47 @@
    !                       !==  SINGLE PRECISION VERSIONS
    !
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-#  define SINGLE_PRECISION
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_2d_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_2d_ptr_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  2D array with extra haloes  ==!
-   !
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_2d_ext_sp
-#     include "lbc_nfd_ext_generic.h90"
-#     undef ROUTINE_NFD
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           lbc_nfd_3d_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_3d_ptr_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           lbc_nfd_4d_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_4d_ptr_sp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_4d
-   !
-   !  lbc_nfd_nogather routines
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_nogather_2d_sp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_nogather_2d_ptr_sp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           lbc_nfd_nogather_3d_sp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_nogather_3d_ptr_sp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           lbc_nfd_nogather_4d_sp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-!#     define MULTI
-!#     define ROUTINE_NFD           lbc_nfd_nogather_4d_ptr
-!#     include "lbc_nfd_nogather_generic.h90"
-!#     undef ROUTINE_NFD
-!#     undef MULTI
-#  undef DIM_4d
-#  undef SINGLE_PRECISION
-
-   !!----------------------------------------------------------------------
+#define PRECISION sp
+#  include "lbc_nfd_generic.h90"
+#  include "lbc_nfd_nogather_generic.h90"
+#  include "lbc_nfd_ext_generic.h90"
+#undef PRECISION
    !
    !                       !==  DOUBLE PRECISION VERSIONS
    !
+#define PRECISION dp
+#  include "lbc_nfd_generic.h90"
+#  include "lbc_nfd_nogather_generic.h90"
+#  include "lbc_nfd_ext_generic.h90"
+#undef PRECISION
+
+   !!======================================================================
    !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_2d_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_2d_ptr_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  2D array with extra haloes  ==!
-   !
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_2d_ext_dp
-#     include "lbc_nfd_ext_generic.h90"
-#     undef ROUTINE_NFD
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           lbc_nfd_3d_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_3d_ptr_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           lbc_nfd_4d_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_4d_ptr_dp
-#     include "lbc_nfd_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_4d
-   !
-   !  lbc_nfd_nogather routines
-   !
-   !                       !==  2D array and array of 2D pointer  ==!
-   !
-#  define DIM_2d
-#     define ROUTINE_NFD           lbc_nfd_nogather_2d_dp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_nogather_2d_ptr_dp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_2d
-   !
-   !                       !==  3D array and array of 3D pointer  ==!
-   !
-#  define DIM_3d
-#     define ROUTINE_NFD           lbc_nfd_nogather_3d_dp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     define MULTI
-#     define ROUTINE_NFD           lbc_nfd_nogather_3d_ptr_dp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-#     undef MULTI
-#  undef DIM_3d
-   !
-   !                       !==  4D array and array of 4D pointer  ==!
-   !
-#  define DIM_4d
-#     define ROUTINE_NFD           lbc_nfd_nogather_4d_dp
-#     include "lbc_nfd_nogather_generic.h90"
-#     undef ROUTINE_NFD
-!#     define MULTI
-!#     define ROUTINE_NFD           lbc_nfd_nogather_4d_ptr
-!#     include "lbc_nfd_nogather_generic.h90"
-!#     undef ROUTINE_NFD
-!#     undef MULTI
-#  undef DIM_4d
-
    !!----------------------------------------------------------------------
-
-
+   !!                   ***  routine mpp_nfd_[sd]p  ***
+   !!
+   !!   * Argument : dummy argument use in mpp_nfd_... routines
+   !!                ptab      :   pointer of arrays on which the boundary condition is applied
+   !!                cd_nat    :   nature of array grid-points
+   !!                psgn      :   sign used across the north fold boundary
+   !!                kfld      :   optional, number of pt3d arrays
+   !!                kfillmode :   optional, method to be use to fill the halos (see jpfill* variables)
+   !!                pfillval  :   optional, background value (used with jpfillcopy)
+   !!----------------------------------------------------------------------
+   !!
+   !!   ----   SINGLE PRECISION VERSIONS
+   !!
+#define PRECISION sp
+#  define MPI_TYPE MPI_REAL
+#  include "mpp_nfd_generic.h90"
+#  undef MPI_TYPE
+#undef PRECISION
+   !!
+   !!   ----   DOUBLE PRECISION VERSIONS
+   !!
+#define PRECISION dp
+#  define MPI_TYPE MPI_DOUBLE_PRECISION
+#  include "mpp_nfd_generic.h90"
+#  undef MPI_TYPE
+#undef PRECISION
 
    !!======================================================================
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lib_mpp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lib_mpp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/lib_mpp.F90	(revision 14676)
@@ -55,4 +55,7 @@
    USE dom_oce        ! ocean space and time domain
    USE in_out_manager ! I/O manager
+#if ! defined key_mpi_off
+   USE MPI
+#endif
 
    IMPLICIT NONE
@@ -107,11 +110,16 @@
    END INTERFACE
 
+   TYPE, PUBLIC ::   PTR_4D_sp   !: array of 4D pointers (used in lbclnk and lbcnfd)
+      REAL(sp), DIMENSION (:,:,:,:), POINTER ::   pt4d
+   END TYPE PTR_4D_sp
+
+   TYPE, PUBLIC ::   PTR_4D_dp   !: array of 4D pointers (used in lbclnk and lbcnfd)
+      REAL(dp), DIMENSION (:,:,:,:), POINTER ::   pt4d
+   END TYPE PTR_4D_dp
+
    !! ========================= !!
    !!  MPI  variable definition !!
    !! ========================= !!
 #if ! defined key_mpi_off
-!$AGRIF_DO_NOT_TREAT
-   INCLUDE 'mpif.h'
-!$AGRIF_END_DO_NOT_TREAT
    LOGICAL, PUBLIC, PARAMETER ::   lk_mpp = .TRUE.    !: mpp flag
 #else
@@ -130,14 +138,31 @@
    INTEGER :: MPI_SUMDD
 
+   ! Neighbourgs informations
+   INTEGER,    PARAMETER, PUBLIC ::   n_hlsmax = 3
+   INTEGER, DIMENSION(         8), PUBLIC ::   mpinei      !: 8-neighbourg MPI indexes (starting at 0, -1 if no neighbourg)
+   INTEGER, DIMENSION(n_hlsmax,8), PUBLIC ::   mpiSnei     !: 8-neighbourg Send MPI indexes (starting at 0, -1 if no neighbourg)
+   INTEGER, DIMENSION(n_hlsmax,8), PUBLIC ::   mpiRnei     !: 8-neighbourg Recv MPI indexes (starting at 0, -1 if no neighbourg)
+   INTEGER,    PARAMETER, PUBLIC ::   jpwe = 1   !: WEst
+   INTEGER,    PARAMETER, PUBLIC ::   jpea = 2   !: EAst
+   INTEGER,    PARAMETER, PUBLIC ::   jpso = 3   !: SOuth
+   INTEGER,    PARAMETER, PUBLIC ::   jpno = 4   !: NOrth
+   INTEGER,    PARAMETER, PUBLIC ::   jpsw = 5   !: South-West
+   INTEGER,    PARAMETER, PUBLIC ::   jpse = 6   !: South-East
+   INTEGER,    PARAMETER, PUBLIC ::   jpnw = 7   !: North-West
+   INTEGER,    PARAMETER, PUBLIC ::   jpne = 8   !: North-East
+
+   LOGICAL, DIMENSION(8), PUBLIC ::   l_SelfPerio  !   should we explicitely take care of I/J periodicity
+   LOGICAL,               PUBLIC ::   l_IdoNFold
+
    ! variables used for zonal integration
-   INTEGER, PUBLIC ::   ncomm_znl       !: communicator made by the processors on the same zonal average
-   LOGICAL, PUBLIC ::   l_znl_root      !: True on the 'left'most processor on the same row
-   INTEGER         ::   ngrp_znl        !  group ID for the znl processors
-   INTEGER         ::   ndim_rank_znl   !  number of processors on the same zonal average
+   INTEGER, PUBLIC ::   ncomm_znl         !: communicator made by the processors on the same zonal average
+   LOGICAL, PUBLIC ::   l_znl_root        !: True on the 'left'most processor on the same row
+   INTEGER         ::   ngrp_znl          !: group ID for the znl processors
+   INTEGER         ::   ndim_rank_znl     !: number of processors on the same zonal average
    INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::   nrank_znl  ! dimension ndim_rank_znl, number of the procs into the same znl domain
 
    ! variables used for MPI3 neighbourhood collectives
-   INTEGER, PUBLIC :: mpi_nc_com                   ! MPI3 neighbourhood collectives communicator
-   INTEGER, PUBLIC :: mpi_nc_all_com               ! MPI3 neighbourhood collectives communicator (with diagionals)
+   INTEGER, DIMENSION(n_hlsmax), PUBLIC ::   mpi_nc_com4       ! MPI3 neighbourhood collectives communicator
+   INTEGER, DIMENSION(n_hlsmax), PUBLIC ::   mpi_nc_com8       ! MPI3 neighbourhood collectives communicator (with diagionals)
 
    ! North fold condition in mpp_mpi with jpni > 1 (PUBLIC for TAM)
@@ -185,5 +210,11 @@
 
    LOGICAL, PUBLIC ::   ln_nnogather                !: namelist control of northfold comms
-   LOGICAL, PUBLIC ::   l_north_nogather = .FALSE.  !: internal control of northfold comms
+   INTEGER, PUBLIC ::   nn_comm                     !: namelist control of comms
+
+   INTEGER, PUBLIC, PARAMETER ::   jpfillnothing = 1
+   INTEGER, PUBLIC, PARAMETER ::   jpfillcst     = 2
+   INTEGER, PUBLIC, PARAMETER ::   jpfillcopy    = 3
+   INTEGER, PUBLIC, PARAMETER ::   jpfillperio   = 4
+   INTEGER, PUBLIC, PARAMETER ::   jpfillmpi     = 5
 
    !! * Substitutions
@@ -263,5 +294,5 @@
       INTEGER , INTENT(in   ) ::   kdest      ! receive process number
       INTEGER , INTENT(in   ) ::   ktyp       ! tag of the message
-      INTEGER , INTENT(in   ) ::   md_req     ! argument for isend
+      INTEGER , INTENT(inout) ::   md_req     ! argument for isend
       !!
       INTEGER ::   iflag
@@ -292,5 +323,5 @@
       INTEGER , INTENT(in   ) ::   kdest      ! receive process number
       INTEGER , INTENT(in   ) ::   ktyp       ! tag of the message
-      INTEGER , INTENT(in   ) ::   md_req     ! argument for isend
+      INTEGER , INTENT(inout) ::   md_req     ! argument for isend
       !!
       INTEGER ::   iflag
@@ -315,5 +346,5 @@
       INTEGER , INTENT(in   ) ::   kdest      ! receive process number
       INTEGER , INTENT(in   ) ::   ktyp       ! tag of the message
-      INTEGER , INTENT(in   ) ::   md_req     ! argument for isend
+      INTEGER , INTENT(inout) ::   md_req     ! argument for isend
       !!
       INTEGER ::   iflag
@@ -942,5 +973,5 @@
       LOGICAL, OPTIONAL, INTENT(in) :: ld_abort    ! source process number
       LOGICAL ::   ll_abort
-      INTEGER ::   info
+      INTEGER ::   info, ierr
       !!----------------------------------------------------------------------
       ll_abort = .FALSE.
@@ -949,5 +980,5 @@
 #if ! defined key_mpi_off
       IF(ll_abort) THEN
-         CALL mpi_abort( MPI_COMM_WORLD )
+         CALL mpi_abort( MPI_COMM_WORLD, 123, info )
       ELSE
          CALL mppsync
@@ -962,5 +993,5 @@
    SUBROUTINE mpp_comm_free( kcom )
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kcom
+      INTEGER, INTENT(inout) ::   kcom
       !!
       INTEGER :: ierr
@@ -1071,5 +1102,6 @@
    END SUBROUTINE mpp_ini_znl
 
-   SUBROUTINE mpp_ini_nc
+   
+   SUBROUTINE mpp_ini_nc( khls )
       !!----------------------------------------------------------------------
       !!               ***  routine mpp_ini_nc  ***
@@ -1082,139 +1114,36 @@
       !
       !! ** output
-      !!         mpi_nc_com = MPI3 neighbourhood collectives communicator
-      !!         mpi_nc_all_com = MPI3 neighbourhood collectives communicator
-      !!                          (with diagonals)
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, DIMENSION(:), ALLOCATABLE :: ineigh, ineighalls, ineighallr
-      INTEGER :: ideg, idegalls, idegallr, icont, icont1
-      INTEGER :: ierr
-      LOGICAL, PARAMETER :: ireord = .FALSE.
-
-#if ! defined key_mpi_off
-
-      ideg = 0
-      idegalls = 0
-      idegallr = 0
-      icont = 0
-      icont1 = 0
-
-      IF (nbondi .eq. 1) THEN
-         ideg = ideg + 1
-      ELSEIF (nbondi .eq. -1) THEN
-         ideg = ideg + 1
-      ELSEIF (nbondi .eq. 0) THEN
-         ideg = ideg + 2
-      ENDIF
-
-      IF (nbondj .eq. 1) THEN
-         ideg = ideg + 1
-      ELSEIF (nbondj .eq. -1) THEN
-         ideg = ideg + 1
-      ELSEIF (nbondj .eq. 0) THEN
-         ideg = ideg + 2
-      ENDIF
-
-      idegalls = ideg
-      idegallr = ideg
-
-      IF (nones .ne. -1) idegalls = idegalls + 1
-      IF (nonws .ne. -1) idegalls = idegalls + 1
-      IF (noses .ne. -1) idegalls = idegalls + 1
-      IF (nosws .ne. -1) idegalls = idegalls + 1
-      IF (noner .ne. -1) idegallr = idegallr + 1
-      IF (nonwr .ne. -1) idegallr = idegallr + 1
-      IF (noser .ne. -1) idegallr = idegallr + 1
-      IF (noswr .ne. -1) idegallr = idegallr + 1
-
-      ALLOCATE(ineigh(ideg))
-      ALLOCATE(ineighalls(idegalls))
-      ALLOCATE(ineighallr(idegallr))
-
-      IF (nbondi .eq. 1) THEN
-         icont = icont + 1
-         ineigh(icont) = nowe
-         ineighalls(icont) = nowe
-         ineighallr(icont) = nowe
-      ELSEIF (nbondi .eq. -1) THEN
-         icont = icont + 1
-         ineigh(icont) = noea
-         ineighalls(icont) = noea
-         ineighallr(icont) = noea
-      ELSEIF (nbondi .eq. 0) THEN
-         icont = icont + 1
-         ineigh(icont) = nowe
-         ineighalls(icont) = nowe
-         ineighallr(icont) = nowe
-         icont = icont + 1
-         ineigh(icont) = noea
-         ineighalls(icont) = noea
-         ineighallr(icont) = noea
-      ENDIF
-
-      IF (nbondj .eq. 1) THEN
-         icont = icont + 1
-         ineigh(icont) = noso
-         ineighalls(icont) = noso
-         ineighallr(icont) = noso
-      ELSEIF (nbondj .eq. -1) THEN
-         icont = icont + 1
-         ineigh(icont) = nono
-         ineighalls(icont) = nono
-         ineighallr(icont) = nono
-      ELSEIF (nbondj .eq. 0) THEN
-         icont = icont + 1
-         ineigh(icont) = noso
-         ineighalls(icont) = noso
-         ineighallr(icont) = noso
-         icont = icont + 1
-         ineigh(icont) = nono
-         ineighalls(icont) = nono
-         ineighallr(icont) = nono
-      ENDIF
-
-      icont1 = icont
-      IF (nosws .ne. -1) THEN
-         icont = icont + 1
-         ineighalls(icont) = nosws
-      ENDIF
-      IF (noses .ne. -1) THEN
-         icont = icont + 1
-         ineighalls(icont) = noses
-      ENDIF
-      IF (nonws .ne. -1) THEN
-         icont = icont + 1
-         ineighalls(icont) = nonws
-      ENDIF
-      IF (nones .ne. -1) THEN
-         icont = icont + 1
-         ineighalls(icont) = nones
-      ENDIF
-      IF (noswr .ne. -1) THEN
-         icont1 = icont1 + 1
-         ineighallr(icont1) = noswr
-      ENDIF
-      IF (noser .ne. -1) THEN
-         icont1 = icont1 + 1
-         ineighallr(icont1) = noser
-      ENDIF
-      IF (nonwr .ne. -1) THEN
-         icont1 = icont1 + 1
-         ineighallr(icont1) = nonwr
-      ENDIF
-      IF (noner .ne. -1) THEN
-         icont1 = icont1 + 1
-         ineighallr(icont1) = noner
-      ENDIF
-
-      CALL MPI_Dist_graph_create_adjacent(mpi_comm_oce, ideg, ineigh, MPI_UNWEIGHTED, ideg, ineigh, MPI_UNWEIGHTED, MPI_INFO_NULL, ireord, mpi_nc_com, ierr)
-      CALL MPI_Dist_graph_create_adjacent(mpi_comm_oce, idegallr, ineighallr, MPI_UNWEIGHTED, idegalls, ineighalls, MPI_UNWEIGHTED, MPI_INFO_NULL, ireord, mpi_nc_all_com, ierr)
-
-      DEALLOCATE (ineigh)
-      DEALLOCATE (ineighalls)
-      DEALLOCATE (ineighallr)
+      !!         mpi_nc_com4 = MPI3 neighbourhood collectives communicator
+      !!         mpi_nc_com8 = MPI3 neighbourhood collectives communicator (with diagonals)
+      !!----------------------------------------------------------------------
+      INTEGER,             INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      !
+      INTEGER, DIMENSION(:), ALLOCATABLE :: iSnei4, iRnei4, iSnei8, iRnei8
+      INTEGER                            :: iScnt4, iRcnt4, iScnt8, iRcnt8
+      INTEGER                            :: ierr
+      LOGICAL, PARAMETER                 :: ireord = .FALSE.
+      !!----------------------------------------------------------------------
+#if ! defined key_mpi_off && ! defined key_mpi2
+      
+      iScnt4 = COUNT( mpiSnei(khls,1:4) >= 0 )
+      iRcnt4 = COUNT( mpiRnei(khls,1:4) >= 0 )
+      iScnt8 = COUNT( mpiSnei(khls,1:8) >= 0 )
+      iRcnt8 = COUNT( mpiRnei(khls,1:8) >= 0 )
+
+      ALLOCATE( iSnei4(iScnt4), iRnei4(iRcnt4), iSnei8(iScnt8), iRnei8(iRcnt8) )   ! ok if icnt4 or icnt8 = 0
+
+      iSnei4 = PACK( mpiSnei(khls,1:4), mask = mpiSnei(khls,1:4) >= 0 )
+      iRnei4 = PACK( mpiRnei(khls,1:4), mask = mpiRnei(khls,1:4) >= 0 )
+      iSnei8 = PACK( mpiSnei(khls,1:8), mask = mpiSnei(khls,1:8) >= 0 )
+      iRnei8 = PACK( mpiRnei(khls,1:8), mask = mpiRnei(khls,1:8) >= 0 )
+
+      CALL MPI_Dist_graph_create_adjacent( mpi_comm_oce, iScnt4, iSnei4, MPI_UNWEIGHTED, iRcnt4, iRnei4, MPI_UNWEIGHTED,   &
+         &                                 MPI_INFO_NULL, ireord, mpi_nc_com4(khls), ierr )
+      CALL MPI_Dist_graph_create_adjacent( mpi_comm_oce, iScnt8, iSnei8, MPI_UNWEIGHTED, iRcnt8, iRnei8, MPI_UNWEIGHTED,   &
+         &                                 MPI_INFO_NULL, ireord, mpi_nc_com8(khls), ierr)
+
+      DEALLOCATE( iSnei4, iRnei4, iSnei8, iRnei8 )
 #endif
    END SUBROUTINE mpp_ini_nc
-
 
 
@@ -1232,5 +1161,4 @@
       !!
       !! ** output
-      !!      njmppmax = njmpp for northern procs
       !!      ndim_rank_north = number of processors in the northern line
       !!      nrank_north (ndim_rank_north) = number  of the northern procs.
@@ -1247,5 +1175,4 @@
       !
 #if ! defined key_mpi_off
-      njmppmax = MAXVAL( njmppt )
       !
       ! Look for how many procs on the northern boundary
@@ -1398,5 +1325,5 @@
          END DO
          IF ( crname_lbc(n_sequence_lbc) /= 'already counted' ) THEN
-            WRITE(numcom,'(A, I4, A, A)') ' - ', 1,' times by subroutine ', TRIM(crname_lbc(ncom_rec_max))
+            WRITE(numcom,'(A, I4, A, A)') ' - ', 1,' times by subroutine ', TRIM(crname_lbc(n_sequence_lbc))
          END IF
          WRITE(numcom,*) ' '
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lbc_north_icb_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lbc_north_icb_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lbc_north_icb_generic.h90	(revision 14676)
@@ -31,5 +31,5 @@
       CHARACTER(len=1)        , INTENT(in   ) ::   cd_type  ! nature of pt3d grid-points
       !                                                     !   = T ,  U , V , F or W -points
-      REAL(wp)                , INTENT(in   ) ::   psgn     ! = -1. the sign change across the
+      REAL(PRECISION)         , INTENT(in   ) ::   psgn     ! = -1. the sign change across the
       !!                                                    ! north fold, =  1. otherwise
       INTEGER                 , INTENT(in   ) ::   kextj    ! Extra halo width at north fold
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lnk_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lnk_generic.h90	(revision 14675)
+++ 	(revision )
@@ -1,410 +1,0 @@
-#if defined MULTI
-#   define NAT_IN(k)                cd_nat(k)
-#   define SGN_IN(k)                psgn(k)
-#   define F_SIZE(ptab)             kfld
-#   define OPT_K(k)                 ,ipf
-#   if defined DIM_2d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#      define K_SIZE(ptab)             1
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_3d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_4d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#   endif
-#else
-#   if defined SINGLE_PRECISION
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(sp)                    , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f)
-#   else
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(dp)                    , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f)
-#   endif
-#   define NAT_IN(k)                cd_nat
-#   define SGN_IN(k)                psgn
-#   define F_SIZE(ptab)             1
-#   define OPT_K(k)
-#   if defined DIM_2d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
-#      define K_SIZE(ptab)          1
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          SIZE(ptab,4)
-#   endif
-#endif
-
-# if defined SINGLE_PRECISION
-#    define PRECISION sp
-#    define SENDROUTINE mppsend_sp
-#    define RECVROUTINE mpprecv_sp
-# else
-#    define PRECISION dp
-#    define SENDROUTINE mppsend_dp
-#    define RECVROUTINE mpprecv_dp
-# endif
-
-#if defined MULTI
-   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv, ncsten )
-      INTEGER             , INTENT(in   ) ::   kfld        ! number of pt3d arrays
-#else
-   SUBROUTINE ROUTINE_LNK( cdname, ptab, cd_nat, psgn      , kfillmode, pfillval, lsend, lrecv, ncsten )
-#endif
-      ARRAY_TYPE(:,:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
-      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
-      CHARACTER(len=1)              , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)                      , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
-      INTEGER ,             OPTIONAL, INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
-      REAL(wp),             OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
-      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
-      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ncsten      ! 5-point or 9-point stencil
-      !
-      INTEGER  ::    ji,  jj,  jk,  jl,  jf      ! dummy loop indices
-      INTEGER  ::   ipi, ipj, ipk, ipl, ipf      ! dimension of the input array
-      INTEGER  ::   isize, ishift, ishift2       ! local integers
-      INTEGER  ::   ireq_we, ireq_ea, ireq_so, ireq_no     ! mpi_request id
-      INTEGER  ::   ierr
-      INTEGER  ::   ifill_we, ifill_ea, ifill_so, ifill_no
-      REAL(wp) ::   zland
-      INTEGER , DIMENSION(MPI_STATUS_SIZE)        ::   istat          ! for mpi_isend
-      REAL(PRECISION), DIMENSION(:,:,:,:,:), ALLOCATABLE ::   zsnd_we, zrcv_we, zsnd_ea, zrcv_ea   ! east -west  & west - east  halos
-      REAL(PRECISION), DIMENSION(:,:,:,:,:), ALLOCATABLE ::   zsnd_so, zrcv_so, zsnd_no, zrcv_no   ! north-south & south-north  halos
-      LOGICAL  ::   llsend_we, llsend_ea, llsend_no, llsend_so       ! communication send
-      LOGICAL  ::   llrecv_we, llrecv_ea, llrecv_no, llrecv_so       ! communication receive
-      LOGICAL  ::   lldo_nfd                                     ! do north pole folding
-      !!----------------------------------------------------------------------
-      !
-#if defined key_mpi3
-#   if defined MULTI
-      CALL lbc_lnk_nc    ( cdname,  ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv, ncsten )
-#   else
-      CALL lbc_lnk_nc_multi(cdname, ptab, cd_nat, psgn, kfillmode=kfillmode, pfillval=pfillval, lsend=lsend, lrecv=lrecv, ncsten=ncsten)
-#   endif
-#else
-
-      ! ----------------------------------------- !
-      !     0. local variables initialization     !
-      ! ----------------------------------------- !
-      !
-      ipk = K_SIZE(ptab)   ! 3rd dimension
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
-      !
-      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
-      !
-      IF     ( PRESENT(lsend) .AND. PRESENT(lrecv) ) THEN
-         llsend_we = lsend(1)   ;   llsend_ea = lsend(2)   ;   llsend_so = lsend(3)   ;   llsend_no = lsend(4)
-         llrecv_we = lrecv(1)   ;   llrecv_ea = lrecv(2)   ;   llrecv_so = lrecv(3)   ;   llrecv_no = lrecv(4)
-      ELSE IF( PRESENT(lsend) .OR.  PRESENT(lrecv) ) THEN
-         WRITE(ctmp1,*) ' E R R O R : Routine ', cdname, '  is calling lbc_lnk with only one of the two arguments lsend or lrecv'
-         WRITE(ctmp2,*) ' ========== '
-         CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
-      ELSE   ! send and receive with every neighbour
-         llsend_we = nbondi ==  1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
-         llsend_ea = nbondi == -1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
-         llsend_so = nbondj ==  1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
-         llsend_no = nbondj == -1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
-         llrecv_we = llsend_we   ;   llrecv_ea = llsend_ea   ;   llrecv_so = llsend_so   ;   llrecv_no = llsend_no
-      END IF
-
-
-      lldo_nfd = npolj /= 0                      ! keep for compatibility, should be defined in mppini
-
-      zland = 0._wp                                     ! land filling value: zero by default
-      IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
-
-      ! define the method we will use to fill the halos in each direction
-      IF(              llrecv_we ) THEN   ;   ifill_we = jpfillmpi
-      ELSEIF(           l_Iperio ) THEN   ;   ifill_we = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_we = kfillmode
-      ELSE                                ;   ifill_we = jpfillcst
-      END IF
-      !
-      IF(              llrecv_ea ) THEN   ;   ifill_ea = jpfillmpi
-      ELSEIF(           l_Iperio ) THEN   ;   ifill_ea = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_ea = kfillmode
-      ELSE                                ;   ifill_ea = jpfillcst
-      END IF
-      !
-      IF(              llrecv_so ) THEN   ;   ifill_so = jpfillmpi
-      ELSEIF(           l_Jperio ) THEN   ;   ifill_so = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_so = kfillmode
-      ELSE                                ;   ifill_so = jpfillcst
-      END IF
-      !
-      IF(              llrecv_no ) THEN   ;   ifill_no = jpfillmpi
-      ELSEIF(           l_Jperio ) THEN   ;   ifill_no = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_no = kfillmode
-      ELSE                                ;   ifill_no = jpfillcst
-      END IF
-      !
-#if defined PRINT_CAUTION
-      !
-      ! ================================================================================== !
-      ! CAUTION: semi-column notation is often impossible because of the cpp preprocessing !
-      ! ================================================================================== !
-      !
-#endif
-      !
-      ! -------------------------------------------------- !
-      !     1. Do east and west MPI exchange if needed     !
-      ! -------------------------------------------------- !
-      !
-      ! Must exchange the whole column (from 1 to jpj) to get the corners if we have no south/north neighbourg
-      isize = nn_hls * jpj * ipk * ipl * ipf
-      !
-      ! Allocate local temporary arrays to be sent/received. Fill arrays to be sent
-      IF( llsend_we )   ALLOCATE( zsnd_we(nn_hls,jpj,ipk,ipl,ipf) )
-      IF( llsend_ea )   ALLOCATE( zsnd_ea(nn_hls,jpj,ipk,ipl,ipf) )
-      IF( llrecv_we )   ALLOCATE( zrcv_we(nn_hls,jpj,ipk,ipl,ipf) )
-      IF( llrecv_ea )   ALLOCATE( zrcv_ea(nn_hls,jpj,ipk,ipl,ipf) )
-      !
-      IF( llsend_we ) THEN   ! copy western side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            zsnd_we(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! nn_hls + 1 -> 2*nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      ENDIF
-      !
-      IF(llsend_ea  ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = jpi - 2 * nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            zsnd_ea(ji,jj,jk,jl,jf) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)   ! jpi - 2*nn_hls + 1 -> jpi - nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      ENDIF
-      !
-      IF( ln_timing ) CALL tic_tac(.TRUE.)
-      !
-      ! non-blocking send of the western/eastern side using local temporary arrays
-      IF( llsend_we )   CALL SENDROUTINE( 1, zsnd_we(1,1,1,1,1), isize, nowe, ireq_we )
-      IF( llsend_ea )   CALL SENDROUTINE( 2, zsnd_ea(1,1,1,1,1), isize, noea, ireq_ea )
-      ! blocking receive of the western/eastern halo in local temporary arrays
-      IF( llrecv_we )   CALL RECVROUTINE( 2, zrcv_we(1,1,1,1,1), isize, nowe )
-      IF( llrecv_ea )   CALL RECVROUTINE( 1, zrcv_ea(1,1,1,1,1), isize, noea )
-      !
-      IF( ln_timing ) CALL tic_tac(.FALSE.)
-      !
-      !
-      ! ----------------------------------- !
-      !     2. Fill east and west halos     !
-      ! ----------------------------------- !
-      !
-      ! 2.1 fill weastern halo
-      ! ----------------------
-      ! ishift = 0                         ! fill halo from ji = 1 to nn_hls
-      SELECT CASE ( ifill_we )
-      CASE ( jpfillnothing )               ! no filling
-      CASE ( jpfillmpi   )                 ! use data received by MPI
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_we(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillperio )                 ! use east-weast periodicity
-         ishift2 = jpi - 2 * nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ji,jj,jk,jl,jf) = zland
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      END SELECT
-      !
-      ! 2.2 fill eastern halo
-      ! ---------------------
-      ishift = jpi - nn_hls                ! fill halo from ji = jpi-nn_hls+1 to jpi
-      SELECT CASE ( ifill_ea )
-      CASE ( jpfillnothing )               ! no filling
-      CASE ( jpfillmpi   )                 ! use data received by MPI
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv_ea(ji,jj,jk,jl,jf)   ! jpi - nn_hls + 1 -> jpi
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillperio )                 ! use east-weast periodicity
-         ishift2 = nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-            ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      END SELECT
-      !
-      ! ------------------------------- !
-      !     3. north fold treatment     !
-      ! ------------------------------- !
-      !
-      ! do it before south directions so concerned processes can do it without waiting for the comm with the sourthern neighbor
-      !
-      IF( lldo_nfd .AND. ifill_no /= jpfillnothing ) THEN
-         !
-         SELECT CASE ( jpni )
-         CASE ( 1 )     ;   CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:)                  OPT_K(:) )   ! only 1 northern proc, no mpp
-         CASE DEFAULT   ;   CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:), ifill_no, zland OPT_K(:) )   ! for all northern procs.
-         END SELECT
-         !
-         ifill_no = jpfillnothing  ! force to do nothing for the northern halo as we just done the north pole folding
-         !
-      ENDIF
-      !
-      ! ---------------------------------------------------- !
-      !     4. Do north and south MPI exchange if needed     !
-      ! ---------------------------------------------------- !
-      !
-      IF( llsend_so )   ALLOCATE( zsnd_so(jpi,nn_hls,ipk,ipl,ipf) )
-      IF( llsend_no )   ALLOCATE( zsnd_no(jpi,nn_hls,ipk,ipl,ipf) )
-      IF( llrecv_so )   ALLOCATE( zrcv_so(jpi,nn_hls,ipk,ipl,ipf) )
-      IF( llrecv_no )   ALLOCATE( zrcv_no(jpi,nn_hls,ipk,ipl,ipf) )
-      !
-      isize = jpi * nn_hls * ipk * ipl * ipf
-
-      ! allocate local temporary arrays to be sent/received. Fill arrays to be sent
-      IF( llsend_so ) THEN   ! copy sourhern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            zsnd_so(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! nn_hls+1 -> 2*nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      ENDIF
-      !
-      IF( llsend_no ) THEN   ! copy eastern side of the inner mpi domain in local temporary array to be sent by MPI
-         ishift = jpj - 2 * nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            zsnd_no(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)   ! jpj-2*nn_hls+1 -> jpj-nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      ENDIF
-      !
-      IF( ln_timing ) CALL tic_tac(.TRUE.)
-      !
-      ! non-blocking send of the southern/northern side
-      IF( llsend_so )   CALL SENDROUTINE( 3, zsnd_so(1,1,1,1,1), isize, noso, ireq_so )
-      IF( llsend_no )   CALL SENDROUTINE( 4, zsnd_no(1,1,1,1,1), isize, nono, ireq_no )
-      ! blocking receive of the southern/northern halo
-      IF( llrecv_so )   CALL RECVROUTINE( 4, zrcv_so(1,1,1,1,1), isize, noso )
-      IF( llrecv_no )   CALL RECVROUTINE( 3, zrcv_no(1,1,1,1,1), isize, nono )
-      !
-      IF( ln_timing ) CALL tic_tac(.FALSE.)
-      !
-      ! ------------------------------------- !
-      !     5. Fill south and north halos     !
-      ! ------------------------------------- !
-      !
-      ! 5.1 fill southern halo
-      ! ----------------------
-      ! ishift = 0                         ! fill halo from jj = 1 to nn_hls
-      SELECT CASE ( ifill_so )
-      CASE ( jpfillnothing )               ! no filling
-      CASE ( jpfillmpi   )                 ! use data received by MPI
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = zrcv_so(ji,jj,jk,jl,jf)   ! 1 -> nn_hls
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillperio )                 ! use north-south periodicity
-         ishift2 = jpj - 2 * nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,jj,jk,jl,jf) = zland
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      END SELECT
-      !
-      ! 5.2 fill northern halo
-      ! ----------------------
-      ishift = jpj - nn_hls                ! fill halo from jj = jpj-nn_hls+1 to jpj
-      SELECT CASE ( ifill_no )
-      CASE ( jpfillnothing )               ! no filling
-      CASE ( jpfillmpi   )                 ! use data received by MPI
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv_no(ji,jj,jk,jl,jf)   ! jpj-nn_hls+1 -> jpj
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillperio )                 ! use north-south periodicity
-         ishift2 = nn_hls
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcopy  )                 ! filling with inner domain values
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      CASE ( jpfillcst   )                 ! filling with constant value
-         DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-            ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-      END SELECT
-      !
-      ! -------------------------------------------- !
-      !     6. deallocate local temporary arrays     !
-      ! -------------------------------------------- !
-      !
-      IF( llsend_we ) THEN
-         CALL mpi_wait(ireq_we, istat, ierr )
-         DEALLOCATE( zsnd_we )
-      ENDIF
-      IF( llsend_ea )  THEN
-         CALL mpi_wait(ireq_ea, istat, ierr )
-         DEALLOCATE( zsnd_ea )
-      ENDIF
-      IF( llsend_so ) THEN
-         CALL mpi_wait(ireq_so, istat, ierr )
-         DEALLOCATE( zsnd_so )
-      ENDIF
-      IF( llsend_no ) THEN
-         CALL mpi_wait(ireq_no, istat, ierr )
-         DEALLOCATE( zsnd_no )
-      ENDIF
-      !
-      IF( llrecv_we )   DEALLOCATE( zrcv_we )
-      IF( llrecv_ea )   DEALLOCATE( zrcv_ea )
-      IF( llrecv_so )   DEALLOCATE( zrcv_so )
-      IF( llrecv_no )   DEALLOCATE( zrcv_no )
-      !
-#endif
-   END SUBROUTINE ROUTINE_LNK
-#undef PRECISION
-#undef SENDROUTINE
-#undef RECVROUTINE
-#undef ARRAY_TYPE
-#undef NAT_IN
-#undef SGN_IN
-#undef ARRAY_IN
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
-#undef OPT_K
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lnk_icb_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lnk_icb_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_lnk_icb_generic.h90	(revision 14676)
@@ -24,17 +24,12 @@
       !!                    jpi    : first dimension of the local subdomain
       !!                    jpj    : second dimension of the local subdomain
+      !!                    mpinei : number of neighboring domains (starting at 0, -1 if no neighbourg)
       !!                    kexti  : number of columns for extra outer halo
       !!                    kextj  : number of rows for extra outer halo
-      !!                    nbondi : mark for "east-west local boundary"
-      !!                    nbondj : mark for "north-south local boundary"
-      !!                    noea   : number for local neighboring processors
-      !!                    nowe   : number for local neighboring processors
-      !!                    noso   : number for local neighboring processors
-      !!                    nono   : number for local neighboring processors
       !!----------------------------------------------------------------------
       CHARACTER(len=*)                                        , INTENT(in   ) ::   cdname      ! name of the calling subroutine
       REAL(PRECISION), DIMENSION(1-kexti:jpi+kexti,1-kextj:jpj+kextj), INTENT(inout) ::   pt2d     ! 2D array with extra halo
       CHARACTER(len=1)                                        , INTENT(in   ) ::   cd_type  ! nature of ptab array grid-points
-      REAL(wp)                                                , INTENT(in   ) ::   psgn     ! sign used across the north fold
+      REAL(PRECISION)                                         , INTENT(in   ) ::   psgn     ! sign used across the north fold
       INTEGER                                                 , INTENT(in   ) ::   kexti    ! extra i-halo width
       INTEGER                                                 , INTENT(in   ) ::   kextj    ! extra j-halo width
@@ -90,5 +85,5 @@
       ! north fold treatment
       ! -----------------------
-      IF( npolj /= 0 ) THEN
+      IF( l_IdoNFold ) THEN
          !
          SELECT CASE ( jpni )
@@ -103,6 +98,5 @@
       ! we play with the neigbours AND the row number because of the periodicity
       !
-      SELECT CASE ( nbondi )      ! Read Dirichlet lateral conditions
-      CASE ( -1, 0, 1 )                ! all exept 2 (i.e. close case)
+      IF( mpinei(jpwe) >= 0 .OR. mpinei(jpea) >= 0 ) THEN   ! Read Dirichlet lateral conditions: all exept 2 (i.e. close case)
          iihom = jpi - (2 * nn_hls) -kexti
          DO jl = 1, ipreci
@@ -110,5 +104,5 @@
             r2dwe(:,jl,1) = pt2d(iihom +jl,:)
          END DO
-      END SELECT
+      ENDIF
       !
       !                           ! Migrations
@@ -120,21 +114,10 @@
       IF( ln_timing ) CALL tic_tac(.TRUE.)
       !
-      SELECT CASE ( nbondi )
-      CASE ( -1 )
-         CALL SENDROUTINE( 2, r2dwe(1-kextj,1,1), imigr, noea, ml_req1 )
-         CALL RECVROUTINE( 1, r2dew(1-kextj,1,2), imigr, noea )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-      CASE ( 0 )
-         CALL SENDROUTINE( 1, r2dew(1-kextj,1,1), imigr, nowe, ml_req1 )
-         CALL SENDROUTINE( 2, r2dwe(1-kextj,1,1), imigr, noea, ml_req2 )
-         CALL RECVROUTINE( 1, r2dew(1-kextj,1,2), imigr, noea )
-         CALL RECVROUTINE( 2, r2dwe(1-kextj,1,2), imigr, nowe )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-         CALL mpi_wait(ml_req2,ml_stat,ml_err)
-      CASE ( 1 )
-         CALL SENDROUTINE( 1, r2dew(1-kextj,1,1), imigr, nowe, ml_req1 )
-         CALL RECVROUTINE( 2, r2dwe(1-kextj,1,2), imigr, nowe )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-      END SELECT
+      IF( mpinei(jpwe) >= 0  )   CALL SENDROUTINE( 1, r2dew(1-kextj,1,1), imigr, mpinei(jpwe), ml_req1 )
+      IF( mpinei(jpea) >= 0  )   CALL SENDROUTINE( 2, r2dwe(1-kextj,1,1), imigr, mpinei(jpea), ml_req2 )
+      IF( mpinei(jpwe) >= 0  )   CALL RECVROUTINE( 2, r2dwe(1-kextj,1,2), imigr, mpinei(jpwe) )
+      IF( mpinei(jpea) >= 0  )   CALL RECVROUTINE( 1, r2dew(1-kextj,1,2), imigr, mpinei(jpea) )
+      IF( mpinei(jpwe) >= 0  )   CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      IF( mpinei(jpea) >= 0  )   CALL mpi_wait(ml_req2,ml_stat,ml_err)
       !
       IF( ln_timing ) CALL tic_tac(.FALSE.)
@@ -142,21 +125,14 @@
       !                           ! Write Dirichlet lateral conditions
       iihom = jpi - nn_hls
-      !
-      SELECT CASE ( nbondi )
-      CASE ( -1 )
+      IF( mpinei(jpwe) >= 0  ) THEN
+         DO jl = 1, ipreci
+            pt2d(jl-kexti,:) = r2dwe(:,jl,2)
+         END DO
+      ENDIF
+      IF( mpinei(jpea) >= 0  ) THEN
          DO jl = 1, ipreci
             pt2d(iihom+jl,:) = r2dew(:,jl,2)
          END DO
-      CASE ( 0 )
-         DO jl = 1, ipreci
-            pt2d(jl-kexti,:) = r2dwe(:,jl,2)
-            pt2d(iihom+jl,:) = r2dew(:,jl,2)
-         END DO
-      CASE ( 1 )
-         DO jl = 1, ipreci
-            pt2d(jl-kexti,:) = r2dwe(:,jl,2)
-         END DO
-      END SELECT
-
+      ENDIF
 
       ! 3. North and south directions
@@ -164,5 +140,5 @@
       ! always closed : we play only with the neigbours
       !
-      IF( nbondj /= 2 ) THEN      ! Read Dirichlet lateral conditions
+      IF( mpinei(jpso) >= 0 .OR. mpinei(jpno) >= 0 ) THEN   ! Read Dirichlet lateral conditions: all exept 2 (i.e. close case)
          ijhom = jpj - (2 * nn_hls) - kextj
          DO jl = 1, iprecj
@@ -177,21 +153,10 @@
       IF( ln_timing ) CALL tic_tac(.TRUE.)
       !
-      SELECT CASE ( nbondj )
-      CASE ( -1 )
-         CALL SENDROUTINE( 4, r2dsn(1-kexti,1,1), imigr, nono, ml_req1 )
-         CALL RECVROUTINE( 3, r2dns(1-kexti,1,2), imigr, nono )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-      CASE ( 0 )
-         CALL SENDROUTINE( 3, r2dns(1-kexti,1,1), imigr, noso, ml_req1 )
-         CALL SENDROUTINE( 4, r2dsn(1-kexti,1,1), imigr, nono, ml_req2 )
-         CALL RECVROUTINE( 3, r2dns(1-kexti,1,2), imigr, nono )
-         CALL RECVROUTINE( 4, r2dsn(1-kexti,1,2), imigr, noso )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-         CALL mpi_wait(ml_req2,ml_stat,ml_err)
-      CASE ( 1 )
-         CALL SENDROUTINE( 3, r2dns(1-kexti,1,1), imigr, noso, ml_req1 )
-         CALL RECVROUTINE( 4, r2dsn(1-kexti,1,2), imigr, noso )
-         CALL mpi_wait(ml_req1,ml_stat,ml_err)
-      END SELECT
+      IF( mpinei(jpso) >= 0  )   CALL SENDROUTINE( 3, r2dns(1-kexti,1,1), imigr, mpinei(jpso), ml_req1 )
+      IF( mpinei(jpno) >= 0  )   CALL SENDROUTINE( 4, r2dsn(1-kexti,1,1), imigr, mpinei(jpno), ml_req2 )
+      IF( mpinei(jpso) >= 0  )   CALL RECVROUTINE( 4, r2dsn(1-kexti,1,2), imigr, mpinei(jpso) )
+      IF( mpinei(jpno) >= 0  )   CALL RECVROUTINE( 3, r2dns(1-kexti,1,2), imigr, mpinei(jpno) )
+      IF( mpinei(jpso) >= 0  )   CALL mpi_wait(ml_req1,ml_stat,ml_err)
+      IF( mpinei(jpno) >= 0  )   CALL mpi_wait(ml_req2,ml_stat,ml_err)
       !
       IF( ln_timing ) CALL tic_tac(.FALSE.)
@@ -200,19 +165,14 @@
       ijhom = jpj - nn_hls
       !
-      SELECT CASE ( nbondj )
-      CASE ( -1 )
-         DO jl = 1, iprecj
-            pt2d(:,ijhom+jl) = r2dns(:,jl,2)
-         END DO
-      CASE ( 0 )
-         DO jl = 1, iprecj
-            pt2d(:,jl-kextj) = r2dsn(:,jl,2)
-            pt2d(:,ijhom+jl) = r2dns(:,jl,2)
-         END DO
-      CASE ( 1 )
+      IF( mpinei(jpso) >= 0  ) THEN
          DO jl = 1, iprecj
             pt2d(:,jl-kextj) = r2dsn(:,jl,2)
          END DO
-      END SELECT
+      ENDIF
+       IF( mpinei(jpno) >= 0  ) THEN
+        DO jl = 1, iprecj
+            pt2d(:,ijhom+jl) = r2dns(:,jl,2)
+         END DO
+      ENDIF
       !
    END SUBROUTINE ROUTINE_LNK
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_nc_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_nc_generic.h90	(revision 14675)
+++ 	(revision )
@@ -1,950 +1,0 @@
-#   define NAT_IN(k)                cd_nat(k)   
-#   define SGN_IN(k)                psgn(k)
-#   define F_SIZE(ptab)             kfld
-#   define OPT_K(k)                 ,ipf
-#   if defined DIM_2d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#      define K_SIZE(ptab)             1
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_3d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_4d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp)                , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp)                , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#   endif
-#   if defined SINGLE_PRECISION
-#      define PRECISION sp
-#      define MPI_TYPE MPI_REAL
-#   else
-#      define PRECISION dp
-#      define MPI_TYPE MPI_DOUBLE_PRECISION
-#   endif
-
-   SUBROUTINE ROUTINE_NC( cdname, ptab, cd_nat, psgn, kfld, kfillmode, pfillval, lsend, lrecv, ncsten )
-      INTEGER             , INTENT(in   ) ::   kfld        ! number of pt3d arrays
-      ARRAY_TYPE(:,:,:,:,:)                                        ! array or pointer of arrays on which the boundary condition is applied
-      CHARACTER(len=*)              , INTENT(in   ) ::   cdname      ! name of the calling subroutine
-      CHARACTER(len=1)              , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)                      , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
-      INTEGER ,             OPTIONAL, INTENT(in   ) ::   kfillmode   ! filling method for halo over land (default = constant)
-      REAL(wp),             OPTIONAL, INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
-      LOGICAL, DIMENSION(4),OPTIONAL, INTENT(in   ) ::   lsend, lrecv  ! communication with other 4 proc
-      LOGICAL,              OPTIONAL, INTENT(in   ) ::   ncsten      ! 5-point or 9-point stencil
-      !
-      INTEGER  ::   ji,  jj,  jk,  jl,  jf                                      ! dummy loop indices
-      INTEGER  ::   ipi, ipj, ipk, ipl, ipf                                     ! dimension of the input array
-      INTEGER  ::   ishift, ishift2, idx, icount, icount1                       ! local integers
-      INTEGER  ::   idims, idimr, isizet, isizets, isizetr, izsnd, izrcv        ! local integers
-      INTEGER  ::   ierr
-      INTEGER  ::   ifill_we, ifill_ea, ifill_so, ifill_no
-      INTEGER  ::   ifill_web, ifill_eab
-      REAL(wp) ::   zland
-      INTEGER , DIMENSION(MPI_STATUS_SIZE)                        ::   istate              ! for mpi_isend
-      REAL(PRECISION), DIMENSION(:), ALLOCATABLE                  ::   zsnd, zrcv          ! halos arrays
-      INTEGER , DIMENSION(:), ALLOCATABLE                         ::   isizes              ! number of elements to be sent
-      INTEGER , DIMENSION(:), ALLOCATABLE                         ::   isizer              ! number of elements to be received
-      INTEGER , DIMENSION(:), ALLOCATABLE                         ::   idatatys, idatatyr  ! datatype of halos arrays
-      INTEGER (KIND=MPI_ADDRESS_KIND), DIMENSION (:), ALLOCATABLE ::   idispls, idisplr    ! displacement in halos arrays
-      LOGICAL  ::   llsend_we, llsend_ea, llsend_no, llsend_so       ! communication send
-      LOGICAL  ::   llrecv_we, llrecv_ea, llrecv_no, llrecv_so       ! communication receive 
-      LOGICAL  ::   lldo_nfd                                         ! do north pole folding
-      LOGICAL  ::   llncall                                          ! default: 9-point stencil
-
-      !!----------------------------------------------------------------------
-      !
-      ! ----------------------------------------- !
-      !     0. local variables initialization     !
-      ! ----------------------------------------- !
-      !
-      llncall = .TRUE. 
-      ipk = K_SIZE(ptab)   ! 3rd dimension
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
-      !
-      IF( narea == 1 .AND. numcom == -1 ) CALL mpp_report( cdname, ipk, ipl, ipf, ld_lbc = .TRUE. )
-      !
-      IF     ( PRESENT(lsend) .AND. PRESENT(lrecv) ) THEN
-         llsend_we = lsend(1)   ;   llsend_ea = lsend(2)   ;   llsend_so = lsend(3)   ;   llsend_no = lsend(4)
-         llrecv_we = lrecv(1)   ;   llrecv_ea = lrecv(2)   ;   llrecv_so = lrecv(3)   ;   llrecv_no = lrecv(4)
-      ELSE IF( PRESENT(lsend) .OR.  PRESENT(lrecv) ) THEN
-         WRITE(ctmp1,*) ' E R R O R : Routine ', cdname, '  is calling lbc_lnk with only one of the two arguments lsend or lrecv'
-         WRITE(ctmp2,*) ' ========== '
-         CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
-      ELSE   ! send and receive with every neighbour
-         llsend_we = nbondi ==  1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
-         llsend_ea = nbondi == -1 .OR. nbondi == 0   ! keep for compatibility, should be defined in mppini
-         llsend_so = nbondj ==  1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
-         llsend_no = nbondj == -1 .OR. nbondj == 0   ! keep for compatibility, should be defined in mppini
-         llrecv_we = llsend_we   ;   llrecv_ea = llsend_ea   ;   llrecv_so = llsend_so   ;   llrecv_no = llsend_no
-      END IF
-         
-      lldo_nfd = npolj /= 0                      ! keep for compatibility, should be defined in mppini
-
-      zland = 0._wp                                     ! land filling value: zero by default
-      IF( PRESENT( pfillval ) )   zland = pfillval      ! set land value
-
-
-      ! define the method we will use to fill the halos in each direction
-      IF(              llrecv_we ) THEN   ;   ifill_we = jpfillmpi
-      ELSEIF(           l_Iperio ) THEN   ;   ifill_we = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_we = kfillmode
-      ELSE                                ;   ifill_we = jpfillcst
-      END IF
-      IF(               l_Iperio ) THEN   ;   ifill_web = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_web = kfillmode
-      ELSE                                ;   ifill_web = jpfillcst
-      END IF
-      !
-      IF(              llrecv_ea ) THEN   ;   ifill_ea = jpfillmpi
-      ELSEIF(           l_Iperio ) THEN   ;   ifill_ea = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_ea = kfillmode
-      ELSE                                ;   ifill_ea = jpfillcst
-      END IF
-      IF(               l_Iperio ) THEN   ;   ifill_eab = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_eab = kfillmode
-      ELSE                                ;   ifill_eab = jpfillcst
-      END IF
-      !
-      IF(              llrecv_so ) THEN   ;   ifill_so = jpfillmpi
-      ELSEIF(           l_Jperio ) THEN   ;   ifill_so = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_so = kfillmode
-      ELSE                                ;   ifill_so = jpfillcst
-      END IF
-      !
-      IF(              llrecv_no ) THEN   ;   ifill_no = jpfillmpi
-      ELSEIF(           l_Jperio ) THEN   ;   ifill_no = jpfillperio
-      ELSEIF( PRESENT(kfillmode) ) THEN   ;   ifill_no = kfillmode
-      ELSE                                ;   ifill_no = jpfillcst
-      END IF
-      !
-      IF(PRESENT(ncsten)) llncall = ncsten 
-#if defined PRINT_CAUTION
-      !
-      ! ================================================================================== !
-      ! CAUTION: semi-column notation is often impossible because of the cpp preprocessing !
-      ! ================================================================================== !
-      !
-#endif
-      !
-      ! -------------------------------------------------- !
-      !     1. Do west, east, south and north MPI exchange !
-      ! -------------------------------------------------- !
-      !
-      ! Allocate local temporary arrays to be sent/received. Fill arrays to be sent
-
-      idims = 0
-      idimr = 0
-      izsnd = 0
-      izrcv = 0
-
-      IF(llsend_we) idims = idims + 1
-      IF(llsend_ea) idims = idims + 1
-      IF(llsend_so) idims = idims + 1
-      IF(llsend_no) idims = idims + 1
-
-      idimr = idims
-
-      IF(llncall) THEN
-         IF(noswr .ne. -1) idimr = idimr + 1
-         IF(noser .ne. -1) idimr = idimr + 1
-         IF(nonwr .ne. -1) idimr = idimr + 1
-         IF(noner .ne. -1) idimr = idimr + 1
-      
-         IF(nosws .ne. -1) idims = idims + 1
-         IF(noses .ne. -1) idims = idims + 1
-         IF(nonws .ne. -1) idims = idims + 1
-         IF(nones .ne. -1) idims = idims + 1
-      END IF
-
-      IF(llsend_we) izsnd = izsnd + nn_hls * (jpj - 2*nn_hls) * ipk * ipl * ipf
-      IF(llsend_ea) izsnd = izsnd + nn_hls * (jpj - 2*nn_hls) * ipk * ipl * ipf
-      IF(llsend_so) izsnd = izsnd + (jpi - 2*nn_hls) * nn_hls * ipk * ipl * ipf
-      IF(llsend_no) izsnd = izsnd + (jpi - 2*nn_hls) * nn_hls * ipk * ipl * ipf
-
-      izrcv = izsnd
-      
-      IF(llncall) THEN
-         IF(noswr .ne. -1) izrcv = izrcv + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(noser .ne. -1) izrcv = izrcv + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(nonwr .ne. -1) izrcv = izrcv + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(noner .ne. -1) izrcv = izrcv + nn_hls * nn_hls * ipk * ipl * ipf
-
-         IF(nosws .ne. -1) izsnd = izsnd + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(noses .ne. -1) izsnd = izsnd + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(nonws .ne. -1) izsnd = izsnd + nn_hls * nn_hls * ipk * ipl * ipf
-         IF(nones .ne. -1) izsnd = izsnd + nn_hls * nn_hls * ipk * ipl * ipf
-      END IF
-
-      ALLOCATE(zsnd(izsnd))
-      ALLOCATE(zrcv(izrcv))
-      ALLOCATE(isizes(idims))
-      ALLOCATE(isizer(idimr))
-      ALLOCATE(idatatys(idims))
-      ALLOCATE(idatatyr(idimr))
-      ALLOCATE(idispls(idims))
-      ALLOCATE(idisplr(idimr))
-
-      zrcv(:)=-1
-      zsnd(:)=-1
-      isizes(:) = 0
-      isizer(:) = 0
-      idispls(:) = 0
-      idisplr(:) = 0
-      isizet = 0 
-     
-      idx = 1
-      icount = 1
-
-      IF(llsend_we) THEN
-         DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = nn_hls + 1, jpj - nn_hls  ;  DO ji = 1, nn_hls
-            zsnd(idx) = ARRAY_IN(nn_hls+ji,jj,jk,jl,jf)
-            idx = idx + 1
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-         isizes(icount) = nn_hls * (jpj - 2*nn_hls) * ipk * ipl * ipf
-         IF(icount .gt. 1) isizet = isizet + isizes(icount - 1)
-         idispls(icount) = jpbyt*isizet
-         icount = icount + 1
-      END IF
-
-      IF(llsend_ea) THEN
-         ishift = jpi-2*nn_hls
-
-         DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = nn_hls + 1, jpj - nn_hls  ;  DO ji = 1, nn_hls
-            zsnd(idx) = ARRAY_IN(ishift+ji,jj,jk,jl,jf)
-            idx = idx + 1
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-         isizes(icount) = nn_hls * (jpj - 2*nn_hls) * ipk * ipl * ipf
-         IF(icount .gt. 1) isizet = isizet + isizes(icount - 1)
-         idispls(icount) = jpbyt*isizet
-         icount = icount + 1
-      END IF
-
-      IF(llsend_so) THEN
-         DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = nn_hls + 1, jpi - nn_hls
-            zsnd(idx) = ARRAY_IN(ji,nn_hls+jj,jk,jl,jf)
-            idx = idx + 1
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-         isizes(icount) = (jpi - 2*nn_hls) * nn_hls * ipk * ipl * ipf
-         IF(icount .gt. 1) isizet = isizet + isizes(icount - 1)
-         idispls(icount) = jpbyt*isizet
-         icount = icount + 1
-      END IF
-
-      IF(llsend_no) THEN
-         ishift = jpj-2*nn_hls
-
-         DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = nn_hls + 1, jpi - nn_hls
-            zsnd(idx) = ARRAY_IN(ji,ishift+jj,jk,jl,jf)
-            idx = idx + 1
-         END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-         isizes(icount) = (jpi - 2*nn_hls) * nn_hls * ipk * ipl * ipf
-         IF(icount .gt. 1) isizet = isizet + isizes(icount - 1)
-         idispls(icount) = jpbyt*isizet
-         icount = icount + 1
-      END IF
-
-      isizer(:) = isizes(:)
-      idisplr(:) = idispls(:)
-      
-      icount1 = icount
-      isizets = isizet 
-      isizetr = isizet 
-
-      IF(llncall) THEN
-         IF(noswr .ne. -1) THEN
-            isizer(icount1) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount1 .gt. 1) isizetr = isizetr + isizer(icount1 - 1)
-            idisplr(icount1) = jpbyt*isizetr
-            icount1 = icount1 + 1
-         END IF
-         IF(noser .ne. -1) THEN
-            isizer(icount1) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount1 .gt. 1) isizetr = isizetr + isizer(icount1 - 1)
-            idisplr(icount1) = jpbyt*isizetr
-            icount1 = icount1 + 1
-         END IF
-         IF(nonwr .ne. -1) THEN
-            isizer(icount1) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount1 .gt. 1) isizetr = isizetr + isizer(icount1 - 1)
-            idisplr(icount1) = jpbyt*isizetr
-            icount1 = icount1 + 1
-         END IF
-         IF(noner .ne. -1) THEN
-            isizer(icount1) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount1 .gt. 1) isizetr = isizetr + isizer(icount1 - 1)
-            idisplr(icount1) = jpbyt*isizetr
-            icount1 = icount1 + 1
-         END IF
-
-         IF(nosws .ne. -1) THEN
-            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = 1, nn_hls
-               zsnd(idx) = ARRAY_IN(nn_hls+ji,nn_hls+jj,jk,jl,jf)
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-            isizes(icount) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount .gt. 1) isizets = isizets + isizes(icount - 1)
-            idispls(icount) = jpbyt*isizets
-            icount = icount + 1
-         END IF
-         IF(noses .ne. -1) THEN
-            ishift = jpi-2*nn_hls
-            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = 1, nn_hls
-               zsnd(idx) = ARRAY_IN(ji+ishift,nn_hls+jj,jk,jl,jf)
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-            isizes(icount) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount .gt. 1) isizets = isizets + isizes(icount - 1)
-            idispls(icount) = jpbyt*isizets
-            icount = icount + 1
-         END IF
-         IF(nonws .ne. -1) THEN
-            ishift = jpj-2*nn_hls
-            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = 1, nn_hls
-               zsnd(idx) = ARRAY_IN(nn_hls+ji,jj+ishift,jk,jl,jf)
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-            isizes(icount) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount .gt. 1) isizets = isizets + isizes(icount - 1)
-            idispls(icount) = jpbyt*isizets
-            icount = icount + 1
-         END IF
-         IF(nones .ne. -1) THEN
-            ishift = jpi-2*nn_hls
-            ishift2 = jpj-2*nn_hls
-            DO jf = 1, ipf  ;  DO jl = 1, ipl  ;  DO jk = 1, ipk  ;  DO jj = 1, nn_hls  ;  DO ji = 1, nn_hls
-               zsnd(idx) = ARRAY_IN(ji+ishift,jj+ishift2,jk,jl,jf)
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-            isizes(icount) = nn_hls * nn_hls * ipk * ipl * ipf
-            IF(icount .gt. 1) isizets = isizets + isizes(icount - 1)
-            idispls(icount) = jpbyt*isizets
-            icount = icount + 1
-         END IF
-      END IF
-
-      idatatys(:) = MPI_TYPE
-      idatatyr(:) = MPI_TYPE
-
-      IF(llncall) THEN
-         IF( ln_timing ) CALL tic_tac(.TRUE.)
-         CALL mpi_neighbor_alltoallw (zsnd, isizes, idispls, idatatys, zrcv, isizer, idisplr, idatatyr, mpi_nc_all_com, ierr)
-         IF( ln_timing ) CALL tic_tac(.FALSE.)
-      ELSE
-         IF( ln_timing ) CALL tic_tac(.TRUE.)
-         CALL mpi_neighbor_alltoallw (zsnd, isizes, idispls, idatatys, zrcv, isizer, idisplr, idatatyr, mpi_nc_com, ierr)
-         IF( ln_timing ) CALL tic_tac(.FALSE.)
-      END IF
-
-      ! --------------------------------------------------- !
-      !     2. Fill east and west north and south halos     !
-      ! --------------------------------------------------- !
-      !
-      !!! Patch to solve MPI3 bug when we have only two processes columns
-      IF(jpni .eq. 2) THEN
-         ! ---------------------
-         ! 2.2 fill eastern halo
-         ! ---------------------
-         idx = 1
-         ishift = jpi - nn_hls                ! fill halo from ji = jpi-nn_hls+1 to jpi
-         SELECT CASE ( ifill_ea )
-         CASE ( jpfillnothing )               ! no filling
-         CASE ( jpfillmpi   )                 ! use data received by MPI
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv(idx)   ! jpi - nn_hls + 1 -> jpi
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillperio )                 ! use east-weast periodicity
-            ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-         ! ----------------------
-         ! 2.1 fill weastern halo
-         ! ----------------------
-         SELECT CASE ( ifill_we )
-         CASE ( jpfillnothing )               ! no filling
-         CASE ( jpfillmpi   )                 ! use data received by MPI
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)   ! 1 -> nn_hls
-               idx = idx + 1
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillperio )                 ! use east-weast periodicity
-            ishift2 = jpi - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-
-      ELSE
-
-         ! ----------------------
-         ! 2.1 fill weastern halo
-         ! ----------------------
-         idx = 1
-         SELECT CASE ( ifill_we )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)   ! 1 -> nn_hls
-               idx = idx + 1
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillperio )                 ! use east-weast periodicity
-            ishift2 = jpi - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-         ! ---------------------
-         ! 2.2 fill eastern halo
-         ! ---------------------
-         ishift = jpi - nn_hls                ! fill halo from ji = jpi-nn_hls+1 to jpi 
-         SELECT CASE ( ifill_ea )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = nn_hls + 1, jpj - nn_hls   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zrcv(idx)   ! jpi - nn_hls + 1 -> jpi
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillperio )                 ! use east-weast periodicity
-            ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, jpj   ;   DO ji = 1, nn_hls
-               ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-
-      ENDIF
-
-      !!! Patch to solve MPI3 bug when we have only two processes rows
-      IF(jpnj .eq. 2) THEN
-         ! ----------------------
-         ! 2.3 fill northern halo
-         ! ----------------------
-         ishift = jpj - nn_hls                ! fill halo from jj = jpj-nn_hls+1 to jpj 
-         SELECT CASE ( ifill_no )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = nn_hls + 1, jpi - nn_hls
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv(idx)   ! jpj-nn_hls+1 -> jpj
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-            IF(nonwr .eq. -1) THEN
-               ishift = jpj - nn_hls
-               SELECT CASE ( ifill_web )
-                  CASE ( jpfillperio )
-                     ishift2 = jpi - 2 * nn_hls
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-            IF(noner .eq. -1) THEN
-               ishift = jpi - nn_hls
-               ishift2 = jpj - nn_hls
-               SELECT CASE ( ifill_eab )
-                  CASE ( jpfillperio )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-         CASE ( jpfillperio )                 ! use north-south periodicity
-            ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-
-         ! ----------------------
-         ! 2.4 fill southern halo
-         ! ----------------------
-         SELECT CASE ( ifill_so )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)   ! 1 -> nn_hls
-               idx = idx + 1
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
-            IF(noswr .eq. -1) THEN
-               SELECT CASE ( ifill_web )
-                  CASE ( jpfillperio )
-                     ishift2 = jpi - 2 * nn_hls
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-            IF(noser .eq. -1) THEN
-               ishift = jpi - nn_hls
-               SELECT CASE ( ifill_eab )
-                  CASE ( jpfillperio )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji+nn_hls,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-         CASE ( jpfillperio )                 ! use north-south periodicity
-            ishift2 = jpj - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-      ELSE
-         ! ----------------------
-         ! 2.3 fill southern halo
-         ! ----------------------
-         SELECT CASE ( ifill_so )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = nn_hls + 1, jpi - nn_hls
-               ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)   ! 1 -> nn_hls
-               idx = idx + 1
-            END DO;   END DO   ;   END DO   ;   END DO   ;   END DO
-            IF(noswr .eq. -1) THEN
-               SELECT CASE ( ifill_web )
-                  CASE ( jpfillperio )
-                     ishift2 = jpi - 2 * nn_hls
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-            IF(noser .eq. -1) THEN
-               ishift = jpi - nn_hls
-               SELECT CASE ( ifill_eab )
-                  CASE ( jpfillperio )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji+nn_hls,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-         CASE ( jpfillperio )                 ! use north-south periodicity
-            ishift2 = jpj - 2 * nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ji,nn_hls+1,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-
-         ! ----------------------
-         ! 2.4 fill northern halo
-         ! ----------------------
-         ishift = jpj - nn_hls                ! fill halo from jj = jpj-nn_hls+1 to jpj 
-         SELECT CASE ( ifill_no )
-         CASE ( jpfillnothing )               ! no filling 
-         CASE ( jpfillmpi   )                 ! use data received by MPI 
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = nn_hls + 1, jpi - nn_hls
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zrcv(idx)   ! jpj-nn_hls+1 -> jpj
-               idx = idx + 1
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-            IF(nonwr .eq. -1) THEN
-               ishift = jpj - nn_hls
-               SELECT CASE ( ifill_web )
-                  CASE ( jpfillperio )
-                     ishift2 = jpi - 2 * nn_hls
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(ishift2+ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = ARRAY_IN(nn_hls+1,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-            IF(noner .eq. -1) THEN
-               ishift = jpi - nn_hls
-               ishift2 = jpj - nn_hls
-               SELECT CASE ( ifill_eab )
-                  CASE ( jpfillperio )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ji,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-
-                  CASE ( jpfillcopy  )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = ARRAY_IN(ishift,jj,jk,jl,jf)
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                  CASE ( jpfillcst   )
-                     DO jf = 1, ipf  ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1 + ishift2, jpj   ;  DO ji = 1, nn_hls
-                        ARRAY_IN(ishift+ji,jj,jk,jl,jf) = zland
-                     END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-               END SELECT
-            END IF
-         CASE ( jpfillperio )                 ! use north-south periodicity
-            ishift2 = nn_hls
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift2+jj,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcopy  )                 ! filling with inner domain values
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = ARRAY_IN(ji,ishift,jk,jl,jf)
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         CASE ( jpfillcst   )                 ! filling with constant value
-            DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;   DO ji = 1, jpi
-               ARRAY_IN(ji,ishift+jj,jk,jl,jf) = zland
-            END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-         END SELECT
-      ENDIF
-
-      IF(llncall) THEN
-
-         !!! Patch to solve MPI3 bug when we have only two processes columns
-         IF(jpni .eq. 2) THEN
-            !!! Patch to solve MPI3 bug when we have only two processes rows
-            IF(jpnj .eq. 2) THEN
-               ! ---------------------------
-               ! 2.5 fill east-nouthern halo
-               ! ---------------------------
-                 IF(noner .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    ishift2 = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj+ishift2,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.6 fill west-nouthern halo
-               ! ---------------------------
-                 IF(nonwr .ne. -1) THEN
-                    ishift = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj+ishift,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.7 fill east-southern halo
-               ! ---------------------------
-                 IF(noser .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.8 fill west-southern halo
-               ! ---------------------------
-                 IF(noswr .ne. -1) THEN
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-
-            ELSE
-               ! ---------------------------
-               ! 2.5 fill east-southern halo
-               ! ---------------------------
-                 IF(noser .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.6 fill west-southern halo
-               ! ---------------------------
-                 IF(noswr .ne. -1) THEN
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.7 fill east-nouthern halo
-               ! ---------------------------
-                 IF(noner .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    ishift2 = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj+ishift2,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.8 fill west-nouthern halo
-               ! ---------------------------
-                 IF(nonwr .ne. -1) THEN
-                    ishift = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj+ishift,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-            ENDIF
-         ELSE
-            !!! Patch to solve MPI3 bug when we have only two processes rows
-            IF(jpnj .eq. 2) THEN
-               ! ---------------------------
-               ! 2.5 fill west-nouthern halo
-               ! ---------------------------
-                 IF(nonwr .ne. -1) THEN
-                    ishift = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj+ishift,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.6 fill east-nouthern halo
-               ! ---------------------------
-                 IF(noner .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    ishift2 = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj+ishift2,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.7 fill west-southern halo
-               ! ---------------------------
-                 IF(noswr .ne. -1) THEN
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.8 fill east-southern halo
-               ! ---------------------------
-                 IF(noser .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-
-            ELSE
-               ! ---------------------------
-               ! 2.5 fill west-southern halo
-               ! ---------------------------
-                 IF(noswr .ne. -1) THEN
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.6 fill east-southern halo
-               ! ---------------------------
-                 IF(noser .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.7 fill west-nouthern halo
-               ! ---------------------------
-                 IF(nonwr .ne. -1) THEN
-                    ishift = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji,jj+ishift,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-               ! ---------------------------
-               ! 2.8 fill east-nouthern halo
-               ! ---------------------------
-                 IF(noner .ne. -1) THEN
-                    ishift = jpi - nn_hls
-                    ishift2 = jpj - nn_hls
-                    DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk   ;   DO jj = 1, nn_hls   ;  DO ji = 1, nn_hls
-                       ARRAY_IN(ji+ishift,jj+ishift2,jk,jl,jf) = zrcv(idx)
-                       idx = idx + 1
-                    END DO   ;   END DO   ;   END DO   ;   END DO   ;   END DO
-                 END IF
-            ENDIF
-         END IF
-      END IF
-
-
-      !
-      ! -------------------------------------------- !
-      !     3. deallocate local temporary arrays     !
-      ! -------------------------------------------- !
-      !
-      DEALLOCATE( zsnd )
-      DEALLOCATE( zrcv )
-      DEALLOCATE(isizes)
-      DEALLOCATE(isizer)
-      DEALLOCATE(idatatys)
-      DEALLOCATE(idatatyr)
-      DEALLOCATE(idispls)
-      DEALLOCATE(idisplr)
-      !
-      ! ------------------------------- !
-      !     4. north fold treatment     !
-      ! ------------------------------- !
-      !
-      IF( lldo_nfd .AND. ifill_no /= jpfillnothing ) THEN
-         !
-         SELECT CASE ( jpni )
-         CASE ( 1 )     ;   CALL lbc_nfd( ptab, NAT_IN(:), SGN_IN(:)                  OPT_K(:) )   ! only 1 northern proc, no mpp
-         CASE DEFAULT   ;   CALL mpp_nfd( ptab, NAT_IN(:), SGN_IN(:), ifill_no, zland OPT_K(:) )   ! for all northern procs.
-         END SELECT
-         !
-         ifill_no = jpfillnothing  ! force to do nothing for the northern halo as we just done the north pole folding
-         !
-      ENDIF
-
-   END SUBROUTINE ROUTINE_NC
-
-#undef PRECISION
-#undef ARRAY_TYPE
-#undef NAT_IN
-#undef SGN_IN
-#undef ARRAY_IN
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
-#undef OPT_K
-#undef MPI_TYPE
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_nfd_generic.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_nfd_generic.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mpp_nfd_generic.h90	(revision 14676)
@@ -1,87 +1,11 @@
-#if defined MULTI
-#   define NAT_IN(k)                cd_nat(k)   
-#   define SGN_IN(k)                psgn(k)
-#   define F_SIZE(ptab)             kfld
-#   define LBC_ARG                  (jf)
-#   if defined DIM_2d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_sp)     , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_2D_dp)     , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#      define K_SIZE(ptab)             1
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_3d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_sp)     , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_3D_dp)     , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#      define L_SIZE(ptab)             1
-#   endif
-#   if defined DIM_4d
-#      if defined SINGLE_PRECISION
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_sp)     , INTENT(inout) ::   ptab(f)
-#      else
-#         define ARRAY_TYPE(i,j,k,l,f)    TYPE(PTR_4D_dp)     , INTENT(inout) ::   ptab(f)
-#      endif
-#      define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#      define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#      define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#   endif
-#else
-!                          !==  IN: ptab is an array  ==!
-#   if defined SINGLE_PRECISION
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(sp)         , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f)
-#   else
-#      define ARRAY_TYPE(i,j,k,l,f)    REAL(dp)         , INTENT(inout) ::   ARRAY_IN(i,j,k,l,f)
-#   endif
-#   define NAT_IN(k)                cd_nat
-#   define SGN_IN(k)                psgn
-#   define F_SIZE(ptab)             1
-#   define LBC_ARG
-#   if defined DIM_2d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j)
-#      define K_SIZE(ptab)          1
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_3d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          1
-#   endif
-#   if defined DIM_4d
-#      define ARRAY_IN(i,j,k,l,f)   ptab(i,j,k,l)
-#      define K_SIZE(ptab)          SIZE(ptab,3)
-#      define L_SIZE(ptab)          SIZE(ptab,4)
-#   endif
-#endif
 
-# if defined SINGLE_PRECISION
-#    define PRECISION sp
-#    define SENDROUTINE mppsend_sp
-#    define RECVROUTINE mpprecv_sp
-#    define MPI_TYPE MPI_REAL
-#    define HUGEVAL(x)   HUGE(x/**/_sp)
-# else
-#    define PRECISION dp
-#    define SENDROUTINE mppsend_dp
-#    define RECVROUTINE mpprecv_dp
-#    define MPI_TYPE MPI_DOUBLE_PRECISION
-#    define HUGEVAL(x)   HUGE(x/**/_dp)
-# endif
-
-   SUBROUTINE ROUTINE_NFD( ptab, cd_nat, psgn, kfillmode, pfillval, kfld )
-      !!----------------------------------------------------------------------
-      ARRAY_TYPE(:,:,:,:,:)   ! array or pointer of arrays on which the boundary condition is applied
-      CHARACTER(len=1) , INTENT(in   ) ::   NAT_IN(:)   ! nature of array grid-points
-      REAL(wp)         , INTENT(in   ) ::   SGN_IN(:)   ! sign used across the north fold boundary
-      INTEGER          , INTENT(in   ) ::   kfillmode   ! filling method for halo over land 
-      REAL(wp)         , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
-      INTEGER, OPTIONAL, INTENT(in   ) ::   kfld        ! number of pt3d arrays
+   SUBROUTINE mpp_nfd_/**/PRECISION( ptab, cd_nat, psgn, kfillmode, pfillval, khls, kfld )
+      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
+      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
+      REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
+      INTEGER                       , INTENT(in   ) ::   kfillmode   ! filling method for halo over land 
+      REAL(PRECISION)               , INTENT(in   ) ::   pfillval    ! background value (used at closed boundaries)
+      INTEGER                       , INTENT(in   ) ::   khls        ! halo size, default = nn_hls
+      INTEGER                       , INTENT(in   ) ::   kfld        ! number of pt3d arrays
       !
       LOGICAL  ::   ll_add_line
@@ -95,5 +19,4 @@
       INTEGER, DIMENSION (jpmaxngh)       ::   ml_req_nf   ! for mpi_isend when avoiding mpi_allgather
       INTEGER                             ::   ml_err      ! for mpi_isend when avoiding mpi_allgather
-      INTEGER, DIMENSION(MPI_STATUS_SIZE) ::   ml_stat     ! for mpi_isend when avoiding mpi_allgather
       !                                                    ! Workspace for message transfers avoiding mpi_allgather
       INTEGER                             ::   ipj_b       ! sum of lines for all multi fields
@@ -103,13 +26,14 @@
       INTEGER , DIMENSION(:)          , ALLOCATABLE ::   ipj_s ! number of sent lines
       REAL(PRECISION), DIMENSION(:,:,:,:)    , ALLOCATABLE ::   ztabb, ztabr, ztabw  ! buffer, receive and work arrays
-      REAL(PRECISION), DIMENSION(:,:,:,:,:)  , ALLOCATABLE ::   ztabglo, znorthloc
+      REAL(PRECISION), DIMENSION(:,:,:,:,:)  , ALLOCATABLE ::   znorthloc
       REAL(PRECISION), DIMENSION(:,:,:,:,:,:), ALLOCATABLE ::   znorthglo
+      TYPE(PTR_4D_/**/PRECISION), DIMENSION(:), ALLOCATABLE ::   ztabglo        ! array or pointer of arrays on which apply the b.c.
       !!----------------------------------------------------------------------
       !
-      ipk = K_SIZE(ptab)   ! 3rd dimension
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
+      ipk = SIZE(ptab(1)%pt4d,3)
+      ipl = SIZE(ptab(1)%pt4d,4)
+      ipf = kfld
       !
-      IF( l_north_nogather ) THEN      !==  no allgather exchanges  ==!
+      IF( ln_nnogather ) THEN      !==  no allgather exchanges  ==!
 
          !   ---   define number of exchanged lines   ---
@@ -118,12 +42,12 @@
          !
          ! However, some other points are duplicated in the north pole folding:
-         !  - jperio=[34], grid=T : half of the last line (jpiglo/2+2:jpiglo-nn_hls)
-         !  - jperio=[34], grid=U : half of the last line (jpiglo/2+1:jpiglo-nn_hls)
-         !  - jperio=[34], grid=V : all the last line nn_hls+1 and (nn_hls+2:jpiglo-nn_hls)
-         !  - jperio=[34], grid=F : all the last line (nn_hls+1:jpiglo-nn_hls)
-         !  - jperio=[56], grid=T : 2 points of the last line (jpiglo/2+1 and jpglo-nn_hls)
-         !  - jperio=[56], grid=U : no points are duplicated
-         !  - jperio=[56], grid=V : half of the last line (jpiglo/2+1:jpiglo-nn_hls)
-         !  - jperio=[56], grid=F : half of the last line (jpiglo/2+1:jpiglo-nn_hls-1)
+         !  - c_NFtype='T', grid=T : half of the last line (jpiglo/2+2:jpiglo-nn_hls)
+         !  - c_NFtype='T', grid=U : half of the last line (jpiglo/2+1:jpiglo-nn_hls)
+         !  - c_NFtype='T', grid=V : all the last line nn_hls+1 and (nn_hls+2:jpiglo-nn_hls)
+         !  - c_NFtype='T', grid=F : all the last line (nn_hls+1:jpiglo-nn_hls)
+         !  - c_NFtype='F', grid=T : 2 points of the last line (jpiglo/2+1 and jpglo-nn_hls)
+         !  - c_NFtype='F', grid=U : no points are duplicated
+         !  - c_NFtype='F', grid=V : half of the last line (jpiglo/2+1:jpiglo-nn_hls)
+         !  - c_NFtype='F', grid=F : half of the last line (jpiglo/2+1:jpiglo-nn_hls-1)
          ! The order of the calculations may differ for these duplicated points (as, for example jj+1 becomes jj-1)
          ! This explain why these duplicated points may have different values even if they are at the exact same location.
@@ -141,8 +65,8 @@
          IF( ll_add_line ) THEN
             DO jf = 1, ipf                      ! Loop over the number of arrays to be processed
-               ipj_s(jf) = nn_hls + COUNT( (/ npolj == 3 .OR. npolj == 4 .OR. NAT_IN(jf) == 'V' .OR. NAT_IN(jf) == 'F' /) ) 
+               ipj_s(jf) = khls + COUNT( (/ c_NFtype == 'T' .OR. cd_nat(jf) == 'V' .OR. cd_nat(jf) == 'F' /) ) 
             END DO
          ELSE
-            ipj_s(:) = nn_hls
+            ipj_s(:) = khls
          ENDIF
          
@@ -155,21 +79,21 @@
          DO jf = 1, ipf                      ! Loop over the number of arrays to be processed
             !
-            SELECT CASE ( npolj )
-            CASE ( 3, 4 )                       ! *  North fold  T-point pivot
-               SELECT CASE ( NAT_IN(jf) )
+            IF( c_NFtype == 'T' ) THEN          ! *  North fold  T-point pivot
+               SELECT CASE ( cd_nat(jf) )
                CASE ( 'T', 'W', 'U' )   ;   i012 = 1   ! T-, U-, W-point
                CASE ( 'V', 'F'      )   ;   i012 = 2   ! V-, F-point
                END SELECT
-            CASE ( 5, 6 )                       ! *  North fold  F-point pivot
-               SELECT CASE ( NAT_IN(jf) )
+            ENDIF
+            IF( c_NFtype == 'F' ) THEN          ! *  North fold  F-point pivot
+               SELECT CASE ( cd_nat(jf) )
                CASE ( 'T', 'W', 'U' )   ;   i012 = 0   ! T-, U-, W-point
                CASE ( 'V', 'F'      )   ;   i012 = 1   ! V-, F-point
                END SELECT
-            END SELECT
+            ENDIF
                !
             DO jj = 1, ipj_s(jf)
                ij1 = ij1 + 1
                jj_b(jj,jf) = ij1
-               jj_s(jj,jf) = jpj - 2*nn_hls + jj - i012
+               jj_s(jj,jf) = jpj - 2*khls + jj - i012
             END DO
             !
@@ -184,8 +108,8 @@
                ij2 = jj_s(jj,jf)
                DO ji = 1, jpi
-                  ztabb(ji,ij1,jk,jl) = ARRAY_IN(ji,ij2,jk,jl,jf)
+                  ztabb(ji,ij1,jk,jl) = ptab(jf)%pt4d(ji,ij2,jk,jl)
                END DO
                DO ji = jpi+1, jpimax
-                  ztabb(ji,ij1,jk,jl) = HUGEVAL(0.)   ! avoid sending uninitialized values (make sure we don't use it)
+                  ztabb(ji,ij1,jk,jl) = HUGE(0._/**/PRECISION)   ! avoid sending uninitialized values (make sure we don't use it)
                END DO
             END DO
@@ -199,5 +123,7 @@
             iproc = nfproc(isendto(jr))
             IF( iproc /= narea-1 .AND. iproc /= -1 ) THEN
-               CALL SENDROUTINE( 5, ztabb, ibuffsize, iproc, ml_req_nf(jr) )
+#if ! defined key_mpi_off
+               CALL MPI_ISEND( ztabb, ibuffsize, MPI_TYPE, iproc, 5, mpi_comm_oce, ml_req_nf(jr), ierr )
+#endif
             ENDIF
          END DO
@@ -212,9 +138,9 @@
             ipi   = nfjpi (ipni)
             !
-            IF( ipni ==   1  ) THEN   ;   iis0 =   1            ! domain  left side: as e-w comm already done -> from 1st column
-            ELSE                      ;   iis0 =   1 + nn_hls   ! default: -> from inner domain 
-            ENDIF
-            IF( ipni == jpni ) THEN   ;   iie0 = ipi            ! domain right side: as e-w comm already done -> until last column
-            ELSE                      ;   iie0 = ipi - nn_hls   ! default: -> until inner domain 
+            IF( ipni ==   1  ) THEN   ;   iis0 =   1          ! domain  left side: as e-w comm already done -> from 1st column
+            ELSE                      ;   iis0 =   1 + khls   ! default: -> from inner domain 
+            ENDIF
+            IF( ipni == jpni ) THEN   ;   iie0 = ipi          ! domain right side: as e-w comm already done -> until last column
+            ELSE                      ;   iie0 = ipi - khls   ! default: -> until inner domain 
             ENDIF
             impp = nfimpp(ipni) - nfimpp(isendto(1))
@@ -230,5 +156,5 @@
                         ij2 = jj_s(jj,jf)
                         DO ji = iis0, iie0
-                           ztabr(impp+ji,ij1,jk,jl) = ARRAY_IN(Nis0,ij2,jk,jl,jf)   ! chose to take the 1st iner domain point
+                           ztabr(impp+ji,ij1,jk,jl) = ptab(jf)%pt4d(Nis0,ij2,jk,jl)   ! chose to take the 1st iner domain point
                         END DO
                      END DO
@@ -251,5 +177,5 @@
                      ij2 = jj_s(jj,jf)
                      DO ji = iis0, iie0
-                        ztabr(impp+ji,ij1,jk,jl) = ARRAY_IN(ji,ij2,jk,jl,jf)
+                        ztabr(impp+ji,ij1,jk,jl) = ptab(jf)%pt4d(ji,ij2,jk,jl)
                      END DO
                   END DO
@@ -258,5 +184,7 @@
             ELSE                               ! get data from a neighbour trough communication
                !  
-               CALL RECVROUTINE(5, ztabw, ibuffsize, iproc)
+#if ! defined key_mpi_off
+               CALL MPI_RECV( ztabw, ibuffsize, MPI_TYPE, iproc, 5, mpi_comm_oce, MPI_STATUS_IGNORE, ierr )
+#endif
                DO jl = 1, ipl   ;   DO jk = 1, ipk
                   DO jj = 1, ipj_b
@@ -278,5 +206,5 @@
             ij1 = jj_b(       1 ,jf)
             ij2 = jj_b(ipj_s(jf),jf)
-            CALL lbc_nfd_nogather( ARRAY_IN(:,:,:,:,jf), ztabr(:,ij1:ij2,:,:), cd_nat LBC_ARG, psgn LBC_ARG )
+            CALL lbc_nfd_nogather( ptab(jf)%pt4d(:,:,:,:), ztabr(:,ij1:ij2,:,:), cd_nat(jf), psgn(jf), khls )
          END DO
          !
@@ -286,5 +214,5 @@
             iproc = nfproc(isendto(jr))
             IF( iproc /= narea-1 .AND. iproc /= -1 ) THEN
-               CALL mpi_wait( ml_req_nf(jr), ml_stat, ml_err )   ! put the wait at the very end just before the deallocate
+               CALL mpi_wait( ml_req_nf(jr), MPI_STATUS_IGNORE, ml_err )   ! put the wait at the very end just before the deallocate
             ENDIF
          END DO
@@ -294,9 +222,9 @@
          !
          ! how many lines do we exchange at max? -> ipj    (no further optimizations in this case...)
-         ipj =      nn_hls + 2
+         ipj =      khls + 2
          ! how many lines do we     need at max? -> ipj2   (no further optimizations in this case...)
-         ipj2 = 2 * nn_hls + 2
-         !
-         i0max = jpimax - 2 * nn_hls
+         ipj2 = 2 * khls + 2
+         !
+         i0max = jpimax - 2 * khls
          ibuffsize = i0max * ipj * ipk * ipl * ipf
          ALLOCATE( znorthloc(i0max,ipj,ipk,ipl,ipf), znorthglo(i0max,ipj,ipk,ipl,ipf,ndim_rank_north) )
@@ -307,8 +235,8 @@
                DO ji = 1, Ni_0
                   ii2 = Nis0 - 1 + ji                       ! inner domain: Nis0 to Nie0
-                  znorthloc(ji,jj,jk,jl,jf) = ARRAY_IN(ii2,ij2,jk,jl,jf)
+                  znorthloc(ji,jj,jk,jl,jf) = ptab(jf)%pt4d(ii2,ij2,jk,jl)
                END DO
                DO ji = Ni_0+1, i0max
-                  znorthloc(ji,jj,jk,jl,jf) = HUGEVAL(0.)   ! avoid sending uninitialized values (make sure we don't use it)
+                  znorthloc(ji,jj,jk,jl,jf) = HUGE(0._/**/PRECISION)   ! avoid sending uninitialized values (make sure we don't use it)
                END DO
             END DO
@@ -323,12 +251,15 @@
          IF( ln_timing ) CALL tic_tac(.FALSE.)
          DEALLOCATE( znorthloc )
-         ALLOCATE( ztabglo(jpiglo,ipj2,ipk,ipl,ipf) )
-         !
-         ! need to fill only the first ipj lines of ztabglo as lbc_nfd don't use the last nn_hls lines
+         ALLOCATE( ztabglo(ipf) )
+         DO jf = 1, ipf
+            ALLOCATE( ztabglo(jf)%pt4d(jpiglo,ipj2,ipk,ipl) )
+         END DO
+         !
+         ! need to fill only the first ipj lines of ztabglo as lbc_nfd don't use the last khls lines
          ijnr = 0
          DO jr = 1, jpni                                                        ! recover the global north array
             iproc = nfproc(jr)
             impp  = nfimpp(jr)
-            ipi   = nfjpi( jr) - 2 * nn_hls                       ! corresponds to Ni_0 but for subdomain iproc
+            ipi   = nfjpi( jr) - 2 * khls                       ! corresponds to Ni_0 but for subdomain iproc
             IF( iproc == -1 ) THEN   ! No neighbour (land proc that was suppressed)
               !
@@ -340,6 +271,6 @@
                         ij2 = jpj - ipj2 + jj                    ! the first ipj lines of the last ipj2 lines
                         DO ji = 1, ipi
-                           ii1 = impp + nn_hls + ji - 1          ! corresponds to mig(nn_hls + ji) but for subdomain iproc
-                           ztabglo(ii1,jj,jk,jl,jf) = ARRAY_IN(Nis0,ij2,jk,jl,jf)   ! chose to take the 1st iner domain point
+                           ii1 = impp + khls + ji - 1            ! corresponds to mig(khls + ji) but for subdomain iproc
+                           ztabglo(jf)%pt4d(ii1,jj,jk,jl) = ptab(jf)%pt4d(Nis0,ij2,jk,jl) ! chose to take the 1st inner domain point
                         END DO
                      END DO
@@ -349,6 +280,6 @@
                      DO jj = 1, ipj
                         DO ji = 1, ipi
-                           ii1 = impp + nn_hls + ji - 1          ! corresponds to mig(nn_hls + ji) but for subdomain iproc
-                           ztabglo(ii1,jj,jk,jl,jf) = pfillval
+                           ii1 = impp + khls + ji - 1            ! corresponds to mig(khls + ji) but for subdomain iproc
+                           ztabglo(jf)%pt4d(ii1,jj,jk,jl) = pfillval
                         END DO
                      END DO
@@ -361,6 +292,6 @@
                   DO jj = 1, ipj
                      DO ji = 1, ipi
-                        ii1 = impp + nn_hls + ji - 1             ! corresponds to mig(nn_hls + ji) but for subdomain iproc
-                        ztabglo(ii1,jj,jk,jl,jf) = znorthglo(ji,jj,jk,jl,jf,ijnr)
+                        ii1 = impp + khls + ji - 1               ! corresponds to mig(khls + ji) but for subdomain iproc
+                        ztabglo(jf)%pt4d(ii1,jj,jk,jl) = znorthglo(ji,jj,jk,jl,jf,ijnr)
                      END DO
                   END DO
@@ -372,10 +303,10 @@
          !
          DO jf = 1, ipf
-            CALL lbc_nfd( ztabglo(:,:,:,:,jf), cd_nat LBC_ARG, psgn LBC_ARG )   ! North fold boundary condition
+            CALL lbc_nfd( ztabglo(jf:jf), cd_nat(jf:jf), psgn(jf:jf), khls, 1 )   ! North fold boundary condition
             DO jl = 1, ipl   ;   DO jk = 1, ipk                  ! e-w periodicity
-               DO jj = 1, nn_hls + 1
-                  ij1 = ipj2 - (nn_hls + 1) + jj                 ! need only the last nn_hls + 1 lines until ipj2
-                  ztabglo(              1:nn_hls,ij1,jk,jl,jf) = ztabglo(jpiglo-2*nn_hls+1:jpiglo-nn_hls,ij1,jk,jl,jf)
-                  ztabglo(jpiglo-nn_hls+1:jpiglo,ij1,jk,jl,jf) = ztabglo(         nn_hls+1:     2*nn_hls,ij1,jk,jl,jf)
+               DO jj = 1, khls + 1
+                  ij1 = ipj2 - (khls + 1) + jj                   ! need only the last khls + 1 lines until ipj2
+                  ztabglo(jf)%pt4d(            1:  khls,ij1,jk,jl) = ztabglo(jf)%pt4d(jpiglo-2*khls+1:jpiglo-khls,ij1,jk,jl)
+                  ztabglo(jf)%pt4d(jpiglo-khls+1:jpiglo,ij1,jk,jl) = ztabglo(jf)%pt4d(         khls+1:     2*khls,ij1,jk,jl)
                END DO
             END DO   ;   END DO
@@ -383,31 +314,21 @@
          !
          DO jf = 1, ipf   ;   DO jl = 1, ipl   ;   DO jk = 1, ipk               ! Scatter back to ARRAY_IN
-            DO jj = 1, nn_hls + 1
-               ij1 = jpj  - (nn_hls + 1) + jj   ! last nn_hls + 1 lines until jpj
-               ij2 = ipj2 - (nn_hls + 1) + jj   ! last nn_hls + 1 lines until ipj2
+            DO jj = 1, khls + 1
+               ij1 = jpj  - (khls + 1) + jj   ! last khls + 1 lines until jpj
+               ij2 = ipj2 - (khls + 1) + jj   ! last khls + 1 lines until ipj2
                DO ji= 1, jpi
                   ii2 = mig(ji)
-                  ARRAY_IN(ji,ij1,jk,jl,jf) = ztabglo(ii2,ij2,jk,jl,jf)
+                  ptab(jf)%pt4d(ji,ij1,jk,jl) = ztabglo(jf)%pt4d(ii2,ij2,jk,jl)
                END DO
             END DO
          END DO   ;   END DO   ;   END DO
          !
+         DO jf = 1, ipf
+            DEALLOCATE( ztabglo(jf)%pt4d )
+         END DO
          DEALLOCATE( ztabglo )
          !
       ENDIF   ! l_north_nogather
       !
-   END SUBROUTINE ROUTINE_NFD
+   END SUBROUTINE mpp_nfd_/**/PRECISION
 
-#undef PRECISION
-#undef MPI_TYPE
-#undef SENDROUTINE
-#undef RECVROUTINE
-#undef ARRAY_TYPE
-#undef NAT_IN
-#undef SGN_IN
-#undef ARRAY_IN
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
-#undef LBC_ARG
-#undef HUGEVAL
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mppini.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mppini.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LBC/mppini.F90	(revision 14676)
@@ -69,8 +69,5 @@
       jpi    = jpiglo
       jpj    = jpjglo
-      jpk    = jpkglo
-      jpim1  = jpi-1                         ! inner domain indices
-      jpjm1  = jpj-1                         !   "           "
-      jpkm1  = MAX( 1, jpk-1 )               !   "           "
+      jpk    = MAX( 2, jpkglo )
       jpij   = jpi*jpj
       jpni   = 1
@@ -79,12 +76,5 @@
       nimpp  = 1
       njmpp  = 1
-      nbondi = 2
-      nbondj = 2
       nidom  = FLIO_DOM_NONE
-      npolj = 0
-      IF( jperio == 3 .OR. jperio == 4 )   npolj = 3
-      IF( jperio == 5 .OR. jperio == 6 )   npolj = 5
-      l_Iperio = jpni == 1 .AND. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7)
-      l_Jperio = jpnj == 1 .AND. (jperio == 2 .OR. jperio == 7)
       !
       CALL init_doloop                       ! set start/end indices or do-loop depending on the halo width value (nn_hls)
@@ -95,5 +85,5 @@
          WRITE(numout,*) '~~~~~~~~ '
          WRITE(numout,*) '   l_Iperio = ', l_Iperio, '    l_Jperio = ', l_Jperio
-         WRITE(numout,*) '     npolj  = ',   npolj , '      njmpp  = ', njmpp
+         WRITE(numout,*) '     njmpp  = ', njmpp
       ENDIF
       !
@@ -123,7 +113,5 @@
       !! ** Method  :   Global domain is distributed in smaller local domains.
       !!      Periodic condition is a function of the local domain position
-      !!      (global boundary or neighbouring domain) and of the global
-      !!      periodic
-      !!      Type :         jperio global periodic condition
+      !!      (global boundary or neighbouring domain) and of the global periodic
       !!
       !! ** Action : - set domain parameters
@@ -131,32 +119,25 @@
       !!                    njmpp     : latitudinal  index
       !!                    narea     : number for local area
-      !!                    nbondi    : mark for "east-west local boundary"
-      !!                    nbondj    : mark for "north-south local boundary"
-      !!                    noea      : number for local neighboring processor
-      !!                    nowe      : number for local neighboring processor
-      !!                    noso      : number for local neighboring processor
-      !!                    nono      : number for local neighboring processor
-      !!----------------------------------------------------------------------
-      INTEGER ::   ji, jj, jn, jproc, jarea   ! dummy loop indices
-      INTEGER ::   inijmin
-      INTEGER ::   inum                       ! local logical unit
-      INTEGER ::   idir, ifreq                ! local integers
-      INTEGER ::   ii, il1, ili, imil         !   -       -
-      INTEGER ::   ij, il2, ilj, ijm1         !   -       -
-      INTEGER ::   iino, ijno, iiso, ijso     !   -       -
-      INTEGER ::   iiea, ijea, iiwe, ijwe     !   -       -
-      INTEGER ::   iarea0                     !   -       -
-      INTEGER ::   ierr, ios                  !
-      INTEGER ::   inbi, inbj, iimax,  ijmax, icnt1, icnt2
+      !!                    mpinei    : number of neighboring domains (starting at 0, -1 if no neighbourg)
+      !!----------------------------------------------------------------------
+      INTEGER ::   ji, jj, jn, jp, jh
+      INTEGER ::   ii, ij, ii2, ij2
+      INTEGER ::   inijmin   ! number of oce subdomains
+      INTEGER ::   inum, inum0
+      INTEGER ::   ifreq, il1, imil, il2, ijm1
+      INTEGER ::   ierr, ios
+      INTEGER ::   inbi, inbj, iimax, ijmax, icnt1, icnt2
+      INTEGER, DIMENSION(16*n_hlsmax) :: ichanged
+      INTEGER, ALLOCATABLE, DIMENSION(:    ) ::   iin, ijn
+      INTEGER, ALLOCATABLE, DIMENSION(:,:  ) ::   iimppt, ijpi, ipproc
+      INTEGER, ALLOCATABLE, DIMENSION(:,:  ) ::   ijmppt, ijpj
+      INTEGER, ALLOCATABLE, DIMENSION(:,:  ) ::   impi
+      INTEGER, ALLOCATABLE, DIMENSION(:,:,:) ::   inei
       LOGICAL ::   llbest, llauto
       LOGICAL ::   llwrtlay
+      LOGICAL ::   llmpi_Iperio, llmpi_Jperio, llmpiNFold
       LOGICAL ::   ln_listonly
-      INTEGER, ALLOCATABLE, DIMENSION(:)     ::   iin, ii_nono, ii_noea          ! 1D workspace
-      INTEGER, ALLOCATABLE, DIMENSION(:)     ::   ijn, ii_noso, ii_nowe          !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iimppt, ijpi, ibondi, ipproc   ! 2D workspace
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ijmppt, ijpj, ibondj, ipolj    !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   iie0, iis0, iono, ioea         !  -     -
-      INTEGER, ALLOCATABLE, DIMENSION(:,:) ::   ije0, ijs0, ioso, iowe         !  -     -
-      LOGICAL, ALLOCATABLE, DIMENSION(:,:) ::   llisoce                        !  -     -
+      LOGICAL, ALLOCATABLE, DIMENSION(:,:  ) ::   llisOce  ! is not land-domain only?
+      LOGICAL, ALLOCATABLE, DIMENSION(:,:,:) ::   llnei    ! are neighbourgs existing?
       NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file,           &
            &             ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta,     &
@@ -165,5 +146,5 @@
            &             cn_ice, nn_ice_dta,                                     &
            &             ln_vol, nn_volctl, nn_rimwidth
-      NAMELIST/nammpp/ jpni, jpnj, nn_hls, ln_nnogather, ln_listonly
+      NAMELIST/nammpp/ jpni, jpnj, nn_hls, ln_nnogather, ln_listonly, nn_comm
       !!----------------------------------------------------------------------
       !
@@ -193,7 +174,4 @@
       IF(lwm)   WRITE( numond, nammpp )
       !
-!!!------------------------------------
-!!!  nn_hls shloud be read in nammpp
-!!!------------------------------------
       jpiglo = Ni0glo + 2 * nn_hls
       jpjglo = Nj0glo + 2 * nn_hls
@@ -213,5 +191,5 @@
       ! -----------------------------------
       !
-      ! If dimensions of processors grid weren't specified in the namelist file
+      ! If dimensions of MPI processes grid weren't specified in the namelist file
       ! then we calculate them here now that we have our communicator size
       IF(lwp) THEN
@@ -260,7 +238,7 @@
 
       ! look for land mpi subdomains...
-      ALLOCATE( llisoce(jpni,jpnj) )
-      CALL mpp_is_ocean( llisoce )
-      inijmin = COUNT( llisoce )   ! number of oce subdomains
+      ALLOCATE( llisOce(jpni,jpnj) )
+      CALL mpp_is_ocean( llisOce )
+      inijmin = COUNT( llisOce )   ! number of oce subdomains
 
       IF( mppsize < inijmin ) THEN   ! too many oce subdomains: can happen only if jpni and jpnj are prescribed...
@@ -319,15 +297,10 @@
 9003  FORMAT (a, i5)
 
-      ALLOCATE(  nfimpp(jpni ) , nfproc(jpni ) ,   nfjpi(jpni ) ,                     &
-         &       nimppt(jpnij) , ibonit(jpnij) ,  jpiall(jpnij) ,  jpjall(jpnij) ,    &
-         &       njmppt(jpnij) , ibonjt(jpnij) , nis0all(jpnij) , njs0all(jpnij) ,    &
-         &                                       nie0all(jpnij) , nje0all(jpnij) ,    &
-         &       iin(jpnij), ii_nono(jpnij), ii_noea(jpnij),   &
-         &       ijn(jpnij), ii_noso(jpnij), ii_nowe(jpnij),   &
-         &       iimppt(jpni,jpnj), ijpi(jpni,jpnj), ibondi(jpni,jpnj), ipproc(jpni,jpnj),   &
-         &       ijmppt(jpni,jpnj), ijpj(jpni,jpnj), ibondj(jpni,jpnj),  ipolj(jpni,jpnj),   &
-         &         iie0(jpni,jpnj), iis0(jpni,jpnj),   iono(jpni,jpnj),   ioea(jpni,jpnj),   &
-         &         ije0(jpni,jpnj), ijs0(jpni,jpnj),   ioso(jpni,jpnj),   iowe(jpni,jpnj),   &
-         &       STAT=ierr )
+      ALLOCATE( nfimpp(jpni), nfproc(jpni), nfjpi(jpni),   &
+         &      iin(jpnij), ijn(jpnij),   &
+         &      iimppt(jpni,jpnj), ijmppt(jpni,jpnj), ijpi(jpni,jpnj), ijpj(jpni,jpnj), ipproc(jpni,jpnj),   &
+         &      inei(8,jpni,jpnj), llnei(8,jpni,jpnj),   &
+         &      impi(8,jpnij),   &
+         &      STAT=ierr )
       CALL mpp_sum( 'mppini', ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'mpp_init: unable to allocate standard ocean arrays' )
@@ -343,17 +316,16 @@
       !
       CALL mpp_basesplit( jpiglo, jpjglo, nn_hls, jpni, jpnj, jpimax, jpjmax, iimppt, ijmppt, ijpi, ijpj )
-      CALL mpp_getnum( llisoce, ipproc, iin, ijn )
-      !
-      !DO jn = 1, jpni
-      !   jproc = ipproc(jn,jpnj)
-      !   ii = iin(jproc+1)
-      !   ij = ijn(jproc+1)
-      !   nfproc(jn) = jproc
-      !   nfimpp(jn) = iimppt(ii,ij)
-      !   nfjpi (jn) =   ijpi(ii,ij)
-      !END DO
-      nfproc(:) = ipproc(:,jpnj)
-      nfimpp(:) = iimppt(:,jpnj)
-      nfjpi (:) =   ijpi(:,jpnj)
+      CALL mpp_getnum( llisOce, ipproc, iin, ijn )
+      !
+      ii = iin(narea)
+      ij = ijn(narea)
+      jpi   = ijpi(ii,ij)
+      jpj   = ijpj(ii,ij)
+      jpk   = MAX( 2, jpkglo )
+      jpij  = jpi*jpj
+      nimpp = iimppt(ii,ij)
+      njmpp = ijmppt(ii,ij)
+      !
+      CALL init_doloop                          ! set start/end indices of do-loop, depending on the halo width value (nn_hls)
       !
       IF(lwp) THEN
@@ -365,120 +337,11 @@
          WRITE(numout,*) '      jpnj = ', jpnj
          WRITE(numout,*) '     jpnij = ', jpnij
+         WRITE(numout,*) '     nimpp = ', nimpp
+         WRITE(numout,*) '     njmpp = ', njmpp
          WRITE(numout,*)
          WRITE(numout,*) '      sum ijpi(i,1) = ', sum(ijpi(:,1)), ' jpiglo = ', jpiglo
-         WRITE(numout,*) '      sum ijpj(1,j) = ', sum(ijpj(1,:)), ' jpjglo = ', jpjglo
-      ENDIF
-
-      ! 3. Subdomain description in the Regular Case
-      ! --------------------------------------------
-      ! specific cases where there is no communication -> must do the periodicity by itself
-      ! Warning: because of potential land-area suppression, do not use nbond[ij] == 2
-      l_Iperio = jpni == 1 .AND. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7)
-      l_Jperio = jpnj == 1 .AND. (jperio == 2 .OR. jperio == 7)
-
-      DO jarea = 1, jpni*jpnj
-         !
-         iarea0 = jarea - 1
-         ii = 1 + MOD(iarea0,jpni)
-         ij = 1 +     iarea0/jpni
-         ili = ijpi(ii,ij)
-         ilj = ijpj(ii,ij)
-         ibondi(ii,ij) = 0                         ! default: has e-w neighbours
-         IF( ii   ==    1 )   ibondi(ii,ij) = -1   ! first column, has only e neighbour
-         IF( ii   == jpni )   ibondi(ii,ij) =  1   ! last column,  has only w neighbour
-         IF( jpni ==    1 )   ibondi(ii,ij) =  2   ! has no e-w neighbour
-         ibondj(ii,ij) = 0                         ! default: has n-s neighbours
-         IF( ij   ==    1 )   ibondj(ii,ij) = -1   ! first row, has only n neighbour
-         IF( ij   == jpnj )   ibondj(ii,ij) =  1   ! last row,  has only s neighbour
-         IF( jpnj ==    1 )   ibondj(ii,ij) =  2   ! has no n-s neighbour
-
-         ! Subdomain neighbors (get their zone number): default definition
-         ioso(ii,ij) = iarea0 - jpni
-         iowe(ii,ij) = iarea0 - 1
-         ioea(ii,ij) = iarea0 + 1
-         iono(ii,ij) = iarea0 + jpni
-         iis0(ii,ij) =  1  + nn_hls
-         iie0(ii,ij) = ili - nn_hls
-         ijs0(ii,ij) =  1  + nn_hls
-         ije0(ii,ij) = ilj - nn_hls
-
-         ! East-West periodicity: change ibondi, ioea, iowe
-         IF( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7 ) THEN
-            IF( jpni  /= 1 )   ibondi(ii,ij) = 0                        ! redefine: all have e-w neighbours
-            IF( ii ==    1 )   iowe(ii,ij) = iarea0 +        (jpni-1)   ! redefine: first column, address of w neighbour
-            IF( ii == jpni )   ioea(ii,ij) = iarea0 -        (jpni-1)   ! redefine: last column,  address of e neighbour
-         ENDIF
-
-         ! Simple North-South periodicity: change ibondj, ioso, iono
-         IF( jperio == 2 .OR. jperio == 7 ) THEN
-            IF( jpnj  /= 1 )   ibondj(ii,ij) = 0                        ! redefine: all have n-s neighbours
-            IF( ij ==    1 )   ioso(ii,ij) = iarea0 + jpni * (jpnj-1)   ! redefine: first row, address of s neighbour
-            IF( ij == jpnj )   iono(ii,ij) = iarea0 - jpni * (jpnj-1)   ! redefine: last row,  address of n neighbour
-         ENDIF
-
-         ! North fold: define ipolj, change iono. Warning: we do not change ibondj...
-         ipolj(ii,ij) = 0
-         IF( jperio == 3 .OR. jperio == 4 ) THEN
-            ijm1 = jpni*(jpnj-1)
-            imil = ijm1+(jpni+1)/2
-            IF( jarea > ijm1 ) ipolj(ii,ij) = 3
-            IF( MOD(jpni,2) == 1 .AND. jarea == imil ) ipolj(ii,ij) = 4
-            IF( ipolj(ii,ij) == 3 ) iono(ii,ij) = jpni*jpnj-jarea+ijm1   ! MPI rank of northern neighbour
-         ENDIF
-         IF( jperio == 5 .OR. jperio == 6 ) THEN
-            ijm1 = jpni*(jpnj-1)
-            imil = ijm1+(jpni+1)/2
-            IF( jarea > ijm1) ipolj(ii,ij) = 5
-            IF( MOD(jpni,2) == 1 .AND. jarea == imil ) ipolj(ii,ij) = 6
-            IF( ipolj(ii,ij) == 5) iono(ii,ij) = jpni*jpnj-jarea+ijm1    ! MPI rank of northern neighbour
-         ENDIF
-         !
-      END DO
-
-      ! 4. deal with land subdomains
-      ! ----------------------------
-      !
-      ! neighbour treatment: change ibondi, ibondj if next to a land zone
-      DO jarea = 1, jpni*jpnj
-         ii = 1 + MOD( jarea-1  , jpni )
-         ij = 1 +     (jarea-1) / jpni
-         ! land-only area with an active n neigbour
-         IF ( ipproc(ii,ij) == -1 .AND. 0 <= iono(ii,ij) .AND. iono(ii,ij) <= jpni*jpnj-1 ) THEN
-            iino = 1 + MOD( iono(ii,ij) , jpni )                    ! ii index of this n neigbour
-            ijno = 1 +      iono(ii,ij) / jpni                      ! ij index of this n neigbour
-            ! In case of north fold exchange: I am the n neigbour of my n neigbour!! (#1057)
-            ! --> for northern neighbours of northern row processors (in case of north-fold)
-            !     need to reverse the LOGICAL direction of communication
-            idir = 1                                           ! we are indeed the s neigbour of this n neigbour
-            IF( ij == jpnj .AND. ijno == jpnj )   idir = -1    ! both are on the last row, we are in fact the n neigbour
-            IF( ibondj(iino,ijno) == idir     )   ibondj(iino,ijno) =   2     ! this n neigbour had only a s/n neigbour -> no more
-            IF( ibondj(iino,ijno) == 0        )   ibondj(iino,ijno) = -idir   ! this n neigbour had both, n-s neighbours -> keep 1
-         ENDIF
-         ! land-only area with an active s neigbour
-         IF( ipproc(ii,ij) == -1 .AND. 0 <= ioso(ii,ij) .AND. ioso(ii,ij) <= jpni*jpnj-1 ) THEN
-            iiso = 1 + MOD( ioso(ii,ij) , jpni )                    ! ii index of this s neigbour
-            ijso = 1 +      ioso(ii,ij) / jpni                      ! ij index of this s neigbour
-            IF( ibondj(iiso,ijso) == -1 )   ibondj(iiso,ijso) = 2   ! this s neigbour had only a n neigbour    -> no more neigbour
-            IF( ibondj(iiso,ijso) ==  0 )   ibondj(iiso,ijso) = 1   ! this s neigbour had both, n-s neighbours -> keep s neigbour
-         ENDIF
-         ! land-only area with an active e neigbour
-         IF( ipproc(ii,ij) == -1 .AND. 0 <= ioea(ii,ij) .AND. ioea(ii,ij) <= jpni*jpnj-1 ) THEN
-            iiea = 1 + MOD( ioea(ii,ij) , jpni )                    ! ii index of this e neigbour
-            ijea = 1 +      ioea(ii,ij) / jpni                      ! ij index of this e neigbour
-            IF( ibondi(iiea,ijea) == 1 )   ibondi(iiea,ijea) =  2   ! this e neigbour had only a w neigbour    -> no more neigbour
-            IF( ibondi(iiea,ijea) == 0 )   ibondi(iiea,ijea) = -1   ! this e neigbour had both, e-w neighbours -> keep e neigbour
-         ENDIF
-         ! land-only area with an active w neigbour
-         IF( ipproc(ii,ij) == -1 .AND. 0 <= iowe(ii,ij) .AND. iowe(ii,ij) <= jpni*jpnj-1) THEN
-            iiwe = 1 + MOD( iowe(ii,ij) , jpni )                    ! ii index of this w neigbour
-            ijwe = 1 +      iowe(ii,ij) / jpni                      ! ij index of this w neigbour
-            IF( ibondi(iiwe,ijwe) == -1 )   ibondi(iiwe,ijwe) = 2   ! this w neigbour had only a e neigbour    -> no more neigbour
-            IF( ibondi(iiwe,ijwe) ==  0 )   ibondi(iiwe,ijwe) = 1   ! this w neigbour had both, e-w neighbours -> keep w neigbour
-         ENDIF
-      END DO
-
-      ! 5. Subdomain print
-      ! ------------------
-      IF(lwp) THEN
+         WRITE(numout,*) '      sum ijpj(1,j) = ', SUM(ijpj(1,:)), ' jpjglo = ', jpjglo
+         
+         ! Subdomain grid print
          ifreq = 4
          il1 = 1
@@ -503,224 +366,209 @@
  9404    FORMAT('           *  '   ,20('     ' ,i4,'   *   ') )
       ENDIF
-
-      ! just to save nono etc for all proc
-      ! warning ii*ij (zone) /= mpprank (processors)!
-      ! ioso = zone number, ii_noso = proc number
-      ii_noso(:) = -1
-      ii_nono(:) = -1
-      ii_noea(:) = -1
-      ii_nowe(:) = -1
-      DO jproc = 1, jpnij
-         ii = iin(jproc)
-         ij = ijn(jproc)
-         IF( 0 <= ioso(ii,ij) .AND. ioso(ii,ij) <= (jpni*jpnj-1) ) THEN
-            iiso = 1 + MOD( ioso(ii,ij) , jpni )
-            ijso = 1 +      ioso(ii,ij) / jpni
-            ii_noso(jproc) = ipproc(iiso,ijso)
-         ENDIF
-         IF( 0 <= iowe(ii,ij) .AND. iowe(ii,ij) <= (jpni*jpnj-1) ) THEN
-          iiwe = 1 + MOD( iowe(ii,ij) , jpni )
-          ijwe = 1 +      iowe(ii,ij) / jpni
-          ii_nowe(jproc) = ipproc(iiwe,ijwe)
-         ENDIF
-         IF( 0 <= ioea(ii,ij) .AND. ioea(ii,ij) <= (jpni*jpnj-1) ) THEN
-            iiea = 1 + MOD( ioea(ii,ij) , jpni )
-            ijea = 1 +      ioea(ii,ij) / jpni
-            ii_noea(jproc)= ipproc(iiea,ijea)
-         ENDIF
-         IF( 0 <= iono(ii,ij) .AND. iono(ii,ij) <= (jpni*jpnj-1) ) THEN
-            iino = 1 + MOD( iono(ii,ij) , jpni )
-            ijno = 1 +      iono(ii,ij) / jpni
-            ii_nono(jproc)= ipproc(iino,ijno)
-         ENDIF
-      END DO
-
-      ! 6. Change processor name
-      ! ------------------------
-      ii = iin(narea)
-      ij = ijn(narea)
-      !
-      jpi    = ijpi(ii,ij)
-!!$      Nis0  = iis0(ii,ij)
-!!$      Nie0  = iie0(ii,ij)
-      jpj    = ijpj(ii,ij)
-!!$      Njs0  = ijs0(ii,ij)
-!!$      Nje0  = ije0(ii,ij)
-      nbondi = ibondi(ii,ij)
-      nbondj = ibondj(ii,ij)
-      nimpp = iimppt(ii,ij)
-      njmpp = ijmppt(ii,ij)
-      jpk = jpkglo                              ! third dim
-
-      ! set default neighbours
-      noso = ii_noso(narea)
-      nowe = ii_nowe(narea)
-      noea = ii_noea(narea)
-      nono = ii_nono(narea)
-
-      nones = -1
-      nonws = -1
-      noses = -1
-      nosws = -1
-
-      noner = -1
-      nonwr = -1
-      noser = -1
-      noswr = -1
-
-      IF((nbondi .eq. -1) .or. (nbondi .eq. 0)) THEN ! east neighbour exists
-         IF(ibondj(iin(noea+1),ijn(noea+1)) .eq. 0) THEN
-            nones = ii_nono(noea+1)                  ! east neighbour has north and south neighbours
-            noses = ii_noso(noea+1)
-         ELSEIF(ibondj(iin(noea+1),ijn(noea+1)) .eq. -1) THEN
-            nones = ii_nono(noea+1)                  ! east neighbour has north neighbour
-         ELSEIF(ibondj(iin(noea+1),ijn(noea+1)) .eq. 1) THEN
-            noses = ii_noso(noea+1)                  ! east neighbour has south neighbour
-         END IF
-      END IF
-      IF((nbondi .eq. 1) .or. (nbondi .eq. 0)) THEN  ! west neighbour exists
-         IF(ibondj(iin(nowe+1),ijn(nowe+1)) .eq. 0) THEN
-            nonws = ii_nono(nowe+1)                  ! west neighbour has north and south neighbours
-            nosws = ii_noso(nowe+1)
-         ELSEIF(ibondj(iin(nowe+1),ijn(nowe+1)) .eq. -1) THEN
-            nonws = ii_nono(nowe+1)                  ! west neighbour has north neighbour
-         ELSEIF(ibondj(iin(nowe+1),ijn(nowe+1)) .eq. 1)  THEN
-            nosws = ii_noso(nowe+1)                  ! west neighbour has north neighbour
-         END IF
-      END IF
-
-      IF((nbondj .eq. -1) .or. (nbondj .eq. 0)) THEN ! north neighbour exists
-         IF(ibondi(iin(nono+1),ijn(nono+1)) .eq. 0) THEN
-            noner = ii_noea(nono+1)                  ! north neighbour has east and west neighbours
-            nonwr = ii_nowe(nono+1)
-         ELSEIF(ibondi(iin(nono+1),ijn(nono+1)) .eq. -1) THEN
-            noner = ii_noea(nono+1)                  ! north neighbour has east neighbour
-         ELSEIF(ibondi(iin(nono+1),ijn(nono+1)) .eq. 1) THEN
-            nonwr = ii_nowe(nono+1)                  ! north neighbour has west neighbour
-         END IF
-      END IF
-      IF((nbondj .eq. 1) .or. (nbondj .eq. 0)) THEN  ! south neighbour exists
-         IF(ibondi(iin(noso+1),ijn(noso+1)) .eq. 0) THEN
-            noser = ii_noea(noso+1)                  ! south neighbour has east and west neighbours
-            noswr = ii_nowe(noso+1)
-         ELSEIF(ibondi(iin(noso+1),ijn(noso+1)) .eq. -1) THEN
-            noser = ii_noea(noso+1)                  ! south neighbour has east neighbour
-         ELSEIF(ibondi(iin(noso+1),ijn(noso+1)) .eq. 1) THEN
-            noswr = ii_nowe(noso+1)                  ! south neighbour has west neighbour
-         END IF
-      END IF
-
-      !
-      CALL init_doloop                          ! set start/end indices of do-loop, depending on the halo width value (nn_hls)
-      !
-      jpim1 = jpi-1                             ! inner domain indices
-      jpjm1 = jpj-1                             !   "           "
-      jpkm1 = MAX( 1, jpk-1 )                   !   "           "
-      jpij  = jpi*jpj                           !  jpi x j
-      DO jproc = 1, jpnij
-         ii = iin(jproc)
-         ij = ijn(jproc)
-         jpiall (jproc) = ijpi(ii,ij)
-         nis0all(jproc) = iis0(ii,ij)
-         nie0all(jproc) = iie0(ii,ij)
-         jpjall (jproc) = ijpj(ii,ij)
-         njs0all(jproc) = ijs0(ii,ij)
-         nje0all(jproc) = ije0(ii,ij)
-         ibonit(jproc) = ibondi(ii,ij)
-         ibonjt(jproc) = ibondj(ii,ij)
-         nimppt(jproc) = iimppt(ii,ij)
-         njmppt(jproc) = ijmppt(ii,ij)
-      END DO
-
+      !
+      ! Store informations for the north pole folding communications
+      nfproc(:) = ipproc(:,jpnj)
+      nfimpp(:) = iimppt(:,jpnj)
+      nfjpi (:) =   ijpi(:,jpnj)
+      !
+      ! 3. Define Western, Eastern, Southern and Northern neighbors + corners in the subdomain grid reference
+      ! ------------------------------------------------------------------------------------------------------
+      !
+      ! note that North fold is has specific treatment for its MPI communications.
+      ! This must not be treated as a "usual" communication with a northern neighbor.
+      !    -> North fold processes have no Northern neighbor in the definition done bellow
+      !
+      llmpi_Iperio = jpni > 1 .AND. l_Iperio                         ! do i-periodicity with an MPI communication?
+      llmpi_Jperio = jpnj > 1 .AND. l_Jperio                         ! do j-periodicity with an MPI communication?
+      !
+      l_SelfPerio(1:2) = l_Iperio .AND. jpni == 1                    !  west,  east periodicity by itself
+      l_SelfPerio(3:4) = l_Jperio .AND. jpnj == 1                    ! south, north periodicity by itself
+      l_SelfPerio(5:8) = l_SelfPerio(jpwe) .AND. l_SelfPerio(jpso)   ! corners bi-periodicity by itself
+      !
+      ! define neighbors mapping (1/2): default definition: ignore if neighbours are land-only subdomains or not
+      DO jj = 1, jpnj
+         DO ji = 1, jpni
+            !
+            IF ( llisOce(ji,jj) ) THEN                     ! this subdomain has some ocean: it has neighbours
+               !
+               inum0 = ji - 1 + ( jj - 1 ) * jpni             ! index in the subdomains grid. start at 0
+               !
+               ! Is there a neighbor?
+               llnei(jpwe,ji,jj) = ji >   1  .OR. llmpi_Iperio           ! West  nei exists if not the first column or llmpi_Iperio
+               llnei(jpea,ji,jj) = ji < jpni .OR. llmpi_Iperio           ! East  nei exists if not the last  column or llmpi_Iperio
+               llnei(jpso,ji,jj) = jj >   1  .OR. llmpi_Jperio           ! South nei exists if not the first line   or llmpi_Jperio
+               llnei(jpno,ji,jj) = jj < jpnj .OR. llmpi_Jperio           ! North nei exists if not the last  line   or llmpi_Jperio
+               llnei(jpsw,ji,jj) = llnei(jpwe,ji,jj) .AND. llnei(jpso,ji,jj)   ! So-We nei exists if both South and West nei exist
+               llnei(jpse,ji,jj) = llnei(jpea,ji,jj) .AND. llnei(jpso,ji,jj)   ! So-Ea nei exists if both South and East nei exist
+               llnei(jpnw,ji,jj) = llnei(jpwe,ji,jj) .AND. llnei(jpno,ji,jj)   ! No-We nei exists if both North and West nei exist
+               llnei(jpne,ji,jj) = llnei(jpea,ji,jj) .AND. llnei(jpno,ji,jj)   ! No-Ea nei exists if both North and East nei exist
+               !
+               ! Which index (starting at 0) have neighbors in the subdomains grid?
+               IF( llnei(jpwe,ji,jj) )   inei(jpwe,ji,jj) =            inum0 -    1 + jpni        * COUNT( (/ ji ==    1 /) )
+               IF( llnei(jpea,ji,jj) )   inei(jpea,ji,jj) =            inum0 +    1 - jpni        * COUNT( (/ ji == jpni /) )
+               IF( llnei(jpso,ji,jj) )   inei(jpso,ji,jj) =            inum0 - jpni + jpni * jpnj * COUNT( (/ jj ==    1 /) )
+               IF( llnei(jpno,ji,jj) )   inei(jpno,ji,jj) =            inum0 + jpni - jpni * jpnj * COUNT( (/ jj == jpnj /) )
+               IF( llnei(jpsw,ji,jj) )   inei(jpsw,ji,jj) = inei(jpso,ji,jj) -    1 + jpni        * COUNT( (/ ji ==    1 /) )
+               IF( llnei(jpse,ji,jj) )   inei(jpse,ji,jj) = inei(jpso,ji,jj) +    1 - jpni        * COUNT( (/ ji == jpni /) )
+               IF( llnei(jpnw,ji,jj) )   inei(jpnw,ji,jj) = inei(jpno,ji,jj) -    1 + jpni        * COUNT( (/ ji ==    1 /) )
+               IF( llnei(jpne,ji,jj) )   inei(jpne,ji,jj) = inei(jpno,ji,jj) +    1 - jpni        * COUNT( (/ ji == jpni /) )
+               !
+            ELSE                                           ! land-only domain has no neighbour
+               llnei(:,ji,jj) = .FALSE.
+            ENDIF
+            !
+         END DO
+      END DO
+      !
+      ! define neighbors mapping (2/2): check if neighbours are not land-only subdomains
+      DO jj = 1, jpnj
+         DO ji = 1, jpni
+            DO jn = 1, 8
+               IF( llnei(jn,ji,jj) ) THEN   ! if a neighbour is existing -> this should not be a land-only domain
+                  ii = 1 + MOD( inei(jn,ji,jj) , jpni )
+                  ij = 1 +      inei(jn,ji,jj) / jpni
+                  llnei(jn,ji,jj) = llisOce( ii, ij )
+               ENDIF
+            END DO
+         END DO
+      END DO
+      !
+      ! update index of the neighbours in the subdomains grid
+      WHERE( .NOT. llnei )   inei = -1
+      !
       ! Save processor layout in ascii file
       IF (llwrtlay) THEN
          CALL ctl_opn( inum, 'layout.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
-         WRITE(inum,'(a)') '   jpnij   jpimax  jpjmax    jpk  jpiglo  jpjglo'//&
-   &           ' ( local:    narea     jpi     jpj )'
-         WRITE(inum,'(6i8,a,3i8,a)') jpnij,jpimax,jpjmax,jpk,jpiglo,jpjglo,&
-   &           ' ( local: ',narea,jpi,jpj,' )'
-         WRITE(inum,'(a)') 'narea   jpi  jpj Nis0 Njs0 Nie0 Nje0 nimp njmp nono noso nowe noea nbondi nbondj '
-
-         DO jproc = 1, jpnij
-            WRITE(inum,'(13i5,2i7)')     jproc,  jpiall(jproc),  jpjall(jproc),   &
-               &                                nis0all(jproc), njs0all(jproc),   &
-               &                                nie0all(jproc), nje0all(jproc),   &
-               &                                nimppt (jproc), njmppt (jproc),   &
-               &                                ii_nono(jproc), ii_noso(jproc),   &
-               &                                ii_nowe(jproc), ii_noea(jproc),   &
-               &                                ibonit (jproc), ibonjt (jproc)
+         WRITE(inum,'(a)') '  jpnij jpimax jpjmax    jpk jpiglo jpjglo ( local:   narea    jpi    jpj )'
+         WRITE(inum,'(6i7,a,3i7,a)') jpnij,jpimax,jpjmax,jpk,jpiglo,jpjglo,' ( local: ',narea,jpi,jpj,' )'
+         WRITE(inum,*) 
+         WRITE(inum,       *) '------------------------------------'
+         WRITE(inum,'(a,i2)') ' Mapping of the default neighnourgs '
+         WRITE(inum,       *) '------------------------------------'
+         WRITE(inum,*) 
+         WRITE(inum,'(a)') '  rank    ii    ij   jpi   jpj nimpp njmpp mpiwe mpiea mpiso mpino mpisw mpise mpinw mpine'
+         DO jp = 1, jpnij
+            ii = iin(jp)
+            ij = ijn(jp)
+            WRITE(inum,'(15i6)')  jp-1, ii, ij, ijpi(ii,ij), ijpj(ii,ij), iimppt(ii,ij), ijmppt(ii,ij), inei(:,ii,ij)
          END DO
-      END IF
-
-      !                          ! north fold parameter
-      ! Defined npolj, either 0, 3 , 4 , 5 , 6
-      ! In this case the important thing is that npolj /= 0
-      ! Because if we go through these line it is because jpni >1 and thus
-      ! we must use lbcnorthmpp, which tests only npolj =0 or npolj /= 0
-      npolj = 0
-      ij = ijn(narea)
-      IF( jperio == 3 .OR. jperio == 4 ) THEN
-         IF( ij == jpnj )   npolj = 3
-      ENDIF
-      IF( jperio == 5 .OR. jperio == 6 ) THEN
-         IF( ij == jpnj )   npolj = 5
-      ENDIF
+      ENDIF
+
+      !
+      ! 4. Define Western, Eastern, Southern and Northern neighbors + corners for each mpi process
+      ! ------------------------------------------------------------------------------------------
+      ! 
+      ! rewrite information from "subdomain grid" to mpi process list
+      ! Warning, for example:
+      !    position of the northern neighbor in the "subdomain grid"
+      !    position of the northern neighbor in the "mpi process list"
+      
+      ! default definition: no neighbors
+      impi(:,:) = -1   ! (starting at 0, -1 if no neighbourg)
+      
+      DO jp = 1, jpnij
+         ii = iin(jp)
+         ij = ijn(jp)
+         DO jn = 1, 8
+            IF( llnei(jn,ii,ij) ) THEN   ! must be tested as some land-domain can be kept to fit mppsize
+               ii2 = 1 + MOD( inei(jn,ii,ij) , jpni )
+               ij2 = 1 +      inei(jn,ii,ij) / jpni
+               impi(jn,jp) = ipproc( ii2, ij2 )
+            ENDIF
+         END DO
+      END DO
+
+      !
+      ! 4. keep information for the local process
+      ! -----------------------------------------
+      !
+      ! set default neighbours
+      mpinei(:) = impi(:,narea)
+      DO jh = 1, n_hlsmax
+         mpiSnei(jh,:) = impi(:,narea)   ! default definition
+         mpiRnei(jh,:) = impi(:,narea)
+      END DO
       !
       IF(lwp) THEN
          WRITE(numout,*)
          WRITE(numout,*) '   resulting internal parameters : '
-         WRITE(numout,*) '      narea  = ', narea
-         WRITE(numout,*) '      nowe   = ', nowe  , '   noea  =  ', noea
-         WRITE(numout,*) '      nono   = ', nono  , '   noso  =  ', noso
-         WRITE(numout,*) '      nbondi = ', nbondi
-         WRITE(numout,*) '      nbondj = ', nbondj
-         WRITE(numout,*) '      npolj  = ', npolj
-         WRITE(numout,*) '    l_Iperio = ', l_Iperio
-         WRITE(numout,*) '    l_Jperio = ', l_Jperio
-         WRITE(numout,*) '      nimpp  = ', nimpp
-         WRITE(numout,*) '      njmpp  = ', njmpp
-      ENDIF
-
+         WRITE(numout,*) '      narea = ', narea
+         WRITE(numout,*) '      mpi nei  west = ', mpinei(jpwe)  , '   mpi nei  east = ', mpinei(jpea)
+         WRITE(numout,*) '      mpi nei south = ', mpinei(jpso)  , '   mpi nei north = ', mpinei(jpno)
+         WRITE(numout,*) '      mpi nei so-we = ', mpinei(jpsw)  , '   mpi nei so-ea = ', mpinei(jpse)
+         WRITE(numout,*) '      mpi nei no-we = ', mpinei(jpnw)  , '   mpi nei no-ea = ', mpinei(jpne)
+      ENDIF
       !                          ! Prepare mpp north fold
-      IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN
+      !
+      llmpiNFold =          jpni  > 1 .AND. l_NFold   ! is the North fold done with an MPI communication?
+      l_IdoNFold = ijn(narea) == jpnj .AND. l_NFold   ! is this process doing North fold?
+      !
+      IF( llmpiNFold ) THEN
          CALL mpp_ini_north
          IF (lwp) THEN
             WRITE(numout,*)
             WRITE(numout,*) '   ==>>>   North fold boundary prepared for jpni >1'
-            ! additional prints in layout.dat
-         ENDIF
-         IF (llwrtlay) THEN
+         ENDIF
+         IF (llwrtlay) THEN      ! additional prints in layout.dat
             WRITE(inum,*)
             WRITE(inum,*)
-            WRITE(inum,*) 'number of subdomains located along the north fold : ', ndim_rank_north
+            WRITE(inum,*) 'Number of subdomains located along the north fold : ', ndim_rank_north
             WRITE(inum,*) 'Rank of the subdomains located along the north fold : ', ndim_rank_north
-            DO jproc = 1, ndim_rank_north, 5
-               WRITE(inum,*) nrank_north( jproc:MINVAL( (/jproc+4,ndim_rank_north/) ) )
+            DO jp = 1, ndim_rank_north, 5
+               WRITE(inum,*) nrank_north( jp:MINVAL( (/jp+4,ndim_rank_north/) ) )
             END DO
          ENDIF
-      ENDIF
-
-      !
-      CALL mpp_ini_nc        ! Initialize communicator for neighbourhood collective communications
-      !
-      CALL init_ioipsl       ! Prepare NetCDF output file (if necessary)
-      !
-      IF (( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ).AND.( ln_nnogather )) THEN
-         CALL init_nfdcom     ! northfold neighbour lists
-         IF (llwrtlay) THEN
-            WRITE(inum,*)
-            WRITE(inum,*)
-            WRITE(inum,*) 'north fold exchanges with explicit point-to-point messaging :'
-            WRITE(inum,*) 'nsndto : ', nsndto
-            WRITE(inum,*) 'isendto : ', isendto
-         ENDIF
-      ENDIF
+         IF ( l_IdoNFold .AND. ln_nnogather ) THEN
+            CALL init_nfdcom     ! northfold neighbour lists
+            IF (llwrtlay) THEN
+               WRITE(inum,*)
+               WRITE(inum,*) 'north fold exchanges with explicit point-to-point messaging :'
+               WRITE(inum,*) '   nsndto  : ', nsndto
+               WRITE(inum,*) '   isendto : ', isendto(1:nsndto)
+            ENDIF
+         ENDIF
+      ENDIF
+      !
+      CALL mpp_ini_nc(nn_hls)    ! Initialize communicator for neighbourhood collective communications
+      DO jh = 1, n_hlsmax
+         mpi_nc_com4(jh) = mpi_nc_com4(nn_hls)   ! default definition
+         mpi_nc_com8(jh) = mpi_nc_com8(nn_hls)
+      END DO
+      !
+      CALL init_excl_landpt      ! exclude exchanges which contain only land points
+      !
+      ! Save processor layout changes in ascii file
+      DO jh = 1, n_hlsmax    ! different halo size
+         DO ji = 1, 8
+            ichanged(16*(jh-1)  +ji) = COUNT( mpinei(ji:ji) /= mpiSnei(jh,ji:ji) )
+            ichanged(16*(jh-1)+8+ji) = COUNT( mpinei(ji:ji) /= mpiRnei(jh,ji:ji) )
+         END DO
+      END DO
+      CALL mpp_sum( "mpp_init", ichanged )   ! must be called by all processes
+      IF (llwrtlay) THEN
+         WRITE(inum,*) 
+         WRITE(inum,       *) '----------------------------------------------------------------------'
+         WRITE(inum,'(a,i2)') ' Mapping of the neighnourgs once excluding comm with only land points '
+         WRITE(inum,       *) '----------------------------------------------------------------------'
+         DO jh = 1, n_hlsmax    ! different halo size
+            WRITE(inum,*) 
+            WRITE(inum,'(a,i2)') 'halo size: ', jh
+            WRITE(inum,       *) '---------'
+            WRITE(inum,'(a)') '  rank    ii    ij mpiwe mpiea mpiso mpino mpisw mpise mpinw mpine'
+            WRITE(inum,   '(11i6,a)')  narea-1, iin(narea), ijn(narea),   mpinei(:), ' <- Org'
+            WRITE(inum,'(18x,8i6,a,i1,a)')   mpiSnei(jh,:), ' <- Send ', COUNT( mpinei(:) /= mpiSnei(jh,:) ), ' modif'
+            WRITE(inum,'(18x,8i6,a,i1,a)')   mpiRnei(jh,:), ' <- Recv ', COUNT( mpinei(:) /= mpiRnei(jh,:) ), ' modif'
+            WRITE(inum,*) ' total changes among all mpi tasks:'
+            WRITE(inum,*) '       mpiwe mpiea mpiso mpino mpisw mpise mpinw mpine'
+            WRITE(inum,'(a,8i6)') ' Send: ', ichanged(jh*16-15:jh*16-8)
+            WRITE(inum,'(a,8i6)') ' Recv: ', ichanged(jh*16 -7:jh*16  )
+         END DO
+      ENDIF
+      !
+      CALL init_ioipsl           ! Prepare NetCDF output file (if necessary)
       !
       IF (llwrtlay) CLOSE(inum)
       !
-      DEALLOCATE(iin, ijn, ii_nono, ii_noea, ii_noso, ii_nowe,    &
-         &       iimppt, ijmppt, ibondi, ibondj, ipproc, ipolj,   &
-         &       ijpi, ijpj, iie0, ije0, iis0, ijs0,              &
-         &       iono, ioea, ioso, iowe, llisoce)
+      DEALLOCATE(iin, ijn, iimppt, ijmppt, ijpi, ijpj, ipproc, inei, llnei, impi, llisOce)
       !
     END SUBROUTINE mpp_init
@@ -789,11 +637,11 @@
         CALL ctl_stop( 'STOP', ctmp1, ctmp2 )
       ENDIF
-      IF( jperio == 3 .OR. jperio == 4 .OR. jperio == 5 .OR. jperio == 6 ) THEN
+      IF( l_NFold ) THEN
          ! minimize the size of the last row to compensate for the north pole folding coast
-         IF( jperio == 3 .OR. jperio == 4 )   ijpjmin = 2+3*khls   ! V and F folding must be outside of southern halos
-         IF( jperio == 5 .OR. jperio == 6 )   ijpjmin = 1+3*khls   ! V and F folding must be outside of southern halos
-         irm = knbj - irestj                                       ! total number of lines to be removed
-         klcj(:,knbj) = MAX( ijpjmin, kjmax-irm )                  ! we must have jpj >= ijpjmin in the last row
-         irm = irm - ( kjmax - klcj(1,knbj) )                      ! remaining number of lines to remove
+         IF( c_NFtype == 'T' )   ijpjmin = 2+3*khls   ! V and F folding must be outside of southern halos
+         IF( c_NFtype == 'F' )   ijpjmin = 1+3*khls   ! V and F folding must be outside of southern halos
+         irm = knbj - irestj                          ! total number of lines to be removed
+         klcj(:,knbj) = MAX( ijpjmin, kjmax-irm )     ! we must have jpj >= ijpjmin in the last row
+         irm = irm - ( kjmax - klcj(1,knbj) )         ! remaining number of lines to remove
          irestj = knbj - 1 - irm
          klcj(:, irestj+1:knbj-1) = kjmax-1
@@ -860,5 +708,5 @@
       LOGICAL :: llist
       LOGICAL, DIMENSION(:,:), ALLOCATABLE :: llmsk2d                 ! max size of the subdomains along i,j
-      LOGICAL, DIMENSION(:,:), ALLOCATABLE :: llisoce              !  -     -
+      LOGICAL, DIMENSION(:,:), ALLOCATABLE :: llisOce              !  -     -
       REAL(wp)::   zpropland
       !!----------------------------------------------------------------------
@@ -883,6 +731,6 @@
       iszimin = 4*nn_hls          ! minimum size of the MPI subdomain so halos are always adressing neighbor inner domain
       iszjmin = 4*nn_hls
-      IF( jperio == 3 .OR. jperio == 4 )   iszjmin = MAX(iszjmin, 2+3*nn_hls)   ! V and F folding must be outside of southern halos
-      IF( jperio == 5 .OR. jperio == 6 )   iszjmin = MAX(iszjmin, 1+3*nn_hls)   ! V and F folding must be outside of southern halos
+      IF( c_NFtype == 'T' )   iszjmin = MAX(iszjmin, 2+3*nn_hls)   ! V and F folding must be outside of southern halos
+      IF( c_NFtype == 'F' )   iszjmin = MAX(iszjmin, 1+3*nn_hls)   ! V and F folding must be outside of southern halos
       !
       ! get the list of knbi that gives a smaller jpimax than knbi-1
@@ -933,5 +781,5 @@
                iszi1(ii) = iszi0(ji)
                iszj1(ii) = iszj0(jj)
-            END IF
+            ENDIF
          END DO
       END DO
@@ -989,15 +837,15 @@
             WRITE(numout,*) '  -----------------------------------------------------'
             WRITE(numout,*)
-         END IF
+         ENDIF
          ji = isz0   ! initialization with the largest value
-         ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
-         CALL mpp_is_ocean( llisoce )   ! Warning: must be call by all cores (call mpp_sum)
-         inbijold = COUNT(llisoce)
-         DEALLOCATE( llisoce )
+         ALLOCATE( llisOce(inbi0(ji), inbj0(ji)) )
+         CALL mpp_is_ocean( llisOce )   ! Warning: must be call by all cores (call mpp_sum)
+         inbijold = COUNT(llisOce)
+         DEALLOCATE( llisOce )
          DO ji =isz0-1,1,-1
-            ALLOCATE( llisoce(inbi0(ji), inbj0(ji)) )
-            CALL mpp_is_ocean( llisoce )   ! Warning: must be call by all cores (call mpp_sum)
-            inbij = COUNT(llisoce)
-            DEALLOCATE( llisoce )
+            ALLOCATE( llisOce(inbi0(ji), inbj0(ji)) )
+            CALL mpp_is_ocean( llisOce )   ! Warning: must be call by all cores (call mpp_sum)
+            inbij = COUNT(llisOce)
+            DEALLOCATE( llisOce )
             IF(lwp .AND. inbij < inbijold) THEN
                WRITE(numout,'(a, i6, a, i6, a, f4.1, a, i9, a, i6, a, i6, a)')                                 &
@@ -1006,5 +854,5 @@
                   &   '%), largest oce domain: ', iszi0(ji)*iszj0(ji), ' ( ', iszi0(ji),' x ', iszj0(ji), ' )'
                inbijold = inbij
-            END IF
+            ENDIF
          END DO
          DEALLOCATE( inbi0, inbj0, iszi0, iszj0 )
@@ -1022,8 +870,8 @@
       DO WHILE( inbij > knbij )   ! while the number of ocean subdomains exceed the number of procs
          ii = ii -1
-         ALLOCATE( llisoce(inbi0(ii), inbj0(ii)) )
-         CALL mpp_is_ocean( llisoce )            ! must be done by all core
-         inbij = COUNT(llisoce)
-         DEALLOCATE( llisoce )
+         ALLOCATE( llisOce(inbi0(ii), inbj0(ii)) )
+         CALL mpp_is_ocean( llisOce )            ! must be done by all core
+         inbij = COUNT(llisOce)
+         DEALLOCATE( llisOce )
       END DO
       knbi = inbi0(ii)
@@ -1073,5 +921,5 @@
          !
          ALLOCATE( lloce(Ni0glo, ijsz) )                                     ! allocate the strip
-         CALL readbot_strip( ijstr, ijsz, lloce )
+         CALL read_mask( 1, ijstr, Ni0glo, ijsz, lloce )
          inboce = COUNT(lloce)                                               ! number of ocean point in the stripe
          DEALLOCATE(lloce)
@@ -1087,5 +935,5 @@
 
 
-   SUBROUTINE mpp_is_ocean( ldisoce )
+   SUBROUTINE mpp_is_ocean( ldIsOce )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE mpp_is_ocean  ***
@@ -1095,5 +943,5 @@
       !!              at least 1 ocean point.
       !!              We must indeed ensure that each subdomain that is a neighbour
-      !!              of a land subdomain as only land points on its boundary
+      !!              of a land subdomain, has only land points on its boundary
       !!              (inside the inner subdomain) with the land subdomain.
       !!              This is needed to get the proper bondary conditions on
@@ -1102,5 +950,5 @@
       !! ** Method  : read inbj strips (of length Ni0glo) of the land-sea mask
       !!----------------------------------------------------------------------
-      LOGICAL, DIMENSION(:,:), INTENT(  out) ::   ldisoce        ! .true. if a sub domain constains 1 ocean point
+      LOGICAL, DIMENSION(:,:), INTENT(  out) ::   ldIsOce        ! .true. if a sub domain constains 1 ocean point
       !
       INTEGER :: idiv, iimax, ijmax, iarea
@@ -1115,10 +963,10 @@
       ! do nothing if there is no land-sea mask
       IF( numbot == -1 .AND. numbdy == -1 ) THEN
-         ldisoce(:,:) = .TRUE.
+         ldIsOce(:,:) = .TRUE.
          RETURN
       ENDIF
       !
-      inbi = SIZE( ldisoce, dim = 1 )
-      inbj = SIZE( ldisoce, dim = 2 )
+      inbi = SIZE( ldIsOce, dim = 1 )
+      inbj = SIZE( ldIsOce, dim = 2 )
       !
       ! we want to read inbj strips of the land-sea mask. -> pick up inbj processes every idiv processes starting at 1
@@ -1143,9 +991,9 @@
             inry = iny - COUNT( (/ iarea == 1, iarea == inbj /) )      ! number of point to read in y-direction
             isty = 1 + COUNT( (/ iarea == 1 /) )                       ! read from the first or the second line?
-            CALL readbot_strip( ijmppt(1,iarea) - 2 + isty, inry, lloce(2:inx-1, isty:inry+isty-1) )   ! read the strip
+            CALL read_mask( 1, ijmppt(1,iarea) - 2 + isty, Ni0glo, inry, lloce(2:inx-1, isty:inry+isty-1) )   ! read the strip
             !
             IF( iarea == 1    ) THEN                                   ! the first line was not read
-               IF( jperio == 2 .OR. jperio == 7 ) THEN                 !   north-south periodocity
-                  CALL readbot_strip( Nj0glo, 1, lloce(2:inx-1, 1) )   !   read the last line -> first line of lloce
+               IF( l_Jperio ) THEN                                     !   north-south periodocity
+                  CALL read_mask( 1, Nj0glo, Ni0glo, 1, lloce(2:inx-1, 1) )   !   read the last line -> first line of lloce
                ELSE
                   lloce(2:inx-1,  1) = .FALSE.                         !   closed boundary
@@ -1153,7 +1001,7 @@
             ENDIF
             IF( iarea == inbj ) THEN                                   ! the last line was not read
-               IF( jperio == 2 .OR. jperio == 7 ) THEN                 !   north-south periodocity
-                  CALL readbot_strip( 1, 1, lloce(2:inx-1,iny) )       !      read the first line -> last line of lloce
-               ELSEIF( jperio == 3 .OR. jperio == 4 ) THEN             !   north-pole folding T-pivot, T-point
+               IF( l_Jperio ) THEN                                     !   north-south periodocity
+                  CALL read_mask( 1, 1, Ni0glo, 1, lloce(2:inx-1,iny) )   !      read the first line -> last line of lloce
+               ELSEIF( c_NFtype == 'T' ) THEN                          !   north-pole folding T-pivot, T-point
                   lloce(2,iny) = lloce(2,iny-2)                        !      here we have 1 halo (even if nn_hls>1)
                   DO ji = 3,inx-1
@@ -1163,5 +1011,5 @@
                      lloce(ji,iny-1) = lloce(inx-ji+2,iny-1)
                   END DO
-               ELSEIF( jperio == 5 .OR. jperio == 6 ) THEN             !   north-pole folding F-pivot, T-point, 1 halo
+               ELSEIF( c_NFtype == 'F' ) THEN                          !   north-pole folding F-pivot, T-point, 1 halo
                   lloce(inx/2+1,iny-1) = lloce(inx/2,iny-1)            !      here we have 1 halo (even if nn_hls>1)
                   lloce(inx  -1,iny-1) = lloce(2    ,iny-1)
@@ -1174,5 +1022,5 @@
             ENDIF
             !                                                          ! first and last column were not read
-            IF( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7 ) THEN
+            IF( l_Iperio ) THEN
                lloce(1,:) = lloce(inx-1,:)   ;   lloce(inx,:) = lloce(2,:)   ! east-west periodocity
             ELSE
@@ -1193,5 +1041,5 @@
       CALL mpp_sum( 'mppini', inboce_1d )
       inboce = RESHAPE(inboce_1d, (/inbi, inbj/))
-      ldisoce(:,:) = inboce(:,:) /= 0
+      ldIsOce(:,:) = inboce(:,:) /= 0
       DEALLOCATE(inboce, inboce_1d)
       !
@@ -1199,7 +1047,7 @@
 
 
-   SUBROUTINE readbot_strip( kjstr, kjcnt, ldoce )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE readbot_strip  ***
+   SUBROUTINE read_mask( kistr, kjstr, kicnt, kjcnt, ldoce )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE read_mask  ***
       !!
       !! ** Purpose : Read relevant bathymetric information in order to
@@ -1209,10 +1057,10 @@
       !! ** Method  : read stipe of size (Ni0glo,...)
       !!----------------------------------------------------------------------
-      INTEGER                         , INTENT(in   ) ::   kjstr       ! starting j position of the reading
-      INTEGER                         , INTENT(in   ) ::   kjcnt       ! number of lines to read
-      LOGICAL, DIMENSION(Ni0glo,kjcnt), INTENT(  out) ::   ldoce       ! ldoce(i,j) = .true. if the point (i,j) is ocean
-      !
-      INTEGER                           ::   inumsave                ! local logical unit
-      REAL(wp), DIMENSION(Ni0glo,kjcnt) ::   zbot, zbdy
+      INTEGER                        , INTENT(in   ) ::   kistr, kjstr   ! starting i and j position of the reading
+      INTEGER                        , INTENT(in   ) ::   kicnt, kjcnt   ! number of points to read in i and j directions
+      LOGICAL, DIMENSION(kicnt,kjcnt), INTENT(  out) ::   ldoce          ! ldoce(i,j) = .true. if the point (i,j) is ocean
+      !
+      INTEGER                          ::   inumsave                     ! local logical unit
+      REAL(wp), DIMENSION(kicnt,kjcnt) ::   zbot, zbdy
       !!----------------------------------------------------------------------
       !
@@ -1220,5 +1068,5 @@
       !
       IF( numbot /= -1 ) THEN
-         CALL iom_get( numbot, jpdom_unknown, 'bottom_level', zbot, kstart = (/1,kjstr/), kcount = (/Ni0glo, kjcnt/) )
+         CALL iom_get( numbot, jpdom_unknown, 'bottom_level', zbot, kstart = (/kistr,kjstr/), kcount = (/kicnt, kjcnt/) )
       ELSE
          zbot(:,:) = 1._wp                      ! put a non-null value
@@ -1226,15 +1074,15 @@
       !
       IF( numbdy /= -1 ) THEN                   ! Adjust with bdy_msk if it exists
-         CALL iom_get ( numbdy, jpdom_unknown,     'bdy_msk', zbdy, kstart = (/1,kjstr/), kcount = (/Ni0glo, kjcnt/) )
+         CALL iom_get ( numbdy, jpdom_unknown,     'bdy_msk', zbdy, kstart = (/kistr,kjstr/), kcount = (/kicnt, kjcnt/) )
          zbot(:,:) = zbot(:,:) * zbdy(:,:)
       ENDIF
       !
-      ldoce(:,:) = zbot(:,:) > 0._wp
+      ldoce(:,:) = NINT(zbot(:,:)) > 0
       numout = inumsave
       !
-   END SUBROUTINE readbot_strip
-
-
-   SUBROUTINE mpp_getnum( ldisoce, kproc, kipos, kjpos )
+   END SUBROUTINE read_mask
+
+
+   SUBROUTINE mpp_getnum( ldIsOce, kproc, kipos, kjpos )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE mpp_getnum  ***
@@ -1244,6 +1092,6 @@
       !! ** Method  : start from bottom left. First skip land subdomain, and finally use them if needed
       !!----------------------------------------------------------------------
-      LOGICAL, DIMENSION(:,:), INTENT(in   ) ::   ldisoce     ! F if land process
-      INTEGER, DIMENSION(:,:), INTENT(  out) ::   kproc       ! subdomain number (-1 if supressed, starting at 0)
+      LOGICAL, DIMENSION(:,:), INTENT(in   ) ::   ldIsOce     ! F if land process
+      INTEGER, DIMENSION(:,:), INTENT(  out) ::   kproc       ! subdomain number (-1 if not existing, starting at 0)
       INTEGER, DIMENSION(  :), INTENT(  out) ::   kipos       ! i-position of the subdomain (from 1 to jpni)
       INTEGER, DIMENSION(  :), INTENT(  out) ::   kjpos       ! j-position of the subdomain (from 1 to jpnj)
@@ -1253,6 +1101,6 @@
       !!----------------------------------------------------------------------
       !
-      ini = SIZE(ldisoce, dim = 1)
-      inj = SIZE(ldisoce, dim = 2)
+      ini = SIZE(ldIsOce, dim = 1)
+      inj = SIZE(ldIsOce, dim = 2)
       inij = SIZE(kipos)
       !
@@ -1264,5 +1112,5 @@
          ii = 1 + MOD(iarea0,ini)
          ij = 1 +     iarea0/ini
-         IF( ldisoce(ii,ij) ) THEN
+         IF( ldIsOce(ii,ij) ) THEN
             icont = icont + 1
             kproc(ii,ij) = icont
@@ -1272,10 +1120,10 @@
       END DO
       ! if needed add some land subdomains to reach inij active subdomains
-      i2add = inij - COUNT( ldisoce )
+      i2add = inij - COUNT( ldIsOce )
       DO jarea = 1, ini*inj
          iarea0 = jarea - 1
          ii = 1 + MOD(iarea0,ini)
          ij = 1 +     iarea0/ini
-         IF( .NOT. ldisoce(ii,ij) .AND. i2add > 0 ) THEN
+         IF( .NOT. ldIsOce(ii,ij) .AND. i2add > 0 ) THEN
             icont = icont + 1
             kproc(ii,ij) = icont
@@ -1287,4 +1135,93 @@
       !
    END SUBROUTINE mpp_getnum
+
+
+   SUBROUTINE init_excl_landpt
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE   ***
+      !!
+      !! ** Purpose : exclude exchanges which contain only land points
+      !!
+      !! ** Method  : if a send or receive buffer constains only land point we
+      !!              flag off the corresponding communication
+      !!              Warning: this selection depend on the halo size -> loop on halo size
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER ::   inumsave
+      INTEGER ::   jh
+      INTEGER ::   ipi, ipj
+      INTEGER ::   iiwe, iiea, iist, iisz 
+      INTEGER ::   ijso, ijno, ijst, ijsz 
+      LOGICAL ::   llsave
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   zmsk
+      LOGICAL , DIMENSION(Ni_0,Nj_0,1)      ::   lloce
+      !!----------------------------------------------------------------------
+      !
+      ! read the land-sea mask on the inner domain
+      CALL read_mask( nimpp, njmpp, Ni_0, Nj_0, lloce(:,:,1) )
+      !
+      ! Here we look only at communications excluding the NP folding.
+      ! As lbcnfd not validated if halo size /= nn_hls, we switch if off temporary...
+      llsave = l_IdoNFold
+      l_IdoNFold = .FALSE.
+      !
+      DO jh = 1, n_hlsmax    ! different halo size
+         !
+         ipi = Ni_0 + 2*jh   ! local domain size
+         ipj = Nj_0 + 2*jh
+         !
+         ALLOCATE( zmsk(ipi,ipj) )
+         zmsk(jh+1:jh+Ni_0,jh+1:jh+Nj_0) = REAL(COUNT(lloce, dim = 3), wp)   ! define inner domain -> need REAL to use lbclnk
+         CALL lbc_lnk('mppini', zmsk, 'T', 1._wp, khls = jh)                 ! fill halos
+         !        
+         iiwe = jh   ;   iiea = Ni_0   ! bottom-left corfer - 1 of the sent data
+         ijso = jh   ;   ijno = Nj_0
+         IF( nn_comm == 1 ) THEN 
+            iist =  0   ;   iisz = ipi
+            ijst =  0   ;   ijsz = ipj
+         ELSE
+            iist = jh   ;   iisz = Ni_0
+            ijst = jh   ;   ijsz = Nj_0
+         ENDIF
+IF( nn_comm == 1 ) THEN       ! SM: NOT WORKING FOR NEIGHBOURHOOD COLLECTIVE COMMUNICATIONS, I DON'T KNOW WHY... 
+         ! do not send if we send only land points
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijst+1:ijst+ijsz) )) == 0 )   mpiSnei(jh,jpwe) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijst+1:ijst+ijsz) )) == 0 )   mpiSnei(jh,jpea) = -1
+         IF( NINT(SUM( zmsk(iist+1:iist+iisz,ijso+1:ijso+jh  ) )) == 0 )   mpiSnei(jh,jpso) = -1
+         IF( NINT(SUM( zmsk(iist+1:iist+iisz,ijno+1:ijno+jh  ) )) == 0 )   mpiSnei(jh,jpno) = -1
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijso+1:ijso+jh  ) )) == 0 )   mpiSnei(jh,jpsw) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijso+1:ijso+jh  ) )) == 0 )   mpiSnei(jh,jpse) = -1
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijno+1:ijno+jh  ) )) == 0 )   mpiSnei(jh,jpnw) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijno+1:ijno+jh  ) )) == 0 )   mpiSnei(jh,jpne) = -1
+         !
+         iiwe = iiwe-jh   ;   iiea = iiea+jh   ! bottom-left corfer - 1 of the received data
+         ijso = ijso-jh   ;   ijno = ijno+jh
+         ! do not send if we send only land points
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijst+1:ijst+ijsz) )) == 0 )   mpiRnei(jh,jpwe) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijst+1:ijst+ijsz) )) == 0 )   mpiRnei(jh,jpea) = -1
+         IF( NINT(SUM( zmsk(iist+1:iist+iisz,ijso+1:ijso+jh  ) )) == 0 )   mpiRnei(jh,jpso) = -1
+         IF( NINT(SUM( zmsk(iist+1:iist+iisz,ijno+1:ijno+jh  ) )) == 0 )   mpiRnei(jh,jpno) = -1
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijso+1:ijso+jh  ) )) == 0 )   mpiRnei(jh,jpsw) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijso+1:ijso+jh  ) )) == 0 )   mpiRnei(jh,jpse) = -1
+         IF( NINT(SUM( zmsk(iiwe+1:iiwe+jh  ,ijno+1:ijno+jh  ) )) == 0 )   mpiRnei(jh,jpnw) = -1
+         IF( NINT(SUM( zmsk(iiea+1:iiea+jh  ,ijno+1:ijno+jh  ) )) == 0 )   mpiRnei(jh,jpne) = -1
+ENDIF
+         !
+         ! Specific (and rare) problem in corner treatment because we do 1st West-East comm, next South-North comm
+         IF( nn_comm == 1 ) THEN
+            IF( mpiSnei(jh,jpwe) > -1 )   mpiSnei(jh, (/jpsw,jpnw/) ) = -1   ! SW and NW corners already sent through West nei
+            IF( mpiSnei(jh,jpea) > -1 )   mpiSnei(jh, (/jpse,jpne/) ) = -1   ! SE and NE corners already sent through East nei
+            IF( mpiRnei(jh,jpso) > -1 )   mpiRnei(jh, (/jpsw,jpse/) ) = -1   ! SW and SE corners will be received through South nei
+            IF( mpiRnei(jh,jpno) > -1 )   mpiRnei(jh, (/jpnw,jpne/) ) = -1   ! NW and NE corners will be received through North nei
+        ENDIF
+         !
+         DEALLOCATE( zmsk )
+         !
+         CALL mpp_ini_nc(jh)    ! Initialize/Update communicator for neighbourhood collective communications
+         !
+      END DO
+      l_IdoNFold = llsave
+
+   END SUBROUTINE init_excl_landpt
 
 
@@ -1343,38 +1280,30 @@
       !!----------------------------------------------------------------------
       !
-      !initializes the north-fold communication variables
-      isendto(:) = 0
-      nsndto     = 0
-      !
-      IF ( njmpp == MAXVAL( njmppt ) ) THEN      ! if I am a process in the north
+      !sxM is the first point (in the global domain) needed to compute the north-fold for the current process
+      sxM = jpiglo - nimpp - jpi + 1
+      !dxM is the last point (in the global domain) needed to compute the north-fold for the current process
+      dxM = jpiglo - nimpp + 2
+      !
+      ! loop over the other north-fold processes to find the processes
+      ! managing the points belonging to the sxT-dxT range
+      !
+      nsndto = 0
+      DO jn = 1, jpni
          !
-         !sxM is the first point (in the global domain) needed to compute the north-fold for the current process
-         sxM = jpiglo - nimppt(narea) - jpiall(narea) + 1
-         !dxM is the last point (in the global domain) needed to compute the north-fold for the current process
-         dxM = jpiglo - nimppt(narea) + 2
+         sxT = nfimpp(jn)                    ! sxT = 1st  point (in the global domain) of the jn process
+         dxT = nfimpp(jn) + nfjpi(jn) - 1    ! dxT = last point (in the global domain) of the jn process
          !
-         ! loop over the other north-fold processes to find the processes
-         ! managing the points belonging to the sxT-dxT range
+         IF    ( sxT < sxM  .AND.  sxM < dxT ) THEN
+            nsndto          = nsndto + 1
+            isendto(nsndto) = jn
+         ELSEIF( sxM <= sxT  .AND.  dxM >= dxT ) THEN
+            nsndto          = nsndto + 1
+            isendto(nsndto) = jn
+         ELSEIF( dxM <  dxT  .AND.  sxT <  dxM ) THEN
+            nsndto          = nsndto + 1
+            isendto(nsndto) = jn
+         ENDIF
          !
-         DO jn = 1, jpni
-            !
-            sxT = nfimpp(jn)                    ! sxT = 1st  point (in the global domain) of the jn process
-            dxT = nfimpp(jn) + nfjpi(jn) - 1    ! dxT = last point (in the global domain) of the jn process
-            !
-            IF    ( sxT < sxM  .AND.  sxM < dxT ) THEN
-               nsndto          = nsndto + 1
-               isendto(nsndto) = jn
-            ELSEIF( sxM <= sxT  .AND.  dxM >= dxT ) THEN
-               nsndto          = nsndto + 1
-               isendto(nsndto) = jn
-            ELSEIF( dxM <  dxT  .AND.  sxT <  dxM ) THEN
-               nsndto          = nsndto + 1
-               isendto(nsndto) = jn
-            ENDIF
-            !
-         END DO
-         !
-      ENDIF
-      l_north_nogather = .TRUE.
+      END DO
       !
    END SUBROUTINE init_nfdcom
@@ -1389,28 +1318,16 @@
       !!----------------------------------------------------------------------
       !
-      Nis0 =   1+nn_hls   ;   Nis1 = Nis0-1   ;   Nis2 = MAX(  1, Nis0-2)
-      Njs0 =   1+nn_hls   ;   Njs1 = Njs0-1   ;   Njs2 = MAX(  1, Njs0-2)
-      !
-      Nie0 = jpi-nn_hls   ;   Nie1 = Nie0+1   ;   Nie2 = MIN(jpi, Nie0+2)
-      Nje0 = jpj-nn_hls   ;   Nje1 = Nje0+1   ;   Nje2 = MIN(jpj, Nje0+2)
-      !
-      IF( nn_hls == 1 ) THEN          !* halo size of 1
-         !
-         Nis1nxt2 = Nis0   ;   Njs1nxt2 = Njs0
-         Nie1nxt2 = Nie0   ;   Nje1nxt2 = Nje0
-         !
-      ELSE                            !* larger halo size...
-         !
-         Nis1nxt2 = Nis1   ;   Njs1nxt2 = Njs1
-         Nie1nxt2 = Nie1   ;   Nje1nxt2 = Nje1
-         !
-      ENDIF
+      Nis0 =   1+nn_hls
+      Njs0 =   1+nn_hls
+      Nie0 = jpi-nn_hls
+      Nje0 = jpj-nn_hls
       !
       Ni_0 = Nie0 - Nis0 + 1
       Nj_0 = Nje0 - Njs0 + 1
-      Ni_1 = Nie1 - Nis1 + 1
-      Nj_1 = Nje1 - Njs1 + 1
-      Ni_2 = Nie2 - Nis2 + 1
-      Nj_2 = Nje2 - Njs2 + 1
+      !
+      ! old indices to be removed...
+      jpim1 = jpi-1                             ! inner domain indices
+      jpjm1 = jpj-1                             !   "           "
+      jpkm1 = jpk-1                             !   "           "
       !
    END SUBROUTINE init_doloop
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfc1d_c2d.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfc1d_c2d.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfc1d_c2d.F90	(revision 14676)
@@ -95,5 +95,5 @@
          END_3D
          ! Lateral boundary conditions
-         CALL lbc_lnk_multi( 'ldfc1d_c2d', pah1, 'U', 1.0_wp , pah2, 'V', 1.0_wp )
+         CALL lbc_lnk( 'ldfc1d_c2d', pah1, 'U', 1.0_wp , pah2, 'V', 1.0_wp )
          !
       CASE DEFAULT                        ! error
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfdyn.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfdyn.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfdyn.F90	(revision 14676)
@@ -412,5 +412,5 @@
          ENDIF
          !
-         CALL lbc_lnk_multi( 'ldfdyn', ahmt, 'T', 1.0_wp,  ahmf, 'F', 1.0_wp )
+         CALL lbc_lnk( 'ldfdyn', ahmt, 'T', 1.0_wp,  ahmf, 'F', 1.0_wp )
          !
          !
@@ -444,5 +444,5 @@
             END DO
             !
-            CALL lbc_lnk_multi( 'ldfdyn', dtensq, 'T', 1.0_wp )  ! lbc_lnk on dshesq not needed
+            CALL lbc_lnk( 'ldfdyn', dtensq, 'T', 1.0_wp )  ! lbc_lnk on dshesq not needed
             !
             DO jk = 1, jpkm1
@@ -495,5 +495,5 @@
          ENDIF
          !
-         CALL lbc_lnk_multi( 'ldfdyn', ahmt, 'T', 1.0_wp , ahmf, 'F', 1.0_wp )
+         CALL lbc_lnk( 'ldfdyn', ahmt, 'T', 1.0_wp , ahmf, 'F', 1.0_wp )
          !
       END SELECT
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfslp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfslp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldfslp.F90	(revision 14676)
@@ -229,5 +229,5 @@
 !!gm end modif
       END_3D
-      CALL lbc_lnk_multi( 'ldfslp', zwz, 'U', -1.0_wp,  zww, 'V', -1.0_wp )      ! lateral boundary conditions
+      CALL lbc_lnk( 'ldfslp', zwz, 'U', -1.0_wp,  zww, 'V', -1.0_wp )      ! lateral boundary conditions
       !
       !                                    !* horizontal Shapiro filter
@@ -289,5 +289,5 @@
 !!gm end modif
       END_3D
-      CALL lbc_lnk_multi( 'ldfslp', zwz, 'T', -1.0_wp,  zww, 'T', -1.0_wp )      ! lateral boundary conditions
+      CALL lbc_lnk( 'ldfslp', zwz, 'T', -1.0_wp,  zww, 'T', -1.0_wp )      ! lateral boundary conditions
       !
       !                                           !* horizontal Shapiro filter
@@ -318,5 +318,5 @@
       ! IV. Lateral boundary conditions
       ! ===============================
-      CALL lbc_lnk_multi( 'ldfslp', uslp , 'U', -1.0_wp , vslp , 'V', -1.0_wp , wslpi, 'W', -1.0_wp, wslpj, 'W', -1.0_wp )
+      CALL lbc_lnk( 'ldfslp', uslp , 'U', -1.0_wp , vslp , 'V', -1.0_wp , wslpi, 'W', -1.0_wp, wslpj, 'W', -1.0_wp )
 
       IF(sn_cfctl%l_prtctl) THEN
@@ -659,5 +659,5 @@
       END_2D
       !!gm this lbc_lnk should be useless....
-      CALL lbc_lnk_multi( 'ldfslp', uslpml , 'U', -1.0_wp , vslpml , 'V', -1.0_wp , wslpiml, 'W', -1.0_wp , wslpjml, 'W', -1.0_wp ) 
+      CALL lbc_lnk( 'ldfslp', uslpml , 'U', -1.0_wp , vslpml , 'V', -1.0_wp , wslpiml, 'W', -1.0_wp , wslpjml, 'W', -1.0_wp ) 
       !
    END SUBROUTINE ldf_slp_mxl
@@ -727,5 +727,5 @@
 !               END DO
 !            END DO
-!            CALL lbc_lnk_multi( 'ldfslp', uslp , 'U', -1. ; CALL lbc_lnk( 'ldfslp', vslp , 'V', -1.,  wslpi, 'W', -1.,  wslpj, 'W', -1. )
+!            CALL lbc_lnk( 'ldfslp', uslp , 'U', -1. ; CALL lbc_lnk( 'ldfslp', vslp , 'V', -1.,  wslpi, 'W', -1.,  wslpj, 'W', -1. )
 !!gm         ENDIF
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldftra.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldftra.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/LDF/ldftra.F90	(revision 14676)
@@ -697,5 +697,5 @@
          paeiv(ji,jj,1) = 0.5_wp * ( zaeiw(ji,jj) + zaeiw(ji  ,jj+1) ) * vmask(ji,jj,1)
       END_2D
-      CALL lbc_lnk_multi( 'ldftra', paeiu(:,:,1), 'U', 1.0_wp , paeiv(:,:,1), 'V', 1.0_wp )      ! lateral boundary condition
+      CALL lbc_lnk( 'ldftra', paeiu(:,:,1), 'U', 1.0_wp , paeiv(:,:,1), 'V', 1.0_wp )      ! lateral boundary condition
 
       DO jk = 2, jpkm1                          !==  deeper values equal the surface one  ==!
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/cpl_oasis3.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/cpl_oasis3.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/cpl_oasis3.F90	(revision 14676)
@@ -294,5 +294,6 @@
       !
 #if defined key_agrif
-      IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN
+      ! Warning: Agrif_Nb_Fine_Grids not yet defined at this stage for Agrif_Root -> must use Agrif_Root_Only()
+      IF( Agrif_Root_Only() .OR. agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN
 #endif
       CALL oasis_enddef(nerror)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/fldread.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/fldread.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/fldread.F90	(revision 14676)
@@ -211,5 +211,5 @@
             !
             IF( sd(jf)%ln_tint ) THEN              ! temporal interpolation
-               IF(lwp .AND. kt - nit000 <= 100 ) THEN 
+               IF(lwp .AND. ( kt - nit000 <= 20 .OR. nitend - kt <= 20 ) ) THEN 
                   clfmt = "('   fld_read: var ', a, ' kt = ', i8, ' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   &
                      &    "', records b/a: ', i6.4, '/', i6.4, ' (days ', f9.4,'/', f9.4, ')')"
@@ -223,5 +223,5 @@
                sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,ibb) + ztinta * sd(jf)%fdta(:,:,:,iaa)
             ELSE   ! nothing to do...
-               IF(lwp .AND. kt - nit000 <= 100 ) THEN
+               IF(lwp .AND. ( kt - nit000 <= 20 .OR. nitend - kt <= 20 ) ) THEN
                   clfmt = "('   fld_read: var ', a, ' kt = ', i8,' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," //   &
                      &    "', record: ', i6.4, ' (days ', f9.4, ' <-> ', f9.4, ')')"
@@ -251,5 +251,5 @@
       !!---------------------------------------------------------------------
       !
-      IF( nflag == 0 )   nflag = -( HUGE(0) - 10 )
+      IF( nflag == 0 )   nflag = -HUGE(0)
       !
       CALL fld_def( sdjf )
@@ -908,10 +908,10 @@
       TYPE(FLD)        , INTENT(inout) ::   sdjf       ! input field related variables
       !
-      INTEGER, DIMENSION(2)  :: isave
+      INTEGER  :: isave
       LOGICAL  :: llprev, llnext, llstop
       !!----------------------------------------------------------------------
       !
       llprev = sdjf%nrecsec(sdjf%nreclast) < nsec000_1jan000   ! file ends before the beginning of the job -> file may not exist
-      llnext = sdjf%nrecsec(       0     ) > nsecend_1jan000   ! file begins after the end of the job -> file may not exist 
+      llnext = sdjf%nrecsec(      1      ) > nsecend_1jan000   ! file begins after the end of the job -> file may not exist 
 
       llstop = sdjf%ln_clim .OR. .NOT. ( llprev .OR. llnext )
@@ -926,18 +926,17 @@
          IF( llprev ) THEN   ! previous file does not exist : go back to current and accept to read only the first record
             CALL ctl_warn('previous file: '//TRIM(sdjf%clname)//' not found -> go back to current year/month/week/day file')
-            isave(1:2) = sdjf%nrecsec(sdjf%nreclast-1:sdjf%nreclast)   ! save previous file info
-            CALL fld_def( sdjf )   ! go back to current file
-            sdjf%nreclast = 1   ! force to use only the first record (do as if other were not existing...)
-            sdjf%nrecsec(0:1) = isave(1:2)
+            isave = sdjf%nrecsec(sdjf%nreclast)   ! save previous file info
+            CALL fld_def( sdjf )                  ! go back to current file
+            sdjf%nreclast = 1                     ! force to use only the first record (do as if other were not existing...)
          ENDIF
          !
          IF( llnext ) THEN   ! next     file does not exist : go back to current and accept to read only the last  record 
             CALL ctl_warn('next file: '//TRIM(sdjf%clname)//' not found -> go back to current year/month/week/day file')
-            isave(1:2) = sdjf%nrecsec(0:1)    ! save next file info
-            CALL fld_def( sdjf )   ! go back to current file
-            ! -> read last record but keep record info from the first record of next file
-            sdjf%nrecsec(sdjf%nreclast-1:sdjf%nreclast) = isave(1:2)
-            sdjf%nrecsec(0:sdjf%nreclast-2) = nflag
-         ENDIF
+            isave = sdjf%nrecsec(1)               ! save next file info
+            CALL fld_def( sdjf )                  ! go back to current file
+         ENDIF
+         ! -> read "last" record but keep record info from the first record of next file
+         sdjf%nrecsec(  sdjf%nreclast  ) = isave
+         sdjf%nrecsec(0:sdjf%nreclast-1) = nflag
          !
          CALL iom_open( sdjf%clname, sdjf%num, ldiof = LEN_TRIM(sdjf%wgtname) > 0 )   
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/geo2ocean.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/geo2ocean.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/geo2ocean.F90	(revision 14676)
@@ -272,6 +272,6 @@
       ! =========================== !
       !           ! lateral boundary cond.: T-, U-, V-, F-pts, sgn
-      CALL lbc_lnk_multi( 'geo2ocean', gcost, 'T', -1.0_wp, gsint, 'T', -1.0_wp, gcosu, 'U', -1.0_wp, gsinu, 'U', -1.0_wp, & 
-                      &   gcosv, 'V', -1.0_wp, gsinv, 'V', -1.0_wp, gcosf, 'F', -1.0_wp, gsinf, 'F', -1.0_wp  )
+      CALL lbc_lnk( 'geo2ocean', gcost, 'T', -1.0_wp, gsint, 'T', -1.0_wp, gcosu, 'U', -1.0_wp, gsinu, 'U', -1.0_wp, & 
+         &                       gcosv, 'V', -1.0_wp, gsinv, 'V', -1.0_wp, gcosf, 'F', -1.0_wp, gsinf, 'F', -1.0_wp  )
       !
    END SUBROUTINE angle
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcblk.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcblk.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcblk.F90	(revision 14676)
@@ -40,5 +40,5 @@
    USE sbcdcy         ! surface boundary condition: diurnal cycle
    USE sbcwave , ONLY :   cdn_wave ! wave module
-   USE lib_fortran    ! to use key_nosignedzero
+   USE lib_fortran    ! to use key_nosignedzero and glob_sum
    !
 #if defined key_si3
@@ -348,4 +348,7 @@
       !                                      !- fill the bulk structure with namelist informations
       CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_init', 'surface boundary condition -- bulk formulae', 'namsbc_blk' )
+      sf(jp_wndi )%zsgn = -1._wp   ;   sf(jp_wndj )%zsgn = -1._wp   ! vector field at T point: overwrite default definition of zsgn
+      sf(jp_uoatm)%zsgn = -1._wp   ;   sf(jp_voatm)%zsgn = -1._wp   ! vector field at T point: overwrite default definition of zsgn
+      sf(jp_hpgi )%zsgn = -1._wp   ;   sf(jp_hpgj )%zsgn = -1._wp   ! vector field at T point: overwrite default definition of zsgn
       !
       DO jfpr= 1, jpfld
@@ -501,5 +504,6 @@
       !!----------------------------------------------------------------------
       REAL(wp), DIMENSION(jpi,jpj) ::   zssq, zcd_du, zsen, zlat, zevp
-      REAL(wp) :: ztmp
+      REAL(wp) :: ztst
+      LOGICAL  :: llerr
       !!----------------------------------------------------------------------
       !
@@ -508,31 +512,29 @@
       ! Sanity/consistence test on humidity at first time step to detect potential screw-up:
       IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*) ''
-#if defined key_agrif
-         IF(lwp) WRITE(numout,*) ' === AGRIF => Sanity/consistence test on air humidity SKIPPED! :( ==='
-#else
-         ztmp = SUM(tmask(:,:,1)) ! number of ocean points on local proc domain
-         IF( ztmp > 8._wp ) THEN ! test only on proc domains with at least 8 ocean points!
-            ztmp = SUM(sf(jp_humi)%fnow(:,:,1)*tmask(:,:,1))/ztmp ! mean humidity over ocean on proc
-            SELECT CASE( nhumi )
-            CASE( np_humi_sph ) ! specific humidity => expect: 0. <= something < 0.065 [kg/kg] (0.061 is saturation at 45degC !!!)
-               IF(  (ztmp < 0._wp) .OR. (ztmp > 0.065)  ) ztmp = -1._wp
-            CASE( np_humi_dpt ) ! dew-point temperature => expect: 110. <= something < 320. [K]
-               IF( (ztmp < 110._wp).OR.(ztmp > 320._wp) ) ztmp = -1._wp
-            CASE( np_humi_rlh ) ! relative humidity => expect: 0. <= something < 100. [%]
-               IF(  (ztmp < 0._wp) .OR.(ztmp > 100._wp) ) ztmp = -1._wp
-            END SELECT
-            IF(ztmp < 0._wp) THEN
-               IF (lwp) WRITE(numout,'("   Mean humidity value found on proc #",i6.6," is: ",f10.5)') narea, ztmp
-               CALL ctl_stop( 'STOP', 'Something is wrong with air humidity!!!', &
-                  &   ' ==> check the unit in your input files'       , &
-                  &   ' ==> check consistence of namelist choice: specific? relative? dew-point?', &
-                  &   ' ==> ln_humi_sph -> [kg/kg] | ln_humi_rlh -> [%] | ln_humi_dpt -> [K] !!!' )
-            END IF
-         END IF
-         IF(lwp) WRITE(numout,*) ' === Sanity/consistence test on air humidity sucessfuly passed! ==='
-#endif
-         IF(lwp) WRITE(numout,*) ''
-      END IF !IF( kt == nit000 )
+         ! mean humidity over ocean on proc
+         ztst = glob_sum( 'sbcblk', sf(jp_humi)%fnow(:,:,1) * e1e2t(:,:) * tmask(:,:,1) ) / glob_sum( 'sbcblk', e1e2t(:,:) * tmask(:,:,1) )
+         llerr = .FALSE.
+         SELECT CASE( nhumi )
+         CASE( np_humi_sph ) ! specific humidity => expect: 0. <= something < 0.065 [kg/kg] (0.061 is saturation at 45degC !!!)
+            IF( (ztst <   0._wp) .OR. (ztst > 0.065_wp) )   llerr = .TRUE.
+         CASE( np_humi_dpt ) ! dew-point temperature => expect: 110. <= something < 320. [K]
+            IF( (ztst < 110._wp) .OR. (ztst >  320._wp) )   llerr = .TRUE.
+         CASE( np_humi_rlh ) ! relative humidity => expect: 0. <= something < 100. [%]
+            IF( (ztst <   0._wp) .OR. (ztst >  100._wp) )   llerr = .TRUE.
+         END SELECT
+         IF(llerr) THEN
+            WRITE(ctmp1,'("   Error on mean humidity value: ",f10.5)') ztst
+            CALL ctl_stop( 'STOP', ctmp1, 'Something is wrong with air humidity!!!', &
+               &   ' ==> check the unit in your input files'       , &
+               &   ' ==> check consistence of namelist choice: specific? relative? dew-point?', &
+               &   ' ==> ln_humi_sph -> [kg/kg] | ln_humi_rlh -> [%] | ln_humi_dpt -> [K] !!!' )
+         ENDIF
+         IF(lwp) THEN
+            WRITE(numout,*) ''
+            WRITE(numout,*) ' Global mean humidity at kt = nit000: ', ztst
+            WRITE(numout,*) ' === Sanity/consistence test on air humidity sucessfuly passed! ==='
+            WRITE(numout,*) ''
+         ENDIF
+      ENDIF   !IF( kt == nit000 )
       !                                            ! compute the surface ocean fluxes using bulk formulea
       IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN
@@ -620,6 +622,6 @@
       !!---------------------------------------------------------------------
       INTEGER , INTENT(in   )                 ::   kt     ! time step index
-      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndi  ! atmospheric wind at U-point              [m/s]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndj  ! atmospheric wind at V-point              [m/s]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndi  ! atmospheric wind at T-point              [m/s]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pwndj  ! atmospheric wind at T-point              [m/s]
       REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   pqair  ! specific humidity at T-points            [kg/kg]
       REAL(wp), INTENT(in   ), DIMENSION(:,:) ::   ptair  ! potential temperature at T-points        [Kelvin]
@@ -830,7 +832,7 @@
 
          IF( ln_crt_fbk ) THEN
-            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1., taum, 'T', -1. )
+            CALL lbc_lnk( 'sbcblk', utau, 'U', -1._wp, vtau, 'V', -1._wp, taum, 'T', 1._wp )
          ELSE
-            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1. )
+            CALL lbc_lnk( 'sbcblk', utau, 'U', -1._wp, vtau, 'V', -1._wp )
          ENDIF
 
@@ -1066,5 +1068,5 @@
             pvtaui(ji,jj) = zztmp2 * ( pvtaui(ji,jj) + pvtaui(ji  ,jj+1) )
          END_2D
-         CALL lbc_lnk_multi( 'sbcblk', putaui, 'U', -1._wp, pvtaui, 'V', -1._wp )
+         CALL lbc_lnk( 'sbcblk', putaui, 'U', -1._wp, pvtaui, 'V', -1._wp )
          !
          IF(sn_cfctl%l_prtctl)  CALL prt_ctl( tab2d_1=putaui  , clinfo1=' blk_ice: putaui : '   &
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbccpl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbccpl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbccpl.F90	(revision 14676)
@@ -129,4 +129,5 @@
    INTEGER, PARAMETER ::   jpr_icb    = 61
    INTEGER, PARAMETER ::   jpr_ts_ice = 62   ! Sea ice surface temp
+   !!INTEGER, PARAMETER ::   jpr_qtrice = 63   ! Transmitted solar thru sea-ice
 
    INTEGER, PARAMETER ::   jprcv      = 62   ! total number of fields received
@@ -202,4 +203,5 @@
       &             sn_rcv_wstrf, sn_rcv_wdrag, sn_rcv_charn, sn_rcv_taw, sn_rcv_bhd, sn_rcv_tusd, sn_rcv_tvsd
    !                                   ! Other namelist parameters
+!!   TYPE(FLD_C) ::   sn_rcv_qtrice
    INTEGER     ::   nn_cplmodel           ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
    LOGICAL     ::   ln_usecplmask         !  use a coupling mask file to merge data received from several models
@@ -237,5 +239,5 @@
       !!             ***  FUNCTION sbc_cpl_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER :: ierr(5)
+      INTEGER :: ierr(4)
       !!----------------------------------------------------------------------
       ierr(:) = 0
@@ -247,9 +249,6 @@
 #endif
       ALLOCATE( xcplmask(jpi,jpj,0:nn_cplmodel) , STAT=ierr(3) )
-#if defined key_si3 || defined key_cice
-      ALLOCATE( a_i_last_couple(jpi,jpj,jpl) , STAT=ierr(4) )
-#endif
-      !
-      IF( .NOT. ln_apr_dyn ) ALLOCATE( ssh_ib(jpi,jpj), ssh_ibb(jpi,jpj), apr(jpi, jpj), STAT=ierr(5) )
+      !
+      IF( .NOT. ln_apr_dyn ) ALLOCATE( ssh_ib(jpi,jpj), ssh_ibb(jpi,jpj), apr(jpi, jpj), STAT=ierr(4) )
 
       sbc_cpl_alloc = MAXVAL( ierr )
@@ -286,5 +285,5 @@
          &                  sn_rcv_charn , sn_rcv_taw   , sn_rcv_bhd  , sn_rcv_tusd  , sn_rcv_tvsd,    &
          &                  sn_rcv_wdrag , sn_rcv_qns   , sn_rcv_emp  , sn_rcv_rnf   , sn_rcv_cal  ,   &
-         &                  sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_icb  , sn_rcv_isf   , sn_rcv_ts_ice
+         &                  sn_rcv_iceflx, sn_rcv_co2   , sn_rcv_icb  , sn_rcv_isf   , sn_rcv_ts_ice !!, sn_rcv_qtrice
 
       !!---------------------------------------------------------------------
@@ -327,4 +326,5 @@
          WRITE(numout,*)'      ice shelf                       = ', TRIM(sn_rcv_isf%cldes   ), ' (', TRIM(sn_rcv_isf%clcat   ), ')'
          WRITE(numout,*)'      sea ice heat fluxes             = ', TRIM(sn_rcv_iceflx%cldes), ' (', TRIM(sn_rcv_iceflx%clcat), ')'
+!!       WRITE(numout,*)'      transmitted solar thru sea-ice  = ', TRIM(sn_rcv_qtrice%cldes), ' (', TRIM(sn_rcv_qtrice%clcat), ')'
          WRITE(numout,*)'      atm co2                         = ', TRIM(sn_rcv_co2%cldes   ), ' (', TRIM(sn_rcv_co2%clcat   ), ')'
          WRITE(numout,*)'      Sea ice surface skin temperature= ', TRIM(sn_rcv_ts_ice%cldes), ' (', TRIM(sn_rcv_ts_ice%clcat), ')'
@@ -602,7 +602,7 @@
       srcv(jpr_mslp)%clname = 'O_MSLP'     ;   IF( TRIM(sn_rcv_mslp%cldes  ) == 'coupled' )    srcv(jpr_mslp)%laction = .TRUE.
       !
-      !                                                      ! ------------------------- !
-      !                                                      !  ice topmelt and botmelt  !
-      !                                                      ! ------------------------- !
+      !                                                      ! --------------------------------- !
+      !                                                      !  ice topmelt and conduction flux  !   
+      !                                                      ! --------------------------------- !
       srcv(jpr_topm )%clname = 'OTopMlt'
       srcv(jpr_botm )%clname = 'OBotMlt'
@@ -615,4 +615,16 @@
          srcv(jpr_topm:jpr_botm)%laction = .TRUE.
       ENDIF
+!!      !                                                      ! --------------------------- !
+!!      !                                                      ! transmitted solar thru ice  !   
+!!      !                                                      ! --------------------------- !
+!!      srcv(jpr_qtrice)%clname = 'OQtr'
+!!      IF( TRIM(sn_rcv_qtrice%cldes) == 'coupled' ) THEN
+!!         IF ( TRIM( sn_rcv_qtrice%clcat ) == 'yes' ) THEN
+!!            srcv(jpr_qtrice)%nct = nn_cats_cpl
+!!         ELSE
+!!           CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qtrice%clcat should always be set to yes currently' )
+!!         ENDIF
+!!         srcv(jpr_qtrice)%laction = .TRUE.
+!!      ENDIF
       !                                                      ! ------------------------- !
       !                                                      !    ice skin temperature   !
@@ -888,8 +900,4 @@
       END SELECT
 
-      ! Initialise ice fractions from last coupling time to zero (needed by Met-Office)
-#if defined key_si3 || defined key_cice
-       a_i_last_couple(:,:,:) = 0._wp
-#endif
       !                                                      ! ------------------------- !
       !                                                      !      Ice Meltponds        !
@@ -1248,5 +1256,5 @@
                   frcv(jpr_oty1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_oty1)%z3(ji  ,jj+1,1) + frcv(jpr_oty1)%z3(ji,jj,1) )
                END_2D
-               CALL lbc_lnk_multi( 'sbccpl', frcv(jpr_otx1)%z3(:,:,1), 'U',  -1.0_wp, frcv(jpr_oty1)%z3(:,:,1), 'V',  -1.0_wp )
+               CALL lbc_lnk( 'sbccpl', frcv(jpr_otx1)%z3(:,:,1), 'U',  -1.0_wp, frcv(jpr_oty1)%z3(:,:,1), 'V',  -1.0_wp )
             ENDIF
             llnewtx = .TRUE.
@@ -1589,6 +1597,6 @@
       !! ** Action  :   return ptau_i, ptau_j, the stress over the ice
       !!----------------------------------------------------------------------
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_taui   ! i- & j-components of atmos-ice stress [N/m2]
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_tauj   ! at I-point (B-grid) or U & V-point (C-grid)
+      REAL(wp), INTENT(inout), DIMENSION(:,:) ::   p_taui   ! i- & j-components of atmos-ice stress [N/m2]
+      REAL(wp), INTENT(inout), DIMENSION(:,:) ::   p_tauj   ! at I-point (B-grid) or U & V-point (C-grid)
       !!
       INTEGER ::   ji, jj   ! dummy loop indices
@@ -1597,4 +1605,6 @@
       REAL(wp), DIMENSION(jpi,jpj) ::   ztx, zty
       !!----------------------------------------------------------------------
+      !
+#if defined key_si3 || defined key_cice
       !
       IF( srcv(jpr_itx1)%laction ) THEN   ;   itx =  jpr_itx1
@@ -1666,13 +1676,15 @@
                p_tauj(ji,jj) = zztmp2 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) )
             END_2D
-            CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U',  -1., p_tauj, 'V',  -1. )
+            CALL lbc_lnk( 'sbccpl', p_taui, 'U',  -1., p_tauj, 'V',  -1. )
          END SELECT
 
       ENDIF
       !
+#endif
+      !
    END SUBROUTINE sbc_cpl_ice_tau
 
 
-   SUBROUTINE sbc_cpl_ice_flx( picefr, palbi, psst, pist, phs, phi )
+   SUBROUTINE sbc_cpl_ice_flx( kt, picefr, palbi, psst, pist, phs, phi )
       !!----------------------------------------------------------------------
       !!             ***  ROUTINE sbc_cpl_ice_flx  ***
@@ -1716,4 +1728,11 @@
       !!                                                                      are provided but not included in emp here. Only runoff will
       !!                                                                      be included in emp in other parts of NEMO code
+      !!
+      !! ** Note : In case of the ice-atm coupling with conduction fluxes (such as Jules interface for the Met-Office),
+      !!              qsr_ice and qns_ice are not provided and they are not supposed to be used in the ice code.
+      !!              However, by precaution we also "fake" qns_ice and qsr_ice this way:
+      !!              qns_ice = qml_ice + qcn_ice ??
+      !!              qsr_ice = qtr_ice_top ??
+      !!
       !! ** Action  :   update at each nf_ice time step:
       !!                   qns_tot, qsr_tot  non-solar and solar total heat fluxes
@@ -1724,4 +1743,5 @@
       !!                   sprecip           solid precipitation over the ocean
       !!----------------------------------------------------------------------
+      INTEGER,  INTENT(in)                                ::   kt         ! ocean model time step index (only for a_i_last_couple)
       REAL(wp), INTENT(in)   , DIMENSION(:,:)             ::   picefr     ! ice fraction                [0 to 1]
       !                                                   !!           ! optional arguments, used only in 'mixed oce-ice' case or for Met-Office coupling
@@ -1740,4 +1760,13 @@
       REAL(wp), DIMENSION(jpi,jpj)     ::   ztri
       !!----------------------------------------------------------------------
+      !
+#if defined key_si3 || defined key_cice
+      !
+      IF( kt == nit000 ) THEN
+         ! allocate ice fractions from last coupling time here and not in sbc_cpl_init because of jpl
+         IF( .NOT.ALLOCATED(a_i_last_couple) )   ALLOCATE( a_i_last_couple(jpi,jpj,jpl) )
+         ! initialize to a_i for the 1st time step
+         a_i_last_couple(:,:,:) = a_i(:,:,:)
+      ENDIF
       !
       IF( ln_mixcpl )   zmsk(:,:) = 1. - xcplmask(:,:,0)
@@ -1767,6 +1796,4 @@
          CALL ctl_stop('STOP', 'sbccpl/sbc_cpl_ice_flx: some fields are not defined. Change sn_rcv_emp value in namelist namsbc_cpl')
       END SELECT
-
-#if defined key_si3
 
       ! --- evaporation over ice (kg/m2/s) --- !
@@ -1860,38 +1887,34 @@
       ENDIF
 
-#else
-      zsnw(:,:) = picefr(:,:)
-      ! --- Continental fluxes --- !
-      IF( srcv(jpr_rnf)%laction ) THEN   ! runoffs (included in emp later on)
-         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1)
-      ENDIF
-      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot)
-         zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1)
-      ENDIF
-      IF( srcv(jpr_icb)%laction ) THEN   ! iceberg added to runoffs
-         fwficb(:,:) = frcv(jpr_icb)%z3(:,:,1)
-         rnf(:,:)    = rnf(:,:) + fwficb(:,:)
-      ENDIF
-      IF( srcv(jpr_isf)%laction ) THEN   ! iceshelf (fwfisf <0 mean melting)
-        fwfisf_oasis(:,:) = - frcv(jpr_isf)%z3(:,:,1)
-      ENDIF
-      !
-      IF( ln_mixcpl ) THEN
-         emp_tot(:,:) = emp_tot(:,:) * xcplmask(:,:,0) + zemp_tot(:,:) * zmsk(:,:)
-         emp_ice(:,:) = emp_ice(:,:) * xcplmask(:,:,0) + zemp_ice(:,:) * zmsk(:,:)
-         sprecip(:,:) = sprecip(:,:) * xcplmask(:,:,0) + zsprecip(:,:) * zmsk(:,:)
-         tprecip(:,:) = tprecip(:,:) * xcplmask(:,:,0) + ztprecip(:,:) * zmsk(:,:)
-      ELSE
-         emp_tot(:,:) =                                  zemp_tot(:,:)
-         emp_ice(:,:) =                                  zemp_ice(:,:)
-         sprecip(:,:) =                                  zsprecip(:,:)
-         tprecip(:,:) =                                  ztprecip(:,:)
-      ENDIF
-      !
-#endif
-
+!! for CICE ??
+!!$      zsnw(:,:) = picefr(:,:)
+!!$      ! --- Continental fluxes --- !
+!!$      IF( srcv(jpr_rnf)%laction ) THEN   ! runoffs (included in emp later on)
+!!$         rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1)
+!!$      ENDIF
+!!$      IF( srcv(jpr_cal)%laction ) THEN   ! calving (put in emp_tot)
+!!$         zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1)
+!!$      ENDIF
+!!$      IF( srcv(jpr_icb)%laction ) THEN   ! iceberg added to runoffs
+!!$         fwficb(:,:) = frcv(jpr_icb)%z3(:,:,1)
+!!$         rnf(:,:)    = rnf(:,:) + fwficb(:,:)
+!!$      ENDIF
+!!$      IF( srcv(jpr_isf)%laction ) THEN   ! iceshelf (fwfisf <0 mean melting)
+!!$        fwfisf_oasis(:,:) = - frcv(jpr_isf)%z3(:,:,1)
+!!$      ENDIF
+!!$      !
+!!$      IF( ln_mixcpl ) THEN
+!!$         emp_tot(:,:) = emp_tot(:,:) * xcplmask(:,:,0) + zemp_tot(:,:) * zmsk(:,:)
+!!$         emp_ice(:,:) = emp_ice(:,:) * xcplmask(:,:,0) + zemp_ice(:,:) * zmsk(:,:)
+!!$         sprecip(:,:) = sprecip(:,:) * xcplmask(:,:,0) + zsprecip(:,:) * zmsk(:,:)
+!!$         tprecip(:,:) = tprecip(:,:) * xcplmask(:,:,0) + ztprecip(:,:) * zmsk(:,:)
+!!$      ELSE
+!!$         emp_tot(:,:) =                                  zemp_tot(:,:)
+!!$         emp_ice(:,:) =                                  zemp_ice(:,:)
+!!$         sprecip(:,:) =                                  zsprecip(:,:)
+!!$         tprecip(:,:) =                                  ztprecip(:,:)
+!!$      ENDIF
+      !
       ! outputs
-!!      IF( srcv(jpr_rnf)%laction )   CALL iom_put( 'runoffs' , rnf(:,:) * tmask(:,:,1)                                 )  ! runoff
-!!      IF( srcv(jpr_isf)%laction )   CALL iom_put( 'iceshelf_cea', -fwfisf(:,:) * tmask(:,:,1)                         )  ! iceshelf
       IF( srcv(jpr_cal)%laction )    CALL iom_put( 'calving_cea' , frcv(jpr_cal)%z3(:,:,1) * tmask(:,:,1)                )  ! calving
       IF( srcv(jpr_icb)%laction )    CALL iom_put( 'iceberg_cea' , frcv(jpr_icb)%z3(:,:,1) * tmask(:,:,1)                )  ! icebergs
@@ -1906,4 +1929,24 @@
          &                                                         - frcv(jpr_ievp)%z3(:,:,1) * picefr(:,:) ) * tmask(:,:,1) ) ! ice-free oce evap (cell average)
       ! note: runoff output is done in sbcrnf (which includes icebergs too) and iceshelf output is done in sbcisf
+!!      IF( srcv(jpr_rnf)%laction )   CALL iom_put( 'runoffs' , rnf(:,:) * tmask(:,:,1)                                 )  ! runoff
+!!      IF( srcv(jpr_isf)%laction )   CALL iom_put( 'iceshelf_cea', -fwfisf(:,:) * tmask(:,:,1)                         )  ! iceshelf
+      !
+      !                                                      ! ========================= !
+      SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )             !  ice topmelt and botmelt  !
+      !                                                      ! ========================= !
+      CASE ('coupled')
+         IF (ln_scale_ice_flux) THEN
+            WHERE( a_i(:,:,:) > 1.e-10_wp )
+               qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+               qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+            ELSEWHERE
+               qml_ice(:,:,:) = 0.0_wp
+               qcn_ice(:,:,:) = 0.0_wp
+            END WHERE
+         ELSE
+            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:)
+            qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:)
+         ENDIF
+      END SELECT
       !
       !                                                      ! ========================= !
@@ -1911,8 +1954,13 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )         ! the required field is directly provided
-         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
-         ! For Met Office sea ice non-solar fluxes are already delt with by JULES so setting to zero
-         ! here so the only flux is the ocean only one.
-         zqns_ice(:,:,:) = 0._wp
+         ! Get the sea ice non solar heat flux from conductive, melting and sublimation fluxes
+         IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN
+            zqns_ice(:,:,:) = qml_ice(:,:,:) + qcn_ice(:,:,:)
+         ELSE
+            zqns_ice(:,:,:) = 0._wp
+         ENDIF
+         ! Calculate the total non solar heat flux. The ocean only non solar heat flux (zqns_oce) will be recalculated after this CASE
+         ! statement to be consistent with other coupling methods even though .zqns_oce = frcv(jpr_qnsoce)%z3(:,:,1)
+         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1) + SUM( zqns_ice(:,:,:) * a_i(:,:,:), dim=3 )
       CASE( 'conservative' )     ! the required fields are directly provided
          zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
@@ -1961,5 +2009,4 @@
       IF( srcv(jpr_icb)%laction )   zqns_tot(:,:) = zqns_tot(:,:) - frcv(jpr_icb)%z3(:,:,1) * rLfus  ! remove latent heat of iceberg melting
 
-#if defined key_si3
       ! --- non solar flux over ocean --- !
       !         note: ziceld cannot be = 0 since we limit the ice concentration to amax
@@ -2014,26 +2061,26 @@
       ENDIF
 
-#else
-      zcptsnw (:,:) = zcptn(:,:)
-      zcptrain(:,:) = zcptn(:,:)
-
-      ! clem: this formulation is certainly wrong... but better than it was...
-      zqns_tot(:,:) = zqns_tot(:,:)                             &          ! zqns_tot update over free ocean with:
-         &          - (  ziceld(:,:) * zsprecip(:,:) * rLfus )  &          ! remove the latent heat flux of solid precip. melting
-         &          - (  zemp_tot(:,:)                          &          ! remove the heat content of mass flux (assumed to be at SST)
-         &             - zemp_ice(:,:) ) * zcptn(:,:)
-
-     IF( ln_mixcpl ) THEN
-         qns_tot(:,:) = qns(:,:) * ziceld(:,:) + SUM( qns_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
-         qns_tot(:,:) = qns_tot(:,:) * xcplmask(:,:,0) +  zqns_tot(:,:)* zmsk(:,:)
-         DO jl=1,jpl
-            qns_ice(:,:,jl) = qns_ice(:,:,jl) * xcplmask(:,:,0) +  zqns_ice(:,:,jl)* zmsk(:,:)
-         ENDDO
-      ELSE
-         qns_tot(:,:  ) = zqns_tot(:,:  )
-         qns_ice(:,:,:) = zqns_ice(:,:,:)
-      ENDIF
-
-#endif
+!! for CICE ??
+!!$      ! --- non solar flux over ocean --- !
+!!$      zcptsnw (:,:) = zcptn(:,:)
+!!$      zcptrain(:,:) = zcptn(:,:)
+!!$
+!!$      ! clem: this formulation is certainly wrong... but better than it was...
+!!$      zqns_tot(:,:) = zqns_tot(:,:)                             &          ! zqns_tot update over free ocean with:
+!!$         &          - (  ziceld(:,:) * zsprecip(:,:) * rLfus )  &          ! remove the latent heat flux of solid precip. melting
+!!$         &          - (  zemp_tot(:,:)                          &          ! remove the heat content of mass flux (assumed to be at SST)
+!!$         &             - zemp_ice(:,:) ) * zcptn(:,:)
+!!$
+!!$     IF( ln_mixcpl ) THEN
+!!$         qns_tot(:,:) = qns(:,:) * ziceld(:,:) + SUM( qns_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
+!!$         qns_tot(:,:) = qns_tot(:,:) * xcplmask(:,:,0) +  zqns_tot(:,:)* zmsk(:,:)
+!!$         DO jl=1,jpl
+!!$            qns_ice(:,:,jl) = qns_ice(:,:,jl) * xcplmask(:,:,0) +  zqns_ice(:,:,jl)* zmsk(:,:)
+!!$         ENDDO
+!!$      ELSE
+!!$         qns_tot(:,:  ) = zqns_tot(:,:  )
+!!$         qns_ice(:,:,:) = zqns_ice(:,:,:)
+!!$      ENDIF
+
       ! outputs
       IF ( srcv(jpr_cal)%laction ) CALL iom_put('hflx_cal_cea' , - frcv(jpr_cal)%z3(:,:,1) * rLfus ) ! latent heat from calving
@@ -2056,10 +2103,33 @@
       !
       !                                                      ! ========================= !
+      SELECT CASE( TRIM( sn_rcv_dqnsdt%cldes ) )             !          d(qns)/dt        !
+      !                                                      ! ========================= !
+      CASE ('coupled')
+         IF( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
+            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
+         ELSE
+            ! Set all category values equal for the moment
+            DO jl=1,jpl
+               zdqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
+            ENDDO
+         ENDIF
+      CASE( 'none' )
+         zdqns_ice(:,:,:) = 0._wp
+      END SELECT
+
+      IF( ln_mixcpl ) THEN
+         DO jl=1,jpl
+            dqns_ice(:,:,jl) = dqns_ice(:,:,jl) * xcplmask(:,:,0) + zdqns_ice(:,:,jl) * zmsk(:,:)
+         ENDDO
+      ELSE
+         dqns_ice(:,:,:) = zdqns_ice(:,:,:)
+      ENDIF
+      !                                                      ! ========================= !
       SELECT CASE( TRIM( sn_rcv_qsr%cldes ) )                !      solar heat fluxes    !   (qsr)
       !                                                      ! ========================= !
       CASE( 'oce only' )
          zqsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) )
-         ! For Met Office sea ice solar fluxes are already delt with by JULES so setting to zero
-         ! here so the only flux is the ocean only one.
+         ! For the Met Office the only sea ice solar flux is the transmitted qsr which is added onto zqsr_ice
+         ! further down. Therefore start zqsr_ice off at zero.
          zqsr_ice(:,:,:) = 0._wp
       CASE( 'conservative' )
@@ -2114,68 +2184,4 @@
          END DO
       ENDIF
-
-#if defined key_si3
-      ! --- solar flux over ocean --- !
-      !         note: ziceld cannot be = 0 since we limit the ice concentration to amax
-      zqsr_oce = 0._wp
-      WHERE( ziceld /= 0._wp )  zqsr_oce(:,:) = ( zqsr_tot(:,:) - SUM( a_i * zqsr_ice, dim=3 ) ) / ziceld(:,:)
-
-      IF( ln_mixcpl ) THEN   ;   qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) +  zqsr_oce(:,:)* zmsk(:,:)
-      ELSE                   ;   qsr_oce(:,:) = zqsr_oce(:,:)   ;   ENDIF
-#endif
-
-      IF( ln_mixcpl ) THEN
-         qsr_tot(:,:) = qsr(:,:) * ziceld(:,:) + SUM( qsr_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
-         qsr_tot(:,:) = qsr_tot(:,:) * xcplmask(:,:,0) +  zqsr_tot(:,:)* zmsk(:,:)
-         DO jl = 1, jpl
-            qsr_ice(:,:,jl) = qsr_ice(:,:,jl) * xcplmask(:,:,0) +  zqsr_ice(:,:,jl)* zmsk(:,:)
-         END DO
-      ELSE
-         qsr_tot(:,:  ) = zqsr_tot(:,:  )
-         qsr_ice(:,:,:) = zqsr_ice(:,:,:)
-      ENDIF
-
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_dqnsdt%cldes ) )             !          d(qns)/dt        !
-      !                                                      ! ========================= !
-      CASE ('coupled')
-         IF( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
-            zdqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
-         ELSE
-            ! Set all category values equal for the moment
-            DO jl=1,jpl
-               zdqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      CASE( 'none' )
-         zdqns_ice(:,:,:) = 0._wp
-      END SELECT
-
-      IF( ln_mixcpl ) THEN
-         DO jl=1,jpl
-            dqns_ice(:,:,jl) = dqns_ice(:,:,jl) * xcplmask(:,:,0) + zdqns_ice(:,:,jl) * zmsk(:,:)
-         ENDDO
-      ELSE
-         dqns_ice(:,:,:) = zdqns_ice(:,:,:)
-      ENDIF
-
-#if defined key_si3
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )             !  ice topmelt and botmelt  !
-      !                                                      ! ========================= !
-      CASE ('coupled')
-         IF (ln_scale_ice_flux) THEN
-            WHERE( a_i(:,:,:) > 1.e-10_wp )
-               qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
-               qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
-            ELSEWHERE
-               qml_ice(:,:,:) = 0.0_wp
-               qcn_ice(:,:,:) = 0.0_wp
-            END WHERE
-         ELSE
-            qml_ice(:,:,:) = frcv(jpr_topm)%z3(:,:,:)
-            qcn_ice(:,:,:) = frcv(jpr_botm)%z3(:,:,:)
-         ENDIF
-      END SELECT
       !                                                      ! ========================= !
       !                                                      !      Transmitted Qsr      !   [W/m2]
@@ -2209,17 +2215,50 @@
       ELSEIF( ln_cndflx .AND. .NOT.ln_cndemulate ) THEN      !==  conduction flux as surface forcing  ==!
          !
-         !          ! ===> here we must receive the qtr_ice_top array from the coupler
-         !                 for now just assume zero (fully opaque ice)
+!!         SELECT CASE( TRIM( sn_rcv_qtrice%cldes ) )
+!!            !
+!!            !      ! ===> here we receive the qtr_ice_top array from the coupler
+!!         CASE ('coupled')
+!!            IF (ln_scale_ice_flux) THEN
+!!               WHERE( a_i(:,:,:) > 1.e-10_wp )
+!!                  zqtr_ice_top(:,:,:) = frcv(jpr_qtrice)%z3(:,:,:) * a_i_last_couple(:,:,:) / a_i(:,:,:)
+!!               ELSEWHERE
+!!                  zqtr_ice_top(:,:,:) = 0.0_wp
+!!               ENDWHERE
+!!            ELSE
+!!               zqtr_ice_top(:,:,:) = frcv(jpr_qtrice)%z3(:,:,:)
+!!            ENDIF
+!!           
+!!            ! Add retrieved transmitted solar radiation onto the ice and total solar radiation
+!!            zqsr_ice(:,:,:) = zqsr_ice(:,:,:) + zqtr_ice_top(:,:,:)
+!!            zqsr_tot(:,:)   = zqsr_tot(:,:) + SUM( zqtr_ice_top(:,:,:) * a_i(:,:,:), dim=3 )
+!!            
+!!            !      if we are not getting this data from the coupler then assume zero (fully opaque ice)
+!!         CASE ('none')
          zqtr_ice_top(:,:,:) = 0._wp
-         !
-      ENDIF
-      !
+!!         END SELECT
+            !
+      ENDIF
+
       IF( ln_mixcpl ) THEN
-         DO jl=1,jpl
+         qsr_tot(:,:) = qsr(:,:) * ziceld(:,:) + SUM( qsr_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
+         qsr_tot(:,:) = qsr_tot(:,:) * xcplmask(:,:,0) + zqsr_tot(:,:) * zmsk(:,:)
+         DO jl = 1, jpl
+            qsr_ice    (:,:,jl) = qsr_ice    (:,:,jl) * xcplmask(:,:,0) + zqsr_ice    (:,:,jl) * zmsk(:,:)
             qtr_ice_top(:,:,jl) = qtr_ice_top(:,:,jl) * xcplmask(:,:,0) + zqtr_ice_top(:,:,jl) * zmsk(:,:)
-         ENDDO
+         END DO
       ELSE
+         qsr_tot    (:,:  ) = zqsr_tot    (:,:  )
+         qsr_ice    (:,:,:) = zqsr_ice    (:,:,:)
          qtr_ice_top(:,:,:) = zqtr_ice_top(:,:,:)
       ENDIF
+      
+      ! --- solar flux over ocean --- !
+      !         note: ziceld cannot be = 0 since we limit the ice concentration to amax
+      zqsr_oce = 0._wp
+      WHERE( ziceld /= 0._wp )  zqsr_oce(:,:) = ( zqsr_tot(:,:) - SUM( a_i * zqsr_ice, dim=3 ) ) / ziceld(:,:)
+
+      IF( ln_mixcpl ) THEN   ;   qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) +  zqsr_oce(:,:)* zmsk(:,:)
+      ELSE                   ;   qsr_oce(:,:) = zqsr_oce(:,:)   ;   ENDIF
+
       !                                                      ! ================== !
       !                                                      !   ice skin temp.   !
@@ -2560,5 +2599,5 @@
                   zity1(ji,jj) = 0.5 * ( v_ice(ji,jj  )     + v_ice(ji  ,jj-1  )     ) *  fr_i(ji,jj)
                END_2D
-               CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1.0_wp, zity1, 'T', -1.0_wp )
+               CALL lbc_lnk( 'sbccpl', zitx1, 'T', -1.0_wp, zity1, 'T', -1.0_wp )
             CASE( 'mixed oce-ice'        )      ! Ocean and Ice on C-grid ==> T
                DO_2D( 0, 0, 0, 0 )
@@ -2569,5 +2608,5 @@
                END_2D
             END SELECT
-            CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocx1)%clgrid, -1.0_wp,  zoty1, ssnd(jps_ocy1)%clgrid, -1.0_wp )
+            CALL lbc_lnk( 'sbccpl', zotx1, ssnd(jps_ocx1)%clgrid, -1.0_wp,  zoty1, ssnd(jps_ocy1)%clgrid, -1.0_wp )
             !
          ENDIF
@@ -2637,5 +2676,5 @@
                 zity1(ji,jj) = 0.5 * ( v_ice(ji,jj  ) + v_ice(ji  ,jj-1  ) ) *  fr_i(ji,jj)
              END_2D
-             CALL lbc_lnk_multi( 'sbccpl', zitx1, 'T', -1.0_wp,  zity1, 'T', -1.0_wp )
+             CALL lbc_lnk( 'sbccpl', zitx1, 'T', -1.0_wp,  zity1, 'T', -1.0_wp )
           CASE( 'mixed oce-ice'        )      ! Ocean and Ice on C-grid ==> T
              DO_2D( 0, 0, 0, 0 )
@@ -2646,5 +2685,5 @@
              END_2D
           END SELECT
-         CALL lbc_lnk_multi( 'sbccpl', zotx1, ssnd(jps_ocxw)%clgrid, -1.0_wp, zoty1, ssnd(jps_ocyw)%clgrid, -1.0_wp )
+         CALL lbc_lnk( 'sbccpl', zotx1, ssnd(jps_ocxw)%clgrid, -1.0_wp, zoty1, ssnd(jps_ocyw)%clgrid, -1.0_wp )
          !
          !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcflx.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcflx.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcflx.F90	(revision 14676)
@@ -119,4 +119,6 @@
          !                                         ! fill sf with slf_i and control print
          CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' )
+         sf(jp_utau)%cltype = 'U'   ;   sf(jp_utau)%zsgn = -1._wp   ! vector field at U point: overwrite default definition of cltype and zsgn
+         sf(jp_vtau)%cltype = 'V'   ;   sf(jp_vtau)%zsgn = -1._wp   ! vector field at V point: overwrite default definition of cltype and zsgn
          !
       ENDIF
@@ -129,9 +131,9 @@
             qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1)
          ELSE
-            DO_2D( 0, 0, 0, 0 )
-               qsr(ji,jj) =          sf(jp_qsr)%fnow(ji,jj,1)   * tmask(ji,jj,1)
+            DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
+               qsr(ji,jj) =     sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1)
             END_2D
          ENDIF
-         DO_2D( 0, 0, 0, 0 )                                      ! set the ocean fluxes from read fields
+         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )                  ! set the ocean fluxes from read fields
             utau(ji,jj) =   sf(jp_utau)%fnow(ji,jj,1)                              * umask(ji,jj,1)
             vtau(ji,jj) =   sf(jp_vtau)%fnow(ji,jj,1)                              * vmask(ji,jj,1)
@@ -143,8 +145,4 @@
          !!clem: I do not think it is needed
          !!qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp        ! mass flux is at SST
-         !
-         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x)
-         CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, &
-            &                           qns, 'T',  1._wp, emp , 'T',  1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp  )
          !
          IF( nitend-nit000 <= 100 .AND. lwp ) THEN                ! control print (if less than 100 time-step asked)
@@ -172,5 +170,5 @@
       END_2D
       !
-      CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp )
+      CALL lbc_lnk( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp )
       !
    END SUBROUTINE sbc_flx
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcice_cice.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcice_cice.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcice_cice.F90	(revision 14676)
@@ -139,5 +139,5 @@
             CALL cice_sbc_force(kt)
          ELSE IF( ksbc == jp_purecpl ) THEN
-            CALL sbc_cpl_ice_flx( fr_i )
+            CALL sbc_cpl_ice_flx( kt, fr_i )
          ENDIF
 
@@ -222,5 +222,5 @@
       END_2D
 
-      CALL lbc_lnk_multi( 'sbcice_cice', fr_iu , 'U', 1.0_wp,  fr_iv , 'V', 1.0_wp )
+      CALL lbc_lnk( 'sbcice_cice', fr_iu , 'U', 1.0_wp,  fr_iv , 'V', 1.0_wp )
 
       ! set the snow+ice mass
@@ -569,5 +569,5 @@
       fmmflx(:,:) = ztmp1(:,:) !!Joakim edit
       
-      CALL lbc_lnk_multi( 'sbcice_cice', emp , 'T', 1.0_wp, sfx , 'T', 1.0_wp )
+      CALL lbc_lnk( 'sbcice_cice', emp , 'T', 1.0_wp, sfx , 'T', 1.0_wp )
 
 ! Solar penetrative radiation and non solar surface heat flux
@@ -626,5 +626,5 @@
       END_2D
 
-      CALL lbc_lnk_multi( 'sbcice_cice', fr_iu , 'U', 1.0_wp, fr_iv , 'V', 1.0_wp )
+      CALL lbc_lnk( 'sbcice_cice', fr_iu , 'U', 1.0_wp, fr_iv , 'V', 1.0_wp )
 
       ! set the snow+ice mass
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcwave.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcwave.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/SBC/sbcwave.F90	(revision 14676)
@@ -211,5 +211,5 @@
       ENDIF
 
-      CALL lbc_lnk_multi( 'sbcwave', usd, 'U', -1.0_wp, vsd, 'V', -1.0_wp )
+      CALL lbc_lnk( 'sbcwave', usd, 'U', -1.0_wp, vsd, 'V', -1.0_wp )
 
       !
@@ -503,4 +503,5 @@
                !
                CALL fld_fill( sf_sd, slf_i, cn_dir, 'sbc_wave_init', 'Wave module ', 'namsbc_wave' )
+               sf_sd(jp_usd)%zsgn = -1._wp   ;  sf_sd(jp_vsd)%zsgn = -1._wp   ! vector field at T point: overwrite default definition of zsgn
             ENDIF
             !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TDE/tide.h90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TDE/tide.h90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TDE/tide.h90	(revision 14676)
@@ -67,5 +67,6 @@
    !                         |                                                              Diurnal tidal constituents                                                                |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components( 8) = tide( 'K1'   , -0.142486_wp ,  1 ,  0 ,  1 ,  0 ,   0 ,    90 ,   0 ,    0 ,   -1 ,    0 ,  0 , 227 )      ! CE73           | S54 (Table 2)         | Note 1 |
+   tide_components( 8) = tide( 'K1'   ,  0.142486_wp ,  1 ,  0 ,  1 ,  0 ,   0 ,   -90 ,   0 ,    0 ,   -1 ,    0 ,  0 , 227 )      ! CE73, sign     | S54 (Table 2)         | Note 1 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
    tide_components( 9) = tide( 'O1'   ,  0.101316_wp ,  1 , -2 ,  1 ,  0 ,   0 ,    90 ,   2 ,   -1 ,    0 ,    0 ,  0 ,  75 )      ! CE73           | S54 (Table 2, A14)    |        |
@@ -75,5 +76,6 @@
    tide_components(11) = tide( 'Q1'   ,  0.019396_wp ,  1 , -3 ,  1 ,  1 ,   0 ,    90 ,   2 ,   -1 ,    0 ,    0 ,  0 ,  75 )      ! CE73           | S54 (Table 2, A15)    |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components(12) = tide( 'J1'   , -0.007967_wp ,  1 ,  1 ,  1 , -1 ,   0 ,    90 ,   0 ,   -1 ,    0 ,    0 ,  0 ,  76 )      ! CE73           | S54 (Table 2, A24)    | Note 1 |
+   tide_components(12) = tide( 'J1'   ,  0.007967_wp ,  1 ,  1 ,  1 , -1 ,   0 ,   -90 ,   0 ,   -1 ,    0 ,    0 ,  0 ,  76 )      ! CE73, sign     | S54 (Table 2, A24)    | Note 1 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
    tide_components(13) = tide( 'S1'   ,  0.000000_wp ,  1 ,  0 ,  0 ,  0 ,   0 ,     0 ,   0 ,    0 ,    0 ,    0 ,  0 ,   0 )      ! Meteorological | S54 (Table 2, B71)    |        |
@@ -96,5 +98,6 @@
    tide_components(20) = tide( '2N2'  ,  0.006184_wp ,  2 , -4 ,  2 ,  2 ,   0 ,     0 ,   2 ,   -2 ,    0 ,    0 ,  0 ,  78 )      ! CE73           | S54 (Table 2, A42)    |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components(21) = tide( 'L2'   , -0.006899_wp ,  2 , -1 ,  2 , -1 ,   0 ,     0 ,   2 ,   -2 ,    0 ,    0 , -1 , 215 )      ! CE73           | S54 (Table 2)         | Note 1 |
+   tide_components(21) = tide( 'L2'   ,  0.006899_wp ,  2 , -1 ,  2 , -1 ,   0 ,   180 ,   2 ,   -2 ,    0 ,    0 , -1 , 215 )      ! CE73, sign     | S54 (Table 2)         | Note 1 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
    tide_components(22) = tide( 'T2'   ,  0.006655_wp ,  2 ,  0 , -1 ,  0 ,   1 ,     0 ,   0 ,    0 ,    0 ,    0 ,  0 ,   0 )      ! CE73           | S54 (Table 2, B40)    |        |
@@ -103,11 +106,14 @@
    !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            |                | algorithm)            |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components(24) = tide( 'lam2' , -0.001800_wp ,  2 , -1 ,  0 ,  1 ,   0 ,     0 ,   2 ,   -2 ,    0 ,    0 ,  0 ,  78 )      ! CE73           | S54 (Table 2, A44)    | Note 1 |
+   tide_components(24) = tide( 'lam2' ,  0.001800_wp ,  2 , -1 ,  0 ,  1 ,   0 ,   180 ,   2 ,   -2 ,    0 ,    0 ,  0 ,  78 )      ! CE73, sign     | S54 (Table 2, A44)    | Note 1 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components(25) = tide( 'R2'   , -0.000952_wp ,  2 ,  0 ,  1 ,  0 ,  -1 ,     0 ,   0 ,    0 ,    0 ,    0 ,  0 ,   0 )      ! CE73           | S54 (Table 2, B41)    | Note 1 |
+   tide_components(25) = tide( 'R2'   ,  0.000952_wp ,  2 ,  0 ,  1 ,  0 ,  -1 ,   180 ,   0 ,    0 ,    0 ,    0 ,  0 ,   0 )      ! CE73, sign     | S54 (Table 2, B41)    | Note 1 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
    !                         |                                                            Terdiurnal tidal constituents                                                               |
    !                         +--------+-------------+-----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   tide_components(26) = tide( 'M3'   , -0.003192_wp ,  3 , -3 ,  3 ,  0 ,   0 ,   180 ,   3 ,   -3 ,    0 ,    0 ,  0 , 149 )      ! CT71           | S54 (Table 2, A82)    | Note 2 |
+   tide_components(26) = tide( 'M3'   ,  0.003192_wp ,  3 , -3 ,  3 ,  0 ,   0 ,     0 ,   3 ,   -3 ,    0 ,    0 ,  0 , 149 )      ! CT71, sign     | S54 (Table 2, A82)    | Note 2 |
+   !                         |        |              |    |    |    |    |     |       |     |      |      |      |    |            | change         |                       |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
    !                         |                                                                    Compound tides                                                                      |
@@ -135,6 +141,6 @@
    tide_components(34) = tide( 'M8'   ,  0.000000_wp ,  8 , -8 ,  8 ,  0 ,  0  ,     0 ,   8 ,   -8 ,    0 ,    0 ,  0 ,  20 )      ! Overtide       | S54                   |        |
    !                         +--------+--------------+----+----+----+----+-----+-------+-----+------+------+------+----+------------+----------------+-----------------------+--------+
-   !   Note 1: the phase shift from Table 2 of S54 has been adjusted to accomodate the negative sign of the equilibrium-tide value derived from CE73.
-   !   Note 2: the phase shift from Table 2 of S54 has been adjusted to accomodate the negative sign of the equilibrium-tide value derived from CT71.
+   !   Note 1: the negative sign of the equilibrium-tide value derived from CE73 has been changed to accomodate the phase shift from Table 2 of S54.
+   !   Note 2: the negative sign of the equilibrium-tide value derived from CT71 has been changed to accomodate the phase shift from Table 2 of S54.
    !   Note 3: the nodal correction factor formulas from FES2014 and S54 differ; here, the version from FES2014 has been selected.
 #else
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv.F90	(revision 14676)
@@ -182,6 +182,6 @@
          CASE ( np_FCT )                                 ! FCT scheme      : 2nd / 4th order
             IF (nn_hls.EQ.2) THEN
-               CALL lbc_lnk_multi( 'traadv', pts(:,:,:,:,Kbb), 'T', 1., pts(:,:,:,:,Kmm), 'T', 1.)
-               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
+               CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1., pts(:,:,:,:,Kmm), 'T', 1.)
+               CALL lbc_lnk( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
 #if defined key_loop_fusion
                CALL tra_adv_fct_lf ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_fct_h, nn_fct_v )
@@ -208,5 +208,5 @@
          CASE ( np_QCK )                                 ! QUICKEST
             IF (nn_hls.EQ.2) THEN
-               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
+               CALL lbc_lnk( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
                CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1.)
             END IF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_cen.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_cen.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_cen.F90	(revision 14676)
@@ -119,5 +119,5 @@
                ztv(ji,jj,jk) = ( pt(ji  ,jj+1,jk,jn,Kmm) - pt(ji,jj,jk,jn,Kmm) ) * vmask(ji,jj,jk)
             END_3D
-            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_cen', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond.
+            IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_cen', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond.
             !
             DO_3D( nn_hls-1, 0, nn_hls-1, 0, 1, jpkm1 )           ! Horizontal advective fluxes
@@ -131,5 +131,5 @@
                zwy(ji,jj,jk) =  0.5_wp * pV(ji,jj,jk) * zC4t_v
             END_3D
-            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_cen', zwx, 'U', -1. , zwy, 'V', -1. )
+            IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_cen', zwx, 'U', -1. , zwy, 'V', -1. )
             !
          CASE DEFAULT
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct.F90	(revision 14676)
@@ -238,5 +238,5 @@
                END_2D
             END DO
-            CALL lbc_lnk_multi( 'traadv_fct', zltu, 'T', 1.0_wp , zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            CALL lbc_lnk( 'traadv_fct', zltu, 'T', 1.0_wp , zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
             DO_3D( 1, 0, 1, 0, 1, jpkm1 )
@@ -247,5 +247,5 @@
                zwy(ji,jj,jk) =  0.5_wp * pV(ji,jj,jk) * ( zC2t_v + zltv(ji,jj,jk) - zltv(ji,jj+1,jk) ) - zwy(ji,jj,jk)
             END_3D
-            IF (nn_hls.EQ.2) CALL lbc_lnk_multi( 'traadv_fct', zwx, 'U', -1.0_wp, zwy, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv_fct', zwx, 'U', -1.0_wp, zwy, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
          CASE(  41 )                   !- 4th order centered       ==>>   !!gm coding attempt   need to be tested
@@ -256,5 +256,5 @@
                ztv(ji,jj,jk) = ( pt(ji  ,jj+1,jk,jn,Kmm) - pt(ji,jj,jk,jn,Kmm) ) * vmask(ji,jj,jk)
             END_3D
-            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
             DO_3D( 0, 0, 0, 0, 1, jpkm1 )    ! Horizontal advective fluxes
@@ -268,5 +268,5 @@
                zwy(ji,jj,jk) =  0.5_wp * pV(ji,jj,jk) * zC4t_v - zwy(ji,jj,jk)
             END_3D
-            IF (nn_hls.EQ.2) CALL lbc_lnk_multi( 'traadv_fct', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv_fct', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
          END SELECT
@@ -292,5 +292,5 @@
          !
          IF (nn_hls.EQ.1) THEN
-            CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
+            CALL lbc_lnk( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
          ELSE
             CALL lbc_lnk( 'traadv_fct', zwi, 'T', 1.0_wp)
@@ -449,5 +449,5 @@
          END_2D
       END DO
-      IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_fct', zbetup, 'T', 1.0_wp , zbetdo, 'T', 1.0_wp )   ! lateral boundary cond. (unchanged sign)
+      IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_fct', zbetup, 'T', 1.0_wp , zbetdo, 'T', 1.0_wp )   ! lateral boundary cond. (unchanged sign)
 
       ! 3. monotonic flux in the i & j direction (paa & pbb)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct_lf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct_lf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_fct_lf.F90	(revision 14676)
@@ -270,5 +270,5 @@
                END_2D
             END DO
-            CALL lbc_lnk_multi( 'traadv_fct', zltu_3d, 'T', 1.0_wp , zltv_3d, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            CALL lbc_lnk( 'traadv_fct', zltu_3d, 'T', 1.0_wp , zltv_3d, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
 !            !
             DO_3D( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 1, jpkm1 )
@@ -280,5 +280,5 @@
             END_3D
             !
-            CALL lbc_lnk_multi( 'traadv_fct', zwx_3d, 'U', -1.0_wp , zwy_3d, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            CALL lbc_lnk( 'traadv_fct', zwx_3d, 'U', -1.0_wp , zwy_3d, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
          CASE(  41 )                   !- 4th order centered       ==>>   !!gm coding attempt   need to be tested
             DO_3D( 0, 0, 0, 0, 1, jpkm1 )    ! Horizontal advective fluxes
@@ -298,5 +298,5 @@
                zwy_3d(ji,jj,jk) =  0.5_wp * pV(ji,jj,jk) * zC4t_v - zwy_3d(ji,jj,jk)
             END_3D
-            CALL lbc_lnk_multi( 'traadv_fct', zwx_3d, 'U', -1.0_wp , zwy_3d, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+            CALL lbc_lnk( 'traadv_fct', zwx_3d, 'U', -1.0_wp , zwy_3d, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
          END SELECT
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_mus.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_mus.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_mus.F90	(revision 14676)
@@ -140,5 +140,5 @@
          END_3D
          ! lateral boundary conditions   (changed sign)
-         IF ( nn_hls.EQ.1 ) CALL lbc_lnk_multi( 'traadv_mus', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )
+         IF ( nn_hls.EQ.1 ) CALL lbc_lnk( 'traadv_mus', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )
          !                                !-- Slopes of tracer
          zslpx(:,:,jpk) = 0._wp                 ! bottom values
@@ -176,5 +176,5 @@
             zwy(ji,jj,jk) = pV(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
          END_3D
-         IF ( nn_hls.EQ.1 ) CALL lbc_lnk_multi( 'traadv_mus', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )   ! lateral boundary conditions   (changed sign)
+         IF ( nn_hls.EQ.1 ) CALL lbc_lnk( 'traadv_mus', zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp )   ! lateral boundary conditions   (changed sign)
          !
          DO_3D( 0, 0, 0, 0, 1, jpkm1 )    !-- Tracer advective trend
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_qck.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_qck.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_qck.F90	(revision 14676)
@@ -149,5 +149,5 @@
             zfd(ji,jj,jk) = pt(ji+1,jj,jk,jn,Kbb)        ! Downstream in the x-direction for the tracer
          END_3D
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_qck', zfc(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp )   ! Lateral boundary conditions
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_qck', zfc(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp )   ! Lateral boundary conditions
 
          !
@@ -167,5 +167,5 @@
          END_3D
          !--- Lateral boundary conditions
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_qck', zfu(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp, zfc(:,:,:), 'T', 1.0_wp,  zwx(:,:,:), 'T', 1.0_wp )
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_qck', zfu(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp, zfc(:,:,:), 'T', 1.0_wp,  zwx(:,:,:), 'T', 1.0_wp )
 
          !--- QUICKEST scheme
@@ -239,5 +239,5 @@
             END_2D
          END DO
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_qck', zfc(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp )   ! Lateral boundary conditions
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_qck', zfc(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp )   ! Lateral boundary conditions
 
          !
@@ -259,5 +259,5 @@
 
          !--- Lateral boundary conditions
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_qck', zfu(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp, zfc(:,:,:), 'T', 1.0_wp, zwy(:,:,:), 'T', 1.0_wp )
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_qck', zfu(:,:,:), 'T', 1.0_wp , zfd(:,:,:), 'T', 1.0_wp, zfc(:,:,:), 'T', 1.0_wp, zwy(:,:,:), 'T', 1.0_wp )
 
          !--- QUICKEST scheme
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_ubs.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_ubs.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traadv_ubs.F90	(revision 14676)
@@ -140,5 +140,5 @@
             !
          END DO
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_ubs', zltu, 'T', 1.0_wp, zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'traadv_ubs', zltu, 'T', 1.0_wp, zltv, 'T', 1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
          !
          DO_3D( 1, 0, 1, 0, 1, jpkm1 )   !==  Horizontal advective fluxes  ==!     (UBS)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf.F90	(revision 14676)
@@ -110,5 +110,5 @@
 #endif
       !                                              ! local domain boundaries  (T-point, unchanged sign)
-      CALL lbc_lnk_multi( 'traatf', pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp )
+      CALL lbc_lnk( 'traatf', pts(:,:,:,jp_tem,Kaa), 'T', 1.0_wp, pts(:,:,:,jp_sal,Kaa), 'T', 1.0_wp )
       !
       IF( ln_bdy )   CALL bdy_tra( kt, Kbb, pts, Kaa )  ! BDY open boundaries
@@ -156,5 +156,5 @@
          ENDIF
          !
-         CALL lbc_lnk_multi( 'traatf',  pts(:,:,:,jp_tem,Kmm) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1.0_wp )
+         CALL lbc_lnk( 'traatf',  pts(:,:,:,jp_tem,Kmm) , 'T', 1.0_wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1.0_wp )
 
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf_qco.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf_qco.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/traatf_qco.F90	(revision 14676)
@@ -146,5 +146,5 @@
          ENDIF
          !
-         CALL lbc_lnk_multi( 'traatfqco', pts(:,:,:,jp_tem,Kmm) , 'T', 1._wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1._wp )
+         CALL lbc_lnk( 'traatfqco', pts(:,:,:,jp_tem,Kmm) , 'T', 1._wp, pts(:,:,:,jp_sal,Kmm) , 'T', 1._wp )
          !
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trabbl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trabbl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trabbl.F90	(revision 14676)
@@ -141,5 +141,5 @@
          IF( ntile == 0 .OR. ntile == nijtile ) THEN                       ! Do only on the last tile
             ! lateral boundary conditions ; just need for outputs
-            CALL lbc_lnk_multi( 'trabbl', utr_bbl, 'U', 1.0_wp , vtr_bbl, 'V', 1.0_wp )
+            CALL lbc_lnk( 'trabbl', utr_bbl, 'U', 1.0_wp , vtr_bbl, 'V', 1.0_wp )
             CALL iom_put( "uoce_bbl", utr_bbl )  ! bbl i-transport
             CALL iom_put( "voce_bbl", vtr_bbl )  ! bbl j-transport
@@ -522,5 +522,5 @@
       ! converte into REAL to use lbc_lnk ; impose a min value of 1 as a zero can be set in lbclnk
       zmbku(:,:) = REAL( mbku_d(:,:), wp )   ;     zmbkv(:,:) = REAL( mbkv_d(:,:), wp )
-      CALL lbc_lnk_multi( 'trabbl', zmbku,'U',1.0_wp, zmbkv,'V',1.0_wp)
+      CALL lbc_lnk( 'trabbl', zmbku,'U',1.0_wp, zmbkv,'V',1.0_wp)
       mbku_d(:,:) = MAX( INT( zmbku(:,:) ), 1 ) ;  mbkv_d(:,:) = MAX( NINT( zmbkv(:,:) ), 1 )
       !
@@ -541,5 +541,5 @@
          e3v_bbl_0(ji,jj) = MIN( e3v_0(ji,jj,mbkt(ji  ,jj+1)), e3v_0(ji,jj,mbkt(ji,jj)) )
       END_2D
-      CALL lbc_lnk_multi( 'trabbl', e3u_bbl_0, 'U', 1.0_wp , e3v_bbl_0, 'V', 1.0_wp )      ! lateral boundary conditions
+      CALL lbc_lnk( 'trabbl', e3u_bbl_0, 'U', 1.0_wp , e3v_bbl_0, 'V', 1.0_wp )      ! lateral boundary conditions
       !
       !                             !* masked diffusive flux coefficients
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/tramle.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/tramle.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/tramle.F90	(revision 14676)
@@ -361,5 +361,5 @@
                rfv(ji,jj) = SQRT(  zfv * zfv + z1_t2 )
             END_2D
-            CALL lbc_lnk_multi( 'tramle', rfu, 'U', 1.0_wp , rfv, 'V', 1.0_wp )
+            CALL lbc_lnk( 'tramle', rfu, 'U', 1.0_wp , rfv, 'V', 1.0_wp )
             !
          ELSEIF( nn_mle == 1 ) THEN           ! MLE array allocation & initialisation
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trazdf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trazdf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/trazdf.F90	(revision 14676)
@@ -102,5 +102,5 @@
          END DO
 !!gm this should be moved in trdtra.F90 and done on all trends
-         CALL lbc_lnk_multi( 'trazdf', ztrdt, 'T', 1.0_wp , ztrds, 'T', 1.0_wp )
+         CALL lbc_lnk( 'trazdf', ztrdt, 'T', 1.0_wp , ztrds, 'T', 1.0_wp )
 !!gm
          CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_zdf, ztrdt )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/zpshde.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/zpshde.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRA/zpshde.F90	(revision 14676)
@@ -173,5 +173,5 @@
       END DO
       !
-      IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgtu(:,:,:), 'U', -1.0_wp , pgtv(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
+      IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgtu(:,:,:), 'U', -1.0_wp , pgtv(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
       !
       IF( PRESENT( prd ) ) THEN    !==  horizontal derivative of density anomalies (rd)  ==!    (optional part)
@@ -206,5 +206,5 @@
             ENDIF
          END_2D
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgru , 'U', -1.0_wp , pgrv , 'V', -1.0_wp )   ! Lateral boundary conditions
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgru , 'U', -1.0_wp , pgrv , 'V', -1.0_wp )   ! Lateral boundary conditions
          !
       END IF
@@ -359,5 +359,5 @@
       END DO
       !
-      IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgtu(:,:,:), 'U', -1.0_wp , pgtv(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
+      IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgtu(:,:,:), 'U', -1.0_wp , pgtv(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
 
       ! horizontal derivative of density anomalies (rd)
@@ -401,5 +401,5 @@
          END_2D
 
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgru , 'U', -1.0_wp , pgrv , 'V', -1.0_wp )   ! Lateral boundary conditions
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgru , 'U', -1.0_wp , pgrv , 'V', -1.0_wp )   ! Lateral boundary conditions
          !
       END IF
@@ -452,5 +452,5 @@
          !
       END DO
-      IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgtui(:,:,:), 'U', -1.0_wp , pgtvi(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
+      IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgtui(:,:,:), 'U', -1.0_wp , pgtvi(:,:,:), 'V', -1.0_wp )   ! Lateral boundary cond.
 
       IF( PRESENT( prd ) ) THEN    !==  horizontal derivative of density anomalies (rd)  ==!    (optional part)
@@ -491,5 +491,5 @@
 
          END_2D
-         IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'zpshde', pgrui, 'U', -1.0_wp , pgrvi, 'V', -1.0_wp )   ! Lateral boundary conditions
+         IF (nn_hls.EQ.1) CALL lbc_lnk( 'zpshde', pgrui, 'U', -1.0_wp , pgrvi, 'V', -1.0_wp )   ! Lateral boundary conditions
          !
       END IF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trddyn.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trddyn.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trddyn.F90	(revision 14676)
@@ -128,5 +128,5 @@
                                  z3dy(ji,jj,jk) = vv(ji,jj,jk,Kmm) * ( vv(ji,jj+1,jk,Kmm) - vv(ji,jj-1,jk,Kmm) ) / ( 2._wp * e2v(ji,jj) )
                               END_3D
-                              CALL lbc_lnk_multi( 'trddyn', z3dx, 'U', -1.0_wp, z3dy, 'V', -1.0_wp )
+                              CALL lbc_lnk( 'trddyn', z3dx, 'U', -1.0_wp, z3dy, 'V', -1.0_wp )
                               CALL iom_put( "utrd_udx", z3dx  )
                               CALL iom_put( "vtrd_vdy", z3dy  )
@@ -164,5 +164,5 @@
 !                                 END DO
 !                              END DO
-!                              CALL lbc_lnk_multi( 'trddyn', z3dx, 'U', -1.0_wp, z3dy, 'V', -1.0_wp )
+!                              CALL lbc_lnk( 'trddyn', z3dx, 'U', -1.0_wp, z3dy, 'V', -1.0_wp )
 !                              CALL iom_put( "utrd_bfr", z3dx )
 !                              CALL iom_put( "vtrd_bfr", z3dy )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdken.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdken.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdken.F90	(revision 14676)
@@ -90,5 +90,5 @@
       !!----------------------------------------------------------------------
       !
-      CALL lbc_lnk_multi( 'trdken', putrd, 'U', -1.0_wp , pvtrd, 'V', -1.0_wp )      ! lateral boundary conditions
+      CALL lbc_lnk( 'trdken', putrd, 'U', -1.0_wp , pvtrd, 'V', -1.0_wp )      ! lateral boundary conditions
       !
       nkstp = kt
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdmxl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdmxl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdmxl.F90	(revision 14676)
@@ -154,5 +154,5 @@
 !!gm to be put juste before the output !
 !      ! Lateral boundary conditions
-!      CALL lbc_lnk_multi( 'trdmxl', tmltrd(:,:,jl), 'T', 1.0_wp , smltrd(:,:,jl), 'T', 1.0_wp )
+!      CALL lbc_lnk( 'trdmxl', tmltrd(:,:,jl), 'T', 1.0_wp , smltrd(:,:,jl), 'T', 1.0_wp )
 !!gm end
 
@@ -472,7 +472,7 @@
          !-- Lateral boundary conditions
          !         ... temperature ...                    ... salinity ...
-         CALL lbc_lnk_multi( 'trdmxl', ztmltot , 'T', 1.0_wp, zsmltot , 'T', 1.0_wp, &
-                  &          ztmlres , 'T', 1.0_wp, zsmlres , 'T', 1.0_wp, &
-                  &          ztmlatf , 'T', 1.0_wp, zsmlatf , 'T', 1.0_wp )
+         CALL lbc_lnk( 'trdmxl', ztmltot , 'T', 1.0_wp, zsmltot , 'T', 1.0_wp, &
+            &                    ztmlres , 'T', 1.0_wp, zsmlres , 'T', 1.0_wp, &
+            &                    ztmlatf , 'T', 1.0_wp, zsmlatf , 'T', 1.0_wp )
 
 
@@ -523,8 +523,8 @@
          !-- Lateral boundary conditions
          !         ... temperature ...                    ... salinity ...
-         CALL lbc_lnk_multi( 'trdmxl', ztmltot2, 'T', 1.0_wp, zsmltot2, 'T', 1.0_wp, &
-                  &          ztmlres2, 'T', 1.0_wp, zsmlres2, 'T', 1.0_wp )
-         !
-         CALL lbc_lnk_multi( 'trdmxl', ztmltrd2(:,:,:), 'T', 1.0_wp, zsmltrd2(:,:,:), 'T', 1.0_wp ) ! /  in the NetCDF trends file
+         CALL lbc_lnk( 'trdmxl', ztmltot2, 'T', 1.0_wp, zsmltot2, 'T', 1.0_wp, &
+            &                    ztmlres2, 'T', 1.0_wp, zsmlres2, 'T', 1.0_wp )
+         !
+         CALL lbc_lnk( 'trdmxl', ztmltrd2(:,:,:), 'T', 1.0_wp, zsmltrd2(:,:,:), 'T', 1.0_wp ) ! /  in the NetCDF trends file
          
          ! III.3 Time evolution array swap
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdvor.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdvor.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/TRD/trdvor.F90	(revision 14676)
@@ -162,5 +162,5 @@
 
       zudpvor(:,:) = 0._wp                 ;   zvdpvor(:,:) = 0._wp                    ! Initialisation
-      CALL lbc_lnk_multi( 'trdvor', putrdvor, 'U', -1.0_wp , pvtrdvor, 'V', -1.0_wp )      ! lateral boundary condition
+      CALL lbc_lnk( 'trdvor', putrdvor, 'U', -1.0_wp , pvtrdvor, 'V', -1.0_wp )      ! lateral boundary condition
       
 
@@ -251,5 +251,5 @@
       zvdpvor(:,:) = 0._wp
       !                            ! lateral boundary condition on input momentum trends
-      CALL lbc_lnk_multi( 'trdvor', putrdvor, 'U', -1.0_wp , pvtrdvor, 'V', -1.0_wp )
+      CALL lbc_lnk( 'trdvor', putrdvor, 'U', -1.0_wp , pvtrdvor, 'V', -1.0_wp )
 
       !  =====================================
@@ -400,5 +400,5 @@
 
          ! Boundary conditions
-         CALL lbc_lnk_multi( 'trdvor', vor_avrtot, 'F', 1.0_wp , vor_avrres, 'F', 1.0_wp )
+         CALL lbc_lnk( 'trdvor', vor_avrtot, 'F', 1.0_wp , vor_avrres, 'F', 1.0_wp )
 
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/README.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/README.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/README.rst	(revision 14676)
@@ -58,4 +58,9 @@
 
 .. _here: https://prodn.idris.fr/thredds/catalog/ipsl_public/rron463/catalog.html
+
+Option 4: Use the nesting tools to create embedded zooms or regional configurations from an existing grid
+---------------------------------------------------------------------------------------------------------
+(see :download:`NESTING README <../../../tools/NESTING/README>`).
+
 
 Creating a completely new configuration
@@ -111,8 +116,6 @@
    /* configuration name, configuration resolution                 */
    int    ORCA, ORCA_index
-   /* global domain sizes                                          */
-   int    jpiglo, jpjglo, jpkglo
    /* lateral global domain b.c.                                   */
-   int    jperio
+   int    Iperio, Jperio, NFoldT, NFoldF
    /* flags for z-coord, z-coord with partial steps and s-coord    */
    int    ln_zco, ln_zps, ln_sco
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_nam.F90	(revision 14676)
@@ -37,5 +37,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -49,8 +49,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER         , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER         , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
-      INTEGER         , INTENT(out) ::   kperio          ! lateral global domain b.c.
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -82,5 +84,6 @@
       kpk = jpkglo
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! GYRE configuration : closed domain
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! GYRE configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -102,5 +105,4 @@
          WRITE(numout,*) '      number of model levels                           jpkglo = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral b.c. of the global domain set to closed     jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_sbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/USR/usrdef_sbc.F90	(revision 14676)
@@ -181,5 +181,5 @@
          wndm(ji,jj) = SQRT( zmod * zcoef )
       END_2D
-      CALL lbc_lnk_multi( 'usrdef_sbc', taum(:,:), 'T', 1.0_wp , wndm(:,:), 'T', 1.0_wp )
+      CALL lbc_lnk( 'usrdef_sbc', taum(:,:), 'T', 1.0_wp , wndm(:,:), 'T', 1.0_wp )
 
       ! ---------------------------------- !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfmfc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfmfc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfmfc.F90	(revision 14676)
@@ -376,5 +376,5 @@
       !
       !
-      CALL lbc_lnk_multi( 'zdfmfc', edmfm,'T',1., edmfa,'T',1., edmfb,'T',1., edmfc,'T',1., edmftra(:,:,:,jp_tem),'T',1., edmftra(:,:,:,jp_sal),'T',1.)
+      CALL lbc_lnk( 'zdfmfc', edmfm,'T',1., edmfa,'T',1., edmfb,'T',1., edmfc,'T',1., edmftra(:,:,:,jp_tem),'T',1., edmftra(:,:,:,jp_sal),'T',1.)
       !
    END SUBROUTINE tra_mfc
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfosm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfosm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfosm.F90	(revision 14676)
@@ -1163,6 +1163,6 @@
      END_3D
       ! Lateral boundary conditions on ghamu and ghamv, currently on W-grid  (sign unchanged), needed to caclulate gham[uv] on u and v grids
-     CALL lbc_lnk_multi( 'zdfosm', p_avt, 'W', 1.0_wp , p_avm, 'W', 1.0_wp,   &
-      &                  ghamu, 'W', 1.0_wp , ghamv, 'W', 1.0_wp )
+     CALL lbc_lnk( 'zdfosm', p_avt, 'W', 1.0_wp , p_avm, 'W', 1.0_wp,   &
+        &                    ghamu, 'W', 1.0_wp , ghamv, 'W', 1.0_wp )
        DO_3D( 0, 0, 0, 0, 2, jpkm1 )
             ghamu(ji,jj,jk) = ( ghamu(ji,jj,jk) + ghamu(ji+1,jj,jk) ) &
@@ -1176,9 +1176,9 @@
        END_3D
         ! Lateral boundary conditions on final outputs for hbl,  on T-grid (sign unchanged)
-        CALL lbc_lnk_multi( 'zdfosm', hbl, 'T', 1., dh, 'T', 1., hmle, 'T', 1. )
+        CALL lbc_lnk( 'zdfosm', hbl, 'T', 1., dh, 'T', 1., hmle, 'T', 1. )
         ! Lateral boundary conditions on final outputs for gham[ts],  on W-grid  (sign unchanged)
         ! Lateral boundary conditions on final outputs for gham[uv],  on [UV]-grid  (sign changed)
-        CALL lbc_lnk_multi( 'zdfosm', ghamt, 'W',  1.0_wp , ghams, 'W',  1.0_wp,   &
-         &                            ghamu, 'U', -1.0_wp , ghamv, 'V', -1.0_wp )
+        CALL lbc_lnk( 'zdfosm', ghamt, 'W',  1.0_wp , ghams, 'W',  1.0_wp,   &
+           &                    ghamu, 'U', -1.0_wp , ghamv, 'V', -1.0_wp )
 
       IF(ln_dia_osm) THEN
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfphy.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfphy.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/ZDF/zdfphy.F90	(revision 14676)
@@ -323,13 +323,13 @@
       !                                         !* Lateral boundary conditions (sign unchanged)
       IF( l_zdfsh2 ) THEN
-         CALL lbc_lnk_multi( 'zdfphy', avm_k, 'W', 1.0_wp , avt_k, 'W', 1.0_wp,   &
-            &                avm  , 'W', 1.0_wp , avt  , 'W', 1.0_wp , avs , 'W', 1.0_wp )
+         CALL lbc_lnk( 'zdfphy', avm_k, 'W', 1.0_wp , avt_k, 'W', 1.0_wp,   &
+            &                    avm  , 'W', 1.0_wp , avt  , 'W', 1.0_wp , avs , 'W', 1.0_wp )
       ELSE
-         CALL lbc_lnk_multi( 'zdfphy', avm  , 'W', 1.0_wp , avt  , 'W', 1.0_wp , avs , 'W', 1.0_wp )
+         CALL lbc_lnk( 'zdfphy', avm  , 'W', 1.0_wp , avt  , 'W', 1.0_wp , avs , 'W', 1.0_wp )
       ENDIF
       !
       IF( l_zdfdrg ) THEN     ! drag  have been updated (non-linear cases)
-         IF( ln_isfcav ) THEN   ;  CALL lbc_lnk_multi( 'zdfphy', rCdU_top, 'T', 1.0_wp , rCdU_bot, 'T', 1.0_wp )   ! top & bot drag
-         ELSE                   ;  CALL lbc_lnk      ( 'zdfphy', rCdU_bot, 'T', 1.0_wp )                       ! bottom drag only
+         IF( ln_isfcav ) THEN   ;  CALL lbc_lnk( 'zdfphy', rCdU_top, 'T', 1.0_wp , rCdU_bot, 'T', 1.0_wp )   ! top & bot drag
+         ELSE                   ;  CALL lbc_lnk( 'zdfphy', rCdU_bot, 'T', 1.0_wp )                       ! bottom drag only
          ENDIF
       ENDIF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/lib_fortran.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/lib_fortran.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/lib_fortran.F90	(revision 14676)
@@ -220,5 +220,5 @@
       !
       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
-         IF( MOD(mig(ji), 3) == MOD(nn_hls, 3) .AND.   &
+         IF( MOD(mig(ji), 3) == MOD(nn_hls, 3) .AND.   &              ! 1st bottom left corner always at (Nis0-1, Njs0-1)
            & MOD(mjg(jj), 3) == MOD(nn_hls, 3)         ) THEN         ! bottom left corner of a 3x3 box
             ji2 = MIN(mig(ji)+2, jpiglo) - nimpp + 1                  ! right position of the box
@@ -230,19 +230,21 @@
       END_2D
       CALL lbc_lnk( 'lib_fortran', p2d, 'T', 1.0_wp )
-      ! no need for 2nd exchange when nn_hls = 2
-      IF( nn_hls /= 2 ) THEN
-         IF( nbondi /= -1 ) THEN
-            IF( MOD(mig(    1), 3) == 1 )   p2d(    1,:) = p2d(    2,:)
-            IF( MOD(mig(    1), 3) == 2 )   p2d(    2,:) = p2d(    1,:)
-         ENDIF
-         IF( nbondi /=  1 ) THEN
+      ! no need for 2nd exchange when nn_hls > 1
+      IF( nn_hls == 1 ) THEN
+         IF( mpiRnei(nn_hls,jpwe) > -1 ) THEN   ! 1st column was changed during the previous call to lbc_lnk
+            IF( MOD(mig(    1), 3) == 1 )   &   ! 1st box start at i=1 -> column 1 to 3 correctly computed locally
+               p2d(    1,:) = p2d(    2,:)      ! previous lbc_lnk corrupted column 1 -> put it back using column 2 
+            IF( MOD(mig(    1), 3) == 2 )   &   ! 1st box start at i=3 -> column 1 and 2 correctly computed on west neighbourh
+               p2d(    2,:) = p2d(    1,:)      !  previous lbc_lnk fix column 1 -> copy it to column 2 
+         ENDIF
+         IF( mpiRnei(nn_hls,jpea) > -1 ) THEN
             IF( MOD(mig(jpi-2), 3) == 1 )   p2d(  jpi,:) = p2d(jpi-1,:)
             IF( MOD(mig(jpi-2), 3) == 0 )   p2d(jpi-1,:) = p2d(  jpi,:)
          ENDIF
-         IF( nbondj /= -1 ) THEN
+         IF( mpiRnei(nn_hls,jpso) > -1 ) THEN
             IF( MOD(mjg(    1), 3) == 1 )   p2d(:,    1) = p2d(:,    2)
             IF( MOD(mjg(    1), 3) == 2 )   p2d(:,    2) = p2d(:,    1)
          ENDIF
-         IF( nbondj /=  1 ) THEN
+         IF( mpiRnei(nn_hls,jpno) > -1 ) THEN
             IF( MOD(mjg(jpj-2), 3) == 1 )   p2d(:,  jpj) = p2d(:,jpj-1)
             IF( MOD(mjg(jpj-2), 3) == 0 )   p2d(:,jpj-1) = p2d(:,  jpj)
@@ -274,5 +276,5 @@
          !
          DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
-            IF( MOD(mig(ji), 3) == MOD(nn_hls, 3) .AND.   &
+            IF( MOD(mig(ji), 3) == MOD(nn_hls, 3) .AND.   &              ! 1st bottom left corner always at (Nis0-1, Njs0-1)
               & MOD(mjg(jj), 3) == MOD(nn_hls, 3)         ) THEN         ! bottom left corner of a 3x3 box
                ji2 = MIN(mig(ji)+2, jpiglo) - nimpp + 1                  ! right position of the box
@@ -285,19 +287,21 @@
       END DO
       CALL lbc_lnk( 'lib_fortran', p3d, 'T', 1.0_wp )
-      ! no need for 2nd exchange when nn_hls = 2
-      IF( nn_hls /= 2 ) THEN
-         IF( nbondi /= -1 ) THEN
-            IF( MOD(mig(    1), 3) == 1 )   p3d(    1,:,:) = p3d(    2,:,:)
-            IF( MOD(mig(    1), 3) == 2 )   p3d(    2,:,:) = p3d(    1,:,:)
-         ENDIF
-         IF( nbondi /=  1 ) THEN
+      ! no need for 2nd exchange when nn_hls > 1
+      IF( nn_hls == 1 ) THEN
+         IF( mpiRnei(nn_hls,jpwe) > -1 ) THEN    ! 1st column was changed during the previous call to lbc_lnk
+            IF( MOD(mig(    1), 3) == 1 )   &    ! 1st box start at i=1 -> column 1 to 3 correctly computed locally
+               p3d(    1,:,:) = p3d(    2,:,:)   ! previous lbc_lnk corrupted column 1 -> put it back using column 2 
+            IF( MOD(mig(    1), 3) == 2 )   &    ! 1st box start at i=3 -> column 1 and 2 correctly computed on west neighbourh
+               p3d(    2,:,:) = p3d(    1,:,:)   !  previous lbc_lnk fix column 1 -> copy it to column 2 
+         ENDIF
+         IF( mpiRnei(nn_hls,jpea) > -1 ) THEN
             IF( MOD(mig(jpi-2), 3) == 1 )   p3d(  jpi,:,:) = p3d(jpi-1,:,:)
             IF( MOD(mig(jpi-2), 3) == 0 )   p3d(jpi-1,:,:) = p3d(  jpi,:,:)
          ENDIF
-         IF( nbondj /= -1 ) THEN
+         IF( mpiRnei(nn_hls,jpso) > -1 ) THEN
             IF( MOD(mjg(    1), 3) == 1 )   p3d(:,    1,:) = p3d(:,    2,:)
             IF( MOD(mjg(    1), 3) == 2 )   p3d(:,    2,:) = p3d(:,    1,:)
          ENDIF
-         IF( nbondj /=  1 ) THEN
+         IF( mpiRnei(nn_hls,jpno) > -1 ) THEN
             IF( MOD(mjg(jpj-2), 3) == 1 )   p3d(:,  jpj,:) = p3d(:,jpj-1,:)
             IF( MOD(mjg(jpj-2), 3) == 0 )   p3d(:,jpj-1,:) = p3d(:,  jpj,:)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/module_example.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/module_example.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/module_example.F90	(revision 14676)
@@ -127,7 +127,5 @@
       ! WARNING! the lbc_lnk call could not be compatible with the tiling approach
       ! please refer to the manual for how to adapt your code
-      CALL lbc_lnk( 'module_example', avm, 'T', 1., ncsten=true )     ! Lateral boundary conditions (unchanged sign)
-      !                                                                ! ncsten=false for 5-points stencil communication
-      !                                                                ! ncsten=true (default)  for 9-points stencil communication
+      CALL lbc_lnk( 'module_example', avm, 'T', 1. )     ! Lateral boundary conditions (unchanged sign)
       !
    END SUBROUTINE exa_mpl
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/nemogcm.F90	(revision 14676)
@@ -378,7 +378,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_kind.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_kind.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_kind.F90	(revision 14676)
@@ -10,7 +10,4 @@
    IMPLICIT NONE
    PRIVATE
-
-   INTEGER, PUBLIC, PARAMETER ::   jpbyt   = 8    !: real size for mpp communications
-   INTEGER, PUBLIC, PARAMETER ::   jpbytda = 4    !: real size in input data files 4 or 8
 
    ! Number model from which the SELECTED_*_KIND are requested:
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_oce.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_oce.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/par_oce.F90	(revision 14676)
@@ -91,11 +91,11 @@
 
    ! halo with and starting/inding DO-loop indices
-   INTEGER, PUBLIC ::   nn_hls   !: halo width (applies to both rows and columns)
-   INTEGER, PUBLIC ::   Nis0, Nis1, Nis1nxt2, Nis2   !: start I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   Nie0, Nie1, Nie1nxt2, Nie2   !: end   I-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   Njs0, Njs1, Njs1nxt2, Njs2   !: start J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   Nje0, Nje1, Nje1nxt2, Nje2   !: end   J-index (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   Ni_0, Nj_0, Ni_1, Nj_1, Ni_2, Nj_2   !: domain size (_0: without halo, _1 or _2: with 1 or 2 halos)
-   INTEGER, PUBLIC ::   Ni0glo, Nj0glo
+   INTEGER, PUBLIC ::   nn_hls           !: halo width (applies to both rows and columns)
+   INTEGER, PUBLIC ::   Nis0             !: start I-index without halo
+   INTEGER, PUBLIC ::   Nie0             !: end   I-index without halo
+   INTEGER, PUBLIC ::   Njs0             !: start J-index without halo
+   INTEGER, PUBLIC ::   Nje0             !: end   J-index without halo
+   INTEGER, PUBLIC ::   Ni_0, Nj_0       !: local domain size without halo
+   INTEGER, PUBLIC ::   Ni0glo, Nj0glo   !: global domain size without halo
 
    !!----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/step.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/step.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/step.F90	(revision 14676)
@@ -133,11 +133,16 @@
 #endif
       ENDIF
+      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN
 #if defined key_si3
-      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN
                              CALL iom_swap(                     cw_icerst_cxt )
                              CALL iom_init_closedef(            cw_icerst_cxt )
                              CALL iom_setkt( kstp - nit000 + 1, cw_icerst_cxt )
-      ENDIF
-#endif
+#endif
+         IF( ln_abl      ) THEN
+                             CALL iom_swap(                     cw_ablrst_cxt )
+                             CALL iom_init_closedef(            cw_ablrst_cxt )
+                             CALL iom_setkt( kstp - nit000 + 1, cw_ablrst_cxt )
+         ENDIF
+      ENDIF
       IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init)
                              CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpctl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpctl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpctl.F90	(revision 14676)
@@ -123,8 +123,8 @@
       !                                   !==  done by all processes at every time step  ==!
       !
-      llmsk(   1:Nis1,:,:) = .FALSE.                                              ! exclude halos from the checked region
-      llmsk(Nie1: jpi,:,:) = .FALSE.
-      llmsk(:,   1:Njs1,:) = .FALSE.
-      llmsk(:,Nje1: jpj,:) = .FALSE.
+      llmsk(     1:nn_hls,:,:) = .FALSE.                                          ! exclude halos from the checked region
+      llmsk(Nie0+1:   jpi,:,:) = .FALSE.
+      llmsk(:,     1:nn_hls,:) = .FALSE.
+      llmsk(:,Nje0+1:   jpj,:) = .FALSE.
       !
       llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0) == 1._wp         ! define only the inner domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpmlf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpmlf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OCE/stpmlf.F90	(revision 14676)
@@ -141,11 +141,16 @@
 #endif
       ENDIF
+      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN
 #if defined key_si3
-      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN
                              CALL iom_swap(                     cw_icerst_cxt )
                              CALL iom_init_closedef(            cw_icerst_cxt )
                              CALL iom_setkt( kstp - nit000 + 1, cw_icerst_cxt )
-      ENDIF
-#endif
+#endif
+         IF( ln_abl      ) THEN
+                             CALL iom_swap(                     cw_ablrst_cxt )
+                             CALL iom_init_closedef(            cw_ablrst_cxt )
+                             CALL iom_setkt( kstp - nit000 + 1, cw_ablrst_cxt )
+         ENDIF
+      ENDIF
       IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init)
                              CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp
@@ -508,6 +513,6 @@
 # endif
       !                                        ! local domain boundaries  (T-point, unchanged sign)
-      CALL lbc_lnk_multi( 'finalize_lbc', puu(:,:,:,       Kaa), 'U', -1., pvv(:,:,:       ,Kaa), 'V', -1.   &
-                       &                , pts(:,:,:,jp_tem,Kaa), 'T',  1., pts(:,:,:,jp_sal,Kaa), 'T',  1. )
+      CALL lbc_lnk( 'finalize_lbc', puu(:,:,:,       Kaa), 'U', -1., pvv(:,:,:       ,Kaa), 'V', -1.   &
+                       &          , pts(:,:,:,jp_tem,Kaa), 'T',  1., pts(:,:,:,jp_sal,Kaa), 'T',  1. )
       !
       !                                        !* BDY open boundaries
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OFF/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OFF/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/OFF/nemogcm.F90	(revision 14676)
@@ -309,7 +309,7 @@
       !
       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                                ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAO/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAO/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAO/nemogcm.F90	(revision 14676)
@@ -207,7 +207,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/nemogcm.F90	(revision 14676)
@@ -340,7 +340,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/sbcssm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/sbcssm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/sbcssm.F90	(revision 14676)
@@ -102,8 +102,18 @@
                e3t_m(:,:) = e3t_0(:,:,1)                                 ! vertical scale factor
             ENDIF
+            IF( TRIM(sf_ssm_2d(jf_usp)%clrootname) == 'NOT USED' ) &
+               &     sf_ssm_2d(jf_usp)%fnow(:,:,1) = 0._wp
+            IF( TRIM(sf_ssm_2d(jf_vsp)%clrootname) == 'NOT USED' ) &
+               &     sf_ssm_2d(jf_vsp)%fnow(:,:,1) = 0._wp
             ssu_m(:,:) = sf_ssm_2d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity
             ssv_m(:,:) = sf_ssm_2d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity
          ENDIF
          !
+         IF( TRIM(sf_ssm_2d(jf_sal)%clrootname) == 'NOT USED' ) &
+            &     sf_ssm_2d(jf_sal)%fnow(:,:,1) = 35._wp
+         IF( TRIM(sf_ssm_2d(jf_tem)%clrootname) == 'NOT USED' ) &
+            &     CALL eos_fzp( sf_ssm_2d(jf_sal)%fnow(:,:,1), sf_ssm_2d(jf_tem)%fnow(:,:,1) )
+         IF( TRIM(sf_ssm_2d(jf_ssh)%clrootname) == 'NOT USED' ) &
+            &     sf_ssm_2d(jf_ssh)%fnow(:,:,1) = 0._wp
          sst_m(:,:) = sf_ssm_2d(jf_tem)%fnow(:,:,1) * tmask(:,:,1)    ! temperature
          sss_m(:,:) = sf_ssm_2d(jf_sal)%fnow(:,:,1) * tmask(:,:,1)    ! salinity
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/stpctl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/stpctl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SAS/stpctl.F90	(revision 14676)
@@ -122,8 +122,8 @@
       !                                   !==  done by all processes at every time step  ==!
       !
-      llmsk(   1:Nis1,:) = .FALSE.                                              ! exclude halos from the checked region
-      llmsk(Nie1: jpi,:) = .FALSE.
-      llmsk(:,   1:Njs1) = .FALSE.
-      llmsk(:,Nje1: jpj) = .FALSE.
+      llmsk(     1:nn_hls,:) = .FALSE.                                          ! exclude halos from the checked region
+      llmsk(Nie0+1:   jpi,:) = .FALSE.
+      llmsk(:,     1:nn_hls) = .FALSE.
+      llmsk(:,Nje0+1:   jpj) = .FALSE.
       !
       llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp        ! test only the inner domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/nemogcm.F90	(revision 14676)
@@ -261,7 +261,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpctl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpctl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpctl.F90	(revision 14676)
@@ -113,8 +113,8 @@
       !                                   !==  done by all processes at every time step  ==!
       !
-      llmsk(   1:Nis1,:,:) = .FALSE.                                              ! exclude halos from the checked region
-      llmsk(Nie1: jpi,:,:) = .FALSE.
-      llmsk(:,   1:Njs1,:) = .FALSE.
-      llmsk(:,Nje1: jpj,:) = .FALSE.
+      llmsk(     1:nn_hls,:,:) = .FALSE.                                          ! exclude halos from the checked region
+      llmsk(Nie0+1:   jpi,:,:) = .FALSE.
+      llmsk(:,     1:nn_hls,:) = .FALSE.
+      llmsk(:,Nje0+1:   jpj,:) = .FALSE.
       !
       llmsk(Nis0:Nie0,Njs0:Nje0,1) = ssmask(Nis0:Nie0,Njs0:Nje0) == 1._wp         ! define only the inner domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpmlf.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpmlf.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stpmlf.F90	(revision 14676)
@@ -197,6 +197,6 @@
       ENDIF
 
-      CALL lbc_lnk_multi( 'stp_MLF', uu(:,:,:,Nnn), 'U', -1., vv(:,:,:,Nnn), 'V', -1.,   &   !* local domain boundaries
-         &                           uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1.    )     
+      CALL lbc_lnk( 'stp_MLF', uu(:,:,:,Nnn), 'U', -1., vv(:,:,:,Nnn), 'V', -1.,   &   !* local domain boundaries
+         &                     uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1.    )     
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stprk3.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stprk3.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/SWE/stprk3.F90	(revision 14676)
@@ -171,5 +171,5 @@
       ENDIF
       !
-      CALL lbc_lnk_multi( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
+      CALL lbc_lnk( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
       !
       !                                 !==  Swap time levels  ==!
@@ -236,5 +236,5 @@
       ENDIF
       !
-      CALL lbc_lnk_multi( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
+      CALL lbc_lnk( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
       !
       !                                 !==  Swap time levels  ==!
@@ -299,5 +299,5 @@
       ENDIF
       !
-      CALL lbc_lnk_multi( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
+      CALL lbc_lnk( 'stp_RK3', uu(:,:,:,Naa), 'U', -1., vv(:,:,:,Naa), 'V', -1. )
       !
       !                                 !==  Swap time levels  ==!
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/P2Z/p2zbio.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 14676)
@@ -340,5 +340,5 @@
       IF( lk_iomput ) THEN
          CALL lbc_lnk( 'p2zbio', zw2d(:,:,:),'T', 1.0_wp )
-         CALL lbc_lnk_multi( 'p2zbio', zw3d(:,:,:,1),'T', 1.0_wp, zw3d(:,:,:,2),'T', 1.0_wp, zw3d(:,:,:,3),'T', 1.0_wp )
+         CALL lbc_lnk( 'p2zbio', zw3d(:,:,:,1),'T', 1.0_wp, zw3d(:,:,:,2),'T', 1.0_wp, zw3d(:,:,:,3),'T', 1.0_wp )
          ! Save diagnostics
          CALL iom_put( "TNO3PHY", zw2d(:,:,1) )
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/sms_pisces.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/sms_pisces.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/PISCES/sms_pisces.F90	(revision 14676)
@@ -70,8 +70,4 @@
 
    !!*  Biological fluxes for light : variables shared by pisces & lobster
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln  !: number of T-levels + 1 in the euphotic layer
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup  !: euphotic layer depth
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot  !: par (photosynthetic available radiation)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot_ndcy      !: PAR over 24h in case of diurnal cycle
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  enano, ediat   !: PAR for phyto, nano and diat 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  enanom, ediatm !: PAR for phyto, nano and diat 
@@ -79,5 +75,4 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  epicom         !: PAR for pico
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  emoy           !: averaged PAR in the mixed layer
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup_01 !: Absolute euphotic layer depth
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  xksi  !:  LOBSTER : zooplakton closure
 
@@ -139,6 +134,5 @@
       ierr(:) = 0
       !*  Biological fluxes for light : shared variables for pisces & lobster
-      ALLOCATE( etot(jpi,jpj,jpk), neln(jpi,jpj), heup(jpi,jpj),    &
-        &       heup_01(jpi,jpj) , xksi(jpi,jpj)               ,  STAT=ierr(1) )
+      ALLOCATE( xksi(jpi,jpj)                                  ,  STAT=ierr(1) )
       !
   
@@ -147,5 +141,5 @@
          ALLOCATE(  enano(jpi,jpj,jpk)    , ediat(jpi,jpj,jpk) ,   &
            &        enanom(jpi,jpj,jpk)   , ediatm(jpi,jpj,jpk),   &
-           &        etot_ndcy(jpi,jpj,jpk), emoy(jpi,jpj,jpk)  ,  STAT=ierr(2) ) 
+           &        emoy(jpi,jpj,jpk)                          ,  STAT=ierr(2) ) 
 
          !*  Biological fluxes for primary production
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/README.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/README.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/README.rst	(revision 14676)
@@ -376,5 +376,5 @@
    .. code-block:: perl
 
-      bld::tool::fppkeys  key_zdftke key_dynspg_ts key_xios key_top
+      bld::tool::fppkeys key_xios key_top
       inc <MYBGCPATH>/MYBGC.fcm
 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trcadv.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trcadv.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trcadv.F90	(revision 14676)
@@ -131,6 +131,6 @@
       CASE ( np_FCT )                                 ! FCT      : 2nd / 4th order
          IF (nn_hls.EQ.2) THEN
-            CALL lbc_lnk_multi( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1., ptr(:,:,:,:,Kmm), 'T', 1.)
-            CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
+            CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1., ptr(:,:,:,:,Kmm), 'T', 1.)
+            CALL lbc_lnk( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
 #if defined key_loop_fusion
             CALL tra_adv_fct_lf( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, nn_fct_h, nn_fct_v )
@@ -143,5 +143,5 @@
       CASE ( np_MUS )                                 ! MUSCL
          IF (nn_hls.EQ.2) THEN
-            IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1.)
+            CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1.)
 #if defined key_loop_fusion
             CALL tra_adv_mus_lf( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, ln_mus_ups ) 
@@ -157,5 +157,5 @@
       CASE ( np_QCK )                                 ! QUICKEST
          IF (nn_hls.EQ.2) THEN
-            CALL lbc_lnk_multi( 'trcadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
+            CALL lbc_lnk( 'trcadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
             CALL lbc_lnk( 'traadv', ptr(:,:,:,:,Kbb), 'T', 1.)
          END IF
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trdmxl_trc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trdmxl_trc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/TRP/trdmxl_trc.F90	(revision 14676)
@@ -419,6 +419,6 @@
          !-- Lateral boundary conditions
                IF ( cn_cfg .NE. 'gyre' ) THEN
-                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot(:,:,jn) , 'T', 1. , ztmlres(:,:,jn) , 'T', 1., &
-                     &                ztmlatf(:,:,jn) , 'T', 1. , ztmlrad(:,:,jn) , 'T', 1. )
+                  CALL lbc_lnk( 'trdmxl_trc', ztmltot(:,:,jn) , 'T', 1. , ztmlres(:,:,jn) , 'T', 1., &
+                     &                        ztmlatf(:,:,jn) , 'T', 1. , ztmlrad(:,:,jn) , 'T', 1. )
                ENDIF
 
@@ -470,5 +470,5 @@
          !-- Lateral boundary conditions 
                IF ( cn_cfg .NE. 'gyre' ) THEN            ! other than GYRE configuration    
-                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot2(:,:,jn), 'T', 1., ztmlres2(:,:,jn), 'T', 1. )
+                  CALL lbc_lnk( 'trdmxl_trc', ztmltot2(:,:,jn), 'T', 1., ztmlres2(:,:,jn), 'T', 1. )
                   DO jl = 1, jpltrd_trc
                      CALL lbc_lnk( 'trdmxl_trc', ztmltrd2(:,:,jl,jn), 'T', 1. )       ! will be output in the NetCDF trends file
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/oce_trc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/oce_trc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/oce_trc.F90	(revision 14676)
@@ -19,26 +19,10 @@
    USE par_oce , ONLY :   jp_sal   =>   jp_sal     !: indice for salinity
    USE par_oce , ONLY :   nn_hls   =>   nn_hls     !: 
-   USE par_oce , ONLY :   Nis0    =>   Nis0      !: 
-   USE par_oce , ONLY :   Njs0    =>   Njs0      !: 
-   USE par_oce , ONLY :   Nie0    =>   Nie0      !: 
-   USE par_oce , ONLY :   Nje0    =>   Nje0      !: 
-   USE par_oce , ONLY :   Nis1    =>   Nis1      !: 
-   USE par_oce , ONLY :   Njs1    =>   Njs1      !: 
-   USE par_oce , ONLY :   Nie1    =>   Nie1      !: 
-   USE par_oce , ONLY :   Nje1    =>   Nje1      !: 
-   USE par_oce , ONLY :   Nis1nxt2    =>   Nis1nxt2      !: 
-   USE par_oce , ONLY :   Njs1nxt2    =>   Njs1nxt2      !: 
-   USE par_oce , ONLY :   Nie1nxt2    =>   Nie1nxt2      !: 
-   USE par_oce , ONLY :   Nje1nxt2    =>   Nje1nxt2      !: 
-   USE par_oce , ONLY :   Nis2    =>   Nis2      !: 
-   USE par_oce , ONLY :   Njs2    =>   Njs2      !: 
-   USE par_oce , ONLY :   Nie2    =>   Nie2      !: 
-   USE par_oce , ONLY :   Nje2    =>   Nje2      !: 
-   USE par_oce , ONLY :   Ni_0    =>   Ni_0      !: 
-   USE par_oce , ONLY :   Nj_0    =>   Nj_0      !: 
-   USE par_oce , ONLY :   Ni_1    =>   Ni_1      !: 
-   USE par_oce , ONLY :   Nj_1    =>   Nj_1      !: 
-   USE par_oce , ONLY :   Ni_2    =>   Ni_2      !: 
-   USE par_oce , ONLY :   Nj_2    =>   Nj_2      !: 
+   USE par_oce , ONLY :   Nis0     =>   Nis0       !: 
+   USE par_oce , ONLY :   Njs0     =>   Njs0       !: 
+   USE par_oce , ONLY :   Nie0     =>   Nie0       !: 
+   USE par_oce , ONLY :   Nje0     =>   Nje0       !: 
+   USE par_oce , ONLY :   Ni_0     =>   Ni_0       !: 
+   USE par_oce , ONLY :   Nj_0     =>   Nj_0       !: 
 
    USE in_out_manager                           !* IO manager *
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trc.F90	(revision 14676)
@@ -82,4 +82,12 @@
    CHARACTER(len=2), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   cn_trc_o         !: choice of ocean tracer cc
 
+   !! Information for the optics module
+   !! ---------------------------------
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln       !: number of T-levels + 1 in the euphotic layer
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup       !: euphotic layer depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup_01    !: Absolute euphotic layer depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot       !: par (photosynthetic available radiation)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot_ndcy  !: PAR over 24h in case of diurnal cycle
+
 
    !! information for outputs
@@ -156,4 +164,6 @@
          &      gtrui(jpi,jpj,jptra)  , gtrvi(jpi,jpj,jptra)                          ,       &
          &      trc_ice_ratio(jptra)  , trc_ice_prescr(jptra) , cn_trc_o(jptra)       ,       &
+         &      neln(jpi,jpj)         , heup(jpi,jpj)         , heup_01(jpi,jpj)      ,       &
+         &      etot(jpi,jpj,jpk)     , etot_ndcy(jpi,jpj,jpk)                        ,       &
          &      sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra)                      ,       &  
          &      cvol(jpi,jpj,jpk)     , trai(jptra)           , qsr_mean(jpi,jpj)     ,       &
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trcopt.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trcopt.F90	(revision 14676)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/src/TOP/trcopt.F90	(revision 14676)
@@ -0,0 +1,359 @@
+MODULE trcopt
+   !!======================================================================
+   !!                         ***  MODULE trcopt  ***
+   !! TOP :   Compute the light in the water column for RGB wavelengths
+   !!======================================================================
+   !! History :  1.0  !  2020     (T. Lovato) Initial code
+   !!----------------------------------------------------------------------
+   !!   trc_opt       : light availability in the water column
+   !!----------------------------------------------------------------------
+   USE trc            ! tracer variables
+   USE oce_trc        ! tracer-ocean share variables
+   USE iom            ! I/O manager
+   USE fldread        ! time interpolation
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_opt       ! called in spefici BGC model routines
+   PUBLIC   trc_opt_ini   ! called in trcini.F90
+   PUBLIC   trc_opt_alloc
+
+   !! * Shared module variables
+
+   LOGICAL  ::   ln_varpar   ! boolean for variable PAR fraction
+   REAL(wp) ::   parlux      ! Fraction of shortwave as PAR
+   CHARACTER (len=25) :: light_loc ! Light location in the water cell ('center', 'integral')
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_par        ! structure of input par
+   INTEGER                              ::   ntimes_par    ! number of time steps in par file
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   par_varsw      ! PAR fraction of shortwave
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ekb, ekg, ekr  ! wavelength (Red-Green-Blue)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xeps  ! weighted diffusion coefficient
+
+   INTEGER  ::   nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m)
+
+   ! TL: This array should come directly from traqsr module
+   REAL(wp), DIMENSION(3,61) ::   xkrgb   ! tabulated attenuation coefficients for RGB absorption
+   
+   !! * Substitutions
+#  include "do_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 4.0 , NEMO Consortium (2020)
+   !! $Id: trcopt.F90 12377 2020-02-12 14:39:06Z acc $ 
+   !! Software governed by the CeCILL license (see ./LICENSE)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_opt( kt, knt, Kbb, Kmm, zchl, ze1, ze2, ze3)
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_opt  ***
+      !!
+      !! ** Purpose : Compute the light availability in the water column
+      !!              depending on depth and chlorophyll concentration
+      !!
+      !! ** Method  : Morel
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt, knt   ! ocean time step
+      INTEGER, INTENT(in) ::   Kbb, Kmm  ! time level indices
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) ::   zchl  ! chlorophyll field
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(out),OPTIONAL :: ze1, ze2, ze3 ! PAR for individual wavelength
+      !
+      INTEGER  ::   ji, jj, jk, irgb
+      REAL(wp) ::   ztmp
+      REAL(wp), DIMENSION(jpi,jpj    ) :: parsw, zqsr100, zqsr_corr
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ze0
+      !!---------------------------------------------------------------------
+      !
+      IF( ln_timing )   CALL timing_start('trc_opt')
+
+      !     Initialisation of variables used to compute PAR
+      !     -----------------------------------------------
+      ze0(:,:,:) = 0._wp
+      ze1(:,:,:) = 0._wp
+      ze2(:,:,:) = 0._wp
+      ze3(:,:,:) = 0._wp
+
+      !     PAR conversion factor
+      !     --------------------
+      IF( knt == 1 .AND. ln_varpar )   CALL trc_opt_sbc( kt )
+      !
+      IF( ln_varpar ) THEN  ;  parsw(:,:) = par_varsw(:,:)
+      ELSE                  ;  parsw(:,:) = parlux / 3.0
+      ENDIF
+
+      !     Attenuation coef. function of Chlorophyll and wavelength (RGB)
+      !     --------------------------------------------------------------
+      DO_3D( 1, 1, 1, 1, 1, jpkm1 )
+         ztmp = ( zchl(ji,jj,jk) + rtrn ) * 1.e6
+         ztmp = MIN(  10. , MAX( 0.05, ztmp )  )
+         irgb = NINT( 41 + 20.* LOG10( ztmp ) + rtrn )
+         !                                                         
+         ekb(ji,jj,jk) = xkrgb(1,irgb) * e3t(ji,jj,jk,Kmm)
+         ekg(ji,jj,jk) = xkrgb(2,irgb) * e3t(ji,jj,jk,Kmm)
+         ekr(ji,jj,jk) = xkrgb(3,irgb) * e3t(ji,jj,jk,Kmm)
+      END_3D
+
+      !     Heat flux across w-level (used in the dynamics)
+      !     -----------------------------------------------
+      IF( ln_qsr_bio ) THEN
+         !
+         zqsr_corr(:,:) = parsw(:,:) * qsr(:,:)
+         !
+         ze0(:,:,1) = (1._wp - 3._wp * parsw(:,:)) * qsr(:,:)  !  ( 1 - 3 * alpha ) * q
+         ze1(:,:,1) = zqsr_corr(:,:)
+         ze2(:,:,1) = zqsr_corr(:,:)
+         ze3(:,:,1) = zqsr_corr(:,:)
+         !
+         DO jk = 2, nksrp + 1
+            DO_2D(1, 1, 1, 1)
+                  ze0(ji,jj,jk) = ze0(ji,jj,jk-1) * EXP( -e3t(ji,jj,jk-1,Kmm) * (1. / rn_si0) )
+                  ze1(ji,jj,jk) = ze1(ji,jj,jk-1) * EXP( -ekb  (ji,jj,jk-1 )        )
+                  ze2(ji,jj,jk) = ze2(ji,jj,jk-1) * EXP( -ekg  (ji,jj,jk-1 )        )
+                  ze3(ji,jj,jk) = ze3(ji,jj,jk-1) * EXP( -ekr  (ji,jj,jk-1 )        )
+            END_2D
+         END DO
+         !
+         etot3(:,:,1) = qsr(:,:) * tmask(:,:,1)
+         DO jk = 2, nksrp + 1
+            etot3(:,:,jk) =  ( ze0(:,:,jk) + ze1(:,:,jk) + ze2(:,:,jk) + ze3(:,:,jk) ) * tmask(:,:,jk)
+         END DO
+         !                                     !  ------------------------
+      ENDIF
+
+      !     Photosynthetically Available Radiation (PAR)
+      !     --------------------------------------------
+      zqsr_corr(:,:) = parsw(:,:) * qsr(:,:) / ( 1.-fr_i(:,:) + rtrn )
+      !
+      CALL trc_opt_par( kt, zqsr_corr, ze1, ze2, ze3 )
+      !
+      DO jk = 1, nksrp
+         etot (:,:,jk) = ze1(:,:,jk) + ze2(:,:,jk) + ze3(:,:,jk)
+      ENDDO
+
+      ! No Diurnal cycle PAR
+      IF( l_trcdm2dc ) THEN
+         zqsr_corr(:,:) = parsw(:,:) * qsr_mean(:,:) / ( 1.-fr_i(:,:) + rtrn )
+         !
+         CALL trc_opt_par( kt, zqsr_corr, ze1, ze2, ze3 )
+         DO jk = 1, nksrp
+            etot_ndcy(:,:,jk) = ze1(:,:,jk) + ze2(:,:,jk) + ze3(:,:,jk)
+         END DO
+      ELSE
+         etot_ndcy(:,:,:) = etot(:,:,:)
+      ENDIF
+
+      !     Weighted broadband attenuation coefficient
+      !     ------------------------------------------
+      DO_3D( 1, 1, 1, 1, 1, jpkm1 )
+         ztmp = ze1(ji,jj,jk)* ekb(ji,jj,jk) + ze2(ji,jj,jk) * ekg(ji,jj,jk) + ze3(ji,jj,jk) * ekr(ji,jj,jk)
+         xeps(ji,jj,jk) = ztmp / e3t(ji,jj,jk,Kmm) / (etot(ji,jj,jk) + rtrn)
+      END_3D
+      !xeps = (ze1(:,:,:) * ekb(:,:,:) + ze2(:,:,:) * ekg(:,:,:) + ze3(:,:,:) * ekr(:,:,:)) / e3t(:,:,:,Kmm) / (etot(:,:,:) + rtrn)
+
+      !     Light at the euphotic depth
+      !     ---------------------------
+      zqsr100 = 0.01 * 3. * zqsr_corr(:,:)
+
+      !     Euphotic depth and level
+      !     ------------------------
+      neln   (:,:) = 1
+      heup   (:,:) = gdepw(:,:,2,Kmm)
+      heup_01(:,:) = gdepw(:,:,2,Kmm)
+      !
+      DO_3D( 1, 1, 1, 1, 2, nksrp )
+        IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >=  zqsr100(ji,jj) )  THEN
+           ! Euphotic level (1st T-level strictly below Euphotic layer)
+           ! NOTE: ensure compatibility with nmld_trc definition in trdmxl_trc
+           neln(ji,jj) = jk+1
+           !
+           ! Euphotic layer depth
+           heup(ji,jj) = gdepw(ji,jj,jk+1,Kmm)
+        ENDIF
+        ! Euphotic layer depth (light level definition)
+        IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >= 0.50 )  THEN
+           heup_01(ji,jj) = gdepw(ji,jj,jk+1,Kmm)
+        ENDIF
+      END_3D
+      !
+      heup   (:,:) = MIN( 300., heup   (:,:) )
+      heup_01(:,:) = MIN( 300., heup_01(:,:) )
+      !
+      IF( lk_iomput ) THEN
+         CALL iom_put( "xeps" , xeps(:,:,:) * tmask(:,:,:) )
+         CALL iom_put( "Heup" , heup(:,:  ) * tmask(:,:,1) )
+      ENDIF
+      !
+      IF( ln_timing )   CALL timing_stop('trc_opt')
+      !
+   END SUBROUTINE trc_opt
+
+
+   SUBROUTINE trc_opt_par( kt, zqsr, pe1, pe2, pe3) 
+      !!----------------------------------------------------------------------
+      !!                  ***  routine trc_opt_par  ***
+      !!
+      !! ** purpose :   compute PAR of each wavelength (Red-Green-Blue)
+      !!                from given surface shortwave radiation
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER                         , INTENT(in)      ::   kt                ! ocean time-step
+      REAL(wp), DIMENSION(jpi,jpj)    , INTENT(in)      ::   zqsr              ! real shortwave
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(out)     ::   pe1 , pe2 , pe3   ! PAR (R-G-B)
+      !
+      INTEGER                       ::   ji, jj, jk        ! dummy loop indices
+      REAL(wp), DIMENSION(jpi,jpj)  ::   we1, we2, we3     ! PAR (R-G-B) at w-level
+      !!----------------------------------------------------------------------
+      pe1(:,:,:) = 0. ; pe2(:,:,:) = 0. ; pe3(:,:,:) = 0.
+      !
+      IF ( TRIM(light_loc) == 'center' ) THEN
+         ! cell-center (t-pivot)
+         pe1(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekb(:,:,1) )
+         pe2(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekg(:,:,1) )
+         pe3(:,:,1) = zqsr(:,:) * EXP( -0.5 * ekr(:,:,1) )
+         !
+         DO_3D( 1, 1, 1, 1, 2, nksrp )
+            pe1(ji,jj,jk) = pe1(ji,jj,jk-1) * EXP( -0.5 * ( ekb(ji,jj,jk-1) + ekb(ji,jj,jk) ) )
+            pe2(ji,jj,jk) = pe2(ji,jj,jk-1) * EXP( -0.5 * ( ekg(ji,jj,jk-1) + ekg(ji,jj,jk) ) )
+            pe3(ji,jj,jk) = pe3(ji,jj,jk-1) * EXP( -0.5 * ( ekr(ji,jj,jk-1) + ekr(ji,jj,jk) ) )
+         END_3D
+         !
+      ELSE IF ( TRIM(light_loc) == 'integral' ) THEN
+         ! integrate over cell thickness
+         we1(:,:) = zqsr(:,:)
+         we2(:,:) = zqsr(:,:)
+         we3(:,:) = zqsr(:,:)
+         !
+         DO_3D( 1, 1, 1, 1, 1, nksrp )
+            ! integrate PAR over current t-level
+            pe1(ji,jj,jk) = we1(ji,jj) / (ekb(ji,jj,jk) + rtrn) * (1. - EXP( -ekb(ji,jj,jk) ))
+            pe2(ji,jj,jk) = we2(ji,jj) / (ekg(ji,jj,jk) + rtrn) * (1. - EXP( -ekg(ji,jj,jk) ))
+            pe3(ji,jj,jk) = we3(ji,jj) / (ekr(ji,jj,jk) + rtrn) * (1. - EXP( -ekr(ji,jj,jk) ))
+            ! PAR at next w-level
+            we1(ji,jj) = we1(ji,jj) * EXP( -ekb(ji,jj,jk) )
+            we2(ji,jj) = we2(ji,jj) * EXP( -ekg(ji,jj,jk) )
+            we3(ji,jj) = we3(ji,jj) * EXP( -ekr(ji,jj,jk) )
+         END_3D
+         !
+      ENDIF 
+      !
+      ! 
+   END SUBROUTINE trc_opt_par
+
+
+   SUBROUTINE trc_opt_sbc( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine trc_opt_sbc  ***
+      !!
+      !! ** purpose :   read and interpolate the variable PAR fraction
+      !!                of shortwave radiation
+      !!
+      !! ** method  :   read the files and interpolate the appropriate variables
+      !!
+      !! ** input   :   external netcdf files
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean time step
+      !
+      INTEGER  :: ji,jj
+      REAL(wp) :: zcoef
+      !!---------------------------------------------------------------------
+      !
+      IF( ln_timing )  CALL timing_start('trc_opt_sbc')
+      !
+      ! Compute par_varsw at nit000 or only if there is more than 1 time record in par coefficient file
+      IF( ln_varpar ) THEN
+         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_par > 1 ) ) THEN
+            CALL fld_read( kt, 1, sf_par )
+            par_varsw(:,:) = ( sf_par(1)%fnow(:,:,1) ) / 3.0
+         ENDIF
+      ENDIF
+      !
+      IF( ln_timing )  CALL timing_stop('trc_opt_sbc')
+      !
+   END SUBROUTINE trc_opt_sbc
+
+
+   SUBROUTINE trc_opt_ini
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_opt_ini  ***
+      !!
+      !! ** Purpose :   Initialization of tabulated attenuation coefficients
+      !!                and percentage of PAR in Shortwave
+      !!
+      !! ** Input   :   external ascii and netcdf files
+      !!----------------------------------------------------------------------
+      INTEGER :: numpar, ierr, ios   ! Local integer 
+      !
+      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N) ::   sn_par                ! informations about the fields to be read
+      !
+      NAMELIST/namtrc_opt/cn_dir, sn_par, ln_varpar, parlux, light_loc
+      !!----------------------------------------------------------------------
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'trc_opt_ini : Initialize light module'
+         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+      ENDIF
+      READ  ( numnat_ref, namtrc_opt, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_opt in reference namelist' )
+      READ  ( numnat_cfg, namtrc_opt, IOSTAT = ios, ERR = 902 )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_opt in configuration namelist' )
+      IF(lwm) WRITE ( numont, namtrc_opt )
+
+      IF(lwp) THEN
+         WRITE(numout,*) '   Namelist : namtrc_opt '
+         WRITE(numout,*) '      PAR as a variable fraction of SW     ln_varpar      = ', ln_varpar
+         WRITE(numout,*) '      Fraction of shortwave as PAR         parlux         = ', parlux
+         WRITE(numout,*) '      Light location in the water cell     light_loc      = ', light_loc
+      ENDIF
+      !
+      ! Variable PAR at the surface of the ocean
+      ! ----------------------------------------
+      IF( ln_varpar ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) '   ==>>>   initialize variable par fraction (ln_varpar=T)'
+         !
+         ALLOCATE( par_varsw(jpi,jpj) )
+         !
+         ALLOCATE( sf_par(1), STAT=ierr )           !* allocate and fill sf_par (forcing structure) with sn_par
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trc_opt_ini: unable to allocate sf_par structure' )
+         !
+         CALL fld_fill( sf_par, (/ sn_par /), cn_dir, 'trc_opt_ini', 'Initialize prescribed PAR forcing ', 'namtrc_opt' )
+                                   ALLOCATE( sf_par(1)%fnow(jpi,jpj,1)   )
+         IF( sn_par%ln_tint )      ALLOCATE( sf_par(1)%fdta(jpi,jpj,1,2) )
+
+         CALL iom_open (  TRIM( sn_par%clname ) , numpar )
+         ntimes_par = iom_getszuld( numpar )   ! get number of record in file
+      ENDIF
+      !
+      CALL trc_oce_rgb( xkrgb )                  ! tabulated attenuation coefficients
+      nksrp = trc_oce_ext_lev( r_si2, 0.33e2 )   ! max level of light extinction (Blue Chl=0.01)
+      !
+      IF(lwp) WRITE(numout,*) '        level of light extinction = ', nksrp, ' ref depth = ', gdepw_1d(nksrp+1), ' m'
+      !
+                         ekr      (:,:,:) = 0._wp
+                         ekb      (:,:,:) = 0._wp
+                         ekg      (:,:,:) = 0._wp
+                         etot     (:,:,:) = 0._wp
+                         etot_ndcy(:,:,:) = 0._wp
+      IF( ln_qsr_bio )   etot3    (:,:,:) = 0._wp
+      ! 
+   END SUBROUTINE trc_opt_ini
+
+
+   INTEGER FUNCTION trc_opt_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_opt_alloc  ***
+      !!----------------------------------------------------------------------
+      !
+      ALLOCATE( ekb(jpi,jpj,jpk), ekr(jpi,jpj,jpk),  &
+                ekg(jpi,jpj,jpk), xeps(jpi,jpj,jpk), STAT= trc_opt_alloc  ) 
+      !
+      IF( trc_opt_alloc /= 0 ) CALL ctl_stop( 'STOP', 'trc_opt_alloc : failed to allocate arrays.' )
+      !
+   END FUNCTION trc_opt_alloc
+
+   !!======================================================================
+END MODULE trcopt
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca025_like
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 14676)
@@ -18,5 +18,8 @@
    nn_jsize   =   1206  !!  1049    ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
-   nn_perio   =   4        ! periodicity
+   ln_Iperio  =   .true.   ! i-periodicity
+   ln_Jperio  =  .false.   ! j-periodicity
+   ln_NFold   =   .true.   ! North pole folding
+      cn_NFtype   =   'T'  ! Folding type: T or F
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca12_like
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 14676)
@@ -18,5 +18,8 @@
    nn_jsize   =   3146     ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
-   nn_perio   =   4        ! periodicity
+   ln_Iperio  =   .true.   ! i-periodicity
+   ln_Jperio  =  .false.   ! j-periodicity
+   ln_NFold   =   .true.   ! North pole folding
+      cn_NFtype   =   'T'  ! Folding type: T or F
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca1_like
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 14676)
@@ -18,5 +18,8 @@
    nn_jsize   =   331      ! number of point in j-direction of global(local) domain if >0 (<0)  
    nn_ksize   =   75       ! total number of point in k-direction
-   nn_perio   =   6        ! periodicity
+   ln_Iperio  =   .true.   ! i-periodicity
+   ln_Jperio  =  .false.   ! j-periodicity
+   ln_NFold   =   .true.   ! North pole folding
+      cn_NFtype   =   'F'  ! Folding type: T or F
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -29,5 +29,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -41,9 +41,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
-      !
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes 
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios         ! Local integer
@@ -52,11 +53,13 @@
       INTEGER ::   nn_jsize    ! number of point in j-direction of global(local) domain if >0 (<0)  
       INTEGER ::   nn_ksize    ! total number of point in k-direction
-      INTEGER ::   nn_perio    ! periodicity
       !                              !!* nammpp namelist *!!
       INTEGER          ::   jpni, jpnj
-      LOGICAL          ::   ln_nnogather, ln_listonly
+      LOGICAL          ::   ln_listonly
+      LOGICAL          ::   ln_Iperio, ln_Jperio
+      LOGICAL          ::   ln_NFold
+      character(len=1) ::   cn_NFtype
       !!
-      NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, nn_perio
-      NAMELIST/nammpp/ jpni, jpnj, nn_hls, ln_nnogather, ln_listonly
+      NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, ln_Iperio, ln_Jperio, ln_NFold, cn_NFtype
+      NAMELIST/nammpp/ jpni, jpnj, nn_hls, ln_nnogather, ln_listonly, nn_comm
       !!----------------------------------------------------------------------     
       !
@@ -83,7 +86,9 @@
          kpj = nn_jsize
       ENDIF
+      kpk = nn_ksize
       !
-      kpk = nn_ksize
-      kperio = nn_perio
+      ldIperio = ln_Iperio   ;   ldJperio = ln_Jperio
+      ldNFold  = ln_NFold    ;   cdNFtype = cn_NFtype
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -107,5 +112,5 @@
          ENDIF
          WRITE(numout,*) '      global domain size-z            nn_ksize = ', nn_ksize
-         WRITE(numout,*) '      LBC of the global domain          kperio = ', kperio
+         WRITE(numout,*) '   '
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_sbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_sbc.F90	(revision 14676)
@@ -110,5 +110,5 @@
       END_2D
 
-      CALL lbc_lnk_multi( 'usrdef_sbc', utau_ice, 'U', -1., vtau_ice, 'V', -1. )
+      CALL lbc_lnk( 'usrdef_sbc', utau_ice, 'U', -1., vtau_ice, 'V', -1. )
 #endif
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/BENCH/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -197,5 +197,5 @@
       !
       
-!!$      IF( jperio == 3 .OR. jperio == 4 ) THEN   ! add a small island in the upper corners to avoid model instabilities...
+!!$      IF( c_NFtype == 'T' ) THEN   ! add a small island in the upper corners to avoid model instabilities...
 !!$         z2d(mi0(       nn_hls):mi1(                  nn_hls+2 ),mj0(jpjglo-nn_hls-1):mj1(jpjglo-nn_hls+1)) = 0.
 !!$         z2d(mi0(jpiglo-nn_hls):mi1(MIN(jpiglo,jpiglo-nn_hls+2)),mj0(jpjglo-nn_hls-1):mj1(jpjglo-nn_hls+1)) = 0.
@@ -203,5 +203,5 @@
 !!$      ENDIF
 !!$      !
-!!$      IF( jperio == 5 .OR. jperio == 6 ) THEN   ! add a small island in the upper corners to avoid model instabilities...
+!!$      IF( c_NFtype == 'F' ) THEN   ! add a small island in the upper corners to avoid model instabilities...
 !!$         z2d(mi0(       nn_hls):mi1(       nn_hls+1),mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls+1)) = 0.
 !!$         z2d(mi0(jpiglo-nn_hls):mi1(jpiglo-nn_hls+1),mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls+1)) = 0.
@@ -210,5 +210,5 @@
 
       !
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (closed boundaries)
       !
       k_bot(:,:) = INT( z2d(:,:) )           ! =jpkm1 over the ocean point, =0 elsewhere
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/C1D_ASICS/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/C1D_ASICS/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/C1D_ASICS/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -39,5 +39,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -51,8 +51,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -72,7 +74,8 @@
       kpi = 3
       kpj = 3
-      kpk = 75 
+      kpk = 75
       !                             ! Set the lateral boundary condition of the global domain
-      kperio =  7                   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldIperio = .TRUE.    ;   ldJperio = .true.   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -90,6 +93,5 @@
          WRITE(numout,*) '                                               jpjglo = ', kpj
          WRITE(numout,*) '                                               jpkglo = ', kpk
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      C1D : closed basin                       jperio = ', kperio
+      WRITE(numout,*) '   '
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/EXPREF/namelist_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/EXPREF/namelist_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/EXPREF/namelist_cfg	(revision 14676)
@@ -49,5 +49,6 @@
    ln_sshnoise =  .FALSE.  !  add random noise on initial ssh
    rn_lambda   =     50.   !  gaussian lambda
-   nn_perio    = 1
+   ln_Iperio   =   .true.  ! i-periodicity
+   ln_Jperio   =  .false.  ! j-periodicity
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_hgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_hgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_hgr.F90	(revision 14676)
@@ -64,5 +64,6 @@
       !
       INTEGER  ::   ji, jj     ! dummy loop indices
-      REAL(wp) ::   zphi0, zlam0, zbeta, zf0
+      INTEGER  ::   ii0, ij0   ! dummy loop indices
+      REAL(wp) ::   zbeta, zf0
       REAL(wp) ::   zti, ztj   ! local scalars
       !!-------------------------------------------------------------------------------
@@ -77,28 +78,25 @@
       ! Position coordinates (in kilometers)
       !                          ==========
-      zlam0 = -REAL(Ni0glo, wp) * rn_0xratio * rn_dx
-      zphi0 = -REAL(Nj0glo, wp) * rn_0yratio * rn_dy
+      ii0 = NINT( REAL(Ni0glo, wp) * rn_0xratio )
+      ij0 = NINT( REAL(Nj0glo, wp) * rn_0yratio )
 
 #if defined key_agrif
       ! ! let lower left longitude and latitude from parent
       IF (.NOT.Agrif_root()) THEN
-          zlam0 = (0.5_wp-(Agrif_parent(jpiglo)-1)/2)*Agrif_irhox()*rn_dx &
-             &+(Agrif_Ix()+nbghostcells-1)*Agrif_irhox()*rn_dx-(0.5_wp+nbghostcells)*rn_dx
-          zphi0 = (0.5_wp-(Agrif_parent(jpjglo)-1)/2)*Agrif_irhoy()*rn_dy &
-             &+(Agrif_Iy()+nbghostcells-1)*Agrif_irhoy()*rn_dy-(0.5_wp+nbghostcells)*rn_dy
+          to be coded...
       ENDIF 
 #endif
          
       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )         
-         zti = REAL( mig0(ji), wp ) - 0.5_wp  ! start at i=0.5 in the global grid without halos
-         ztj = REAL( mjg0(jj), wp ) - 0.5_wp  ! start at j=0.5 in the global grid without halos
+         zti = REAL( mig0(ji)-ii0, wp )   ! =0 at i=ii0 in the global grid without halos
+         ztj = REAL( mjg0(jj)-ij0, wp )   ! =0 at i=ij0 in the global grid without halos
          
-         plamt(ji,jj) = zlam0 + rn_dx *   zti
-         plamu(ji,jj) = zlam0 + rn_dx * ( zti + 0.5_wp ) 
+         plamt(ji,jj) = rn_dx *   zti
+         plamu(ji,jj) = rn_dx * ( zti + 0.5_wp ) 
          plamv(ji,jj) = plamt(ji,jj) 
          plamf(ji,jj) = plamu(ji,jj) 
          
-         pphit(ji,jj) = zphi0 + rn_dy *   ztj
-         pphiv(ji,jj) = zphi0 + rn_dy * ( ztj + 0.5_wp ) 
+         pphit(ji,jj) = rn_dy *   ztj
+         pphiv(ji,jj) = rn_dy * ( ztj + 0.5_wp ) 
          pphiu(ji,jj) = pphit(ji,jj) 
          pphif(ji,jj) = pphiv(ji,jj) 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_istate.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_istate.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_istate.F90	(revision 14676)
@@ -239,5 +239,5 @@
       !
       CALL lbc_lnk( 'usrdef_istate', pts , 'T',  1. )
-      CALL lbc_lnk_multi( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. )
+      CALL lbc_lnk( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. )
 
    END SUBROUTINE usr_def_istate
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -50,5 +50,4 @@
    LOGICAL , PUBLIC ::   ln_sshnoise=.false. ! add random noise on initial ssh
    REAL(wp), PUBLIC ::   rn_lambda  = 50.    ! gaussian lambda
-   INTEGER , PUBLIC ::   nn_perio   =    0   ! periodicity of the channel (0=closed, 1=E-W)
 
    !!----------------------------------------------------------------------
@@ -59,5 +58,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -71,16 +70,19 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios      ! Local integer
       REAL(wp)::   zh       ! Local scalars
+      LOGICAL ::   ln_Iperio, ln_Jperio
       !!
       NAMELIST/namusr_def/  rn_domszx, rn_domszy, rn_domszz, rn_dx, rn_dy, rn_dz, rn_0xratio, rn_0yratio   &
          &                 , nn_fcase, rn_ppgphi0, rn_u10, rn_windszx, rn_windszy & !!, rn_uofac   &
          &                 , rn_vtxmax, rn_uzonal, rn_ujetszx, rn_ujetszy  &
-         &                 , nn_botcase, nn_initcase, ln_sshnoise, rn_lambda, nn_perio
+         &                 , nn_botcase, nn_initcase, ln_sshnoise, rn_lambda, ln_Iperio, ln_Jperio
       !!----------------------------------------------------------------------
       !
@@ -102,6 +104,4 @@
 #endif
       !
-      IF(lwm)   WRITE( numond, namusr_def )
-      !
       cd_cfg = 'EW_CANAL'             ! name & resolution (not used)
       kk_cfg = INT( rn_dx )
@@ -109,5 +109,5 @@
       IF( Agrif_Root() ) THEN        ! Global Domain size:  EW_CANAL global domain is  1800 km x 1800 Km x 5000 m
          kpi = NINT( rn_domszx / rn_dx ) + 1
-         kpj = NINT( rn_domszy / rn_dy ) + 3
+         kpj = NINT( rn_domszy / rn_dy ) + 1
       ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side
          kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2
@@ -117,6 +117,4 @@
       !
       zh  = (kpk-1)*rn_dz
-      !                             ! Set the lateral boundary condition of the global domain
-      kperio = 1                    ! EW_CANAL configuration : closed basin
       !                             ! control print
       IF(lwp) THEN
@@ -149,8 +147,10 @@
          WRITE(numout,*) '      add random noise on initial ssh   ln_sshnoise= ', ln_sshnoise
          WRITE(numout,*) '      Gaussian lambda parameter          rn_lambda = ', rn_lambda
-         WRITE(numout,*) '      Periodicity of the basin            nn_perio = ', nn_perio
+         WRITE(numout,*) '      i and j Periodicity     ln_Iperio, ln_Jperio = ', ln_Iperio, ln_Jperio
+         WRITE(numout,*) '   '
       ENDIF
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = nn_perio                    ! EW_CANAL configuration : closed basin
+      ldIperio = ln_Iperio   ;   ldJperio = ln_Jperio   ! CANAL configuration
+      ldNFold  =  .FALSE.    ;   cdNFtype = '-'
       !
    END SUBROUTINE usr_def_nam
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/CANAL/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -202,5 +202,5 @@
       END SELECT
       !
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (closed boundaries)
       !
       k_bot(:,:) = NINT( z2d(:,:) )          ! =jpkm1 over the ocean point, =0 elsewhere
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -40,5 +40,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -52,8 +52,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios          ! Local integer
@@ -97,5 +99,7 @@
       zh  = (kpk-1)*rn_dz
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! DOME configuration : closed basin
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! DOME configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -118,6 +122,4 @@
          WRITE(numout,*) '      Coriolis frequency                rn_f0 = ', rn_f0, ' s-1'
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      DOME : closed basin            jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/DOME/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -98,5 +98,5 @@
          END DO
       END DO
-      CALL lbc_lnk_multi( 'usrdef_zgr', zhu, 'U', 1.0_wp, zhv, 'V', 1.0_wp, zhf, 'F', 1.0_wp)      
+      CALL lbc_lnk( 'usrdef_zgr', zhu, 'U', 1.0_wp, zhv, 'V', 1.0_wp, zhf, 'F', 1.0_wp)      
       !     
       CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! Reference z-coordinate system
@@ -106,10 +106,10 @@
       !
       ! no ocean cavities : top ocean level is ONE, except over land
-      ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 
+      ! the ocean basin surrounded by land (1+nn_hls grid-point) set through lbc_lnk call
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
       WHERE (gphit(:,:)>0._wp) z2d(:,:) = 0._wp
       ! Dig inlet:
       WHERE ((gphit(:,:)>0._wp).AND.(glamt(:,:)>-50._wp).AND.(glamt(:,:)<50._wp)) z2d(:,:) = 1._wp
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin, see userdef_nam.F90
       k_top(:,:) = NINT( z2d(:,:) )
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICB/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICB/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICB/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -42,5 +42,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -54,8 +54,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -78,5 +80,6 @@
       !
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! ICB configuration : box
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! ICB configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -99,6 +102,4 @@
          WRITE(numout,*) '                                               jpkglo   = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ICB : closed basin                    jperio   = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV1D/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -39,5 +39,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -51,8 +51,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios       ! Local integer
@@ -78,5 +80,7 @@
       zly = kpj*rn_dy*1.e-3
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! ICE_ADV1D configuration : bi-periodic basin
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! ICE_ADV1D configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -95,6 +99,4 @@
          WRITE(numout,*) '         Coriolis:', ln_corio
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ICE_ADV1D : closed basin                 jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_ADV2D/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -40,5 +40,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -52,8 +52,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes 
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios       ! Local integer
@@ -96,7 +98,9 @@
       zly = kpj*rn_dy*1.e-3
       !
-      IF( Agrif_Root() ) THEN   ;   kperio = 7     ! ICE_AGRIF configuration : bi-periodic basin
-      ELSE                      ;   kperio = 0     ! closed periodicity for the zoom
+      IF( Agrif_Root() ) THEN   ;   ldIperio =  .TRUE.   ;   ldJperio =  .TRUE.     ! ICE_ADV2D configuration : bi-periodic basin
+      ELSE                      ;   ldIperio = .FALSE.   ;   ldJperio = .FALSE.     ! closed periodicity for the zoom
       ENDIF
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -115,6 +119,4 @@
          WRITE(numout,*) '         Coriolis:', ln_corio
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ICE_ADV2D : bi-periodic basin            jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_AGRIF/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -40,5 +40,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -52,8 +52,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes 
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios       ! Local integer
@@ -98,7 +100,9 @@
       zly = kpj*rn_dy*1.e-3
       !
-      IF( Agrif_Root() ) THEN   ;   kperio = 7     ! ICE_AGRIF configuration : bi-periodic basin
-      ELSE                      ;   kperio = 0     ! closed periodicity for the zoom
+      IF( Agrif_Root() ) THEN   ;   ldIperio =  .TRUE.   ;   ldJperio =  .TRUE.     ! ICE_AGRIF configuration : bi-periodic basin
+      ELSE                      ;   ldIperio = .FALSE.   ;   ldJperio = .FALSE.     ! closed periodicity for the zoom
       ENDIF
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -117,6 +121,4 @@
          WRITE(numout,*) '         Coriolis:', ln_corio
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ICE_AGRIF : bi-periodic basin            jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_eap.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_eap.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_eap.F90	(revision 14676)
@@ -354,5 +354,5 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_eap', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_eap', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
       !
       !                                  !== Landfast ice parameterization ==!
@@ -492,5 +492,5 @@
             zs2(ji,jj) = ( zs2(ji,jj) * zalph1 + zstressmtmp ) * z1_alph1
          END_2D
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zstress12tmp, 'T', 1.0_wp , paniso_11, 'T', 1.0_wp , paniso_12, 'T', 1.0_wp)
+         CALL lbc_lnk( 'icedyn_rhg_eap', zstress12tmp, 'T', 1.0_wp , paniso_11, 'T', 1.0_wp , paniso_12, 'T', 1.0_wp)
 
         ! Save beta at T-points for further computations
@@ -520,5 +520,5 @@
 
          END_2D
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zs1, 'T', 1.0_wp, zs2, 'T', 1.0_wp, zs12, 'F', 1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zs1, 'T', 1.0_wp, zs2, 'T', 1.0_wp, zs12, 'F', 1.0_wp )
 
          ! --- Ice internal stresses (Appendix C of Hunke and Dukowicz, 2002) --- !
@@ -832,7 +832,7 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_eap', pshear_i, 'T', 1.0_wp, pdivu_i, 'T', 1.0_wp, pdelta_i, 'T', 1.0_wp, &
-         &                                    zten_i, 'T', 1.0_wp, zs1    , 'T', 1.0_wp, zs2     , 'T', 1.0_wp, &
-         &                                      zs12, 'F', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_eap', pshear_i, 'T', 1.0_wp, pdivu_i, 'T', 1.0_wp, pdelta_i, 'T', 1.0_wp, &
+         &                              zten_i, 'T', 1.0_wp, zs1    , 'T', 1.0_wp, zs2     , 'T', 1.0_wp, &
+         &                                zs12, 'F', 1.0_wp )
 
       ! --- Store the stress tensor for the next time step --- !
@@ -849,6 +849,6 @@
          & iom_use('utau_bi') .OR. iom_use('vtau_bi') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, &
-            &                                  ztauy_ai, 'V', -1.0_wp, ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, &
+            &                            ztauy_ai, 'V', -1.0_wp, ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
          !
          CALL iom_put( 'utau_oi' , ztaux_oi * aimsk00 )
@@ -934,5 +934,5 @@
       IF( iom_use('yield11') .OR. iom_use('yield12') .OR. iom_use('yield22')) THEN
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zyield11, 'T', 1.0_wp, zyield22, 'T', 1.0_wp, zyield12, 'T', 1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zyield11, 'T', 1.0_wp, zyield22, 'T', 1.0_wp, zyield12, 'T', 1.0_wp )
 
          CALL iom_put( 'yield11', zyield11 * aimsk00 )
@@ -951,7 +951,7 @@
          & iom_use('corstrx') .OR. iom_use('corstry') .OR. iom_use('intstrx') .OR. iom_use('intstry') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
-            &                                  zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, &
-            &                                    zfU, 'U', -1.0_wp,   zfV, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
+            &                            zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, &
+            &                              zfU, 'U', -1.0_wp,   zfV, 'V', -1.0_wp )
 
          CALL iom_put( 'dssh_dx' , zspgU * aimsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -985,7 +985,7 @@
          END_2D
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_eap', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
-            &                                  zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
-            &                                  zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_eap', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
+            &                            zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
+            &                            zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_evp.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_evp.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/icedyn_rhg_evp.F90	(revision 14676)
@@ -320,5 +320,5 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
+      CALL lbc_lnk( 'icedyn_rhg_evp', zmf, 'T', 1.0_wp, zdt_m, 'T', 1.0_wp )
       !
       !                                  !== Landfast ice parameterization ==!
@@ -770,6 +770,6 @@
 
       END_2D
-      CALL lbc_lnk_multi( 'icedyn_rhg_evp', pshear_i, 'T', 1._wp, pdivu_i, 'T', 1._wp, pdelta_i, 'T', 1._wp, zten_i, 'T', 1._wp, &
-         &                                  zs1     , 'T', 1._wp, zs2    , 'T', 1._wp, zs12    , 'F', 1._wp )
+      CALL lbc_lnk( 'icedyn_rhg_evp', pshear_i, 'T', 1._wp, pdivu_i, 'T', 1._wp, pdelta_i, 'T', 1._wp, zten_i, 'T', 1._wp, &
+         &                            zs1     , 'T', 1._wp, zs2    , 'T', 1._wp, zs12    , 'F', 1._wp )
       
       ! --- Store the stress tensor for the next time step --- !
@@ -786,6 +786,7 @@
          & iom_use('utau_bi') .OR. iom_use('vtau_bi') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp, ztaux_ai, 'U', -1.0_wp, ztauy_ai, 'V', -1.0_wp, &
-            &                                  ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', ztaux_oi, 'U', -1.0_wp, ztauy_oi, 'V', -1.0_wp,   &
+            &                            ztaux_ai, 'U', -1.0_wp, ztauy_ai, 'V', -1.0_wp,   &
+            &                            ztaux_bi, 'U', -1.0_wp, ztauy_bi, 'V', -1.0_wp )
          !
          CALL iom_put( 'utau_oi' , ztaux_oi * zmsk00 )
@@ -871,6 +872,6 @@
          & iom_use('corstrx') .OR. iom_use('corstry') .OR. iom_use('intstrx') .OR. iom_use('intstry') ) THEN
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
-            &                                  zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, zfU, 'U', -1.0_wp, zfV, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', zspgU, 'U', -1.0_wp, zspgV, 'V', -1.0_wp, &
+            &                            zCorU, 'U', -1.0_wp, zCorV, 'V', -1.0_wp, zfU, 'U', -1.0_wp, zfV, 'V', -1.0_wp )
 
          CALL iom_put( 'dssh_dx' , zspgU * zmsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -904,7 +905,7 @@
          END_2D
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_evp', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
-            &                                  zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
-            &                                  zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
+         CALL lbc_lnk( 'icedyn_rhg_evp', zdiag_xmtrp_ice, 'U', -1.0_wp, zdiag_ymtrp_ice, 'V', -1.0_wp, &
+            &                            zdiag_xmtrp_snw, 'U', -1.0_wp, zdiag_ymtrp_snw, 'V', -1.0_wp, &
+            &                            zdiag_xatrp    , 'U', -1.0_wp, zdiag_yatrp    , 'V', -1.0_wp )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -40,5 +40,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -52,8 +52,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios       ! Local integer
@@ -81,5 +83,7 @@
       zly = kpj*rn_dy*1.e-3
       !
-      kperio = 0     ! closed periodicity for the zoom
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! ICE_RHEO configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -98,6 +102,4 @@
          WRITE(numout,*) '         Coriolis:', ln_corio
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ICE_RHEO closed basin                    jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_sbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ICE_RHEO/MY_SRC/usrdef_sbc.F90	(revision 14676)
@@ -126,5 +126,5 @@
          windv(ji,jj) = Umax/sqrt(d*1000)*(d-2*mjg(jj)*res)/((d-2*mig(ji)*res)**2+(d-2*mjg(jj)*res)**2*Rwind**2)**(1/4)*Rwind*min(kt*30./21600,1.)
       END_2D
-      CALL lbc_lnk_multi( 'usrdef_sbc', windu, 'U', -1., windv, 'V', -1. )
+      CALL lbc_lnk( 'usrdef_sbc', windu, 'U', -1., windv, 'V', -1. )
 
       wndm_ice(:,:) = 0._wp      !!gm brutal....
@@ -156,5 +156,5 @@
             &          * ( 0.5 * (windv(ji,jj+1) + windv(ji,jj) ) - r_vfac * v_ice(ji,jj) )
       END_2D
-      CALL lbc_lnk_multi( 'usrdef_sbc', utau_ice, 'U', -1., vtau_ice, 'V', -1. )
+      CALL lbc_lnk( 'usrdef_sbc', utau_ice, 'U', -1., vtau_ice, 'V', -1. )
       !
    END SUBROUTINE usrdef_sbc_ice_tau
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ISOMIP/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ISOMIP/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/ISOMIP/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -41,5 +41,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -53,8 +53,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -77,5 +79,6 @@
       !
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! ISOMIP configuration : close basin
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! ISOMIP configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -98,6 +101,4 @@
          WRITE(numout,*) '                                               jpkglo   = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      ISOMIP : closed basin                    jperio   = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -37,5 +37,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -49,8 +49,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -73,5 +75,6 @@
       kpk = INT(  20.  / rn_dz ) + 1
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! LOCK_EXCHANGE configuration : closed domain
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! LOCK_EXCHANGE configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -88,6 +91,4 @@
          WRITE(numout,*) '                                               jpkglo = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      closed                                   jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -84,7 +84,7 @@
       !
       ! no ocean cavities : top ocean level is ONE, except over land
-      ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 
+      ! the ocean basin surrounded by land (1+nn_hls grid-points) set through lbc_lnk call
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin, see userdef_nam.F90
       k_top(:,:) = NINT( z2d(:,:) )
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/1_namelist_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/1_namelist_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/1_namelist_cfg	(revision 14676)
@@ -11,5 +11,5 @@
    ln_sco      = .false.      ! s-coordinate   
    rn_dx       =   1000.   !  horizontal resolution   [meters]
-   rn_dz       =     20.   !  vertical   resolution   [meters]
+   rn_dz       =     50.   !  vertical   resolution   [meters]
 /
 !
@@ -26,5 +26,5 @@
    cn_exp      =    "OVF"  !  experience name
    nn_it000    =       1   !  first time step
-   nn_itend    =    2040   ! here 16h of simulation  (=5760 time-step) abort after 5802 for zps: pb of physics conditions
+   nn_itend    =    1530   ! here 16h of simulation  (=5760 time-step) abort after 5802 for zps: pb of physics conditions
    nn_istate   =       0   !  output the initial state (1) or not (0)
    nn_stock    =    9999   !  frequency of creation of a restart file (modulo referenced to 1)
@@ -42,5 +42,5 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
-   rn_Dt      =   10.     !  time step for the dynamics (and tracer if nn_acc=0)
+   rn_Dt      =   40.     !  time step for the dynamics (and tracer if nn_acc=0)
    rn_atfp    =    0.1    !  asselin time filter parameter
    ln_meshmask = .false.  !  =T create a mesh file
@@ -150,5 +150,4 @@
    ln_dynvor_mix = .false. !  mixed scheme
    ln_dynvor_een = .false. !  energy & enstrophy scheme
-      nn_een_e3f = 0             !  e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/AGRIF_FixedGrids.in
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/AGRIF_FixedGrids.in	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/AGRIF_FixedGrids.in	(revision 14676)
@@ -1,3 +1,3 @@
 1
-10 41 1 4 4 1 4 
+10 41 1 4 1 1 1 
 0
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/README.txt
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/README.txt	(revision 14675)
+++ 	(revision )
@@ -1,14 +1,0 @@
-! Overflow test case with an embedded zoom
-! J. Chanut December 2020
-!
-! ** Compilation: ./makenemo -a OVERFLOW add_key "key_agrif"
-! ** Files contained in that directory override the ones in EXPREF
-! ** OVF_domcfg.nc and 1_OVF_domcfg.nc files containing parent and child domain
-!    definitions are needed. These need to be suitably matched !
-! ** The zoom, as defined in the shipped in AGRIF_FixedGrids.in file, has an
-!    horizontal and temporal refinement of 4 in the x direction only and a vertical
-!    refinement of 2 (both parent and child have geopotential vertical grids).
-!    Have a look at the figure "Overflow_agrif.png".
-! ** Warning: The domain has only 5 points in the y directio and automatic
-!    definition of mpp layout (i.e. jpni=jpnj=0) fails in that case. One has
-!    to manually define jpni=your_number_of_process and jpnj=1.
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/namelist_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/namelist_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/EXPREF/AGRIF/namelist_cfg	(revision 14676)
@@ -11,5 +11,5 @@
    ln_sco      = .false.      ! s-coordinate   
    rn_dx       =   1000.   !  horizontal resolution   [meters]
-   rn_dz       =     20.   !  vertical   resolution   [meters]
+   rn_dz       =     50.   !  vertical   resolution   [meters]
 /
 !
@@ -20,5 +20,5 @@
    cn_exp      =    "OVF"  !  experience name
    nn_it000    =       1   !  first time step
-   nn_itend    =    2040   ! here 16h of simulation  (=5760 time-step) abort after 5802 for zps: pb of physics conditions
+   nn_itend    =    1530   ! here 16h of simulation  (=5760 time-step) abort after 5802 for zps: pb of physics conditions
    nn_istate   =       0   !  output the initial state (1) or not (0)
    nn_stock    =    9999   !  frequency of creation of a restart file (modulo referenced to 1)
@@ -144,5 +144,4 @@
    ln_dynvor_mix = .false. !  mixed scheme
    ln_dynvor_een = .false. !  energy & enstrophy scheme
-      nn_een_e3f = 0             !  e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -38,5 +38,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -50,8 +50,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -88,11 +90,9 @@
       WRITE(numout,*) '                                               Nj0glo = ', kpj
       WRITE(numout,*) '                                               jpkglo = ', kpk
+      WRITE(numout,*) '   '
       !
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! OVERFLOW configuration : close basin
-      !
-      WRITE(numout,*) '   '
-      WRITE(numout,*) '   Lateral boundary condition of the global domain'
-      WRITE(numout,*) '      OVERFLOW : closed basin                  jperio = ', kperio
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! OVERFLOW configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
    END SUBROUTINE usr_def_nam
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/OVERFLOW/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -110,7 +110,7 @@
       !
       ! no ocean cavities : top ocean level is ONE, except over land
-      ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 
+      ! the ocean basin surrounded by land (1+nn_hls grid-points) set through lbc_lnk call
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin, see userdef_nam.F90
       k_top(:,:) = NINT( z2d(:,:) )
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/README.rst
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/README.rst	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/README.rst	(revision 14676)
@@ -206,22 +206,57 @@
    :labelprefix: T
 
+ICE_RHEO
+--------
+| 
+
+BENCH
+-----
+| Benchmark configuration. Allow to run any configuration (including ORCA type or BDY) with idealized grid
+  and initial state so it does not need any input file other than the namelists.
+  As usual, all configuration changes can be done through the namelist. 
+  We provide 3 example of namelist_cfg to mimic ORCA1, OR025 or ORCA12 configurations.
+  By default do not produce any output file. An extensive description of BENCH will be abailable in 
+  Irrmann et al. 2021.
+
 CPL_OASIS
 ---------
 | This test case checks the OASIS interface in OCE/SBC, allowing to set up 
-a coupled configuration through OASIS. See CPL_OASIS/README.md for more information.
+  a coupled configuration through OASIS. See CPL_OASIS/README.md for more information.
 
 TSUNAMI
 ---------
 | just use dynspg_ts to simulate the propagation of an ssh anomaly (cosinus) in a box configuration
-with flat bottom and jpk=2
+  with flat bottom and jpk=2.
 
 DONUT
 -----
-| Donut shaped configuration to test MPI decomposition with bdy
-
-SEAMOUNT
------
-| Classic horizontal pressure gradient scheme test case of Beckmann and Haidvogel (1993).
-  This is an isolated SEAMOUNT in an East-West periodic channel initialised at rest with a horizontally uniform density profile.
-  The analytical solution should give no horizontal pressure gradient hence all velocities are spurious.
-  This configuration uses uniformly spaced sigma coordinates whereas the original test case of Beckmann and Haidvogel (1993) used stretched sigma.
+| Donut shaped configuration to test MPI decomposition with bdy.
+
+C1D_ASICS
+---------
+| 
+
+DOME
+----
+| 
+
+ICB
+----
+| ICB is a very idealized configuration used to test and debug the icb module.
+  The configuration is box with a shallow shelf (40m) on the east and west part of the domain 
+  with a deep central trough (> 100m).
+  ICB are generating using the test capability of the icb model along a E-W line (this can easily be tuned).
+
+STATION_ASF
+-----------
+| this demonstration test case can be used to perform a sanity test of the SBCBLK interface of
+  NEMO.  It will test all the bulk-parameterization algorithms using an idealized
+  forcing that includes a wide range of *SSX / surface atmospheric state*
+  conditions to detect potential error / inconsistencies.  Both a short report and
+  boolean output: *passed* or *failed* is provided as an output.
+
+SWG
+---
+| Square bassin blown with an analytical wind. Vertical structure allows only one mode
+  associated with reduced gravity to develop. This configuration is based on Adcroft & Marshall 1998.
+  Also run with RK3 time stepping. 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/icesbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/icesbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/icesbc.F90	(revision 14676)
@@ -91,5 +91,5 @@
          vtau_ice(ji,jj) = vtau_ice(ji,jj) * xcplmask(ji,jj,0) + zvtau_ice(ji,jj) * ( 1. - xcplmask(ji,jj,0) )
          END_2D
-         CALL lbc_lnk_multi( 'icesbc', utau_ice, 'U', -1.0_wp, vtau_ice, 'V', -1.0_wp )
+         CALL lbc_lnk( 'icesbc', utau_ice, 'U', -1.0_wp, vtau_ice, 'V', -1.0_wp )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/nemogcm.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/nemogcm.F90	(revision 14676)
@@ -243,7 +243,7 @@
       !
       IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
-         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL domain_cfg ( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ELSE                              ! user-defined namelist
-         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, jperio )
+         CALL usr_def_nam( cn_cfg, nn_cfg, Ni0glo, Nj0glo, jpkglo, l_Iperio, l_Jperio, l_NFold, c_NFtype )
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/stpctl.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/stpctl.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/stpctl.F90	(revision 14676)
@@ -113,8 +113,8 @@
       !                                   !==  done by all processes at every time step  ==!
       !
-      llmsk(   1:Nis1,:) = .FALSE.                                              ! exclude halos from the checked region
-      llmsk(Nie1: jpi,:) = .FALSE.
-      llmsk(:,   1:Njs1) = .FALSE.
-      llmsk(:,Nje1: jpj) = .FALSE.
+      llmsk(     1:nn_hls,:) = .FALSE.                                          ! exclude halos from the checked region
+      llmsk(Nie0+1:   jpi,:) = .FALSE.
+      llmsk(:,     1:nn_hls) = .FALSE.
+      llmsk(:,Nje0+1:   jpj) = .FALSE.
       !
       llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp        ! test only the inner domain
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/STATION_ASF/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -37,5 +37,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -49,8 +49,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER         , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER         , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes
-      INTEGER         , INTENT(out) ::   kperio          ! lateral global domain b.c.
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -73,5 +75,6 @@
       !
       !                             ! Set the lateral boundary condition of the global domain
-      kperio =  7                   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldIperio = .TRUE.    ;   ldJperio = .true.   ! C1D configuration : 3x3 basin with cyclic Est-West and Norht-South condition
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
       !                             ! control print
@@ -85,5 +88,4 @@
          WRITE(numout,*) '      number of model levels                              kpk = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral b.c. of the domain set to       jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -57,5 +57,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -69,8 +69,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER         , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER         , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER         , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER  ::   ios             ! Local integer
@@ -110,5 +112,6 @@
       kpk = jpkglo
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! SWG configuration : closed domain
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! SWG configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       !
 # if defined key_bvp
@@ -131,5 +134,4 @@
          WRITE(numout,*) '      number of model levels                              jpkglo = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral b.c. of the global domain set to closed        jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_sbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_sbc.F90	(revision 14676)
@@ -104,5 +104,5 @@
       END DO
       
-      CALL lbc_lnk_multi( 'usrdef_sbc', taum(:,:), 'T', 1. , wndm(:,:), 'T', 1. )
+      CALL lbc_lnk( 'usrdef_sbc', taum(:,:), 'T', 1. , wndm(:,:), 'T', 1. )
       !
    END SUBROUTINE usrdef_sbc_oce
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/SWG/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -190,7 +190,6 @@
       z2d(:,:) = REAL( jpkm1 , wp )          ! flat bottom
       !
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
-      !
-      ! 
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (closed boundaries)
+      !
       zylim0 =   10000._wp    ! +10km 
       zylim1 = 2010000._wp    ! 2010km
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/EXPREF/namelist_cfg
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/EXPREF/namelist_cfg	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/EXPREF/namelist_cfg	(revision 14676)
@@ -29,5 +29,6 @@
    nn_fcase    =      0    !  Coriolis frequency(f) computation (0:f0, 1:Beta plan, 2:real)
    rn_ppgphi0  =    38.5   !  Reference latitude      [degrees]
-   nn_perio    =      7
+   ln_Iperio  =   .true.   ! i-periodicity
+   ln_Jperio  =   .true.   ! j-periodicity
 /
 !-----------------------------------------------------------------------
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_hgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_hgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_hgr.F90	(revision 14676)
@@ -64,5 +64,6 @@
       !
       INTEGER  ::   ji, jj     ! dummy loop indices
-      REAL(wp) ::   zphi0, zlam0, zbeta, zf0
+      INTEGER  ::   ii0, ij0   ! dummy loop indices
+      REAL(wp) ::   zbeta, zf0
       REAL(wp) ::   zti, ztj   ! local scalars
       !!-------------------------------------------------------------------------------
@@ -77,28 +78,25 @@
       ! Position coordinates (in kilometers)
       !                          ==========
-      zlam0 = -REAL(Ni0glo, wp) * rn_0xratio * rn_dx
-      zphi0 = -REAL(Nj0glo, wp) * rn_0yratio * rn_dy
+      ii0 = NINT( REAL(Ni0glo, wp) * rn_0xratio )
+      ij0 = NINT( REAL(Nj0glo, wp) * rn_0yratio )
 
 #if defined key_agrif
       ! ! let lower left longitude and latitude from parent
       IF (.NOT.Agrif_root()) THEN
-          zlam0 = (0.5_wp-(Agrif_parent(jpiglo)-1)/2)*Agrif_irhox()*rn_dx &
-             &+(Agrif_Ix()+nbghostcells-1)*Agrif_irhox()*rn_dx-(0.5_wp+nbghostcells)*rn_dx
-          zphi0 = (0.5_wp-(Agrif_parent(jpjglo)-1)/2)*Agrif_irhoy()*rn_dy &
-             &+(Agrif_Iy()+nbghostcells-1)*Agrif_irhoy()*rn_dy-(0.5_wp+nbghostcells)*rn_dy
+          to be coded...
       ENDIF 
 #endif
          
       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )         
-         zti = REAL( mig0(ji), wp ) - 0.5_wp  ! start at i=0.5 in the global grid without halos
-         ztj = REAL( mjg0(jj), wp ) - 0.5_wp  ! start at j=0.5 in the global grid without halos
+         zti = REAL( mig0(ji)-ii0, wp )   ! =0 at i=ii0 in the global grid without halos
+         ztj = REAL( mjg0(jj)-ij0, wp )   ! =0 at i=ij0 in the global grid without halos
          
-         plamt(ji,jj) = zlam0 + rn_dx *   zti
-         plamu(ji,jj) = zlam0 + rn_dx * ( zti + 0.5_wp ) 
+         plamt(ji,jj) = rn_dx *   zti
+         plamu(ji,jj) = rn_dx * ( zti + 0.5_wp ) 
          plamv(ji,jj) = plamt(ji,jj) 
          plamf(ji,jj) = plamu(ji,jj) 
          
-         pphit(ji,jj) = zphi0 + rn_dy *   ztj
-         pphiv(ji,jj) = zphi0 + rn_dy * ( ztj + 0.5_wp ) 
+         pphit(ji,jj) = rn_dy *   ztj
+         pphiv(ji,jj) = rn_dy * ( ztj + 0.5_wp ) 
          pphiu(ji,jj) = pphit(ji,jj) 
          pphif(ji,jj) = pphiv(ji,jj) 
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -37,5 +37,4 @@
    INTEGER , PUBLIC ::   nn_fcase   =    1   ! F computation (0:f0, 1:Beta, 2:real)
    REAL(wp), PUBLIC ::   rn_ppgphi0 =   38.5 ! reference latitude for beta-plane 
-   INTEGER , PUBLIC ::   nn_perio   =    0   ! periodicity of the channel (0=closed, 1=E-W)
 
    !!----------------------------------------------------------------------
@@ -46,5 +45,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -58,13 +57,16 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios      ! Local integer
+      LOGICAL ::   ln_Iperio, ln_Jperio
       !!
       NAMELIST/namusr_def/  rn_domszx, rn_domszy, rn_domszz, rn_dx, rn_dy, rn_0xratio, rn_0yratio   &
-         &                 , nn_fcase, rn_ppgphi0, nn_perio
+         &                 , nn_fcase, rn_ppgphi0, ln_Iperio, ln_Jperio
       !!----------------------------------------------------------------------
       !
@@ -85,6 +87,4 @@
 #endif
       !
-      IF(lwm)   WRITE( numond, namusr_def )
-      !
       cd_cfg = 'TSUNAMI'             ! name & resolution (not used)
       kk_cfg = INT( rn_dx )
@@ -92,5 +92,5 @@
       IF( Agrif_Root() ) THEN        ! Global Domain size:  TSUNAMI global domain is  1800 km x 1800 Km x 5000 m
          kpi = NINT( rn_domszx / rn_dx ) + 1
-         kpj = NINT( rn_domszy / rn_dy ) + 3
+         kpj = NINT( rn_domszy / rn_dy ) + 1
       ELSE                           ! Global Domain size: add nbghostcells + 1 "land" point on each side
          kpi  = nbcellsx + nbghostcells_x   + nbghostcells_x   + 2
@@ -98,7 +98,10 @@
       ENDIF
       kpk = 2
-      !                             ! Set the lateral boundary condition of the global domain
-      kperio = 1                    ! TSUNAMI configuration : closed basin
-      !                             ! control print
+      !                              ! Set the lateral boundary condition of the global domain
+      !
+      ldIperio = ln_Iperio   ;   ldJperio = ln_Jperio
+      ldNFold  =  .FALSE.    ;   cdNFtype = '-'
+      !
+      !                              ! control print
       IF(lwp) THEN
          WRITE(numout,*) '   '
@@ -115,8 +118,6 @@
          WRITE(numout,*) '      F computation                     nn_fcase   = ',   nn_fcase
          WRITE(numout,*) '      Reference latitude                rn_ppgphi0 = ', rn_ppgphi0
-         WRITE(numout,*) '      Periodicity of the basin            nn_perio = ', nn_perio
+         WRITE(numout,*) '   '
       ENDIF
-      !                             ! Set the lateral boundary condition of the global domain
-      kperio = nn_perio                    ! TSUNAMI configuration : closed basin
       !
    END SUBROUTINE usr_def_nam
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_sbc.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_sbc.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/TSUNAMI/MY_SRC/usrdef_sbc.F90	(revision 14676)
@@ -3,5 +3,5 @@
    !!                       ***  MODULE  usrdef_sbc  ***
    !! 
-   !!                      ===  CANAL configuration  ===
+   !!                      ===  TSUNAMI configuration  ===
    !!
    !! User defined :   surface forcing of a user configuration
@@ -44,5 +44,5 @@
       !!              condition, i.e. the momentum, heat and freshwater fluxes.
       !!
-      !! ** Method  :   all 0 fields, for CANAL case
+      !! ** Method  :   all 0 fields, for TSUNAMI case
       !!                CAUTION : never mask the surface stress field !
       !!
@@ -57,5 +57,5 @@
       IF( kt == nit000 ) THEN
          !
-         IF(lwp) WRITE(numout,*)' usr_sbc : EW_CANAL case: surface forcing'
+         IF(lwp) WRITE(numout,*)' usr_sbc : TSUNAMI case: surface forcing'
          IF(lwp) WRITE(numout,*)' ~~~~~~~~~~~   vtau = taum = wndm = qns = qsr = emp = sfx = 0'
          !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_istate.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_istate.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_istate.F90	(revision 14676)
@@ -123,5 +123,5 @@
       END_2D
       !
-      CALL lbc_lnk_multi( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. )
+      CALL lbc_lnk( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. )
       !   
    END SUBROUTINE usr_def_istate
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -40,5 +40,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -52,8 +52,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios          ! Local integer
@@ -96,5 +98,7 @@
       zh  = (kpk-1)*rn_dz
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! VORTEX configuration : closed basin
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.   ! VORTEX configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
+      !
       !                             ! control print
       IF(lwp) THEN
@@ -115,6 +119,4 @@
          WRITE(numout,*) '      Reference latitude            rn_ppgphi0 = ', rn_ppgphi0
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      VORTEX : closed basin            jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/VORTEX/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -190,5 +190,5 @@
       z2d(:,:) = REAL( jpkm1 , wp )          ! flat bottom
       !
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (closed boundaries)
       !
       k_bot(:,:) = NINT( z2d(:,:) )          ! =jpkm1 over the ocean point, =0 elsewhere
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_nam.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_nam.F90	(revision 14676)
@@ -38,5 +38,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, ldIperio, ldJperio, ldNFold, cdNFtype )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -50,8 +50,10 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
-      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
-      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
-      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
+      CHARACTER(len=*), INTENT(out) ::   cd_cfg               ! configuration name
+      INTEGER         , INTENT(out) ::   kk_cfg               ! configuration resolution
+      INTEGER         , INTENT(out) ::   kpi, kpj, kpk        ! global domain sizes
+      LOGICAL         , INTENT(out) ::   ldIperio, ldJperio   ! i- and j- periodicity
+      LOGICAL         , INTENT(out) ::   ldNFold              ! North pole folding
+      CHARACTER(len=1), INTENT(out) ::   cdNFtype             ! Folding type: T or F
       !
       INTEGER ::   ios   ! Local integer
@@ -75,7 +77,8 @@
       kpk = INT(  10.  / rn_dz ) + 1
       !                             ! Set the lateral boundary condition of the global domain
-      kperio = 0                    ! WAD_TEST_CASES configuration : closed domain
+      ldIperio = .FALSE.   ;   ldJperio = .FALSE.    ! WAD_TEST_CASES configuration : closed domain
+      ldNFold  = .FALSE.   ;   cdNFtype = '-'
       IF( nn_wad_test == 8 ) THEN
-         kperio = 7         ! North-South cyclic test
+         ldIperio = .TRUE.   ;   ldJperio = .TRUE.   ! WAD_TEST_CASES configuration : bi-periodic
          kpi = kpi - 2      ! no closed boundary
          kpj = kpj - 2      ! no closed boundary
@@ -95,6 +98,4 @@
          WRITE(numout,*) '                                               jpkglo = ', kpk
          WRITE(numout,*) '   '
-         WRITE(numout,*) '   Lateral boundary condition of the global domain'
-         WRITE(numout,*) '      closed                                   jperio = ', kperio
       ENDIF
       !
Index: NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_zgr.F90	(revision 14675)
+++ NEMO/branches/2020/dev_14237_KERNEL-01_IMMERSE_SEAMOUNT/tests/WAD/MY_SRC/usrdef_zgr.F90	(revision 14676)
@@ -260,5 +260,5 @@
       !
       ! no ocean cavities : top ocean level is ONE, except over land
-      ! the ocean basin surrounnded by land (1 grid-point) set through lbc_lnk call as jperio=0 
+      ! the ocean basin surrounnded by land (1+nn_hls grid-points) set through lbc_lnk call
       z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
       z2d(mi0(1):mi1(1),:) = 0._wp
@@ -267,9 +267,5 @@
       z2d(:,mj0(jpjglo):mj1(jpjglo)) = 0._wp
 
-
-
-
-
-      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
+      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin, see userdef_nam.F90
       k_top(:,:) = NINT( z2d(:,:) )
       !
