Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Chapters/Chap_SBC.tex
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Chapters/Chap_SBC.tex	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Chapters/Chap_SBC.tex	(revision 4230)
@@ -39,4 +39,7 @@
 be supplied which maps the data from the supplied grid to the model points 
 (so called "Interpolation on the Fly", see \S\ref{SBC_iof}).
+If the Interpolation on the Fly option is used, input data belonging to land points (in the native grid),
+can be masked to avoid spurious results in proximity of the coasts  as large sea-land gradients characterize
+most of the atmospheric variables.
 In addition, the resulting fields can be further modified using several namelist options. 
 These options control  the rotation of vector components supplied relative to an east-north 
@@ -197,5 +200,5 @@
 to defined the input data file and variable names, the frequency of the data (in hours or months), 
 whether its is climatological data or not, the period covered by the input file (one year, month, week or day), 
-and two additional parameters for on-the-fly interpolation. When adding a new input variable, 
+and three additional parameters for on-the-fly interpolation. When adding a new input variable, 
 the developer has to add the associated structure in the namelist, read this information 
 by mirroring the namelist read in \rou{sbc\_blk\_init} for example, and simply call \rou{fld\_read} 
@@ -220,6 +223,6 @@
 \begin{alltt}  {{\tiny    
 \begin{verbatim}
-!  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! 
-!             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+!  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      !
 \end{verbatim}
 }}\end{alltt} 
@@ -282,5 +285,5 @@
 is not starting at the beginning of the year. 
 
-\item[Others]: 'weights filename' and 'pairing rotation' are associted with on-the-fly interpolation 
+\item[Others]: 'weights filename', 'pairing rotation' and 'land/sea mask' are associted with on-the-fly interpolation 
 which is described in \S\ref{SBC_iof}.
 
@@ -337,4 +340,14 @@
 assumed by the model.
 Two methods are currently available: bilinear and bicubic interpolation.
+Prior to the interpolation, providing a land/sea mask file, the user can decide to
+ remove land points from the input file and substitute the corresponding values 
+with the average of the 8 neighbouring points in the native external grid.
+ Only "sea points" are considered for the averaging. The land/sea mask file must 
+be provided in the structure associated with the input variable.
+ The netcdf land/sea mask variable name must be 'LSM' it must have the same 
+horizontal and vertical dimensions of the associated variable and should 
+be equal to 1 over land and 0 elsewhere.
+The procedure can be recursively applied setting nn_lsm > 1 in namsbc namelist. 
+Note that nn_lsm=0 forces the code to not apply the procedure even if a file for land/sea mask is supplied.
 
 \subsubsection{Bilinear Interpolation}
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta	(revision 4230)
@@ -2,13 +2,13 @@
 &nambdy_dta      !  open boundaries - external data           ("key_bdy")
 !-----------------------------------------------------------------------
-!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  ! filename      !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
    cn_dir  =    'bdydta/'
    ln_full_vel = .false.
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta2
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta2	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/nambdy_dta2	(revision 4230)
@@ -2,8 +2,8 @@
 &nambdy_dta      !  open boundaries - external data           ("key_bdy")
 !-----------------------------------------------------------------------
-!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   bn_tem  =    'amm12_bdyT_clim' ,         -1        , 'votemper' ,     .true.     , .true. ,  'daily'  ,    ''    ,   ''
-   bn_sal  =    'amm12_bdyT_clim' ,         -1        , 'vosaline' ,     .true.     , .true. ,  'daily'  ,    ''    ,   ''
+!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
+!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  ! filename      !
+   bn_tem  =    'amm12_bdyT_clim' ,         -1        , 'votemper' ,     .true.     , .true. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_sal  =    'amm12_bdyT_clim' ,         -1        , 'vosaline' ,     .true.     , .true. ,  'daily'  ,    ''    ,   ''    , ''
    cn_dir  =    'bdydta/'
    ln_full_vel = .false.
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namberg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namberg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namberg	(revision 4230)
@@ -27,7 +27,7 @@
       rn_speed_limit           = 0.                   ! CFL speed limit for a berg   
 
-               ! filename ! freq (hours) ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
-               !          ! (<0  months) !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
-      sn_icb =  'calving' ,     -1       , 'calvingmask',  .true.      , .true., 'yearly'   , ' '      , ' '
+               ! filename ! freq (hours) ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation ! land/sea mask !
+               !          ! (<0  months) !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  ! filename      !
+      sn_icb =  'calving' ,     -1       , 'calvingmask',  .true.      , .true., 'yearly'   , ' '      , ' '  , ''
    
       cn_dir = './' 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc	(revision 4230)
@@ -27,3 +27,6 @@
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
    ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
+   nn_lsm  = 0             !  =0   land/sea mask for input fields is not applied (the field land/sea mask filename
+                           !       is left empty in namelist)  ,
+                           !  =1:n number of iterations of land/sea mask application for input fields
 /
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_apr
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_apr	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_apr	(revision 4230)
@@ -2,7 +2,7 @@
 &namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
 !-----------------------------------------------------------------------
-!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  ! filename      !
+   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''     , ''
 
    cn_dir      = './'       !  root directory for the location of the bulk files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_clio
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_clio	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_clio	(revision 4230)
@@ -2,13 +2,13 @@
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the bulk files are
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_core
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_core	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_core	(revision 4230)
@@ -2,16 +2,16 @@
 &namsbc_core   !   namsbc_core  CORE bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
-   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
-   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
-
+!              !  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_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'   , ''
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'   , ''
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+!
    cn_dir      = './'      !  root directory for the location of the bulk files
    ln_2m       = .false.   !  air temperature and humidity referenced at 2m (T) instead 10m (F)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_flx
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_flx	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_flx	(revision 4230)
@@ -2,11 +2,11 @@
 &namsbc_flx    !   surface boundary condition : flux formulation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
-   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+!              !  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_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the flux files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_mfs
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_mfs	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_mfs	(revision 4230)
@@ -2,14 +2,13 @@
 &namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
-
-   cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
+!              !  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_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_prec     =   'precip'  ,        6          , 'precip'  ,    .true.    , .false. , 'daily'  ,'bicubic'    , ''    , ''
+   cn_dir      =   './'      !  root directory for the location of the bulk files
 /
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_rnf
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_rnf	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_rnf	(revision 4230)
@@ -2,11 +2,11 @@
 &namsbc_rnf    !   runoffs namelist surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_rnf      = 'runoff_core_monthly',    -1    , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_cnf      = 'runoff_core_monthly',     0    , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_s_rnf    = 'runoffs'            ,    24    , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_t_rnf    = 'runoffs'            ,    24    , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_dep_rnf  = 'runoffs'            ,     0    , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir       = './'      !  root directory for the location of the runoff files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_sas
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_sas	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_sas	(revision 4230)
@@ -2,11 +2,11 @@
 &namsbc_sas    !   analytical surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+!              !  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_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
 
    ln_3d_uv    = .true.    !  specify whether we are supplying a 3D u,v field
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_ssr
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_ssr	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_ssr	(revision 4230)
@@ -2,8 +2,8 @@
 &namsbc_ssr    !   surface boundary condition : sea surface restoring
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
-   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+!              !  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_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''       , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_wave
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_wave	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namsbc_wave	(revision 4230)
@@ -2,10 +2,10 @@
 &namsbc_wave   ! External fields from wave model
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
-   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
+!              !  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_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.    , .false. , 'daily'  , ''       , ''       , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''       , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''       , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''       , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtra_qsr
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtra_qsr	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtra_qsr	(revision 4230)
@@ -2,7 +2,7 @@
 &namtra_qsr    !   penetrative solar radiation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+!              !  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_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtsd
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtsd	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/DOC/TexFiles/Namelist/namtsd	(revision 4230)
@@ -2,8 +2,8 @@
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
-!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
-   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
-   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+!          ! file name ! frequency (hours)         ! variable     ! time interp. ! clim  !'yearly' or ! weights  ! rotation ! land/sea mask !
+!          !           !  (if <0  months)          !   name       !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  ! filename      !
+   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.      , .true., 'yearly'   , ' '      , ' '      , ''
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.      , .true., 'yearly'   , ''       , ' '      , ''
    !
    cn_dir        = './'     !  root directory for the location of the runoff files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso.fcm	(revision 4230)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  mpxlf90_r
+%FCFLAGS             -O3 -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -O3 -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  mpxlf90_r
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_debug.fcm	(revision 4230)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  mpxlf90_r
+%FCFLAGS             -g -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -g -qsuffix=f=f90  -qstrict -qalias=intptr -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  mpxlf90_r
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-PW6_calypso_tools.fcm	(revision 4230)
@@ -0,0 +1,29 @@
+# vargas IBM POWER6 at french IDRIS, http://www.idris.fr/su/Scalaire/vargas/hw-vargas.html
+# NCDF_INC    netcdf include file
+# NCDF_LIB    netcdf library
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make  
+# USER_INC    additional include files for the compiler,  e.g. -I<include dir> 
+# USER_LIB    additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC            -I/usr/local/netcdf-3.6.3/include
+%NCDF_LIB            -L/usr/local/netcdf-3.6.3/lib -lnetcdf
+%FC                  xlf90
+%FCFLAGS             -O3 -qsuffix=f=f90  -qstrict -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%FFLAGS              -O3 -qsuffix=f=f90  -qstrict -qsuppress=1501-245 -qarch=pwr6 -q64 -qrealsize=8 -qtune=pwr6 -qextname -qlargepage -qmaxmem=-1
+%LD                  xlf90
+%LDFLAGS             -bloadmap:LinkerErrorMap 
+%FPPFLAGS            -P -C
+%AR                  ar  
+%ARFLAGS             rs
+%MK                  gmake 
+%USER_INC            %NCDF_INC
+%USER_LIB            %NCDF_LIB 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-gfortran_athena_xios.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-gfortran_athena_xios.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-gfortran_athena_xios.fcm	(revision 4230)
@@ -0,0 +1,57 @@
+# mpi gfortran compiler options for ATHENA using XIOS parallel writer server
+#
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+#
+
+%NCDF_HOME           /users/home/ans040/local
+%HDF5_HOME           /users/home/ans040/local
+%XIOS_HOME           /users/home/ans040/SOFTWARE/XIOS/trunk
+
+%NCDF_INC            -I%NCDF_HOME/include
+%NCDF_LIB            -L%NCDF_HOME/lib
+
+%HDF5_INC            -I%HDF5_HOME/include
+%HDF5_LIB            -L%HDF5_HOME/lib -lhdf5_hl -lhdf5
+
+%XIOS_INC            -I%XIOS_HOME/inc
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+
+%FC                  mpicc
+%FC                  mpif90
+%FCFLAGS             -fdefault-real-8 -fno-second-underscore -Dgfortran
+%FFLAGS              %FCFLAGS
+%LD                  %FC
+%LDFLAGS
+%FPPFLAGS            -x f77-cpp-input
+%AR                  ar
+%ARFLAGS             rs
+%MK                  gmake
+%USER_INC            %XIOS_INC %NCDF_INC %HDF5_INC
+%USER_LIB            %XIOS_LIB %NCDF_LIB %HDF5_LIB  -lnetcdff -lnetcdf -lstdc++ -lz -lcurl -lgpfs
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena.fcm	(revision 4230)
@@ -0,0 +1,30 @@
+# generic ifort compiler options for linux
+# NCDF_INC netcdf include file
+# NCDF_LIB netcdf library
+# FC Fortran compiler command
+# FCFLAGS Fortran compiler flags
+# FFLAGS Fortran 77 compiler flags
+# LD linker
+# LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS pre-processing flags
+# AR assembler
+# ARFLAGS assembler flags
+# MK make
+# USER_INC additional include files for the compiler, e.g. -I<include dir>
+# USER_LIB additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC -I$NETCDF/include
+%NCDF_LIB -L$NETCDF/lib -lnetcdf -lnetcdff
+%FC mpiifort
+%FCFLAGS -r8 -O3 -xHost -fp-model source -traceback
+%FFLAGS %FCFLAGS
+%LD mpiifort
+%FPPFLAGS -P -C -traditional
+%LDFLAGS
+%AR ar
+%ARFLAGS -r
+%MK gmake
+%USER_INC %NCDF_INC
+%USER_LIB %NCDF_LIB
+
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_debug.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_debug.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_debug.fcm	(revision 4230)
@@ -0,0 +1,30 @@
+# generic ifort compiler options for linux
+# NCDF_INC netcdf include file
+# NCDF_LIB netcdf library
+# FC Fortran compiler command
+# FCFLAGS Fortran compiler flags
+# FFLAGS Fortran 77 compiler flags
+# LD linker
+# LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS pre-processing flags
+# AR assembler
+# ARFLAGS assembler flags
+# MK make
+# USER_INC additional include files for the compiler, e.g. -I<include dir>
+# USER_LIB additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC -I$NETCDF/include
+%NCDF_LIB -L$NETCDF/lib -lnetcdf -lnetcdff
+%FC mpiifort
+%FCFLAGS -fpe0 -g -r8 -O1 -xHost -fp-model source -traceback
+%FFLAGS %FCFLAGS
+%LD mpiifort
+%FPPFLAGS -P -C -traditional
+%LDFLAGS
+%AR ar
+%ARFLAGS -r
+%MK gmake
+%USER_INC %NCDF_INC
+%USER_LIB %NCDF_LIB
+
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_tools.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_tools.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_tools.fcm	(revision 4230)
@@ -0,0 +1,30 @@
+# generic ifort compiler options for linux
+# NCDF_INC netcdf include file
+# NCDF_LIB netcdf library
+# FC Fortran compiler command
+# FCFLAGS Fortran compiler flags
+# FFLAGS Fortran 77 compiler flags
+# LD linker
+# LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+# FPPFLAGS pre-processing flags
+# AR assembler
+# ARFLAGS assembler flags
+# MK make
+# USER_INC additional include files for the compiler, e.g. -I<include dir>
+# USER_LIB additional libraries to pass to the linker, e.g. -l<library>
+
+
+%NCDF_INC -I$NETCDF/include
+%NCDF_LIB -L$NETCDF/lib -lnetcdf -lnetcdff
+%FC ifort
+%FCFLAGS -r8 -O3 -xHost -fp-model source -traceback
+%FFLAGS  %FCFLAGS
+%LD ifort
+%FPPFLAGS -P -C -traditional
+%LDFLAGS
+%AR ar
+%ARFLAGS -r
+%MK gmake
+%USER_INC %NCDF_INC
+%USER_LIB %NCDF_LIB
+
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_xios.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_xios.fcm	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/ARCH/CMCC/arch-ifort_athena_xios.fcm	(revision 4230)
@@ -0,0 +1,49 @@
+# mpi ifort compiler options for ATHENA using XIOS parallel writer server
+#
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+#
+
+
+
+%NCDF_INC            -I/users/home/sco003/mylib/include
+%NCDF_LIB            -L/users/home/sco003/mylib/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5
+%XIOS_INC            -I/users/home/sco003/XIOS/inc
+%XIOS_LIB            -L/users/home/sco003/XIOS/lib  -lxios
+%FC                  mpiifort
+%FCFLAGS 	     -r8 -O3 -xHost -fp-model source -traceback
+%FFLAGS 	     -r8 -O3 -xHost -fp-model source -traceback
+%LD                  mpiifort
+%FPPFLAGS            -P -C -traditional
+%LDFLAGS             -lstdc++ -lz -lgpfs -lcurl
+%AR                  ar 
+%ARFLAGS             -r
+%MK                  gmake
+%USER_INC            %XIOS_INC %NCDF_INC
+%USER_LIB            %XIOS_LIB %NCDF_LIB
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg	(revision 4230)
@@ -102,11 +102,11 @@
 &namsbc_flx    !   surface boundary condition : flux formulation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'amm12_utau'     ,          1        ,  'utau'      , .false.      , .false. , 'daily'   ,  ''      ,  ''
-   sn_vtau     = 'amm12_vtau'     ,          1        ,  'vtau'      , .false.      , .false. , 'daily'   ,  ''      ,  ''
-   sn_qtot     = 'amm12_flx'      ,          3        ,  'sonsfldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''
-   sn_qsr      = 'amm12_flx'      ,          3        ,  'soshfldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''
-   sn_emp      = 'amm12_flx'      ,          3        ,  'sowafldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''
+!          !  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_utau     = 'amm12_utau'     ,          1        ,  'utau'      , .false.      , .false. , 'daily'   ,  ''      ,  ''  , ''
+   sn_vtau     = 'amm12_vtau'     ,          1        ,  'vtau'      , .false.      , .false. , 'daily'   ,  ''      ,  ''  , ''
+   sn_qtot     = 'amm12_flx'      ,          3        ,  'sonsfldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''  , ''
+   sn_qsr      = 'amm12_flx'      ,          3        ,  'soshfldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''  , ''
+   sn_emp      = 'amm12_flx'      ,          3        ,  'sowafldo'  ,  .true.      , .false. , 'daily'   ,  ''      ,  ''  , ''
    cn_dir      = './fluxes/'        !  root directory for the location of the flux files
 /
@@ -136,11 +136,11 @@
 &namsbc_rnf    !   runoffs namelist surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_rnf      = 'amm12_rivers'       ,        24         , 'rorunoff',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_cnf      = 'runoff_1m_nomask'   ,         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_s_rnf    = 'amm12_rivers'       ,        24         , 'rosaline',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_t_rnf    = 'amm12_rivers'       ,        24         , 'rotemper',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_dep_rnf  = 'amm12_rivers'       ,        24         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+!          !  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_rnf      = 'amm12_rivers'       ,        24         , 'rorunoff',   .false.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_cnf      = 'runoff_1m_nomask'   ,         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_s_rnf    = 'amm12_rivers'       ,        24         , 'rosaline',   .false.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_t_rnf    = 'amm12_rivers'       ,        24         , 'rotemper',   .false.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_dep_rnf  = 'amm12_rivers'       ,        24         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''  , ''
    ln_rnf_mouth = .false.   !  specific treatment at rivers mouths
    ln_rnf_depth = .true.    !  read in depth information for runoff
@@ -151,7 +151,7 @@
 &namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
 !-----------------------------------------------------------------------
-!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+!          !  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_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   '' , ''
 
    cn_dir      = './'       !  root directory for the location of the bulk files
@@ -163,8 +163,8 @@
 &namsbc_ssr    !   surface boundary condition : sea surface restoring
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_sst      = 'amm12_sstref'    ,        24         ,  'sst'     ,     .true.     , .false. , 'daily'   , .false. , ''       , ''
-   sn_sss      = 'sss_data'        ,        -1         ,  'sss'     ,     .true.     , .true.  , 'yearly'  , .false. , ''       , ''
+!          !  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_sst      = 'amm12_sstref'    ,        24         ,  'sst'     ,     .true.     , .false. , 'daily'   , .false. , ''       , '' , ''
+   sn_sss      = 'sss_data'        ,        -1         ,  'sss'     ,     .true.     , .true.  , 'yearly'  , .false. , ''       , '' , ''
 
    cn_dir      = 'fluxes/' !  root directory for the location of the runoff files
@@ -227,13 +227,13 @@
 &nambdy_dta      !  open boundaries - external data           ("key_bdy")
 !-----------------------------------------------------------------------
-!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+!          !  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      !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''  , ''
    cn_dir  =    './bdydta/'
    ln_full_vel = .false.
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg	(revision 4230)
@@ -71,6 +71,4 @@
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
-!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  
    cn_dir        = './'      !  root directory for the location of the runoff files
    ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE/cpp_GYRE.fcm	(revision 4230)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_dynspg_flt key_ldfslp key_zdftke key_iomput key_mpp_mpi key_nosignedzero
+ bld::tool::fppkeys key_dynspg_flt key_ldfslp key_zdftke key_iomput key_mpp_mpi
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/README
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/README	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/README	(revision 4230)
@@ -5,5 +5,5 @@
 INFO HELPDESK: info@bfm-community.eu
 WEB SITE: www.bfm-community.eu
-REVISION DATE: February 2013
+REVISION DATE: October 2013
 
 Please address any technical query to the BFM System Team 
@@ -33,21 +33,29 @@
 Compile NEMO with the BFM 
 -----------------------------------------------------------------------
+NEMO-BFM is compiled from the BFM configuration script relying on the
+NEMO FCM compilation environment. This is done to allow BFM users to
+use new configurations in NEMO that are not part of the NEMO
+standard distribution code.
+The BFM configuration shipped with NEMO is GYRE_BFM (see next section)
+
 Make sure that the BFMDIR variable is defined in your environment
-(ex: export BFMDIR=path/to/bfm)
-Define the variable NEMODIR pointing to the root of NEMO source code
-(ex: export NEMODIR=path/to/nemo)
+and define the variable NEMODIR pointing to the root of NEMO source code
+It is assumed here that you have expanded the bfm in /home/user/bfm
+and the root of this NEMO directory in /home/user/nemo then
+and that you have already adjusted the appropriate ARCHFILE that
+is used for the NEMO compilation with makenemo in ../../ARCH
 
-Go to the $BFMDIR/build/Configurations/GYRE_BFM directory and read 
-carefully the README file.
-Altrenatively, execute
-$BFMDIR/build/bfm_config.sh -h
-to get information on how to add the appropriate ARCHFILE that 
-is used for the NEMO compilation.
-The script will generate the BFM code and then launch makenemo
-to build the executable in this directory.
+Execute the following commands:
+>> export BFMDIR=/home/user/bfm
+>> export NEMODIR=/home/user/nemo
+>> cd $BFMDIR/build
+>> ./bfm_config.sh -gcd -p GYRE_BFM
 
-Once the BFM code has been generated the first time, the code can be 
-rebuilt with the following command:
-./makenemo -n GYRE_BFM -m ARCHFILE -e $BFMDIR/src/nemo 
+The script will generate (-g) the BFM code, then launch 
+makenemo for compilation (-c) and create the run directory
+(-d) in $BFMDIR/run.
+
+to get information on how to use the BFM configuration script run
+>> ./bfm_config.sh -h
 
 -----------------------------------------------------------------------
@@ -56,13 +64,27 @@
 The distributed standard test case is GYRE_BFM, a version of GYRE
 with a full-blown BFM. It is a demnstration simulation and it is not
-meant to produce any published result. The namelists for the BFM are 
-not distributed with NEMO but are generated directly by the BFM, in
-directory $BFMDIR/run/GYRE_BFM. The user can either copy the content
-of $NEMODIR/NEMOGCM/CONFIG/GYRE_BFM/EXP00 in this directory or the
-other way around. GYRE_BFM runs with analytical input data only.
+meant to produce any published result. 
+GYRE_BFM runs with analytical input data only.
+The namelists for the BFM are not distributed with NEMO but are 
+generated directly by the BFM, in directory $BFMDIR/run/gyre_bfm. 
+The generation of the BFM namelist also copy the required NEMO
+namelist and namelist_top files to this directory. 
+This is why there are no namelist files found in the standard 
+run directory $NEMODIR/NEMOGCM/CONFIG/GYRE_BFM/EXP00 
+
+Note for expert users:
+If a user prefers to work in the NEMO directory than she has to
+copy the generated namelists there 
+>> cp $BFMDIR/run/gyre_bfm/* $NEMODIR/NEMOGCM/CONFIG/GYRE_BFM/EXP00
+Once the BFM code has been generated the first time, the code can be 
+also rebuilt with the standard NEMO command:
+>> ./makenemo -n GYRE_BFM -m ARCHFILE -e $BFMDIR/src/nemo 
 
 -----------------------------------------------------------------------
 Other examples
 -----------------------------------------------------------------------
-Other couplings with NEMO are available in $BFMDIR/build/Configurations.
+Other couplings with NEMO are available in $BFMDIR/build/configurations.
+Run the command 
+>> ./bfm_config.sh -P
+to get a list of available presets
 Please refer to the README file in each directory for more information.
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_BFM/cpp_GYRE_BFM.fcm	(revision 4230)
@@ -1,2 +1,2 @@
-bld::tool::fppkeys  key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_top key_my_trc key_mpp_mpi key_iomput key_nosignedzero
+bld::tool::fppkeys key_dynspg_flt key_ldfslp key_zdftke key_vectopt_loop key_top key_my_trc key_mpp_mpi key_iomput
 inc $BFMDIR/src/nemo/bfm.fcm
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_cfg	(revision 4230)
@@ -67,6 +67,4 @@
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
-!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  
    cn_dir        = './'      !  root directory for the location of the runoff files
    ln_tsd_init   = .false.   !  Initialisation of ocean T & S with T &S input data (T) or not (F)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 4230)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys  key_dynspg_flt key_ldfslp key_zdftke key_top key_pisces_reduced key_iomput key_mpp_mpi  key_nosignedzero
+bld::tool::fppkeys  key_dynspg_flt key_ldfslp key_zdftke key_top key_pisces_reduced key_iomput key_mpp_mpi 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg	(revision 4230)
@@ -41,14 +41,14 @@
 &namtrc_dta      !    Initialisation from data input file
 !-----------------------------------------------------------------------
-!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+!          !  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_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
    rn_trfac(1)   =   1.0e-06  !  multiplicative factor
    rn_trfac(2)   =   1.0e-06  !  -      -      -     -
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_cfg	(revision 4230)
@@ -95,26 +95,26 @@
 &namdta_dyn        !   offline dynamics read in files                ("key_offline")
 !-----------------------------------------------------------------------
-!            !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!            !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_tem  = 'dyna_grid_T' ,    120            , 'votemper' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_sal  = 'dyna_grid_T' ,    120            , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_mld  = 'dyna_grid_T' ,    120            , 'somixhgt' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_fmf  = 'dyna_grid_T' ,    120            , 'iowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_ice  = 'dyna_grid_T' ,    120            , 'soicecov' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_qsr  = 'dyna_grid_T' ,    120            , 'soshfldo' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_wnd  = 'dyna_grid_T' ,    120            , 'sowindsp' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_uwd  = 'dyna_grid_U' ,    120            , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_vwd  = 'dyna_grid_V' ,    120            , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_wwd  = 'dyna_grid_W' ,    120            , 'vovecrtz' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_avt  = 'dyna_grid_W' ,    120            , 'voddmavs' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_ubl  = 'dyna_grid_U' ,    120            , 'sobblcox' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_vbl  = 'dyna_grid_V' ,    120            , 'sobblcoy' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_ahu  = 'dyna_grid_U' ,    120            , 'vozoahtu' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_ahv  = 'dyna_grid_V' ,    120            , 'vomeahtv' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_ahw  = 'dyna_grid_W' ,    120            , 'voveahtz' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_eiu  = 'dyna_grid_U' ,    120            , 'vozoaeiu' ,  .true.    , .true. ,   'yearly'  , ''       , '' 
-   sn_eiv  = 'dyna_grid_V' ,    120            , 'vomeaeiv' ,  .true.    , .true. ,   'yearly'  , ''       , ''
-   sn_eiw  = 'dyna_grid_W' ,    120            , 'soleaeiw' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+!          !  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_tem  = 'dyna_grid_T' ,    120            , 'votemper' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_sal  = 'dyna_grid_T' ,    120            , 'vosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_mld  = 'dyna_grid_T' ,    120            , 'somixhgt' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_fmf  = 'dyna_grid_T' ,    120            , 'iowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ice  = 'dyna_grid_T' ,    120            , 'soicecov' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_qsr  = 'dyna_grid_T' ,    120            , 'soshfldo' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_wnd  = 'dyna_grid_T' ,    120            , 'sowindsp' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_uwd  = 'dyna_grid_U' ,    120            , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_vwd  = 'dyna_grid_V' ,    120            , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_wwd  = 'dyna_grid_W' ,    120            , 'vovecrtz' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_avt  = 'dyna_grid_W' ,    120            , 'voddmavs' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ubl  = 'dyna_grid_U' ,    120            , 'sobblcox' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_vbl  = 'dyna_grid_V' ,    120            , 'sobblcoy' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ahu  = 'dyna_grid_U' ,    120            , 'vozoahtu' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ahv  = 'dyna_grid_V' ,    120            , 'vomeahtv' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ahw  = 'dyna_grid_W' ,    120            , 'voveahtz' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_eiu  = 'dyna_grid_U' ,    120            , 'vozoaeiu' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_eiv  = 'dyna_grid_V' ,    120            , 'vomeaeiv' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_eiw  = 'dyna_grid_W' ,    120            , 'soleaeiw' ,  .true.    , .true. ,   'yearly'  , ''       , ''    , ''
 !
    cn_dir      = './'      !  root directory for the location of the dynamical files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg	(revision 4230)
@@ -44,13 +44,13 @@
 !-----------------------------------------------------------------------
 !
-!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(3)  = 'data_O2_nomask'      ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(5)  = 'data_PO4_nomask'     ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(7)  = 'data_Si_nomask'      ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
-   sn_trcdta(23) = 'data_NO3_nomask'     ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+!          !  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_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(3)  = 'data_O2_nomask'      ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(5)  = 'data_PO4_nomask'     ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(7)  = 'data_Si_nomask'      ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''  , ''
+   sn_trcdta(23) = 'data_NO3_nomask'     ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''  , ''
 !
    cn_dir        =  './'      !  root directory for the location of the data files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/1_namelist_ref
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/1_namelist_ref	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/1_namelist_ref	(revision 4230)
@@ -17,4 +17,5 @@
 !!======================================================================
 !!                   ***  Run management namelists  ***
+
 !!======================================================================
 !!   namrun        parameters of the run
@@ -210,5 +211,5 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
-   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+   nn_ice_embd = 1         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
                            !  =1 levitating ice with mass and salt exchange but no presure effect
                            !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
@@ -223,4 +224,5 @@
    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model (T => fill namsbc_wave)
    ln_sdw  = .false.       !  Computation of 3D stokes drift                (T => fill namsbc_wave)
+   cn_iceflx = 'linear'    !  redistribution of solar input into ice categories during coupling ice/atm.
 /
 !-----------------------------------------------------------------------
@@ -237,11 +239,11 @@
 &namsbc_flx    !   surface boundary condition : flux formulation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
-   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+!              !  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_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the flux files
@@ -250,13 +252,13 @@
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the bulk files are
@@ -265,15 +267,15 @@
 &namsbc_core   !   namsbc_core  CORE bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
-   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
-   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'   , ''
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'   , ''
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the bulk files
@@ -281,6 +283,6 @@
    ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
    rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
-   rn_vfac     = 0.        !  multiplicative factor for ocean/ice velocity
    rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.)
+   rn_vfac     = 0.        !  multiplicative factor for ocean/ice velocity 
                            !  in the calculation of the wind stress (0.=absolute winds or 1.=relative winds)
 /
@@ -288,13 +290,13 @@
 &namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+!              !  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_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''    , ''
 
    cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
@@ -326,11 +328,11 @@
 &namsbc_sas    !   analytical surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+!              !  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_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''       , ''      
+   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
 
    ln_3d_uv    = .true.    !  specify whether we are supplying a 3D u,v field
@@ -340,7 +342,7 @@
 &namtra_qsr    !   penetrative solar radiation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+!              !  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_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
@@ -358,11 +360,11 @@
 &namsbc_rnf    !   runoffs namelist surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''    , ''
+   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir       = './'      !  root directory for the location of the runoff files
@@ -379,7 +381,7 @@
 &namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
 !-----------------------------------------------------------------------
-!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+!              !  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_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''    , ''
 
    cn_dir      = './'       !  root directory for the location of the bulk files
@@ -391,8 +393,8 @@
 &namsbc_ssr    !   surface boundary condition : sea surface restoring
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
-   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+!              !  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_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''    , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
@@ -530,10 +532,14 @@
                                           !  = 2, use tidal harmonic forcing data from files
                                           !  = 3, use external data AND tidal harmonic forcing
-    nn_dyn3d      =  0                    !  boundary conditions for baroclinic velocities
-    nn_dyn3d_dta  =  0                    !  = 0, bdy data are equal to the initial state
-                           !  = 1, bdy data are read in 'bdydata   .nc' files
-    nn_tra        =  1                    !  boundary conditions for T and S
+    nn_dyn3d      =  1                    !  boundary conditions for baroclinic velocities.....0=None/1=FRS
+    nn_dyn3d_dta  =  1                    !  = 0, bdy data are equal to the initial state
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+    nn_tra        =  1                    !  boundary conditions for T and S...................0=None/1=FRS
     nn_tra_dta    =  1                    !  = 0, bdy data are equal to the initial state
-                           !  = 1, bdy data are read in 'bdydata   .nc' files
+                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+!    nn_ice_lim      =  1                  !  boundary conditions for ice.......................0=None/1=FRS
+!    nn_ice_lim_dta  =  1                  !  = 0, bdy data are equal to the initial state
+!                                          !  = 1, bdy data are read in 'bdydata   .nc' files
+
     nn_rimwidth  = 10                      !  width of the relaxation zone
     ln_vol     = .false.                  !  total volume correction (see nn_volctl parameter)
@@ -543,13 +549,16 @@
 &nambdy_dta      !  open boundaries - external data           ("key_bdy")
 !-----------------------------------------------------------------------
-!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+!              !  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      !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_a_i  =    'amm12_bdyT_ice' ,         24        , 'ileadfra' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_ht_i =    'amm12_bdyT_ice' ,         24        , 'iicethic' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_ht_s =    'amm12_bdyT_ice' ,         24        , 'isnowthi' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
    cn_dir  =    'bdydta/'
    ln_full_vel = .false.
@@ -1076,10 +1085,10 @@
 &namsbc_wave   ! External fields from wave model
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
-   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
+!              !  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_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''    , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ice_lim2_ref
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ice_lim2_ref	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ice_lim2_ref	(revision 4230)
@@ -87,8 +87,8 @@
 !              !   (hard coded damping area: check if it fit your config)
 !-----------------------------------------------------------------------
-!              !  file name   ! frequency (hours) ! variable ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !              !  (if <0  months)  !   name   !  (logical)   !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_hicif    = 'ice_damping',  -1.              , 'hicif'  ,   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_frld     = 'ice_damping',  -1.              , 'frld'   ,   .true.     , .true. , 'yearly'  , ''       , ''
+!              !  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_hicif    = 'ice_damping',  -1.              , 'hicif'  ,   .true.     , .true. , 'yearly'  , ''       , '',    ''
+   sn_frld     = 'ice_damping',  -1.              , 'frld'   ,   .true.     , .true. , 'yearly'  , ''       , '',    ''
 !
    cn_dir      = './'      !  root directory for the location of the runoff files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref	(revision 4230)
@@ -26,7 +26,7 @@
 &nampisatm     !  Atmospheric prrssure 
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !  file name   ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !              !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_patm     = 'presatm'    ,     -1            , 'patm'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
+!              !  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_patm     = 'presatm'    ,     -1            , 'patm'     ,  .true.      , .true. ,   'yearly'  , ''       , '', ''
    cn_dir      = './'     !  root directory for the location of the dynamical files
 !
@@ -70,7 +70,7 @@
 &nampisopt     !   parameters for optics
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_par     = 'par.orca'       ,     24            , 'fr_par'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
+!              !  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_par     = 'par.orca'       ,     24            , 'fr_par'     ,  .true.      , .true. ,   'yearly'  , ''       , '', ''
    cn_dir      = './'      !  root directory for the location of the dynamical files
    ln_varpar   =  .true.   ! boolean for PAR variable
@@ -172,18 +172,18 @@
 &nampissbc     !   parameters for inputs deposition
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !  file name        ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                   !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_dust     = 'dust.orca'       ,     -1            , 'dust'     ,  .true.      , .true. ,   'yearly'  , ''       , ''
-   sn_solub    = 'solubility.orca' ,    -12            , 'solubility1' ,  .false.      , .true. ,   'yearly'  , ''       , ''
-   sn_riverdic = 'river.orca'      ,    120            , 'riverdic' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdoc = 'river.orca'      ,    120            , 'riverdoc' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdin = 'river.orca'      ,    120            , 'riverdin' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdon = 'river.orca'      ,    120            , 'riverdon' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdip = 'river.orca'      ,    120            , 'riverdip' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdop = 'river.orca'      ,    120            , 'riverdop' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_riverdsi = 'river.orca'      ,    120            , 'riverdsi' ,  .true.     , .true. ,   'yearly'  , ''       , ''
-   sn_ndepo    = 'ndeposition.orca',    -12            , 'ndep'     ,  .false.     , .true. ,   'yearly'  , ''       , ''
-   sn_ironsed  = 'bathy.orca'      ,    -12            , 'bathy'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
-   sn_hydrofe  = 'hydrofe'         ,    -12            , 'epsdb'    ,  .false.     , .true. ,   'yearly'  , ''       , ''
+!              !  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_dust     = 'dust.orca'       ,     -1            , 'dust'     ,  .true.      , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_solub    = 'solubility.orca' ,    -12            , 'solubility1' ,  .false.      , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdic = 'river.orca'      ,    120            , 'riverdic' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdoc = 'river.orca'      ,    120            , 'riverdoc' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdin = 'river.orca'      ,    120            , 'riverdin' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdon = 'river.orca'      ,    120            , 'riverdon' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdip = 'river.orca'      ,    120            , 'riverdip' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdop = 'river.orca'      ,    120            , 'riverdop' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_riverdsi = 'river.orca'      ,    120            , 'riverdsi' ,  .true.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ndepo    = 'ndeposition.orca',    -12            , 'ndep'     ,  .false.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_ironsed  = 'bathy.orca'      ,    -12            , 'bathy'    ,  .false.     , .true. ,   'yearly'  , ''       , ''    , ''
+   sn_hydrofe  = 'hydrofe'         ,    -12            , 'epsdb'    ,  .false.     , .true. ,   'yearly'  , ''       , ''    , ''
 !
    cn_dir      = './'      !  root directory for the location of the dynamical files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 4230)
@@ -170,8 +170,9 @@
 &namtsd    !   data : Temperature  & Salinity
 !-----------------------------------------------------------------------
-!          ! file name ! frequency (hours)    ! variable ! time interp. ! clim  !'yearly' or ! weights  ! rotation !
-!          !           !  (if <0  months)     !   name   !  (logical)   ! (T/F) ! 'monthly'  ! filename ! pairing  !
-   sn_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ' '      , ' '
-   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ' '
+!-----------------------------------------------------------------------
+!          !  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_tem  = 'data_1m_potential_temperature_nomask', -1,'votemper',  .true.  , .true., 'yearly'   , ''       , ''  , ''
+   sn_sal  = 'data_1m_salinity_nomask'             , -1,'vosaline',  .true.  , .true., 'yearly'   , ''       , ''  , ''
    !
    cn_dir        = './'     !  root directory for the location of the runoff files
@@ -240,11 +241,11 @@
 &namsbc_flx    !   surface boundary condition : flux formulation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''
-   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''
-   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''
+!              !  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_utau     = 'utau'      ,        24         , 'utau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'vtau'      ,        24         , 'vtau'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qtot     = 'qtot'      ,        24         , 'qtot'    , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_qsr      = 'qsr'       ,        24         , 'qsr'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
+   sn_emp      = 'emp'       ,        24         , 'emp'     , .false.      , .false., 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the flux files
@@ -253,13 +254,13 @@
 &namsbc_clio   !   namsbc_clio  CLIO bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_utau     = 'taux_1m'   ,       -1          , 'sozotaux',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_vtau     = 'tauy_1m'   ,       -1          , 'sometauy',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_wndm     = 'flx'       ,       -1          , 'socliowi',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 'flx'       ,       -1          , 'socliot2',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'flx'       ,       -1          , 'socliohu',   .true.     , .true. , 'yearly'  , ''       , ''       , ''
+   sn_ccov     = 'flx'       ,       -1          , 'socliocl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'flx'       ,       -1          , 'socliopl',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the bulk files are
@@ -268,15 +269,15 @@
 &namsbc_core   !   namsbc_core  CORE bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name                    ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                               !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'
-   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'
-   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_wndi     = 'u_10.15JUNE2009_orca2'       ,         6         , 'U_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Uwnd'   , ''
+   sn_wndj     = 'v_10.15JUNE2009_orca2'       ,         6         , 'V_10_MOD',   .false.    , .true. , 'yearly'  , ''       , 'Vwnd'   , ''
+   sn_qsr      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'SWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_qlw      = 'ncar_rad.15JUNE2009_orca2'   ,        24         , 'LWDN_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tair     = 't_10.15JUNE2009_orca2'       ,         6         , 'T_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_humi     = 'q_10.15JUNE2009_orca2'       ,         6         , 'Q_10_MOD',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_prec     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'PRC_MOD1',   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_snow     = 'ncar_precip.15JUNE2009_orca2',        -1         , 'SNOW'    ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
+   sn_tdif     = 'taudif_core'                 ,        24         , 'taudif'  ,   .false.    , .true. , 'yearly'  , ''       , ''       , ''
 
    cn_dir      = './'      !  root directory for the location of the bulk files
@@ -291,13 +292,13 @@
 &namsbc_mfs   !   namsbc_mfs  MFS bulk formulae
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''
-   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''
-   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''
+!              !  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_wndi     =   'ecmwf'   ,        6          , 'u10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_wndj     =   'ecmwf'   ,        6          , 'v10'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_clc      =   'ecmwf'   ,        6          , 'clc'     ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_msl      =   'ecmwf'   ,        6          , 'msl'     ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_tair     =   'ecmwf'   ,        6          , 't2'      ,    .true.    , .false. , 'daily'  ,'bicubic.nc' , ''    , ''
+   sn_rhm      =   'ecmwf'   ,        6          , 'rh'      ,    .true.    , .false. , 'daily'  ,'bilinear.nc', ''    , ''
+   sn_prec     =   'ecmwf'   ,        6          , 'precip'  ,    .true.    , .true.  , 'daily'  ,'bicubic.nc' , ''    , ''
 
    cn_dir      = './ECMWF/'      !  root directory for the location of the bulk files
@@ -329,11 +330,11 @@
 &namsbc_sas    !   analytical surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
-   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''         
+!              !  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_usp      = 'sas_grid_U' ,    120    , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''       , ''      
+   sn_vsp      = 'sas_grid_V' ,    120    , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_tem      = 'sas_grid_T' ,    120    , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_sal      = 'sas_grid_T' ,    120    , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
+   sn_ssh      = 'sas_grid_T' ,    120    , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , ''
 
    ln_3d_uv    = .true.    !  specify whether we are supplying a 3D u,v field
@@ -343,7 +344,7 @@
 &namtra_qsr    !   penetrative solar radiation
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''
+!              !  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_chl      ='chlorophyll',        -1         , 'CHLA'    ,   .true.     , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
@@ -361,11 +362,11 @@
 &namsbc_rnf    !   runoffs namelist surface boundary condition
 !-----------------------------------------------------------------------
-!              !  file name           ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !                      !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''
-   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''
-   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''
+!              !  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_rnf      = 'runoff_core_monthly',        -1         , 'sorunoff',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_cnf      = 'runoff_core_monthly',         0         , 'socoefr0',   .false.    , .true. , 'yearly'  , ''       , ''    , ''
+   sn_s_rnf    = 'runoffs'            ,        24         , 'rosaline',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_t_rnf    = 'runoffs'            ,        24         , 'rotemper',   .true.     , .true. , 'yearly'  , ''       , ''    , ''
+   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir       = './'      !  root directory for the location of the runoff files
@@ -382,7 +383,7 @@
 &namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk
 !-----------------------------------------------------------------------
-!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   sn_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''
+!              !  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_apr      = 'patm'    ,         -1        ,'somslpre',    .true.      , .true.  , 'yearly'  ,  ''      ,   ''    , ''
 
    cn_dir      = './'       !  root directory for the location of the bulk files
@@ -394,8 +395,8 @@
 &namsbc_ssr    !   surface boundary condition : sea surface restoring
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''
-   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''
+!              !  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_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''    , ''
+   sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''    , ''
 
    cn_dir      = './'      !  root directory for the location of the runoff files
@@ -550,16 +551,16 @@
 &nambdy_dta      !  open boundaries - external data           ("key_bdy")
 !-----------------------------------------------------------------------
-!              !   file name    ! frequency (hours) !  variable  ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
-!              !                !  (if <0  months)  !    name    !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-!   bn_a_i  =    'amm12_bdyT_ice' ,         24        , 'ileadfra' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-!   bn_ht_i =    'amm12_bdyT_ice' ,         24        , 'iicethic' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
-!   bn_ht_s =    'amm12_bdyT_ice' ,         24        , 'isnowthi' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''
+!              !  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      !
+   bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+   bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_a_i  =    'amm12_bdyT_ice' ,         24        , 'ileadfra' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_ht_i =    'amm12_bdyT_ice' ,         24        , 'iicethic' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
+!   bn_ht_s =    'amm12_bdyT_ice' ,         24        , 'isnowthi' ,     .true.     , .false. ,  'daily'  ,    ''    ,   ''    , ''
    cn_dir  =    'bdydta/'
    ln_full_vel = .false.
@@ -1086,10 +1087,10 @@
 &namsbc_wave   ! External fields from wave model
 !-----------------------------------------------------------------------
-!              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
-!              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
-   sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''
-   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''
-   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''
+!              !  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_cdg      =  'cdg_wave' ,        1          , 'drag_coeff' , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'     , .true.   , .false. , 'daily'  ,''         , ''    , ''
+   sn_wn       =  'sdw_wave' ,        1          , 'wave_num'   , .true.   , .false. , 'daily'  ,''         , ''    , ''
 !
    cn_dir_cdg  = './'  !  root directory for the location of drag coefficient files
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/cfg.txt
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/cfg.txt	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/CONFIG/cfg.txt	(revision 4230)
@@ -8,3 +8,4 @@
 ORCA2_LIM_CFC_C14b OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
 ORCA2_SAS_LIM OPA_SRC SAS_SRC LIM_SRC_2 NST_SRC
+ORCA2_LIM_CFC_C14b OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
 ORCA2_OFF_PISCES OPA_SRC OFF_SRC TOP_SRC
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 4230)
@@ -347,5 +347,4 @@
 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdta_dyn in configuration namelist', lwp )
       WRITE ( numond, namdta_dyn )
-
       !                                         ! store namelist information in an array
       !                                         ! Control print
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90	(revision 4230)
@@ -46,4 +46,5 @@
    USE timing          ! Timing
    USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
+   USE lbcnfd, ONLY: isendto, nsndto
 
    USE trc
@@ -570,136 +571,57 @@
       !!======================================================================
       !!                     ***  ROUTINE  nemo_northcomms  ***
-      !! nemo_northcomms    :  Setup for north fold exchanges with explicit peer to peer messaging
+      !! nemo_northcomms    :  Setup for north fold exchanges with explicit 
+      !!                       point-to-point messaging
       !!=====================================================================
       !!----------------------------------------------------------------------
-      !! 
+      !!
       !! ** Purpose :   Initialization of the northern neighbours lists.
       !!----------------------------------------------------------------------
-      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE) 
-      !!----------------------------------------------------------------------
-
-      INTEGER ::   ji, jj, jk, ij, jtyp    ! dummy loop indices
-      INTEGER ::   ijpj                    ! number of rows involved in north-fold exchange
-      INTEGER ::   northcomms_alloc        ! allocate return status
-      REAL(wp), ALLOCATABLE, DIMENSION ( :,: ) ::   znnbrs     ! workspace
-      LOGICAL,  ALLOCATABLE, DIMENSION ( : )   ::   lrankset   ! workspace
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'nemo_northcomms : Initialization of the northern neighbours lists'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
-
-      !!----------------------------------------------------------------------
-      ALLOCATE( znnbrs(jpi,jpj), stat = northcomms_alloc )
-      ALLOCATE( lrankset(jpnij), stat = northcomms_alloc )
-      IF( northcomms_alloc /= 0 ) THEN
-         WRITE(numout,cform_war)
-         WRITE(numout,*) 'northcomms_alloc : failed to allocate arrays'
-         CALL ctl_stop( 'STOP', 'nemo_northcomms : unable to allocate temporary arrays' )
-      ENDIF
+      !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE)
+      !!    2.0  ! 2013-06 Setup avoiding MPI communication (I. Epicoco, S. Mocavero, CMCC) 
+      !!----------------------------------------------------------------------
+
+      INTEGER  ::   sxM, dxM, sxT, dxT, jn
+      INTEGER  ::   njmppmax
+
+      njmppmax = MAXVAL( njmppt )
+
+      !initializes the north-fold communication variables
+      isendto(:) = 0
       nsndto = 0
-      isendto = -1
-      ijpj   = 4
-      !
-      ! This routine has been called because ln_nnogather has been set true ( nammpp )
-      ! However, these first few exchanges have to use the mpi_allgather method to
-      ! establish the neighbour lists to use in subsequent peer to peer exchanges.
-      ! Consequently, set l_north_nogather to be false here and set it true only after
-      ! the lists have been established.
-      !
-      l_north_nogather = .FALSE.
-      !
-      ! Exchange and store ranks on northern rows
-
-      DO jtyp = 1,4
-
-         lrankset = .FALSE.
-         znnbrs = narea
-         SELECT CASE (jtyp)
-            CASE(1)
-               CALL lbc_lnk( znnbrs, 'T', 1. )      ! Type 1: T,W-points
-            CASE(2)
-               CALL lbc_lnk( znnbrs, 'U', 1. )      ! Type 2: U-point
-            CASE(3)
-               CALL lbc_lnk( znnbrs, 'V', 1. )      ! Type 3: V-point
-            CASE(4)
-               CALL lbc_lnk( znnbrs, 'F', 1. )      ! Type 4: F-point
-         END SELECT
-
-         IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN
-            DO jj = nlcj-ijpj+1, nlcj
-               ij = jj - nlcj + ijpj
-               DO ji = 1,jpi
-                  IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) &
-               &     lrankset(INT(znnbrs(ji,jj))) = .true.
-               END DO
-            END DO
-
-            DO jj = 1,jpnij
-               IF ( lrankset(jj) ) THEN
-                  nsndto(jtyp) = nsndto(jtyp) + 1
-                  IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN
-                     CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', &
-                  &                 ' jpmaxngh will need to be increased ')
-                  ENDIF
-                  isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank
-               ENDIF
-            END DO
-         ENDIF
-
-      END DO
-
-      !
-      ! Type 5: I-point
-      !
-      ! ICE point exchanges may involve some averaging. The neighbours list is
-      ! built up using two exchanges to ensure that the whole stencil is covered.
-      ! lrankset should not be reset between these 'J' and 'K' point exchanges
-
-      jtyp = 5
-      lrankset = .FALSE.
-      znnbrs = narea 
-      CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point
-
-      IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN
-         DO jj = nlcj-ijpj+1, nlcj
-            ij = jj - nlcj + ijpj
-            DO ji = 1,jpi
-               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) &
-            &     lrankset(INT(znnbrs(ji,jj))) = .true.
-         END DO
-        END DO
-      ENDIF
-
-      znnbrs = narea 
-      CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point
-
-      IF ( njmppt(narea) .EQ. MAXVAL( njmppt )) THEN
-         DO jj = nlcj-ijpj+1, nlcj
-            ij = jj - nlcj + ijpj
-            DO ji = 1,jpi
-               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND.  INT(znnbrs(ji,jj)) .NE. narea ) &
-            &       lrankset( INT(znnbrs(ji,jj))) = .true.
-            END DO
-         END DO
-
-         DO jj = 1,jpnij
-            IF ( lrankset(jj) ) THEN
-               nsndto(jtyp) = nsndto(jtyp) + 1
-               IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN
-                  CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', &
-               &                 ' jpmaxngh will need to be increased ')
-               ENDIF
-               isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank
-            ENDIF
-         END DO
-         !
-         ! For northern row areas, set l_north_nogather so that all subsequent exchanges 
-         ! can use peer to peer communications at the north fold
-         !
-         l_north_nogather = .TRUE.
-         !
-      ENDIF
-      DEALLOCATE( znnbrs )
-      DEALLOCATE( lrankset )
+
+      !if I am a process in the north
+      IF ( njmpp == njmppmax ) THEN
+          !sxM is the first point (in the global domain) needed to compute the
+          !north-fold for the current process
+          sxM = jpiglo - nimppt(narea) - nlcit(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
+
+          !loop over the other north-fold processes to find the processes
+          !managing the points belonging to the sxT-dxT range
+          DO jn = jpnij - jpni +1, jpnij
+             IF ( njmppt(jn) == njmppmax ) THEN
+                !sxT is the first point (in the global domain) of the jn
+                !process
+                sxT = nimppt(jn)
+                !dxT is the last point (in the global domain) of the jn
+                !process
+                dxT = nimppt(jn) + nlcit(jn) - 1
+                IF ((sxM .gt. sxT) .AND. (sxM .lt. dxT)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                ELSEIF ((sxM .le. sxT) .AND. (dxM .gt. dxT)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                ELSEIF ((dxM .lt. dxT) .AND. (sxT .lt. dxM)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                END IF
+             END IF
+          END DO
+      ENDIF
+      l_north_nogather = .TRUE.
 
    END SUBROUTINE nemo_northcomms
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 4230)
@@ -446,5 +446,4 @@
       DO ib_bdy = 1, nb_bdy         
          IF( nn_dta(ib_bdy) .eq. 1 ) THEN
-
             READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901)
 901         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp )
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/DOM/dtatsd.F90	(revision 4230)
@@ -73,8 +73,10 @@
       cn_dir = './'                       ! directory in which the model is executed
       !                                   ! sn_... default values (NB: frequency positive => hours, negative => months)
-      !            !   file    ! frequency ! variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
-      !            !   name    !  (hours)  !  name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
-      sn_tem = FLD_N( 'temperature',  -1.  , 'votemper',  .false.   , .true.  ,  'monthly'  , ''       , ''       )
-      sn_sal = FLD_N( 'salinity'   ,  -1.  , 'vosaline',  .false.   , .true.  ,  'monthly'  , ''       , ''       )
+      !            !   file    ! frequency ! variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation ! land/sea mask !
+      !            !   name    !  (hours)  !  name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    ! filename      !
+      sn_tem = FLD_N( 'temperature',  -1.  , 'votemper',  .false.   , .true.  ,  'monthly'  , ''       , &
+           & ''       , ''            )
+      sn_sal = FLD_N( 'salinity'   ,  -1.  , 'vosaline',  .false.   , .true.  ,  'monthly'  , ''       , &
+           & ''       , ''            )
  
       REWIND( numnam_ref )              ! Namelist namtsd in reference namelist : 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lbcnfd.F90	(revision 4230)
@@ -5,4 +5,5 @@
    !!======================================================================
    !! History :  3.2  ! 2009-03  (R. Benshila)  Original code 
+   !!            3.5  ! 2013-07 (I. Epicoco, S. Mocavero - CMCC) MPP optimization 
    !!----------------------------------------------------------------------
 
@@ -11,4 +12,6 @@
    !!   lbc_nfd_3d    : lateral boundary condition: North fold treatment for a 3D arrays   (lbc_nfd)
    !!   lbc_nfd_2d    : lateral boundary condition: North fold treatment for a 2D arrays   (lbc_nfd)
+   !!   mpp_lbc_nfd_3d    : North fold treatment for a 3D arrays optimized for MPP
+   !!   mpp_lbc_nfd_2d    : North fold treatment for a 2D arrays optimized for MPP
    !!----------------------------------------------------------------------
    USE dom_oce        ! ocean space and time domain 
@@ -23,4 +26,15 @@
 
    PUBLIC   lbc_nfd   ! north fold conditions
+   INTERFACE mpp_lbc_nfd
+      MODULE PROCEDURE   mpp_lbc_nfd_3d, mpp_lbc_nfd_2d
+   END INTERFACE
+
+   PUBLIC   mpp_lbc_nfd   ! north fold conditions in parallel case
+
+   INTEGER, PUBLIC,  PARAMETER :: jpmaxngh = 3
+   INTEGER, PUBLIC                                  ::   nsndto
+   INTEGER, PUBLIC,  DIMENSION (jpmaxngh)           ::   isendto ! processes to which communicate
+
+
 
    !!----------------------------------------------------------------------
@@ -361,4 +375,547 @@
    END SUBROUTINE lbc_nfd_2d
 
-   !!======================================================================
+
+   SUBROUTINE mpp_lbc_nfd_3d( pt3dl, pt3dr, cd_type, psgn )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lbc_nfd_3d  ***
+      !!
+      !! ** Purpose :   3D lateral boundary condition : North fold treatment
+      !!              without processor exchanges. 
+      !!
+      !! ** Method  :   
+      !!
+      !! ** Action  :   pt3d with updated values along the north fold
+      !!----------------------------------------------------------------------
+      CHARACTER(len=1)          , INTENT(in   ) ::   cd_type   ! define the nature of ptab array grid-points
+      !                                                        !   = T , U , V , F , W points
+      REAL(wp)                  , INTENT(in   ) ::   psgn      ! control of the sign change
+      !                                                        !   = -1. , the sign is changed if north fold boundary
+      !                                                        !   =  1. , the sign is kept  if north fold boundary
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pt3dl      ! 3D array on which the boundary condition is applied
+      REAL(wp), DIMENSION(:,:,:), INTENT(in) ::   pt3dr      ! 3D array on which the boundary condition is applied
+      !
+      INTEGER  ::   ji, jk
+      INTEGER  ::   ijt, iju, ijpj, ijpjm1, ijta, ijua, jia, startloop, endloop
+      !!----------------------------------------------------------------------
+
+      SELECT CASE ( jpni )
+      CASE ( 1 )     ;   ijpj = nlcj      ! 1 proc only  along the i-direction
+      CASE DEFAULT   ;   ijpj = 4         ! several proc along the i-direction
+      END SELECT
+      ijpjm1 = ijpj-1
+
+         !
+         SELECT CASE ( npolj )
+         !
+         CASE ( 3 , 4 )                        ! *  North fold  T-point pivot
+            !
+            SELECT CASE ( cd_type )
+            CASE ( 'T' , 'W' )                         ! T-, W-point
+               IF (narea .ne. (jpnij - jpni + 1)) THEN
+                 startloop = 1
+               ELSE
+                 startloop = 2
+               ENDIF
+
+               DO jk = 1, jpk
+                  DO ji = startloop, nlci
+                     ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                     pt3dl(ji,ijpj,jk) = psgn * pt3dr(ijt,ijpj-2,jk)
+                  END DO
+               END DO
+
+               IF(nimpp .ge. (jpiglo/2+1)) THEN
+                 startloop = 1
+               ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+                 startloop = jpiglo/2+1 - nimpp + 1
+               ELSE
+                 startloop = nlci + 1
+               ENDIF
+               IF(startloop .le. nlci) THEN
+                 DO jk = 1, jpk
+                    DO ji = startloop, nlci
+                       ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                       jia = ji + nimpp - 1
+                       ijta = jpiglo - jia + 2
+                       IF((ijta .ge. (startloop + nimpp - 1)) .and. (ijta .lt. jia)) THEN
+                          pt3dl(ji,ijpjm1,jk) = psgn * pt3dl(ijta-nimpp+1,ijpjm1,jk)
+                       ELSE
+                          pt3dl(ji,ijpjm1,jk) = psgn * pt3dr(ijt,ijpjm1,jk)
+                       ENDIF
+                    END DO
+                 END DO
+               ENDIF
+
+
+
+            CASE ( 'U' )                               ! U-point
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO jk = 1, jpk
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+                     pt3dl(ji,ijpj,jk) = psgn * pt3dr(iju,ijpj-2,jk)
+                  END DO
+               END DO
+
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               IF(nimpp .ge. (jpiglo/2)) THEN
+                  startloop = 1
+               ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2)) .AND. (nimpp .lt. (jpiglo/2))) THEN
+                  startloop = jpiglo/2 - nimpp + 1
+               ELSE
+                  startloop = endloop + 1
+               ENDIF
+               IF (startloop .le. endloop) THEN
+                 DO jk = 1, jpk
+                    DO ji = startloop, endloop
+                      iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+                      jia = ji + nimpp - 1
+                      ijua = jpiglo - jia + 1
+                      IF((ijua .ge. (startloop + nimpp - 1)) .and. (ijua .lt. jia)) THEN
+                        pt3dl(ji,ijpjm1,jk) = psgn * pt3dl(ijua-nimpp+1,ijpjm1,jk)
+                      ELSE
+                        pt3dl(ji,ijpjm1,jk) = psgn * pt3dr(iju,ijpjm1,jk)
+                      ENDIF
+                    END DO
+                 END DO
+               ENDIF
+
+            CASE ( 'V' )                               ! V-point
+               IF (narea .ne. (jpnij - jpni + 1)) THEN
+                  startloop = 1
+               ELSE
+                  startloop = 2
+               ENDIF
+               DO jk = 1, jpk
+                  DO ji = startloop, nlci
+                     ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                     pt3dl(ji,ijpj-1,jk) = psgn * pt3dr(ijt,ijpj-2,jk)
+                     pt3dl(ji,ijpj  ,jk) = psgn * pt3dr(ijt,ijpj-3,jk)
+                  END DO
+               END DO
+            CASE ( 'F' )                               ! F-point
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO jk = 1, jpk
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+                     pt3dl(ji,ijpj-1,jk) = psgn * pt3dr(iju,ijpj-2,jk)
+                     pt3dl(ji,ijpj  ,jk) = psgn * pt3dr(iju,ijpj-3,jk)
+                  END DO
+               END DO
+            END SELECT
+            !
+
+         CASE ( 5 , 6 )                        ! *  North fold  F-point pivot
+            !
+            SELECT CASE ( cd_type )
+            CASE ( 'T' , 'W' )                         ! T-, W-point
+               DO jk = 1, jpk
+                  DO ji = 1, nlci
+                     ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+                     pt3dl(ji,ijpj,jk) = psgn * pt3dr(ijt,ijpj-1,jk)
+                  END DO
+               END DO
+
+            CASE ( 'U' )                               ! U-point
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO jk = 1, jpk
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+                     pt3dl(ji,ijpj,jk) = psgn * pt3dr(iju,ijpj-1,jk)
+                  END DO
+               END DO
+
+            CASE ( 'V' )                               ! V-point
+               DO jk = 1, jpk
+                  DO ji = 1, nlci
+                     ijt = jpiglo - ji- nimpp - nimppt(isendto(1)) + 3
+                     pt3dl(ji,ijpj,jk) = psgn * pt3dr(ijt,ijpj-2,jk)
+                  END DO
+               END DO
+
+               IF(nimpp .ge. (jpiglo/2+1)) THEN
+                  startloop = 1
+               ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+                  startloop = jpiglo/2+1 - nimpp + 1
+               ELSE
+                  startloop = nlci + 1
+               ENDIF
+               IF(startloop .le. nlci) THEN
+                 DO jk = 1, jpk
+                    DO ji = startloop, nlci
+                       ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+                       pt3dl(ji,ijpjm1,jk) = psgn * pt3dr(ijt,ijpjm1,jk)
+                    END DO
+                 END DO
+               ENDIF
+
+            CASE ( 'F' )                               ! F-point
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO jk = 1, jpk
+                  DO ji = 1, endloop
+                     iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+                     pt3dl(ji,ijpj ,jk) = psgn * pt3dr(iju,ijpj-2,jk)
+                  END DO
+               END DO
+
+               IF (narea .ne. (jpnij)) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               IF(nimpp .ge. (jpiglo/2+1)) THEN
+                  startloop = 1
+               ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+                  startloop = jpiglo/2+1 - nimpp + 1
+               ELSE
+                  startloop = endloop + 1
+               ENDIF
+               IF (startloop .le. endloop) THEN
+                  DO jk = 1, jpk
+                     DO ji = startloop, endloop
+                        iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+                        pt3dl(ji,ijpjm1,jk) = psgn * pt3dr(iju,ijpjm1,jk)
+                     END DO
+                  END DO
+               ENDIF
+
+            END SELECT
+
+         CASE DEFAULT                           ! *  closed : the code probably never go through
+            !
+            SELECT CASE ( cd_type)
+            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
+               pt3dl(:, 1  ,jk) = 0.e0
+               pt3dl(:,ijpj,jk) = 0.e0
+            CASE ( 'F' )                               ! F-point
+               pt3dl(:,ijpj,jk) = 0.e0
+            END SELECT
+            !
+         END SELECT     !  npolj
+         !
+      !
+   END SUBROUTINE mpp_lbc_nfd_3d
+
+
+   SUBROUTINE mpp_lbc_nfd_2d( pt2dl, pt2dr, cd_type, psgn )
+      !!----------------------------------------------------------------------
+      !!                  ***  routine mpp_lbc_nfd_2d  ***
+      !!
+      !! ** Purpose :   2D lateral boundary condition : North fold treatment
+      !!       without processor exchanges. 
+      !!
+      !! ** Method  :   
+      !!
+      !! ** Action  :   pt2d with updated values along the north fold
+      !!----------------------------------------------------------------------
+      CHARACTER(len=1)        , INTENT(in   ) ::   cd_type   ! define the nature of ptab array grid-points
+      !                                                      ! = T , U , V , F , W points
+      REAL(wp)                , INTENT(in   ) ::   psgn      ! control of the sign change
+      !                                                      !   = -1. , the sign is changed if north fold boundary
+      !                                                      !   =  1. , the sign is kept  if north fold boundary
+      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pt2dl      ! 2D array on which the boundary condition is applied
+      REAL(wp), DIMENSION(:,:), INTENT(in) ::   pt2dr      ! 2D array on which the boundary condition is applied
+      !
+      INTEGER  ::   ji
+      INTEGER  ::   ijt, iju, ijpj, ijpjm1, ijta, ijua, jia, startloop, endloop
+      !!----------------------------------------------------------------------
+
+      SELECT CASE ( jpni )
+      CASE ( 1 )     ;   ijpj = nlcj      ! 1 proc only  along the i-direction
+      CASE DEFAULT   ;   ijpj = 4         ! several proc along the i-direction
+      END SELECT
+      !
+      ijpjm1 = ijpj-1
+
+
+      SELECT CASE ( npolj )
+      !
+      CASE ( 3, 4 )                       ! *  North fold  T-point pivot
+         !
+         SELECT CASE ( cd_type )
+         !
+         CASE ( 'T' , 'W' )                               ! T- , W-points
+            IF (narea .ne. (jpnij - jpni + 1)) THEN
+              startloop = 1
+            ELSE
+              startloop = 2
+            ENDIF
+            DO ji = startloop, nlci
+              ijt=jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+              pt2dl(ji,ijpj) = psgn * pt2dr(ijt,ijpjm1-1)
+            END DO
+
+            IF(nimpp .ge. (jpiglo/2+1)) THEN
+               startloop = 1
+            ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+               startloop = jpiglo/2+1 - nimpp + 1
+            ELSE
+               startloop = nlci + 1
+            ENDIF
+            DO ji = startloop, nlci
+               ijt=jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+               jia = ji + nimpp - 1
+               ijta = jpiglo - jia + 2
+               IF((ijta .ge. (startloop + nimpp - 1)) .and. (ijta .lt. jia)) THEN
+                  pt2dl(ji,ijpjm1) = psgn * pt2dl(ijta-nimpp+1,ijpjm1)
+               ELSE
+                  pt2dl(ji,ijpjm1) = psgn * pt2dr(ijt,ijpjm1)
+               ENDIF
+            END DO
+
+         CASE ( 'U' )                                     ! U-point
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            DO ji = 1, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1-1)
+            END DO
+
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            IF(nimpp .ge. (jpiglo/2)) THEN
+               startloop = 1
+            ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2)) .AND. (nimpp .lt. (jpiglo/2))) THEN
+               startloop = jpiglo/2 - nimpp + 1
+            ELSE
+               startloop = endloop + 1
+            ENDIF
+            DO ji = startloop, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               jia = ji + nimpp - 1
+               ijua = jpiglo - jia + 1
+               IF((ijua .ge. (startloop + nimpp - 1)) .and. (ijua .lt. jia)) THEN
+                  pt2dl(ji,ijpjm1) = psgn * pt2dl(ijua-nimpp+1,ijpjm1)
+               ELSE
+                  pt2dl(ji,ijpjm1) = psgn * pt2dr(iju,ijpjm1)
+               ENDIF
+            END DO
+
+         CASE ( 'V' )                                     ! V-point
+            IF (narea .ne. (jpnij - jpni + 1)) THEN
+              startloop = 1
+            ELSE
+              startloop = 2
+            ENDIF
+            DO ji = startloop, nlci
+              ijt=jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+              pt2dl(ji,ijpjm1) = psgn * pt2dr(ijt,ijpjm1-1)
+              pt2dl(ji,ijpj) = psgn * pt2dr(ijt,ijpjm1-2)
+            END DO
+
+         CASE ( 'F' )                                     ! F-point
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            DO ji = 1, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               pt2dl(ji,ijpjm1) = psgn * pt2dr(iju,ijpjm1-1)
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1-2)
+            END DO
+
+         CASE ( 'I' )                                     ! ice U-V point (I-point)
+            IF (narea .ne. (jpnij - jpni + 1)) THEN
+               startloop = 1
+            ELSE
+               startloop = 3
+               pt2dl(2,ijpj) = psgn * pt2dr(3,ijpjm1)
+            ENDIF
+            DO ji = startloop, nlci
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 5
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1)
+            END DO
+
+         CASE ( 'J' )                                     ! first ice U-V point
+            IF (narea .ne. (jpnij - jpni + 1)) THEN
+               startloop = 1
+            ELSE
+               startloop = 3
+               pt2dl(2,ijpj) = psgn * pt2dr(3,ijpjm1)
+            ENDIF
+            DO ji = startloop, nlci
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 5
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1)
+            END DO
+
+         CASE ( 'K' )                                     ! second ice U-V point
+            IF (narea .ne. (jpnij - jpni + 1)) THEN
+               startloop = 1
+            ELSE
+               startloop = 3
+               pt2dl(2,ijpj) = psgn * pt2dr(3,ijpjm1)
+            ENDIF
+            DO ji = startloop, nlci
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 5
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1)
+            END DO
+
+         END SELECT
+         !
+      CASE ( 5, 6 )                        ! *  North fold  F-point pivot
+         !
+         SELECT CASE ( cd_type )
+         CASE ( 'T' , 'W' )                               ! T-, W-point
+            DO ji = 1, nlci
+               ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               pt2dl(ji,ijpj) = psgn * pt2dr(ijt,ijpjm1)
+            END DO
+
+         CASE ( 'U' )                                     ! U-point
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            DO ji = 1, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1)
+            END DO
+
+         CASE ( 'V' )                                     ! V-point
+            DO ji = 1, nlci
+               ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               pt2dl(ji,ijpj) = psgn * pt2dr(ijt,ijpjm1-1)
+            END DO
+            IF(nimpp .ge. (jpiglo/2+1)) THEN
+               startloop = 1
+            ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+               startloop = jpiglo/2+1 - nimpp + 1
+            ELSE
+               startloop = nlci + 1
+            ENDIF
+            DO ji = startloop, nlci
+               ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 3
+               pt2dl(ji,ijpjm1) = psgn * pt2dr(ijt,ijpjm1)
+            END DO
+
+         CASE ( 'F' )                               ! F-point
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            DO ji = 1, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+               pt2dl(ji,ijpj) = psgn * pt2dr(iju,ijpjm1-1)
+            END DO
+
+            IF (narea .ne. (jpnij)) THEN
+               endloop = nlci
+            ELSE
+               endloop = nlci - 1
+            ENDIF
+            IF(nimpp .ge. (jpiglo/2+1)) THEN
+               startloop = 1
+            ELSEIF(((nimpp+nlci-1) .ge. (jpiglo/2+1)) .AND. (nimpp .lt. (jpiglo/2+1))) THEN
+               startloop = jpiglo/2+1 - nimpp + 1
+            ELSE
+               startloop = endloop + 1
+            ENDIF
+
+            DO ji = startloop, endloop
+               iju = jpiglo - ji - nimpp - nimppt(isendto(1)) + 2
+               pt2dl(ji,ijpjm1) = psgn * pt2dr(iju,ijpjm1)
+            END DO
+
+         CASE ( 'I' )                                  ! ice U-V point (I-point)
+               IF (narea .ne. (jpnij - jpni + 1)) THEN
+                  startloop = 1
+               ELSE
+                  startloop = 2
+               ENDIF
+               IF (narea .ne. jpnij) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO ji = startloop , endloop
+                  ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                  pt2dl(ji,ijpj)= 0.5 * (pt2dr(ji,ijpjm1) + psgn * pt2dr(ijt,ijpjm1))
+               END DO
+
+         CASE ( 'J' )                                  ! first ice U-V point
+               IF (narea .ne. (jpnij - jpni + 1)) THEN
+                  startloop = 1
+               ELSE
+                  startloop = 2
+               ENDIF
+               IF (narea .ne. jpnij) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO ji = startloop , endloop
+                  ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                  pt2dl(ji,ijpj) = pt2dr(ji,ijpjm1)
+               END DO
+
+         CASE ( 'K' )                                  ! second ice U-V point
+               IF (narea .ne. (jpnij - jpni + 1)) THEN
+                  startloop = 1
+               ELSE
+                  startloop = 2
+               ENDIF
+               IF (narea .ne. jpnij) THEN
+                  endloop = nlci
+               ELSE
+                  endloop = nlci - 1
+               ENDIF
+               DO ji = startloop, endloop
+                  ijt = jpiglo - ji - nimpp - nimppt(isendto(1)) + 4
+                  pt2dl(ji,ijpj) = pt2dr(ijt,ijpjm1)
+               END DO
+
+         END SELECT
+         !
+      CASE DEFAULT                           ! *  closed : the code probably never go through
+         !
+         SELECT CASE ( cd_type)
+         CASE ( 'T' , 'U' , 'V' , 'W' )                 ! T-, U-, V-, W-points
+            pt2dl(:, 1     ) = 0.e0
+            pt2dl(:,ijpj) = 0.e0
+         CASE ( 'F' )                                   ! F-point
+            pt2dl(:,ijpj) = 0.e0
+         CASE ( 'I' )                                   ! ice U-V point
+            pt2dl(:, 1     ) = 0.e0
+            pt2dl(:,ijpj) = 0.e0
+         CASE ( 'J' )                                   ! first ice U-V point
+            pt2dl(:, 1     ) = 0.e0
+            pt2dl(:,ijpj) = 0.e0
+         CASE ( 'K' )                                   ! second ice U-V point
+            pt2dl(:, 1     ) = 0.e0
+            pt2dl(:,ijpj) = 0.e0
+         END SELECT
+         !
+      END SELECT
+      !
+   END SUBROUTINE mpp_lbc_nfd_2d
+
 END MODULE lbcnfd
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 4230)
@@ -22,5 +22,6 @@
    !!                          'mpp_lnk_bdy_2d' and 'mpp_lnk_obc_2d' routines and update
    !!                          the mppobc routine to optimize the BDY and OBC communications
-   !!            3.6  !  2013  ( C. Ethe, G. Madec ) message passing arrays as local variables 
+   !!            3.5  !  2013  ( C. Ethe, G. Madec ) message passing arrays as local variables 
+   !!            3.5  !  2013 (S.Mocavero, I.Epicoco - CMCC) north fold optimizations
    !!----------------------------------------------------------------------
 
@@ -151,10 +152,5 @@
    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE :: tampon  ! buffer in case of bsend
 
-   ! North fold arrays used to minimise the use of allgather operations. Set in nemo_northcomms (nemogcm) so need to be public
-   INTEGER, PUBLIC,  PARAMETER :: jpmaxngh = 8                 ! Assumed maximum number of active neighbours
-   INTEGER, PUBLIC,  PARAMETER :: jptyps   = 5                 ! Number of different neighbour lists to be used for northfold exchanges
-   INTEGER, PUBLIC,  DIMENSION (jpmaxngh,jptyps)    ::   isendto
-   INTEGER, PUBLIC,  DIMENSION (jptyps)             ::   nsndto
-   LOGICAL, PUBLIC                                  ::   ln_nnogather     = .FALSE.  ! namelist control of northfold comms
+   LOGICAL, PUBLIC                                  ::   ln_nnogather       ! namelist control of northfold comms
    LOGICAL, PUBLIC                                  ::   l_north_nogather = .FALSE.  ! internal control of northfold comms
    INTEGER, PUBLIC                                  ::   ityp
@@ -2592,10 +2588,10 @@
       CHARACTER(len=1)                , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
       !                                                              !   = T ,  U , V , F or W  gridpoints
-      REAL(wp)                        , INTENT(in   ) ::   psgn      ! = -1. the sign change across the north fold
+      REAL(wp)                        , INTENT(in   ) ::   psgn      ! = -1. the sign change across the north fold 
       !!                                                             ! =  1. , the sign is kept
-      INTEGER ::   ji, jj, jr
+      INTEGER ::   ji, jj, jr, jk
       INTEGER ::   ierr, itaille, ildi, ilei, iilb
       INTEGER ::   ijpj, ijpjm1, ij, iproc
-      INTEGER, DIMENSION (jpmaxngh)          ::   ml_req_nf          ! for mpi_isend when avoiding mpi_allgather
+      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
@@ -2604,82 +2600,88 @@
       REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE   :: znorthloc, zfoldwk      
       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE   :: znorthgloio
-
-      !!----------------------------------------------------------------------
-      !
-      ALLOCATE( ztab(jpiglo,4,jpk), znorthloc(jpi,4,jpk), zfoldwk(jpi,4,jpk), znorthgloio(jpi,4,jpk,jpni) )
+      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE   :: ztabl, ztabr
+
+      INTEGER :: istatus(mpi_status_size)
+      INTEGER :: iflag
+      !!----------------------------------------------------------------------
+      !
+      ALLOCATE( ztab(jpiglo,4,jpk) , znorthloc(jpi,4,jpk), zfoldwk(jpi,4,jpk), znorthgloio(jpi,4,jpk,jpni) )
+      ALLOCATE( ztabl(jpi,4,jpk), ztabr(jpi*jpmaxngh, 4, jpk) ) 
 
       ijpj   = 4
-      ityp = -1
       ijpjm1 = 3
-      ztab(:,:,:) = 0.e0
-      !
-      DO jj = nlcj - ijpj +1, nlcj          ! put in znorthloc the last 4 jlines of pt3d
-         ij = jj - nlcj + ijpj
-         znorthloc(:,ij,:) = pt3d(:,jj,:)
+      !
+      DO jk = 1, jpk
+         DO jj = nlcj - ijpj +1, nlcj          ! put in xnorthloc the last 4 jlines of pt3d
+            ij = jj - nlcj + ijpj
+            znorthloc(:,ij,jk) = pt3d(:,jj,jk)
+         END DO
       END DO
       !
       !                                     ! Build in procs of ncomm_north the znorthgloio
       itaille = jpi * jpk * ijpj
+
+
       IF ( l_north_nogather ) THEN
          !
-         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified
-         ! (in nemo_northcomms) as being  involved in this process' northern boundary exchange
-         !
-         DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array
-            ij = jj - nlcj + ijpj
-            DO ji = 1, nlci
-               ztab(ji+nimpp-1,ij,:) = pt3d(ji,jj,:)
+        ztabr(:,:,:) = 0
+        DO jk = 1, jpk
+           DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array
+              ij = jj - nlcj + ijpj
+              DO ji = 1, nlci
+                 ztabl(ji,ij,jk) = pt3d(ji,jj,jk)
+              END DO
+           END DO
+        END DO
+
+         DO jr = 1,nsndto
+            IF (isendto(jr) .ne. narea) CALL mppsend( 5, znorthloc, itaille, isendto(jr)-1, ml_req_nf(jr) )
+         END DO
+         DO jr = 1,nsndto
+            iproc = isendto(jr)
+            ildi = nldit (iproc)
+            ilei = nleit (iproc)
+            iilb = nimppt(isendto(jr)) - nimppt(isendto(1))
+            IF(isendto(jr) .ne. narea) THEN
+              CALL mpprecv(5, zfoldwk, itaille, isendto(jr)-1)
+              DO jk = 1, jpk
+                 DO jj = 1, ijpj
+                    DO ji = 1, ilei
+                       ztabr(iilb+ji,jj,jk) = zfoldwk(ji,jj,jk)
+                    END DO
+                 END DO
+              END DO
+           ELSE
+              DO jk = 1, jpk
+                 DO jj = 1, ijpj
+                    DO ji = 1, ilei
+                       ztabr(iilb+ji,jj,jk) = pt3d(ji,nlcj-ijpj+jj,jk)
+                    END DO
+                 END DO
+              END DO
+           ENDIF
+         END DO
+         IF (l_isend) THEN
+            DO jr = 1,nsndto
+               IF (isendto(jr) .ne. narea) CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
             END DO
-         END DO
-
-         !
-         ! Set the exchange type in order to access the correct list of active neighbours
-         !
-         SELECT CASE ( cd_type )
-            CASE ( 'T' , 'W' )
-               ityp = 1
-            CASE ( 'U' )
-               ityp = 2
-            CASE ( 'V' )
-               ityp = 3
-            CASE ( 'F' )
-               ityp = 4
-            CASE ( 'I' )
-               ityp = 5
-            CASE DEFAULT
-               ityp = -1                    ! Set a default value for unsupported types which
-                                            ! will cause a fallback to the mpi_allgather method
-         END SELECT
-         IF ( ityp .gt. 0 ) THEN
-
-            DO jr = 1,nsndto(ityp)
-               CALL mppsend(5, znorthloc, itaille, isendto(jr,ityp), ml_req_nf(jr) )
-            END DO
-            DO jr = 1,nsndto(ityp)
-               CALL mpprecv(5, zfoldwk, itaille, isendto(jr,ityp))
-               iproc = isendto(jr,ityp) + 1
-               ildi = nldit (iproc)
-               ilei = nleit (iproc)
-               iilb = nimppt(iproc)
-               DO jj = 1, ijpj
-                  DO ji = ildi, ilei
-                     ztab(ji+iilb-1,jj,:) = zfoldwk(ji,jj,:)
-                  END DO
+         ENDIF
+         CALL mpp_lbc_nfd( ztabl, ztabr_3d, cd_type, psgn )   ! North fold boundary condition
+         !
+         DO jk = 1, jpk
+            DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt3d
+               ij = jj - nlcj + ijpj
+               DO ji= 1, nlci
+                  pt3d(ji,jj,jk) = ztabl(ji,ij,jk)
                END DO
             END DO
-            IF (l_isend) THEN
-               DO jr = 1,nsndto(ityp)
-                  CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
-               END DO
-            ENDIF
-
-         ENDIF
-
-      ENDIF
-
-      IF ( ityp .lt. 0 ) THEN
+         END DO
+         !
+
+      ELSE
          CALL MPI_ALLGATHER( znorthloc  , itaille, MPI_DOUBLE_PRECISION,                &
             &                znorthgloio, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr )
          !
+         ztab(:,:,:) = 0.e0
          DO jr = 1, ndim_rank_north         ! recover the global north array
             iproc = nrank_north(jr) + 1
@@ -2687,10 +2689,23 @@
             ilei  = nleit (iproc)
             iilb  = nimppt(iproc)
-            DO jj = 1, ijpj
-               DO ji = ildi, ilei
-                  ztab(ji+iilb-1,jj,:) = znorthgloio(ji,jj,:,jr)
+            DO jk = 1, jpk
+               DO jj = 1, ijpj
+                  DO ji = ildi, ilei
+                    ztab(ji+iilb-1,jj,jk) = znorthgloio(ji,jj,jk,jr)
+                  END DO
                END DO
             END DO
          END DO
+         CALL lbc_nfd( ztab, cd_type, psgn )   ! North fold boundary condition
+         !
+         DO jk = 1, jpk
+            DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt3d
+               ij = jj - nlcj + ijpj
+               DO ji= 1, nlci
+                  pt3d(ji,jj,jk) = ztab(ji+nimpp-1,ij,jk)
+               END DO
+            END DO
+         END DO
+         !
       ENDIF
       !
@@ -2704,12 +2719,15 @@
       CALL lbc_nfd( ztab, cd_type, psgn )   ! North fold boundary condition
       !
-      DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt3d
-         ij = jj - nlcj + ijpj
-         DO ji= 1, nlci
-            pt3d(ji,jj,:) = ztab(ji+nimpp-1,ij,:)
-         END DO
+      DO jk = 1, jpk
+         DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt3d
+            ij = jj - nlcj + ijpj
+            DO ji= 1, nlci
+               pt3d(ji,jj,jk) = ztab(ji+nimpp-1,ij,jk)
+            END DO
+        END DO
       END DO
       !
       DEALLOCATE( ztab, znorthloc, zfoldwk, znorthgloio )
+      DEALLOCATE( ztabl, ztabr ) 
       !
    END SUBROUTINE mpp_lbc_north_3d
@@ -2730,13 +2748,13 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pt2d      ! 3D array on which the b.c. is applied
-      CHARACTER(len=1)            , INTENT(in   ) ::   cd_type   ! nature of pt3d grid-points
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pt2d      ! 2D array on which the b.c. is applied
+      CHARACTER(len=1)            , INTENT(in   ) ::   cd_type   ! nature of pt2d grid-points
       !                                                          !   = T ,  U , V , F or W  gridpoints
-      REAL(wp)                    , INTENT(in   ) ::   psgn      ! = -1. the sign change across the north fold
+      REAL(wp)                    , INTENT(in   ) ::   psgn      ! = -1. the sign change across the north fold 
       !!                                                             ! =  1. , the sign is kept
       INTEGER ::   ji, jj, jr
       INTEGER ::   ierr, itaille, ildi, ilei, iilb
       INTEGER ::   ijpj, ijpjm1, ij, iproc
-      INTEGER, DIMENSION (jpmaxngh)      ::   ml_req_nf          ! for mpi_isend when avoiding mpi_allgather
+      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
@@ -2745,12 +2763,14 @@
       REAL(wp), DIMENSION(:,:)  , ALLOCATABLE   :: znorthloc, zfoldwk      
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   :: znorthgloio
+      REAL(wp), DIMENSION(:,:)  , ALLOCATABLE   :: ztabl, ztabr
+      INTEGER :: istatus(mpi_status_size)
+      INTEGER :: iflag
       !!----------------------------------------------------------------------
       !
       ALLOCATE( ztab(jpiglo,4), znorthloc(jpi,4), zfoldwk(jpi,4), znorthgloio(jpi,4,jpni) )
+      ALLOCATE( ztabl(jpi,4), ztabr(jpi*jpmaxngh, 4) ) 
       !
       ijpj   = 4
-      ityp = -1
       ijpjm1 = 3
-      ztab(:,:) = 0.e0
       !
       DO jj = nlcj-ijpj+1, nlcj             ! put in znorthloc the last 4 jlines of pt2d
@@ -2763,64 +2783,57 @@
       IF ( l_north_nogather ) THEN
          !
-         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified
+         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified 
          ! (in nemo_northcomms) as being  involved in this process' northern boundary exchange
          !
+         ztabr(:,:) = 0
          DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array
             ij = jj - nlcj + ijpj
             DO ji = 1, nlci
-               ztab(ji+nimpp-1,ij) = pt2d(ji,jj)
+               ztabl(ji,ij) = pt2d(ji,jj)
             END DO
          END DO
 
-         !
-         ! Set the exchange type in order to access the correct list of active neighbours
-         !
-         SELECT CASE ( cd_type )
-            CASE ( 'T' , 'W' )
-               ityp = 1
-            CASE ( 'U' )
-               ityp = 2
-            CASE ( 'V' )
-               ityp = 3
-            CASE ( 'F' )
-               ityp = 4
-            CASE ( 'I' )
-               ityp = 5
-            CASE DEFAULT
-               ityp = -1                    ! Set a default value for unsupported types which
-                                            ! will cause a fallback to the mpi_allgather method
-         END SELECT
-
-         IF ( ityp .gt. 0 ) THEN
-
-            DO jr = 1,nsndto(ityp)
-               CALL mppsend(5, znorthloc, itaille, isendto(jr,ityp), ml_req_nf(jr) )
+         DO jr = 1,nsndto
+            IF (isendto(jr) .ne. narea) CALL mppsend(5, znorthloc, itaille, isendto(jr)-1, ml_req_nf(jr))
+         END DO
+         DO jr = 1,nsndto
+            iproc = isendto(jr)
+            ildi = nldit (iproc)
+            ilei = nleit (iproc)
+            iilb = nimppt(isendto(jr)) - nimppt(isendto(1))
+            IF(isendto(jr) .ne. narea) THEN
+              CALL mpprecv(5, zfoldwk, itaille, isendto(jr)-1)
+              DO jj = 1, ijpj
+                 DO ji = 1, ilei
+                    ztabr(iilb+ji,jj) = zfoldwk(ji,jj)
+                 END DO
+              END DO
+            ELSE
+              DO jj = 1, ijpj
+                 DO ji = 1, ilei
+                    ztabr(iilb+ji,jj) = pt2d(ji,nlcj-ijpj+jj)
+                 END DO
+              END DO
+            ENDIF
+         END DO
+         IF (l_isend) THEN
+            DO jr = 1,nsndto
+               IF (isendto(jr) .ne. narea) CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
             END DO
-            DO jr = 1,nsndto(ityp)
-               CALL mpprecv(5, zfoldwk, itaille, isendto(jr,ityp))
-               iproc = isendto(jr,ityp) + 1
-               ildi = nldit (iproc)
-               ilei = nleit (iproc)
-               iilb = nimppt(iproc)
-               DO jj = 1, ijpj
-                  DO ji = ildi, ilei
-                     ztab(ji+iilb-1,jj) = zfoldwk(ji,jj)
-                  END DO
-               END DO
+         ENDIF
+         CALL mpp_lbc_nfd( ztabl, ztabr, cd_type, psgn )   ! North fold boundary condition
+         !
+         DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt2d
+            ij = jj - nlcj + ijpj
+            DO ji = 1, nlci
+               pt2d(ji,jj) = ztabl(ji,ij)
             END DO
-            IF (l_isend) THEN
-               DO jr = 1,nsndto(ityp)
-                  CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err)
-               END DO
-            ENDIF
-
-         ENDIF
-
-      ENDIF
-
-      IF ( ityp .lt. 0 ) THEN
+         END DO
+         !
+      ELSE
          CALL MPI_ALLGATHER( znorthloc  , itaille, MPI_DOUBLE_PRECISION,        &
             &                znorthgloio, itaille, MPI_DOUBLE_PRECISION, ncomm_north, ierr )
          !
+         ztab(:,:) = 0.e0
          DO jr = 1, ndim_rank_north            ! recover the global north array
             iproc = nrank_north(jr) + 1
@@ -2834,24 +2847,16 @@
             END DO
          END DO
-      ENDIF
-      !
-      ! The ztab array has been either:
-      !  a. Fully populated by the mpi_allgather operation or
-      !  b. Had the active points for this domain and northern neighbours populated
-      !     by peer to peer exchanges
-      ! Either way the array may be folded by lbc_nfd and the result for the span of
-      ! this domain will be identical.
-      !
-      CALL lbc_nfd( ztab, cd_type, psgn )   ! North fold boundary condition
-      !
-      !
-      DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt2d
-         ij = jj - nlcj + ijpj
-         DO ji = 1, nlci
-            pt2d(ji,jj) = ztab(ji+nimpp-1,ij)
-         END DO
-      END DO
-      !
+         CALL lbc_nfd( ztab, cd_type, psgn )   ! North fold boundary condition
+         !
+         DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt2d
+            ij = jj - nlcj + ijpj
+            DO ji = 1, nlci
+               pt2d(ji,jj) = ztab(ji+nimpp-1,ij)
+            END DO
+         END DO
+         !
+      ENDIF
       DEALLOCATE( ztab, znorthloc, zfoldwk, znorthgloio )
+      DEALLOCATE( ztabl, ztabr ) 
       !
    END SUBROUTINE mpp_lbc_north_2d
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/cyclone.F90	(revision 4230)
@@ -98,7 +98,7 @@
          !
          ! (NB: frequency positive => hours, negative => months)
-         !          !    file     ! frequency !  variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
-         !          !    name     !  (hours)  !   name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
-         sn_tc = FLD_N( 'tc_track',     6     ,  'tc'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         )
+         !          !    file     ! frequency !  variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   ! land/sea mask !
+         !          !    name     !  (hours)  !   name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      ! filename      !
+         sn_tc = FLD_N( 'tc_track',     6     ,  'tc'     ,  .true.    , .false. ,   'yearly'  , ''       , ''         , ''            )
          !
          !  Namelist is read in namsbc_core
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 4230)
@@ -7,4 +7,6 @@
    !!                 !  05-2008  (S. Alderson) Modified for Interpolation in memory
    !!                 !                         from input grid to model grid
+   !!                 !  10-2013  (D. Delrosso, P. Oddo) implement suppression of 
+   !!                 !                         land point prior to interpolation
    !!----------------------------------------------------------------------
 
@@ -22,5 +24,6 @@
    USE wrk_nemo        ! work arrays
    USE ioipsl, ONLY :   ymds2ju, ju2ymds   ! for calendar
-
+   USE sbc_oce
+   
    IMPLICIT NONE
    PRIVATE   
@@ -40,4 +43,6 @@
       !                                     ! a string starting with "U" or "V" for each component   
       !                                     ! chars 2 onwards identify which components go together  
+      CHARACTER(len = 34)  ::   lname       ! generic name of a NetCDF land/sea mask file to be used, blank if not 
+      !                                     ! 0=sea 1=land
    END TYPE FLD_N
 
@@ -60,4 +65,5 @@
       LOGICAL, DIMENSION(2)           ::   rotn         ! flag to indicate whether before/after field has been rotated
       INTEGER                         ::   nreclast     ! last record to be read in the current file
+      CHARACTER(len = 256)            ::   lsmname      ! current name of the NetCDF mask file acting as a key
    END TYPE FLD
 
@@ -95,4 +101,5 @@
    TYPE( WGT ), DIMENSION(tot_wgts)   ::   ref_wgts     ! array of wgts
    INTEGER                            ::   nxt_wgt = 1  ! point to next available space in ref_wgts array
+   REAL(wp), PARAMETER                ::   undeff_lsm = -999.00_wp
 
 !$AGRIF_END_DO_NOT_TREAT
@@ -591,6 +598,8 @@
       ELSE IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN
          CALL wgt_list( sdjf, iw )
-         IF( sdjf%ln_tint ) THEN   ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
-         ELSE                      ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fnow(:,:,:  ), sdjf%nrec_a(1) )
+         IF( sdjf%ln_tint ) THEN   ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fdta(:,:,:,2), & 
+              & sdjf%nrec_a(1), sdjf%lsmname )
+         ELSE                      ;   CALL fld_interp( sdjf%num, sdjf%clvar, iw , ipk  , sdjf%fnow(:,:,:  ), &
+              & sdjf%nrec_a(1), sdjf%lsmname )
          ENDIF
       ELSE
@@ -856,4 +865,6 @@
          sdf(jf)%wgtname    = " "
          IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )   sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname )
+         sdf(jf)%lsmname = " "
+         IF( LEN( TRIM(sdf_n(jf)%lname) ) > 0 )   sdf(jf)%lsmname = TRIM( cdir )//TRIM( sdf_n(jf)%lname )
          sdf(jf)%vcomp      = sdf_n(jf)%vcomp
          sdf(jf)%rotn(:)    = .TRUE.   ! pretend to be rotated -> won't try to rotate data before the first call to fld_get
@@ -878,5 +889,6 @@
                &                          ' weights    : '    , TRIM( sdf(jf)%wgtname    ),   &
                &                          ' pairing    : '    , TRIM( sdf(jf)%vcomp      ),   &
-               &                          ' data type: '      ,       sdf(jf)%cltype
+               &                          ' data type: '      ,       sdf(jf)%cltype      ,   &
+               &                          ' land/sea mask:'   , TRIM( sdf(jf)%lsmname    )
             call flush(numout)
          END DO
@@ -1098,5 +1110,113 @@
 
 
-   SUBROUTINE fld_interp( num, clvar, kw, kk, dta, nrec )
+   SUBROUTINE apply_seaoverland(clmaskfile,zfieldo,jpi1_lsm,jpi2_lsm,jpj1_lsm, &
+                          &      jpj2_lsm,itmpi,itmpj,itmpz,rec1_lsm,recn_lsm)
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE apply_seaoverland  ***
+      !!
+      !! ** Purpose :   avoid spurious fluxes in coastal or near-coastal areas
+      !!                due to the wrong usage of "land" values from the coarse
+      !!                atmospheric model when spatial interpolation is required
+      !!      D. Delrosso INGV          
+      !!---------------------------------------------------------------------- 
+      INTEGER                                   :: inum,jni,jnj,jnz,jc                  ! temporary indices
+      INTEGER,                   INTENT(in)     :: itmpi,itmpj,itmpz                    ! lengths
+      INTEGER,                   INTENT(in)     :: jpi1_lsm,jpi2_lsm,jpj1_lsm,jpj2_lsm  ! temporary indices
+      INTEGER, DIMENSION(3),     INTENT(in)     :: rec1_lsm,recn_lsm                    ! temporary arrays for start and length
+      REAL(wp),DIMENSION (:,:,:),INTENT(inout)  :: zfieldo                              ! input/output array for seaoverland application
+      REAL(wp),DIMENSION (:,:,:),ALLOCATABLE    :: zslmec1                              ! temporary array for land point detection
+      REAL(wp),DIMENSION (:,:),  ALLOCATABLE    :: zfieldn                              ! array of forcing field with undeff for land points
+      REAL(wp),DIMENSION (:,:),  ALLOCATABLE    :: zfield                               ! array of forcing field
+      CHARACTER (len=100),       INTENT(in)     :: clmaskfile                           ! land/sea mask file name
+      !!---------------------------------------------------------------------
+      ALLOCATE ( zslmec1(itmpi,itmpj,itmpz) )
+      ALLOCATE ( zfieldn(itmpi,itmpj) )
+      ALLOCATE ( zfield(itmpi,itmpj) )
+
+      ! Retrieve the land sea mask data
+      CALL iom_open( clmaskfile, inum )
+      SELECT CASE( SIZE(zfieldo(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),3) )
+      CASE(1)
+           CALL iom_get( inum, jpdom_unknown, 'LSM', zslmec1(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,1), 1, rec1_lsm, recn_lsm)
+      CASE DEFAULT
+           CALL iom_get( inum, jpdom_unknown, 'LSM', zslmec1(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:), 1, rec1_lsm, recn_lsm)
+      END SELECT
+      CALL iom_close( inum )
+
+      DO jnz=1,rec1_lsm(3)                            !! Loop over k dimension
+
+         DO jni=1,itmpi                               !! copy the original field into a tmp array
+            DO jnj=1,itmpj                            !! substituting undeff over land points
+            zfieldn(jni,jnj) = zfieldo(jni,jnj,jnz)
+               IF ( zslmec1(jni,jnj,jnz) == 1. ) THEN
+                  zfieldn(jni,jnj) = undeff_lsm
+               ENDIF
+            END DO
+         END DO
+  
+      CALL seaoverland(zfieldn,itmpi,itmpj,zfield)
+      DO jc=1,nn_lsm
+         CALL seaoverland(zfield,itmpi,itmpj,zfield)
+      END DO
+
+      !   Check for Undeff and substitute original values
+      IF(ANY(zfield==undeff_lsm)) THEN
+         DO jni=1,itmpi
+            DO jnj=1,itmpj
+               IF (zfield(jni,jnj)==undeff_lsm) THEN
+                  zfield(jni,jnj) = zfieldo(jni,jnj,jnz)
+               ENDIF
+            ENDDO
+         ENDDO
+      ENDIF
+
+      zfieldo(:,:,jnz)=zfield(:,:)
+
+      END DO                          !! End Loop over k dimension
+
+      DEALLOCATE ( zslmec1 )
+      DEALLOCATE ( zfieldn )
+      DEALLOCATE ( zfield )
+
+   END SUBROUTINE apply_seaoverland 
+
+
+   SUBROUTINE seaoverland(zfieldn,ileni,ilenj,zfield)
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE seaoverland  ***
+      !!
+      !! ** Purpose :   create shifted matrices for seaoverland application  
+      !!      D. Delrosso INGV
+      !!---------------------------------------------------------------------- 
+      INTEGER,INTENT(in)                       :: ileni,ilenj              ! lengths 
+      REAL,DIMENSION (ileni,ilenj),INTENT(in)  :: zfieldn                  ! array of forcing field with undeff for land points
+      REAL,DIMENSION (ileni,ilenj),INTENT(out) :: zfield                   ! array of forcing field
+      REAL,DIMENSION (ileni,ilenj)             :: zmat1,zmat2,zmat3,zmat4  ! temporary arrays for seaoverland application
+      REAL,DIMENSION (ileni,ilenj)             :: zmat5,zmat6,zmat7,zmat8  ! temporary arrays for seaoverland application
+      REAL,DIMENSION (ileni,ilenj)             :: zlsm2d                   ! temporary arrays for seaoverland application
+      REAL,DIMENSION (ileni,ilenj,8)           :: zlsm3d                   ! temporary arrays for seaoverland application
+      LOGICAL,DIMENSION (ileni,ilenj,8)        :: ll_msknan3d              ! logical mask for undeff detection
+      LOGICAL,DIMENSION (ileni,ilenj)          :: ll_msknan2d              ! logical mask for undeff detection
+      !!---------------------------------------------------------------------- 
+      zmat8 = eoshift(zfieldn   ,  SHIFT=-1, BOUNDARY = (/zfieldn(:,1)/)    ,DIM=2)
+      zmat1 = eoshift(zmat8     ,  SHIFT=-1, BOUNDARY = (/zmat8(1,:)/)      ,DIM=1)
+      zmat2 = eoshift(zfieldn   ,  SHIFT=-1, BOUNDARY = (/zfieldn(1,:)/)    ,DIM=1)
+      zmat4 = eoshift(zfieldn   ,  SHIFT= 1, BOUNDARY = (/zfieldn(:,ilenj)/),DIM=2)
+      zmat3 = eoshift(zmat4     ,  SHIFT=-1, BOUNDARY = (/zmat4(1,:)/)      ,DIM=1)
+      zmat5 = eoshift(zmat4     ,  SHIFT= 1, BOUNDARY = (/zmat4(ileni,:)/)  ,DIM=1)
+      zmat6 = eoshift(zfieldn   ,  SHIFT= 1, BOUNDARY = (/zfieldn(ileni,:)/),DIM=1)
+      zmat7 = eoshift(zmat8     ,  SHIFT= 1, BOUNDARY = (/zmat8(ileni,:)/)  ,DIM=1)
+
+      zlsm3d  = RESHAPE( (/ zmat1, zmat2, zmat3, zmat4, zmat5, zmat6, zmat7, zmat8 /), (/ ileni, ilenj, 8 /))
+      ll_msknan3d = .not.(zlsm3d==undeff_lsm)
+      ll_msknan2d = .not.(zfieldn==undeff_lsm)  ! FALSE where is Undeff (land)
+      zlsm2d = (SUM ( zlsm3d, 3 , ll_msknan3d ) )/(MAX(1,(COUNT( ll_msknan3d , 3 ))   ))
+      WHERE ((COUNT( ll_msknan3d , 3 )) == 0.0_wp)  zlsm2d = undeff_lsm
+      zfield = MERGE (zfieldn,zlsm2d,ll_msknan2d)
+   END SUBROUTINE seaoverland
+
+
+   SUBROUTINE fld_interp( num, clvar, kw, kk, dta,  &
+                          &         nrec, lsmfile)      
       !!---------------------------------------------------------------------
       !!                    ***  ROUTINE fld_interp  ***
@@ -1111,11 +1231,20 @@
       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   dta     ! output field on model grid
       INTEGER                   , INTENT(in   ) ::   nrec    ! record number to read (ie time slice)
+      CHARACTER(LEN=*)          , INTENT(in   ) ::   lsmfile ! land sea mask file name
       !! 
-      INTEGER, DIMENSION(3) ::   rec1,recn   ! temporary arrays for start and length
-      INTEGER ::  jk, jn, jm           ! loop counters
-      INTEGER ::  ni, nj               ! lengths
-      INTEGER ::  jpimin,jpiwid        ! temporary indices
-      INTEGER ::  jpjmin,jpjwid        ! temporary indices
-      INTEGER ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
+      REAL(wp),DIMENSION(:,:,:),ALLOCATABLE     ::   ztmp_fly_dta,zfieldo                  ! temporary array of values on input grid
+      INTEGER, DIMENSION(3)                     ::   rec1,recn                             ! temporary arrays for start and length
+      INTEGER, DIMENSION(3)                     ::   rec1_lsm,recn_lsm                     ! temporary arrays for start and length in case of seaoverland
+      INTEGER                                   ::   ii_lsm1,ii_lsm2,ij_lsm1,ij_lsm2       ! temporary indices
+      INTEGER                                   ::   jk, jn, jm, jir, jjr                  ! loop counters
+      INTEGER                                   ::   ni, nj                                ! lengths
+      INTEGER                                   ::   jpimin,jpiwid                         ! temporary indices
+      INTEGER                                   ::   jpimin_lsm,jpiwid_lsm                 ! temporary indices
+      INTEGER                                   ::   jpjmin,jpjwid                         ! temporary indices
+      INTEGER                                   ::   jpjmin_lsm,jpjwid_lsm                 ! temporary indices
+      INTEGER                                   ::   jpi1,jpi2,jpj1,jpj2                   ! temporary indices
+      INTEGER                                   ::   jpi1_lsm,jpi2_lsm,jpj1_lsm,jpj2_lsm   ! temporary indices
+      INTEGER                                   ::   itmpi,itmpj,itmpz                     ! lengths
+      
       !!----------------------------------------------------------------------
       !
@@ -1147,11 +1276,66 @@
       jpj2 = jpj1 + recn(2) - 1
 
-      ref_wgts(kw)%fly_dta(:,:,:) = 0.0
-      SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) )
-      CASE(1)
-           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn)
-      CASE DEFAULT
-           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn)
-      END SELECT 
+
+      IF( LEN( TRIM(lsmfile) ) > 0 ) THEN
+      !! indeces for ztmp_fly_dta
+      ! --------------------------
+         rec1_lsm(1)=MAX(rec1(1)-nn_lsm,1)  ! starting index for enlarged external data, x direction
+         rec1_lsm(2)=MAX(rec1(2)-nn_lsm,1)  ! starting index for enlarged external data, y direction
+         rec1_lsm(3) = 1                    ! vertical dimension
+         recn_lsm(1)=MIN(rec1(1)-rec1_lsm(1)+recn(1)+nn_lsm,ref_wgts(kw)%ddims(1)-rec1_lsm(1)) ! n points in x direction
+         recn_lsm(2)=MIN(rec1(2)-rec1_lsm(2)+recn(2)+nn_lsm,ref_wgts(kw)%ddims(2)-rec1_lsm(2)) ! n points in y direction
+         recn_lsm(3) = kk                   ! number of vertical levels in the input file
+
+      !  Avoid out of bound
+         jpimin_lsm = MAX( rec1_lsm(1)+1, 1 )
+         jpjmin_lsm = MAX( rec1_lsm(2)+1, 1 )
+         jpiwid_lsm = MIN( recn_lsm(1)-2,ref_wgts(kw)%ddims(1)-rec1(1)+1)
+         jpjwid_lsm = MIN( recn_lsm(2)-2,ref_wgts(kw)%ddims(2)-rec1(2)+1)
+
+         jpi1_lsm = 2+rec1_lsm(1)-jpimin_lsm
+         jpj1_lsm = 2+rec1_lsm(2)-jpjmin_lsm
+         jpi2_lsm = jpi1_lsm + recn_lsm(1) - 1
+         jpj2_lsm = jpj1_lsm + recn_lsm(2) - 1
+
+
+         itmpi=SIZE(ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),1)
+         itmpj=SIZE(ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),2)
+         itmpz=kk
+         ALLOCATE(ztmp_fly_dta(itmpi,itmpj,itmpz))
+         ztmp_fly_dta(:,:,:) = 0.0
+         SELECT CASE( SIZE(ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),3) )
+         CASE(1)
+              CALL iom_get( num, jpdom_unknown, clvar, ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,1),   &
+                 &                                                                nrec, rec1_lsm, recn_lsm)
+         CASE DEFAULT
+              CALL iom_get( num, jpdom_unknown, clvar, ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),   &
+                 &                                                                nrec, rec1_lsm, recn_lsm)
+         END SELECT
+         CALL apply_seaoverland(lsmfile,ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),                  &
+                 &                                      jpi1_lsm,jpi2_lsm,jpj1_lsm,jpj2_lsm,                  &
+                 &                                      itmpi,itmpj,itmpz,rec1_lsm,recn_lsm)
+
+
+         ! Relative indeces for remapping
+         ii_lsm1 = (rec1(1)-rec1_lsm(1))+1
+         ii_lsm2 = (ii_lsm1+recn(1))-1
+         ij_lsm1 = (rec1(2)-rec1_lsm(2))+1
+         ij_lsm2 = (ij_lsm1+recn(2))-1
+
+         ref_wgts(kw)%fly_dta(:,:,:) = 0.0
+         ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:) = ztmp_fly_dta(ii_lsm1:ii_lsm2,ij_lsm1:ij_lsm2,:)
+         DEALLOCATE(ztmp_fly_dta)
+
+      ELSE
+         
+         ref_wgts(kw)%fly_dta(:,:,:) = 0.0
+         SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) )
+         CASE(1)
+              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn)
+         CASE DEFAULT
+              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn)
+         END SELECT 
+      ENDIF
+      
 
       !! first four weights common to both bilinear and bicubic
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 4230)
@@ -37,5 +37,5 @@
    LOGICAL , PUBLIC ::   ln_cpl         !: coupled   formulation (overwritten by key_sbc_coupled )
    LOGICAL , PUBLIC ::   ln_dm2dc       !: Daily mean to Diurnal Cycle short wave (qsr)
-   LOGICAL , PUBLIC ::   ln_rnf      = .FALSE.   !: runoffs / runoff mouths
+   LOGICAL , PUBLIC ::   ln_rnf         !: runoffs / runoff mouths
    LOGICAL , PUBLIC ::   ln_ssr         !: Sea Surface restoring on SST and/or SSS      
    LOGICAL , PUBLIC ::   ln_apr_dyn     !: Atmospheric pressure forcing used on dynamics (ocean & ice)
@@ -55,8 +55,9 @@
    LOGICAL , PUBLIC ::   ln_icebergs    !: Icebergs
    !
-   CHARACTER (len=8), PUBLIC :: cn_iceflx = 'none' !: Flux handling over ice categories
-   LOGICAL, PUBLIC :: ln_iceflx_ave    = .FALSE. ! Average heat fluxes over all ice categories
-   LOGICAL, PUBLIC :: ln_iceflx_linear = .FALSE. ! Redistribute mean heat fluxes over all ice categories, using ice temperature and albedo
+   CHARACTER (len=8), PUBLIC :: cn_iceflx  !: Flux handling over ice categories
+   LOGICAL, PUBLIC :: ln_iceflx_ave     ! Average heat fluxes over all ice categories
+   LOGICAL, PUBLIC :: ln_iceflx_linear  ! Redistribute mean heat fluxes over all ice categories, using ice temperature and albedo
    !
+   INTEGER , PUBLIC ::   nn_lsm        !: Number of iteration if seaoverland is applied
    !!----------------------------------------------------------------------
    !!              Ocean Surface Boundary Condition fields
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 4230)
@@ -76,6 +76,5 @@
       !                                         ! -------------------- !
       IF( kt == nit000 ) THEN                   ! First call kt=nit000 !
-      !                                         ! -------------------- !
-
+         !                                      ! -------------------- !
          REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
          READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 4230)
@@ -141,5 +141,4 @@
          !                                      ! ====================== !
          !
-
          REWIND( numnam_ref )              ! Namelist namsbc_core in reference namelist : CORE bulk parameters
          READ  ( numnam_ref, namsbc_core, IOSTAT = ios, ERR = 901)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 4230)
@@ -734,4 +734,5 @@
          &                          sn_top1, sn_top2, sn_top3, sn_top4, sn_top5,  &
          &                          sn_bot1, sn_bot2, sn_bot3, sn_bot4, sn_bot5
+      INTEGER :: ios
       !!---------------------------------------------------------------------
 
@@ -739,33 +740,12 @@
       IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
          !                                      ! ====================== !
-         ! set file information (default values)
-         cn_dir = './'       ! directory in which the model is executed
-
-         ! (NB: frequency positive => hours, negative => months)
-         !            !    file          ! frequency !  variable    ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
-         !            !    name          !  (hours)  !   name       !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
-         sn_snow = FLD_N( 'snowfall_1m'  ,    -1.    ,  'snowfall'  ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         ) 
-         sn_rain = FLD_N( 'rainfall_1m'  ,    -1.    ,  'rainfall'  ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         ) 
-         sn_sblm = FLD_N( 'sublim_1m'    ,    -1.    ,  'sublim'    ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top1 = FLD_N( 'topmeltn1_1m' ,    -1.    ,  'topmeltn1' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top2 = FLD_N( 'topmeltn2_1m' ,    -1.    ,  'topmeltn2' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top3 = FLD_N( 'topmeltn3_1m' ,    -1.    ,  'topmeltn3' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top4 = FLD_N( 'topmeltn4_1m' ,    -1.    ,  'topmeltn4' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_top5 = FLD_N( 'topmeltn5_1m' ,    -1.    ,  'topmeltn5' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot1 = FLD_N( 'botmeltn1_1m' ,    -1.    ,  'botmeltn1' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot2 = FLD_N( 'botmeltn2_1m' ,    -1.    ,  'botmeltn2' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot3 = FLD_N( 'botmeltn3_1m' ,    -1.    ,  'botmeltn3' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot4 = FLD_N( 'botmeltn4_1m' ,    -1.    ,  'botmeltn4' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-         sn_bot5 = FLD_N( 'botmeltn5_1m' ,    -1.    ,  'botmeltn5' ,  .true.    , .true.  ,  ' yearly'  , ''       , ''         )
-
-! ... at some point might read in from NEMO namelist?
-!!$      REWIND( numnam_ref )              ! Namelist namsbc_cice in reference namelist : 
-!!$      READ  ( numnam_ref, namsbc_cice, IOSTAT = ios, ERR = 901)
-!!$901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in reference namelist', lwp )
-!!$
-!!$      REWIND( numnam_cfg )              ! Namelist namsbc_cice in configuration namelist : Parameters of the run
-!!$      READ  ( numnam_cfg, namsbc_cice, IOSTAT = ios, ERR = 902 )
-!!$902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist', lwp )
-!!$      WRITE ( numond, namsbc_cice )
+         REWIND( numnam_ref )              ! Namelist namsbc_cice in reference namelist : 
+         READ  ( numnam_ref, namsbc_cice, IOSTAT = ios, ERR = 901)
+901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in reference namelist', lwp )
+
+         REWIND( numnam_cfg )              ! Namelist namsbc_cice in configuration namelist : Parameters of the run
+         READ  ( numnam_cfg, namsbc_cice, IOSTAT = ios, ERR = 902 )
+902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cice in configuration namelist', lwp )
+         WRITE ( numond, namsbc_cice )
 
          ! store namelist information in an array
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 4230)
@@ -84,5 +84,5 @@
       NAMELIST/namsbc/ nn_fsbc   , ln_ana    , ln_flx,  ln_blk_clio, ln_blk_core, ln_cpl,   &
          &             ln_blk_mfs, ln_apr_dyn, nn_ice,  nn_ice_embd, ln_dm2dc   , ln_rnf,   &
-         &             ln_ssr    , nn_fwb    , ln_cdgw , ln_wave , ln_sdw, cn_iceflx
+         &             ln_ssr    , nn_fwb    , ln_cdgw , ln_wave , ln_sdw, nn_lsm, cn_iceflx
       INTEGER  ::   ios
       !!----------------------------------------------------------------------
@@ -134,4 +134,5 @@
          WRITE(numout,*) '              FreshWater Budget control  (=0/1/2)        nn_fwb      = ', nn_fwb
          WRITE(numout,*) '              closed sea (=0/1) (set in namdom)          nn_closea   = ', nn_closea
+         WRITE(numout,*) '              n. of iterations if land-sea-mask applied  nn_lsm      = ', nn_lsm
       ENDIF
 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 4230)
@@ -83,5 +83,4 @@
       IF( kt == nit000 ) THEN                   ! First call kt=nit000 !
          !                                      ! -------------------- !
-         
          REWIND( numnam_ref )              ! Namelist namsbc_wave in reference namelist : File for drag coeff. from wave model
          READ  ( numnam_ref, namsbc_wave, IOSTAT = ios, ERR = 901)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 4230)
@@ -104,11 +104,11 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~'
          !
-         rbcp = 0.25 * (1. + atfp) * (1. + atfp) * ( 1. - atfp)      ! Brown & Campana parameter for semi-implicit hpg
+         rbcp = 0.25_wp * (1._wp + atfp) * (1._wp + atfp) * ( 1._wp - atfp)      ! Brown & Campana parameter for semi-implicit hpg
       ENDIF
 
       ! Update after tracer on domain lateral boundaries
       ! 
-      CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1. )      ! local domain boundaries  (T-point, unchanged sign)
-      CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1. )
+      CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1._wp )      ! local domain boundaries  (T-point, unchanged sign)
+      CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1._wp )
       !
 #if defined key_obc 
@@ -124,5 +124,5 @@
       ! set time step size (Euler/Leapfrog)
       IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dtra(:) =     rdttra(:)      ! at nit000             (Euler)
-      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dtra(:) = 2.* rdttra(:)      ! at nit000 or nit000+1 (Leapfrog)
+      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dtra(:) = 2._wp* rdttra(:)      ! at nit000 or nit000+1 (Leapfrog)
       ENDIF
 
@@ -155,5 +155,5 @@
       IF( l_trdtra ) THEN      ! trend of the Asselin filter (tb filtered - tb)/dt     
          DO jk = 1, jpkm1
-            zfact = 1.e0 / r2dtra(jk)             
+            zfact = 1.e0_wp / r2dtra(jk)             
             ztrdt(:,:,jk) = ( tsb(:,:,jk,jp_tem) - ztrdt(:,:,jk) ) * zfact
             ztrds(:,:,jk) = ( tsb(:,:,jk,jp_sal) - ztrds(:,:,jk) ) * zfact
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4230)
@@ -86,4 +86,5 @@
    USE sbctide, ONLY: lk_tide
    USE crsini          ! initialise grid coarsening utility
+   USE lbcnfd, ONLY: isendto, nsndto ! Setup of north fold exchanges 
 
    IMPLICIT NONE
@@ -755,5 +756,6 @@
       !!======================================================================
       !!                     ***  ROUTINE  nemo_northcomms  ***
-      !! nemo_northcomms    :  Setup for north fold exchanges with explicit peer to peer messaging
+      !! nemo_northcomms    :  Setup for north fold exchanges with explicit 
+      !!                       point-to-point messaging
       !!=====================================================================
       !!----------------------------------------------------------------------
@@ -762,130 +764,49 @@
       !!----------------------------------------------------------------------
       !!    1.0  ! 2011-10  (A. C. Coward, NOCS & J. Donners, PRACE)
-      !!----------------------------------------------------------------------
-
-      INTEGER ::   ji, jj, jk, ij, jtyp    ! dummy loop indices
-      INTEGER ::   ijpj                    ! number of rows involved in north-fold exchange
-      INTEGER ::   northcomms_alloc        ! allocate return status
-      REAL(wp), ALLOCATABLE, DIMENSION ( :,: ) ::   znnbrs     ! workspace
-      LOGICAL,  ALLOCATABLE, DIMENSION ( : )   ::   lrankset   ! workspace
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'nemo_northcomms : Initialization of the northern neighbours lists'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
-
-      !!----------------------------------------------------------------------
-      ALLOCATE( znnbrs(jpi,jpj), stat = northcomms_alloc )
-      ALLOCATE( lrankset(jpnij), stat = northcomms_alloc )
-      IF( northcomms_alloc /= 0 ) THEN
-         WRITE(numout,cform_war)
-         WRITE(numout,*) 'northcomms_alloc : failed to allocate arrays'
-         CALL ctl_stop( 'STOP', 'nemo_northcomms : unable to allocate temporary arrays' )
-      ENDIF
+      !!    2.0  ! 2013-06 Setup avoiding MPI communication (I. Epicoco, S. Mocavero, CMCC) 
+      !!----------------------------------------------------------------------
+
+      INTEGER  ::   sxM, dxM, sxT, dxT, jn
+      INTEGER  ::   njmppmax
+
+      njmppmax = MAXVAL( njmppt )
+    
+      !initializes the north-fold communication variables
+      isendto(:) = 0
       nsndto = 0
-      isendto = -1
-      ijpj   = 4
-      !
-      ! This routine has been called because ln_nnogather has been set true ( nammpp )
-      ! However, these first few exchanges have to use the mpi_allgather method to
-      ! establish the neighbour lists to use in subsequent peer to peer exchanges.
-      ! Consequently, set l_north_nogather to be false here and set it true only after
-      ! the lists have been established.
-      !
-      l_north_nogather = .FALSE.
-      !
-      ! Exchange and store ranks on northern rows
-
-      DO jtyp = 1,4
-
-         lrankset = .FALSE.
-         znnbrs = narea
-         SELECT CASE (jtyp)
-            CASE(1)
-               CALL lbc_lnk( znnbrs, 'T', 1. )      ! Type 1: T,W-points
-            CASE(2)
-               CALL lbc_lnk( znnbrs, 'U', 1. )      ! Type 2: U-point
-            CASE(3)
-               CALL lbc_lnk( znnbrs, 'V', 1. )      ! Type 3: V-point
-            CASE(4)
-               CALL lbc_lnk( znnbrs, 'F', 1. )      ! Type 4: F-point
-         END SELECT
-
-         IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN
-            DO jj = nlcj-ijpj+1, nlcj
-               ij = jj - nlcj + ijpj
-               DO ji = 1,jpi
-                  IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) &
-               &     lrankset(INT(znnbrs(ji,jj))) = .true.
-               END DO
-            END DO
-
-            DO jj = 1,jpnij
-               IF ( lrankset(jj) ) THEN
-                  nsndto(jtyp) = nsndto(jtyp) + 1
-                  IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN
-                     CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', &
-                  &                 ' jpmaxngh will need to be increased ')
-                  ENDIF
-                  isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank
-               ENDIF
-            END DO
-         ENDIF
-
-      END DO
-
-      !
-      ! Type 5: I-point
-      !
-      ! ICE point exchanges may involve some averaging. The neighbours list is
-      ! built up using two exchanges to ensure that the whole stencil is covered.
-      ! lrankset should not be reset between these 'J' and 'K' point exchanges
-
-      jtyp = 5
-      lrankset = .FALSE.
-      znnbrs = narea
-      CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point
-
-      IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN
-         DO jj = nlcj-ijpj+1, nlcj
-            ij = jj - nlcj + ijpj
-            DO ji = 1,jpi
-               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) &
-            &     lrankset(INT(znnbrs(ji,jj))) = .true.
-         END DO
-        END DO
-      ENDIF
-
-      znnbrs = narea
-      CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point
-
-      IF ( njmppt(narea) .EQ. MAXVAL( njmppt )) THEN
-         DO jj = nlcj-ijpj+1, nlcj
-            ij = jj - nlcj + ijpj
-            DO ji = 1,jpi
-               IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND.  INT(znnbrs(ji,jj)) .NE. narea ) &
-            &       lrankset( INT(znnbrs(ji,jj))) = .true.
-            END DO
-         END DO
-
-         DO jj = 1,jpnij
-            IF ( lrankset(jj) ) THEN
-               nsndto(jtyp) = nsndto(jtyp) + 1
-               IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN
-                  CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', &
-               &                 ' jpmaxngh will need to be increased ')
-               ENDIF
-               isendto(nsndto(jtyp),jtyp) = jj-1   ! narea converted to MPI rank
-            ENDIF
-         END DO
-         !
-         ! For northern row areas, set l_north_nogather so that all subsequent exchanges
-         ! can use peer to peer communications at the north fold
-         !
-         l_north_nogather = .TRUE.
-         !
-      ENDIF
-      DEALLOCATE( znnbrs )
-      DEALLOCATE( lrankset )
-
+
+      !if I am a process in the north
+      IF ( njmpp == njmppmax ) THEN
+          !sxM is the first point (in the global domain) needed to compute the
+          !north-fold for the current process
+          sxM = jpiglo - nimppt(narea) - nlcit(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
+
+          !loop over the other north-fold processes to find the processes
+          !managing the points belonging to the sxT-dxT range
+          DO jn = jpnij - jpni +1, jpnij
+             IF ( njmppt(jn) == njmppmax ) THEN
+                !sxT is the first point (in the global domain) of the jn
+                !process
+                sxT = nimppt(jn)
+                !dxT is the last point (in the global domain) of the jn
+                !process
+                dxT = nimppt(jn) + nlcit(jn) - 1
+                IF ((sxM .gt. sxT) .AND. (sxM .lt. dxT)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                ELSEIF ((sxM .le. sxT) .AND. (dxM .gt. dxT)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                ELSEIF ((dxM .lt. dxT) .AND. (sxT .lt. dxM)) THEN
+                   nsndto = nsndto + 1
+                   isendto(nsndto) = jn
+                END IF
+             END IF
+          END DO
+      ENDIF
+      l_north_nogather = .TRUE.
    END SUBROUTINE nemo_northcomms
 #else
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4230)
@@ -193,4 +193,7 @@
                              tsa(:,:,:,:) = 0.e0            ! set tracer trends to zero
 
+!write(numout,*) "MAV kt",kstp
+!write(numout,'(a5,3(1x,f21.18))') "INIn:",tsn(24,11,1,jp_tem),tsn(24,11,1,jp_sal),sshn(24,11)
+!write(numout,'(a5,3(1x,f21.18))') "INIa:",tsa(24,11,1,jp_tem),tsa(24,11,1,jp_sal),ssha(24,11)
       IF(  ln_asmiau .AND. &
          & ln_trainc     )   CALL tra_asm_inc( kstp )       ! apply tracer assimilation increment
@@ -202,10 +205,18 @@
       IF( lk_bdy         )   CALL bdy_tra_dmp( kstp )       ! bdy damping trends
                              CALL tra_adv    ( kstp )       ! horizontal & vertical advection
+!write(numout,'(a5,3(1x,f21.18))') "ADVn:",tsn(24,11,1,jp_tem),tsn(24,11,1,jp_sal),sshn(24,11)
+!write(numout,'(a5,3(1x,f21.18))') "ADVa:",tsa(24,11,1,jp_tem),tsa(24,11,1,jp_sal),ssha(24,11)
       IF( lk_zdfkpp      )   CALL tra_kpp    ( kstp )       ! KPP non-local tracer fluxes
                              CALL tra_ldf    ( kstp )       ! lateral mixing
+!write(numout,'(a5,3(1x,f21.18))') "LDFn:",tsn(24,11,1,jp_tem),tsn(24,11,1,jp_sal),sshn(24,11)
+!write(numout,'(a5,3(1x,f21.18))') "LDFa:",tsa(24,11,1,jp_tem),tsa(24,11,1,jp_sal),ssha(24,11)
 #if defined key_agrif
       IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra          ! tracers sponge
 #endif
                              CALL tra_zdf    ( kstp )       ! vertical mixing and after tracer fields
+!do jk=1,jpk
+!write(numout,'(a5,3(1x,f21.18))') "ZDFn:",tsn(5,10,jk,jp_tem),tsn(5,10,jk,jp_sal),tmask(5,10,jk)
+!write(numout,'(a5,3(1x,f21.18))') "ZDFa:",tsa(5,10,jk,jp_tem),tsa(5,10,jk,jp_sal),ssha(5,10)
+!end do
 
       IF( ln_dynhpg_imp  ) THEN                             ! semi-implicit hpg (time stepping then eos)
@@ -220,6 +231,10 @@
          IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsn, gtsu, gtsv,  &    ! zps: now hor. derivative
             &                                          rhd, gru , grv  )      ! of t, s, rd at the last ocean level
+!write(numout,'(a5,3(1x,f21.18))') "ZPSn:",tsn(24,11,1,jp_tem),tsn(24,11,1,jp_sal),sshn(24,11)
+!write(numout,'(a5,3(1x,f21.18))') "ZPSa:",tsa(24,11,1,jp_tem),tsa(24,11,1,jp_sal),ssha(24,11)
          IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection
                              CALL tra_nxt( kstp )                ! tracer fields at next time step
+!write(numout,'(a5,3(1x,f21.18))') "NXTn:",tsn(24,11,1,jp_tem),tsn(24,11,1,jp_sal),sshn(25,11)
+!write(numout,'(a5,3(1x,f21.18))') "NXTa:",tsa(24,11,1,jp_tem),tsa(24,11,1,jp_sal),ssha(24,11)
       ENDIF
 
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 4230)
@@ -318,5 +318,4 @@
       !                                         ! ----------------------- !
       IF( kt == nit000 ) THEN                   ! First call kt=nittrc000 !
-         !                                      ! ----------------------- !
 
          REWIND( numnatp_ref )              ! Namelist nampisatm in reference namelist : Pisces atm. sea level pressure file
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 4230)
@@ -210,5 +210,4 @@
       !
       !                            !* set file information
-
       REWIND( numnatp_ref )              ! Namelist nampissbc in reference namelist : Pisces external sources of nutrients
       READ  ( numnatp_ref, nampissbc, IOSTAT = ios, ERR = 901)
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 4230)
@@ -84,5 +84,5 @@
       CHARACTER (len=22) :: charout
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrd
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta   ! 4D  workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace
       !!----------------------------------------------------------------------
       !
@@ -97,6 +97,5 @@
       IF( nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
          !
-         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
-         CALL trc_dta( kt, ztrcdta )   ! read tracer data at nit000
+         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation
          !                                                          ! ===========
          DO jn = 1, jptra                                           ! tracer loop
@@ -107,4 +106,6 @@
                
                jl = n_trc_index(jn) 
+               CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000
+               ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:)
 
                SELECT CASE ( nn_zdmp_tr )
@@ -114,5 +115,5 @@
                      DO jj = 2, jpjm1
                         DO ji = fs_2, fs_jpim1   ! vector opt.
-                           ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) - trb(ji,jj,jk,jn) )
+                           ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
                            tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                         END DO
@@ -125,5 +126,5 @@
                         DO ji = fs_2, fs_jpim1   ! vector opt.
                            IF( avt(ji,jj,jk) <= 5.e-4 )  THEN 
-                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) - trb(ji,jj,jk,jn) )
+                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                            ENDIF
@@ -137,5 +138,5 @@
                         DO ji = fs_2, fs_jpim1   ! vector opt.
                            IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN
-                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk,jl) - trb(ji,jj,jk,jn) )
+                              ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
                            END IF
@@ -155,5 +156,5 @@
          END DO                                                     ! tracer loop
          !                                                          ! ===========
-         CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
       ENDIF
       !
@@ -184,5 +185,5 @@
       !
       INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indicesa
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta     ! 4D  workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace
 
       !!----------------------------------------------------------------------
@@ -266,16 +267,16 @@
          IF(lwp)  WRITE(numout,*)
          !
-         CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )   ! Memory allocation
-         !
-         CALL trc_dta( kt , ztrcdta )   ! read tracer data at nittrc000
+         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )   ! Memory allocation
          !
          DO jn = 1, jptra
             IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
                 jl = n_trc_index(jn)
+                CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000
+                ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:)
                 DO jc = 1, npncts
                    DO jk = 1, jpkm1
                       DO jj = nctsj1(jc), nctsj2(jc)
                          DO ji = nctsi1(jc), nctsi2(jc)
-                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk)
+                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk) * tmask(ji,jj,jk)
                             trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
                          ENDDO
@@ -285,5 +286,5 @@
              ENDIF
           ENDDO
-          CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+          CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
       ENDIF
       !
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 4230)
@@ -17,4 +17,8 @@
 
    IMPLICIT NONE
+
+   ! Passive tracers : Maximum number of tracers. Needed to define data structures
+   ! --------------- 
+   INTEGER, PUBLIC,  PARAMETER ::   jpmaxtrc = 100
 
    ! Passive tracers : Total size
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcbc.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 4230)
@@ -0,0 +1,311 @@
+MODULE trcbc
+   !!======================================================================
+   !!                     ***  MODULE  trcdta  ***
+   !! TOP :  module for passive tracer boundary conditions
+   !!=====================================================================
+   !!----------------------------------------------------------------------
+#if  defined key_top 
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP model 
+   !!----------------------------------------------------------------------
+   !!   trc_dta    : read and time interpolated passive tracer data
+   !!----------------------------------------------------------------------
+   USE par_trc       !  passive tracers parameters
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE iom           !  I/O manager
+   USE lib_mpp       !  MPP library
+   USE fldread       !  read input fields
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_bc_init    ! called in trcini.F90 
+   PUBLIC   trc_bc_read    ! called in trcstp.F90 or within
+
+   INTEGER  , SAVE, PUBLIC                             :: nb_trcobc   ! number of tracers with open BC
+   INTEGER  , SAVE, PUBLIC                             :: nb_trcsbc   ! number of tracers with surface BC
+   INTEGER  , SAVE, PUBLIC                             :: nb_trccbc   ! number of tracers with coastal BC
+   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indobc ! index of tracer with OBC data
+   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indsbc ! index of tracer with SBC data
+   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_indcbc ! index of tracer with CBC data
+   INTEGER  , SAVE, PUBLIC                             :: ntra_obc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking
+   INTEGER  , SAVE, PUBLIC                             :: ntra_sbc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking
+   INTEGER  , SAVE, PUBLIC                             :: ntra_cbc     ! MAX( 1, nb_trcxxx ) to avoid compilation error with bounds checking
+   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trofac   ! multiplicative factor for OBCtracer values
+   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcobc   ! structure of data input OBC (file informations, fields read)
+   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trsfac   ! multiplicative factor for SBC tracer values
+   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcsbc   ! structure of data input SBC (file informations, fields read)
+   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trcfac   ! multiplicative factor for CBC tracer values
+   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trccbc   ! structure of data input CBC (file informations, fields read)
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: trcdta.F90 2977 2011-10-22 13:46:41Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_bc_init(ntrc)
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_bc_init  ***
+      !!                    
+      !! ** Purpose :   initialisation of passive tracer BC data 
+      !! 
+      !! ** Method  : - Read namtsd namelist
+      !!              - allocates passive tracer BC data structure 
+      !!----------------------------------------------------------------------
+      !
+      INTEGER,INTENT(IN) :: ntrc                           ! number of tracers
+      INTEGER            :: jl, jn                         ! dummy loop indices
+      INTEGER            :: ierr0, ierr1, ierr2, ierr3     ! temporary integers
+      INTEGER            ::  ios                           ! Local integer output status for namelist read
+      CHARACTER(len=100) :: clndta, clntrc
+      !
+      CHARACTER(len=100) :: cn_dir
+      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i  ! local array of namelist informations on the fields to read
+      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcobc    ! open
+      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcsbc    ! surface
+      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trccbc    ! coastal
+      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trofac    ! multiplicative factor for tracer values
+      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trsfac    ! multiplicative factor for tracer values
+      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trcfac    ! multiplicative factor for tracer values
+      !!
+      NAMELIST/namtrc_bc/ cn_dir, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac 
+      !!----------------------------------------------------------------------
+      IF( nn_timing == 1 )  CALL timing_start('trc_bc_init')
+      !
+      !  Initialisation and local array allocation
+      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0  
+      ALLOCATE( slf_i(ntrc), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_bc_init: unable to allocate local slf_i' )   ;   RETURN
+      ENDIF
+
+      ! Compute the number of tracers to be initialised with open, surface and boundary data
+      ALLOCATE( n_trc_indobc(ntrc), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indobc' )   ;   RETURN
+      ENDIF
+      nb_trcobc      = 0
+      n_trc_indobc(:) = 0
+      !
+      ALLOCATE( n_trc_indsbc(ntrc), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indsbc' )   ;   RETURN
+      ENDIF
+      nb_trcsbc      = 0
+      n_trc_indsbc(:) = 0
+      !
+      ALLOCATE( n_trc_indcbc(ntrc), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indcbc' )   ;   RETURN
+      ENDIF
+      nb_trccbc      = 0
+      n_trc_indcbc(:) = 0
+      !
+      DO jn = 1, ntrc
+         IF( ln_trc_obc(jn) ) THEN
+             nb_trcobc       = nb_trcobc + 1 
+             n_trc_indobc(jn) = nb_trcobc 
+         ENDIF
+         IF( ln_trc_sbc(jn) ) THEN
+             nb_trcsbc       = nb_trcsbc + 1
+             n_trc_indsbc(jn) = nb_trcsbc
+         ENDIF
+         IF( ln_trc_cbc(jn) ) THEN
+             nb_trccbc       = nb_trccbc + 1
+             n_trc_indcbc(jn) = nb_trccbc
+         ENDIF
+      ENDDO
+      ntra_obc = MAX( 1, nb_trcobc )   ! To avoid compilation error with bounds checking
+      IF( lwp ) WRITE(numout,*) ' '
+      IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with open boundary data :', nb_trcobc
+      IF( lwp ) WRITE(numout,*) ' '
+      ntra_sbc = MAX( 1, nb_trcsbc )   ! To avoid compilation error with bounds checking
+      IF( lwp ) WRITE(numout,*) ' '
+      IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with surface boundary data :', nb_trcsbc
+      IF( lwp ) WRITE(numout,*) ' '
+      ntra_cbc = MAX( 1, nb_trccbc )   ! To avoid compilation error with bounds checking
+      IF( lwp ) WRITE(numout,*) ' '
+      IF( lwp ) WRITE(numout,*) ' Number of passive tracers to be initialized with coastal boundary data :', nb_trccbc
+      IF( lwp ) WRITE(numout,*) ' '
+
+      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure
+      READ  ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bc in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure
+      READ  ( numnat_cfg, namtrc_bc, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bc in configuration namelist', lwp )
+      WRITE ( numont, namtrc_bc )
+
+      ! print some information for each 
+      IF( lwp ) THEN
+         DO jn = 1, ntrc
+            IF( ln_trc_obc(jn) )  THEN    
+               clndta = TRIM( sn_trcobc(jn)%clvar ) 
+               IF(lwp) WRITE(numout,*) 'Preparing to read OBC data file for passive tracer number :', jn, ' name : ', clndta, & 
+               &               ' multiplicative factor : ', rn_trofac(jn)
+            ENDIF
+            IF( ln_trc_sbc(jn) )  THEN    
+               clndta = TRIM( sn_trcsbc(jn)%clvar ) 
+               IF(lwp) WRITE(numout,*) 'Preparing to read SBC data file for passive tracer number :', jn, ' name : ', clndta, & 
+               &               ' multiplicative factor : ', rn_trsfac(jn)
+            ENDIF
+            IF( ln_trc_cbc(jn) )  THEN    
+               clndta = TRIM( sn_trccbc(jn)%clvar ) 
+               IF(lwp) WRITE(numout,*) 'Preparing to read CBC data file for passive tracer number :', jn, ' name : ', clndta, & 
+               &               ' multiplicative factor : ', rn_trcfac(jn)
+            ENDIF
+         END DO
+      ENDIF
+      !
+      ! The following code is written this way to reduce memory usage and repeated for each boundary data
+      ! MAV: note that this is just a placeholder and the dimensions must be changed according to 
+      !      what will be done with BDY. A new structure will probably need to be included
+      !
+      ! OPEN Lateral boundary conditions
+      IF( nb_trcobc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
+         ALLOCATE( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), STAT=ierr1 )
+         IF( ierr1 > 0 ) THEN
+            CALL ctl_stop( 'trc_bc_init: unable to allocate  sf_trcobc structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jn = 1, ntrc
+            IF( ln_trc_obc(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               jl = n_trc_indobc(jn)
+               slf_i(jl)    = sn_trcobc(jn)
+               rf_trofac(jl) = rn_trofac(jn)
+                                            ALLOCATE( sf_trcobc(jl)%fnow(jpi,jpj,jpk)   , STAT=ierr2 )
+               IF( sn_trcobc(jn)%ln_tint )  ALLOCATE( sf_trcobc(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 )
+               IF( ierr2 + ierr3 > 0 ) THEN
+                 CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer OBC data arrays' )   ;   RETURN
+               ENDIF
+            ENDIF
+            !   
+         ENDDO
+         !                         ! fill sf_trcdta with slf_i and control print
+         CALL fld_fill( sf_trcobc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' )
+         !
+      ENDIF
+      !
+      ! SURFACE Boundary conditions
+      IF( nb_trcsbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
+         ALLOCATE( sf_trcsbc(nb_trcsbc), rf_trsfac(nb_trcsbc), STAT=ierr1 )
+         IF( ierr1 > 0 ) THEN
+            CALL ctl_stop( 'trc_bc_init: unable to allocate  sf_trcsbc structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jn = 1, ntrc
+            IF( ln_trc_sbc(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               jl = n_trc_indsbc(jn)
+               slf_i(jl)    = sn_trcsbc(jn)
+               rf_trsfac(jl) = rn_trsfac(jn)
+                                            ALLOCATE( sf_trcsbc(jl)%fnow(jpi,jpj,1)   , STAT=ierr2 )
+               IF( sn_trcsbc(jn)%ln_tint )  ALLOCATE( sf_trcsbc(jl)%fdta(jpi,jpj,1,2) , STAT=ierr3 )
+               IF( ierr2 + ierr3 > 0 ) THEN
+                 CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer SBC data arrays' )   ;   RETURN
+               ENDIF
+            ENDIF
+            !   
+         ENDDO
+         !                         ! fill sf_trcsbc with slf_i and control print
+         CALL fld_fill( sf_trcsbc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer SBC data', 'namtrc_bc' )
+         !
+      ENDIF
+      !
+      ! COSTAL Boundary conditions
+      IF( nb_trccbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
+         ALLOCATE( sf_trccbc(nb_trccbc), rf_trcfac(nb_trccbc), STAT=ierr1 )
+         IF( ierr1 > 0 ) THEN
+            CALL ctl_stop( 'trc_bc_ini: unable to allocate  sf_trccbc structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jn = 1, ntrc
+            IF( ln_trc_cbc(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               jl = n_trc_indcbc(jn)
+               slf_i(jl)    = sn_trccbc(jn)
+               rf_trcfac(jl) = rn_trcfac(jn)
+                                            ALLOCATE( sf_trccbc(jl)%fnow(jpi,jpj,1)   , STAT=ierr2 )
+               IF( sn_trccbc(jn)%ln_tint )  ALLOCATE( sf_trccbc(jl)%fdta(jpi,jpj,1,2) , STAT=ierr3 )
+               IF( ierr2 + ierr3 > 0 ) THEN
+                 CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer CBC data arrays' )   ;   RETURN
+               ENDIF
+            ENDIF
+            !   
+         ENDDO
+         !                         ! fill sf_trccbc with slf_i and control print
+         CALL fld_fill( sf_trccbc, slf_i, cn_dir, 'trc_bc_init', 'Passive tracer CBC data', 'namtrc_bc' )
+         !
+      ENDIF
+ 
+      DEALLOCATE( slf_i )          ! deallocate local field structure
+      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_init')
+
+   END SUBROUTINE trc_bc_init
+
+
+   SUBROUTINE trc_bc_read(kt)
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_bc_init  ***
+      !!
+      !! ** Purpose :  Read passive tracer Boundary Conditions data
+      !!
+      !! ** Method  :  Read BC inputs and update data structures using fldread
+      !!              
+      !!----------------------------------------------------------------------
+   
+      ! NEMO
+      USE fldread
+      
+      !! * Arguments
+      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
+
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_bc_read')
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'trc_bc_read : Surface boundary conditions for passive tracers.'
+         IF(lwp) WRITE(numout,*) '~~~~~~~ '
+      ENDIF
+
+      ! OPEN boundary conditions: DOES NOT WORK. Waiting for stable BDY
+      IF( nb_trcobc > 0 ) THEN
+        if (lwp) write(numout,'(a,i5,a,i5)') '   reading OBC data for ', nb_trcobc ,' variables at step ', kt
+        CALL fld_read(kt,1,sf_trcobc)
+        ! vertical interpolation on s-grid and partial step to be added
+      ENDIF
+
+      ! SURFACE boundary conditions       
+      IF( nb_trcsbc > 0 ) THEN
+        if (lwp) write(numout,'(a,i5,a,i5)') '   reading SBC data for ', nb_trcsbc ,' variables at step ', kt
+        CALL fld_read(kt,1,sf_trcsbc)
+      ENDIF
+
+      ! COASTAL boundary conditions       
+      IF( nb_trccbc > 0 ) THEN
+        if (lwp) write(numout,'(a,i5,a,i5)') '   reading CBC data for ', nb_trccbc ,' variables at step ', kt
+        CALL fld_read(kt,1,sf_trccbc)
+      ENDIF   
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_read')
+      !       
+
+   END SUBROUTINE trc_bc_read
+#else
+   !!----------------------------------------------------------------------
+   !!   Dummy module                              NO 3D passive tracer data
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_bc_read( kt )        ! Empty routine
+      WRITE(*,*) 'trc_bc_read: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_bc_read
+#endif
+
+   !!======================================================================
+END MODULE trcbc
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 4230)
@@ -8,4 +8,5 @@
    !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
    !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation 
+   !!            3.5   !  2013-08  (M. Vichi)  generalization for other BGC models
    !!----------------------------------------------------------------------
 #if  defined key_top 
@@ -30,7 +31,7 @@
    INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data
    INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_index ! indice of tracer which is initialised with data
-   INTEGER  , SAVE                                     :: ntra        ! MAX( 1, nb_trcdta ) to avoid compilation error with bounds checking
-   REAL(wp) , SAVE,         ALLOCATABLE, DIMENSION(:)  :: rf_trfac    ! multiplicative factor for tracer values
-   TYPE(FLD), SAVE,         ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read)
+   INTEGER  , SAVE, PUBLIC                             :: ntra        ! MAX( 1, nb_trcdta ) to avoid compilation error with bounds checking
+   REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: rf_trfac    ! multiplicative factor for tracer values
+   TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
@@ -43,5 +44,5 @@
 CONTAINS
 
-   SUBROUTINE trc_dta_init
+   SUBROUTINE trc_dta_init(ntrc)
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE trc_dta_init  ***
@@ -53,5 +54,6 @@
       !!----------------------------------------------------------------------
       !
-      INTEGER            :: jl, jn                           ! dummy loop indicies
+      INTEGER,INTENT(IN) :: ntrc                             ! number of tracers
+      INTEGER            :: jl, jn                           ! dummy loop indices
       INTEGER            :: ierr0, ierr1, ierr2, ierr3       ! temporary integers
       INTEGER            :: ios                              ! Local integer output status for namelist read
@@ -60,7 +62,7 @@
       !
       CHARACTER(len=100)            :: cn_dir
-      TYPE(FLD_N), DIMENSION(jptra) :: slf_i     ! array of namelist informations on the fields to read
-      TYPE(FLD_N), DIMENSION(jptra) :: sn_trcdta
-      REAL(wp)   , DIMENSION(jptra) :: rn_trfac  ! multiplicative factor for tracer values
+      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i ! array of namelist informations on the fields to read
+      TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcdta
+      REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trfac    ! multiplicative factor for tracer values
       !!
       NAMELIST/namtrc_dta/ sn_trcdta, cn_dir, rn_trfac 
@@ -72,5 +74,5 @@
       ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0  
       ! Compute the number of tracers to be initialised with data
-      ALLOCATE( n_trc_index(jptra), STAT=ierr0 )
+      ALLOCATE( n_trc_index(ntrc), slf_i(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
          CALL ctl_stop( 'trc_nam: unable to allocate n_trc_index' )   ;   RETURN
@@ -78,5 +80,5 @@
       nb_trcdta      = 0
       n_trc_index(:) = 0
-      DO jn = 1, jptra
+      DO jn = 1, ntrc
          IF( ln_trc_ini(jn) ) THEN
              nb_trcdta       = nb_trcdta + 1 
@@ -92,14 +94,4 @@
       ENDIF
       !
-      DO jn = 1, jptra
-         WRITE( clndta,'("TR_",I1)' ) jn
-         clndta = TRIM( clndta )
-         !                 !  file      ! frequency ! variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
-         !                 !  name      !  (hours)  !  name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
-         sn_trcdta(jn)  = FLD_N( clndta ,   -1      , clndta    ,  .false.   , .true.  ,  'monthly'  , ''       , ''       )
-         !
-         rn_trfac(jn) = 1._wp
-      END DO
-      !
       REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data
       READ  ( numnat_ref, namtrc_dta, IOSTAT = ios, ERR = 901)
@@ -112,5 +104,5 @@
 
       IF( lwp ) THEN
-         DO jn = 1, jptra
+         DO jn = 1, ntrc
             IF( ln_trc_ini(jn) )  THEN    ! open input file only if ln_trc_ini(jn) is true
                clndta = TRIM( sn_trcdta(jn)%clvar ) 
@@ -134,5 +126,5 @@
          ENDIF
          !
-         DO jn = 1, jptra
+         DO jn = 1, ntrc
             IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
                jl = n_trc_index(jn)
@@ -152,4 +144,5 @@
       ENDIF
       !
+      DEALLOCATE( slf_i )          ! deallocate local field structure
       IF( nn_timing == 1 )  CALL timing_stop('trc_dta_init')
       !
@@ -157,5 +150,5 @@
 
 
-   SUBROUTINE trc_dta( kt, ptrc )
+   SUBROUTINE trc_dta( kt, sf_dta, zrf_trfac )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE trc_dta  ***
@@ -167,10 +160,11 @@
       !!              - ln_trcdmp=F: deallocates the data structure as they are not used
       !!
-      !! ** Action  :   ptrc   passive tracer data on medl mesh and interpolated at time-step kt
+      !! ** Action  :   sf_dta   passive tracer data on medl mesh and interpolated at time-step kt
       !!----------------------------------------------------------------------
       INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(  out) ::   ptrc   ! passive tracer data
-      !
-      INTEGER ::   ji, jj, jk, jl, jn, jkk, ik    ! dummy loop indicies
+      TYPE(FLD), DIMENSION(1)   , INTENT(inout) ::   sf_dta     ! array of information on the field to read
+      REAL(wp)                  , INTENT(in   ) ::   zrf_trfac  ! multiplication factor
+      !
+      INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices
       REAL(wp)::   zl, zi
       REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace
@@ -182,9 +176,5 @@
       IF( nb_trcdta > 0 ) THEN
          !
-         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==!
-         !
-         DO jn = 1, ntra
-            ptrc(:,:,:,jn) = sf_trcdta(jn)%fnow(:,:,:)    ! NO mask
-         ENDDO
+         CALL fld_read( kt, 1, sf_dta )      !==   read data at kt time step   ==!
          !
          IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==!
@@ -195,5 +185,4 @@
             ENDIF
             !
-            DO jn = 1, ntra
                DO jj = 1, jpj                         ! vertical interpolation of T & S
                   DO ji = 1, jpi
@@ -201,12 +190,13 @@
                         zl = fsdept_0(ji,jj,jk)
                         IF(     zl < gdept_0(1  ) ) THEN          ! above the first level of data
-                           ztp(jk) =  ptrc(ji,jj,1    ,jn)
+                           ztp(jk) =  sf_dta(1)%fnow(ji,jj,1)
                         ELSEIF( zl > gdept_0(jpk) ) THEN          ! below the last level of data
-                           ztp(jk) =  ptrc(ji,jj,jpkm1,jn)
+                           ztp(jk) =  sf_dta(1)%fnow(ji,jj,jpkm1)
                         ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1
                            DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1)
                               IF( (zl-gdept_0(jkk)) * (zl-gdept_0(jkk+1)) <= 0._wp ) THEN
                                  zi = ( zl - gdept_0(jkk) ) / (gdept_0(jkk+1)-gdept_0(jkk))
-                                 ztp(jk) = ptrc(ji,jj,jkk,jn) + ( ptrc(ji,jj,jkk+1,jn) - ptrc(ji,jj,jkk,jn) ) * zi 
+                                 ztp(jk) = sf_dta(1)%fnow(ji,jj,jkk) + ( sf_dta(1)%fnow(ji,jj,jkk+1) - &
+                                           sf_dta(1)%fnow(ji,jj,jkk) ) * zi 
                               ENDIF
                            END DO
@@ -214,15 +204,13 @@
                      END DO
                      DO jk = 1, jpkm1
-                        ptrc(ji,jj,jk,jn) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
+                        sf_dta(1)%fnow(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
                      END DO
-                     ptrc(ji,jj,jpk,jn) = 0._wp
+                     sf_dta(1)%fnow(ji,jj,jpk) = 0._wp
                   END DO
                END DO
-            ENDDO 
             ! 
          ELSE                                !==   z- or zps- coordinate   ==!
             !                             
-            DO jn = 1, ntra
-               ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * tmask(:,:,:)    ! Mask
+               sf_dta(1)%fnow(:,:,:) = sf_dta(1)%fnow(:,:,:) * tmask(:,:,:)    ! Mask
                !
                IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level
@@ -232,45 +220,28 @@
                         IF( ik > 1 ) THEN
                            zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                           ptrc(ji,jj,ik,jn) = (1.-zl) * ptrc(ji,jj,ik,jn) + zl * ptrc(ji,jj,ik-1,jn)
+                           sf_dta(1)%fnow(ji,jj,ik) = (1.-zl) * sf_dta(1)%fnow(ji,jj,ik) + zl * sf_dta(1)%fnow(ji,jj,ik-1)
                         ENDIF
                      END DO
                   END DO
                ENDIF
-            ENDDO 
             !
          ENDIF
          !
-         DO jn = 1, ntra
-            ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * rf_trfac(jn)   !  multiplicative factor
-         ENDDO 
+         sf_dta(1)%fnow(:,:,:) = sf_dta(1)%fnow(:,:,:) * zrf_trfac   !  multiplicative factor
          !
          IF( lwp .AND. kt == nit000 ) THEN
-            DO jn = 1, ntra
-               clndta = TRIM( sf_trcdta(jn)%clvar ) 
+               clndta = TRIM( sf_dta(1)%clvar ) 
                WRITE(numout,*) ''//clndta//' data '
                WRITE(numout,*)
                WRITE(numout,*)'  level = 1'
-               CALL prihre( ptrc(:,:,1    ,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               CALL prihre( sf_dta(1)%fnow(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
                WRITE(numout,*)'  level = ', jpk/2
-               CALL prihre( ptrc(:,:,jpk/2,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               CALL prihre( sf_dta(1)%fnow(:,:,jpk/2), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
                WRITE(numout,*)'  level = ', jpkm1
-               CALL prihre( ptrc(:,:,jpkm1,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               CALL prihre( sf_dta(1)%fnow(:,:,jpkm1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
                WRITE(numout,*)
-            ENDDO
-         ENDIF
-         
-         IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !==   deallocate data structure   ==! 
-            !                                              (data used only for initialisation)
-            IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only use to initialize the run'
-            DO jn = 1, ntra
-                                             DEALLOCATE( sf_trcdta(jn)%fnow )     !  arrays in the structure
-               IF( sf_trcdta(jn)%ln_tint )   DEALLOCATE( sf_trcdta(jn)%fdta )
-            ENDDO
-                                             DEALLOCATE( sf_trcdta          )     ! the structure itself
-            !
-         ENDIF
-         !
-      ENDIF
-      ! 
+         ENDIF
+      ENDIF
+      !
       IF( nn_timing == 1 )  CALL timing_stop('trc_dta')
       !
@@ -281,5 +252,5 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_dta( kt )        ! Empty routine
+   SUBROUTINE trc_dta( kt, sf_dta, zrf_trfac )        ! Empty routine
       WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
    END SUBROUTINE trc_dta
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 4229)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 4230)
@@ -24,5 +24,5 @@
    USE trcini_c14b     ! C14 bomb initialisation
    USE trcini_my_trc   ! MY_TRC   initialisation
-   USE trcdta          ! initialisation form files
+   USE trcdta          ! initialisation from files
    USE daymod          ! calendar manager
    USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
@@ -58,5 +58,5 @@
       INTEGER ::   jk, jn, jl    ! dummy loop indices
       CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta   ! 4D  workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace
       !!---------------------------------------------------------------------
       !
@@ -102,5 +102,5 @@
       ENDIF
 
-      IF( ln_trcdta )      CALL trc_dta_init
+      IF( ln_trcdta )      CALL trc_dta_init(jptra)
 
 
@@ -113,15 +113,22 @@
         IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
             !
-            CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
-            !
-            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
+            CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation
             !
             DO jn = 1, jptra
                IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
                   jl = n_trc_index(jn) 
-                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:)  
+                  CALL trc_dta( nit000, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000
+                  ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:)
+                  trn(:,:,:,jn) = ztrcdta(:,:,:) * tmask(:,:,:)  
+                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==!
+                     !                                                    (data used only for initialisation)
+                     IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run'
+                                                  DEALLOCATE( sf_trcdta(jl)%fnow )     !  arrays in the structure
+                     IF( sf_trcdta(jl)%ln_tint )  DEALLOCATE( sf_trcdta(jl)%fdta )
+                     !
+                  ENDIF
                ENDIF
             ENDDO
-            CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
+            CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
         ENDIF
         !
Index: branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-athena-xios
===================================================================
--- branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-athena-xios	(revision 4230)
+++ branches/2013/dev_LOCEAN_CMCC_INGV_2013/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-athena-xios	(revision 4230)
@@ -0,0 +1,80 @@
+#!/bin/bash 
+#!
+#BSUB -q poe_short
+#BSUB -n NPROCS
+#BSUB -a poe
+#BSUB -J MPI_config
+#BSUB -o poe.stdout.%J
+#BSUB -e poe.stderr.%J
+
+ 
+
+###############################################################
+# Test specific settings. Do not hand edit these lines; the fcm_job.sh script will set these
+# (via sed operating on this template job file). 
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+
+###############################################################
+#
+# set up mpp computing environment
+#
+# Local settings for machine IBM Power6 (VARGAS at IDRIS France)
+#
+
+# export MPIRUN="mpirun -n $OCEANCORES"
+
+export MPIRUN="mpirun.lsf"
+
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+
+
+# Don't remove neither change the following line 
+# BODY
+
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export EXE_DIR=DEF_EXE_DIR
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_DIR
+  export NEMO_VALIDATION_DIR=DEF_NEMO_VALIDATION
+  export NEW_CONF=DEF_NEW_CONF
+  export CMP_NAM=DEF_CMP_NAM
+  export TEST_NAME=DEF_TEST_NAME
+#
+# end of set up
+
+
+###############################################################
+#
+# change to the working directory 
+#
+cd ${EXE_DIR}
+
+#
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+#  echo "Running time ${MPIRUN} " $OCEANCORES " ./opa"
+#
+
+  if [ MPI_FLAG == "yes" ]; then
+     time ${MPIRUN} ./opa
+  else
+     time ./opa
+  fi
+#
+  post_test_tidyup
+
+# END_BODY
+# Don't remove neither change the previous line 
+
+  exit
