Index: CONFIG/UNIFORM/v6/IPSLCM6/AA_make
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/AA_make	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/AA_make	(revision 2451)
@@ -121,17 +121,17 @@
 
 orca2lim2:  ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM_PISCES -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_oasis_mct key_diahth key_diaar5" del_key "key_nosignedzero " ; cp ORCA2_LIM_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM_PISCES -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_oasis3 key_diahth key_diaar5" del_key "key_nosignedzero " ; cp ORCA2_LIM_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 orca2lim2nopisces:  ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_oasis_mct key_diahth key_diaar5" del_key "key_nosignedzero" ; cp ORCA2_LIM/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_oasis3 key_diahth key_diaar5" del_key "key_nosignedzero" ; cp ORCA2_LIM/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 orca2lim3:  ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM3_PISCES -d "OPA_SRC LIM_SRC_3 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim3 key_coupled key_oasis3 key_oasis_mct key_top key_pisces key_diahth key_diaar5" del_key "key_lim2 key_nosignedzero" ; cp ORCA2_LIM3_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM3_PISCES -d "OPA_SRC LIM_SRC_3 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim3 key_oasis3 key_top key_pisces key_diahth key_diaar5" del_key "key_lim2 key_nosignedzero" ; cp ORCA2_LIM3_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 orca1lim3: ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA1_LIM3_PISCES -d "OPA_SRC LIM_SRC_3 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim3 key_oasis3 key_coupled key_oasis_mct  key_top key_pisces key_diahth key_diaar5 key_vvl" del_key "key_lim2 key_lim2_vp key_nosignedzero" ; cp ORCA1_LIM3_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA1_LIM3_PISCES -d "OPA_SRC LIM_SRC_3 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim3 key_oasis3 key_top key_pisces key_diahth key_diaar5 key_vvl" del_key "key_lim2 key_lim2_vp key_nosignedzero" ; cp ORCA1_LIM3_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 orca1lim2:  ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA1_LIM2_PISCES -d "OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_top key_pisces key_lim2 key_lim2_vp key_coupled key_oasis3 key_oasis_mct key_diahth key_diaar5 key_vvl" del_key "key_lim3 key_nosignedzero " ; cp ORCA1_LIM2_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; cp ../../../config/IPSLCM6/SOURCES/NEMO/*.cfg ../TOOLS/COMPILE/. ; ./makenemo -m ${FCM_ARCH} -n ORCA1_LIM2_PISCES -d "OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC" -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_top key_pisces key_lim2 key_lim2_vp key_oasis3 key_diahth key_diaar5 key_vvl" del_key "key_lim3 key_nosignedzero " ; cp ORCA1_LIM2_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 verif: ../../bin
Index: CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card	(revision 2451)
@@ -55,5 +55,5 @@
         (${config_UserChoices_JobName}_1m_grid_U.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_U.nc, Post_1M_grid_U),\
         (${config_UserChoices_JobName}_1m_grid_V.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_V.nc, Post_1M_grid_V),\
-        (${config_UserChoices_JobName}_1m_grid_W.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_W.nc, NONE),\
+        (${config_UserChoices_JobName}_1m_grid_W.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_W.nc, Post_1M_grid_W),\
         (${config_UserChoices_JobName}_1m_diaptr.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_diaptr.nc, Post_1M_diaptr),\
         (${config_UserChoices_JobName}_1d_grid_T.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_T.nc, Post_1D_grid_T),\
@@ -109,9 +109,9 @@
 TimeSeriesVars3D = (difvmo, difvmto, difvtrto, voddmavs, voveeivw, votkeavt, vovecrtz, wmo, wmosq)
 ChunckJob3D = 50Y
-Seasonal=OFF
+Seasonal=ON
 
 [Post_1M_diaptr]
 Patches = ()
-GatherWithInternal = (nav_lat, time_counter, deptht, time_counter_bounds)
+GatherWithInternal = (nav_lat, time_counter, deptht, depthw, time_counter_bounds)
 TimeSeriesVars2D = (zotemglo, zosalglo, zomsfglo, zotematl, zosalatl, zomsfatl, zotempac, zosalpac, zomsfpac, zotemind, zosalind, zomsfind, zotemipc, zosalipc, zomsfipc, sophtadv, sophtldf, sopstadv)
 ChunckJob2D = NONE
@@ -198,5 +198,5 @@
 [Post_1Y_diaptr]
 Patches = ()
-GatherWithInternal = (nav_lat, time_counter, deptht, time_counter_bounds)
+GatherWithInternal = (nav_lat, time_counter, deptht, depthw, time_counter_bounds)
 TimeSeriesVars2D = (zotemglo, zosalglo, zomsfglo, zotematl, zosalatl, zomsfatl, zotempac, zosalpac, zomsfpac, zotemind, zosalind, zomsfind, zotemipc, zosalipc, zomsfipc, sophtadv, sophtldf, sopstadv)
 ChunckJob2D = NONE
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver	(revision 2451)
@@ -144,27 +144,4 @@
     fi
     
-    ##--Write Frequency Purpose ....
-    frequency=$( echo ${config_OCE_WriteFrequency} | awk "-F " '{print $1}' )
-    factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
-    case ${frequency} in
-	1Y|1y)
-	    (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}y ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_Y} ;
-	    WF1=${factor}Y ;;
-	1M|1m)
-	    (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInMonth ${year} ${month} ) )) ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}m ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_M} ;
-	    WF1=${factor}M ;;
-	*D|*d)
-	    (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor  ))  ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}d ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_D} ;
-	    WF1=${factor}D ;;
-	*)
-	    (( ORCA_NWRITE = 0 ))                                                            ;;
-    esac
-
     ##--Write Frequency for iomput
     ## Differents frequencies are allowed for grid_[TUVW] and icemod files
@@ -266,10 +243,7 @@
         -e "s%${PAT_NLEAPY}%       nn_leapy=${ORCA_NLEAPY}%"                    \
 	-e "s/${PAT_NSTOCK}/       nn_stock=${ORCA_NSTOCK}/"                    \
-	-e "s/${PAT_NWRITE}/       nn_write=${ORCA_NWRITE}/"                    \
 	-e "s/${PAT_RESTAR}/       ln_rstart=${ORCA_LRSTAR}/"                   \
 	-e "s/${PAT_NRSTAR}/       nn_rstctl=${ORCA_NRSTDT}/"                   \
 	-e "s/${PAT_NMSH}/         nn_msh=${ORCA_NMSH}/"                        \
-	-e "s/${PAT_NN_WRITE}/     nn_prg=${ORCA_NWRITE}/"                      \
-	-e "s/${PAT_NN_FWRI}/      nn_fwri=${ORCA_NWRITE}/"                     \
 	-e "s/${PAT_NN_FSBC}/      nn_fsbc=${ORCA_NN_FSBC}/"                    \
 	-e "s/${PAT_ICE_EMBD}/     nn_ice_embd=${NN_ICE_EMBD}/"                 \
@@ -323,12 +297,4 @@
     IGCM_debug_PushStack "OCE_Finalize"
 
-    if [ -f date.file ] ; then
-        # Prefix use in opa9.card AND in lim2.card :
-	DATE_OPA=$( cat date.file | \
-	    sed "s/\ ${config_UserChoices_JobName}_[0-9]*[a-z]_\([0-9]*_[0-9]*\)_\ */\1/g" )
-	MainPrefix=${config_UserChoices_JobName}_1d_${DATE_OPA}
-	SecondPrefix=${config_UserChoices_JobName}_1m_${DATE_OPA}
-    fi
-
     IGCM_debug_Print 1 FINALIZE OCE !!!
 
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/pisces.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/pisces.driver	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/pisces.driver	(revision 2451)
@@ -30,5 +30,4 @@
     PAT_TOP_NRSTTR=$( supergrep nn_rsttr          ${NAMELIST_TOP_CFG} )
     PAT_PIS_ATCCO2=$( supergrep atcco2            ${NAMELIST_PISCES_CFG} )
-    PAT_PIS_LRIVER=$( supergrep ln_river          ${NAMELIST_PISCES_CFG} )
 
     IGCM_debug_PopStack "MBG_Initialize"
@@ -47,6 +46,4 @@
         TOP_NRSTTR=0
 
-        PISCES_LRIVER=.FALSE.
-
     elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
 
@@ -54,6 +51,4 @@
         TOP_LRSTTR=.TRUE.
         TOP_NRSTTR=0
-
-        PISCES_LRIVER=.TRUE.
 
         # If we start from IPSLCM5* restart files.
@@ -67,6 +62,4 @@
         TOP_LRSTTR=.TRUE.
         TOP_NRSTTR=2
-
-        PISCES_LRIVER=.FALSE.
 
     fi
@@ -118,10 +111,4 @@
     IGCM_sys_Mv namelist_top_cfg.tmp namelist_top_cfg
 
-    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
-        namelist_pisces_cfg > namelist_pisces_cfg.tmp
-
-    IGCM_sys_Mv namelist_pisces_cfg.tmp namelist_pisces_cfg
-
-
     IGCM_debug_PopStack "MBG_Update"
 }
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/config.def_L19
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/config.def_L19	(revision 2446)
+++ 	(revision )
@@ -1,64 +1,0 @@
-##  Cycle diurne  ou non                 
-cycle_diurne=y
-##  Soil Model  ou non               
-soil_model=y
-## Pas de temps de couplage (s).
-t_coupl=_AUTO_
-## Nombre  d'appels des routines de rayonnements ( par jour)                 
-nbapp_rad=12
-
-##  Facteur additif pour l'albedo
-pmagic=0.008
-
-#
-# Parametres "orbitaux/ ere geologique"
-#
-### R_ecc =      Excentricite
-R_ecc = 0.016715
-### R_peri =     Equinoxe
-R_peri = 102.7
-### R_incl =     Inclinaison
-R_incl = 23.441
-### solaire =    Constante solaire
-solaire = _AUTO_: DEFAULT = 1361.
-#
-# Taux gaz a effet de serre
-#
-### co2_ppm =    taux CO2 en ppm
-co2_ppm = _AUTO_: DEFAULT = 367.
-### CH4_ppb =    taux CH4 en ppb
-CH4_ppb = _AUTO_: DEFAULT = 1760.
-### N2O_ppb =    taux N2O en ppb
-N2O_ppb = _AUTO_: DEFAULT = 316.
-### CFC11_ppt =  taux CFC11 en ppt
-CFC11_ppt = _AUTO_: DEFAULT = 741.2
-### CFC12_ppt =  taux CFC12 en ppt
-CFC12_ppt = _AUTO_: DEFAULT = 535.
-#
-# Parametres effets directs/indirects des "aerosols"
-#
-### ok_ade=y/n   flag Aerosol direct effect
-ok_ade=_AUTO_
-### ok_aie=y/n   flag Aerosol indirect effect
-ok_aie=_AUTO_
-### aer_type =   Aerosol variation type : actuel / preind / scenario / annuel
-aer_type=actuel
-### aerosol coupling = online (y) or offline (n)
-aerosol_couple=_AUTO_
-###  flag_aerosol = type of coupled aerosol, if aerosol offline 
-###  0 => no aerosol, 1 => sulfate only, 2 => bc only, 3 => pom only, 4 => seasalt only, 5 => dust only, 6 => all aerosol
-flag_aerosol=_AUTO_
-### ok_cdnc=y/n   Cloud droplet number concentration
-ok_cdnc=_AUTO_
-### bl95_b0 =    Parameter in CDNC-maer link (Boucher&Lohmann 1995)
-bl95_b0=1.7
-### bl95_b1 =    Parameter in CDNC-maer link (Boucher&Lohmann 1995)
-bl95_b1=0.2
-#
-# Parametre de lecture de l'ozone
-#
-# Allowed values are 0, 1 and 2
-# 0: do not read an ozone climatology
-# 1: read a single ozone climatology that will be used day and night
-# 2: read two ozone climatologies, the average day and night climatology and the daylight climatology
-read_climoz=_AUTO_
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/config.def_preind
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/config.def_preind	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/config.def_preind	(revision 2451)
@@ -12,5 +12,5 @@
 
 ##  Facteur additif pour l'albedo
-pmagic=0.0
+pmagic=-0.01
 
 #
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/context_nemo.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/context_nemo.xml	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/context_nemo.xml	(revision 2451)
@@ -91,5 +91,11 @@
 	</file>
 
-	<file id="file7" name_suffix="_icemod" description="ice variables" >
+	<file id="file7" name_suffix="_grid_W" description="ocean W grid variables" >
+	  <field field_ref="woce"         name="vovecrtz" />
+	  <field field_ref="avt"          name="votkeavt" />
+	  <field field_ref="avs"          name="voddmavs" />
+	</file>
+
+	<file id="file8" name_suffix="_icemod" description="ice variables" >
 	  <field field_ref="ice_pres"                     />
 	  <field field_ref="snowthic_cea" name="isnowthi" />
@@ -106,10 +112,9 @@
 	</file>
 
-    <file id="file8" name_suffix="_diaptr" description="diaptr variables" >
+    <file id="file9" name_suffix="_diaptr" description="diaptr variables" >
        <field field_ref="zotemglo"   />
        <field field_ref="zosalglo"     />
        <field field_ref="zosrfglo"    />
        <field field_ref="zomsfglo"    />
-       <field field_ref="zomsfeiv"    />
        <field field_ref="zotematl"   />
        <field field_ref="zosalatl"     />
@@ -129,22 +134,10 @@
        <field field_ref="zomsfipc"     />
        <field field_ref="sophtadv"      />
-       <field field_ref="sophteiv"      />
        <field field_ref="sophtldf"      />
-       <field field_ref="sophtove"      />
-       <field field_ref="sohtatl"       />
-       <field field_ref="sohtpac"       />
-       <field field_ref="sohtind"       />
-       <field field_ref="sohtipc"       />
        <field field_ref="sopstadv"      />
-       <field field_ref="sopsteiv"      />
        <field field_ref="sopstldf"      />
-       <field field_ref="sopstove"      />
-       <field field_ref="sostatl"       />
-       <field field_ref="sostpac"       />
-       <field field_ref="sostind"       />
-       <field field_ref="sostipc"       />
     </file>
 
-	<file id="file9" name_suffix="_ptrc_T" description="pisces sms variables" >
+	<file id="file10" name_suffix="_ptrc_T" description="pisces sms variables" >
        <field field_ref="DIC"      />
        <field field_ref="Alkalini" />
@@ -173,5 +166,5 @@
 	</file>
 	
-	<file id="file10" name_suffix="_diad_T" description="additional pisces diagnostics" >
+	<file id="file11" name_suffix="_diad_T" description="additional pisces diagnostics" >
        <field field_ref="PH"       />
        <field field_ref="CO3"      />
@@ -224,5 +217,5 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled="_1Y_ENABLE_"> <!-- real yearly files -->
 
-	<file id="file11" name_suffix="_ptrc_T" description="pisces sms variables" >
+	<file id="file12" name_suffix="_ptrc_T" description="pisces sms variables" >
        <field field_ref="DIC"      />
        <field field_ref="Alkalini" />
@@ -251,5 +244,5 @@
 	</file>
 
-	<file id="file12" name_suffix="_diad_T" description="additional pisces diagnostics" >
+	<file id="file13" name_suffix="_diad_T" description="additional pisces diagnostics" >
        <field field_ref="PH"       />
        <field field_ref="CO3"      />
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def_nemo.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def_nemo.xml	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def_nemo.xml	(revision 2451)
@@ -16,21 +16,43 @@
       
      <field_group id="grid_T" grid_ref="grid_T_2D" >
-         <field id="toce"         long_name="temperature"                               unit="degC" grid_ref="grid_T_3D"/>
-         <field id="soce"         long_name="salinity"                                  unit="psu"  grid_ref="grid_T_3D"/>
+         <field id="e3t"          long_name="T-cell thickness"                          unit="m"      grid_ref="grid_T_3D"/>
+
+         <field id="toce"         long_name="temperature"                               unit="degC"   grid_ref="grid_T_3D"/>
+         <field id="toce_e3t"     long_name="temperature * e3t"                         unit="degC*m" grid_ref="grid_T_3D" > toce * e3t </field >
+         <field id="soce"         long_name="salinity"                                  unit="psu"    grid_ref="grid_T_3D"/>
+         <field id="soce_e3t"     long_name="salinity * e3t"                            unit="psu*m"  grid_ref="grid_T_3D" > soce * e3t </field >
+
          <field id="sst"          long_name="sea surface temperature"                   unit="degC"                     />
-         <field id="sst2"         long_name="square of sea surface temperature"         unit="degC2"                    />
+         <field id="sst2"         long_name="square of sea surface temperature"         unit="degC2"                     >  sst * sst </field >
+         <field id="sstmax"       long_name="max of sea surface temperature"       field_ref="sst"  operation="maximum" />
+         <field id="sstmin"       long_name="min of sea surface temperature"       field_ref="sst"  operation="minimum" />
          <field id="sstgrad"      long_name="module of sst gradient"                    unit="degC/m"                   />
          <field id="sstgrad2"     long_name="square of module of sst gradient"          unit="degC2/m2"                 />
+         <field id="sbt"          long_name="sea bottom temperature"                    unit="degC"                     />
+	 
          <field id="sss"          long_name="sea surface salinity"                      unit="psu"                      />
-         <field id="sss2"         long_name="square of sea surface salinity"            unit="psu2"                     />
+         <field id="sss2"         long_name="square of sea surface salinity"            unit="psu2"                      >  sss * sss </field >
+         <field id="sssmax"       long_name="max of sea surface salinity"          field_ref="sss"  operation="maximum" />
+         <field id="sssmin"       long_name="min of sea surface salinity"          field_ref="sss"  operation="minimum" />
+         <field id="sbs"          long_name="sea bottom salinity"                       unit="psu"                      />
+
          <field id="ssh"          long_name="sea surface height"                        unit="m"                        />
-         <field id="ssh2"         long_name="square of sea surface height"              unit="m2"                       />
+         <field id="ssh2"         long_name="square of sea surface height"              unit="m2"                        >  ssh * ssh </field >
+         <field id="sshmax"       long_name="max of sea surface height"            field_ref="ssh"  operation="maximum" />
+
          <field id="mldkz5"       long_name="mixing layer depth (Turbocline)"           unit="m"                        />
          <field id="mldr10_1"     long_name="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
-         <field id="rhop"         long_name="potential density (sigma0)"                unit="kg/m3" grid_ref="grid_T_3D"/>
-         <field id="heatc"        long_name="Heat content vertically integrated"        unit="J/m2"                      />
+         <field id="mldr10_1max"  long_name="max of Mixed Layer Depth 0.01 ref.10m" field_ref="mldr10_1"  operation="maximum" />
+         <field id="mldr10_1min"  long_name="min of Mixed Layer Depth 0.01 ref.10m" field_ref="mldr10_1"  operation="minimum" />
+         <field id="heatc"        long_name="Heat content vertically integrated"        unit="J/m2"                     />
          <field id="saltc"        long_name="Salt content vertically integrated"        unit="PSU*kg/m2"                />
-	 <field id="eken"         long_name="kinetic energy"                            unit="m2/s2" grid_ref="grid_T_3D"/>
-	 <field id="hdiv"         long_name="horizontal divergence"                     unit="s-1"   grid_ref="grid_T_3D"/>
+         <!-- EOS -->
+         <field id="alpha"        long_name="thermal expansion"                         unit="1/degC" grid_ref="grid_T_3D"/>
+         <field id="beta"         long_name="haline contraction"                        unit="1/psu"  grid_ref="grid_T_3D"/>
+         <field id="bn2"          long_name="squared Brunt-Vaisala frequency"           unit="1/s"    grid_ref="grid_T_3D"/>
+         <field id="rhop"         long_name="potential density (sigma0)"                unit="kg/m3"  grid_ref="grid_T_3D"/>
+         <!-- Energy - horizontal divergence -->
+         <field id="eken"         long_name="kinetic energy"                            unit="m2/s2"  grid_ref="grid_T_3D"/>
+         <field id="hdiv"         long_name="horizontal divergence"                     unit="s-1"    grid_ref="grid_T_3D"/>
          <!-- variables available with MLE -->
          <field id="Lf_NHpf"      long_name="MLE: Lf = N H / f"                         unit="m"                        />
@@ -52,5 +74,4 @@
          <field id="botpres"      long_name="Pressure at sea floor"                     unit="dbar"                     />
          <!-- variables available with key_diaar5/key_vvl -->
-         <field id="cellthc"      long_name="Cell thickness"                            unit="m"    grid_ref="grid_T_3D"/>
          <!-- variables available with key_vvl -->
          <field id="tpt_dep"      long_name="T-point depth"                             unit="m"    grid_ref="grid_T_3D"/>
@@ -140,9 +161,9 @@
 
          <field id="empmr"        long_name="Net Upward Water Flux"                                        unit="kg/m2/s"  />
-         <field id="saltflx"      long_name="Downward salt flux"                                           unit="PSU/m2/s"  />
+         <field id="saltflx"      long_name="Downward salt flux"                                           unit="PSU/m2/s" />
          <field id="fmmflx"       long_name="Water flux due to freezing/melting"                           unit="kg/m2/s"  />
          <field id="snowpre"      long_name="Snow precipitation"                                           unit="kg/m2/s"  />
          <field id="runoffs"      long_name="River Runoffs"                                                unit="Kg/m2/s"  />
-         <field id="precip"       long_name="Total precipitation"                                           unit="kg/m2/s"  />
+         <field id="precip"       long_name="Total precipitation"                                          unit="kg/m2/s"  />
 
 
@@ -158,5 +179,13 @@
 	 <!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
 	 <field id="ssh_ib"       long_name="Inverse barometer sea surface height"                         unit="m"        />
-	
+
+         <!-- * variable related to ice shelf forcing * -->
+         <field id="fwfisf"       long_name="Ice shelf melting"                                            unit="Kg/m2/s"  />
+         <field id="qisf"         long_name="Ice Shelf Heat Flux"                                          unit="W/m2"     />
+         <field id="isfgammat"    long_name="transfert coefficient for isf (temperature) "                 unit="m/s"      />
+         <field id="isfgammas"    long_name="transfert coefficient for isf (salinity)    "                 unit="m/s"      />
+ 	     <field id="stbl"         long_name="salinity in the Losh tbl                    "                 unit="PSU"      />
+	     <field id="ttbl"         long_name="temperature in the Losh tbl                 "                 unit="C"        />
+
          <!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
          <field id="qlw_oce"      long_name="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
@@ -189,5 +218,5 @@
          <field id="snowmel_cea"   long_name="Snow Melt Rate (cell average)"                               unit="kg/m2/s"  />
          <field id="sntoice_cea"   long_name="Snow-Ice Formation Rate (cell average)"                      unit="kg/m2/s"  />
-         <field id="ticemel_cea"      long_name="Rate of Melt at Upper Surface of Sea Ice (cell average)"     unit="kg/m2/s"  />
+         <field id="ticemel_cea"   long_name="Rate of Melt at Upper Surface of Sea Ice (cell average)"     unit="kg/m2/s"  />
 
 	 <!-- ice fields -->
@@ -205,4 +234,5 @@
          <field id="icethic_cea"  long_name="Ice thickness (cell average)"                                 unit="m"        />
          <field id="iceprod_cea"  long_name="Ice production (cell average)"                                unit="m/s"      />
+         <field id="iiceconc"     long_name="Ice concentration"                                            unit=""         />
          
          <field id="ice_pres"     long_name="Ice presence"                                                 unit="-"        />
@@ -219,6 +249,5 @@
          <field id="emp_x_sst"    long_name="Concentration/Dilution term on SST"                           unit="kgC/m2/s" />
          <field id="emp_x_sss"    long_name="Concentration/Dilution term on SSS"                         unit="kgPSU/m2/s" />        
-         
-         
+       
          <field id="iceconc"      long_name="ice concentration"                                            unit="%"        />
          <field id="uice_ipa"     long_name="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />
@@ -246,5 +275,5 @@
 
          <field id="micet"        long_name="Mean ice temperature"                                         unit="degC"     />
-         <field id="icehc"        long_name="ice total heat content"                                       unit="10^9J"   /> 
+         <field id="icehc"        long_name="ice total heat content"                                       unit="10^9J"    /> 
          <field id="isnowhc"      long_name="snow total heat content"                                      unit="10^9J"    />
          <field id="icest"        long_name="ice surface temperature"                                      unit="degC"     />
@@ -255,11 +284,12 @@
          <field id="idive"        long_name="divergence"                                                   unit="10-8s-1"  />
          <field id="ishear"       long_name="shear"                                                        unit="10-8s-1"  />
-         <field id="icevolu"      long_name="ice volume"                                                   unit="m"      />
-         <field id="snowvol"      long_name="snow volume"                                                  unit="m"      />
+         <field id="icevolu"      long_name="ice volume"                                                   unit="m"        />
+         <field id="snowvol"      long_name="snow volume"                                                  unit="m"        />
 
          <field id="icetrp"       long_name="ice volume transport"                                         unit="m/day"   />
          <field id="snwtrp"       long_name="snw volume transport"                                         unit="m/day"   />
-         <field id="deitrp"       long_name="advected ice enhalpy"                                         unit="W/m2"   />
-         <field id="destrp"       long_name="advected snw enhalpy"                                         unit="W/m2"   />
+         <field id="saltrp"       long_name="salt content transport"                                       unit="psu*kg/m2/day" />
+         <field id="deitrp"       long_name="advected ice enthalpy"                                         unit="W/m2"    />
+         <field id="destrp"       long_name="advected snw enthalpy"                                         unit="W/m2"    />
 
          <field id="sfxbri"       long_name="brine salt flux"                                              unit="psu*kg/m2/day" />
@@ -285,4 +315,8 @@
          <field id="vfxspr"       long_name="snw precipitation on ice"                                     unit="m/day"   />
 
+         <field id="afxtot"       long_name="area tendency (total)"                                        unit="day-1"   />
+         <field id="afxdyn"       long_name="area tendency (dynamics)"                                     unit="day-1"   />
+         <field id="afxthd"       long_name="area tendency (thermo)"                                       unit="day-1"   />
+
          <field id="hfxsum"   long_name="heat fluxes causing surface ice melt"            unit="W/m2"  />
          <field id="hfxbom"   long_name="heat fluxes causing bottom ice melt"             unit="W/m2"  />
@@ -301,9 +335,9 @@
          <field id="hfxres"   long_name="heat fluxes from ice-ocean mass exchange during resultant"           unit="W/m2"  />
          <field id="hfxsub"   long_name="heat fluxes from ice-atm. mass exchange during sublimation"          unit="W/m2"  />
-         <field id="hfxspr"   long_name="heat fluxes from ice-atm. mass exchange during snow precip"          unit="W/m2" />
+         <field id="hfxspr"   long_name="heat fluxes from ice-atm. mass exchange during snow precip"          unit="W/m2"  />
 
 	 <!-- diags -->
          <field id="hfxdhc"    long_name="Heat content variation in snow and ice"   unit="W/m2" />
-         <field id="hfxtur"    long_name="turbulent heat flux at the ice base"      unit="W/m2"  />
+         <field id="hfxtur"    long_name="turbulent heat flux at the ice base"      unit="W/m2" />
 
       </field_group>
@@ -312,23 +346,28 @@
       
       <field_group id="grid_U"   grid_ref="grid_U_2D">
-         <field id="utau"         long_name="Wind Stress along i-axis"                    unit="N/m2" />
-         <field id="suoce"        long_name="ocean surface current along i-axis"          unit="m/s"  />
-         <field id="uoce"         long_name="ocean current along i-axis"                  unit="m/s"  grid_ref="grid_U_3D" />
-         <field id="uocetr_eff"   long_name="Effective ocean transport along i-axis"      unit="m3/s" grid_ref="grid_U_3D" />
+         <field id="e3u"          long_name="U-cell thickness"                               unit="m"        grid_ref="grid_U_3D" />
+         <field id="utau"         long_name="Wind Stress along i-axis"                       unit="N/m2"                          />
+         <field id="uoce"         long_name="ocean current along i-axis"                     unit="m/s"      grid_ref="grid_U_3D" />
+         <field id="uoce_e3u"     long_name="ocean current along i-axis * e3u"               unit="m2/s"     grid_ref="grid_U_3D"  > uoce * e3u </field>
+         <field id="ssu"          long_name="ocean surface current along i-axis"             unit="m/s"                           />
+         <field id="sbu"          long_name="ocean bottom current along i-axis"              unit="m/s"                           />
+         <field id="uocetr_eff"   long_name="Effective ocean transport along i-axis"         unit="m3/s"     grid_ref="grid_U_3D" />
          <field id="uocet"        long_name="ocean transport along i-axis times temperature" unit="degC.m/s" grid_ref="grid_U_3D" />
          <field id="uoces"        long_name="ocean transport along i-axis times salinity"    unit="psu.m/s"  grid_ref="grid_U_3D" />
          <!-- variables available with MLE -->
-         <field id="psiu_mle"     long_name="MLE streamfunction along i-axis"             unit="m3/s"  grid_ref="grid_U_3D"  />
+         <field id="psiu_mle"     long_name="MLE streamfunction along i-axis"                unit="m3/s"     grid_ref="grid_U_3D" />
          <!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
-         <field id="uoce_eiv"     long_name="EIV ocean current along i-axis"              unit="m/s"  grid_ref="grid_U_3D" />
+         <field id="uoce_eiv"     long_name="EIV ocean current along i-axis"                 unit="m/s"      grid_ref="grid_U_3D" />
          <!-- uoce_eiv: available with key_trabbl -->
-         <field id="uoce_bbl"     long_name="BBL ocean current along i-axis"              unit="m/s"  grid_ref="grid_U_3D" />
-	 <field id="ahu_bbl"      long_name="BBL diffusive flux along i-axis"             unit="m3/s" />
+         <field id="uoce_bbl"     long_name="BBL ocean current along i-axis"                 unit="m/s"      grid_ref="grid_U_3D" />
+	     <field id="ahu_bbl"      long_name="BBL diffusive flux along i-axis"                unit="m3/s"                          />
+         <!-- variable for ice shelves -->
+	 <field id="utbl"         long_name="zonal current in the Losh tbl"                  unit="m/s"                           />
          <!-- variables available with key_diaar5 -->
-         <field id="u_masstr"     long_name="ocean eulerian mass transport along i-axis"  unit="kg/s" grid_ref="grid_U_3D" />
-         <field id="u_heattr"     long_name="ocean eulerian heat transport along i-axis"  unit="W"    />
-         <field id="u_salttr"     long_name="ocean eulerian salt transport along i-axis"  unit="PSU*kg/s"    />
-         <field id="ueiv_heattr"  long_name="ocean bolus heat transport along i-axis"     unit="W"    />
-         <field id="udiff_heattr" long_name="ocean diffusion heat transport along i-axis" unit="W"    />
+         <field id="u_masstr"     long_name="ocean eulerian mass transport along i-axis"     unit="kg/s"     grid_ref="grid_U_3D" />
+         <field id="u_heattr"     long_name="ocean eulerian heat transport along i-axis"     unit="W"                             />
+         <field id="u_salttr"     long_name="ocean eulerian salt transport along i-axis"     unit="PSU*kg/s"                      />
+         <field id="ueiv_heattr"  long_name="ocean bolus heat transport along i-axis"        unit="W"                             />
+         <field id="udiff_heattr" long_name="ocean diffusion heat transport along i-axis"    unit="W"                             />
      </field_group>
       
@@ -336,23 +375,28 @@
       
       <field_group id="grid_V"   grid_ref="grid_V_2D">
-         <field id="vtau"         long_name="Wind Stress along j-axis"                    unit="N/m2" />
-         <field id="svoce"        long_name="ocean surface current along j-axis"          unit="m/s"  />
-         <field id="voce"         long_name="ocean current along j-axis"                  unit="m/s"  grid_ref="grid_V_3D" />
-         <field id="vocetr_eff"   long_name="Effective ocean transport along j-axis"      unit="m3/s" grid_ref="grid_V_3D" />
+         <field id="e3v"          long_name="V-cell thickness"                               unit="m"        grid_ref="grid_V_3D" />
+         <field id="vtau"         long_name="Wind Stress along j-axis"                       unit="N/m2"                          />
+         <field id="voce"         long_name="ocean current along j-axis"                     unit="m/s"      grid_ref="grid_V_3D" />
+         <field id="voce_e3v"     long_name="ocean current along j-axis * e3v"               unit="m2/s"     grid_ref="grid_V_3D"  > voce * e3v </field>
+         <field id="ssv"          long_name="ocean surface current along j-axis"             unit="m/s"                           />
+         <field id="sbv"          long_name="ocean bottom current along j-axis"              unit="m/s"                           />
+         <field id="vocetr_eff"   long_name="Effective ocean transport along j-axis"         unit="m3/s"     grid_ref="grid_V_3D" />
          <field id="vocet"        long_name="ocean transport along j-axis times temperature" unit="degC.m/s" grid_ref="grid_V_3D" />
          <field id="voces"        long_name="ocean transport along j-axis times salinity"    unit="psu.m/s"  grid_ref="grid_V_3D" />
          <!-- variables available with MLE -->
-         <field id="psiv_mle"     long_name="MLE streamfunction along j-axis"             unit="m3/s"  grid_ref="grid_V_3D"  />
+         <field id="psiv_mle"     long_name="MLE streamfunction along j-axis"                unit="m3/s"     grid_ref="grid_V_3D" />
          <!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
-         <field id="voce_eiv"     long_name="EIV ocean current along j-axis"              unit="m/s"  grid_ref="grid_V_3D" />
+         <field id="voce_eiv"     long_name="EIV ocean current along j-axis"                 unit="m/s"      grid_ref="grid_V_3D" />
          <!-- voce_eiv: available with key_trabbl -->
-         <field id="voce_bbl"     long_name="BBL ocean current along j-axis"              unit="m/s"  grid_ref="grid_V_3D" />
-	 <field id="ahv_bbl"      long_name="BBL diffusive flux along j-axis"             unit="m3/s"                   />
+         <field id="voce_bbl"     long_name="BBL ocean current along j-axis"                 unit="m/s"      grid_ref="grid_V_3D" />
+	     <field id="ahv_bbl"      long_name="BBL diffusive flux along j-axis"                unit="m3/s"                          />
+         <!-- variable for ice shelves -->
+	     <field id="vtbl"         long_name="meridional current in the Losh tbl"             unit="m/s"                           />
          <!-- variables available with key_diaar5 -->
-         <field id="v_masstr"     long_name="ocean eulerian mass transport along j-axis"  unit="kg/s" grid_ref="grid_V_3D" />
-         <field id="v_heattr"     long_name="ocean eulerian heat transport along j-axis"  unit="W"     />
-         <field id="v_salttr"     long_name="ocean eulerian salt transport along i-axis"  unit="PSU*kg/s"    />
-         <field id="veiv_heattr"  long_name="ocean bolus heat transport along j-axis"     unit="W"     />
-         <field id="vdiff_heattr" long_name="ocean diffusion heat transport along j-axis" unit="W"     />
+         <field id="v_masstr"     long_name="ocean eulerian mass transport along j-axis"     unit="kg/s"     grid_ref="grid_V_3D" />
+         <field id="v_heattr"     long_name="ocean eulerian heat transport along j-axis"     unit="W"                             />
+         <field id="v_salttr"     long_name="ocean eulerian salt transport along i-axis"     unit="PSU*kg/s"                      />
+         <field id="veiv_heattr"  long_name="ocean bolus heat transport along j-axis"        unit="W"                             />
+         <field id="vdiff_heattr" long_name="ocean diffusion heat transport along j-axis"    unit="W"                             />
       </field_group>
       
@@ -360,5 +404,7 @@
       
       <field_group id="grid_W" grid_ref="grid_W_3D">
+        <field id="e3w"          long_name="W-cell thickness"                            unit="m"   />
         <field id="woce"         long_name="ocean vertical velocity"                  unit="m/s"    />
+        <field id="woce_e3w"     long_name="ocean vertical velocity * e3v"            unit="m2/s"    > woce * e3w </field>
         <field id="wocetr_eff"   long_name="effective ocean vertical transport"       unit="m3/s"   />
         <!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
@@ -386,36 +432,39 @@
 
       <field_group id="scalar"  domain_ref="1point" >
-     <field id="voltot"     long_name="global mean volume"                         unit="m3"   />
-     <field id="sshtot"     long_name="global mean ssh"                            unit="m"    />
-     <field id="sshsteric"  long_name="global mean ssh steric"                     unit="m"    />
-     <field id="sshthster"  long_name="global mean ssh thermosteric"               unit="m"    />
-     <field id="masstot"    long_name="global mean mass"                           unit="kg"   />
-     <field id="temptot"    long_name="global mean temperature"                    unit="degC" />
-     <field id="saltot"     long_name="global mean salinity"                       unit="psu"  />
-     <field id="fram_trans" long_name="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+         <field id="voltot"     long_name="global mean volume"                         unit="m3"   />
+         <field id="sshtot"     long_name="global mean ssh"                            unit="m"    />
+         <field id="sshsteric"  long_name="global mean ssh steric"                     unit="m"    />
+         <field id="sshthster"  long_name="global mean ssh thermosteric"               unit="m"    />
+         <field id="masstot"    long_name="global mean mass"                           unit="kg"   />
+         <field id="temptot"    long_name="global mean temperature"                    unit="degC" />
+         <field id="saltot"     long_name="global mean salinity"                       unit="psu"  />
+         <field id="fram_trans" long_name="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
+
    	 <!-- available with ln_diahsb -->
-	 <field id="bgtemper" long_name="global mean temperature variation"            unit="degC"/>
-	 <field id="bgsaline" long_name="global mean salinity variation"               unit="psu"/>
-	 <field id="bgheatco" long_name="global mean heat content variation"           unit="10^20J"/>
-	 <field id="bgsaltco" long_name="global mean salt content variation"           unit="psu*km3" />
-	 <field id="bgvolssh" long_name="global mean volume variation (ssh)"           unit="km3"/>
-	 <field id="bgvole3t" long_name="global mean volume variation (e3t)"           unit="km3"/>
-	 <field id="bgfrcvol" long_name="global mean volume variation from forcing"    unit="km3"/>
-	 <field id="bgfrctem" long_name="global mean forcing from heat content variation"   unit="degC"/>
-	 <field id="bgfrcsal" long_name="global mean forcing salt content variation"        unit="psu"/>
-	 <field id="bgmistem" long_name="global mean temperature error due to free surface" unit="degC"/>
-	 <field id="bgmissal" long_name="global mean salinity error due to free surface"    unit="psu"/>
+		 <field id="bgtemper"     long_name="global mean temperature"                  unit="degC"   />
+		 <field id="bgsaline"     long_name="global mean salinity"                     unit="psu"    />
+		 <field id="bgheatco"     long_name="global mean heat content"                 unit="10^9J"  />
+		 <field id="bgsaltco"     long_name="global mean salt content"                 unit="psu*m3" />
+		 <field id="bgvolssh"     long_name="global mean ssh volume"                   unit="km3"     />
+	     <field id="bgvole3t"     long_name="global mean volume variation (e3t)"           unit="km3"/>
+		 <field id="bgvoltot"     long_name="global mean volume"                       unit="km3"     />
+		 <field id="bgsshtot"     long_name="global mean ssh"                          unit="m"      />
+		 <field id="bgfrcvol"     long_name="global mean volume from forcing"          unit="km3"     />
+		 <field id="bgfrctem"     long_name="global mean heat content from forcing"    unit="10^9J"  />
+		 <field id="bgfrcsal"     long_name="global mean salt content from forcing"    unit="psu*km3" />
+		 <field id="bgmistem"     long_name="global mean temperature error due to free surface" unit="degC" />
+		 <field id="bgmissal"     long_name="global mean salinity error due to free surface"    unit="psu"  />
       </field_group>
 
       <field_group id="SBC_scalar"  domain_ref="1point" >
          <!-- available with ln_limdiaout -->
-	 <field id="ibgvoltot"    long_name="global mean ice volume"                   unit="km3"   />
-	 <field id="sbgvoltot"    long_name="global mean snow volume"                  unit="km3"   />
-	 <field id="ibgarea"      long_name="global mean ice area"                     unit="km2"   />
-	 <field id="ibgsaline"    long_name="global mean ice salinity"                 unit="psu"   />
-	 <field id="ibgtemper"    long_name="global mean ice temperature"              unit="degC"   />
+	 <field id="ibgvoltot"    long_name="global mean ice volume"                   unit="km3"      />
+	 <field id="sbgvoltot"    long_name="global mean snow volume"                  unit="km3"      />
+	 <field id="ibgarea"      long_name="global mean ice area"                     unit="km2"      />
+	 <field id="ibgsaline"    long_name="global mean ice salinity"                 unit="psu"      />
+	 <field id="ibgtemper"    long_name="global mean ice temperature"              unit="degC"     />
 	 <field id="ibgheatco"    long_name="global mean ice heat content"             unit="10^20J"   />
 	 <field id="sbgheatco"    long_name="global mean snow heat content"            unit="10^20J"   />
-	 <field id="ibgsaltco"    long_name="global mean ice salt content"             unit="psu*km3"   />
+	 <field id="ibgsaltco"    long_name="global mean ice salt content"             unit="psu*km3"  />
 
 	 <field id="ibgvfx"       long_name="global mean volume flux (emp)"               unit="m/day"   />
@@ -446,9 +495,9 @@
 
         <field id="ibghfxthd"   long_name="heat fluxes from ice-ocean exchange during thermo"              unit="W"  />
-        <field id="ibghfxsum"   long_name="heat fluxes causing surface ice melt"              unit="W"  />
-        <field id="ibghfxbom"   long_name="heat fluxes causing bottom ice melt"              unit="W"  />
-        <field id="ibghfxbog"   long_name="heat fluxes causing bottom ice growth"              unit="W"  />
-        <field id="ibghfxdif"   long_name="heat fluxes causing ice temperature change"              unit="W"  />
-        <field id="ibghfxopw"   long_name="heat fluxes causing open water ice formation"              unit="W"  />
+        <field id="ibghfxsum"   long_name="heat fluxes causing surface ice melt"                           unit="W"  />
+        <field id="ibghfxbom"   long_name="heat fluxes causing bottom ice melt"                            unit="W"  />
+        <field id="ibghfxbog"   long_name="heat fluxes causing bottom ice growth"                          unit="W"  />
+        <field id="ibghfxdif"   long_name="heat fluxes causing ice temperature change"                     unit="W"  />
+        <field id="ibghfxopw"   long_name="heat fluxes causing open water ice formation"                   unit="W"  />
         <field id="ibghfxdyn"   long_name="heat fluxes from ice-ocean exchange during dynamic"             unit="W"  />
         <field id="ibghfxres"   long_name="heat fluxes from ice-ocean exchange during resultant"           unit="W"  />
@@ -459,5 +508,5 @@
 
 	 <field id="ibgfrcvol"    long_name="global mean forcing volume (emp)"         unit="km3"      />
-	 <field id="ibgfrcsfx"    long_name="global mean forcing salt   (sfx)"         unit="psu*km3"   />
+	 <field id="ibgfrcsfx"    long_name="global mean forcing salt   (sfx)"         unit="psu*km3"  />
 	 <field id="ibgvolgrm"    long_name="global mean ice growth+melt volume"       unit="km3"      />
       </field_group>
@@ -491,44 +540,32 @@
       </field_group>
 
-      <!-- PTR -->
-      <field_group id="diaptr" domain_ref="ptr"   grid_ref="grid_T_3D"  enabled=".FALSE."> <!-- time step automaticaly defined based on nn_fptr -->
-        <field id="zotemglo"          long_name="Zonal Mean Temperature"                       unit="C"   />
-        <field id="zosalglo"          long_name="Zonal Mean Salinity"                          unit="PSU"   />
-        <field id="zosrfglo"          long_name="Zonal Mean Surface"                           unit="m2"   />
-        <field id="zomsfglo"          long_name="Meridional Stream-Function: Global"           unit="Sv"   />
-        <field id="zomsfeiv"          long_name="Bolus Meridional Stream-Function: Global"     unit="Sv"   />
-        <field id="zotematl"          long_name="Zonal Mean Temperature : Atlantic"            unit="C"   />
-        <field id="zosalatl"          long_name="Zonal Mean Salinity : Atlantic"               unit="PSU"   />
-        <field id="zosrfatl"          long_name="Zonal Mean Surface : Atlantic"                unit="m2"   />
-        <field id="zomsfatl"          long_name="Meridional Stream-Function: Atlantic"         unit="Sv"   />
-        <field id="zotempac"          long_name="Zonal Mean Temperature : Pacific"             unit="C"   />
-        <field id="zosalpac"          long_name="Zonal Mean Salinity : Pacific"                unit="PSU"   />
-        <field id="zosrfpac"          long_name="Zonal Mean Surface : Pacific"                 unit="m2"   />
-        <field id="zomsfpac"          long_name="Meridional Stream-Function: Pacific"          unit="Sv"   />
-        <field id="zotemind"          long_name="Zonal Mean Temperature : Indian"              unit="C"   />
-        <field id="zosalind"          long_name="Zonal Mean Salinity : Indian"                 unit="PSU"   />
-        <field id="zosrfind"          long_name="Zonal Mean Surface : Indian"                  unit="m2"   />
-        <field id="zomsfind"          long_name="Meridional Stream-Function: Indian"           unit="Sv"   />
-        <field id="zotemipc"          long_name="Zonal Mean Temperature : Pacific+Indian"      unit="C"   />
-        <field id="zosalipc"          long_name="Zonal Mean Salinity : Pacific+Indian"         unit="PSU"   />
-        <field id="zosrfipc"          long_name="Zonal Mean Surface : Pacific+Indian"          unit="m2"   />
-        <field id="zomsfipc"          long_name="Meridional Stream-Function: Pacific+Indian"   unit="Sv"    />
-        <field id="sophtadv"          long_name="Advective Heat Transport"                     unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sophteiv"          long_name="Bolus Advective Heat Transport"               unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sophtldf"          long_name="Diffusive Heat Transport"                     unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sophtove"          long_name="Overtuning Heat Transport"                    unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sohtatl"           long_name="Heat Transport Atlantic"                      unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sohtpac"           long_name="Heat Transport Pacific"                       unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sohtind"           long_name="Heat Transport Indian"                        unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sohtipc"           long_name="Heat Transport Pacific+Indian"                unit="PW"       grid_ref="grid_T_2D"   />
-        <field id="sopstadv"          long_name="Advective Salt Transport"                     unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sopsteiv"          long_name="Bolus Advective Salt Transport"               unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sopstldf"          long_name="Diffusive Salt Transport"                     unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sopstove"          long_name="Overtuning Salt Transport"                    unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sostatl"           long_name="Salt Transport Atlantic"                      unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sostpac"           long_name="Salt Transport Pacific"                       unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sostind"           long_name="Salt Transport Indian"                        unit="Giga g/s" grid_ref="grid_T_2D"   />
-        <field id="sostipc"           long_name="Salt Transport Pacific+Indian"                unit="Giga g/s" grid_ref="grid_T_2D"   />
+      <!-- Poleward transport : ptr -->     
+      <field_group id="diaptr" domain_ref="ptr"  > 
+        <field id="zomsfglo"          long_name="Meridional Stream-Function: Global"           unit="Sv"       grid_ref="grid_W_3D"  />
+        <field id="zomsfatl"          long_name="Meridional Stream-Function: Atlantic"         unit="Sv"       grid_ref="grid_W_3D"  />
+        <field id="zomsfpac"          long_name="Meridional Stream-Function: Pacific"          unit="Sv"       grid_ref="grid_W_3D"  />
+        <field id="zomsfind"          long_name="Meridional Stream-Function: Indian"           unit="Sv"       grid_ref="grid_W_3D"  />
+        <field id="zomsfipc"          long_name="Meridional Stream-Function: Pacific+Indian"   unit="Sv"       grid_ref="grid_W_3D"   />
+        <field id="zotemglo"          long_name="Zonal Mean Temperature : Global"              unit="C"        grid_ref="grid_T_3D" />
+        <field id="zotematl"          long_name="Zonal Mean Temperature : Atlantic"            unit="C"        grid_ref="grid_T_3D" />
+        <field id="zotempac"          long_name="Zonal Mean Temperature : Pacific"             unit="C"        grid_ref="grid_T_3D" />
+        <field id="zotemind"          long_name="Zonal Mean Temperature : Indian"              unit="C"        grid_ref="grid_T_3D" />
+        <field id="zotemipc"          long_name="Zonal Mean Temperature : Pacific+Indian"      unit="C"        grid_ref="grid_T_3D" />
+        <field id="zosalglo"          long_name="Zonal Mean Salinity : Global"                 unit="PSU"      grid_ref="grid_T_3D"   />
+        <field id="zosalatl"          long_name="Zonal Mean Salinity : Atlantic"               unit="PSU"      grid_ref="grid_T_3D"   />
+        <field id="zosalpac"          long_name="Zonal Mean Salinity : Pacific"                unit="PSU"      grid_ref="grid_T_3D"   />
+        <field id="zosalind"          long_name="Zonal Mean Salinity : Indian"                 unit="PSU"      grid_ref="grid_T_3D"   />
+        <field id="zosalipc"          long_name="Zonal Mean Salinity : Pacific+Indian"         unit="PSU"      grid_ref="grid_T_3D"   />
+        <field id="zosrfglo"          long_name="Zonal Mean Surface"                           unit="m2"       grid_ref="grid_T_3D"  />
+        <field id="zosrfatl"          long_name="Zonal Mean Surface : Atlantic"                unit="m2"       grid_ref="grid_T_3D"  />
+        <field id="zosrfpac"          long_name="Zonal Mean Surface : Pacific"                 unit="m2"       grid_ref="grid_T_3D"  />
+        <field id="zosrfind"          long_name="Zonal Mean Surface : Indian"                  unit="m2"       grid_ref="grid_T_3D"  />
+        <field id="zosrfipc"          long_name="Zonal Mean Surface : Pacific+Indian"          unit="m2"       grid_ref="grid_T_3D"  />
+        <field id="sophtadv"          long_name="Advective Heat Transport"                     unit="PW"       grid_ref="grid_T_2D" />
+        <field id="sophtldf"          long_name="Diffusive Heat Transport"                     unit="PW"       grid_ref="grid_T_2D" />
+        <field id="sopstadv"          long_name="Advective Salt Transport"                     unit="Giga g/s" grid_ref="grid_T_2D" />
+        <field id="sopstldf"          long_name="Diffusive Salt Transport"                     unit="Giga g/s" grid_ref="grid_T_2D" />
       </field_group>
+
 
       <!-- ptrc on T grid -->
@@ -620,4 +657,8 @@
        <field id="EPSI100"     long_name="Export of Silicate at 100 m"             unit="mol/m2/s"                     />
        <field id="EPCAL100"    long_name="Export of Calcite at 100 m"              unit="mol/m2/s"                     />
+       <field id="EXPC"        long_name="Export of carbon"                        unit="molC/m2/s"  grid_ref="grid_T_3D" />
+       <field id="EXPFE"       long_name="Export of biogenic iron"                 unit="molFe/m2/s" grid_ref="grid_T_3D" />
+       <field id="EXPSI"       long_name="Export of Silicate"                      unit="molSi/m2/s" grid_ref="grid_T_3D" />
+       <field id="EXPCAL"      long_name="Export of Calcite"                       unit="molC/m2/s"  grid_ref="grid_T_3D" />
        <field id="Cflx"        long_name="DIC flux"                                unit="mol/m2/s"                     />
        <field id="Oflx"        long_name="Oxygen flux"                             unit="mol/m2/s"                     />
@@ -629,12 +670,27 @@
        <field id="Ironsed"     long_name="Iron deposition from sediment"           unit="mol/m2/s"  grid_ref="grid_T_3D"/>
 
+
        <!-- PISCES with Kriest parametisation : variables available with key_kriest -->
-       <field id="POCFlx"      long_name="Particulate organic C flux"              unit="mol/m2/s"   grid_ref="grid_T_3D" />
-       <field id="NumFlx"      long_name="Particle number flux"                    unit="nbr/m2/s"   grid_ref="grid_T_3D" />
-       <field id="SiFlx"       long_name="Biogenic Si flux"                        unit="mol/m2/s"   grid_ref="grid_T_3D" />
-       <field id="CaCO3Flx"    long_name="CaCO3 flux"                              unit="mol/m2/s"   grid_ref="grid_T_3D" />
-       <field id="xnum"        long_name="Number of particles in aggregats"        unit="-"          grid_ref="grid_T_3D" />
-       <field id="W1"          long_name="sinking speed of mass flux"              unit="m2/s"       grid_ref="grid_T_3D" />
-       <field id="W2"          long_name="sinking speed of number flux"            unit="m2/s"       grid_ref="grid_T_3D" />
+       <field id="EPN100"      long_name="Particulate number flux at 100 m"        unit="mol/m2/s"                     />
+       <field id="EXPN"        long_name="Particulate number flux"                 unit="mol/m2/s"   grid_ref="grid_T_3D" />
+       <field id="XNUM"        long_name="Number of particles in aggregats"        unit="-"          grid_ref="grid_T_3D" />
+       <field id="WSC"         long_name="sinking speed of mass flux"              unit="m2/s"       grid_ref="grid_T_3D" />
+       <field id="WSN"         long_name="sinking speed of number flux"            unit="m2/s"       grid_ref="grid_T_3D" />
+
+      <!-- dbio_T on T grid : variables available with key_diaar5 -->
+       <field id="TPP"         long_name="Total Primary production of phyto"                   unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="TPNEW"       long_name="New Primary production of phyto"                     unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="TPBFE"       long_name="Total biogenic iron production"                      unit="molFe/m3/s" grid_ref="grid_T_3D" />
+       <field id="INTDIC"      long_name="DIC content"                                         unit="kg/m2"   />
+       <field id="O2MIN"       long_name="Oxygen minimum concentration"                        unit="molC/L" />
+       <field id="ZO2MIN"      long_name="Depth of oxygen minimum concentration"               unit="m"       />
+       <field id="INTNFIX"     long_name="Nitrogen fixation rate : vert. integrated"           unit="molN/m2/s"  />
+       <field id="INTPPPHY"    long_name="Vertically integrated primary production by nanophy" unit="molC/m2/s"  />
+       <field id="INTPPPHY2"   long_name="Vertically integrated primary production by diatom"  unit="molC/m2/s"  />
+       <field id="INTPP"       long_name="Vertically integrated primary production by phyto"   unit="molC/m2/s"  />
+       <field id="INTPNEW"     long_name="Vertically integrated new primary production"        unit="molC/m2/s"  />
+       <field id="INTPBFE"     long_name="Vertically integrated of biogenic iron production"   unit="molFe/m2/s" />
+       <field id="INTPBSI"     long_name="Vertically integrated of biogenic Si production"     unit="molSi/m2/s" />
+       <field id="INTPCAL"     long_name="Vertically integrated of calcite production"         unit="molC/m2/s" />
 
        <!-- PISCES light : variables available with key_pisces_reduced -->
@@ -668,4 +724,17 @@
        <field id="qintC14b"    long_name="Cumulative air-sea flux of Bomb C14"      unit="mol/m2"     />
        <field id="fdecay"      long_name="Radiactive decay of Bomb C14"             unit="mol/m3"  grid_ref="grid_T_3D"  />
+     </field_group>
+
+    <field_group id="PISCES_scalar"  domain_ref="1point" >
+       <field id="pno3tot"         long_name="global mean nitrate concentration"                  unit="mol/l"   />
+       <field id="psiltot"         long_name="global mean silicate concentration"                 unit="mol/l"   />
+       <field id="palktot"         long_name="global mean alkalinity concentration"               unit="mol/l"   />
+       <field id="pfertot"         long_name="global mean iron concentration"                     unit="mol/l"   />
+       <field id="tcflx"           long_name="total Flux of Carbon out of the ocean"              unit="molC/s" />
+       <field id="tcflxcum"        long_name="cumulative total Flux of Carbon out of the ocean"   unit="molC/s" />
+       <field id="tcexp"           long_name="total Carbon export at 100m"                        unit="molC/s" />
+       <field id="tintpp"          long_name="global total integrated primary production"         unit="molC/s" />
+       <field id="tnfix"           long_name="global total nitrogen fixation"                     unit="molN/s" />
+       <field id="tdenit"          long_name="Total denitrification"                              unit="molN/s" />
      </field_group>
 
@@ -734,5 +803,5 @@
     <field_group id="groupU" >
       <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity"      />
-      <field field_ref="suoce"        name="uos"     long_name="sea_surface_x_velocity"    />
+      <field field_ref="ssu"          name="uos"     long_name="sea_surface_x_velocity"    />
       <field field_ref="utau"         name="tauuo"   long_name="surface_downward_x_stress" />
     </field_group>
@@ -740,5 +809,5 @@
     <field_group id="groupV" >
       <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity"      />
-      <field field_ref="svoce"        name="vos"     long_name="sea_surface_y_velocity"    />
+      <field field_ref="ssv"          name="vos"     long_name="sea_surface_y_velocity"    />
       <field field_ref="vtau"         name="tauvo"   long_name="surface_downward_y_stress" />
     </field_group>
@@ -748,3 +817,121 @@
     </field_group>
     
+    <!-- 
+============================================================================================================
+                     Trend diagnostics : temperature, KE, PE, momentum
+============================================================================================================
+    -->
+
+    <field_group id="trendT" grid_ref="grid_T_3D">
+      <!-- variables available with ln_tra_trd -->
+      <field id="ttrd_xad"      long_name="temperature-trend: i-advection"                 unit="degC/s" />
+      <field id="strd_xad"      long_name="salinity   -trend: i-advection"                 unit="psu/s"  />
+      <field id="ttrd_yad"      long_name="temperature-trend: j-advection"                 unit="degC/s" />
+      <field id="strd_yad"      long_name="salinity   -trend: j-advection"                 unit="psu/s"  />
+      <field id="ttrd_zad"      long_name="temperature-trend: k-advection"                 unit="degC/s" />
+      <field id="strd_zad"      long_name="salinity   -trend: k-advection"                 unit="psu/s"  />
+      <field id="ttrd_sad"      long_name="temperature-trend: surface adv. (no-vvl)"       unit="degC/s" grid_ref="grid_T_2D" />
+      <field id="strd_sad"      long_name="salinity   -trend: surface adv. (no-vvl)"       unit="psu/s"  grid_ref="grid_T_2D" />
+      <field id="ttrd_ldf"      long_name="temperature-trend: lateral  diffusion"          unit="degC/s" />
+      <field id="strd_ldf"      long_name="salinity   -trend: lateral  diffusion"          unit="psu/s"  />
+      <field id="ttrd_zdf"      long_name="temperature-trend: vertical diffusion"          unit="degC/s" />
+      <field id="strd_zdf"      long_name="salinity   -trend: vertical diffusion"          unit="psu/s"  />
+      <!-- ln_traldf_iso=T only (iso-neutral diffusion) -->
+      <field id="ttrd_zdfp"     long_name="temperature-trend: pure vert. diffusion"        unit="degC/s" />
+      <field id="strd_zdfp"     long_name="salinity   -trend: pure vert. diffusion"        unit="psu/s"  />
+      <!-- -->
+      <field id="ttrd_dmp"      long_name="temperature-trend: interior restoring"          unit="degC/s" />
+      <field id="strd_dmp"      long_name="salinity   -trend: interior restoring"          unit="psu/s"  />
+      <field id="ttrd_bbl"      long_name="temperature-trend: bottom boundary layer"       unit="degC/s" />
+      <field id="strd_bbl"      long_name="salinity   -trend: bottom boundary layer"       unit="psu/s"  />
+      <field id="ttrd_npc"      long_name="temperature-trend: non-penetrative conv."       unit="degC/s" />
+      <field id="strd_npc"      long_name="salinity   -trend: non-penetrative conv."       unit="psu/s"  />
+      <field id="ttrd_qns"      long_name="temperature-trend: non-solar flux + runoff"     unit="degC/s" />
+      <field id="strd_cdt"      long_name="salinity   -trend: C/D term       + runoff"     unit="degC/s" />
+      <field id="ttrd_qsr"      long_name="temperature-trend: solar penetr. heating"       unit="degC/s" />
+      <field id="ttrd_bbc"      long_name="temperature-trend: geothermal heating"          unit="degC/s" />
+      <field id="ttrd_atf"      long_name="temperature-trend: asselin time filter"         unit="degC/s" />
+      <field id="strd_atf"      long_name="salinity   -trend: asselin time filter"         unit="psu/s"  />
+      <!-- variables available with ln_KE_trd -->
+      <field id="ketrd_hpg"     long_name="ke-trend: hydrostatic pressure gradient"        unit="W/s^3"  />
+      <field id="ketrd_spg"     long_name="ke-trend: surface     pressure gradient"        unit="W/s^3"  />
+      <field id="ketrd_spgexp"  long_name="ke-trend: surface pressure gradient (explicit)" unit="W/s^3"  />
+      <field id="ketrd_spgflt"  long_name="ke-trend: surface pressure gradient (filter)"   unit="W/s^3"  />
+      <field id="ssh_flt"       long_name="filtered contribution to ssh (dynspg_flt)"      unit="m"     grid_ref="grid_T_2D"   />
+      <field id="w0"            long_name="surface vertical velocity"                      unit="m/s"   grid_ref="grid_T_2D"   />
+      <field id="pw0_exp"       long_name="surface pressure flux due to ssh"               unit="W/s^2" grid_ref="grid_T_2D"   />
+      <field id="pw0_flt"       long_name="surface pressure flux due to filtered ssh"      unit="W/s^2" grid_ref="grid_T_2D"   />
+      <field id="ketrd_keg"     long_name="ke-trend: KE gradient         or hor. adv."     unit="W/s^3"  />
+      <field id="ketrd_rvo"     long_name="ke-trend: relative  vorticity or metric term"   unit="W/s^3"  />
+      <field id="ketrd_pvo"     long_name="ke-trend: planetary vorticity"                  unit="W/s^3"  />
+      <field id="ketrd_zad"     long_name="ke-trend: vertical  advection"                  unit="W/s^3"  />
+      <field id="ketrd_udx"     long_name="ke-trend: U.dx[U]"                              unit="W/s^3"  />
+      <field id="ketrd_ldf"     long_name="ke-trend: lateral   diffusion"                  unit="W/s^3"  />
+      <field id="ketrd_zdf"     long_name="ke-trend: vertical  diffusion"                  unit="W/s^3"  />
+      <field id="ketrd_tau"     long_name="ke-trend: wind stress "                         unit="W/s^3" grid_ref="grid_T_2D"   />
+      <field id="ketrd_bfr"     long_name="ke-trend: bottom friction (explicit)"           unit="W/s^3"  />   
+      <field id="ketrd_bfri"    long_name="ke-trend: bottom friction (implicit)"           unit="W/s^3"  />   
+      <field id="ketrd_atf"     long_name="ke-trend: asselin time filter trend"            unit="W/s^3"  />  
+      <field id="ketrd_convP2K" long_name="ke-trend: conversion (potential to kinetic)"    unit="W/s^3"  />
+      <field id="KE"            long_name="kinetic energy: u(n)*u(n+1)/2"                  unit="W/s^2"  />   
+      <!-- variables available with ln_PE_trd -->
+      <field id="petrd_xad"     long_name="pe-trend: i-advection"                          unit="W/m^3"  />
+      <field id="petrd_yad"     long_name="pe-trend: j-advection"                          unit="W/m^3"  />
+      <field id="petrd_zad"     long_name="pe-trend: k-advection"                          unit="W/m^3"  />
+      <field id="petrd_sad"     long_name="pe-trend: surface adv. (no-vvl)"                unit="W/m^3"  grid_ref="grid_T_2D" />
+      <field id="petrd_ldf"     long_name="pe-trend: lateral  diffusion"                   unit="W/m^3"  />
+      <field id="petrd_zdf"     long_name="pe-trend: vertical diffusion"                   unit="W/m^3"  />
+      <field id="petrd_zdfp"    long_name="pe-trend: pure vert. diffusion"                 unit="W/m^3"  />
+      <field id="petrd_dmp"     long_name="pe-trend: interior restoring"                   unit="W/m^3"  />
+      <field id="petrd_bbl"     long_name="pe-trend: bottom boundary layer"                unit="W/m^3"  />
+      <field id="petrd_npc"     long_name="pe-trend: non-penetrative conv."                unit="W/m^3"  />
+      <field id="petrd_nsr"     long_name="pe-trend: surface forcing + runoff"             unit="W/m^3"  />
+      <field id="petrd_qsr"     long_name="pe-trend: solar penetr. heating"                unit="W/m^3"  />
+      <field id="petrd_bbc"     long_name="pe-trend: geothermal heating"                   unit="W/m^3"  />
+      <field id="petrd_atf"     long_name="pe-trend: asselin time filter"                  unit="W/m^3"  />
+      <field id="PEanom"        long_name="potential energy anomaly"                       unit="SI"     />   
+      <field id="alphaPE"       long_name="- partial deriv. of PEanom wrt T"               unit="/degC"  />   
+      <field id="betaPE"        long_name="partial deriv. of PEanom wrt S"                 unit="/psu"   />   
+    </field_group>
+
+    <field_group id="trendU" grid_ref="grid_U_3D">
+     <!-- variables available with ln_dyn_trd -->
+     <field id="utrd_hpg"       long_name="i-trend: hydrostatic pressure gradient"         unit="m/s^2"                      />
+     <field id="utrd_spg"       long_name="i-trend: surface     pressure gradient"         unit="m/s^2"                      />
+     <field id="utrd_spgexp"    long_name="i-trend: surface pressure gradient (explicit)"  unit="m/s^2"                      />
+     <field id="utrd_spgflt"    long_name="i-trend: surface pressure gradient (filtered)"  unit="m/s^2"                      />
+     <field id="utrd_keg"       long_name="i-trend: KE gradient         or hor. adv."      unit="m/s^2"                      />
+     <field id="utrd_rvo"       long_name="i-trend: relative  vorticity or metric term"    unit="m/s^2"                      />
+     <field id="utrd_pvo"       long_name="i-trend: planetary vorticity"                   unit="m/s^2"                      />
+     <field id="utrd_zad"       long_name="i-trend: vertical  advection"                   unit="m/s^2"                      />
+     <field id="utrd_udx"       long_name="i-trend: U.dx[U]"                               unit="m/s^2"                      />
+     <field id="utrd_ldf"       long_name="i-trend: lateral   diffusion"                   unit="m/s^2"                      />
+     <field id="utrd_zdf"       long_name="i-trend: vertical  diffusion"                   unit="m/s^2"                      />
+     <field id="utrd_tau"       long_name="i-trend: wind stress "                          unit="m/s^2" grid_ref="grid_U_2D" />
+     <field id="utrd_bfr"       long_name="i-trend: bottom friction (explicit)"            unit="m/s^2"                      />   
+     <field id="utrd_bfri"      long_name="i-trend: bottom friction (implicit)"            unit="m/s^2"                      />   
+     <field id="utrd_tot"       long_name="i-trend: total momentum trend before atf"       unit="m/s^2"                      />   
+     <field id="utrd_atf"       long_name="i-trend: asselin time filter trend"             unit="m/s^2"                      />   
+    </field_group>
+
+    <field_group id="trendV" grid_ref="grid_V_3D">
+     <!-- variables available with ln_dyn_trd -->
+     <field id="vtrd_hpg"       long_name="j-trend: hydrostatic pressure gradient"         unit="m/s^2"                      />
+     <field id="vtrd_spg"       long_name="j-trend: surface     pressure gradient"         unit="m/s^2"                      />
+     <field id="vtrd_spgexp"    long_name="j-trend: surface pressure gradient (explicit)"  unit="m/s^2"                      />
+     <field id="vtrd_spgflt"    long_name="j-trend: surface pressure gradient (filtered)"  unit="m/s^2"                      />
+     <field id="vtrd_keg"       long_name="j-trend: KE gradient         or hor. adv."      unit="m/s^2"                      />
+     <field id="vtrd_rvo"       long_name="j-trend: relative  vorticity or metric term"    unit="m/s^2"                      />
+     <field id="vtrd_pvo"       long_name="j-trend: planetary vorticity"                   unit="m/s^2"                      />
+     <field id="vtrd_zad"       long_name="j-trend: vertical  advection"                   unit="m/s^2"                      />
+     <field id="vtrd_vdy"       long_name="i-trend: V.dx[V]"                               unit="m/s^2"                      />
+     <field id="vtrd_ldf"       long_name="j-trend: lateral   diffusion"                   unit="m/s^2"                      />
+     <field id="vtrd_zdf"       long_name="j-trend: vertical  diffusion"                   unit="m/s^2"                      />
+     <field id="vtrd_tau"       long_name="j-trend: wind stress "                          unit="m/s^2" grid_ref="grid_V_2D" />
+     <field id="vtrd_bfr"       long_name="j-trend: bottom friction (explicit)"            unit="m/s^2"                      />   
+     <field id="vtrd_bfri"      long_name="j-trend: bottom friction (implicit)"            unit="m/s^2"                      />   
+     <field id="vtrd_tot"       long_name="j-trend: total momentum trend before atf"       unit="m/s^2"                      />   
+     <field id="vtrd_atf"       long_name="j-trend: asselin time filter trend"            unit="m/s^2"                       />   
+    </field_group>
+
     </field_definition>
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_144x142x19
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_144x142x19	(revision 2446)
+++ 	(revision )
@@ -1,54 +1,0 @@
-## $Id$
-## nombre de pas par jour (multiple de iperiod) ( ici pour  dt = 1 min )      
-day_step=720
-## periode pour le pas Matsuno (en pas)
-iperiod=5
-## choix de l'operateur de dissipation (star ou  non star )
-lstardis=y
-## nombre d'iterations de l'operateur de dissipation   gradiv
-nitergdiv=1
-## nombre d'iterations de l'operateur de dissipation  nxgradrot
-nitergrot=2
-## nombre d'iterations de l'operateur de dissipation  divgrad            
-niterh=2
-## temps de dissipation des plus petites long.d ondes pour u,v (gradiv)  
-tetagdiv=3600.
-## temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
-tetagrot=5400.
-## temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
-tetatemp=5400.
-## coefficient pour gamdissip                                            
-coefdis=0.
-## choix du shema d'integration temporelle (Matsuno ou Matsuno-leapfrog) 
-purmats=n
-## avec ou sans physique                                                 
-physic=y
-## periode de la physique (en pas)                                       
-## iphysiq est modifie pour la nouvelle physique par le lmdz.driver pour les autres cas le valeur par defaut est utilise
-iphysiq=_AUTO_ : DEFAULT = 15
-##  Avec ou sans strato
-ok_strato=n
-#  Couche eponge dans les couches de pression plus faible que 100 fois la pression de la derniere couche
-iflag_top_bound=1
-#  Coefficient pour la couche eponge (valeur derniere couche)
-tau_top_bound=1.e-5
-## longitude en degres du centre du zoom                                 
-clon=0.
-## latitude en degres du centre du zoom                                  
-clat=0.
-## facteur de grossissement du zoom,selon longitude                      
-grossismx=1.0
-## facteur de grossissement du zoom ,selon latitude                      
-grossismy=1.0
-##  Fonction  f(y)  hyperbolique  si = .true.  , sinon  sinusoidale         
-fxyhypb=y
-## extension en longitude  de la zone du zoom  ( fraction de la zone totale)
-dzoomx=0.0
-## extension en latitude de la zone  du zoom  ( fraction de la zone totale)
-dzoomy=0.0
-##raideur du zoom en  X
-taux=3.
-##raideur du zoom en  Y
-tauy=3.
-##  Fonction  f(y) avec y = Sin(latit.) si = .true. , sinon y = latit.         
-ysinus=y
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_96x95x19
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_96x95x19	(revision 2446)
+++ 	(revision )
@@ -1,54 +1,0 @@
-## $Id$
-## nombre de pas par jour (multiple de iperiod) ( ici pour  dt = 1 min )      
-day_step=480
-## periode pour le pas Matsuno (en pas)
-iperiod=5
-## choix de l'operateur de dissipation (star ou  non star )
-lstardis=y
-## nombre d'iterations de l'operateur de dissipation   gradiv
-nitergdiv=1
-## nombre d'iterations de l'operateur de dissipation  nxgradrot
-nitergrot=2
-## nombre d'iterations de l'operateur de dissipation  divgrad            
-niterh=2
-## temps de dissipation des plus petites long.d ondes pour u,v (gradiv)  
-tetagdiv=5400.
-## temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
-tetagrot=7200.
-## temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
-tetatemp=7200.
-## coefficient pour gamdissip                                            
-coefdis=0.
-## choix du shema d'integration temporelle (Matsuno ou Matsuno-leapfrog) 
-purmats=n
-## avec ou sans physique                                                 
-physic=y
-## periode de la physique (en pas)                                       
-## iphysiq est modifie pour la nouvelle physique par le lmdz.driver pour les autres cas le valeur par defaut est utilise
-iphysiq=_AUTO_ : DEFAULT = 10
-##  Avec ou sans strato
-ok_strato=n
-#  Couche eponge dans les couches de pression plus faible que 100 fois la pression de la derniere couche
-iflag_top_bound=1
-#  Coefficient pour la couche eponge (valeur derniere couche)
-tau_top_bound=1.e-5
-## longitude en degres du centre du zoom                                 
-clon=0.
-## latitude en degres du centre du zoom                                  
-clat=0.
-## facteur de grossissement du zoom,selon longitude                      
-grossismx=1.0
-## facteur de grossissement du zoom ,selon latitude                      
-grossismy=1.0
-##  Fonction  f(y)  hyperbolique  si = .true.  , sinon  sinusoidale         
-fxyhypb=y
-## extension en longitude  de la zone du zoom  ( fraction de la zone totale)
-dzoomx=0.0
-## extension en latitude de la zone  du zoom  ( fraction de la zone totale)
-dzoomy=0.0
-##raideur du zoom en  X
-taux=3.
-##raideur du zoom en  Y
-tauy=3.
-##  Fonction  f(y) avec y = Sin(latit.) si = .true. , sinon y = latit.         
-ysinus=y
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/iodef.xml_v32
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/iodef.xml_v32	(revision 2446)
+++ 	(revision )
@@ -1,720 +1,0 @@
-<?xml version="1.0"?>
-<simulation> 
-  
-  <context id="nemo">
-
-    <!-- $id$ -->
-    
-    <!-- 
-============================================================================================================
-=                                  definition of all existing variables                                    =
-=                                            DO NOT CHANGE                                                 =
-============================================================================================================
-    -->
-    
-    <field_definition level="0" prec="4" operation="ave(X)" enabled=".TRUE."> <!-- time step automaticaly defined -->
-
-      <!-- T grid -->
-      
-      <group id="grid_T" axis_ref="none" grid_ref="grid_T">
-	<field id="toce"         description="temperature"                               unit="degC" axis_ref="deptht"   />
-       	<field id="soce"         description="salinity"                                  unit="psu"  axis_ref="deptht"   />
-	<field id="sst"          description="sea surface temperature"                   unit="degC"                     />
-	<field id="sst2"         description="square of sea surface temperature"         unit="degC2"                    />
-	<field id="|sstgrad|"    description="module of sst gradient"                    unit="degC/m"                   />
-	<field id="|sstgrad|2"   description="square of module of sst gradient"          unit="degC2/m2"                 />
-	<field id="sss"          description="sea surface salinity"                      unit="psu"                      />
-	<field id="sss2"         description="square of sea surface salinity"            unit="psu2"                     />
-	<field id="ssh"          description="sea surface height"                        unit="m"                        />
-	<field id="ssh2"         description="square of sea surface height"              unit="m2"                       />
-	<field id="mldkz5"       description="mixing layer depth (Turbocline)"           unit="m"                        />
-	<field id="mldr10_1"     description="Mixed Layer Depth 0.01 ref.10m"            unit="m"                        />
-       	<field id="rhop"         description="potential density (sigma0)"                unit="kg/m3" axis_ref="deptht"  />
-	<!-- next variables available with key_diahth -->
-	<field id="mlddzt"       description="Thermocline Depth (max dT/dz)"             unit="m"                        />
-	<field id="mldr10_3"     description="Mixed Layer Depth dr=0.03 (ref.10m)"       unit="m"                        />
-	<field id="mldr0_1"      description="Mixed Layer Depth dr=0.01 (ref.surf)"      unit="m"                        />
-	<field id="mldr0_3"      description="Mixed Layer Depth dr=0.03 (ref.surf)"      unit="m"                        />
-	<field id="mld|dt|"      description="Mixed Layer Depth |dt|=0.2 (ref.10m)"      unit="m"                        />
-	<field id="topthdep"     description="Top of the thermocline dt=-0.2 (ref.10m)"  unit="m"                        />
-	<field id="pycndep"      description="Pycnocline depth dr~dt=-0.2 (ref.10m)"     unit="m"                        />
-	<field id="BLT"          description="Barrier Layer Thickness"                   unit="m"                        />
-	<field id="tinv"         description="Max of vertical invertion of temperature"  unit="degC"                     />
-	<field id="depti"        description="Depth of max. vert. inv. of temperature"   unit="m"                        />
-	<field id="20d"          description="Depth of 20C isotherm"                     unit="m"                        />
-	<field id="28d"          description="Depth of 28C isotherm"                     unit="m"                        />
-	<field id="hc300"        description="Heat content 300 m"                        unit="W"                        />
-	<!-- variables available with key_diaar5 -->
-	<field id="botpres"      description="Pressure at sea floor"                     unit="dbar"                     />
-	<field id="cellthc"      description="Cell thickness"                            unit="m"     axis_ref="deptht"  />
-     </group>
-
-      <!-- SBC -->
-      
-      <group id="SBC" axis_ref="none" grid_ref="grid_T" > <!-- time step automaticaly defined based on nn_fsbc -->
-
-	<field id="emp"          description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
-	<field id="emps"         description="concentration/dilution water flux"                            unit="kg/m2/s"  />
-	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
-	<field id="runoffs"      description="River Runoffs"                                                unit="kg/m2/s"  />
-
-	<field id="qns+qsr"      description="Net Downward Heat Flux"                                       unit="W/m2"     />
-	<field id="qns"          description="non solar Downward Heat Flux"                                 unit="W/m2"     />
-	<field id="qsr"          description="Shortwave Radiation"                                          unit="W/m2"     />
-	<field id="qsr3d"        description="Shortwave Radiation 3D distribution"        axis_ref="deptht" unit="W/m2"     />
-	<field id="qrp"          description="Surface Heat Flux: Damping"                                   unit="W/m2"     />
-	<field id="erp"          description="Surface Water Flux: Damping"                                  unit="kg/m2/s"  />
-	<field id="taum"         description="wind stress module"                                           unit="N/m2"     />
-	<field id="wspd"         description="Wind speed module at 10 m"                                    unit="m/s"      />
-	
-	<!-- *_oce variables available with ln_blk_clio or ln_blk_core -->
-	<field id="qns_oce"      description="Non solar Downward Heat Flux over open ocean"                 unit="W/m2"     />
-	<field id="qlw_oce"      description="Longwave Downward Heat Flux over open ocean"                  unit="W/m2"     />
-	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
-	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
-	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
-
-	<field id="ice_cover"    description="Ice fraction"                                                 unit="1"        />
-
-	<field id="ioceflxb"     description="Oceanic flux at the ice base"                                 unit="W/m2"     />
-	<field id="qsr_ai_cea"   description="Air-Ice downward solar heat flux (cell average)"              unit="W/m2"     />
-	<field id="qns_ai_cea"   description="Air-Ice downward non-solar heat flux (cell average)"          unit="W/m2"     />
-	<field id="qla_ai_cea"   description="Air-Ice downward Latent heat flux (cell average)"             unit="W/m2"     />
-	
-	<field id="qsr_io_cea"   description="Ice-Oce downward solar heat flux (cell average)"              unit="W/m2"     />
-	<field id="qns_io_cea"   description="Ice-Oce downward non-solar heat flux (cell average)"          unit="W/m2"     />
-	
-	<field id="snowthic_cea" description="Snow thickness (cell average)"                                unit="m"        />
-	<field id="icethic_cea"  description="Ice thickness (cell average)"                                 unit="m"        />
-	<field id="iceprod_cea"  description="Ice production (cell average)"                                unit="m/s"      />
-        <field id="sim"          description="Sea Ice Plus Surface Snow Amount"                             unit="kg/m2"    />
-	
-	<field id="ice_pres"     description="Ice presence"                                                 unit="-"        />
-	<field id="ist_cea"      description="Ice surface temperature (cell average)"                       unit="degC"     />
-	<field id="ist_ipa"      description="Ice surface temperature (ice presence average)"               unit="degC"     />      
-	<field id="uice_ipa"     description="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />      
-	<field id="vice_ipa"     description="Ice velocity along j-axis at I-point (ice presence average)"  unit="m/s"      />      
-	
-	<field id="utau_ice"     description="Wind stress along i-axis over the ice at i-point"             unit="N/m2"     />
-	<field id="vtau_ice"     description="Wind stress along j-axis over the ice at i-point"             unit="N/m2"     />
-	
-	<field id="u_imasstr"    description="Sea-ice mass transport along i-axis"                          unit="kg/s"     />
-	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
-
-	<!-- available key_coupled -->
-	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
-	<field id="snow_ai_cea"  description="Snow over sea-ice (cell average)"                             unit="kg/m2/s"  />
-	<field id="subl_ai_cea"  description="Sublimation over sea-ice (cell average)"                      unit="kg/m2/s"  />
-	<field id="icealb_cea"   description="Ice albedo (cell average)"                                    unit="1"        />
-	<field id="calving"      description="Calving"                                                      unit="kg/m2/s"  />
-	<!-- available if key_coupled + conservative method -->
-	<field id="rain"         description="Liquid precipitation"                                         unit="kg/m2/s"  />
-	<field id="evap_ao_cea"  description="Evaporation over ice-free ocean (cell average)"               unit="kg/m2/s"  />
-	<!-- variables available with key_diaar5 -->
-	<field id="isnwmlt_cea"   description="Snow over Ice melting (cell average)"                        unit="kg/m2/s"  />
-	<field id="fsal_virt_cea" description="Virtual salt flux due to ice formation (cell average)"       unit="kg/m2/s"  />
-	<field id="fsal_real_cea" description="Real salt flux due to ice formation (cell average)"          unit="kg/m2/s"  />
-	<field id="hflx_rain_cea" description="heat flux due to rainfall"                                   unit="W/m2"     />
-	<field id="hflx_evap_cea" description="heat flux due to evaporation"                                unit="W/m2"     />
-	<field id="hflx_snow_cea" description="heat flux due to snow falling over ice-free ocean"           unit="W/m2"     />
-	<field id="hflx_ice_cea"  description="heat flux due to ice thermodynamics"                         unit="W/m2"     />
-	<field id="hflx_rnf_cea"  description="heat flux due to runoffs"                                    unit="W/m2"     />
-	<field id="hflx_cal_cea"  description="heat flux due to calving"                                    unit="W/m2"     />
-	<field id="bicemel_cea"  description="Rate of Melt at Sea Ice Base (cell average)"                  unit="kg/m2/s"  />
-	<field id="licepro_cea"  description="Lateral Sea Ice Growth Rate (cell average)"                   unit="kg/m2/s"  />
-	<field id="snowmel_cea"  description="Snow Melt Rate (cell average)"                                unit="kg/m2/s"  />
-	<field id="sntoice_cea"  description="Snow-Ice Formation Rate (cell average)"                       unit="kg/m2/s"  />
-	<field id="ticemel_cea"  description="Rate of Melt at Upper Surface of Sea Ice (cell average)"      unit="kg/m2/s"  />
-
-      </group>
-
-      <!-- U grid -->
-      
-      <group id="grid_U"  axis_ref="depthu" grid_ref="grid_U">
-	<field id="utau"         description="Wind Stress along i-axis"                    unit="N/m2" axis_ref="none" />
-	<field id="uoce"         description="ocean current along i-axis"                  unit="m/s"                  />
-	<field id="uoce_eff"     description="Effective ocean current along i-axis"        unit="m/s"                  />
-	<!-- uoce_eiv: available with key_traldf_eiv and key_diaeiv -->
-	<field id="uoce_eiv"     description="EIV ocean current along i-axis"              unit="m/s"                  />
-	<!-- uoce_eiv: available with key_trabbl_adv -->
-	<field id="uoce_bbl"     description="BBL ocean current along i-axis"              unit="m/s"                  />
- 	<!-- variables available with key_diaar5 -->
-	<field id="u_masstr"     description="ocean eulerian mass transport along i-axis"  unit="kg/s"                 />
-	<field id="u_heattr"     description="ocean eulerian heat transport along i-axis"  unit="W"    axis_ref="none" />
-	<field id="ueiv_heattr"  description="ocean bolus heat transport along i-axis"     unit="W"    axis_ref="none" />
-	<field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W"    axis_ref="none" />
-     </group>
-      
-      <!-- V grid -->
-      
-      <group id="grid_V"  axis_ref="depthv" grid_ref="grid_V">
-	<field id="vtau"         description="Wind Stress along j-axis"                    unit="N/m2" axis_ref="none" />
-	<field id="voce"         description="ocean current along j-axis"                  unit="m/s"                  />
-	<field id="voce_eff"     description="Effective ocean current along j-axis"        unit="m/s"                  />
-	<!-- voce_eiv: available with key_traldf_eiv and key_diaeiv -->
-	<field id="voce_eiv"     description="EIV ocean current along j-axis"              unit="m/s"                  />
-	<!-- voce_eiv: available with key_trabbl_adv -->
-	<field id="voce_bbl"     description="BBL ocean current along j-axis"              unit="m/s"                  />
-	<!-- variables available with key_diaar5 -->
-	<field id="v_masstr"     description="ocean eulerian mass transport along j-axis"  unit="kg/s"                 />
-	<field id="v_heattr"     description="ocean eulerian heat transport along j-axis"  unit="W"    axis_ref="none" />
-	<field id="veiv_heattr"  description="ocean bolus heat transport along j-axis"     unit="W"    axis_ref="none" />
-	<field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W"    axis_ref="none" />
-      </group>
-      
-      <!-- W grid -->
-      
-      <group id="grid_W"  axis_ref="depthw" grid_ref="grid_W">
-	<field id="woce"         description="ocean vertical velocity"                     unit="m/s"                  />
-	<field id="woce_eff"     description="effective ocean vertical velocity"           unit="m/s"                  />
-	<!-- woce_eiv: available with key_traldf_eiv and key_diaeiv -->
-	<field id="woce_eiv"     description="EIV ocean vertical velocity"                 unit="m/s"                  />
-	<!-- woce_eiv: available with key_trabbl_adv -->
-	<field id="woce_bbl"     description="BBL ocean vertical velocity"                 unit="m/s"                  />
-	<field id="avt"          description="vertical eddy diffusivity"                   unit="m2/s"                 />
-	<field id="avm"          description="vertical eddy viscosity"                     unit="m2/s"                 />
-	<!-- avs: available with key_zdfddm -->
-	<field id="avs"          description="salt vertical eddy diffusivity"              unit="m2/s"                 />
-	<!-- avt_evd and avm_evd: available with ln_zdfevd -->
-	<field id="avt_evd"      description="enhanced vertical diffusivity"               unit="m2/s"                 />
-	<field id="avm_evd"      description="enhanced vertical viscosity"                 unit="m2/s"                 />
-	<!-- aht2d and  aht2d_eiv: available with key_traldf_eiv and key_traldf_c2d -->
-	<field id="aht2d"        description="lateral eddy diffusivity"                    unit="m2/s" axis_ref="none" />
-	<field id="aht2d_eiv"    description="EIV lateral eddy diffusivity"                unit="m2/s" axis_ref="none" />
-	<!-- avt_tide: available with key_zdftmx -->
-	<field id="av_tide"      description="tidal vertical diffusivity"                  unit="m2/s"                 />
-	<!-- variables available with key_diaar5 -->   
-	<field id="w_masstr"     description="vertical mass trasport"                      unit="kg/s"                 />
-	<field id="w_masstr2"    description="square of vertical mass trasport"            unit="kg2/s2"               />
-      </group>
-          
-      <!-- scalar -->
-      
-      <!-- variables available with key_diaar5 -->
-      <group id="scalar" axis_ref="none" grid_ref="scalarpoint" zoom_ref="1point" >
-	<field id="voltot"     description="global mean volume"                         unit="m3"   />
-	<field id="sshtot"     description="global mean ssh"                            unit="m"    />
-	<field id="sshsteric"  description="global mean ssh steric"                     unit="m"    />
-	<field id="sshthster"  description="global mean ssh thermosteric"               unit="m"    />
-	<field id="masstot"    description="global mean mass"                           unit="kg"   />
-	<field id="temptot"    description="global mean temperature"                    unit="degC" />
-	<field id="saltot"     description="global mean salinity"                       unit="psu"  />
-	<field id="fram_trans" description="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
-      </group>
-
-      <!-- ptrc on T grid -->
-          
-     <group id="ptrc_T" axis_ref="deptht" grid_ref="grid_T">  
-       <field id="DIC"      description="Dissolved inorganic Concentration"        unit="molC/L" />
-       <field id="Alkalini" description="Total Alkalinity Concentration"           unit="eq/L"    />
-       <field id="O2"       description="Oxygen Concentration"                     unit="molO2/L" />
-       <field id="CaCO3"    description="Calcite Concentration"                    unit="molC/L" />
-       <field id="PO4"      description="Phosphate Concentration"                  unit="molC/L" />
-       <field id="POC"      description="Small organic carbon Concentration"       unit="molC/L" />
-       <field id="Si"       description="Silicate Concentration"                   unit="molSi/L" />
-       <field id="PHY"      description="Nanophytoplankton Concentration"          unit="molC/L" />
-       <field id="ZOO"      description="Microzooplankton Concentration"           unit="molC/L" />
-       <field id="DOC"      description="Dissolved organic Concentration"          unit="molC/L" />
-       <field id="PHY2"     description="Diatoms Concentration"                    unit="molC/L" />
-       <field id="ZOO2"     description="Mesozooplankton Concentration"            unit="molC/L" />
-       <field id="BSi"      description="Diatoms Silicate Concentration"           unit="molC/L" />
-       <field id="Fer"      description="Dissolved Iron Concentration"             unit="molFe/L" />
-       <field id="BFe"      description="Big iron particles Concentration"         unit="molFe/L" />
-       <field id="GOC"      description="Big organic carbon Concentration"         unit="molC/L" />
-       <field id="SFe"      description="Small iron particles Concentration"       unit="molFe/L" />
-       <field id="DFe"      description="Diatoms iron  Concentration"              unit="molFe/L" />
-       <field id="DSi"      description="Sinking biogenic Silicate Concentration"  unit="molC/L" />
-       <field id="NFe"      description="Nano iron Concentration"                  unit="molC/L" />
-       <field id="NCHL"     description="Nano chlorophyl Concentration"            unit="gChl/L" />
-       <field id="DCHL"     description="Diatoms chlorophyl Concentration"         unit="gChl/L" />
-       <field id="NO3"      description="Nitrates Concentration"                   unit="molC/L" />
-       <field id="NH4"      description="Ammonium Concentration"                   unit="molC/L" />
-     </group>
-
-      <!-- diad on T grid : : variables available with key_trc_diaadd && key_trc_dia3d -->
-
-     <group id="diad_T" axis_ref="none" grid_ref="grid_T">
-       <field id="PH"          description="PH"                                       unit="-"           axis_ref="deptht" />
-       <field id="CO3"         description="Bicarbonates"                             unit="mol/L"       axis_ref="deptht" />
-       <field id="CO3sat"      description="CO3 saturation"                           unit="mol/L"       axis_ref="deptht" />
-       <field id="PAR"         description="Photosynthetically Available Radiation"   unit="W/m2"        axis_ref="deptht" />
-       <field id="PPPHY"       description="Primary production of nanophyto"          unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="PPPHY2"      description="Primary production of diatoms"            unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWN"      description="New Primary production of nanophyto"      unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="PPNEWD"      description="New Primary production of diatoms"        unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="PBSi"        description="Primary production of Si diatoms"         unit="molSi/m3/s"  axis_ref="deptht" />
-       <field id="PFeN"        description="Primary production of nano iron"          unit="molFe/m3/s"  axis_ref="deptht" />
-       <field id="PFeD"        description="Primary production of diatoms iron"       unit="molFe/m3/s"  axis_ref="deptht" />
-       <field id="PCAL"        description="Calcite production"                       unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="DCAL"        description="Calcite dissolution"                      unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="GRAZ"        description="Grazing by zooplankton"                   unit="molC/m3/s"   axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="molN/m2/s"      />
-       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="molC/m2/s"      />
-       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="molFe/m2/s"     />
-       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="molSi/m2/s"     />
-       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="molC/m2/s"      />
-       <field id="Cflx"        description="DIC flux"                                 unit="molC/m2/s"      />
-       <field id="Oflx"        description="Oxygen flux"                              unit="molC/m2/s"      />
-       <field id="Kg"          description="Gas transfer"                             unit="molC/m2/s/uatm" />
-       <field id="Dpco2"       description="Delta CO2"                                unit="uatm"            />
-       <field id="Dpo2"        description="Delta O2"                                 unit="uatm"            />
-       <field id="Heup"        description="Euphotic layer depth"                     unit="m"               />
-       <field id="Irondep"     description="Iron deposition"                          unit="molFe/m2/s"     />
-     </group>
-
-      <!-- dbio_T on T grid : variables available with key_diaar5 -->
-     <group id="dbio_T" axis_ref="none" grid_ref="grid_T">
-       <field id="PHYT"        description="Total phytoplankton Concentration"                   unit="molC/L"     axis_ref="deptht" />
-       <field id="ZOOT"        description="Total zooplankton Concentration"                     unit="molC/L"     axis_ref="deptht" />
-       <field id="CHLT"        description="Total chlorophyll Concentration"                     unit="gChl/L"     axis_ref="deptht" />
-       <field id="POCT"        description="Total carbon particles Concentration"                unit="molC/L"     axis_ref="deptht" />
-       <field id="PFET"        description="Total biogenic Iron Concentration"                   unit="molFe/L"     axis_ref="deptht" />
-       <field id="TPP"         description="Total Primary production of phyto"                   unit="molC/m3/s"  axis_ref="deptht" />
-       <field id="TPNEW"       description="New Primary production of phyto"                     unit="molC/m3/s"  axis_ref="deptht" />
-       <field id="TPBFE"       description="Total biogenic iron production"                      unit="molFe/m3/s" axis_ref="deptht" />
-       <field id="EXPC"        description="Export of carbon"                                    unit="molC/m2/s"  axis_ref="deptht" />
-       <field id="EXPFE"       description="Export of biogenic iron"                             unit="molFe/m2/s" axis_ref="deptht" />
-       <field id="EXPSI"       description="Export of Silicate"                                  unit="molSi/m2/s" axis_ref="deptht" />
-       <field id="EXPCAL"      description="Export of Calcite"                                   unit="molC/m2/s"  axis_ref="deptht" />
-       <field id="PHSFC"       description="PH at surface"                                       unit="-"       />
-       <field id="INTDIC"      description="DIC content"                                         unit="kg/m2"   />
-       <field id="O2MIN"       description="Oxygen minimum concentration"                        unit="molC/L" />
-       <field id="ZO2MIN"      description="Depth of oxygen minimum concentration"               unit="m"       />
-       <field id="INTNFIX"     description="Nitrogen fixation rate : vert. integrated"           unit="molN/m2/s"  />
-       <field id="INTPPPHY"    description="Vertically integrated primary production by nanophy" unit="molC/m2/s"  />
-       <field id="INTPPPHY2"   description="Vertically integrated primary production by diatom"  unit="molC/m2/s"  />
-       <field id="INTPP"       description="Vertically integrated primary production by phyto"   unit="molC/m2/s"  />
-       <field id="INTPNEW"     description="Vertically integrated new primary production"        unit="molC/m2/s"  />
-       <field id="INTPBFE"     description="Vertically integrated of biogenic iron production"   unit="molFe/m2/s" />
-       <field id="INTPBSI"     description="Vertically integrated of biogenic Si production"     unit="molSi/m2/s" />
-       <field id="INTPCAL"     description="Vertically integrated of calcite production"         unit="molSi/m2/s" />
-     </group>
-
-    </field_definition>
-    
-    <!-- 
-============================================================================================================
-=                                                                                                          =
-=                                           output files definition                                        =
-=                                                                                                          =
-=                  http://www2-pcmdi.llnl.gov/svn/repository/cmor/trunk/Tables/CMIP5_Oclim                 =
-=                  http://www2-pcmdi.llnl.gov/svn/repository/cmor/trunk/Tables/CMIP5_Omon                  =
-=                  http://www2-pcmdi.llnl.gov/svn/repository/cmor/trunk/Tables/CMIP5_Oimon                 =              
-=          http://www.clivar.org/organization/wgomd/references/WGOMD_CMIP5_ocean_fields.June2009.pdf       =
-=                                                                                                          =
-============================================================================================================
-    -->
-    
-    <file_definition output_level="<OUTPUT_LEVEL>" >
-      <!--
-+++++++++++++++++++++++++++++++++++++++++++++++   daily   ++++++++++++++++++++++++++++++++++++++++++++++++++
-        -->
-      <group id="1d" output_freq="86400"  enabled="<1D_ENABLE>">                             <!-- 1d files -->
-	<!--
-..............................................    grid T   .................................................
-	  -->
-	<file id="ORCA2_1d_grid_T" description="table 2.2" >                                 <!-- grid T  Table 2.2 -->
-	  <field ref="sst"          name="sosstsst" description="sea_surface_temperature"                              level="2"                      />
-	  <field ref="sst2"         name="tossq"    description="square_of_sea_surface_temperature"                    level="2"                      />
-	  <field ref="mldkz5"       name="omldamax" description="ocean_mixed_layer_thickness_defined_by_mixing_scheme" level="2" operation="t_max(X)" />
-         <!--  IPSL variables -->
-	  <field ref="sss"          name="sosaline" description="sea_surface_salinity"                                 level="3"                      />
-	  <field ref="ssh"          name="sossheig" description="sea_surface_height_above_geoid"                       level="3"                      />
-	  <field ref="toce"         name="votemper" description="sea_water_potential_temperature"                      level="3"                      />
-	  <field ref="soce"         name="vosaline" description="sea_water_salinity"                                   level="3"                      />
-	</file> 
-	<!--
-..............................................    grid U   .................................................
-	  -->
-	<file id="ORCA2_1d_grid_U" description="ocean U grid variables : table 2.3" >                       <!-- grid U -->
-
-	  <!--  table 2.3 -->
-	    <field ref="uoce"         name="vozocrtx" description="sea_water_x_velocity"                                level="3"       />
-
-	</file> 
-
-	<!--
-..............................................    grid V   .................................................
-	  -->
-	<file id="ORCA2_1d_grid_V" description="ocean V grid variables : table 2.3" >                      <!-- grid V -->
-
-	  <!-- table 2.3 -->
-	    <field ref="voce"         name="vomecrty" description="sea_water_y_velocity"                                level="3"       />
-
-	</file>   
-  
-	<!--
-..............................................    icemod   .................................................
-	  -->
-	<file id="ORCA2_1d_icemod" description=" ice variables" >                                           <!-- icemod -->
-
-         <!-- table 2.2 -->
-          <field ref="uice_ipa"     name="iicevelu"   description="Ice velocity along i-axis at I-point (ice presence average)"  level="2"    />
-          <field ref="vice_ipa"     name="iicevelv"   description="Ice velocity along j-axis at I-point (ice presence average)"  level="2"    />
-          <field ref="ice_cover"    name="ileadfra"   description="sea_ice_area_fraction"                                        level="2"    />
-	  <field ref="icethic_cea"  name="iicethic"   description="sea_ice_thickness"                                            level="2"    />
-	</file>   
-
-      </group>
-	<!--
-++++++++++++++++++++++++++++++++++++++++++++++   monthly   +++++++++++++++++++++++++++++++++++++++++++++++++
-	  -->
-      <group id="1m" output_freq="-1"     enabled="<1M_ENABLE>">                             <!-- real monthly files -->
-	<!--
-..............................................    grid T   .................................................
-	  -->
-	<file id="ORCA2_1m_grid_T" description="ocean T grid variables table 2.2 2.5 2.6 2.7"> <!-- grid T -->
-
-          <!-- table 2.2 -->
-	    <field ref="botpres"      name="pbo"      description="sea_water_pressure_at_sea_floor"                               />
-	    <!-- pso : sea_water_pressure_at_sea_water_surface = 0 -->
-	    <field ref="ssh"          name="sossheig" description="sea_surface_height_above_geoid"                                 />
-	    <field ref="ssh2"         name="zossq"    description="square_of_sea_surface_height_above_geoid"             level="2" />
-	    <!-- masscello : sea_water_mass_per_unit_area = cellthc*rau0                                          no time changes -->
-	    <field ref="cellthc"      name="thkcello" description="cell_thickness"                                                 /> <!-- no time changes -->
-	    <field ref="toce"         name="votemper" description="sea_water_potential_temperature"                                />
-	    <field ref="sst"          name="sosstsst" description="sea_surface_temperature"                              level="1" />
-	    <field ref="sst2"         name="tossq"    description="square_of_sea_surface_temperature"                    level="2" />
-	    <field ref="soce"         name="vosaline" description="sea_water_salinity"                                             />
-	    <field ref="sss"          name="sosaline" description="sea_surface_salinity"                                 level="1" />
-	    <field ref="rhop"         name="rhopoto"  description="sea_water_potential_density"                          level="2" />
-	    <!-- no agessc : sea_water_age_since_surface_contact -->
-	    <!-- no cfc11  : moles_per_unit_mass_of_cfc11_in_sea_water -->
-	    <!-- msftbarot : ocean_barotropic_mass_streamfunction : offline -->
-	    <!-- mlotst    :           ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
-	    <!-- mlotstsq  : square_of_ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
-	    <field ref="mldkz5"       name='omlmax'   description="ocean_mixed_layer_thickness_defined_by_mixing_scheme" level="2" operation="t_max(X)" />
-
-          <!-- table 2.5 -->
-	    <field ref="rain"         name="pr"       description="rainfall_flux"                                           level="1" />
-	    <field ref="snow_ao_cea"  name="prsn"     description="snowfall_flux"                                           level="1" />
-	    <field ref="evap_ao_cea"  name="evs"      description="water_evaporation_flux"                                  level="1" />
-	    <field ref="runoffs"      name="friver"   description="water_flux_into_sea_water_from_rivers"                   level="1" />
-	    <field ref="calving"      name="ficeberg" description="water_flux_into_sea_water_from_icebergs"                 level="1" />
-	    <field ref="isnwmlt_cea"  name="fsitherm" description="water_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
-	    <field ref="emp"          name="sowaflup" description="water_flux_into_sea_water"                               level="1" />
-	    <!-- wfonocorr : water_flux_into_sea_water_without_flux_correction : emp - erp -->  
-	    <field ref="erp"          name="wfcorr"   description="water_flux_correction"                                   level="1" /> <!-- usually = 0 -->
-
-          <!-- table2.6 -->
-	    <!-- vsfpr    : virtual_salt_flux_into_sea_water_due_to_rainfall    = 0 --> 
-	    <!-- vsfevap  : virtual_salt_flux_into_sea_water_due_to_evaporation = 0 --> 
-	    <!-- vsfriver : virtual_salt_flux_into_sea_water_from_rivers        = 0 --> 	  
-	    <field ref="fsal_virt_cea" name="vsfsit" description="virtual_salt_flux_into_sea_water_due_to_sea_ice_thermodynamics" level="1" />
-	    <!-- vsf      : virtual_salt_flux_into_sea_water = fsal_virtual + fsal_real -->
-	    <!-- wfcorr   : virtual_salt_flux_correction                        = 0 --> 
-	    <field ref="fsal_virt_cea" name="sfdsi"  description="downward_sea_ice_basal_salt_flux"                               level="1" />
-	    <!-- sfriver  : salt_flux_into_sea_water_from_rivers                = 0 --> 
-
-          <!--  table 2.7 -->
-	    <!-- hfgeou : upward_geothermal_heat_flux_at_sea_floor : cte, see nambbc and trabbc.F90 -->
-	    <field ref="hflx_rain_cea" name="hfrainds"    description="temperature_flux_due_to_rainfall_expressed_as_heat_flux_into_sea_water"      level="1" />
-	    <field ref="hflx_evap_cea" name="hfevapds"    description="temperature_flux_due_to_evaporation_expressed_as_heat_flux_out_of_sea_water" level="1" />
-	    <field ref="hflx_rnf_cea"  name="hfrunoffds"  description="temperature_flux_due_to_runoff_expressed_as_heat_flux_into_sea_water"        level="1" />
-	    <field ref="hflx_snow_cea" name="hfsnthermds" description="heat_flux_into_sea_water_due_to_snow_thermodynamics"                         level="1" />
-	    <field ref="hflx_ice_cea"  name="hfsithermds" description="heat_flux_into_sea_water_due_to_sea_ice_thermodynamics"                      level="1" />
-	    <field ref="hflx_cal_cea"  name="hfibthermds" description="heat_flux_into_sea_water_due_to_iceberg_thermodynamics"                      level="1" />
-	    <!-- rlds   : surface_net_downward_longwave_flux : not available -->
-	    <!-- hfls   : surface_downward_latent_heat_flux  : not available -->
-	    <!-- hfss   : surface_downward_sensible_heat_flux: not available -->
-	    <field ref="qns"           name="nshfls"      description="surface_net_downward_non_solar_flux"                                         level="1" />
-	    <field ref="qsr"           name="soshfldo"    description="surface_net_downward_shortwave_flux"                                         level="1" />
-	    <field ref="qsr3d"         name="rsds"        description="downwelling_shortwave_flux_in_sea_water"                                     level="1" />
-	    <field ref="qrp"           name="hfcorr"      description="heat_flux_correction"                                                        level="1" />
-
-         <!--  IPSL variables -->
-        <field ref="qns+qsr"           name="sohefldo"    description="Net Downward Heat Flux"                                   />
-	<field ref="20d"               name="so20chgt"    description="Depth of 20C isotherm"                                    />
-	<field ref="28d"               name="so28chgt"    description="Depth of 28C isotherm"                                    />
-	<field ref="hc300"             name="sohtc300"    description="Heat content 300 m"                                       />
-	<field ref="mldr10_1"          name="somxl010"    description="Mixed Layer Depth 0.01 ref.10m"                           />
-	<field ref="mldr10_3"          name="somx3010"    description="Mixed Layer Depth dr=0.03 (ref.10m)"                      />
-	<field ref="mldkz5"            name="somixhgt"    description="mixing layer depth (Turbocline)"                          />
-	<field ref="emps"              name="sowaflcd"    description="concentration/dilution water flux"                        />
-	<field ref="taum"              name="sotaumod"    description="Wind stress module"                                       />
-	<field ref="wspd"              name="sowindsp"    description="Wind speed module at 10 m"                                />
-	<field ref="ice_cover"         name="soicecov"    description="sea_ice_area_fraction"                                    />
-	<field ref="BLT"               name="blt"         description="Barrier Layer Thickness"                    level="3"     />
-	<field ref="mld|dt|"           name="mld_dt02"    description="Mixed Layer Depth |dt|=0.2 (ref.10m)"       level="3"     />
-
-	  </file>   
-	<!--
-..............................................    grid U   .................................................
-	  -->
-	<file id="ORCA2_1m_grid_U" description="ocean U grid variables : table 2.3 2.8" >                       <!-- grid U -->
-
-	  <!--  table 2.3 -->
-	    <field ref="uoce"         name="vozocrtx" description="sea_water_x_velocity"                                       />
-	    <field ref="u_masstr"     name="umo"      description="ocean_mass_x_transport"                           level="1" />
-	    <field ref="u_heattr"     name="hfx"      description="ocean_heat_x_transport"                           level="1" />
-	    <field ref="ueiv_heattr"  name="hfxba"    description="ocean_heat_x_transport_due_to_bolus_advection"    level="2" />
-	    <field ref="udiff_heattr" name="hfxdiff"  description="ocean_heat_x_transport_due_to_diffusion"          level="2" />
-
-	  <!-- table 2.8 -->
-	    <field ref="utau"         name="sozotaux" description="surface_downward_x_stress"                        level="1" />
-	    <!-- tauucorr : surface_downward_x_stress_correction = 0 -->
-
-         <!--  IPSL variables -->
-        <field ref="uoce_eiv"         name="vozoeivu" description="EIV ocean current along i-axis"                             />
-
-        </file>   
-
-	<!--
-..............................................    grid V   .................................................
-	  -->
-	<file id="ORCA2_1m_grid_V" description="ocean V grid variables : table 2.3 2.8" >                      <!-- grid V -->
-
-	  <!-- table 2.3" -->
-	    <field ref="voce"         name="vomecrty" description="sea_water_y_velocity"                                       />
-	    <field ref="v_masstr"     name="vmo"      description="ocean_mass_y_transport"                           level="1" />
-	    <field ref="v_heattr"     name="hfy"      description="ocean_heat_y_transport"                           level="1" />
-	    <field ref="veiv_heattr"  name="hfyba"    description="ocean_heat_y_transport_due_to_bolus_advection"    level="2" />
-	    <field ref="vdiff_heattr" name="hfydiff"  description="ocean_heat_y_transport_due_to_diffusion"          level="2" />
-
-	  <!-- table 2.8 -->
-	    <field ref="vtau"         name="sometauy" description="surface_downward_y_stress"                        level="1" />
-	    <!-- tauvcorr : surface_downward_y_stress_correction = 0 -->
-
-         <!--  IPSL variables -->
-        <field ref="voce_eiv"         name="vomeeivv" description="EIV ocean current along j-axis"                             />
-
-	</file>   
-
-	<!--
-..............................................    grid W   .................................................
-	  -->
-	<file id="ORCA2_1m_grid_W" description="ocean W grid variables table 2.3 2.9 2.10" >                   <!-- grid W -->
-	  
-	  <!-- table 2.3 -->
-	    <field ref="w_masstr"   name="wmo"   description="upward_ocean_mass_transport"                                    />
-	    <field ref="w_masstr2"  name="wmosq" description="square_pf_upward_ocean_mass_transport"                          />
-	  
-	  <!-- table 2.9 -->
-	    <field ref="avt"     name="votkeavt" description="ocean_vertical_heat_diffusivity"                  level="2" />
-	    <field ref="avs"     name="voddmavs" description="ocean_vertical_salt_diffusivity"                  level="2" />
-	    <!-- difvtrbo : ocean_vertical_tracer_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb and  nn_havtb -->
-	    <field ref="av_tide" name="difvtrto" description="ocean_vertical_tracer_diffusivity_due_to_tides"   level="2" />
-	    <!-- tnpeo     : tendency_of_ocean_potential_energy_content                   : not available -->
-	    <!-- tnpeot    : tendency_of_ocean_potential_energy_content_due_to_tides      : not available -->
-	    <!-- tnpeotb   : tendency_of_ocean_potential_energy_content_due_to_background : not available -->
-	    <field ref="avm"     name="difvmo"   description="ocean_vertical_momentum_diffusivity"              level="2" />
-	    <!-- difvmbo : ocean_vertical_momentum_diffusivity_due_to_background : cte with time, see namelist parameters nn_avb -->
-	    <field ref="av_tide" name="difvmto"  description="ocean_vertical_momentum_diffusivity_due_to_tides" level="2" /> <!-- same as tracer -->
-	    <!-- difvmfdo : ocean_vertical_momentum_diffusivity_due_to_form_drag : ??? -->
-	    <!-- dispkevfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_vertical_friction : not available -->
-
-	  <!-- table 2.10 -->
-	    <!-- if ln_traldf_lap    =  .true. -->
-	    <field ref="aht2d_eiv" name="soleaeiw" description="ocean_tracer_bolus_laplacian_diffusivity"                     level="2" />
-	    <!-- diftrelo : ocean_tracer_epineutral_laplacian_diffusivity : cte with time, see ln_traldf_iso -->
-	    <!-- diftrxylo : ocean_tracer_xy_laplacian_diffusivity : cte with time -->
-	    <field ref="aht2d"     name="soleahtw" description="ocean_tracer_xy_laplacian_diffusivity"                        level="2" />
-	    <!-- if ln_traldf_bilap  =  .true. -->
-	    <!-- field ref="diftrbbo" name="aht2d_eiv" description="ocean_tracer_bolus_biharmonic_diffusivity"                level="2" /-->
-	    <!-- diftrebo : ocean_tracer_epineutral_biharmonic_diffusivity : cte with time, see ln_traldf_iso -->
-	    <!-- diftrxybo : ocean_tracer_xy_biharmonic_diffusivity : cte with time -->
-	    <!-- tnkebto : tendency_of_ocean_eddy_kinetic_energy_content_due_to_bolus_transport : not available -->
-	    <!-- difmxylo : ocean_momentum_xy_laplacian_diffusivity : cte with time, see ln_dynldf_lap -->
-	    <!-- difmxybo : ocean_momentum_xy_biharmonic_diffusivity : cte with time, see ln_dynldf_bilap -->
-	    <!-- dispkexyfo : ocean_kinetic_energy_dissipation_per_unit_area_due_to_xy_friction : not available -->
-
-         <!--  IPSL variables -->
-        <field ref="woce"             name="vovecrtz" description="ocean vertical velocity"                          />
-        <field ref="woce_eiv"         name="voveeivw" description="EIV ocean vertical velocity"                      />
-
-
-	  </file>   
-
-	<!--
-..............................................    icemod   .................................................
-	  -->
-	<file id="ORCA2_1m_icemod" description=" ice variables" >                                           <!-- icemod -->
-         <!-- table 2.2 -->
-	  <field ref="ice_pres"                     />
-	  <field ref="ice_cover"    name="soicecov"   description="sea_ice_area_fraction"                            />
-	  <field ref="icethic_cea"  name="iicethic"   description="sea_ice_thickness"                                />
-	  <field ref="subl_ai_cea"  name="evap"       description="water_evaporation_flux"                           />
-	  <field ref="snowthic_cea" name="isnowthi"   description="surface_snow_thickness"                           />
-          <field ref="sim"          name="sim"        description="sea_ice_and_surface_snow_amount"                  />
-	  <!-- snc : surface_snow_area_fraction : same as sic -->
-	  <field ref="icealb_cea"   name="ialb"       description="Bare Sea Ice Albedo"                              />
-	  <!-- ssi : Sea Ice Salinity : cte = sice = 6, expect in baltic sea = 2 -->
-	  <field ref="ist_cea"      name="tsice"      description="Surface Temperature of Sea Ice"                   />
-	  <!-- tsnint : Temperature at Interface Between Sea Ice and Snow : not available -->
-	  <!-- pr : Surface Rainfall Rate into the Sea Ice Portion of the Grid Cell = 0 -->
-	  <field ref="snow_ai_cea"  name="prsn"       description="Surface Snowfall Rate into the Sea Ice Portion of the Grid Cell" />
-	  <!-- ageice   : Age of Sea Ice : not available ??? -->
-	  <!-- grFrazil : Frazil Sea Ice Growth (Leads) Rate ??? -->
-	  <!-- grCongel : Congelation Sea Ice Growth Rate ??? -->
-	  <field ref="licepro_cea"  name="grLateral"  description="Lateral Sea Ice Growth Rate"                      />
-	  <field ref="sntoice_cea"  name="snoToIce"   description="Snow-Ice Formation Rate"                          />
-	  <field ref="snowmel_cea"  name="snomelt"    description="Snow Melt Rate"                                   />
-	  <field ref="ticemel_cea"  name="tmelt"      description="Rate of Melt at Upper Surface of Sea Ice"         />
-	  <field ref="bicemel_cea"  name="bmelt"      description="Rate of Melt at Sea Ice Base"                     />
-	  <!-- hcice  : Sea Ice Total Heat Content ??? -->
-	  <field ref="qsr_ai_cea"   name="rsdssi"     description="surface_downwelling_shortwave_flux_in_air"        />
-	  <!-- rsussi : surface_upwelling_shortwave_flux_in_air ??? -->
-	  <!-- rldssi : surface_downwelling_longwave_flux_in_air ??? -->
-	  <!-- rlussi : surface_upwelling_longwave_flux_in_air ??? -->
-	  <!-- hfssi  : surface_upward_sensible_heat_flux ??? -->
-	  <!-- hflssi : surface_upward_latent_heat_flux ??? -->
-	  <field ref="subl_ai_cea"  name="sblsi"      description="surface_snow_and_ice_sublimation_flux"             />
-	  <field ref="u_imasstr"    name="transix"    description="Eastward Sea Ice Transport"                        />
-	  <field ref="v_imasstr"    name="transiy"    description="Northward Sea Ice Transport"                       />
-	  <field ref="fram_trans"   name="transifs"   description="Sea Ice Mass Transport Through Fram Strait"        />
-	  <field ref="utau_ice"     name="strairx"    description="Eastward Atmospheric Stress On Sea Ice"            />
-	  <field ref="vtau_ice"     name="strairy"    description="Northward Atmospheric Stress On Sea Ice"           />
-	  <!-- strocnx : Eastward Ocean Stress On Sea Ice ??? -->
-	  <!-- strocny : Northward Ocean Stress On Sea Ice ??? -->
-	  <!-- streng  : Compressive Sea Ice Strength ??? -->
-	  <!-- divice  : Strain Rate Divergence of Sea Ice ??? -->
-	  <!-- shrice  : Strain Rate Shear of Sea Ice ??? -->
-	  <!-- ridgice : Sea Ice Ridging Rate ??? -->
-         <!-- IPSL variables -->
-          <field ref="ist_ipa"    name="iicetemp"   description="Ice surface temperature (ice presence average)"               />
-          <field ref="uice_ipa"   name="iicevelu"   description="Ice velocity along i-axis at I-point (ice presence average)"  />
-          <field ref="vice_ipa"   name="iicevelv"   description="Ice velocity along j-axis at I-point (ice presence average)"  />
-          <field ref="ice_cover"  name="ileadfra"   description="sea_ice_area_fraction"                                        />
-
-	</file>   
-
-	<!--
-..............................................    scalar   .................................................
-	  -->
-	<file id="ORCA2_1m_scalar" description="Ocean scalar" >                                <!-- scalar -->
-         <!-- table 2.2 -->
-	  <field ref="masstot"    name="masso"    description="sea_water_mass"                                />
-	  <field ref="voltot"     name="volo"     description="sea_water_volume"                              />
-	  <field ref="sshtot"     name="zosga"    description="global_average_sea_level_change"               />
-	  <field ref="sshsteric"  name="zossga"   description="global_average_steric_sea_level_change"        />
-	  <field ref="sshthster"  name="zostoga"  description="global_average_thermosteric_sea_level_change"  />
-	  <field ref="temptot"    name="thetaoga" description="sea_water_potential_temperature"               />
-	  <field ref="saltot"     name="soga"     description="sea_water_salinity"                            />
-	</file>   
-
-        <!--
-..............................................   ptrc_T   .................................................
-          -->
-        <file id="ORCA2_1m_ptrc_T" description="Marine Biogeochemical 3-D Fields" >            <!-- ptrc_T -->
-          <field ref="DIC"      />
-          <field ref="Alkalini" />
-          <field ref="O2"       />
-          <field ref="CaCO3"    />
-          <field ref="PO4"      />
-          <field ref="POC"      />
-          <field ref="Si"       />
-          <field ref="PHY"      />
-          <field ref="ZOO"      />
-          <field ref="DOC"      />
-          <field ref="PHY2"     />
-          <field ref="ZOO2"     />
-          <field ref="BSi"      />
-          <field ref="Fer"      />
-          <field ref="BFe"      />
-          <field ref="GOC"      />
-          <field ref="SFe"      />
-          <field ref="DFe"      />
-          <field ref="DSi"      />
-          <field ref="NFe"      />
-          <field ref="NCHL"     />
-          <field ref="DCHL"     />
-          <field ref="NO3"      />
-          <field ref="NH4"      />
-       </file>
-
-        <!--
-..............................................  diad_T   .................................................
-          -->
-       <file id="ORCA2_1m_diad_T" description="Marine Biogeochemical Fields : Additional diagnostics" >
-          <field ref="PH"       />
-          <field ref="CO3"      />
-          <field ref="CO3sat"   />
-          <field ref="PAR"      />
-          <field ref="PPPHY"    />
-          <field ref="PPPHY2"   />
-          <field ref="PPNEWN"   />
-          <field ref="PPNEWD"   />
-          <field ref="PBSi"     />
-          <field ref="PFeN"     />
-          <field ref="PFeD"     />
-          <field ref="PCAL"     />
-          <field ref="DCAL"     />
-          <field ref="GRAZ"     />
-          <field ref="EPC100"   />
-          <field ref="EPFE100"  />
-          <field ref="EPSI100"  />
-          <field ref="EPCAL100" />
-          <field ref="Cflx"     />
-          <field ref="Oflx"     />
-          <field ref="Kg"       />
-          <field ref="Dpco2"    />
-          <field ref="Dpo2"     />
-          <field ref="Heup"     />
-          <field ref="Irondep"  />
-          <field ref="Nfix"     />
-       </file>
-
-        <!--
-..............................................  dbio_T   .................................................
-          -->
-       <file id="ORCA2_1m_dbio_T" description="Marine Biogeochemical Fields : Additional AR5 variables" enabled="<DBIO_ENABLE>" >
-          <field ref="PHYT"        />
-          <field ref="ZOOT"        />
-          <field ref="CHLT"        />
-          <field ref="POCT"        />
-          <field ref="PFET"        />
-          <field ref="TPP"         />
-          <field ref="TPNEW"       />
-          <field ref="TPBFE"       />
-          <field ref="EXPC"        />
-          <field ref="EXPFE"       />
-          <field ref="EXPSI"       />
-          <field ref="EXPCAL"      />
-          <field ref="INTDIC"      />
-          <field ref="O2MIN"       />
-          <field ref="ZO2MIN"      />
-          <field ref="INTNFIX"     />
-          <field ref="INTPPPHY"    />
-          <field ref="INTPPPHY2"   />
-          <field ref="INTPP"       />
-          <field ref="INTPNEW"     />
-          <field ref="INTPBFE"     />
-          <field ref="INTPBSI"     />
-          <field ref="INTPCAL"     />
-       </file>
-
-      </group>   
-
-      <!-- 
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-        -->
-    </file_definition>
-    
-    <!-- 
-============================================================================================================
-=                                           grid definition                                                =
-=                                            DO NOT CHANGE                                                 =
-============================================================================================================
-    -->
-    
-    <axis_definition>  
-      <axis id="deptht" description="Vertical T levels" unit="m" positive=".false." />
-      <axis id="depthu" description="Vertical U levels" unit="m" positive=".false." />
-      <axis id="depthv" description="Vertical V levels" unit="m" positive=".false." />
-      <axis id="depthw" description="Vertical W levels" unit="m" positive=".false." />
-      <axis id="none" description="axe non defini" unit="none" size="1" />
-    </axis_definition> 
-    
-    <grid_definition>
-      <grid id="grid_T" description="grid T" />
-      <grid id="grid_U" description="grid U" />
-      <grid id="grid_V" description="grid V" />
-      <grid id="grid_W" description="grid W" />
-      <grid id="scalarpoint" description="scalar" >
-	<zoom id="1point" ibegin="1" jbegin="1" ni="1" nj="1" />
-      </grid>
-    </grid_definition>    
-    
-  </context>
-  
-</simulation>
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_cfg	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_cfg	(revision 2451)
@@ -88,12 +88,8 @@
                            !     (also = the frequency of sea-ice model call)
    ln_blk_core = .false.   !  CORE bulk formulation                     (T => fill namsbc_core)
-   ln_cpl      = .true.    !  Coupled formulation                       (T => fill namsbc_cpl )
    ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
    nn_ice      = 2         !  =0 no ice boundary condition   ,
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2")
-   cn_iceflx   = 'linear'  !  AUTO - 
-                           !  ="ave"    - Average flux over all ice categories ("key_lim3")
-                           !  ="linear" - Linear repartition of fluxes over ice categories ("key_lim3")
    nn_ice_embd = 0         !  AUTO - 
                            !  =0 levitating ice (no mass exchange, concentration/dilution effect)
@@ -279,10 +275,6 @@
 !-----------------------------------------------------------------------
    ln_diaptr  = .true.     !  Poleward heat and salt transport (T) or not (F)
-   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
    ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not
                            !  (orca configuration only, need input basins mask file named "subbasins.nc"
-   ln_ptrcomp = .true.     !  Add decomposition : overturning
-   nn_fptr    =  1         !  Frequency of ptr computation [time step]
-   nn_fwri    =  15        !  AUTO - Frequency of ptr outputs [time step]
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_ref
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_ref	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2_ref	(revision 2451)
@@ -1,5 +1,5 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! NEMO/OPA  :  1 - run manager      (namrun, namcfg)
-!! namelists    2 - Domain           (namzgr, namzgr_sco, namdom, namtsd)
+!! NEMO/OPA  :  1 - run manager      (namrun)
+!! namelists    2 - Domain           (namcfg, namzgr, namzgr_sco, namdom, namtsd)
 !!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core, namsbc_sas
 !!                                    namsbc_cpl, namtra_qsr, namsbc_rnf,
@@ -10,5 +10,5 @@
 !!              7 - dynamics         (namdyn_adv, namdyn_vor, namdyn_hpg, namdyn_spg, namdyn_ldf)
 !!              8 - Verical physics  (namzdf, namzdf_ric, namzdf_tke, namzdf_kpp, namzdf_ddm, namzdf_tmx)
-!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namptr, namhsb)
+!!              9 - diagnostics      (namnc4, namtrd, namspr, namflo, namhsb)
 !!             10 - miscellaneous    (namsol, nammpp, namctl)
 !!             11 - Obs & Assim      (namobs, nam_asminc)
@@ -18,5 +18,5 @@
 !!                   ***  Run management namelists  ***
 !!======================================================================
-!!   namrun        parameters of the run
+!!   namrun       parameters of the run
 !!======================================================================
 !
@@ -31,6 +31,6 @@
    nn_leapy    =       0   !  Leap year calendar (1) or not (0)
    ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
-   nn_euler    =       1   !  = 0 : start with forward time step if ln_rstart=.true.
-   nn_rstctl   =       0   !  restart control => activated only if ln_rstart = T
+   nn_euler    =       1   !  = 0 : start with forward time step if ln_rstart=T
+   nn_rstctl   =       0   !  restart control ==> activated only if ln_rstart=T
                            !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
                            !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
@@ -47,9 +47,19 @@
 /
 !
-!-----------------------------------------------------------------------
-&namcfg     !   default parameters of the configuration      
+!!======================================================================
+!!                      ***  Domain namelists  ***
+!!======================================================================
+!!   namcfg       parameters of the configuration      
+!!   namzgr       vertical coordinate
+!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
+!!   namdom       space and time domain (bathymetry, mesh, timestep)
+!!   namtsd       data: temperature & salinity
+!!======================================================================
+!
+!-----------------------------------------------------------------------
+&namcfg     !   parameters of the configuration      
 !-----------------------------------------------------------------------
    cp_cfg      =  "default"            !  name of the configuration
-   cp_cfz      =         ''            !  name of the zoom of configuration
+   cp_cfz      =  "no zoom"            !  name of the zoom of configuration
    jp_cfg      =       0               !  resolution of the configuration
    jpidta      =      10               !  1st lateral dimension ( >= jpi )
@@ -57,5 +67,5 @@
    jpkdta      =      31               !  number of levels      ( >= jpk )
    jpiglo      =      10               !  1st dimension of global domain --> i =jpidta
-   jpjglo      =      12               !  2nd    -                  -    --> j  =jpjdta
+   jpjglo      =      12               !  2nd    -                  -    --> j =jpjdta
    jpizoom     =       1               !  left bottom (i,j) indices of the zoom
    jpjzoom     =       1               !  in data domain indices
@@ -66,14 +76,7 @@
                                        !  = 5 North fold F-point pivot
                                        !  = 6 cyclic East-West AND North fold F-point pivot
-/
-!!======================================================================
-!!                      ***  Domain namelists  ***
-!!======================================================================
-!!   namzgr       vertical coordinate
-!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate
-!!   namdom       space and time domain (bathymetry, mesh, timestep)
-!!   namtsd       data: temperature & salinity
-!!======================================================================
-!
+   ln_use_jattr = .false.              !  use (T) the file attribute: open_ocean_jstart, if present 
+                                       !  in netcdf input files, as the start j-row for reading
+/
 !-----------------------------------------------------------------------
 &namzgr        !   vertical coordinate
@@ -82,4 +85,5 @@
    ln_zps      = .true.    !  z-coordinate - partial steps   (T/F)
    ln_sco      = .false.   !  s- or hybrid z-s-coordinate    (T/F)
+   ln_isfcav   = .false.   !  ice shelf cavity               (T/F)
 /
 !-----------------------------------------------------------------------
@@ -215,4 +219,5 @@
 !!   namtra_qsr      penetrative solar radiation
 !!   namsbc_rnf      river runoffs
+!!   namsbc_isf      ice shelf melting/freezing
 !!   namsbc_apr      Atmospheric Pressure
 !!   namsbc_ssr      sea surface restoring term (for T and/or S)
@@ -230,14 +235,18 @@
    ln_blk_core = .true.    !  CORE bulk formulation                     (T => fill namsbc_core)
    ln_blk_mfs  = .false.   !  MFS bulk formulation                      (T => fill namsbc_mfs )
-   ln_cpl      = .false.   !  Coupled formulation                       (T => fill namsbc_cpl )
    ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr )
    nn_ice      = 2         !  =0 no ice boundary condition   ,
                            !  =1 use observed ice-cover      ,
-                           !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+                           !  =2 ice-model used                         ("key_lim3" or "key_lim2")
    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)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
-   ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
+   ln_rnf      = .true.    !  runoffs                                   (T   => fill namsbc_rnf)
+   nn_isf      = 0         !  ice shelf melting/freezing                (/=0 => fill namsbc_isf)
+                           !  0 =no isf                  1 = presence of ISF 
+                           !  2 = bg03 parametrisation   3 = rnf file for isf   
+                           !  4 = ISF fwf specified
+                           !  option 1 and 4 need ln_isfcav = .true. (domzgr)
    ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S       (T => fill namsbc_ssr)
    nn_fwb      = 2         !  FreshWater Budget: =0 unchecked
@@ -249,5 +258,9 @@
    nn_lsm  = 0             !  =0 land/sea mask for input fields is not applied (keep empty land/sea mask filename field) ,
                            !  =1:n number of iterations of land/sea mask application for input fields (fill land/sea mask filename field)
-   cn_iceflx = 'linear'    !  redistribution of solar input into ice categories during coupling ice/atm.
+   nn_limflx = -1          !  LIM3 Multi-category heat flux formulation (use -1 if LIM3 is not used)
+                           !  =-1  Use per-category fluxes, bypass redistributor, forced mode only, not yet implemented coupled
+                           !  = 0  Average per-category fluxes (forced and coupled mode)
+                           !  = 1  Average and redistribute per-category fluxes, forced mode only, not yet implemented coupled
+                           !  = 2  Redistribute a single flux over categories (coupled mode only)
 /
 !-----------------------------------------------------------------------
@@ -305,9 +318,7 @@
 
    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)
    ln_taudif   = .false.   !  HF tau contribution: use "mean of stress module - module of the mean stress" data
-   ln_bulk2z   = .false.   !  Air temperature/humidity and wind vectors are referenced at heights rn_zqt and rn_zu
-   rn_zqt      = 3.        !  Air temperature and humidity reference height (m) (ln_bulk2z)
-   rn_zu       = 4.        !  Wind vector reference height (m)                  (ln_bulk2z)
+   rn_zqt      = 10.        !  Air temperature and humidity reference height (m)
+   rn_zu       = 10.        !  Wind vector reference height (m)                 
    rn_pfac     = 1.        !  multiplicative factor for precipitation (total & snow)
    rn_efac     = 1.        !  multiplicative factor for evaporation (0. or 1.)
@@ -336,20 +347,24 @@
 !                    !                       ! categories !  reference  !    orientation       ! grids  !
 ! send
-sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
-sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
-sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
-sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
+   sn_snd_temp   =       'weighted oce and ice' ,    'no'    ,     ''      ,         ''           ,   ''
+   sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
+   sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
+   sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+   sn_snd_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''           ,   ''
 ! receive
-sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
-sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
-sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_w10m   =       'none'                 ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_taumod =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_tau    =       'oce only'             ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'
+   sn_rcv_dqnsdt =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_qsr    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_qns    =       'oce and ice'          ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_cal    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+   sn_rcv_co2    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
+!
+   nn_cplmodel   =     1     !  Maximum number of models to/from which NEMO is potentialy sending/receiving data
+   ln_usecplmask = .false.   !  use a coupling mask file to merge data received from several models
+                             !   -> file cplmask.nc with the float variable called cplmask (jpi,jpj,nn_cplmodel)
 /
 !-----------------------------------------------------------------------
@@ -405,4 +420,34 @@
    ln_rnf_tem   = .false.   !  read in temperature information for runoff
    ln_rnf_sal   = .false.   !  read in salinity information for runoff
+/
+!-----------------------------------------------------------------------
+&namsbc_isf    !  Top boundary layer (ISF) 
+!-----------------------------------------------------------------------
+!              ! file name ! frequency (hours) ! variable ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
+!              !           !  (if <0  months)  !   name   !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
+! nn_isf == 4
+   sn_qisf      = 'rnfisf' ,         -12      ,'sohflisf',    .false.      , .true.  , 'yearly'  ,  ''      ,   ''
+   sn_fwfisf    = 'rnfisf' ,         -12      ,'sowflisf',    .false.      , .true.  , 'yearly'  ,  ''      ,   ''
+! nn_isf == 3
+   sn_rnfisf    = 'runoffs' ,         -12      ,'sofwfisf',    .false.      , .true.  , 'yearly'  ,  ''      ,   ''
+! nn_isf == 2 and 3
+   sn_depmax_isf = 'runoffs' ,       -12        ,'sozisfmax' ,   .false.  , .true.  , 'yearly'  ,  ''      ,   ''
+   sn_depmin_isf = 'runoffs' ,       -12        ,'sozisfmin' ,   .false.  , .true.  , 'yearly'  ,  ''      ,   ''
+! nn_isf == 2
+   sn_Leff_isf = 'rnfisf' ,       0          ,'Leff'         ,   .false.  , .true.  , 'yearly'  ,  ''      ,   ''
+! for all case
+   ln_divisf   = .true.  ! apply isf melting as a mass flux or in the salinity trend. (maybe I should remove this option as for runoff?)
+! only for nn_isf = 1 or 2
+   rn_gammat0  = 1.0e-4   ! gammat coefficient used in blk formula
+   rn_gammas0  = 1.0e-4   ! gammas coefficient used in blk formula
+! only for nn_isf = 1
+   nn_isfblk   =  1       ! 1 ISOMIP ; 2 conservative (3 equation formulation, Jenkins et al. 1991 ??)
+   rn_hisf_tbl =  30.      ! thickness of the top boundary layer           (Losh et al. 2008)
+                          ! 0 => thickness of the tbl = thickness of the first wet cell
+   ln_conserve = .true.   ! conservative case (take into account meltwater advection)
+   nn_gammablk = 1        ! 0 = cst Gammat (= gammat/s)
+                          ! 1 = velocity dependend Gamma (u* * gammat/s)  (Jenkins et al. 2010)
+                          !     if you want to keep the cd as in global config, adjust rn_gammat0 to compensate
+                          ! 2 = velocity and stability dependent Gamma    Holland et al. 1999
 /
 !-----------------------------------------------------------------------
@@ -631,8 +676,16 @@
    rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2)
    rn_bfrz0    =    3.e-3  !  bottom roughness [m] if ln_loglayer=T 
-   ln_loglayer = .false.   !  logarithmic formulation (non linear case)
    ln_bfr2d    = .false.   !  horizontal variation of the bottom friction coef (read a 2D mask file )
    rn_bfrien   =    50.    !  local multiplying factor of bfr (ln_bfr2d=T)
+   rn_tfri1    =    4.e-4  !  top drag coefficient (linear case)
+   rn_tfri2    =    2.5e-3 !  top drag coefficient (non linear case). Minimum coeft if ln_loglayer=T
+   rn_tfri2_max =   1.e-1  !  max. top drag coefficient (non linear case and ln_loglayer=T)
+   rn_tfeb2    =    0.0    !  top turbulent kinetic energy background  (m2/s2)
+   rn_tfrz0    =    3.e-3  !  top roughness [m] if ln_loglayer=T
+   ln_tfr2d    = .false.   !  horizontal variation of the top friction coef (read a 2D mask file )
+   rn_tfrien   =    50.    !  local multiplying factor of tfr (ln_tfr2d=T)
+
    ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true)
+   ln_loglayer = .false.   !  logarithmic formulation (non linear case)
 /
 !-----------------------------------------------------------------------
@@ -659,4 +712,5 @@
 !!   nameos        equation of state
 !!   namtra_adv    advection scheme
+!!   namtra_adv_mle   mixed layer eddy param. (Fox-Kemper param.)
 !!   namtra_ldf    lateral diffusion scheme
 !!   namtra_dmp    T & S newtonian damping
@@ -666,21 +720,31 @@
 &nameos        !   ocean physical parameters
 !-----------------------------------------------------------------------
-   nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency
-                           !     = 0, UNESCO (formulation of Jackett and McDougall (1994) and of McDougall (1987) )
-                           !     = 1, linear: rho(T)   = rau0 * ( 1.028 - ralpha * T )
-                           !     = 2, linear: rho(T,S) = rau0 * ( rbeta * S - ralpha * T )
-   rn_alpha    =   2.0e-4  !  thermal expension coefficient (nn_eos= 1 or 2)
-   rn_beta     =   7.7e-4  !  saline  expension coefficient (nn_eos= 2)
+   nn_eos      =  -1     !  type of equation of state and Brunt-Vaisala frequency
+                                 !  =-1, TEOS-10 
+                                 !  = 0, EOS-80 
+                                 !  = 1, S-EOS   (simplified eos)
+   ln_useCT    = .true.  ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm
+   !                             !
+   !                     ! S-EOS coefficients :
+   !                             !  rd(T,S,Z)*rau0 = -a0*(1+.5*lambda*dT+mu*Z+nu*dS)*dT+b0*dS
+   rn_a0       =  1.6550e-1      !  thermal expension coefficient (nn_eos= 1)
+   rn_b0       =  7.6554e-1      !  saline  expension coefficient (nn_eos= 1)
+   rn_lambda1  =  5.9520e-2      !  cabbeling coeff in T^2  (=0 for linear eos)
+   rn_lambda2  =  7.4914e-4      !  cabbeling coeff in S^2  (=0 for linear eos)
+   rn_mu1      =  1.4970e-4      !  thermobaric coeff. in T (=0 for linear eos)
+   rn_mu2      =  1.1090e-5      !  thermobaric coeff. in S (=0 for linear eos)
+   rn_nu       =  2.4341e-3      !  cabbeling coeff in T*S  (=0 for linear eos)
 /
 !-----------------------------------------------------------------------
 &namtra_adv    !   advection scheme for tracer
 !-----------------------------------------------------------------------
-   ln_traadv_cen2   =  .false.  !  2nd order centered scheme
-   ln_traadv_tvd    =  .true.   !  TVD scheme
-   ln_traadv_muscl  =  .false.  !  MUSCL scheme
-   ln_traadv_muscl2 =  .false.  !  MUSCL2 scheme + cen2 at boundaries
-   ln_traadv_ubs    =  .false.  !  UBS scheme
-   ln_traadv_qck    =  .false.  !  QUICKEST scheme
-   ln_traadv_msc_ups=  .false.  !  use upstream scheme within muscl
+   ln_traadv_cen2   =  .false.   !  2nd order centered scheme
+   ln_traadv_tvd    =  .true.    !  TVD scheme
+   ln_traadv_muscl  =  .false.   !  MUSCL scheme
+   ln_traadv_muscl2 =  .false.   !  MUSCL2 scheme + cen2 at boundaries
+   ln_traadv_ubs    =  .false.   !  UBS scheme
+   ln_traadv_qck    =  .false.   !  QUICKEST scheme
+   ln_traadv_msc_ups=  .false.   !  use upstream scheme within muscl
+   ln_traadv_tvd_zts=  .false.  !  TVD scheme with sub-timestepping of vertical tracer advection
 /
 !-----------------------------------------------------------------------
@@ -729,14 +793,8 @@
 !-----------------------------------------------------------------------
    ln_tradmp   =  .true.   !  add a damping termn (T) or not (F)
-   nn_hdmp     =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
-                           !                   =XX, damping poleward of XX degrees (XX>0)
-                           !                      + F(distance-to-coast) + Red and Med Seas
    nn_zdmp     =    0      !  vertical   shape =0    damping throughout the water column
                            !                   =1 no damping in the mixing layer (kz  criteria)
                            !                   =2 no damping in the mixed  layer (rho crieria)
-   rn_surf     =   50.     !  surface time scale of damping   [days]
-   rn_bot      =  360.     !  bottom  time scale of damping   [days]
-   rn_dep      =  800.     !  depth of transition between rn_surf and rn_bot [meters]
-   nn_file     =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+   cn_resto    = 'resto.nc' ! Name of file containing restoration coefficient field (use dmp_tools to create this)
 /
 
@@ -757,4 +815,5 @@
    ln_dynadv_cen2= .false. !  flux form - 2nd order centered scheme
    ln_dynadv_ubs = .false. !  flux form - 3rd order UBS      scheme
+   ln_dynzad_zts = .false. !  Use (T) sub timestepping for vertical momentum advection
 /
 !-----------------------------------------------------------------------
@@ -779,4 +838,5 @@
    ln_dynvor_mix = .false. !  mixed scheme
    ln_dynvor_een = .true.  !  energy & enstrophy scheme
+   ln_dynvor_een_old = .false.  !  energy & enstrophy scheme - original formulation
 /
 !-----------------------------------------------------------------------
@@ -786,4 +846,5 @@
    ln_hpg_zps  = .true.    !  z-coordinate - partial steps (interpolation)
    ln_hpg_sco  = .false.   !  s-coordinate (standard jacobian formulation)
+   ln_hpg_isf  = .false.   !  s-coordinate (sco ) adapted to isf
    ln_hpg_djc  = .false.   !  s-coordinate (Density Jacobian with Cubic polynomial)
    ln_hpg_prj  = .false.   !  s-coordinate (Pressure Jacobian scheme)
@@ -903,18 +964,18 @@
 &namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls")
 !-----------------------------------------------------------------------
-   rn_emin       = 1.e-6   !  minimum value of e   [m2/s2]
+   rn_emin       = 1.e-7   !  minimum value of e   [m2/s2]
    rn_epsmin     = 1.e-12  !  minimum value of eps [m2/s3]
    ln_length_lim = .true.  !  limit on the dissipation rate under stable stratification (Galperin et al., 1988)
-   rn_clim_galp  = 0.53    !  galperin limit
-   ln_crban      = .true.  !  Use Craig & Banner (1994) surface wave mixing parametrisation
+   rn_clim_galp  = 0.267   !  galperin limit
    ln_sigpsi     = .true.  !  Activate or not Burchard 2001 mods on psi schmidt number in the wb case
    rn_crban      = 100.    !  Craig and Banner 1994 constant for wb tke flux
    rn_charn      = 70000.  !  Charnock constant for wb induced roughness length
-   nn_tkebc_surf =   1     !  surface tke condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
-   nn_tkebc_bot  =   1     !  bottom tke condition (0/1=Dir/Neum)
-   nn_psibc_surf =   1     !  surface psi condition (0/1/2=Dir/Neum/Dir Mellor-Blumberg)
-   nn_psibc_bot  =   1     !  bottom psi condition (0/1=Dir/Neum)
-   nn_stab_func  =   2     !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
-   nn_clos       =   1     !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
+   rn_hsro       =  0.02   !  Minimum surface roughness
+   rn_frac_hs    =   1.3   !  Fraction of wave height as roughness (if nn_z0_met=2)
+   nn_z0_met     =     2   !  Method for surface roughness computation (0/1/2)
+   nn_bc_surf    =     1   !  surface condition (0/1=Dir/Neum)
+   nn_bc_bot     =     1   !  bottom condition (0/1=Dir/Neum)
+   nn_stab_func  =     2   !  stability function (0=Galp, 1= KC94, 2=CanutoA, 3=CanutoB)
+   nn_clos       =     1   !  predefined closure type (0=MY82, 1=k-eps, 2=k-w, 3=Gen)
 /
 !-----------------------------------------------------------------------
@@ -938,7 +999,10 @@
 !!                  ***  Miscellaneous namelists  ***
 !!======================================================================
+!!   namsol            elliptic solver / island / free surface
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
 !!   namctl            Control prints & Benchmark
-!!   namsol            elliptic solver / island / free surface
+!!   namc1d            1D configuration options                         ("key_c1d")
+!!   namc1d_uvd        data: U & V currents                             ("key_c1d")
+!!   namc1d_dyndmp     U & V newtonian damping                          ("key_c1d")
 !!======================================================================
 !
@@ -999,11 +1063,12 @@
    ln_dyndmp   =  .false.  !  add a damping term (T) or not (F)
 /
+
 !!======================================================================
 !!                  ***  Diagnostics namelists  ***
 !!======================================================================
 !!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4")
-!!   namtrd       dynamics and/or tracer trends                         ("key_trddyn","key_trdtra","key_trdmld")
+!!   namtrd       dynamics and/or tracer trends
+!!   namptr       Poleward Transport Diagnostics
 !!   namflo       float parameters                                      ("key_float")
-!!   namptr       Poleward Transport Diagnostics
 !!   namhsb       Heat and salt budgets
 !!======================================================================
@@ -1021,15 +1086,24 @@
 /
 !-----------------------------------------------------------------------
-&namtrd        !   diagnostics on dynamics and/or tracer trends         ("key_trddyn" and/or "key_trdtra")
-!              !       or mixed-layer trends or barotropic vorticity    ("key_trdmld" or     "key_trdvor")
-!-----------------------------------------------------------------------
-   nn_trd      = 365       !  time step frequency dynamics and tracers trends
-   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
-   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
-   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
-   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
-   ln_trdmld_restart = .false.         !  restart for ML diagnostics
-   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
-/
+&namtrd        !   diagnostics on dynamics and/or tracer trends
+!              !       and/or mixed-layer trends and/or barotropic vorticity
+!-----------------------------------------------------------------------
+   ln_glo_trd  = .false.   ! (T) global domain averaged diag for T, T^2, KE, and PE
+   ln_dyn_trd  = .false.   ! (T) 3D momentum trend output
+   ln_dyn_mxl  = .FALSE.   ! (T) 2D momentum trends averaged over the mixed layer (not coded yet)
+   ln_vor_trd  = .FALSE.   ! (T) 2D barotropic vorticity trends (not coded yet)
+   ln_KE_trd   = .false.   ! (T) 3D Kinetic   Energy     trends
+   ln_PE_trd   = .false.   ! (T) 3D Potential Energy     trends
+   ln_tra_trd  = .FALSE.   ! (T) 3D tracer trend output
+   ln_tra_mxl  = .false.   ! (T) 2D tracer trends averaged over the mixed layer (not coded yet)
+   nn_trd      = 365       !  print frequency (ln_glo_trd=T) (unit=time step)
+/
+!!gm   nn_ctls     =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
+!!gm   rn_ucf      =   1.      !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+!!gm   cn_trdrst_in      = "restart_mld"   ! suffix of ocean restart name (input)
+!!gm   cn_trdrst_out     = "restart_mld"   ! suffix of ocean restart name (output)
+!!gm   ln_trdmld_restart = .false.         !  restart for ML diagnostics
+!!gm   ln_trdmld_instant = .false.         !  flag to diagnose trends of instantantaneous or mean ML T/S
+!!gm
 !-----------------------------------------------------------------------
 &namflo       !   float parameters                                      ("key_float")
@@ -1050,10 +1124,5 @@
 !-----------------------------------------------------------------------
    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F)
-   ln_diaznl  = .true.     !  Add zonal means and meridional stream functions
-   ln_subbas  = .true.     !  Atlantic/Pacific/Indian basins computation (T) or not
-                           !  (orca configuration only, need input basins mask file named "subbasins.nc"
-   ln_ptrcomp = .true.     !  Add decomposition : overturning
-   nn_fptr    =  1         !  Frequency of ptr computation [time step]
-   nn_fwri    =  15        !  Frequency of ptr outputs [time step]
+   ln_subbas  = .false.     !  Atlantic/Pacific/Indian basins computation (T) or not
 /
 !-----------------------------------------------------------------------
@@ -1103,11 +1172,11 @@
                            !     ln_ssh                  Logical switch for SSH observations
 
-   ln_sst     = .true.     ! Logical switch for SST observations
-   ln_reysst  = .true.     !     ln_reysst               Logical switch for Reynolds observations
+   ln_sst     = .false.     ! Logical switch for SST observations
+   ln_reysst  = .false.     !     ln_reysst               Logical switch for Reynolds observations
    ln_ghrsst  = .false.    !     ln_ghrsst               Logical switch for GHRSST observations      
 
    ln_sstfb   = .false.    ! Logical switch for feedback SST data
                            !     ln_sss                  Logical switch for SSS observations
-                           !     ln_seaice               Logical switch for Sea Ice observations
+   ln_seaice  = .false.    ! Logical switch for Sea Ice observations
                            !     ln_vel3d                Logical switch for velocity observations
                            !     ln_velavcur             Logical switch for velocity daily av. cur.
@@ -1130,6 +1199,7 @@
                            !     sstfiles                GHRSST input observation file name
    !                       ! sstfbfiles: Feedback SST input observation file name
-   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name
+   sstfbfiles = 'sst_01.nc'
+                           !     seaicefiles             Sea Ice input observation file names
+   seaicefiles = 'seaice_01.nc'  
                            !     velavcurfiles           Vel. cur. daily av. input file name
                            !     velhvcurfiles           Vel. cur. high freq. input file name
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_cfg	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_cfg	(revision 2451)
@@ -14,5 +14,4 @@
 &namicedyn     !   ice dynamic
 !-----------------------------------------------------------------------
-      creepl      =   1.0e-08 !  creep limit
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_ref
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_ref	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim2_ORCA2_ref	(revision 2451)
@@ -48,11 +48,10 @@
    c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
    etamn       =   0.0e+07 !  minimun value for viscosity
-   creepl      =   1.0e-08 !  creep limit
-   ecc         =   2.0     !  eccentricity of the elliptical yield curve
+   rn_creepl   =   1.0e-08 !  creep limit
+   rn_ecc      =   2.0     !  eccentricity of the elliptical yield curve
    ahi0        = 350.e0    !  horizontal eddy diffusivity coefficient for sea-ice [m2/s]
-   nevp        =   120     !  number of EVP subcycling iterations
+   nn_nevp     =   120     !  number of EVP subcycling iterations
    telast      =   9600    !  timescale for EVP elastic waves
    alphaevp    =   1.0     !  coefficient for the solution of EVP int. stresses
-   hminrhg     =   0.05     !  ice thickness (m) below which ice velocity equal ocean velocity
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_cfg	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_cfg	(revision 2451)
@@ -22,5 +22,4 @@
 &namicedyn     !   ice dynamic
 !-----------------------------------------------------------------------
-   pstar       =   4.0e+04 !  1st bulk-rheology parameter
 /
 !-----------------------------------------------------------------------
@@ -31,5 +30,4 @@
 &namicethd     !   ice thermodynamic
 !-----------------------------------------------------------------------
-   parsub      = 0.0       !  switch for snow sublimation or not - O.M. attention : 0 en couple
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_ref
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_ref	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_lim3_ORCA2_ref	(revision 2451)
@@ -1,127 +1,129 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! NEMO/LIM3 :  1 - dynamics/advection/thermo          (namicerun)
-!! namelists    2 - ice intialisation                  (namiceini)
-!!              3 - ice dynamic                        (namicedyn)
-!!              4 - ice advection                      (namicetrp)
-!!              5 - thermodynamic                      (namicethd)
-!!              6 - ice salinity                       (namicesal)
-!!              7 - mechanical redistribution of ice   (namiceitdme)
-!!              8 - ice diagnostics                    (namicedia)
-!!              9 - ice outputs                        (namiceout)
+!! LIM3 namelist :  
+!!              1 - Generic parameters                 (namicerun)
+!!              2 - Ice initialization                 (namiceini)
+!!              3 - Ice discretization                 (namiceitd)
+!!              4 - Ice dynamics and transport         (namicedyn)
+!!              5 - Ice thermodynamics                 (namicethd)
+!!              6 - Ice salinity                       (namicesal)
+!!              7 - Ice mechanical redistribution      (namiceitdme)
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-!-----------------------------------------------------------------------
-&namicerun     !   Share parameters for dynamics/advection/thermo
-!-----------------------------------------------------------------------
+!
+!------------------------------------------------------------------------------
+&namicerun     !   Generic parameters
+!------------------------------------------------------------------------------
+   jpl            =    5           !  number of ice  categories
+   nlay_i         =    2           !  number of ice  layers
+   nlay_s         =    1           !  number of snow layers (only 1 is working)
    cn_icerst_in  = "restart_ice"   !  suffix of ice restart name (input)
    cn_icerst_out = "restart_ice"   !  suffix of ice restart name (output)
    ln_limdyn     = .true.          !  ice dynamics (T) or thermodynamics only (F)
-   amax          = 0.999           !  maximum ice concentration
-   cai           = 1.40e-3         !  atmospheric drag over sea ice (clio)
-   cao           = 1.00e-3         !  atmospheric drag over ocean   (clio)
-   ln_nicep      = .false.         !  Ice points output for debug (yes or no)
-   ln_limdiahsb  = .false.          !  check the heat and salt budgets (T) or not (F)
+   rn_amax       = 0.999           !  maximum tolerated ice concentration 
+   ln_limdiahsb  = .false.         !  check the heat and salt budgets (T) or not (F)
    ln_limdiaout  = .true.          !  output the heat and salt budgets (T) or not (F)
+   ln_icectl     = .false.         !  ice points output for debug (T or F)
+   iiceprt       = 10              !  i-index for debug
+   jiceprt       = 10              !  j-index for debug
 /
-!-----------------------------------------------------------------------
-&namiceini     !   ice initialisation
-!-----------------------------------------------------------------------
-   ln_limini   = .false.   !  activate ice initialization (T) or not (F)
-   thres_sst   =  0.0      !  threshold water temperature for initial sea ice
-   hts_ini_n   =  0.3      !  initial snow thickness in the north
-   hts_ini_s   =  0.3      !        "            "          south
-   hti_ini_n   =  1.0      !  initial ice thickness in the north
-   hti_ini_s   =  1.0      !        "            "         south
-   ati_ini_n   =  0.9      !  initial ice concentration in the north
-   ati_ini_s   =  0.9      !        "            "             south
-   smi_ini_n   =  6.301    !  initial ice salinity in the north
-   smi_ini_s   =  6.301    !        "            "    south
-   tmi_ini_n   =  270.     !  initial ice/snw temp in the north
-   tmi_ini_s   =  270.     !  initial ice/snw temp in the south
+!------------------------------------------------------------------------------
+&namiceini     !   Ice initialization
+!------------------------------------------------------------------------------
+   ln_iceini      = .true.         !  activate ice initialization (T) or not (F)
+   rn_thres_sst   =  2.0           !  maximum water temperature with initial ice (degC)
+   rn_hts_ini_n   =  0.3           !  initial real snow thickness (m), North
+   rn_hts_ini_s   =  0.3           !        "            "             South
+   rn_hti_ini_n   =  3.0           !  initial real ice thickness  (m), North
+   rn_hti_ini_s   =  1.0           !        "            "             South
+   rn_ati_ini_n   =  0.9           !  initial ice concentration   (-), North
+   rn_ati_ini_s   =  0.9           !        "            "             South
+   rn_smi_ini_n   =  6.3           !  initial ice salinity     (g/kg), North
+   rn_smi_ini_s   =  6.3           !        "            "             South
+   rn_tmi_ini_n   =  270.          !  initial ice/snw temperature (K), North
+   rn_tmi_ini_s   =  270.          !        "            "             South
 /
-!-----------------------------------------------------------------------
-&namicedyn     !   ice dynamic
-!-----------------------------------------------------------------------
-   epsd        =   1.0e-20 !  tolerance parameter
-   om          =   0.5     !  relaxation constant 
-   cw          =   5.0e-03 !  drag coefficient for oceanic stress
-   angvg       =   0.0     !  turning angle for oceanic stress
-   pstar       =   2.0e+04 !  1st bulk-rheology parameter
-   c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
-   creepl      =   1.0e-12 !  creep limit
-   ecc         =   2.0     !  eccentricity of the elliptical yield curve
-   ahi0        = 350.e0    !  horizontal eddy diffusivity coefficient for sea-ice [m2/s]
-   nevp        = 300       !  number of iterations for subcycling in EVP, SB, 400
-   telast      =9600.0     !  timescale for elastic waves, SB, 720.0
-   alphaevp    =   1.0     !  coefficient for the solution of internal ice stresses
-   hminrhg     =   0.001   !  ice volume (a*h in m) below which ice velocity equal ocean velocity
+!------------------------------------------------------------------------------
+&namiceitd     !   Ice discretization
+!------------------------------------------------------------------------------
+   nn_catbnd      =    1           !  computation of ice category boundaries based on
+                                   !      1: tanh function
+                                   !      2: h^(-alpha), function of rn_himean
+   rn_himean      =    2.5         !  expected domain-average ice thickness (m), nn_catbnd = 2 only
 /
-!-----------------------------------------------------------------------
-&namicethd     !   ice thermodynamic
-!-----------------------------------------------------------------------
-   hmelt       = -0.15     !  maximum melting at the bottom
-   hiccrit     = 0.1       !  ice thickness for lateral accretion 
-                           !         caution 1.0, 1.0 best value to be used!!! (gilles G.)  ????
-   fraz_swi    = 0         !  use of frazil ice collection thickness in function of wind (1.0) or not (0.0)
-   maxfrazb    = 0.0       !  maximum portion of frazil ice collecting at the ice bottom
-   vfrazb      = 0.4166667 !  thresold drift speed for frazil ice collecting at the ice bottom
-   Cfrazb      = 5.0       !  squeezing coefficient for frazil ice collecting at the ice bottom
-   hiclim      = 0.10      !  minimum ice thickness
-   hnzst       = 0.1       !  thickness of the surf. layer in temp. computation
-   parsub      = 1.0       !  switch for snow sublimation or not
-   betas       = 0.6       !  exponent in lead-ice fractionation of snow precipitation 0.66
-                           !        betas = 1 -> equipartition, betas < 1 -> more on leads
-   kappa_i     = 1.0       !  extinction radiation parameter in sea ice (1.0)
-   nconv_i_thd = 50        !  maximal number of iterations for heat diffusion computation
-   maxer_i_thd = 0.0001    !  maximal error in temperature for heat diffusion computation
-   thcon_i_swi = 1         !  switch for computation of thermal conductivity in the ice
-                           !        (0) Untersteiner (1964), (1) Pringle et al. (2007)
+!------------------------------------------------------------------------------
+&namicedyn     !   Ice dynamics and transport
+!------------------------------------------------------------------------------
+   nn_icestr      =    0           !  ice strength parameteriztaion                      
+                                   !     0: Hibler_79     P = pstar*<h>*exp(-c_rhg*A)
+                                   !     1: Rothrock_75   P = Cf*coeff*integral(wr.h^2)    
+   ln_icestr_bvf  =    .false.     !  ice strength function brine volume (T) or not (F)     
+   rn_pe_rdg      =   17.0         !  ridging work divided by pot. energy change in ridging, if nn_icestr = 1
+   rn_pstar       =    2.0e+04     !  ice strength thickness parameter (N/m2), nn_icestr = 0 
+   rn_crhg        =   20.0         !  ice strength conc. parameter (-), nn_icestr = 0       
+   rn_cio         =    5.0e-03     !  ice-ocean drag coefficient           (-)             
+   rn_creepl      =    1.0e-12     !  creep limit (s-1)                                   
+   rn_ecc         =    2.0         !  eccentricity of the elliptical yield curve          
+   nn_nevp        =  120           !  number of EVP subcycles                             
+   rn_relast      =    0.333       !  ratio of elastic timescale to ice time step: Telast = dt_ice * rn_relast 
+                                   !     advised value: 1/3 (rn_nevp=120) or 1/9 (rn_nevp=300)
+   nn_ahi0        =    2           !  horizontal diffusivity computation
+                                   !     0: use rn_ahi0_ref
+                                   !     1: use rn_ahi0_ref x mean grid cell length / ( 2deg mean grid cell length )
+                                   !     2: use rn_ahi0_ref x grid cell length      / ( 2deg mean grid cell length )
+   rn_ahi0_ref    = 350.0          !  horizontal sea ice diffusivity (m2/s) 
+                                   !     if nn_ahi0 > 0, rn_ahi0_ref is the reference value at a nominal 2 deg resolution
 /
-!-----------------------------------------------------------------------
-&namicesal     !   ice salinity
-!-----------------------------------------------------------------------
-   num_sal     =  2        !  salinity option: 1 -> S = bulk_sal
-                           !                   2 -> S = S(z,t) with a simple parameterization
-                           !                   3 -> S = S(z) profile of Scwharzacher [1959]
-                           !                   4 -> S = S(h) Cox and Weeks [1974]
-   bulk_sal    =  4.0      !  if 1 is used, it represents the ice salinity
-   sal_G       =  5.00     !  restoring salinity for GD
-   time_G      =  1.728e+6 !  restoring time for GD
-   sal_F       =  2.00     !  restoring salinity for flushing
-   time_F      =  8.640e+5 !  restoring time for flushing
-   s_i_max     = 20.0      !  Maximum salinity 
-   s_i_min     =  0.1      !  Minimum tolerated ice salinity
-   s_i_0       =  3.5      !  1st salinity for salinity profile
-   s_i_1       =  4.5      !  2nd salinity for salinity profile
+!------------------------------------------------------------------------------
+&namicethd     !   Ice thermodynamics
+!------------------------------------------------------------------------------
+   rn_hnewice  = 0.1               !  thickness for new ice formation in open water (m)
+   ln_frazil   = .false.           !  use frazil ice collection thickness as a function of wind (T) or not (F)
+   rn_maxfrazb = 0.0               !  maximum fraction of frazil ice collecting at the ice base
+   rn_vfrazb   = 0.417             !  thresold drift speed for frazil ice collecting at the ice bottom (m/s)
+   rn_Cfrazb   = 5.0               !  squeezing coefficient for frazil ice collecting at the ice bottom
+   rn_himin    = 0.10              !  minimum ice thickness (m) used in remapping, must be smaller than rn_hnewice
+   rn_betas    = 0.66              !  exponent in lead-ice repratition of snow precipitation
+                                   !     betas = 1 -> equipartition, betas < 1 -> more on leads
+   rn_kappa_i  = 1.0               !  radiation attenuation coefficient in sea ice (m-1)
+   nn_conv_dif = 50                !  maximal number of iterations for heat diffusion computation
+   rn_terr_dif = 0.0001            !  maximum temperature after heat diffusion (degC)
+   nn_ice_thcon= 1                 !  sea ice thermal conductivity
+                                   !     0: k = k0 + beta.S/T (Untersteiner, 1964)
+                                   !     1: k = k0 + beta1.S/T - beta2.T (Pringle et al., 2007)
+   nn_monocat  = 0                 !  virtual ITD mono-category parameterizations (1, jpl = 1 only) or not (0)
+                                   !     2: simple piling instead of ridging --- temporary option
+                                   !     3: activate G(he) only              --- temporary option
+                                   !     4: activate lateral melting only    --- temporary option
+  ln_it_qnsice = .true.            !  iterate the surface non-solar flux with surface temperature (T) or not (F)
 /
-!-----------------------------------------------------------------------
-&namiceitdme   !   parameters for mechanical redistribution of ice 
-!-----------------------------------------------------------------------
-   ridge_scheme_swi = 0      !  which ridging scheme using (1=Rothrock,else=Hibler79)
-   Cs               =   0.50 !  shearing energy contribution to ridging
-   Cf               =  17.0  !  ratio of ridging work to PE change in ridging
-   fsnowrdg         =   0.5  !  snow fraction that survives in ridging
-   fsnowrft         =   0.5  !  snow fraction that survives in rafting
-   Gstar            =   0.15 !  fractional area of thin ice being ridged
-   astar            =   0.05 !  equivalent of gstar (0.05 for TH75 and 0.03 for weaker ice)
-   Hstar            = 100.0  !  parameter determining the maximum thickness of ridged ice
-   raft_swi         =   1    !  rafting or not
-   hparmeter        =   0.75 !  threshold thickness for rafting or not
-   Craft            =   5.0  !  coefficient used in the rafting function
-   ridge_por        =   0.3  !  initial porosity of the ridged ice (typically 0.30)
-   partfun_swi      =   1    !  participation function linear, TH75 (0) or exponential Letal07 (1)
-   brinstren_swi    =   0    !  (1) use brine volume to diminish ice strength
+!------------------------------------------------------------------------------
+&namicesal     !   Ice salinity
+!------------------------------------------------------------------------------
+   nn_icesal   =  2                !  ice salinity option
+                                   !     1: constant ice salinity (S=rn_icesal)
+                                   !     2: varying salinity parameterization S(z,t)
+                                   !     3: prescribed salinity profile S(z), Schwarzacher, 1959
+   rn_icesal   =  4.               !  ice salinity (g/kg, nn_icesal = 1 only)
+   rn_sal_gd   =  5.               !  restoring ice salinity, gravity drainage (g/kg)
+   rn_time_gd  =  1.73e+6          !  restoring time scale, gravity drainage  (s)
+   rn_sal_fl   =  2.               !  restoring ice salinity, flushing (g/kg)
+   rn_time_fl  =  8.64e+5          !  restoring time scale, flushing (s)
+   rn_simax    = 20.               !  maximum tolerated ice salinity (g/kg)
+   rn_simin    =  0.1              !  minimum tolerated ice salinity (g/kg)
 /
-!-----------------------------------------------------------------------
-&namicedia     !   ice diagnostics
-!-----------------------------------------------------------------------
-   fmtinf      ='1PE13.5 ' !  format of the output values
-   nfrinf      = 4         !  number of variables written in one line
-   ntmoy       = 1         !  instantaneous values of ice evolution or averaging
-   ninfo       = 1         !  frequency of ouputs on file ice_evolu in case of averaging
+!------------------------------------------------------------------------------
+&namiceitdme   !   Ice mechanical redistribution (ridging and rafting)
+!------------------------------------------------------------------------------
+   rn_Cs       =   0.5             !  fraction of shearing energy contributing to ridging
+   rn_fsnowrdg =   0.5             !  snow volume fraction that survives in ridging
+   rn_fsnowrft =   0.5             !  snow volume fraction that survives in rafting
+   nn_partfun  =   1               !  type of ridging participation function
+                                   !     0: linear (Thorndike et al, 1975)
+                                   !     1: exponential (Lipscomb, 2007
+   rn_gstar    =   0.15            !  fractional area of thin ice being ridged (nn_partfun = 0)
+   rn_astar    =   0.05            !  exponential measure of ridging ice fraction (nn_partfun = 1)
+   rn_hstar    = 100.0             !  determines the maximum thickness of ridged ice (m) (Hibler, 1980)
+   ln_rafting  =   .true.          !  rafting activated (T) or not (F)
+   rn_hraft    =   0.75            !  threshold thickness for rafting (m)
+   rn_craft    =   5.0             !  squeezing coefficient used in the rafting function
+   rn_por_rdg  =   0.3             !  porosity of newly ridged ice (Lepparanta et al., 1995)
 /
-!!-----------------------------------------------------------------------
-!&namicehsb       !  Heat and salt budgets 
-!!-----------------------------------------------------------------------
-!/
-
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_cfg	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_cfg	(revision 2451)
@@ -11,5 +11,4 @@
 &nampisatm     !  Atmospheric pressure 
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-  ln_presatm  = .false.   ! constant atmopsheric pressure (F) or from a file (T)
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -56,6 +55,4 @@
 &nampissbc     !   parameters for inputs deposition
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   ln_river    =  .true.   ! AUTO - boolean for river input of nutrients
-   ln_hydrofe  =  .false.  ! AUTO - boolean for hydrothermal vents
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_ref
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_ref	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2_ref	(revision 2451)
@@ -48,12 +48,12 @@
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    concnno3   =  1.e-6    ! Nitrate half saturation of nanophytoplankton
-   concdno3   =  3.E-6    ! Phosphate half saturation for diatoms
+   concdno3   =  3.E-6    ! Nitrate half saturation for diatoms
    concnnh4   =  1.E-7    ! NH4 half saturation for phyto
    concdnh4   =  3.E-7    ! NH4 half saturation for diatoms
    concnfer   =  1.E-9    ! Iron half saturation for phyto
    concdfer   =  3.E-9    ! Iron half saturation for diatoms
-   concbfe    =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
-   concbnh4   =  2.E-8    ! NH4 half saturation for phyto
-   concbno3   =  2.E-7    ! Phosphate half saturation for diatoms
+   concbfe    =  1.E-11   ! Iron half-saturation for DOC remin.
+   concbnh4   =  2.E-8    ! NH4 half saturation for DOC remin.
+   concbno3   =  2.E-7    ! Nitrate half saturation for DOC remin.
    xsizedia   =  1.E-6    ! Minimum size criteria for diatoms
    xsizephy   =  1.E-6    ! Minimum size criteria for phyto
@@ -61,5 +61,5 @@
    xsizerd    =  3.0      ! Size ratio for diatoms
    xksi1      =  2.E-6    ! half saturation constant for Si uptake
-   xksi2      =  20E-6  ! half saturation constant for Si/C
+   xksi2      =  20E-6    ! half saturation constant for Si/C
    xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
    qnfelim    =  7.E-6    ! Optimal quota of phyto
@@ -86,10 +86,10 @@
    excret2    =  0.05     ! excretion ratio of diatoms
    ln_newprod =  .true.   ! Enable new parame. of production (T/F) 
-   bresp      =  0.00333  ! Basal respiration rate
-   chlcnm     =  0.033    ! Minimum Chl/C in nanophytoplankton
-   chlcdm     =  0.05     ! Minimum Chl/C in diatoms
-   chlcmin    =  0.004    ! Maximum Chl/c in phytoplankton
+   bresp      =  0.033    ! Basal respiration rate
+   chlcnm     =  0.033    ! Maximum Chl/C in nanophytoplankton
+   chlcdm     =  0.05     ! Maximum Chl/C in diatoms
+   chlcmin    =  0.004    ! Minimum Chl/c in phytoplankton
    fecnm      =  40E-6    ! Maximum Fe/C in nanophytoplankton
-   fecdm      =  40E-6    ! Minimum Fe/C in diatoms
+   fecdm      =  40E-6    ! Maximum Fe/C in diatoms
    grosip     =  0.159    ! mean Si/C ratio
 /
@@ -110,8 +110,8 @@
    resrat2    =  0.005    ! exsudation rate of mesozooplankton
    mzrat2     =  0.03     ! mesozooplankton mortality rate
-   xprefc     =  1.       ! zoo preference for phyto
-   xprefp     =  0.3      ! zoo preference for POC
-   xprefz     =  1.       ! zoo preference for zoo
-   xprefpoc   =  0.3      ! zoo preference for poc
+   xprefc     =  1.       ! mesozoo preference for diatoms
+   xprefp     =  0.3      ! mesozoo preference for nanophyto.
+   xprefz     =  1.       ! mesozoo preference for microzoo.
+   xprefpoc   =  0.3      ! mesozoo preference for poc
    xthresh2zoo = 1E-8     ! zoo feeding threshold for mesozooplankton 
    xthresh2dia = 1E-8     ! diatoms feeding threshold for mesozooplankton 
@@ -119,5 +119,5 @@
    xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton 
    xthresh2   =  3E-7     ! Food threshold for grazing
-   xkgraz2    =  20.E-6   ! half sturation constant for meso grazing
+   xkgraz2    =  20.E-6   ! half saturation constant for meso grazing
    epsher2    =  0.35     ! Efficicency of Mesozoo growth
    sigma2     =  0.6      ! Fraction of mesozoo excretion as DOM
@@ -156,5 +156,5 @@
 &nampisrem     !   parameters for remineralization
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   xremik    =  0.35      ! remineralization rate of DOC
+   xremik    =  0.3       ! remineralization rate of DOC
    xremip    =  0.025     ! remineralisation rate of POC
    nitrif    =  0.05      ! NH4 nitrification rate
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_cfg	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_cfg	(revision 2451)
@@ -87,5 +87,20 @@
 /
 !-----------------------------------------------------------------------
+&namtrc_dmp    !   passive tracer newtonian damping
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
+!                          or mixed-layer trends          ('key_trdmld_trc')
+!----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &namtrc_dia       !   parameters for passive tracer additional diagnostics
 !----------------------------------------------------------------------
 /
+!----------------------------------------------------------------------
+! namtrc_bc       !   data for boundary conditions
+!-----------------------------------------------------------------------
+&namtrc_bc
+!
+/
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_ref
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_ref	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_top_ORCA2_ref	(revision 2451)
@@ -76,14 +76,8 @@
 &namtrc_dmp    !   passive tracer newtonian damping   
 !-----------------------------------------------------------------------
-   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
-                           !                   =XX, damping poleward of XX degrees (XX>0)
-                           !                      + F(distance-to-coast) + Red and Med Seas
    nn_zdmp_tr  =    1      !  vertical   shape =0    damping throughout the water column
                            !                   =1 no damping in the mixing layer (kz  criteria)
                            !                   =2 no damping in the mixed  layer (rho crieria)
-   rn_surf_tr  =   50.     !  surface time scale of damping   [days]
-   rn_bot_tr   =  360.     !  bottom  time scale of damping   [days]
-   rn_dep_tr   =  800.     !  depth of transition between rn_surf and rn_bot [meters]
-   nn_file_tr  =    0      !  create a damping.coeff NetCDF file (=1) or not (=0)
+   cn_resto_tr  = 'resto_tr.nc'    !  create a damping.coeff NetCDF file (=1) or not (=0)
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/physiq.def_L19_AP
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/physiq.def_L19_AP	(revision 2446)
+++ 	(revision )
@@ -1,97 +1,0 @@
-## $Id$
-#
-##  Choix ou non  de  New oliq               
-new_oliq=y
-##  Activation ou non de la parametrisation de Hines pour la strato
-ok_hines=n
-##  Orodr  ou  non   pour l orographie              
-ok_orodr=y
-##  Orolf  ou  non   pour l orographie              
-ok_orolf=y
-##   Si = .T. ,  lecture du fichier limit avec la bonne annee             
-ok_limitvrai=n
-##  Flag  pour la convection : 1 pour LMD, 2 pour Tiedtke, 3 KE(nvlle version JYG), 30 KE(version IPCC AR4), 4 KE vect
-iflag_con=30
-## Facteur multiplication des precip convectives dans KE
-cvl_corr=1.0
-#
-#
-### niveau du diagnostique de conservation d energie
-if_ebil=0
-#
-# parametres KE
-#
-### epmax = Efficacite precipitation maximale
-epmax = .99
-### ok_adj_ema = ?? pas utilise
-ok_adj_ema = n
-### iflag_clw Flag calcul eau liquide
-# - iflag_clw=0 : qcond_incld(i,l) = em_qcondc(l)
-# - iflag_clw=1 : qcond_incld(i,l) = em_qcond(l)
-# - iflag_clw=2 : eau liquide diagnostique en fonction de la Precip
-iflag_clw = 1
-# 
-# parametres nuages
-#
-### cld_lc_lsc  contenu en eau liquide des nuages large-scale (fisrtilp) 
-cld_lc_lsc = 2.6e-4
-### cld_lc_con  contenu en eau liquide des nuages convectifs (fisrtilp) 
-cld_lc_con = 2.6e-4
-### cld_tau_lsc cte de temps utilisee pour eliminer l eau large-scale (fisrtilp) 
-cld_tau_lsc = 3600.
-### cld_tau_con cte de temps utilisee pour eliminer l eau convective (fisrtilp) 
-cld_tau_con = 3600.
-### ffallv_lsc  cte utilisee dans calcul vitesse de chute cristaux de glace large-scale (fisrtilp) 
-ffallv_lsc = 1.
-### ffallv_lsc  cte utilisee dans calcul vitesse de chute cristaux de glace convectifs (fisrtilp) 
-ffallv_con = 1.
-### coef_eva coef evaporation precips eau/glace (fisrtilp/fisrtilp_tr?/conlmd?)
-coef_eva = 2.e-5
-### reevap_ice  reevaporation de toute la precip dans la couche du dessous pour la glace (fisrtilp) 
-reevap_ice = y
-### iflag_cldcon  flag pour calculer ratqsc=F(ratqsbas,fact_cldcon,q_seri) (physiq) 
-# - iflag_cldcon<=-1 diag. rain_Tiedtke 
-# - iflag_cldcon=1, ratqsc=ratqsbas+fact_cldcon*(q_seri(1)-q_seri(k))/q_seri(k)
-# - iflag_cldcon=1/2, ratqs=max(ratqs,ratqsc)
-# - iflag_cldcon=3,   ratqs=ratqss
-iflag_cldcon = 3
-### iflag_pdf :  flag calcul distribution sous-maille de l eau et des nuages 
-# - iflag_pdf=0, version ratqs, 
-# - iflag_pdf=1, calcul eau condensee, fraction nuageuse, eau nuageuse a partir
-# -              des PDFS de Sandrine Bony 
-iflag_pdf = 1
-### fact_cldcon  constante calcul ratqsc (voir iflag_cldcon) et proprietes nuages convectifs, clwcon0 (physiq.F) 
-fact_cldcon = 1.
-### facttemps=   facteur de relaxation de ratqs (iflag_cldcon=1/2) et rnebcon (iflag_cldcon=3)
-facttemps = 0.
-## ok_newmicro   =y appel newmicro , =n appel nuage (calcul epaisseur optique et emmissivite des nuages) 
-ok_newmicro = y
-### iflag_ratqs=0 correspond a la version IPCC AR4 
-iflag_ratqs=0
-### ratqsbas     ratqs en bas si iflag_cldcon=1 
-ratqsbas = 0.005
-### ratqshaut    ratqs en haut pour ratqss "stables"  
-ratqshaut = 0.33
-### rad_froid    rayon cristaux des nuages de glace "froids" 
-rad_froid = 35
-### rad_chau1    rayon goutelettes d eau chauds", en haut: k=4-klev 
-rad_chau1=12
-### rad_chau2    rayon goutelettes d eau chauds", en bas: k=1-3  
-rad_chau2=11
-# 
-# Coefficient et parametres sur les drags
-#
-f_cdrag_ter=1.
-f_cdrag_stable=1.
-f_cdrag_oce=0.8
-f_rugoro=0.
-### ksta_ter      coef.diffusion minimale sur terre/sic/lic 
-ksta_ter=1.e-7
-### cdmmax =     cdrag maximum pour le moment
-cdmmax = 2.5E-3
-### cdhmax =     cdrag maximum pour l energie
-cdhmax = 2.0E-3
-
-### nsplit_phys (D=1) 
-nsplit_phys=1
-
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_ADA.fcm
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_ADA.fcm	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_ADA.fcm	(revision 2451)
@@ -39,7 +39,8 @@
 %OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lscrip -lmct -lmpeu
 
+%CPP               cpp
 %FC                  mpiifort -c -cpp
 # for Ada
-%FCFLAGS             -DCPP_PARA -i4 -r8 -O3
+%FCFLAGS             -DCPP_PARA -i4 -r8 -O3 -xAVX -fp-model precise
 %FFLAGS              %FCFLAGS
 %LD                  mpiifort
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm	(revision 2451)
@@ -39,4 +39,5 @@
 %OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lscrip -lmct -lmpeu
 
+%CPP                 cpp
 %FC                  mpif90 -c -cpp
 # for Curie Fat Node
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bld.cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bld.cfg	(revision 2446)
+++ 	(revision )
@@ -1,72 +1,0 @@
-# ----------------------- FCM extract configuration file -----------------------
-cfg::type                           bld
-cfg::version                        1.0
-
-
-# ------------------------------------------------------------------------------
-# Build information
-# ------------------------------------------------------------------------------
-
-inc $COMPIL_DIR/arch_nemo.fcm
-inc $COMPIL_DIR/cpp.fcm
-
-search_src           1
-
-src::ioipsl               $MAIN_DIR/EXTERNAL/IOIPSL/src
-src::agrif                $MAIN_DIR/EXTERNAL/AGRIF/AGRIF_FILES
-src::nemo                 $CONFIG_DIR/$NEW_CONF/OPAFILES/obj
-
-bld::target  nemo.exe
-bld::exe_dep
-
-
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
-
-
-bld::tool::fc        %FC 
-bld::tool::fflags    %FCFLAGS %USER_INC
-bld::tool::fflags::agrif   %FFLAGS %USER_INC
-bld::tool::ld        %LD
-bld::tool::ldflags   %LDFLAGS %USER_LIB
-bld::tool::ar        %AR
-bld::tool::arflags   %ARFLAGS
-bld::tool::make      %MK
-
-# Pre-process code before analysing dependencies
-bld::pp::ioipsl   1
-bld::pp::nemo     1
-bld::pp::agrif    1
-bld::tool::fppflags::nemo      %FPPFLAGS -I$CONFIG_DIR/$NEW_CONF/OPAFILES/inc
-bld::tool::fppflags::ioipsl    %FPPFLAGS
-bld::tool::fppflags::agrif     %FPPFLAGS
-
-# Ignore the following dependencies
-bld::excl_dep        inc::netcdf.inc
-bld::excl_dep        inc::VT.inc
-bld::excl_dep        use::netcdf
-bld::excl_dep        use::xios
-bld::excl_dep        h::netcdf.inc
-bld::excl_dep        h::mpif.h
-bld::excl_dep        inc::mpif.h
-bld::excl_dep        inc::mpe_logf.h
-bld::excl_dep        use::mpi
-bld::excl_dep        use::mod_prism_proto
-bld::excl_dep        use::mod_prism_def_partition_proto
-bld::excl_dep        use::mod_prism_get_comm
-bld::excl_dep        use::mod_prism_get_proto
-bld::excl_dep        use::mod_prism_put_proto
-bld::excl_dep        use::mod_comprism_proto
-bld::excl_dep        use::mod_prism
-bld::excl_dep        use::mkl_dfti
-# Don't generate interface files
-bld::tool::geninterface none
-
-# Allow ".h90" as an extension for CPP include files
-bld::infile_ext::h90  CPP::INCLUDE
-bld::infile_ext::f90  FPP::FPP9X::SOURCE
-
-# extension for module output
-bld::outfile_ext::mod .mod
-
-# rename executable to nemo.exe
-bld::exe_name::model  nemo.exe
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bld_preproagr.cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bld_preproagr.cfg	(revision 2446)
+++ 	(revision )
@@ -1,86 +1,0 @@
-# ----------------------- FCM extract configuration file -----------------------
-cfg::type                           bld
-cfg::version                        1.0
-
-
-# ------------------------------------------------------------------------------
-# Build information
-# ------------------------------------------------------------------------------
-
-inc $COMPIL_DIR/arch_nemo.fcm
-inc $COMPIL_DIR/cpp.fcm
-search_src           1
-
-src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
-
-bld::target  lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 
-
-dir::root            $NEMO_TDIR/$NEW_CONF/OPAFILES
-
-bld::tool::fc_output
-bld::tool::fc_compile
-bld::tool::fc_include
-bld::tool::fc        $COMPIL_DIR/agrifpp.sh 
-bld::tool::fflags    
-bld::tool::ld       
-bld::tool::ldflags   
-bld::tool::ar        
-bld::tool::arflags   
-bld::tool::make      %MK
-
-OUTFILE_EXT::obj   .f90
-
-# Pre-process code before analysing dependencies
-bld::pp::nemo     1
-bld::pp::nemo/agrif2model     0
-bld::tool::fpp       cpp
-bld::tool::fppflags::nemo  %FPPFLAGS
-
-# Ignore the following dependencies
-bld::excl_dep        inc::netcdf.inc
-bld::excl_dep        inc::VT.inc
-bld::excl_dep        use::netcdf
-bld::excl_dep        h::netcdf.inc
-bld::excl_dep        h::mpif.h
-bld::excl_dep        inc::mpif.h
-bld::excl_dep        inc::mpe_logf.h
-bld::excl_dep        use::mpi
-bld::excl_dep        use::mod_prism_proto
-bld::excl_dep        use::mod_prism_def_partition_proto
-bld::excl_dep        use::mod_prism_get_comm
-bld::excl_dep        use::mod_prism_get_proto
-bld::excl_dep        use::mod_prism_put_proto
-bld::excl_dep        use::mod_comprism_proto
-bld::excl_dep        use::mod_prism
-bld::excl_dep        use::mkl_dfti
-bld::excl_dep	     use::nc4interface
-bld::excl_dep	     use::ioipsl
-bld::excl_dep	     use::xios
-bld::excl_dep	     use::agrif_types
-bld::excl_dep	     use::agrif_util
-bld::excl_dep        inc::SetNumberofcells.h
-bld::excl_dep        inc::GetNumberofcells.h
-bld::excl_dep        inc::include_use_Alloc_agrif.h
-bld::excl_dep        inc::allocations_calls_agrif.h
-bld::excl_dep        inc::modtype_agrif.h
-bld::excl_dep        inc::probdim_agrif.h
-bld::excl_dep        inc::keys_agrif.h
-bld::excl_dep        h::SetNumberofcells.h
-bld::excl_dep        h::GetNumberofcells.h
-bld::excl_dep        h::include_use_Alloc_agrif.h
-bld::excl_dep        h::allocations_calls_agrif.h
-bld::excl_dep        h::modtype_agrif.h
-bld::excl_dep        h::probdim_agrif.h
-bld::excl_dep        h::keys_agrif.h
-bld::excl_dep        use::mod_attribut
-bld::excl_dep        use::mod_event_client
-bld::excl_dep        use::mod_ioclient
-#bld::excl_dep        OBJ
-
-# Don't generate interface files
-bld::tool::geninterface none
-
-# Allow ".h90" and ".f90" as an extension for CPP include files
-bld::infile_ext::h90  CPP::INCLUDE
-bld::infile_ext::f90  FPP::FPP9X::SOURCE
-bld::src_type::nemo/agrif2model.F90 FORTRAN::FORTRAN9X::SOURCE
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bldxag.cfg
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/bldxag.cfg	(revision 2446)
+++ 	(revision )
@@ -1,68 +1,0 @@
-# ----------------------- FCM extract configuration file -----------------------
-cfg::type                           bld
-cfg::version                        1.0
-
-
-# ------------------------------------------------------------------------------
-# Build information
-# ------------------------------------------------------------------------------
-
-inc $COMPIL_DIR/arch_nemo.fcm
-inc $COMPIL_DIR/cpp.fcm
-
-search_src           1
-
-src::ioipsl               $MAIN_DIR/EXTERNAL/IOIPSL/src
-src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
-
-bld::target nemo.exe
-bld::exe_dep
-
-
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
-
-
-bld::tool::fc        %FC 
-bld::tool::fflags    %FCFLAGS %USER_INC
-bld::tool::ld        %LD
-bld::tool::ldflags   %LDFLAGS %USER_LIB
-bld::tool::ar        %AR
-bld::tool::arflags   %ARFLAGS
-bld::tool::make      %MK
-
-# Pre-process code before analysing dependencies
-bld::pp::ioipsl   1
-bld::pp::nemo     1
-bld::tool::fppflags::nemo     %FPPFLAGS
-bld::tool::fppflags::ioipsl   %FPPFLAGS
-
-# Ignore the following dependencies
-bld::excl_dep        inc::netcdf.inc
-bld::excl_dep        inc::VT.inc
-bld::excl_dep        use::netcdf
-bld::excl_dep        use::xios
-bld::excl_dep        h::netcdf.inc
-bld::excl_dep        h::mpif.h
-bld::excl_dep        inc::mpif.h
-bld::excl_dep        inc::mpe_logf.h
-bld::excl_dep        use::mpi
-bld::excl_dep        use::mod_prism_proto
-bld::excl_dep        use::mod_prism_def_partition_proto
-bld::excl_dep        use::mod_prism_get_comm
-bld::excl_dep        use::mod_prism_get_proto
-bld::excl_dep        use::mod_prism_put_proto
-bld::excl_dep        use::mod_comprism_proto
-bld::excl_dep        use::mod_prism
-bld::excl_dep        use::mkl_dfti
-# Don't generate interface files
-bld::tool::geninterface none
-
-# Allow ".h90" as an extension for CPP include files
-bld::infile_ext::h90  CPP::INCLUDE
-
-# extension for module output
-bld::outfile_ext::mod .mod
-
-# rename executable to nemo.exe
-bld::exe_name::model  nemo.exe
-
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/cpl_oasis3.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/cpl_oasis3.F90	(revision 2446)
+++ 	(revision )
@@ -1,379 +1,0 @@
-MODULE cpl_oasis3
-   !!======================================================================
-   !!                    ***  MODULE cpl_oasis  ***
-   !! Coupled O/A : coupled ocean-atmosphere case using OASIS3 V. prism_2_4
-   !!               special case: NEMO OPA/LIM coupled to ECHAM5
-   !!=====================================================================
-   !! History :   
-   !!   9.0  !  04-06  (R. Redler, NEC Laboratories Europe, Germany) Original code
-   !!   " "  !  04-11  (R. Redler, NEC Laboratories Europe; N. Keenlyside, W. Park, IFM-GEOMAR, Germany) revision
-   !!   " "  !  04-11  (V. Gayler, MPI M&D) Grid writing
-   !!   " "  !  05-08  (R. Redler, W. Park) frld initialization, paral(2) revision
-   !!   " "  !  05-09  (R. Redler) extended to allow for communication over root only
-   !!   " "  !  06-01  (W. Park) modification of physical part
-   !!   " "  !  06-02  (R. Redler, W. Park) buffer array fix for root exchange
-   !!   3.4  !  11-11  (C. Harris) Changes to allow mutiple category fields
-   !!----------------------------------------------------------------------
-#if defined key_oasis3
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3
-   !!----------------------------------------------------------------------
-   !!   cpl_prism_init     : initialization of coupled mode communication
-   !!   cpl_prism_define   : definition of grid and fields
-   !!   cpl_prism_snd     : snd out fields in coupled mode
-   !!   cpl_prism_rcv     : receive fields in coupled mode
-   !!   cpl_prism_finalize : finalize the coupled mode communication
-   !!----------------------------------------------------------------------
-#if defined key_oasis_mct
-   USE mod_prism
-#else
-   USE mod_prism_proto              ! OASIS3 prism module
-   USE mod_prism_def_partition_proto! OASIS3 prism module for partitioning
-   USE mod_prism_put_proto          ! OASIS3 prism module for snding
-   USE mod_prism_get_proto          ! OASIS3 prism module for receiving
-   USE mod_comprism_proto           ! OASIS3 prism module to get coupling frequency
-#endif
-   USE par_oce                      ! ocean parameters
-   USE dom_oce                      ! ocean space and time domain
-   USE in_out_manager               ! I/O manager
-   USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   cpl_prism_init
-   PUBLIC   cpl_prism_define
-   PUBLIC   cpl_prism_snd
-   PUBLIC   cpl_prism_rcv
-   PUBLIC   cpl_prism_freq
-   PUBLIC   cpl_prism_finalize
-
-   LOGICAL, PUBLIC, PARAMETER ::   lk_cpl = .TRUE.   !: coupled flag
-   INTEGER, PUBLIC            ::   OASIS_Rcv  = 1    !: return code if received field
-   INTEGER, PUBLIC            ::   OASIS_idle = 0    !: return code if nothing done by oasis
-   INTEGER                    ::   ncomp_id          ! id returned by prism_init_comp
-   INTEGER                    ::   nerror            ! return error code
-
-   INTEGER, PARAMETER ::   nmaxfld=40    ! Maximum number of coupling fields
-   
-   TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
-      LOGICAL               ::   laction   ! To be coupled or not
-      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field   
-      CHARACTER(len = 1)    ::   clgrid    ! Grid type  
-      REAL(wp)              ::   nsgn      ! Control of the sign change
-      INTEGER, DIMENSION(9) ::   nid       ! Id of the field (no more than 9 categories)
-      INTEGER               ::   nct       ! Number of categories in field
-   END TYPE FLD_CPL
-
-   TYPE(FLD_CPL), DIMENSION(nmaxfld), PUBLIC ::   srcv, ssnd   !: Coupling fields
-
-   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   exfld   ! Temporary buffer for receiving
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: cpl_oasis3.F90 3294 2012-01-28 16:44:18Z rblod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE cpl_prism_init( kl_comm )
-      !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_init  ***
-      !!
-      !! ** Purpose :   Initialize coupled mode communication for ocean
-      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
-      !!
-      !! ** Method  :   OASIS3 MPI communication 
-      !!--------------------------------------------------------------------
-      INTEGER, INTENT(out) ::   kl_comm   ! local communicator of the model
-      !!--------------------------------------------------------------------
-
-      ! WARNING: No write in numout in this routine
-      !============================================
-
-      !------------------------------------------------------------------
-      ! 1st Initialize the PRISM system for the application
-      !------------------------------------------------------------------
-      CALL prism_init_comp_proto ( ncomp_id, 'oceanx', nerror )
-      IF ( nerror /= PRISM_Ok ) &
-         CALL prism_abort_proto (ncomp_id, 'cpl_prism_init', 'Failure in prism_init_comp_proto')
-
-      !------------------------------------------------------------------
-      ! 3rd Get an MPI communicator for OPA local communication
-      !------------------------------------------------------------------
-
-      CALL prism_get_localcomm_proto ( kl_comm, nerror )
-      IF ( nerror /= PRISM_Ok ) &
-         CALL prism_abort_proto (ncomp_id, 'cpl_prism_init','Failure in prism_get_localcomm_proto' )
-      !
-   END SUBROUTINE cpl_prism_init
-
-
-   SUBROUTINE cpl_prism_define( krcv, ksnd )
-      !!-------------------------------------------------------------------
-      !!             ***  ROUTINE cpl_prism_define  ***
-      !!
-      !! ** Purpose :   Define grid and field information for ocean
-      !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
-      !!
-      !! ** Method  :   OASIS3 MPI communication 
-      !!--------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
-      !
-      INTEGER :: id_part
-      INTEGER :: paral(5)       ! OASIS3 box partition
-      INTEGER :: ishape(2,2)    ! shape of arrays passed to PSMILe
-      INTEGER :: ji,jc          ! local loop indicees
-      CHARACTER(LEN=8) :: zclname
-      !!--------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'cpl_prism_define : initialization in coupled ocean/atmosphere case'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
-      IF(lwp) WRITE(numout,*)
-
-      !
-      ! ... Define the shape for the area that excludes the halo
-      !     For serial configuration (key_mpp_mpi not being active)
-      !     nl* is set to the global values 1 and jp*glo.
-      !
-      ishape(:,1) = (/ 1, nlei-nldi+1 /)
-      ishape(:,2) = (/ 1, nlej-nldj+1 /)
-      !
-      ! ... Allocate memory for data exchange
-      !
-      ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
-      IF( nerror > 0 ) THEN
-         CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in allocating exfld')   ;   RETURN
-      ENDIF
-      !
-      ! -----------------------------------------------------------------
-      ! ... Define the partition 
-      ! -----------------------------------------------------------------
-      
-      paral(1) = 2                                              ! box partitioning
-      paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset    
-      paral(3) = nlei-nldi+1                                    ! local extent in i 
-      paral(4) = nlej-nldj+1                                    ! local extent in j
-      paral(5) = jpiglo                                         ! global extent in x
-      
-      IF( ln_ctl ) THEN
-         WRITE(numout,*) ' multiexchg: paral (1:5)', paral
-         WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj
-         WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp
-         WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp
-      ENDIF
-      
-      CALL prism_def_partition_proto ( id_part, paral, nerror )
-      !
-      ! ... Announce send variables. 
-      !
-      DO ji = 1, ksnd
-         IF ( ssnd(ji)%laction ) THEN 
-            DO jc = 1, ssnd(ji)%nct
-               IF ( ssnd(ji)%nct .gt. 1 ) THEN
-                  WRITE(zclname,'( a7, i1)') ssnd(ji)%clname,jc
-               ELSE
-                  zclname=ssnd(ji)%clname
-               ENDIF
-               WRITE(numout,*) "Define",ji,jc,zclname," for",PRISM_Out
-               CALL prism_def_var_proto (ssnd(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
-                    PRISM_Out, ishape, PRISM_REAL, nerror)
-               IF ( nerror /= PRISM_Ok ) THEN
-                  WRITE(numout,*) 'Failed to define transient ', ji, TRIM(zclname)
-                  CALL prism_abort_proto ( ssnd(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
-               ENDIF
-            END DO
-         ENDIF
-      END DO
-      !
-      ! ... Announce received variables. 
-      !
-      DO ji = 1, krcv
-         IF ( srcv(ji)%laction ) THEN 
-            DO jc = 1, srcv(ji)%nct
-               IF ( srcv(ji)%nct .gt. 1 ) THEN
-                  WRITE(zclname,'( a7, i1)') srcv(ji)%clname,jc
-               ELSE
-                  zclname=srcv(ji)%clname
-               ENDIF
-               WRITE(numout,*) "Define",ji,jc,zclname," for",PRISM_In
-               CALL prism_def_var_proto ( srcv(ji)%nid(jc), zclname, id_part, (/ 2, 0/),   &
-                    &                      PRISM_In    , ishape   , PRISM_REAL, nerror)
-               IF ( nerror /= PRISM_Ok ) THEN
-                  WRITE(numout,*) 'Failed to define transient ', ji, TRIM(zclname)
-                  CALL prism_abort_proto ( srcv(ji)%nid(jc), 'cpl_prism_define', 'Failure in prism_def_var')
-               ENDIF
-            END DO
-         ENDIF
-      END DO
-      
-      !------------------------------------------------------------------
-      ! End of definition phase
-      !------------------------------------------------------------------
-      
-      CALL prism_enddef_proto(nerror)
-      IF( nerror /= PRISM_Ok )   CALL prism_abort_proto ( ncomp_id, 'cpl_prism_define', 'Failure in prism_enddef')
-      !
-   END SUBROUTINE cpl_prism_define
-   
-   
-   SUBROUTINE cpl_prism_snd( kid, kstep, pdata, kinfo )
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_snd  ***
-      !!
-      !! ** Purpose : - At each coupling time-step,this routine sends fields
-      !!      like sst or ice cover to the coupler or remote application.
-      !!----------------------------------------------------------------------
-      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
-      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
-      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdata
-      !!
-      INTEGER                                   ::   jc        ! local loop index
-      !!--------------------------------------------------------------------
-      !
-      ! snd data to OASIS3
-      !
-      DO jc = 1, ssnd(kid)%nct
-
-         CALL prism_put_proto ( ssnd(kid)%nid(jc), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
-         
-         IF ( ln_ctl ) THEN        
-            IF ( kinfo == PRISM_Sent     .OR. kinfo == PRISM_ToRest .OR.   &
-                 & kinfo == PRISM_SentOut  .OR. kinfo == PRISM_ToRestOut ) THEN
-               WRITE(numout,*) '****************'
-               WRITE(numout,*) 'prism_put_proto: Outgoing ', ssnd(kid)%clname
-               WRITE(numout,*) 'prism_put_proto: ivarid ', ssnd(kid)%nid(jc)
-               WRITE(numout,*) 'prism_put_proto:  kstep ', kstep
-               WRITE(numout,*) 'prism_put_proto:   info ', kinfo
-               WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
-               WRITE(numout,*) '****************'
-            ENDIF
-         ENDIF
-
-      ENDDO
-      !
-    END SUBROUTINE cpl_prism_snd
-
-
-   SUBROUTINE cpl_prism_rcv( kid, kstep, pdata, kinfo )
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_rcv  ***
-      !!
-      !! ** Purpose : - At each coupling time-step,this routine receives fields
-      !!      like stresses and fluxes from the coupler or remote application.
-      !!----------------------------------------------------------------------
-      INTEGER                   , INTENT(in   ) ::   kid       ! variable index in the array
-      INTEGER                   , INTENT(in   ) ::   kstep     ! ocean time-step in seconds
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdata     ! IN to keep the value if nothing is done
-      INTEGER                   , INTENT(  out) ::   kinfo     ! OASIS3 info argument
-      !!
-      INTEGER                                   ::   jc        ! local loop index
-      LOGICAL                                   ::   llaction
-      !!--------------------------------------------------------------------
-      !
-      ! receive local data from OASIS3 on every process
-      !
-      DO jc = 1, srcv(kid)%nct
-
-         CALL prism_get_proto ( srcv(kid)%nid(jc), kstep, exfld, kinfo )         
-         
-         llaction = .false.
-         IF( kinfo == PRISM_Recvd   .OR. kinfo == PRISM_FromRest .OR.   &
-              kinfo == PRISM_RecvOut .OR. kinfo == PRISM_FromRestOut )   llaction = .TRUE.
-         
-         IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc)
-         
-         IF ( llaction ) THEN
-            
-            pdata(nldi:nlei, nldj:nlej,jc) = exfld(:,:)
-            
-            !--- Fill the overlap areas and extra hallows (mpp)
-            !--- check periodicity conditions (all cases)
-            CALL lbc_lnk( pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
-            
-            IF ( ln_ctl ) THEN        
-               WRITE(numout,*) '****************'
-               WRITE(numout,*) 'prism_get_proto: Incoming ', srcv(kid)%clname
-               WRITE(numout,*) 'prism_get_proto: ivarid '  , srcv(kid)%nid(jc)
-               WRITE(numout,*) 'prism_get_proto:   kstep', kstep
-               WRITE(numout,*) 'prism_get_proto:   info ', kinfo
-               WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(:,:,jc))
-               WRITE(numout,*) '     -     Sum value is ', SUM(pdata(:,:,jc))
-               WRITE(numout,*) '****************'
-            ENDIF
-
-            ! Ideally we would not reuse kinfo, but define a separate variable
-            ! for use as the return code from this routine to avoid confusion
-            ! with the return code previously obtained from the coupler.
-            kinfo = OASIS_Rcv
-            
-         ELSE
-            kinfo = OASIS_idle     
-         ENDIF
-         
-      ENDDO
-      !
-   END SUBROUTINE cpl_prism_rcv
-
-
-   INTEGER FUNCTION cpl_prism_freq( kid )  
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_freq  ***
-      !!
-      !! ** Purpose : - send back the coupling frequency for a particular field
-      !!----------------------------------------------------------------------
-      INTEGER,INTENT(in) ::   kid   ! variable index 
-      !!----------------------------------------------------------------------
-#if ! defined key_oasis_mct
-      cpl_prism_freq = ig_def_freq( kid )
-#else
-      cpl_prism_freq = 300
-#endif
-      !
-   END FUNCTION cpl_prism_freq
-
-
-   SUBROUTINE cpl_prism_finalize
-      !!---------------------------------------------------------------------
-      !!              ***  ROUTINE cpl_prism_finalize  ***
-      !!
-      !! ** Purpose : - Finalizes the coupling. If MPI_init has not been
-      !!      called explicitly before cpl_prism_init it will also close
-      !!      MPI communication.
-      !!----------------------------------------------------------------------
-      !
-      DEALLOCATE( exfld )
-      IF (nstop == 0) THEN
-          CALL prism_terminate_proto( nerror )         
-      ELSE
-          CALL prism_abort_proto(ncomp_id, "nemo crash", "nemo crash")
-      ENDIF
-      !
-   END SUBROUTINE cpl_prism_finalize
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default case          Dummy module          Forced Ocean/Atmosphere
-   !!----------------------------------------------------------------------
-   USE in_out_manager               ! I/O manager
-   LOGICAL, PUBLIC, PARAMETER :: lk_cpl = .FALSE.   !: coupled flag
-   PUBLIC cpl_prism_init
-   PUBLIC cpl_prism_finalize
-CONTAINS
-   SUBROUTINE cpl_prism_init (kl_comm) 
-      INTEGER, INTENT(out)   :: kl_comm       ! local communicator of the model
-      kl_comm = -1
-      WRITE(numout,*) 'cpl_prism_init: Error you sould not be there...'
-   END SUBROUTINE cpl_prism_init
-   SUBROUTINE cpl_prism_finalize
-      WRITE(numout,*) 'cpl_prism_finalize: Error you sould not be there...'
-   END SUBROUTINE cpl_prism_finalize
-#endif
-
-   !!=====================================================================
-END MODULE cpl_oasis3
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/diaptr.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/diaptr.F90	(revision 2446)
+++ 	(revision )
@@ -1,773 +1,0 @@
-MODULE diaptr
-   !!======================================================================
-   !!                       ***  MODULE  diaptr  ***
-   !! Ocean physics:  Computes meridonal transports and zonal means
-   !!=====================================================================
-   !! History :  1.0  ! 2003-09  (C. Talandier, G. Madec)  Original code
-   !!            2.0  ! 2006-01  (A. Biastoch)  Allow sub-basins computation
-   !!            3.2  ! 2010-03  (O. Marti, S. Flavoni) Add fields
-   !!            3.3  ! 2010-10  (G. Madec)  dynamical allocation
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dia_ptr      : Poleward Transport Diagnostics module
-   !!   dia_ptr_init : Initialization, namelist read
-   !!   dia_ptr_wri  : Output of poleward fluxes
-   !!   ptr_vjk      : "zonal" sum computation of a "meridional" flux array
-   !!   ptr_tjk      : "zonal" mean computation of a tracer field
-   !!   ptr_vj       : "zonal" and vertical sum computation of a "meridional" flux array
-   !!                   (Generic interface to ptr_vj_3d, ptr_vj_2d)
-   !!----------------------------------------------------------------------
-   USE oce              ! ocean dynamics and active tracers
-   USE dom_oce          ! ocean space and time domain
-   USE phycst           ! physical constants
-   USE ldftra_oce       ! ocean active tracers: lateral physics
-   USE dianam           !
-   USE diaptr_oce
-   USE iom              ! IOM library
-   USE ioipsl           ! IO-IPSL library
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE lbclnk           ! lateral boundary condition - processor exchanges
-   USE timing           ! preformance summary
-   USE wrk_nemo         ! working arrays
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dia_ptr_init   ! call in opa module
-   PUBLIC   dia_ptr        ! call in step module
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: diaptr.F90 4624 2014-04-28 12:09:03Z acc $ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-
-   SUBROUTINE dia_ptr( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dia_ptr  ***
-      !!----------------------------------------------------------------------
-      USE oce,     vt  =>   ua   ! use ua as workspace
-      USE oce,     vs  =>   va   ! use va as workspace
-      IMPLICIT none
-      !!
-      INTEGER, INTENT(in) ::   kt   ! ocean time step index
-      !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::   zv               ! local scalar
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )   CALL timing_start('dia_ptr')
-      !
-      IF( kt == nit000 .OR. MOD( kt, nn_fptr ) == 0 )   THEN
-         !
-         IF( MOD( kt, nn_fptr ) == 0 ) THEN 
-            !
-            IF( ln_diaznl ) THEN               ! i-mean temperature and salinity
-               DO jn = 1, nptr
-                  tn_jk(:,:,jn) = ptr_tjk( tsn(:,:,:,jp_tem), btmsk(:,:,jn) ) * r1_sjk(:,:,jn)
-                  sn_jk(:,:,jn) = ptr_tjk( tsn(:,:,:,jp_sal), btmsk(:,:,jn) ) * r1_sjk(:,:,jn)
-               END DO
-            ENDIF
-            !
-            !                          ! horizontal integral and vertical dz 
-            !                                ! eulerian velocity
-            v_msf(:,:,1) = ptr_vjk( vn(:,:,:) ) 
-            DO jn = 2, nptr
-               v_msf(:,:,jn) = ptr_vjk( vn(:,:,:), btmsk(:,:,jn)*btm30(:,:) ) 
-            END DO
-#if defined key_diaeiv
-            DO jn = 1, nptr                  ! bolus velocity
-               v_msf_eiv(:,:,jn) = ptr_vjk( v_eiv(:,:,:), btmsk(:,:,jn) )   ! here no btm30 for MSFeiv
-            END DO
-            !                                ! add bolus stream-function to the eulerian one
-            v_msf(:,:,:) = v_msf(:,:,:) + v_msf_eiv(:,:,:)
-#endif
-            !
-            !                          ! Transports
-            !                                ! local heat & salt transports at T-points  ( tsn*mj[vn+v_eiv] )
-            vt(:,:,jpk) = 0._wp   ;   vs(:,:,jpk) = 0._wp
-            DO jk= 1, jpkm1
-               DO jj = 2, jpj
-                  DO ji = 1, jpi
-#if defined key_diaeiv 
-                     zv = ( vn(ji,jj,jk) + vn(ji,jj-1,jk) + v_eiv(ji,jj,jk) + v_eiv(ji,jj-1,jk) ) * 0.5_wp
-#else
-                     zv = ( vn(ji,jj,jk) + vn(ji,jj-1,jk) ) * 0.5_wp
-#endif 
-                     vt(ji,jj,jk) = zv * tsn(ji,jj,jk,jp_tem)
-                     vs(ji,jj,jk) = zv * tsn(ji,jj,jk,jp_sal)
-                  END DO
-               END DO
-            END DO
-!!gm useless as overlap areas are not used in ptr_vjk
-            CALL lbc_lnk( vs, 'V', -1. )   ;   CALL lbc_lnk( vt, 'V', -1. )
-!!gm
-            !                                ! heat & salt advective transports (approximation)
-            htr(:,1) = SUM( ptr_vjk( vt(:,:,:) ) , 2 ) * rc_pwatt   ! SUM over jk + conversion
-            str(:,1) = SUM( ptr_vjk( vs(:,:,:) ) , 2 ) * rc_ggram
-            DO jn = 2, nptr 
-               htr(:,jn) = SUM( ptr_vjk( vt(:,:,:), btmsk(:,:,jn)*btm30(:,:) ) , 2 ) * rc_pwatt   ! mask Southern Ocean
-               str(:,jn) = SUM( ptr_vjk( vs(:,:,:), btmsk(:,:,jn)*btm30(:,:) ) , 2 ) * rc_ggram   ! mask Southern Ocean
-            END DO
-
-            IF( ln_ptrcomp ) THEN            ! overturning transport
-               htr_ove(:) = SUM( v_msf(:,:,1) * tn_jk(:,:,1), 2 ) * rc_pwatt   ! SUM over jk + conversion
-               str_ove(:) = SUM( v_msf(:,:,1) * sn_jk(:,:,1), 2 ) * rc_ggram
-            END IF
-            !                                ! Advective and diffusive transport
-            htr_adv(:) = htr_adv(:) * rc_pwatt        ! these are computed in tra_adv... and tra_ldf... routines 
-            htr_ldf(:) = htr_ldf(:) * rc_pwatt        ! here just the conversion in PW and Gg
-            str_adv(:) = str_adv(:) * rc_ggram
-            str_ldf(:) = str_ldf(:) * rc_ggram
-
-#if defined key_diaeiv
-            DO jn = 1, nptr                  ! Bolus component
-               htr_eiv(:,jn) = SUM( v_msf_eiv(:,:,jn) * tn_jk(:,:,jn), 2 ) * rc_pwatt   ! SUM over jk
-               str_eiv(:,jn) = SUM( v_msf_eiv(:,:,jn) * sn_jk(:,:,jn), 2 ) * rc_ggram   ! SUM over jk
-            END DO
-#endif
-            !                                ! "Meridional" Stream-Function
-            DO jn = 1, nptr
-               DO jk = 2, jpk 
-                  v_msf    (:,jk,jn) = v_msf    (:,jk-1,jn) + v_msf    (:,jk,jn)       ! Eulerian j-Stream-Function
-#if defined key_diaeiv
-                  v_msf_eiv(:,jk,jn) = v_msf_eiv(:,jk-1,jn) + v_msf_eiv(:,jk,jn)       ! Bolus    j-Stream-Function
-
-#endif
-               END DO
-            END DO
-            v_msf    (:,:,:) = v_msf    (:,:,:) * rc_sv       ! converte in Sverdrups
-#if defined key_diaeiv
-            v_msf_eiv(:,:,:) = v_msf_eiv(:,:,:) * rc_sv
-#endif
-         ENDIF
-         !
-         CALL dia_ptr_wri( kt )                        ! outputs
-         !
-      ENDIF
-      !
-      IF( nn_timing == 1 )   CALL timing_stop('dia_ptr')
-      !
-   END SUBROUTINE dia_ptr
-
-
-   SUBROUTINE dia_ptr_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dia_ptr_init  ***
-      !!                   
-      !! ** Purpose :   Initialization, namelist read
-      !!----------------------------------------------------------------------
-      INTEGER ::   jn, ji, jj           ! dummy loop indices 
-      INTEGER ::   inum, ierr   ! local integers
-      INTEGER ::   ios          ! Local integer output status for namelist read
-#if defined key_mpp_mpi
-      INTEGER, DIMENSION(1) :: iglo, iloc, iabsf, iabsl, ihals, ihale, idid
-#endif
-      !!
-      NAMELIST/namptr/ ln_diaptr, ln_diaznl, ln_subbas, ln_ptrcomp, nn_fptr, nn_fwri
-      !!----------------------------------------------------------------------
-
-      REWIND( numnam_ref )              ! Namelist namptr in reference namelist : Poleward transport
-      READ  ( numnam_ref, namptr, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namptr in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namptr in configuration namelist : Poleward transport
-      READ  ( numnam_cfg, namptr, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namptr in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namptr )
-
-      IF(lwp) THEN                     ! Control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'dia_ptr_init : poleward transport and msf initialization'
-         WRITE(numout,*) '~~~~~~~~~~~~'
-         WRITE(numout,*) '   Namelist namptr : set ptr parameters'
-         WRITE(numout,*) '      Poleward heat & salt transport (T) or not (F)      ln_diaptr  = ', ln_diaptr
-         WRITE(numout,*) '      Overturning heat & salt transport                  ln_ptrcomp = ', ln_ptrcomp
-         WRITE(numout,*) '      T & S zonal mean and meridional stream function    ln_diaznl  = ', ln_diaznl 
-         WRITE(numout,*) '      Global (F) or glo/Atl/Pac/Ind/Indo-Pac basins      ln_subbas  = ', ln_subbas
-         WRITE(numout,*) '      Frequency of computation                           nn_fptr    = ', nn_fptr
-         WRITE(numout,*) '      Frequency of outputs                               nn_fwri    = ', nn_fwri
-      ENDIF
-      
-      IF( ln_diaptr) THEN  
-     
-         IF( nn_timing == 1 )   CALL timing_start('dia_ptr_init')
-      
-         IF( ln_subbas ) THEN   ;   nptr = 5       ! Global, Atlantic, Pacific, Indian, Indo-Pacific
-         ELSE                   ;   nptr = 1       ! Global only
-         ENDIF
-
-         !                                      ! allocate dia_ptr arrays
-         IF( dia_ptr_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'dia_ptr_init : unable to allocate arrays' )
-
-         rc_pwatt = rc_pwatt * rau0 * rcp          ! conversion from K.s-1 to PetaWatt
-
-         IF( lk_mpp )   CALL mpp_ini_znl( numout )     ! Define MPI communicator for zonal sum
-
-         IF( ln_subbas ) THEN                ! load sub-basin mask
-            CALL iom_open( 'subbasins', inum )
-            CALL iom_get( inum, jpdom_data, 'atlmsk', btmsk(:,:,2) )   ! Atlantic basin
-            CALL iom_get( inum, jpdom_data, 'pacmsk', btmsk(:,:,3) )   ! Pacific  basin
-            CALL iom_get( inum, jpdom_data, 'indmsk', btmsk(:,:,4) )   ! Indian   basin
-            CALL iom_close( inum )
-            btmsk(:,:,5) = MAX ( btmsk(:,:,3), btmsk(:,:,4) )          ! Indo-Pacific basin
-            WHERE( gphit(:,:) < -30._wp)   ;   btm30(:,:) = 0._wp      ! mask out Southern Ocean
-            ELSE WHERE                     ;   btm30(:,:) = tmask(:,:,1)
-            END WHERE
-         ENDIF
-         btmsk(:,:,1) = tmask_i(:,:)                                   ! global ocean
-      
-         DO jn = 1, nptr
-            btmsk(:,:,jn) = btmsk(:,:,jn) * tmask_i(:,:)               ! interior domain only
-         END DO
-      
-         IF( lk_vvl )   CALL ctl_stop( 'diaptr: error in vvl case as constant i-mean surface is used' )
-
-         !                                   ! i-sum of e1v*e3v surface and its inverse
-         DO jn = 1, nptr
-            sjk(:,:,jn) = ptr_tjk( tmask(:,:,:), btmsk(:,:,jn) )
-            r1_sjk(:,:,jn) = 0._wp
-            WHERE( sjk(:,:,jn) /= 0._wp )   r1_sjk(:,:,jn) = 1._wp / sjk(:,:,jn)
-         END DO
-
-      ! Initialise arrays to zero because diatpr is called before they are first calculated
-      ! Note that this means diagnostics will not be exactly correct when model run is restarted.
-      htr_adv(:) = 0._wp ; str_adv(:) =  0._wp ;  htr_ldf(:) = 0._wp ; str_ldf(:) =  0._wp
-
-      ! Reference latitude (used in plots)
-      ! ------------------
-      !                                           ! =======================
-      IF( cp_cfg == "orca" ) THEN                 !   ORCA configurations
-        !                                        ! =======================
-        IF( jp_cfg == 05  )   nxline = 192   ! i-line that passes near the North Pole
-        IF( jp_cfg == 025 )   nxline = 384   ! i-line that passes near the North Pole
-        IF( jp_cfg == 1   )   nxline =  96   ! i-line that passes near the North Pole
-        IF( jp_cfg == 2   )   nxline =  48   ! i-line that passes near the North Pole
-        IF( jp_cfg == 4   )   nxline =  24   ! i-line that passes near the North Pole
-        !                                         !=======================
-      ELSE                                        !   OTHER configurations 
-        !                                        ! =======================
-        nxline = 1
-        !
-      ENDIF
-
-      IF( nn_timing == 1 )   CALL timing_stop('dia_ptr_init')
-      !
-      ENDIF 
-      ! 
-   END SUBROUTINE dia_ptr_init
-
-#if defined key_iomput
-
-   SUBROUTINE dia_ptr_wri( kt )
-      !!---------------------------------------------------------------------
-      !!                ***  ROUTINE dia_ptr_wri  ***
-      !!
-      !! ** Purpose :   output of poleward fluxes
-      !!
-      !! ** Method  :   NetCDF file
-      !!----------------------------------------------------------------------
-      !!
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !!
-      REAL(wp), POINTER, DIMENSION(:,:    ) :: z2d 
-      REAL(wp), POINTER, DIMENSION(:,:,:  ) :: z3d  
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: z4d 
-      !!----------------------------------------------------------------------
-
-
-      CALL wrk_alloc( jpi, jpj, jpk, nptr, z4d )
-      CALL wrk_alloc( jpi, jpj,      nptr, z3d )
-      CALL wrk_alloc( jpi, jpj,            z2d )
-      !
-      z4d(:,:,:,:) = 0._wp
-      z3d(:,:,:  ) = 0._wp
-      z2d(:,:    ) = 0._wp
-      !
-      IF( ln_diaznl ) THEN 
-        !
-        z4d(nxline,:,:,1) = sjk(:,:,1)
-        CALL iom_put( 'zosrfglo', z4d(:,:,:,1) )
-        z4d(nxline,:,:,1) = tn_jk(:,:,1)
-        CALL iom_put( 'zotemglo', z4d(:,:,:,1) )
-        z4d(nxline,:,:,1) = sn_jk(:,:,1)
-        CALL iom_put( 'zosalglo', z4d(:,:,:,1) )
-        ! overturning outputs:
-        z4d(nxline,:,:,1) = v_msf(:,:,1)
-        CALL iom_put( 'zomsfglo', z4d(:,:,:,1) )
-#if defined key_diaeiv
-        z4d(nxline,:,:,1) = v_msf_eiv(:,:,1)
-        CALL iom_put( 'zomsfeiv', z4d(:,:,:,1) )
-#endif
-        IF (ln_subbas) THEN 
-           !
-           z4d(nxline,:,:,2) = sjk(:,:,2)
-           z4d(nxline,:,:,3) = sjk(:,:,3)
-           z4d(nxline,:,:,4) = sjk(:,:,4)
-           z4d(nxline,:,:,5) = sjk(:,:,5)
-           CALL iom_put( 'zosrfatl', z4d(:,:,:,2) )
-           CALL iom_put( 'zosrfpac', z4d(:,:,:,3) )
-           CALL iom_put( 'zosrfind', z4d(:,:,:,4) )
-           CALL iom_put( 'zosrfipc', z4d(:,:,:,5) )
-           !
-           z4d(nxline,:,:,2) = tn_jk(:,:,2)
-           z4d(nxline,:,:,3) = tn_jk(:,:,3)
-           z4d(nxline,:,:,4) = tn_jk(:,:,4)
-           z4d(nxline,:,:,5) = tn_jk(:,:,5)
-           CALL iom_put( 'zotematl', z4d(:,:,:,2) )
-           CALL iom_put( 'zotempac', z4d(:,:,:,3) )
-           CALL iom_put( 'zotemind', z4d(:,:,:,4) )
-           CALL iom_put( 'zotemipc', z4d(:,:,:,5) )
-           !
-           z4d(nxline,:,:,2) = sn_jk(:,:,2)
-           z4d(nxline,:,:,3) = sn_jk(:,:,3)
-           z4d(nxline,:,:,4) = sn_jk(:,:,4)
-           z4d(nxline,:,:,5) = sn_jk(:,:,5)
-           CALL iom_put( 'zosalatl', z4d(:,:,:,2) )
-           CALL iom_put( 'zosalpac', z4d(:,:,:,3) )
-           CALL iom_put( 'zosalind', z4d(:,:,:,4) )
-           CALL iom_put( 'zosalipc', z4d(:,:,:,5) )
-           !
-           z4d(nxline,:,:,2) = v_msf(:,:,2)
-           z4d(nxline,:,:,3) = v_msf(:,:,3)
-           z4d(nxline,:,:,4) = v_msf(:,:,4)
-           z4d(nxline,:,:,5) = v_msf(:,:,5)
-           CALL iom_put( 'zomsfatl', z4d(:,:,:,2) )
-           CALL iom_put( 'zomsfpac', z4d(:,:,:,3) )
-           CALL iom_put( 'zomsfind', z4d(:,:,:,4) )
-           CALL iom_put( 'zomsfipc', z4d(:,:,:,5) )
-        END IF
-     ENDIF
-
-     ! heat transport outputs:
-     IF( ln_subbas ) THEN
-        !
-        z3d(nxline,:,2) = htr(:,2)
-        z3d(nxline,:,3) = htr(:,3)
-        z3d(nxline,:,4) = htr(:,4)
-        z3d(nxline,:,5) = htr(:,5)
-        CALL iom_put( 'sohtatl', z3d(:,:,2) )
-        CALL iom_put( 'sohtpac', z3d(:,:,3) )
-        CALL iom_put( 'sohtind', z3d(:,:,4) )
-        CALL iom_put( 'sohtipc', z3d(:,:,5) )
-        !
-        z3d(nxline,:,2) = str(:,2)
-        z3d(nxline,:,3) = str(:,3)
-        z3d(nxline,:,4) = str(:,4)
-        z3d(nxline,:,5) = str(:,5)
-        CALL iom_put( 'sostatl', z3d(:,:,2) )
-        CALL iom_put( 'sostpac', z3d(:,:,3) )
-        CALL iom_put( 'sostind', z3d(:,:,4) )
-        CALL iom_put( 'sostipc', z3d(:,:,5) )
-        !
-     ENDIF
-#if defined key_diaeiv
-     z3d(nxline,:,1) = htr_eiv(:,1)
-     CALL iom_put( 'sophteiv', z3d(:,:,1) )
-     !
-     z3d(nxline,:,1) = str_eiv(:,1)
-     CALL iom_put( 'sopsteiv', z3d(:,:,1) )
-#endif
-     z2d(nxline,:) = htr_adv(:)
-     CALL iom_put( 'sophtadv', z2d(:,:) )
-     z2d(nxline,:) = htr_ldf(:)
-     CALL iom_put( 'sophtldf', z2d(:,:) )
-     !
-     z2d(nxline,:) = str_adv(:)
-     CALL iom_put( 'sopstadv', z2d(:,:) )
-     z2d(nxline,:) = str_ldf(:)
-     CALL iom_put( 'sopstldf', z2d(:,:) )
-     !
-     IF( ln_ptrcomp ) THEN 
-        z2d(nxline,:) = htr_ove(:)
-        CALL iom_put( 'sophtove', z2d(:,:) )
-        !
-        z2d(nxline,:) = str_ove(:)
-        CALL iom_put( 'sopstove', z2d(:,:) )
-     ENDIF
-    !
-    CALL wrk_dealloc( jpi, jpj, jpk, nptr, z4d )
-    CALL wrk_dealloc( jpi, jpj,      nptr, z3d )
-    CALL wrk_dealloc( jpi, jpj,            z2d )
-
-   END SUBROUTINE dia_ptr_wri
-
-#else
-
-   SUBROUTINE dia_ptr_wri( kt )
-      !!---------------------------------------------------------------------
-      !!                ***  ROUTINE dia_ptr_wri  ***
-      !!
-      !! ** Purpose :   output of poleward fluxes
-      !!
-      !! ** Method  :   NetCDF file
-      !!----------------------------------------------------------------------
-      !!
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !!
-      INTEGER, SAVE ::   nhoridz, ndepidzt, ndepidzw
-      INTEGER, SAVE ::   ndim  , ndim_atl     , ndim_pac     , ndim_ind     , ndim_ipc
-      INTEGER, SAVE ::           ndim_atl_30  , ndim_pac_30  , ndim_ind_30  , ndim_ipc_30
-      INTEGER, SAVE ::   ndim_h, ndim_h_atl_30, ndim_h_pac_30, ndim_h_ind_30, ndim_h_ipc_30
-      !!
-      CHARACTER (len=40) ::   clhstnam, clop, clop_once, cl_comment   ! temporary names
-      INTEGER            ::   it, itmod, ji, jj, jk            !
-#if defined key_iomput
-      INTEGER            ::   inum                                    ! temporary logical unit
-#endif
-      REAL(wp)           ::   zsto, zout, zdt, zjulian                ! temporary scalars
-      !!
-      REAL(wp), POINTER, DIMENSION(:)   ::   zphi, zfoo    ! 1D workspace
-      REAL(wp), POINTER, DIMENSION(:,:) ::   z_1           ! 2D workspace
-#if defined key_mpp_mpi
-      INTEGER, DIMENSION(1) :: iglo, iloc, iabsf, iabsl, ihals, ihale, idid
-#endif
-
-      !!-------------------------------------------------------------------- 
-      !
-      CALL wrk_alloc( jpj      , zphi, zfoo )
-      CALL wrk_alloc( jpj , jpk, z_1        )
-
-      ! define time axis
-      it    = kt / nn_fptr
-      itmod = kt - nit000 + 1
-      
-      ! Initialization
-      ! --------------
-      IF( kt == nit000 ) THEN
-         niter = ( nit000 - 1 ) / nn_fptr
-         zdt = rdt
-         IF( nacc == 1 )   zdt = rdtmin
-         !
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) 'dia_ptr_wri : poleward transport and msf writing: initialization , niter = ', niter
-            WRITE(numout,*) '~~~~~~~~~~~~'
-         ENDIF
-         !
-#if defined key_mpp_mpi 
-         iglo (1) = jpjglo                   ! MPP case using MPI  ('key_mpp_mpi')
-         iloc (1) = nlcj
-         iabsf(1) = njmppt(narea)
-         iabsl(:) = iabsf(:) + iloc(:) - 1
-         ihals(1) = nldj - 1
-         ihale(1) = nlcj - nlej
-         idid (1) = 2
-         CALL flio_dom_set( jpnj, nproc/jpni, idid, iglo, iloc, iabsf, iabsl, ihals, ihale, 'BOX', nidom_ptr )
-#else
-         nidom_ptr = FLIO_DOM_NONE
-#endif
-
-         ! Reference latitude (used in plots)
-         ! ------------------
-         !                                           ! =======================
-         IF( cp_cfg == "orca" ) THEN                 !   ORCA configurations
-           !                                        ! =======================
-           zphi(1:jpj) = 0._wp
-           DO ji = mi0(nxline), mi1(nxline) 
-              zphi(1:jpj) = gphiv(ji,:)         ! if nxline is in the local domain
-              ! Correct highest latitude for some configurations - will work if domain is parallelized in J ?
-              IF( jp_cfg == 05 ) THEN
-                 DO jj = mj0(jpjdta), mj1(jpjdta) 
-                    zphi( jj ) = zphi(mj0(jpjdta-1)) + ( zphi(mj0(jpjdta-1))-zphi(mj0(jpjdta-2)) ) * 0.5_wp
-                    zphi( jj ) = MIN( zphi(jj), 90._wp )
-                 END DO
-              END IF
-              IF( jp_cfg == 1 .OR. jp_cfg == 2 .OR. jp_cfg == 4 ) THEN
-                 DO jj = mj0(jpjdta-1), mj1(jpjdta-1) 
-                    zphi( jj ) = 88.5_wp
-                 END DO
-                 DO jj = mj0(jpjdta  ), mj1(jpjdta  ) 
-                    zphi( jj ) = 89.5_wp
-                 END DO
-              END IF
-           END DO
-           ! provide the correct zphi to all local domains
-#if defined key_mpp_mpi
-           CALL mpp_sum( zphi, jpj, ncomm_znl )        
-#endif
-           !                                        ! =======================
-         ELSE                                       !   OTHER configurations 
-           !                                        ! =======================
-           zphi(1:jpj) = gphiv(1,:)             ! assume lat/lon coordinate, select the first i-line
-           !
-         ENDIF
-
-         ! Work only on westmost processor (will not work if mppini2 is used)
-#if defined key_mpp_mpi
-         IF( l_znl_root ) THEN 
-#endif
-            !
-            ! OPEN netcdf file 
-            ! ----------------
-            ! Define frequency of output and means
-            zsto = nn_fptr * zdt
-            IF( ln_mskland )   THEN    ! put 1.e+20 on land (very expensive!!)
-               clop      = "ave(only(x))"
-               clop_once = "once(only(x))"
-            ELSE                       ! no use of the mask value (require less cpu time)
-               clop      = "ave(x)"       
-               clop_once = "once"
-            ENDIF
-
-            zout = nn_fwri * zdt
-            zfoo(1:jpj) = 0._wp
-
-            CALL ymds2ju( nyear, nmonth, nday, rdt, zjulian )  ! Compute julian date from starting date of the run
-            zjulian = zjulian - adatrj                         ! set calendar origin to the beginning of the experiment
-
-#if defined key_iomput
-            ! Requested by IPSL people, use by their postpro...
-            IF(lwp) THEN
-               CALL dia_nam( clhstnam, nn_fwri,' ' )
-               CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
-               WRITE(inum,*) clhstnam
-               CLOSE(inum)
-            ENDIF
-#endif
-
-            CALL dia_nam( clhstnam, nn_fwri, 'diaptr' )
-            IF(lwp)WRITE( numout,*)" Name of diaptr NETCDF file : ", clhstnam
-
-            ! Horizontal grid : zphi()
-            CALL histbeg(clhstnam, 1, zfoo, jpj, zphi,   &
-               1, 1, 1, jpj, niter, zjulian, zdt*nn_fptr, nhoridz, numptr, domain_id=nidom_ptr)
-            ! Vertical grids : gdept_1d, gdepw_1d
-            CALL histvert( numptr, "deptht", "Vertical T levels",   &
-               &                   "m", jpk, gdept_1d, ndepidzt, "down" )
-            CALL histvert( numptr, "depthw", "Vertical W levels",   &
-               &                   "m", jpk, gdepw_1d, ndepidzw, "down" )
-            !
-            CALL wheneq ( jpj*jpk, MIN(sjk(:,:,1), 1._wp), 1, 1., ndex  , ndim  )      ! Lat-Depth
-            CALL wheneq ( jpj    , MIN(sjk(:,1,1), 1._wp), 1, 1., ndex_h, ndim_h )     ! Lat
-
-            IF( ln_subbas ) THEN
-               z_1(:,1) = 1._wp
-               WHERE ( gphit(jpi/2,:) < -30._wp )   z_1(:,1) = 0._wp
-               DO jk = 2, jpk
-                  z_1(:,jk) = z_1(:,1)
-               END DO
-               !                       ! Atlantic (jn=2)
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,2)         , 1._wp), 1, 1., ndex_atl     , ndim_atl      ) ! Lat-Depth
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,2)*z_1(:,:), 1._wp), 1, 1., ndex_atl_30  , ndim_atl_30   ) ! Lat-Depth
-               CALL wheneq ( jpj    , MIN(sjk(:,1,2)*z_1(:,1), 1._wp), 1, 1., ndex_h_atl_30, ndim_h_atl_30 ) ! Lat
-               !                       ! Pacific (jn=3)
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,3)         , 1._wp), 1, 1., ndex_pac     , ndim_pac      ) ! Lat-Depth
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,3)*z_1(:,:), 1._wp), 1, 1., ndex_pac_30  , ndim_pac_30   ) ! Lat-Depth
-               CALL wheneq ( jpj    , MIN(sjk(:,1,3)*z_1(:,1), 1._wp), 1, 1., ndex_h_pac_30, ndim_h_pac_30 ) ! Lat
-               !                       ! Indian (jn=4)
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,4)         , 1._wp), 1, 1., ndex_ind     , ndim_ind      ) ! Lat-Depth
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,4)*z_1(:,:), 1._wp), 1, 1., ndex_ind_30  , ndim_ind_30   ) ! Lat-Depth
-               CALL wheneq ( jpj    , MIN(sjk(:,1,4)*z_1(:,1), 1._wp), 1, 1., ndex_h_ind_30, ndim_h_ind_30 ) ! Lat
-               !                       ! Indo-Pacific (jn=5)
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,5)         , 1._wp), 1, 1., ndex_ipc     , ndim_ipc      ) ! Lat-Depth
-               CALL wheneq ( jpj*jpk, MIN(sjk(:,:,5)*z_1(:,:), 1._wp), 1, 1., ndex_ipc_30  , ndim_ipc_30   ) ! Lat-Depth
-               CALL wheneq ( jpj    , MIN(sjk(:,1,5)*z_1(:,1), 1._wp), 1, 1., ndex_h_ipc_30, ndim_h_ipc_30 ) ! Lat
-            ENDIF
-            ! 
-#if defined key_diaeiv
-            cl_comment = ' (Bolus part included)'
-#else
-            cl_comment = '                      '
-#endif
-            IF( ln_diaznl ) THEN             !  Zonal mean T and S
-               CALL histdef( numptr, "zotemglo", "Zonal Mean Temperature","C" ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-               CALL histdef( numptr, "zosalglo", "Zonal Mean Salinity","PSU"  ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-
-               CALL histdef( numptr, "zosrfglo", "Zonal Mean Surface","m^2"   ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop_once, zsto, zout )
-               !
-               IF (ln_subbas) THEN 
-                  CALL histdef( numptr, "zotematl", "Zonal Mean Temperature: Atlantic","C" ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosalatl", "Zonal Mean Salinity: Atlantic","PSU"  ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosrfatl", "Zonal Mean Surface: Atlantic","m^2"   ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop_once, zsto, zout )
-
-                  CALL histdef( numptr, "zotempac", "Zonal Mean Temperature: Pacific","C"  ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosalpac", "Zonal Mean Salinity: Pacific","PSU"   ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosrfpac", "Zonal Mean Surface: Pacific","m^2"    ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop_once, zsto, zout )
-
-                  CALL histdef( numptr, "zotemind", "Zonal Mean Temperature: Indian","C"   ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosalind", "Zonal Mean Salinity: Indian","PSU"    ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosrfind", "Zonal Mean Surface: Indian","m^2"     ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop_once, zsto, zout )
-
-                  CALL histdef( numptr, "zotemipc", "Zonal Mean Temperature: Pacific+Indian","C" ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosalipc", "Zonal Mean Salinity: Pacific+Indian","PSU"  ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop, zsto, zout )
-                  CALL histdef( numptr, "zosrfipc", "Zonal Mean Surface: Pacific+Indian","m^2"   ,   &
-                     1, jpj, nhoridz, jpk, 1, jpk, ndepidzt, 32, clop_once, zsto, zout )
-               ENDIF
-            ENDIF
-            !
-            !  Meridional Stream-Function (Eulerian and Bolus)
-            CALL histdef( numptr, "zomsfglo", "Meridional Stream-Function: Global"//TRIM(cl_comment),"Sv" ,   &
-               1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-            IF( ln_subbas .AND. ln_diaznl ) THEN
-               CALL histdef( numptr, "zomsfatl", "Meridional Stream-Function: Atlantic"//TRIM(cl_comment),"Sv" ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-               CALL histdef( numptr, "zomsfpac", "Meridional Stream-Function: Pacific"//TRIM(cl_comment),"Sv"  ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-               CALL histdef( numptr, "zomsfind", "Meridional Stream-Function: Indian"//TRIM(cl_comment),"Sv"   ,   &
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-               CALL histdef( numptr, "zomsfipc", "Meridional Stream-Function: Indo-Pacific"//TRIM(cl_comment),"Sv" ,&
-                  1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-            ENDIF
-            !
-            !  Heat transport 
-            CALL histdef( numptr, "sophtadv", "Advective Heat Transport"      ,   &
-               "PW", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            CALL histdef( numptr, "sophtldf", "Diffusive Heat Transport"      ,   &
-               "PW",1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            IF ( ln_ptrcomp ) THEN 
-               CALL histdef( numptr, "sophtove", "Overturning Heat Transport"    ,   &
-                  "PW",1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            END IF
-            IF( ln_subbas ) THEN
-               CALL histdef( numptr, "sohtatl", "Heat Transport Atlantic"//TRIM(cl_comment),  &
-                  "PW", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sohtpac", "Heat Transport Pacific"//TRIM(cl_comment) ,  &
-                  "PW", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sohtind", "Heat Transport Indian"//TRIM(cl_comment)  ,  &
-                  "PW", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sohtipc", "Heat Transport Pacific+Indian"//TRIM(cl_comment), &
-                  "PW", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            ENDIF
-            !
-            !  Salt transport 
-            CALL histdef( numptr, "sopstadv", "Advective Salt Transport"      ,   &
-               "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            CALL histdef( numptr, "sopstldf", "Diffusive Salt Transport"      ,   &
-               "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            IF ( ln_ptrcomp ) THEN 
-               CALL histdef( numptr, "sopstove", "Overturning Salt Transport"    ,   &
-                  "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            END IF
-#if defined key_diaeiv
-            ! Eddy induced velocity
-            CALL histdef( numptr, "zomsfeiv", "Bolus Meridional Stream-Function: global",   &
-               "Sv"      , 1, jpj, nhoridz, jpk, 1, jpk, ndepidzw, 32, clop, zsto, zout )
-            CALL histdef( numptr, "sophteiv", "Bolus Advective Heat Transport",   &
-               "PW"      , 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            CALL histdef( numptr, "sopsteiv", "Bolus Advective Salt Transport",   &
-               "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-#endif
-            IF( ln_subbas ) THEN
-               CALL histdef( numptr, "sostatl", "Salt Transport Atlantic"//TRIM(cl_comment)      ,  &
-                  "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sostpac", "Salt Transport Pacific"//TRIM(cl_comment)      ,   &
-                  "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sostind", "Salt Transport Indian"//TRIM(cl_comment)      ,    &
-                  "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-               CALL histdef( numptr, "sostipc", "Salt Transport Pacific+Indian"//TRIM(cl_comment),  &
-                  "Giga g/s", 1, jpj, nhoridz, 1, 1, 1, -99, 32, clop, zsto, zout )
-            ENDIF
-            !
-            CALL histend( numptr )
-            !
-#if defined key_mpp_mpi
-         END IF
-#endif
-      END IF
-
-#if defined key_mpp_mpi
-      IF( MOD( itmod, nn_fptr ) == 0 .AND. l_znl_root ) THEN
-#else
-      IF( MOD( itmod, nn_fptr ) == 0  ) THEN
-#endif
-         niter = niter + 1
-
-         IF( ln_diaznl ) THEN 
-            CALL histwrite( numptr, "zosrfglo", niter, sjk  (:,:,1) , ndim, ndex )
-            CALL histwrite( numptr, "zotemglo", niter, tn_jk(:,:,1)  , ndim, ndex )
-            CALL histwrite( numptr, "zosalglo", niter, sn_jk(:,:,1)  , ndim, ndex )
-
-            IF (ln_subbas) THEN 
-               CALL histwrite( numptr, "zosrfatl", niter, sjk(:,:,2), ndim_atl, ndex_atl )
-               CALL histwrite( numptr, "zosrfpac", niter, sjk(:,:,3), ndim_pac, ndex_pac )
-               CALL histwrite( numptr, "zosrfind", niter, sjk(:,:,4), ndim_ind, ndex_ind )
-               CALL histwrite( numptr, "zosrfipc", niter, sjk(:,:,5), ndim_ipc, ndex_ipc )
-
-               CALL histwrite( numptr, "zotematl", niter, tn_jk(:,:,2)  , ndim_atl, ndex_atl )
-               CALL histwrite( numptr, "zosalatl", niter, sn_jk(:,:,2)  , ndim_atl, ndex_atl )
-               CALL histwrite( numptr, "zotempac", niter, tn_jk(:,:,3)  , ndim_pac, ndex_pac )
-               CALL histwrite( numptr, "zosalpac", niter, sn_jk(:,:,3)  , ndim_pac, ndex_pac )
-               CALL histwrite( numptr, "zotemind", niter, tn_jk(:,:,4)  , ndim_ind, ndex_ind )
-               CALL histwrite( numptr, "zosalind", niter, sn_jk(:,:,4)  , ndim_ind, ndex_ind )
-               CALL histwrite( numptr, "zotemipc", niter, tn_jk(:,:,5)  , ndim_ipc, ndex_ipc )
-               CALL histwrite( numptr, "zosalipc", niter, sn_jk(:,:,5)  , ndim_ipc, ndex_ipc )
-            END IF
-         ENDIF
-
-         ! overturning outputs:
-         CALL histwrite( numptr, "zomsfglo", niter, v_msf(:,:,1), ndim, ndex )
-         IF( ln_subbas .AND. ln_diaznl ) THEN
-            CALL histwrite( numptr, "zomsfatl", niter, v_msf(:,:,2) , ndim_atl_30, ndex_atl_30 )
-            CALL histwrite( numptr, "zomsfpac", niter, v_msf(:,:,3) , ndim_pac_30, ndex_pac_30 )
-            CALL histwrite( numptr, "zomsfind", niter, v_msf(:,:,4) , ndim_ind_30, ndex_ind_30 )
-            CALL histwrite( numptr, "zomsfipc", niter, v_msf(:,:,5) , ndim_ipc_30, ndex_ipc_30 )
-         ENDIF
-#if defined key_diaeiv
-         CALL histwrite( numptr, "zomsfeiv", niter, v_msf_eiv(:,:,1), ndim  , ndex   )
-#endif
-
-         ! heat transport outputs:
-         IF( ln_subbas ) THEN
-            CALL histwrite( numptr, "sohtatl", niter, htr(:,2)  , ndim_h_atl_30, ndex_h_atl_30 )
-            CALL histwrite( numptr, "sohtpac", niter, htr(:,3)  , ndim_h_pac_30, ndex_h_pac_30 )
-            CALL histwrite( numptr, "sohtind", niter, htr(:,4)  , ndim_h_ind_30, ndex_h_ind_30 )
-            CALL histwrite( numptr, "sohtipc", niter, htr(:,5)  , ndim_h_ipc_30, ndex_h_ipc_30 )
-            CALL histwrite( numptr, "sostatl", niter, str(:,2)  , ndim_h_atl_30, ndex_h_atl_30 )
-            CALL histwrite( numptr, "sostpac", niter, str(:,3)  , ndim_h_pac_30, ndex_h_pac_30 )
-            CALL histwrite( numptr, "sostind", niter, str(:,4)  , ndim_h_ind_30, ndex_h_ind_30 )
-            CALL histwrite( numptr, "sostipc", niter, str(:,5)  , ndim_h_ipc_30, ndex_h_ipc_30 )
-         ENDIF
-
-         CALL histwrite( numptr, "sophtadv", niter, htr_adv     , ndim_h, ndex_h )
-         CALL histwrite( numptr, "sophtldf", niter, htr_ldf     , ndim_h, ndex_h )
-         CALL histwrite( numptr, "sopstadv", niter, str_adv     , ndim_h, ndex_h )
-         CALL histwrite( numptr, "sopstldf", niter, str_ldf     , ndim_h, ndex_h )
-         IF( ln_ptrcomp ) THEN 
-            CALL histwrite( numptr, "sopstove", niter, str_ove(:) , ndim_h, ndex_h )
-            CALL histwrite( numptr, "sophtove", niter, htr_ove(:) , ndim_h, ndex_h )
-         ENDIF
-#if defined key_diaeiv
-         CALL histwrite( numptr, "sophteiv", niter, htr_eiv(:,1)  , ndim_h, ndex_h )
-         CALL histwrite( numptr, "sopsteiv", niter, str_eiv(:,1)  , ndim_h, ndex_h )
-#endif
-         !
-      ENDIF
-
-      ! Close all files
-#if defined key_mpp_mpi
-      IF( kt == nitend .AND. l_znl_root )   CALL histclo( numptr )      ! Close the file
-#else
-      IF( kt == nitend )                    CALL histclo( numptr )      ! Close the file
-#endif
-      !
-      CALL wrk_dealloc( jpj      , zphi, zfoo )
-      CALL wrk_dealloc( jpj , jpk, z_1        )
-      !
-  END SUBROUTINE dia_ptr_wri
-
-#endif
-
-   !!======================================================================
-END MODULE diaptr
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/diaptr_oce.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/diaptr_oce.F90	(revision 2446)
+++ 	(revision )
@@ -1,314 +1,0 @@
-MODULE diaptr_oce
-   !!======================================================================
-   !!                       ***  MODULE  diaptr  ***
-   !! Ocean physics:  Computes meridonal transports and zonal means
-   !!=====================================================================
-   !! History :  1.0  ! 2003-09  (C. Talandier, G. Madec)  Original code
-   !!            2.0  ! 2006-01  (A. Biastoch)  Allow sub-basins computation
-   !!            3.2  ! 2010-03  (O. Marti, S. Flavoni) Add fields
-   !!            3.3  ! 2010-10  (G. Madec)  dynamical allocation
-   !!----------------------------------------------------------------------
-
-   USE par_oce
-   USE dom_oce
-   USE in_out_manager
-   USE lib_mpp
-   USE wrk_nemo
-
-   IMPLICIT NONE
-   PRIVATE
-
-   INTERFACE ptr_vj
-      MODULE PROCEDURE ptr_vj_3d, ptr_vj_2d
-   END INTERFACE
-
-   PUBLIC   ptr_vj         ! call by tra_ldf & tra_adv routines
-   PUBLIC   ptr_vjk        ! call by tra_ldf & tra_adv routines
-   PUBLIC   ptr_tjk        ! 
-   PUBLIC   dia_ptr_alloc   ! call in opa module
-   !                                  !!** namelist  namptr  **
-   LOGICAL , PUBLIC ::   ln_diaptr     !: Poleward transport flag (T) or not (F)
-   LOGICAL , PUBLIC ::   ln_subbas     !: Atlantic/Pacific/Indian basins calculation
-   LOGICAL , PUBLIC ::   ln_diaznl     !: Add zonal means and meridional stream functions
-   LOGICAL , PUBLIC ::   ln_ptrcomp    !: Add decomposition : overturning (and gyre, soon ...)
-   INTEGER , PUBLIC ::   nn_fptr       !: frequency of ptr computation  [time step]
-   INTEGER , PUBLIC ::   nn_fwri       !: frequency of ptr outputs      [time step]
-
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) ::   htr_adv, htr_ldf, htr_ove   !: Heat TRansports (adv, diff, overturn.)
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) ::   str_adv, str_ldf, str_ove   !: Salt TRansports (adv, diff, overturn.)
-   
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:,:) ::   btmsk                  ! T-point basin interior masks
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:)   ::   btm30                  ! mask out Southern Ocean (=0 south of 30°S)
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:)   ::   htr  , str             ! adv heat and salt transports (approx)
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:,:) ::   tn_jk, sn_jk , v_msf   ! i-mean T and S, j-Stream-Function
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:,:) ::   sjk  , r1_sjk          ! i-mean i-k-surface and its inverse        
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:)   ::   htr_eiv, str_eiv       ! bolus adv heat ans salt transports ('key_diaeiv')
-   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:,:) ::   v_msf_eiv              ! bolus j-streamfuction              ('key_diaeiv')
-
-
-   INTEGER, SAVE, PUBLIC :: nxline       !
-   INTEGER, PUBLIC ::   niter       !
-   INTEGER, PUBLIC ::   nidom_ptr   !
-   INTEGER, PUBLIC ::   numptr      ! logical unit for Poleward TRansports
-   INTEGER, PUBLIC ::   nptr        ! = 1 (ln_subbas=F) or = 5 (glo, atl, pac, ind, ipc) (ln_subbas=T) 
-
-   REAL(wp), PUBLIC ::   rc_sv    = 1.e-6_wp   ! conversion from m3/s to Sverdrup
-   REAL(wp), PUBLIC ::   rc_pwatt = 1.e-15_wp  ! conversion from W    to PW (further x rau0 x Cp)
-   REAL(wp), PUBLIC ::   rc_ggram = 1.e-6_wp   ! conversion from g    to Pg
-
-   REAL(wp), PUBLIC, TARGET, DIMENSION(:)  , ALLOCATABLE, SAVE :: p_fval1d
-   REAL(wp), PUBLIC, TARGET, DIMENSION(:,:), ALLOCATABLE, SAVE :: p_fval2d
-
-   !! Integer, 1D workspace arrays. Not common enough to be implemented in 
-   !! wrk_nemo module.
-   INTEGER, ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) :: ndex  , ndex_atl     , ndex_pac     , ndex_ind     , ndex_ipc
-   INTEGER, ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) ::         ndex_atl_30  , ndex_pac_30  , ndex_ind_30  , ndex_ipc_30
-   INTEGER, ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) :: ndex_h, ndex_h_atl_30, ndex_h_pac_30, ndex_h_ind_30, ndex_h_ipc_30
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-
-CONTAINS
-
-   FUNCTION dia_ptr_alloc()
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE dia_ptr_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER               ::   dia_ptr_alloc   ! return value
-      INTEGER, DIMENSION(6) ::   ierr
-      !!----------------------------------------------------------------------
-      ierr(:) = 0
-      !
-      ALLOCATE( btmsk(jpi,jpj,nptr) ,           &
-         &      htr_adv(jpj) , str_adv(jpj) ,   &
-         &      htr_ldf(jpj) , str_ldf(jpj) ,   &
-         &      htr_ove(jpj) , str_ove(jpj),    &
-         &      htr(jpj,nptr) , str(jpj,nptr) , &
-         &      tn_jk(jpj,jpk,nptr) , sn_jk (jpj,jpk,nptr) , v_msf(jpj,jpk,nptr) , &
-         &      sjk  (jpj,jpk,nptr) , r1_sjk(jpj,jpk,nptr) , STAT=ierr(1)  )
-         !
-#if defined key_diaeiv
-      ALLOCATE( htr_eiv(jpj,nptr) , str_eiv(jpj,nptr) , &
-         &      v_msf_eiv(jpj,jpk,nptr) , STAT=ierr(2) )
-#endif
-      ALLOCATE( p_fval1d(jpj), p_fval2d(jpj,jpk), Stat=ierr(3))
-      !
-      ALLOCATE( btm30(jpi,jpj), STAT=ierr(4)  )
-
-#if ! defined key_iomput
-      ALLOCATE(ndex(jpj*jpk),        ndex_atl(jpj*jpk), ndex_pac(jpj*jpk), &
-         &     ndex_ind(jpj*jpk),    ndex_ipc(jpj*jpk),                    &
-         &     ndex_atl_30(jpj*jpk), ndex_pac_30(jpj*jpk), Stat=ierr(5))
-
-      ALLOCATE(ndex_ind_30(jpj*jpk), ndex_ipc_30(jpj*jpk),                   &
-         &     ndex_h(jpj),          ndex_h_atl_30(jpj), ndex_h_pac_30(jpj), &
-         &     ndex_h_ind_30(jpj),   ndex_h_ipc_30(jpj), Stat=ierr(6) )
-         !
-#endif
-         !
-      dia_ptr_alloc = MAXVAL( ierr )
-      IF(lk_mpp)   CALL mpp_sum( dia_ptr_alloc )
-      !
-   END FUNCTION dia_ptr_alloc
-
-
-   FUNCTION ptr_vj_3d( pva )   RESULT ( p_fval )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE ptr_vj_3d  ***
-      !!
-      !! ** Purpose :   i-k sum computation of a j-flux array
-      !!
-      !! ** Method  : - i-k sum of pva using the interior 2D vmask (vmask_i).
-      !!              pva is supposed to be a masked flux (i.e. * vmask*e1v*e3v)
-      !!
-      !! ** Action  : - p_fval: i-k-mean poleward flux of pva
-      !!----------------------------------------------------------------------
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj,jpk) ::   pva   ! mask flux array at V-point
-      !!
-      INTEGER                  ::   ji, jj, jk   ! dummy loop arguments
-      INTEGER                  ::   ijpj         ! ???
-      REAL(wp), POINTER, DIMENSION(:) :: p_fval  ! function value
-      !!--------------------------------------------------------------------
-      !
-      p_fval => p_fval1d
-
-      ijpj = jpj
-      p_fval(:) = 0._wp
-      DO jk = 1, jpkm1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! Vector opt.
-               p_fval(jj) = p_fval(jj) + pva(ji,jj,jk) * tmask_i(ji,jj) 
-            END DO
-         END DO
-      END DO
-#if defined key_mpp_mpi
-      IF(lk_mpp)   CALL mpp_sum( p_fval, ijpj, ncomm_znl)
-#endif
-      !
-   END FUNCTION ptr_vj_3d
-
-
-   FUNCTION ptr_vj_2d( pva )   RESULT ( p_fval )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE ptr_vj_2d  ***
-      !!
-      !! ** Purpose :   "zonal" and vertical sum computation of a i-flux array
-      !!
-      !! ** Method  : - i-k sum of pva using the interior 2D vmask (vmask_i).
-      !!      pva is supposed to be a masked flux (i.e. * vmask*e1v*e3v)
-      !!
-      !! ** Action  : - p_fval: i-k-mean poleward flux of pva
-      !!----------------------------------------------------------------------
-      IMPLICIT none
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj) ::   pva   ! mask flux array at V-point
-      !!
-      INTEGER                  ::   ji,jj       ! dummy loop arguments
-      INTEGER                  ::   ijpj        ! ???
-      REAL(wp), POINTER, DIMENSION(:) :: p_fval ! function value
-      !!--------------------------------------------------------------------
-      ! 
-      p_fval => p_fval1d
-
-      ijpj = jpj
-      p_fval(:) = 0._wp
-      DO jj = 2, jpjm1
-         DO ji = nldi, nlei   ! No vector optimisation here. Better use a mask ?
-            p_fval(jj) = p_fval(jj) + pva(ji,jj) * tmask_i(ji,jj)
-         END DO
-      END DO
-#if defined key_mpp_mpi
-      CALL mpp_sum( p_fval, ijpj, ncomm_znl )
-#endif
-      ! 
-   END FUNCTION ptr_vj_2d
-
-
-   FUNCTION ptr_vjk( pva, pmsk )   RESULT ( p_fval )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE ptr_vjk  ***
-      !!
-      !! ** Purpose :   i-sum computation of a j-velocity array
-      !!
-      !! ** Method  : - i-sum of pva using the interior 2D vmask (vmask_i).
-      !!              pva is supposed to be a masked flux (i.e. * vmask)
-      !!
-      !! ** Action  : - p_fval: i-mean poleward flux of pva
-      !!----------------------------------------------------------------------
-      !!
-      IMPLICIT none
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj,jpk)           ::   pva    ! mask flux array at V-point
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj)    , OPTIONAL ::   pmsk   ! Optional 2D basin mask
-      !!
-      INTEGER                           :: ji, jj, jk ! dummy loop arguments
-      REAL(wp), POINTER, DIMENSION(:,:) :: p_fval     ! return function value
-#if defined key_mpp_mpi
-      INTEGER, DIMENSION(1) ::   ish
-      INTEGER, DIMENSION(2) ::   ish2
-      INTEGER               ::   ijpjjpk
-#endif
-#if defined key_mpp_mpi
-      REAL(wp), POINTER, DIMENSION(:) ::   zwork    ! mask flux array at V-point
-#endif
-      !!--------------------------------------------------------------------
-      !
-#if defined key_mpp_mpi
-      ijpjjpk = jpj*jpk
-      CALL wrk_alloc( jpj*jpk, zwork )
-#endif
-
-      p_fval => p_fval2d
-
-      p_fval(:,:) = 0._wp
-      !
-      IF( PRESENT( pmsk ) ) THEN 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-!!gm here, use of tmask_i  ==> no need of loop over nldi, nlei....
-               DO ji =  nldi, nlei   ! No vector optimisation here. Better use a mask ?
-                  p_fval(jj,jk) = p_fval(jj,jk) + pva(ji,jj,jk) * e1v(ji,jj) * fse3v(ji,jj,jk) * pmsk(ji,jj)
-               END DO
-            END DO
-         END DO
-      ELSE 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji =  nldi, nlei   ! No vector optimisation here. Better use a mask ?
-                  p_fval(jj,jk) = p_fval(jj,jk) + pva(ji,jj,jk) * e1v(ji,jj) * fse3v(ji,jj,jk) * tmask_i(ji,jj)
-               END DO
-            END DO
-         END DO
-      END IF
-      !
-#if defined key_mpp_mpi
-      ijpjjpk = jpj*jpk
-      ish(1) = ijpjjpk  ;   ish2(1) = jpj   ;   ish2(2) = jpk
-      zwork(1:ijpjjpk) = RESHAPE( p_fval, ish )
-      CALL mpp_sum( zwork, ijpjjpk, ncomm_znl )
-      p_fval(:,:) = RESHAPE( zwork, ish2 )
-#endif
-      !
-#if defined key_mpp_mpi
-      CALL wrk_dealloc( jpj*jpk, zwork )
-#endif
-      !
-   END FUNCTION ptr_vjk
-
-
-   FUNCTION ptr_tjk( pta, pmsk )   RESULT ( p_fval )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE ptr_tjk  ***
-      !!
-      !! ** Purpose :   i-sum computation of e1t*e3t * a tracer field
-      !!
-      !! ** Method  : - i-sum of mj(pta) using tmask
-      !!
-      !! ** Action  : - p_fval: i-sum of e1t*e3t*pta
-      !!----------------------------------------------------------------------
-      !!
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj,jpk) ::   pta    ! tracer flux array at T-point
-      REAL(wp) , INTENT(in), DIMENSION(jpi,jpj)     ::   pmsk   ! Optional 2D basin mask
-      !!
-      INTEGER                           :: ji, jj, jk   ! dummy loop arguments
-      REAL(wp), POINTER, DIMENSION(:,:) :: p_fval       ! return function value
-#if defined key_mpp_mpi
-      INTEGER, DIMENSION(1) ::   ish
-      INTEGER, DIMENSION(2) ::   ish2
-      INTEGER               ::   ijpjjpk
-#endif
-#if defined key_mpp_mpi
-      REAL(wp), POINTER, DIMENSION(:) ::   zwork    ! mask flux array at V-point
-#endif
-      !!-------------------------------------------------------------------- 
-      !
-#if defined key_mpp_mpi
-      ijpjjpk = jpj*jpk
-      CALL wrk_alloc( jpj*jpk, zwork )
-#endif
-
-      p_fval => p_fval2d
-
-      p_fval(:,:) = 0._wp
-      DO jk = 1, jpkm1
-         DO jj = 2, jpjm1
-            DO ji =  nldi, nlei   ! No vector optimisation here. Better use a mask ?
-               p_fval(jj,jk) = p_fval(jj,jk) + pta(ji,jj,jk) * e1t(ji,jj) * fse3t(ji,jj,jk) * pmsk(ji,jj)
-            END DO
-         END DO
-      END DO
-#if defined key_mpp_mpi
-      ijpjjpk = jpj*jpk
-      ish(1) = jpj*jpk   ;   ish2(1) = jpj   ;   ish2(2) = jpk
-      zwork(1:ijpjjpk)= RESHAPE( p_fval, ish )
-      CALL mpp_sum( zwork, ijpjjpk, ncomm_znl )
-      p_fval(:,:)= RESHAPE( zwork, ish2 )
-#endif
-      !
-#if defined key_mpp_mpi
-      CALL wrk_dealloc( jpj*jpk, zwork )
-#endif
-      !    
-   END FUNCTION ptr_tjk
-
-   !!======================================================================
-END MODULE diaptr_oce
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/iom.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/iom.F90	(revision 2446)
+++ 	(revision )
@@ -1,1530 +1,0 @@
-MODULE iom
-   !!=====================================================================
-   !!                    ***  MODULE  iom ***
-   !! Input/Output manager :  Library to read input files
-   !!====================================================================
-   !! History :  2.0  ! 2005-12  (J. Belier) Original code
-   !!            2.0  ! 2006-02  (S. Masson) Adaptation to NEMO
-   !!            3.0  ! 2007-07  (D. Storkey) Changes to iom_gettime
-   !!            3.4  ! 2012-12  (R. Bourdalle-Badie and G. Reffray)  add C1D case  
-   !!--------------------------------------------------------------------
-
-   !!--------------------------------------------------------------------
-   !!   iom_open       : open a file read only
-   !!   iom_close      : close a file or all files opened by iom
-   !!   iom_get        : read a field (interfaced to several routines)
-   !!   iom_gettime    : read the time axis cdvar in the file
-   !!   iom_varid      : get the id of a variable in a file
-   !!   iom_rstput     : write a field in a restart file (interfaced to several routines)
-   !!--------------------------------------------------------------------
-   USE dom_oce         ! ocean space and time domain
-   USE c1d             ! 1D vertical configuration
-   USE flo_oce         ! floats module declarations
-   USE lbclnk          ! lateal boundary condition / mpp exchanges
-   USE iom_def         ! iom variables definitions
-   USE iom_ioipsl      ! NetCDF format with IOIPSL library
-   USE iom_nf90        ! NetCDF format with native NetCDF library
-   USE iom_rstdimg     ! restarts access direct format "dimg" style...
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp           ! MPP library
-#if defined key_iomput
-   USE sbc_oce    , ONLY :   nn_fsbc         ! ocean space and time domain
-   USE trc_oce    , ONLY :   nn_dttrc        !  !: frequency of step on passive tracers
-   USE icb_oce    , ONLY :   nclasses, class_num       !  !: iceberg classes
-   USE diaptr_oce , ONLY :   nn_fptr, nxline         ! ocean space and time domain
-#if defined key_lim3
-   USE par_ice
-#elif defined key_lim2
-   USE par_ice_2
-#endif
-   USE domngb          ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE dianam          ! build name of file
-   USE xios
-# endif
-   USE ioipsl, ONLY :  ju2ymds    ! for calendar
-   USE crs             ! Grid coarsening
-
-   IMPLICIT NONE
-   PUBLIC   !   must be public to be able to access iom_def through iom
-   
-#if defined key_iomput
-   LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .TRUE.        !: iom_put flag
-#else
-   LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .FALSE.       !: iom_put flag
-#endif
-   PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put
-   PUBLIC iom_getatt, iom_use, iom_context_finalize
-
-   PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d
-   PRIVATE iom_g0d, iom_g1d, iom_g2d, iom_g3d, iom_get_123d
-   PRIVATE iom_p1d, iom_p2d, iom_p3d
-#if defined key_iomput
-   PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr
-   PRIVATE set_grid, set_scalar, set_xmlatt, set_mooring, iom_update_file_name, iom_sdate
-# endif
-
-   INTERFACE iom_get
-      MODULE PROCEDURE iom_g0d, iom_g1d, iom_g2d, iom_g3d
-   END INTERFACE
-   INTERFACE iom_getatt
-      MODULE PROCEDURE iom_g0d_intatt
-   END INTERFACE
-   INTERFACE iom_rstput
-      MODULE PROCEDURE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d
-   END INTERFACE
-  INTERFACE iom_put
-     MODULE PROCEDURE iom_p0d, iom_p1d, iom_p2d, iom_p3d
-  END INTERFACE
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: iom.F90 4691 2014-06-25 12:31:42Z clem $
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE iom_init( cdname ) 
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** Purpose :   
-      !!
-      !!----------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(in)  :: cdname
-#if defined key_iomput
-      TYPE(xios_time)   :: dtime    = xios_time(0, 0, 0, 0, 0, 0)
-      CHARACTER(len=19) :: cldate 
-      CHARACTER(len=10) :: clname
-      INTEGER           ::   ji
-      !!----------------------------------------------------------------------
-
-      clname = cdname
-      IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(cdname)
-# if defined key_mpp_mpi
-      CALL xios_context_initialize(TRIM(clname), mpi_comm_opa)
-# else
-      CALL xios_context_initialize(TRIM(clname), 0)
-# endif
-      CALL iom_swap( cdname )
-
-      ! calendar parameters
-      SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL
-      CASE ( 1)   ;   CALL xios_set_context_attr(TRIM(clname), calendar_type= "Gregorian")
-      CASE ( 0)   ;   CALL xios_set_context_attr(TRIM(clname), calendar_type= "NoLeap")
-      CASE (30)   ;   CALL xios_set_context_attr(TRIM(clname), calendar_type= "D360")
-      END SELECT
-      WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") nyear,nmonth,nday 
-      CALL xios_set_context_attr(TRIM(clname), start_date=cldate )
-
-      ! horizontal grid definition
-      CALL set_scalar
-
-      IF( TRIM(cdname) == "nemo" ) THEN  
-         CALL set_grid( "T", glamt, gphit ) 
-         CALL set_grid( "U", glamu, gphiu )
-         CALL set_grid( "V", glamv, gphiv )
-         CALL set_grid( "W", glamt, gphit )
-      ENDIF
-
-      IF( TRIM(cdname) == "nemo_crs" ) THEN  
-         CALL dom_grid_crs   ! Save the parent grid information  & Switch to coarse grid domain
-         !
-         CALL set_grid( "T", glamt_crs, gphit_crs ) 
-         CALL set_grid( "U", glamu_crs, gphiu_crs ) 
-         CALL set_grid( "V", glamv_crs, gphiv_crs ) 
-         CALL set_grid( "W", glamt_crs, gphit_crs ) 
-          !
-         CALL dom_grid_glo   ! Return to parent grid domain
-      ENDIF
-
-
-      ! vertical grid definition
-      CALL iom_set_axis_attr( "deptht", gdept_1d )
-      CALL iom_set_axis_attr( "depthu", gdept_1d )
-      CALL iom_set_axis_attr( "depthv", gdept_1d )
-      CALL iom_set_axis_attr( "depthw", gdepw_1d )
-# if defined key_floats
-      CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,nfloat) /) )
-# endif
-#if defined key_lim3 || defined key_lim2
-      CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) )
-#endif
-      CALL iom_set_axis_attr( "icbcla", class_num )
-      
-      ! automatic definitions of some of the xml attributs
-      CALL set_xmlatt
-
-      ! end file definition
-      dtime%second = rdt
-      CALL xios_set_timestep(dtime)
-      CALL xios_close_context_definition()
-      
-      CALL xios_update_calendar(0)
-#endif
-      
-   END SUBROUTINE iom_init
-
-
-   SUBROUTINE iom_swap( cdname )
-      !!---------------------------------------------------------------------
-      !!                   ***  SUBROUTINE  iom_swap  ***
-      !!
-      !! ** Purpose :  swap context between different agrif grid for xmlio_server
-      !!---------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(in) :: cdname
-#if defined key_iomput
-      TYPE(xios_context) :: nemo_hdl
-
-      IF( TRIM(Agrif_CFixed()) == '0' ) THEN
-        CALL xios_get_handle(TRIM(cdname),nemo_hdl)
-      ELSE
-        CALL xios_get_handle(TRIM(Agrif_CFixed())//"_"//TRIM(cdname),nemo_hdl)
-      ENDIF
-      !
-      CALL xios_set_current_context(nemo_hdl)
-#endif
-      !
-   END SUBROUTINE iom_swap
-
-
-   SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, kiolib, ldstop, ldiof )
-      !!---------------------------------------------------------------------
-      !!                   ***  SUBROUTINE  iom_open  ***
-      !!
-      !! ** Purpose :  open an input file (return 0 if not found)
-      !!---------------------------------------------------------------------
-      CHARACTER(len=*), INTENT(in   )           ::   cdname   ! File name
-      INTEGER         , INTENT(  out)           ::   kiomid   ! iom identifier of the opened file
-      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldwrt    ! open in write modeb          (default = .FALSE.)
-      INTEGER         , INTENT(in   ), OPTIONAL ::   kdom     ! Type of domain to be written (default = jpdom_local_noovlap)
-      INTEGER         , INTENT(in   ), OPTIONAL ::   kiolib   ! library used to open the file (default = jpnf90) 
-      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldstop   ! stop if open to read a non-existing file (default = .TRUE.)
-      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldiof    ! Interp On the Fly, needed for AGRIF (default = .FALSE.)
-
-      CHARACTER(LEN=256)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu]
-      CHARACTER(LEN=256)    ::   cltmpn    ! tempory name to store clname (in writting mode)
-      CHARACTER(LEN=10)     ::   clsuffix  ! ".nc" or ".dimg"
-      CHARACTER(LEN=15)     ::   clcpu     ! the cpu number (max jpmax_digits digits)
-      CHARACTER(LEN=256)    ::   clinfo    ! info character
-      LOGICAL               ::   llok      ! check the existence 
-      LOGICAL               ::   llwrt     ! local definition of ldwrt
-      LOGICAL               ::   llnoov    ! local definition to read overlap
-      LOGICAL               ::   llstop    ! local definition of ldstop
-      LOGICAL               ::   lliof     ! local definition of ldiof
-      INTEGER               ::   iolib     ! library do we use to open the file
-      INTEGER               ::   icnt      ! counter for digits in clcpu (max = jpmax_digits)
-      INTEGER               ::   iln, ils  ! lengths of character
-      INTEGER               ::   idom      ! type of domain
-      INTEGER               ::   istop     ! 
-      INTEGER, DIMENSION(2,5) ::   idompar ! domain parameters: 
-      ! local number of points for x,y dimensions
-      ! position of first local point for x,y dimensions
-      ! position of last local point for x,y dimensions
-      ! start halo size for x,y dimensions
-      ! end halo size for x,y dimensions
-      !---------------------------------------------------------------------
-      ! Initializations and control
-      ! =============
-      kiomid = -1
-      clinfo = '                    iom_open ~~~  '
-      istop = nstop
-      ! if iom_open is called for the first time: initialize iom_file(:)%nfid to 0
-      ! (could be done when defining iom_file in f95 but not in f90)
-      IF( Agrif_Root() ) THEN
-         IF( iom_open_init == 0 ) THEN
-            iom_file(:)%nfid = 0
-            iom_open_init = 1
-         ENDIF
-      ENDIF
-      ! do we read or write the file?
-      IF( PRESENT(ldwrt) ) THEN   ;   llwrt = ldwrt
-      ELSE                        ;   llwrt = .FALSE.
-      ENDIF
-      ! do we call ctl_stop if we try to open a non-existing file in read mode?
-      IF( PRESENT(ldstop) ) THEN   ;   llstop = ldstop
-      ELSE                         ;   llstop = .TRUE.
-      ENDIF
-      ! what library do we use to open the file?
-      IF( PRESENT(kiolib) ) THEN   ;   iolib = kiolib
-      ELSE                         ;   iolib = jpnf90
-      ENDIF
-      ! are we using interpolation on the fly?
-      IF( PRESENT(ldiof) ) THEN   ;   lliof = ldiof
-      ELSE                        ;   lliof = .FALSE.
-      ENDIF
-      ! do we read the overlap 
-      ! ugly patch SM+JMM+RB to overwrite global definition in some cases
-      llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif 
-      ! create the file name by added, if needed, TRIM(Agrif_CFixed()) and TRIM(clsuffix)
-      ! =============
-      clname   = trim(cdname)
-      IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN
-         iln    = INDEX(clname,'/') 
-         cltmpn = clname(1:iln)
-         clname = clname(iln+1:LEN_TRIM(clname))
-         clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname)
-      ENDIF
-      ! which suffix should we use?
-      SELECT CASE (iolib)
-      CASE (jpioipsl ) ;   clsuffix = '.nc'
-      CASE (jpnf90   ) ;   clsuffix = '.nc'
-      CASE (jprstdimg) ;   clsuffix = '.dimg'
-      CASE DEFAULT     ;   clsuffix = ''
-         CALL ctl_stop( TRIM(clinfo), 'accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-      END SELECT
-      ! Add the suffix if needed
-      iln = LEN_TRIM(clname)
-      ils = LEN_TRIM(clsuffix)
-      IF( iln <= ils .OR. INDEX( TRIM(clname), TRIM(clsuffix), back = .TRUE. ) /= iln - ils + 1 )   &
-         &   clname = TRIM(clname)//TRIM(clsuffix)
-      cltmpn = clname   ! store this name
-      ! try to find if the file to be opened already exist
-      ! =============
-      INQUIRE( FILE = clname, EXIST = llok )
-      IF( .NOT.llok ) THEN
-         ! we try to add the cpu number to the name
-         IF( iolib == jprstdimg ) THEN   ;   WRITE(clcpu,*) narea
-         ELSE                            ;   WRITE(clcpu,*) narea-1
-         ENDIF
-         clcpu  = TRIM(ADJUSTL(clcpu))
-         iln = INDEX(clname,TRIM(clsuffix), back = .TRUE.)
-         clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix)
-         icnt = 0
-         INQUIRE( FILE = clname, EXIST = llok ) 
-         ! we try different formats for the cpu number by adding 0
-         DO WHILE( .NOT.llok .AND. icnt < jpmax_digits )
-            clcpu  = "0"//trim(clcpu)
-            clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix)
-            INQUIRE( FILE = clname, EXIST = llok )
-            icnt = icnt + 1
-         END DO
-      ENDIF
-      IF( llwrt ) THEN
-         ! check the domain definition
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!         idom = jpdom_local_noovlap   ! default definition
-         IF( llnoov ) THEN   ;   idom = jpdom_local_noovlap   ! default definition
-         ELSE                ;   idom = jpdom_local_full      ! default definition
-         ENDIF
-         IF( PRESENT(kdom) )   idom = kdom
-         ! create the domain informations
-         ! =============
-         SELECT CASE (idom)
-         CASE (jpdom_local_full)
-            idompar(:,1) = (/ jpi             , jpj              /)
-            idompar(:,2) = (/ nimpp           , njmpp            /)
-            idompar(:,3) = (/ nimpp + jpi - 1 , njmpp + jpj - 1  /)
-            idompar(:,4) = (/ nldi - 1        , nldj - 1         /)
-            idompar(:,5) = (/ jpi - nlei      , jpj - nlej       /)
-         CASE (jpdom_local_noextra)
-            idompar(:,1) = (/ nlci            , nlcj             /)
-            idompar(:,2) = (/ nimpp           , njmpp            /)
-            idompar(:,3) = (/ nimpp + nlci - 1, njmpp + nlcj - 1 /)
-            idompar(:,4) = (/ nldi - 1        , nldj - 1         /)
-            idompar(:,5) = (/ nlci - nlei     , nlcj - nlej      /)
-         CASE (jpdom_local_noovlap)
-            idompar(:,1) = (/ nlei  - nldi + 1, nlej  - nldj + 1 /)
-            idompar(:,2) = (/ nimpp + nldi - 1, njmpp + nldj - 1 /)
-            idompar(:,3) = (/ nimpp + nlei - 1, njmpp + nlej - 1 /)
-            idompar(:,4) = (/ 0               , 0                /)
-            idompar(:,5) = (/ 0               , 0                /)
-         CASE DEFAULT
-            CALL ctl_stop( TRIM(clinfo), 'wrong value of kdom, only jpdom_local* cases are accepted' )
-         END SELECT
-      ENDIF
-      ! Open the NetCDF or RSTDIMG file
-      ! =============
-      ! do we have some free file identifier?
-      IF( MINVAL(iom_file(:)%nfid) /= 0 )   &
-         &   CALL ctl_stop( TRIM(clinfo), 'No more free file identifier', 'increase jpmax_files in iom_def' )
-      ! if no file was found...
-      IF( .NOT. llok ) THEN
-         IF( .NOT. llwrt ) THEN   ! we are in read mode 
-            IF( llstop ) THEN   ;   CALL ctl_stop( TRIM(clinfo), 'File '//TRIM(cltmpn)//'* not found' )
-            ELSE                ;   istop = nstop + 1   ! make sure that istop /= nstop so we don't open the file
-            ENDIF
-         ELSE                     ! we are in write mode so we 
-            clname = cltmpn       ! get back the file name without the cpu number
-         ENDIF
-      ELSE
-         IF( llwrt .AND. .NOT. ln_clobber ) THEN   ! we stop as we want to write in a new file 
-            CALL ctl_stop( TRIM(clinfo), 'We want to write in a new file but '//TRIM(clname)//' already exists...' )
-            istop = nstop + 1                      ! make sure that istop /= nstop so we don't open the file
-         ELSEIF( llwrt ) THEN     ! the file exists and we are in write mode with permission to 
-            clname = cltmpn       ! overwrite so get back the file name without the cpu number
-         ENDIF
-      ENDIF
-      IF( istop == nstop ) THEN   ! no error within this routine
-         SELECT CASE (iolib)
-         CASE (jpioipsl )   ;   CALL iom_ioipsl_open(  clname, kiomid, llwrt, llok, idompar )
-         CASE (jpnf90   )   ;   CALL iom_nf90_open(    clname, kiomid, llwrt, llok, idompar )
-         CASE (jprstdimg)   ;   CALL iom_rstdimg_open( clname, kiomid, llwrt, llok, idompar )
-         CASE DEFAULT
-            CALL ctl_stop( TRIM(clinfo)//' accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-         END SELECT
-      ENDIF
-      !
-   END SUBROUTINE iom_open
-
-
-   SUBROUTINE iom_close( kiomid )
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE  iom_close  ***
-      !!
-      !! ** Purpose : close an input file, or all files opened by iom
-      !!--------------------------------------------------------------------
-      INTEGER, INTENT(inout), OPTIONAL ::   kiomid   ! iom identifier of the file to be closed
-      !                                              ! return 0 when file is properly closed
-      !                                              ! No argument: all files opened by iom are closed
-
-      INTEGER ::   jf         ! dummy loop indices
-      INTEGER ::   i_s, i_e   ! temporary integer
-      CHARACTER(LEN=100)    ::   clinfo    ! info character
-      !---------------------------------------------------------------------
-      !
-      clinfo = '                    iom_close ~~~  '
-      IF( PRESENT(kiomid) ) THEN
-         i_s = kiomid
-         i_e = kiomid
-      ELSE
-         i_s = 1
-         i_e = jpmax_files
-      ENDIF
-
-      IF( i_s > 0 ) THEN
-         DO jf = i_s, i_e
-            IF( iom_file(jf)%nfid > 0 ) THEN
-               SELECT CASE (iom_file(jf)%iolib)
-               CASE (jpioipsl )   ;   CALL iom_ioipsl_close(  jf )
-               CASE (jpnf90   )   ;   CALL iom_nf90_close(    jf )
-               CASE (jprstdimg)   ;   CALL iom_rstdimg_close( jf )
-               CASE DEFAULT
-                  CALL ctl_stop( TRIM(clinfo)//' accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-               END SELECT
-               iom_file(jf)%nfid       = 0          ! free the id 
-               IF( PRESENT(kiomid) )   kiomid = 0   ! return 0 as id to specify that the file was closed
-               IF(lwp) WRITE(numout,*) TRIM(clinfo)//' close file: '//TRIM(iom_file(jf)%name)//' ok'
-            ELSEIF( PRESENT(kiomid) ) THEN
-               WRITE(ctmp1,*) '--->',  kiomid
-               CALL ctl_stop( TRIM(clinfo)//' Invalid file identifier', ctmp1 )
-            ENDIF
-         END DO
-      ENDIF
-      !    
-   END SUBROUTINE iom_close
-
-
-   FUNCTION iom_varid ( kiomid, cdvar, kdimsz, kndims, ldstop )  
-      !!-----------------------------------------------------------------------
-      !!                  ***  FUNCTION  iom_varid  ***
-      !!
-      !! ** Purpose : get the id of a variable in a file (return 0 if not found)
-      !!-----------------------------------------------------------------------
-      INTEGER              , INTENT(in   )           ::   kiomid   ! file Identifier
-      CHARACTER(len=*)     , INTENT(in   )           ::   cdvar    ! name of the variable
-      INTEGER, DIMENSION(:), INTENT(  out), OPTIONAL ::   kdimsz   ! size of the dimensions
-      INTEGER,               INTENT(  out), OPTIONAL ::   kndims   ! size of the dimensions
-      LOGICAL              , INTENT(in   ), OPTIONAL ::   ldstop   ! stop if looking for non-existing variable (default = .TRUE.)
-      !
-      INTEGER                        ::   iom_varid, iiv, i_nvd
-      LOGICAL                        ::   ll_fnd
-      CHARACTER(LEN=100)             ::   clinfo                   ! info character
-      LOGICAL                        ::   llstop                   ! local definition of ldstop
-      !!-----------------------------------------------------------------------
-      iom_varid = 0                         ! default definition
-      ! do we call ctl_stop if we look for non-existing variable?
-      IF( PRESENT(ldstop) ) THEN   ;   llstop = ldstop
-      ELSE                         ;   llstop = .TRUE.
-      ENDIF
-      !
-      IF( kiomid > 0 ) THEN
-         clinfo = 'iom_varid, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(cdvar)
-         IF( iom_file(kiomid)%nfid == 0 ) THEN 
-            CALL ctl_stop( trim(clinfo), 'the file is not open' )
-         ELSE
-            ll_fnd  = .FALSE.
-            iiv = 0
-            !
-            DO WHILE ( .NOT.ll_fnd .AND. iiv < iom_file(kiomid)%nvars )
-               iiv = iiv + 1
-               ll_fnd  = ( TRIM(cdvar) == TRIM(iom_file(kiomid)%cn_var(iiv)) )
-            END DO
-            !
-            IF( .NOT.ll_fnd ) THEN
-               iiv = iiv + 1
-               IF( iiv <= jpmax_vars ) THEN
-                  SELECT CASE (iom_file(kiomid)%iolib)
-                  CASE (jpioipsl )   ;   iom_varid = iom_ioipsl_varid( kiomid, cdvar, iiv, kdimsz )
-                  CASE (jpnf90   )   ;   iom_varid = iom_nf90_varid  ( kiomid, cdvar, iiv, kdimsz, kndims )
-                  CASE (jprstdimg)   ;   iom_varid = -1   ! all variables are listed in iom_file
-                  CASE DEFAULT   
-                     CALL ctl_stop( TRIM(clinfo)//' accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-                  END SELECT
-               ELSE
-                  CALL ctl_stop( trim(clinfo), 'Too many variables in the file '//iom_file(kiomid)%name,   &
-                        &                         'increase the parameter jpmax_vars')
-               ENDIF
-               IF( llstop .AND. iom_varid == -1 )   CALL ctl_stop( TRIM(clinfo)//' not found' ) 
-            ELSE
-               iom_varid = iiv
-               IF( PRESENT(kdimsz) ) THEN 
-                  i_nvd = iom_file(kiomid)%ndims(iiv)
-                  IF( i_nvd == size(kdimsz) ) THEN
-                     kdimsz(:) = iom_file(kiomid)%dimsz(1:i_nvd,iiv)
-                  ELSE
-                     WRITE(ctmp1,*) i_nvd, size(kdimsz)
-                     CALL ctl_stop( trim(clinfo), 'error in kdimsz size'//trim(ctmp1) )
-                  ENDIF
-               ENDIF
-               IF( PRESENT(kndims) )  kndims = iom_file(kiomid)%ndims(iiv)
-            ENDIF
-         ENDIF
-      ENDIF
-      !
-   END FUNCTION iom_varid
-
-
-   !!----------------------------------------------------------------------
-   !!                   INTERFACE iom_get
-   !!----------------------------------------------------------------------
-   SUBROUTINE iom_g0d( kiomid, cdvar, pvar, ktime )
-      INTEGER         , INTENT(in   )                 ::   kiomid    ! Identifier of the file
-      CHARACTER(len=*), INTENT(in   )                 ::   cdvar     ! Name of the variable
-      REAL(wp)        , INTENT(  out)                 ::   pvar      ! read field
-      INTEGER         , INTENT(in   ),     OPTIONAL   ::   ktime     ! record number
-      !
-      INTEGER                                         ::   idvar     ! variable id
-      INTEGER                                         ::   idmspc    ! number of spatial dimensions
-      INTEGER         , DIMENSION(1)                  ::   itime     ! record number
-      CHARACTER(LEN=100)                              ::   clinfo    ! info character
-      CHARACTER(LEN=100)                              ::   clname    ! file name
-      CHARACTER(LEN=1)                                ::   cldmspc   !
-      !
-      itime = 1
-      IF( PRESENT(ktime) ) itime = ktime
-      !
-      clname = iom_file(kiomid)%name
-      clinfo = '          iom_g0d, file: '//trim(clname)//', var: '//trim(cdvar)
-      !
-      IF( kiomid > 0 ) THEN
-         idvar = iom_varid( kiomid, cdvar )
-         IF( iom_file(kiomid)%nfid > 0 .AND. idvar > 0 ) THEN
-            idmspc = iom_file ( kiomid )%ndims( idvar )
-            IF( iom_file(kiomid)%luld(idvar) )  idmspc = idmspc - 1
-            WRITE(cldmspc , fmt='(i1)') idmspc
-            IF( idmspc > 0 )  CALL ctl_stop( TRIM(clinfo), 'When reading to a 0D array, we do not accept data', &
-                                 &                         'with 1 or more spatial dimensions: '//cldmspc//' were found.' , &
-                                 &                         'Use ncwa -a to suppress the unnecessary dimensions' )
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_get(  kiomid, idvar, pvar, itime )
-            CASE (jpnf90   )   ;   CALL iom_nf90_get(    kiomid, idvar, pvar, itime )
-            CASE (jprstdimg)   ;   CALL iom_rstdimg_get( kiomid, idvar, pvar )
-            CASE DEFAULT    
-               CALL ctl_stop( 'iom_g0d: accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_g0d
-
-   SUBROUTINE iom_g1d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount )
-      INTEGER         , INTENT(in   )                         ::   kiomid    ! Identifier of the file
-      INTEGER         , INTENT(in   )                         ::   kdom      ! Type of domain to be read
-      CHARACTER(len=*), INTENT(in   )                         ::   cdvar     ! Name of the variable
-      REAL(wp)        , INTENT(  out), DIMENSION(:)           ::   pvar      ! read field
-      INTEGER         , INTENT(in   )              , OPTIONAL ::   ktime     ! record number
-      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kstart    ! start axis position of the reading 
-      INTEGER         , INTENT(in   ), DIMENSION(1), OPTIONAL ::   kcount    ! number of points in each axis
-      !
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom       , cdvar        , pv_r1d=pvar,   &
-              &                                                     ktime=ktime, kstart=kstart, kcount=kcount )
-      ENDIF
-   END SUBROUTINE iom_g1d
-
-   SUBROUTINE iom_g2d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount )
-      INTEGER         , INTENT(in   )                           ::   kiomid    ! Identifier of the file
-      INTEGER         , INTENT(in   )                           ::   kdom      ! Type of domain to be read
-      CHARACTER(len=*), INTENT(in   )                           ::   cdvar     ! Name of the variable
-      REAL(wp)        , INTENT(  out), DIMENSION(:,:)           ::   pvar      ! read field
-      INTEGER         , INTENT(in   )                , OPTIONAL ::   ktime     ! record number
-      INTEGER         , INTENT(in   ), DIMENSION(2)  , OPTIONAL ::   kstart    ! start axis position of the reading 
-      INTEGER         , INTENT(in   ), DIMENSION(2)  , OPTIONAL ::   kcount    ! number of points in each axis
-      !
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom       , cdvar        , pv_r2d=pvar,   &
-              &                                                     ktime=ktime, kstart=kstart, kcount=kcount )
-      ENDIF
-   END SUBROUTINE iom_g2d
-
-   SUBROUTINE iom_g3d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount )
-      INTEGER         , INTENT(in   )                             ::   kiomid    ! Identifier of the file
-      INTEGER         , INTENT(in   )                             ::   kdom      ! Type of domain to be read
-      CHARACTER(len=*), INTENT(in   )                             ::   cdvar     ! Name of the variable
-      REAL(wp)        , INTENT(  out), DIMENSION(:,:,:)           ::   pvar      ! read field
-      INTEGER         , INTENT(in   )                  , OPTIONAL ::   ktime     ! record number
-      INTEGER         , INTENT(in   ), DIMENSION(3)    , OPTIONAL ::   kstart    ! start axis position of the reading 
-      INTEGER         , INTENT(in   ), DIMENSION(3)    , OPTIONAL ::   kcount    ! number of points in each axis
-      !
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom       , cdvar        , pv_r3d=pvar,   &
-              &                                                     ktime=ktime, kstart=kstart, kcount=kcount )
-      ENDIF
-   END SUBROUTINE iom_g3d
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE iom_get_123d( kiomid, kdom  , cdvar ,   &
-         &                  pv_r1d, pv_r2d, pv_r3d,   &
-         &                  ktime , kstart, kcount  )
-      !!-----------------------------------------------------------------------
-      !!                  ***  ROUTINE  iom_get_123d  ***
-      !!
-      !! ** Purpose : read a 1D/2D/3D variable
-      !!
-      !! ** Method : read ONE record at each CALL
-      !!-----------------------------------------------------------------------
-      INTEGER                    , INTENT(in   )           ::   kiomid     ! Identifier of the file
-      INTEGER                    , INTENT(in   )           ::   kdom       ! Type of domain to be read
-      CHARACTER(len=*)           , INTENT(in   )           ::   cdvar      ! Name of the variable
-      REAL(wp), DIMENSION(:)     , INTENT(  out), OPTIONAL ::   pv_r1d     ! read field (1D case)
-      REAL(wp), DIMENSION(:,:)   , INTENT(  out), OPTIONAL ::   pv_r2d     ! read field (2D case)
-      REAL(wp), DIMENSION(:,:,:) , INTENT(  out), OPTIONAL ::   pv_r3d     ! read field (3D case)
-      INTEGER                    , INTENT(in   ), OPTIONAL ::   ktime      ! record number
-      INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kstart     ! start position of the reading in each axis 
-      INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kcount     ! number of points to be read in each axis
-      !
-      LOGICAL                        ::   llnoov      ! local definition to read overlap
-      INTEGER                        ::   jl          ! loop on number of dimension 
-      INTEGER                        ::   idom        ! type of domain
-      INTEGER                        ::   idvar       ! id of the variable
-      INTEGER                        ::   inbdim      ! number of dimensions of the variable
-      INTEGER                        ::   idmspc      ! number of spatial dimensions 
-      INTEGER                        ::   itime       ! record number
-      INTEGER                        ::   istop       ! temporary value of nstop
-      INTEGER                        ::   ix1, ix2, iy1, iy2   ! subdomain indexes
-      INTEGER                        ::   ji, jj      ! loop counters
-      INTEGER                        ::   irankpv       ! 
-      INTEGER                        ::   ind1, ind2  ! substring index
-      INTEGER, DIMENSION(jpmax_dims) ::   istart      ! starting point to read for each axis
-      INTEGER, DIMENSION(jpmax_dims) ::   icnt        ! number of value to read along each axis 
-      INTEGER, DIMENSION(jpmax_dims) ::   idimsz      ! size of the dimensions of the variable
-      INTEGER, DIMENSION(jpmax_dims) ::   ishape      ! size of the dimensions of the variable
-      REAL(wp)                       ::   zscf, zofs  ! sacle_factor and add_offset
-      INTEGER                        ::   itmp        ! temporary integer
-      CHARACTER(LEN=256)             ::   clinfo      ! info character
-      CHARACTER(LEN=256)             ::   clname      ! file name
-      CHARACTER(LEN=1)               ::   clrankpv, cldmspc      ! 
-      !---------------------------------------------------------------------
-      !
-      clname = iom_file(kiomid)%name   !   esier to read
-      clinfo = '          iom_get_123d, file: '//trim(clname)//', var: '//trim(cdvar)
-      ! local definition of the domain ?
-      idom = kdom
-      ! do we read the overlap 
-      ! ugly patch SM+JMM+RB to overwrite global definition in some cases
-      llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif 
-      ! check kcount and kstart optionals parameters...
-      IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present')
-      IF( PRESENT(kstart) .AND. (.NOT. PRESENT(kcount)) ) CALL ctl_stop(trim(clinfo), 'kstart present needs kcount present')
-      IF( PRESENT(kstart) .AND. idom /= jpdom_unknown   ) CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown')
-
-      ! Search for the variable in the data base (eventually actualize data)
-      istop = nstop
-      idvar = iom_varid( kiomid, cdvar )
-      !
-      IF( idvar > 0 ) THEN
-         ! to write iom_file(kiomid)%dimsz in a shorter way !
-         idimsz(:) = iom_file(kiomid)%dimsz(:, idvar) 
-         inbdim = iom_file(kiomid)%ndims(idvar)            ! number of dimensions in the file
-         idmspc = inbdim                                   ! number of spatial dimensions in the file
-         IF( iom_file(kiomid)%luld(idvar) )   idmspc = inbdim - 1
-         IF( idmspc > 3 )   CALL ctl_stop(trim(clinfo), 'the file has more than 3 spatial dimensions this case is not coded...') 
-         !
-         ! update idom definition...
-         ! Identify the domain in case of jpdom_auto(glo/dta) definition
-         IF( idom == jpdom_autoglo .OR. idom == jpdom_autodta ) THEN            
-            IF( idom == jpdom_autoglo ) THEN   ;   idom = jpdom_global 
-            ELSE                               ;   idom = jpdom_data
-            ENDIF
-            ind1 = INDEX( clname, '_', back = .TRUE. ) + 1
-            ind2 = INDEX( clname, '.', back = .TRUE. ) - 1
-            IF( ind2 > ind1 ) THEN   ;   IF( VERIFY( clname(ind1:ind2), '0123456789' ) == 0 )   idom = jpdom_local   ;   ENDIF
-         ENDIF
-         ! Identify the domain in case of jpdom_local definition
-         IF( idom == jpdom_local ) THEN
-            IF(     idimsz(1) == jpi               .AND. idimsz(2) == jpj               ) THEN   ;   idom = jpdom_local_full
-            ELSEIF( idimsz(1) == nlci              .AND. idimsz(2) == nlcj              ) THEN   ;   idom = jpdom_local_noextra
-            ELSEIF( idimsz(1) == (nlei - nldi + 1) .AND. idimsz(2) == (nlej - nldj + 1) ) THEN   ;   idom = jpdom_local_noovlap
-            ELSE   ;   CALL ctl_stop( trim(clinfo), 'impossible to identify the local domain' )
-            ENDIF
-         ENDIF
-         !
-         ! check the consistency between input array and data rank in the file
-         !
-         ! initializations
-         itime = 1
-         IF( PRESENT(ktime) ) itime = ktime
-
-         irankpv = 1 * COUNT( (/PRESENT(pv_r1d)/) ) + 2 * COUNT( (/PRESENT(pv_r2d)/) ) + 3 * COUNT( (/PRESENT(pv_r3d)/) )
-         WRITE(clrankpv, fmt='(i1)') irankpv
-         WRITE(cldmspc , fmt='(i1)') idmspc
-         !
-         IF(     idmspc <  irankpv ) THEN 
-            CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension',   &
-               &                         'it is impossible to read a '//clrankpv//'D array from this file...' )
-         ELSEIF( idmspc == irankpv ) THEN
-            IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown )   &
-               &   CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' )
-         ELSEIF( idmspc >  irankpv ) THEN
-               IF( PRESENT(pv_r2d) .AND. itime == 1 .AND. idimsz(3) == 1 .AND. idmspc == 3 ) THEN
-                  CALL ctl_warn( trim(clinfo), '2D array but 3 spatial dimensions for the data...'              ,   &
-                        &         'As the size of the z dimension is 1 and as we try to read the first record, ',   &
-                        &         'we accept this case, even if there is a possible mix-up between z and time dimension' )   
-                  idmspc = idmspc - 1
-               ELSE
-                  CALL ctl_stop( TRIM(clinfo), 'To keep iom lisibility, when reading a '//clrankpv//'D array,'         ,   &
-                     &                         'we do not accept data with '//cldmspc//' spatial dimensions',   &
-                     &                         'Use ncwa -a to suppress the unnecessary dimensions' )
-               ENDIF
-         ENDIF
-
-         !
-         ! definition of istart and icnt
-         !
-         icnt  (:) = 1
-         istart(:) = 1
-         istart(idmspc+1) = itime
-
-         IF(              PRESENT(kstart)       ) THEN ; istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc)
-         ELSE
-            IF(           idom == jpdom_unknown ) THEN                                       ; icnt(1:idmspc) = idimsz(1:idmspc)
-            ELSE 
-               IF( .NOT. PRESENT(pv_r1d) ) THEN   !   not a 1D array
-                  IF(     idom == jpdom_data    ) THEN ; istart(1:2) = (/ mig(1), mjg(1) /)  ! icnt(1:2) done bellow
-                  ELSEIF( idom == jpdom_global  ) THEN ; istart(1:2) = (/ nimpp , njmpp  /)  ! icnt(1:2) done bellow
-                  ENDIF
-                  ! we do not read the overlap                     -> we start to read at nldi, nldj
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!                  IF( idom /= jpdom_local_noovlap )   istart(1:2) = istart(1:2) + (/ nldi - 1, nldj - 1 /)
-                  IF( llnoov .AND. idom /= jpdom_local_noovlap ) istart(1:2) = istart(1:2) + (/ nldi - 1, nldj - 1 /)
-                  ! we do not read the overlap and the extra-halos -> from nldi to nlei and from nldj to nlej 
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!                  icnt(1:2) = (/ nlei - nldi + 1, nlej - nldj + 1 /)
-                  IF( llnoov ) THEN   ;   icnt(1:2) = (/ nlei - nldi + 1, nlej - nldj + 1 /)
-                  ELSE                ;   icnt(1:2) = (/ nlci           , nlcj            /)
-                  ENDIF
-                  IF( PRESENT(pv_r3d) ) THEN
-                     IF( idom == jpdom_data ) THEN   ; icnt(3) = jpkdta
-                     ELSE                            ; icnt(3) = jpk
-                     ENDIF
-                  ENDIF
-               ENDIF
-            ENDIF
-         ENDIF
-
-         ! check that istart and icnt can be used with this file
-         !-
-         DO jl = 1, jpmax_dims
-            itmp = istart(jl)+icnt(jl)-1
-            IF( itmp > idimsz(jl) .AND. idimsz(jl) /= 0 ) THEN
-               WRITE( ctmp1, FMT="('(istart(', i1, ') + icnt(', i1, ') - 1) = ', i5)" ) jl, jl, itmp
-               WRITE( ctmp2, FMT="(' is larger than idimsz(', i1,') = ', i5)"         ) jl, idimsz(jl)
-               CALL ctl_stop( trim(clinfo), 'start and count too big regarding to the size of the data, ', ctmp1, ctmp2 )     
-            ENDIF
-         END DO
-
-         ! check that icnt matches the input array
-         !-     
-         IF( idom == jpdom_unknown ) THEN
-            IF( irankpv == 1 )        ishape(1:1) = SHAPE(pv_r1d)
-            IF( irankpv == 2 )        ishape(1:2) = SHAPE(pv_r2d)
-            IF( irankpv == 3 )        ishape(1:3) = SHAPE(pv_r3d)
-            ctmp1 = 'd'
-         ELSE
-            IF( irankpv == 2 ) THEN
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!               ishape(1:2) = SHAPE(pv_r2d(nldi:nlei,nldj:nlej  ))   ;   ctmp1 = 'd(nldi:nlei,nldj:nlej)'
-               IF( llnoov ) THEN ; ishape(1:2)=SHAPE(pv_r2d(nldi:nlei,nldj:nlej  )) ; ctmp1='d(nldi:nlei,nldj:nlej)'
-               ELSE              ; ishape(1:2)=SHAPE(pv_r2d(1   :nlci,1   :nlcj  )) ; ctmp1='d(1:nlci,1:nlcj)'
-               ENDIF
-            ENDIF
-            IF( irankpv == 3 ) THEN 
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!               ishape(1:3) = SHAPE(pv_r3d(nldi:nlei,nldj:nlej,:))   ;   ctmp1 = 'd(nldi:nlei,nldj:nlej,:)'
-               IF( llnoov ) THEN ; ishape(1:3)=SHAPE(pv_r3d(nldi:nlei,nldj:nlej,:)) ; ctmp1='d(nldi:nlei,nldj:nlej,:)'
-               ELSE              ; ishape(1:3)=SHAPE(pv_r3d(1   :nlci,1   :nlcj,:)) ; ctmp1='d(1:nlci,1:nlcj,:)'
-               ENDIF
-            ENDIF
-         ENDIF
-         
-         DO jl = 1, irankpv
-            WRITE( ctmp2, FMT="(', ', i1,'): ', i5,' /= icnt(', i1,'):', i5)" ) jl, ishape(jl), jl, icnt(jl)
-            IF( ishape(jl) /= icnt(jl) )   CALL ctl_stop( TRIM(clinfo), 'size(pv_r'//clrankpv//TRIM(ctmp1)//TRIM(ctmp2) )
-         END DO
-
-      ENDIF
-
-      ! read the data
-      !-     
-      IF( idvar > 0 .AND. istop == nstop ) THEN   ! no additional errors until this point...
-         !
-         ! find the right index of the array to be read
-! JMM + SM: ugly patch before getting the new version of lib_mpp)
-!         IF( idom /= jpdom_unknown ) THEN   ;   ix1 = nldi   ;   ix2 = nlei      ;   iy1 = nldj   ;   iy2 = nlej
-!         ELSE                               ;   ix1 = 1      ;   ix2 = icnt(1)   ;   iy1 = 1      ;   iy2 = icnt(2)
-!         ENDIF
-         IF( llnoov ) THEN
-            IF( idom /= jpdom_unknown ) THEN   ;   ix1 = nldi   ;   ix2 = nlei      ;   iy1 = nldj   ;   iy2 = nlej
-            ELSE                               ;   ix1 = 1      ;   ix2 = icnt(1)   ;   iy1 = 1      ;   iy2 = icnt(2)
-            ENDIF
-         ELSE
-            IF( idom /= jpdom_unknown ) THEN   ;   ix1 = 1      ;   ix2 = nlci      ;   iy1 = 1      ;   iy2 = nlcj
-            ELSE                               ;   ix1 = 1      ;   ix2 = icnt(1)   ;   iy1 = 1      ;   iy2 = icnt(2)
-            ENDIF
-         ENDIF
-      
-         SELECT CASE (iom_file(kiomid)%iolib)
-         CASE (jpioipsl )   ;   CALL iom_ioipsl_get(  kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2,   &
-            &                                         pv_r1d, pv_r2d, pv_r3d )
-         CASE (jpnf90   )   ;   CALL iom_nf90_get(    kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2,   &
-            &                                         pv_r1d, pv_r2d, pv_r3d )
-         CASE (jprstdimg)   ;   CALL iom_rstdimg_get( kiomid, idom, idvar, ix1, ix2, iy1, iy2,   &
-            &                                         pv_r1d, pv_r2d, pv_r3d )
-         CASE DEFAULT    
-            CALL ctl_stop( TRIM(clinfo)//' accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-         END SELECT
-
-         IF( istop == nstop ) THEN   ! no additional errors until this point...
-            IF(lwp) WRITE(numout,"(10x,' read ',a,' (rec: ',i6,') in ',a,' ok')") TRIM(cdvar), itime, TRIM(iom_file(kiomid)%name)
-          
-            !--- overlap areas and extra hallows (mpp)
-            IF(     PRESENT(pv_r2d) .AND. idom /= jpdom_unknown ) THEN
-               CALL lbc_lnk( pv_r2d,'Z',-999.,'no0' )
-            ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown ) THEN
-               ! this if could be simplified with the new lbc_lnk that works with any size of the 3rd dimension
-               IF( icnt(3) == jpk ) THEN
-                  CALL lbc_lnk( pv_r3d,'Z',-999.,'no0' )
-               ELSE   ! put some arbitrary value (a call to lbc_lnk will be done later...)
-                  DO jj = nlcj+1, jpj   ;   pv_r3d(1:nlci, jj, :) = pv_r3d(1:nlci, nlej, :)   ;   END DO
-                  DO ji = nlci+1, jpi   ;   pv_r3d(ji    , : , :) = pv_r3d(nlei  , :   , :)   ;   END DO
-               ENDIF
-            ENDIF
-            
-            ! C1D case : always call lbc_lnk to replicate the central value over the whole 3X3 domain
-            IF( lk_c1d .AND. PRESENT(pv_r2d) )   CALL lbc_lnk( pv_r2d,'Z',1. )
-            IF( lk_c1d .AND. PRESENT(pv_r3d) )   CALL lbc_lnk( pv_r3d,'Z',1. )
-    
-            !--- Apply scale_factor and offset
-            zscf = iom_file(kiomid)%scf(idvar)      ! scale factor
-            zofs = iom_file(kiomid)%ofs(idvar)      ! offset
-            IF(     PRESENT(pv_r1d) ) THEN
-               IF( zscf /= 1. )   pv_r1d(:) = pv_r1d(:) * zscf 
-               IF( zofs /= 0. )   pv_r1d(:) = pv_r1d(:) + zofs
-            ELSEIF( PRESENT(pv_r2d) ) THEN
-!CDIR COLLAPSE
-               IF( zscf /= 1.)   pv_r2d(:,:) = pv_r2d(:,:) * zscf
-!CDIR COLLAPSE
-               IF( zofs /= 0.)   pv_r2d(:,:) = pv_r2d(:,:) + zofs
-            ELSEIF( PRESENT(pv_r3d) ) THEN
-!CDIR COLLAPSE
-               IF( zscf /= 1.)   pv_r3d(:,:,:) = pv_r3d(:,:,:) * zscf
-!CDIR COLLAPSE
-               IF( zofs /= 0.)   pv_r3d(:,:,:) = pv_r3d(:,:,:) + zofs
-            ENDIF
-            !
-         ENDIF
-         !
-      ENDIF
-      !
-   END SUBROUTINE iom_get_123d
-
-
-   SUBROUTINE iom_gettime( kiomid, ptime, cdvar, kntime, cdunits, cdcalendar )
-      !!--------------------------------------------------------------------
-      !!                   ***  SUBROUTINE iom_gettime  ***
-      !!
-      !! ** Purpose : read the time axis cdvar in the file 
-      !!--------------------------------------------------------------------
-      INTEGER                    , INTENT(in   ) ::   kiomid     ! file Identifier
-      REAL(wp), DIMENSION(:)     , INTENT(  out) ::   ptime      ! the time axis
-      CHARACTER(len=*), OPTIONAL , INTENT(in   ) ::   cdvar      ! time axis name
-      INTEGER         , OPTIONAL , INTENT(  out) ::   kntime     ! number of times in file
-      CHARACTER(len=*), OPTIONAL , INTENT(  out) ::   cdunits    ! units attribute of time coordinate
-      CHARACTER(len=*), OPTIONAL , INTENT(  out) ::   cdcalendar ! calendar attribute of 
-      !
-      INTEGER, DIMENSION(1) :: kdimsz
-      INTEGER            ::   idvar    ! id of the variable
-      CHARACTER(LEN=32)  ::   tname    ! local name of time coordinate
-      CHARACTER(LEN=100) ::   clinfo   ! info character
-      !---------------------------------------------------------------------
-      !
-      IF ( PRESENT(cdvar) ) THEN
-         tname = cdvar
-      ELSE
-         tname = iom_file(kiomid)%uldname
-      ENDIF
-      IF( kiomid > 0 ) THEN
-         clinfo = 'iom_gettime, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(tname)
-         IF ( PRESENT(kntime) ) THEN
-            idvar  = iom_varid( kiomid, tname, kdimsz = kdimsz )
-            kntime = kdimsz(1)
-         ELSE
-            idvar = iom_varid( kiomid, tname )
-         ENDIF
-         !
-         ptime(:) = 0. ! default definition
-         IF( idvar > 0 ) THEN
-            IF( iom_file(kiomid)%ndims(idvar) == 1 ) THEN
-               IF( iom_file(kiomid)%luld(idvar) ) THEN
-                  IF( iom_file(kiomid)%dimsz(1,idvar) <= size(ptime) ) THEN
-                     SELECT CASE (iom_file(kiomid)%iolib)
-                     CASE (jpioipsl )   ;   CALL iom_ioipsl_gettime( kiomid, idvar, ptime, cdunits, cdcalendar )
-                     CASE (jpnf90   )   ;   CALL iom_nf90_gettime(   kiomid, idvar, ptime, cdunits, cdcalendar )
-                     CASE (jprstdimg)   ;   CALL ctl_stop( TRIM(clinfo)//' case IO library == jprstdimg not coded...' )
-                     CASE DEFAULT    
-                        CALL ctl_stop( TRIM(clinfo)//' accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-                     END SELECT
-                  ELSE
-                     WRITE(ctmp1,*) 'error with the size of ptime ',size(ptime),iom_file(kiomid)%dimsz(1,idvar)
-                     CALL ctl_stop( trim(clinfo), trim(ctmp1) )
-                  ENDIF
-               ELSE
-                  CALL ctl_stop( trim(clinfo), 'variable dimension is not unlimited... use iom_get' )
-               ENDIF
-            ELSE
-               CALL ctl_stop( trim(clinfo), 'the variable has more than 1 dimension' )
-            ENDIF
-         ELSE
-            CALL ctl_stop( trim(clinfo), 'variable not found in '//iom_file(kiomid)%name )
-         ENDIF
-      ENDIF
-      !
-   END SUBROUTINE iom_gettime
-
-
-   !!----------------------------------------------------------------------
-   !!                   INTERFACE iom_getatt
-   !!----------------------------------------------------------------------
-   SUBROUTINE iom_g0d_intatt( kiomid, cdatt, pvar )
-      INTEGER         , INTENT(in   )                 ::   kiomid    ! Identifier of the file
-      CHARACTER(len=*), INTENT(in   )                 ::   cdatt     ! Name of the attribute
-      INTEGER         , INTENT(  out)                 ::   pvar      ! read field
-      !
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) THEN
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL ctl_stop('iom_getatt: only nf90 available')
-            CASE (jpnf90   )   ;   CALL iom_nf90_getatt( kiomid, cdatt, pvar )
-            CASE (jprstdimg)   ;   CALL ctl_stop('iom_getatt: only nf90 available')
-            CASE DEFAULT    
-               CALL ctl_stop( 'iom_g0d_att: accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_g0d_intatt
-
-
-   !!----------------------------------------------------------------------
-   !!                   INTERFACE iom_rstput
-   !!----------------------------------------------------------------------
-   SUBROUTINE iom_rp0d( kt, kwrite, kiomid, cdvar, pvar, ktype )
-      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step
-      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step
-      INTEGER         , INTENT(in)                         ::   kiomid   ! Identifier of the file 
-      CHARACTER(len=*), INTENT(in)                         ::   cdvar    ! time axis name
-      REAL(wp)        , INTENT(in)                         ::   pvar     ! written field
-      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type
-      INTEGER :: ivid   ! variable id
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) THEN
-            ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. )
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar )
-            CASE (jpnf90   )   ;   CALL iom_nf90_rstput(   kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar )
-            CASE (jprstdimg)   ;   IF( kt == kwrite )    CALL iom_rstdimg_rstput( kiomid, cdvar, ivid, pvar )
-            CASE DEFAULT     
-               CALL ctl_stop( 'iom_rp0d: accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_rp0d
-
-   SUBROUTINE iom_rp1d( kt, kwrite, kiomid, cdvar, pvar, ktype )
-      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step
-      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step
-      INTEGER         , INTENT(in)                         ::   kiomid   ! Identifier of the file 
-      CHARACTER(len=*), INTENT(in)                         ::   cdvar    ! time axis name
-      REAL(wp)        , INTENT(in), DIMENSION(          :) ::   pvar     ! written field
-      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type
-      INTEGER :: ivid   ! variable id
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) THEN
-            ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. )
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar )
-            CASE (jpnf90   )   ;   CALL iom_nf90_rstput(   kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar )
-            CASE (jprstdimg)   ;   IF( kt == kwrite )    CALL iom_rstdimg_rstput( kiomid, cdvar, ivid, pv_r1d = pvar )
-            CASE DEFAULT     
-               CALL ctl_stop( 'iom_rp1d: accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_rp1d
-
-   SUBROUTINE iom_rp2d( kt, kwrite, kiomid, cdvar, pvar, ktype )
-      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step
-      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step
-      INTEGER         , INTENT(in)                         ::   kiomid   ! Identifier of the file 
-      CHARACTER(len=*), INTENT(in)                         ::   cdvar    ! time axis name
-      REAL(wp)        , INTENT(in), DIMENSION(:,    :    ) ::   pvar     ! written field
-      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type
-      INTEGER :: ivid   ! variable id
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) THEN
-            ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. )
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar )
-            CASE (jpnf90   )   ;   CALL iom_nf90_rstput(   kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar )
-            CASE (jprstdimg)   ;   IF( kt == kwrite )   CALL iom_rstdimg_rstput( kiomid, cdvar, ivid, pv_r2d = pvar ) 
-            CASE DEFAULT     
-               CALL ctl_stop( 'iom_rp2d: accepted IO library are only jpioipsl, jpnf90 and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_rp2d
-
-   SUBROUTINE iom_rp3d( kt, kwrite, kiomid, cdvar, pvar, ktype )
-      INTEGER         , INTENT(in)                         ::   kt       ! ocean time-step
-      INTEGER         , INTENT(in)                         ::   kwrite   ! writing time-step
-      INTEGER         , INTENT(in)                         ::   kiomid   ! Identifier of the file 
-      CHARACTER(len=*), INTENT(in)                         ::   cdvar    ! time axis name
-      REAL(wp)        , INTENT(in),       DIMENSION(:,:,:) ::   pvar     ! written field
-      INTEGER         , INTENT(in), OPTIONAL               ::   ktype    ! variable external type
-      INTEGER :: ivid   ! variable id
-      IF( kiomid > 0 ) THEN
-         IF( iom_file(kiomid)%nfid > 0 ) THEN
-            ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. )
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar )
-            CASE (jpnf90   )   ;   CALL iom_nf90_rstput(   kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar )
-            CASE (jprstdimg)   ;   IF( kt == kwrite )   CALL iom_rstdimg_rstput( kiomid, cdvar, ivid, pv_r3d = pvar )
-            CASE DEFAULT     
-               CALL ctl_stop( 'iom_rp3d: accepted IO library are only jpioipsl and jprstdimg' )
-            END SELECT
-         ENDIF
-      ENDIF
-   END SUBROUTINE iom_rp3d
-
-
-   !!----------------------------------------------------------------------
-   !!                   INTERFACE iom_put
-   !!----------------------------------------------------------------------
-   SUBROUTINE iom_p0d( cdname, pfield0d )
-      CHARACTER(LEN=*), INTENT(in) ::   cdname
-      REAL(wp)        , INTENT(in) ::   pfield0d
-      REAL(wp)        , DIMENSION(jpi,jpj) ::   zz     ! masson
-#if defined key_iomput
-      zz(:,:)=pfield0d
-      CALL xios_send_field(cdname, zz)
-      !CALL xios_send_field(cdname, (/pfield0d/)) 
-#else
-      IF( .FALSE. )   WRITE(numout,*) cdname, pfield0d   ! useless test to avoid compilation warnings
-#endif
-   END SUBROUTINE iom_p0d
-
-   SUBROUTINE iom_p1d( cdname, pfield1d )
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdname
-      REAL(wp),     DIMENSION(:), INTENT(in) ::   pfield1d
-#if defined key_iomput
-      CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) )
-#else
-      IF( .FALSE. )   WRITE(numout,*) cdname, pfield1d   ! useless test to avoid compilation warnings
-#endif
-   END SUBROUTINE iom_p1d
-
-   SUBROUTINE iom_p2d( cdname, pfield2d )
-      CHARACTER(LEN=*)            , INTENT(in) ::   cdname
-      REAL(wp),     DIMENSION(:,:), INTENT(in) ::   pfield2d
-#if defined key_iomput
-      CALL xios_send_field(cdname, pfield2d)
-#else
-      IF( .FALSE. )   WRITE(numout,*) cdname, pfield2d   ! useless test to avoid compilation warnings
-#endif
-   END SUBROUTINE iom_p2d
-
-   SUBROUTINE iom_p3d( cdname, pfield3d )
-      CHARACTER(LEN=*)                , INTENT(in) ::   cdname
-      REAL(wp),       DIMENSION(:,:,:), INTENT(in) ::   pfield3d
-#if defined key_iomput
-      CALL xios_send_field(cdname, pfield3d)
-#else
-      IF( .FALSE. )   WRITE(numout,*) cdname, pfield3d   ! useless test to avoid compilation warnings
-#endif
-   END SUBROUTINE iom_p3d
-   !!----------------------------------------------------------------------
-
-#if defined key_iomput
-
-   SUBROUTINE iom_set_domain_attr( cdid, ni_glo, nj_glo, ibegin, jbegin, ni, nj, zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj,   &
-      &                                    data_dim, data_ibegin, data_ni, data_jbegin, data_nj, lonvalue, latvalue, mask )
-      CHARACTER(LEN=*)                 , INTENT(in) ::   cdid
-      INTEGER                , OPTIONAL, INTENT(in) ::   ni_glo, nj_glo, ibegin, jbegin, ni, nj
-      INTEGER                , OPTIONAL, INTENT(in) ::   data_dim, data_ibegin, data_ni, data_jbegin, data_nj
-      INTEGER                , OPTIONAL, INTENT(in) ::   zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj
-      REAL(wp), DIMENSION(:) , OPTIONAL, INTENT(in) ::   lonvalue, latvalue
-      LOGICAL, DIMENSION(:,:), OPTIONAL, INTENT(in) ::   mask
-
-      IF ( xios_is_valid_domain     (cdid) ) THEN
-         CALL xios_set_domain_attr     ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
-            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj ,   &
-            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                       &
-            &    lonvalue=lonvalue, latvalue=latvalue,mask=mask )
-      ENDIF
-
-      IF ( xios_is_valid_domaingroup(cdid) ) THEN
-         CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj,   &
-            &    data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj ,   &
-            &    zoom_ibegin=zoom_ibegin, zoom_jbegin=zoom_jbegin, zoom_ni=zoom_ni, zoom_nj=zoom_nj,                       &
-            &    lonvalue=lonvalue, latvalue=latvalue,mask=mask )
-      ENDIF
-      CALL xios_solve_inheritance()
-
-   END SUBROUTINE iom_set_domain_attr
-
-
-   SUBROUTINE iom_set_axis_attr( cdid, paxis )
-      CHARACTER(LEN=*)      , INTENT(in) ::   cdid
-      REAL(wp), DIMENSION(:), INTENT(in) ::   paxis
-      IF ( xios_is_valid_axis     (cdid) )   CALL xios_set_axis_attr     ( cdid, size=size(paxis),value=paxis )
-      IF ( xios_is_valid_axisgroup(cdid) )   CALL xios_set_axisgroup_attr( cdid, size=size(paxis),value=paxis )
-      CALL xios_solve_inheritance()
-   END SUBROUTINE iom_set_axis_attr
-
-
-   SUBROUTINE iom_set_field_attr( cdid, freq_op, freq_offset )
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
-      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   freq_op
-      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   freq_offset
-      IF ( xios_is_valid_field     (cdid) )   CALL xios_set_field_attr     ( cdid, freq_op=freq_op, freq_offset=freq_offset )
-      IF ( xios_is_valid_fieldgroup(cdid) )   CALL xios_set_fieldgroup_attr( cdid, freq_op=freq_op, freq_offset=freq_offset )
-      CALL xios_solve_inheritance()
-   END SUBROUTINE iom_set_field_attr
-
-
-   SUBROUTINE iom_set_file_attr( cdid, name, name_suffix )
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
-      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   name, name_suffix
-      IF ( xios_is_valid_file     (cdid) )   CALL xios_set_file_attr     ( cdid, name=name, name_suffix=name_suffix )
-      IF ( xios_is_valid_filegroup(cdid) )   CALL xios_set_filegroup_attr( cdid, name=name, name_suffix=name_suffix )
-      CALL xios_solve_inheritance()
-   END SUBROUTINE iom_set_file_attr
-
-
-   SUBROUTINE iom_get_file_attr( cdid, name, name_suffix, output_freq )
-      CHARACTER(LEN=*)          , INTENT(in ) ::   cdid
-      CHARACTER(LEN=*),OPTIONAL , INTENT(out) ::   name, name_suffix, output_freq
-      LOGICAL                                 ::   llexist1,llexist2,llexist3
-      !---------------------------------------------------------------------
-      IF( PRESENT( name        ) )   name = ''          ! default values
-      IF( PRESENT( name_suffix ) )   name_suffix = ''
-      IF( PRESENT( output_freq ) )   output_freq = ''
-      IF ( xios_is_valid_file     (cdid) ) THEN
-         CALL xios_solve_inheritance()
-         CALL xios_is_defined_file_attr     ( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3)
-         IF(llexist1)   CALL xios_get_file_attr     ( cdid, name = name )
-         IF(llexist2)   CALL xios_get_file_attr     ( cdid, name_suffix = name_suffix )
-         IF(llexist3)   CALL xios_get_file_attr     ( cdid, output_freq = output_freq )
-      ENDIF
-      IF ( xios_is_valid_filegroup(cdid) ) THEN
-         CALL xios_solve_inheritance()
-         CALL xios_is_defined_filegroup_attr( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3)
-         IF(llexist1)   CALL xios_get_filegroup_attr( cdid, name = name )
-         IF(llexist2)   CALL xios_get_filegroup_attr( cdid, name_suffix = name_suffix )
-         IF(llexist3)   CALL xios_get_filegroup_attr( cdid, output_freq = output_freq )
-      ENDIF
-   END SUBROUTINE iom_get_file_attr
-
-
-   SUBROUTINE iom_set_grid_attr( cdid, mask )
-      CHARACTER(LEN=*)                   , INTENT(in) ::   cdid
-      LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) ::   mask
-      IF ( xios_is_valid_grid     (cdid) )   CALL xios_set_grid_attr     ( cdid, mask=mask )
-      IF ( xios_is_valid_gridgroup(cdid) )   CALL xios_set_gridgroup_attr( cdid, mask=mask )
-      CALL xios_solve_inheritance()
-   END SUBROUTINE iom_set_grid_attr
-
-   SUBROUTINE iom_setkt( kt, cdname )
-      INTEGER         , INTENT(in) ::   kt 
-      CHARACTER(LEN=*), INTENT(in) ::   cdname
-      !     
-      CALL iom_swap( cdname )   ! swap to cdname context
-      CALL xios_update_calendar(kt)
-      IF( cdname /= "nemo" ) CALL iom_swap( "nemo" )   ! return back to nemo context
-      !
-   END SUBROUTINE iom_setkt
-
-   SUBROUTINE iom_context_finalize( cdname )
-      CHARACTER(LEN=*), INTENT(in) :: cdname
-      !     
-      CALL iom_swap( cdname )   ! swap to cdname context
-      CALL xios_context_finalize() ! finalize the context
-      IF( cdname /= "nemo" ) CALL iom_swap( "nemo" )   ! return back to nemo context
-      !
-   END SUBROUTINE iom_context_finalize
-
-
-   SUBROUTINE set_grid( cdgrd, plon, plat )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE set_grid  ***
-      !!
-      !! ** Purpose :   define horizontal grids
-      !!
-      !!----------------------------------------------------------------------
-      CHARACTER(LEN=1)            , INTENT(in) ::   cdgrd
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plon
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat
-      !
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmask
-      INTEGER  :: ni,nj
-      
-      ni=nlei-nldi+1 ; nj=nlej-nldj+1
-
-      CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-1, jbegin=njmpp+nldj-1, ni=ni, nj=nj)
-      CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj)
-      CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)),   &
-         &                                     latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /)))  
-
-      IF ( ln_mskland ) THEN
-         ! mask land points, keep values on coast line -> specific mask for U, V and W points
-         SELECT CASE ( cdgrd )
-         CASE('T')   ;   zmask(:,:,:)       = tmask(:,:,:)
-         CASE('U')   ;   zmask(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:)   ;   CALL lbc_lnk( zmask, 'U', 1. )
-         CASE('V')   ;   zmask(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpi,:)   ;   CALL lbc_lnk( zmask, 'V', 1. )
-         CASE('W')   ;   zmask(:,:,2:jpk  ) = tmask(:,:,1:jpkm1) + tmask(:,:,2:jpk)   ;   zmask(:,:,1) = tmask(:,:,1)
-         END SELECT
-         !
-         CALL iom_set_domain_attr( "grid_"//cdgrd       , mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,1),(/ni,nj    /)) /= 0. )
-         CALL iom_set_grid_attr  ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,:),(/ni,nj,jpk/)) /= 0. )
-      ENDIF
-      
-   END SUBROUTINE set_grid
-
-
-   SUBROUTINE set_scalar
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE set_scalar  ***
-      !!
-      !! ** Purpose :   define fake grids for scalar point
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(1) ::   zz = 1.
-      !!----------------------------------------------------------------------
-      CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea, jbegin=1, ni=1, nj=1)
-      CALL iom_set_domain_attr('scalarpoint', data_dim=2, data_ibegin = 1, data_ni = 1, data_jbegin = 1, data_nj = 1)
-      zz=REAL(narea,wp)
-      CALL iom_set_domain_attr('scalarpoint', lonvalue=zz, latvalue=zz)
-
-   END SUBROUTINE set_scalar
-
-
-   SUBROUTINE set_xmlatt
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE set_xmlatt  ***
-      !!
-      !! ** Purpose :   automatic definitions of some of the xml attributs...
-      !!
-      !!----------------------------------------------------------------------
-      CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name
-      CHARACTER(len=256)             ::   clsuff                   ! suffix name
-      CHARACTER(len=1)               ::   cl1                      ! 1 character
-      CHARACTER(len=2)               ::   cl2                      ! 1 character
-      INTEGER                        ::   ji, jg                   ! loop counters
-      INTEGER                        ::   ix, iy                   ! i-,j- index
-      REAL(wp)        ,DIMENSION(11) ::   zlontao                  ! longitudes of tao    moorings
-      REAL(wp)        ,DIMENSION( 7) ::   zlattao                  ! latitudes  of tao    moorings
-      REAL(wp)        ,DIMENSION( 4) ::   zlonrama                 ! longitudes of rama   moorings
-      REAL(wp)        ,DIMENSION(11) ::   zlatrama                 ! latitudes  of rama   moorings
-      REAL(wp)        ,DIMENSION( 3) ::   zlonpira                 ! longitudes of pirata moorings
-      REAL(wp)        ,DIMENSION( 9) ::   zlatpira                 ! latitudes  of pirata moorings
-      !!----------------------------------------------------------------------
-      ! 
-      ! frequency of the call of iom_put (attribut: freq_op)
-      WRITE(cl1,'(i1)')        1   ;   CALL iom_set_field_attr('field_definition', freq_op = cl1//'ts', freq_offset='0ts')
-      WRITE(cl1,'(i1)')  nn_fsbc   ;   CALL iom_set_field_attr('SBC'             , freq_op = cl1//'ts', freq_offset='0ts')
-      WRITE(cl1,'(i1)')  nn_fsbc   ;   CALL iom_set_field_attr('SBC_scalar'      , freq_op = cl1//'ts', freq_offset='0ts')
-      WRITE(cl1,'(i1)') nn_dttrc   ;   CALL iom_set_field_attr('ptrc_T'          , freq_op = cl1//'ts', freq_offset='0ts')
-      WRITE(cl1,'(i1)') nn_dttrc   ;   CALL iom_set_field_attr('diad_T'          , freq_op = cl1//'ts', freq_offset='0ts')
-      WRITE(cl1,'(i1)') nn_fptr    ;   CALL iom_set_field_attr('diaptr'          , freq_op = cl1//'ts', freq_offset='0ts')
-       
-      ! output file names (attribut: name)
-      DO ji = 1, 9
-         WRITE(cl1,'(i1)') ji 
-         CALL iom_update_file_name('file'//cl1)
-      END DO
-      DO ji = 1, 99
-         WRITE(cl2,'(i2.2)') ji 
-         CALL iom_update_file_name('file'//cl2)
-      END DO
-
-      ! Zooms...
-      clgrd = (/ 'T', 'U', 'W' /) 
-      DO jg = 1, SIZE(clgrd)                                                                   ! grid type
-         cl1 = clgrd(jg)
-         ! Equatorial section (attributs: jbegin, ni, name_suffix)
-         CALL dom_ngb( 0., 0., ix, iy, cl1 )
-         CALL iom_set_domain_attr ('Eq'//cl1, zoom_jbegin=iy, zoom_ni=jpiglo)
-         CALL iom_get_file_attr   ('Eq'//cl1, name_suffix = clsuff             )
-         CALL iom_set_file_attr   ('Eq'//cl1, name_suffix = TRIM(clsuff)//'_Eq')
-         CALL iom_update_file_name('Eq'//cl1)
-      END DO
-      ! TAO moorings (attributs: ibegin, jbegin, name_suffix)
-      zlontao = (/ 137.0, 147.0, 156.0, 165.0, -180.0, -170.0, -155.0, -140.0, -125.0, -110.0, -95.0 /)
-      zlattao = (/  -8.0,  -5.0,  -2.0,   0.0,    2.0,    5.0,    8.0 /)
-      CALL set_mooring( zlontao, zlattao )
-      ! RAMA moorings (attributs: ibegin, jbegin, name_suffix)
-      zlonrama = (/  55.0,  67.0, 80.5, 90.0 /)
-      zlatrama = (/ -16.0, -12.0, -8.0, -4.0, -1.5, 0.0, 1.5, 4.0, 8.0, 12.0, 15.0 /)
-      CALL set_mooring( zlonrama, zlatrama )
-      ! PIRATA moorings (attributs: ibegin, jbegin, name_suffix)
-      zlonpira = (/ -38.0, -23.0, -10.0 /)
-      zlatpira = (/ -19.0, -14.0,  -8.0, 0.0, 4.0, 8.0, 12.0, 15.0, 20.0 /)
-      CALL set_mooring( zlonpira, zlatpira )
-    
-      ! diaptr : zonal mean 
-      CALL iom_set_domain_attr ('ptr', zoom_ibegin=nxline, zoom_nj=jpjglo)
-      CALL iom_update_file_name('ptr')
-      !
-   END SUBROUTINE set_xmlatt
-
-
-   SUBROUTINE set_mooring( plon, plat)
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE set_mooring  ***
-      !!
-      !! ** Purpose :   automatic definitions of moorings xml attributs...
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:), INTENT(in) ::  plon, plat           ! longitudes/latitudes oft the mooring
-      !
-!!$      CHARACTER(len=1),DIMENSION(4) ::   clgrd = (/ 'T', 'U', 'V', 'W' /)   ! suffix name
-      CHARACTER(len=1),DIMENSION(1) ::   clgrd = (/ 'T' /)        ! suffix name
-      CHARACTER(len=256)            ::   clname                   ! file name
-      CHARACTER(len=256)            ::   clsuff                   ! suffix name
-      CHARACTER(len=1)              ::   cl1                      ! 1 character
-      CHARACTER(len=6)              ::   clon,clat                ! name of longitude, latitude
-      INTEGER                       ::   ji, jj, jg               ! loop counters
-      INTEGER                       ::   ix, iy                   ! i-,j- index
-      REAL(wp)                      ::   zlon, zlat
-      !!----------------------------------------------------------------------
-      DO jg = 1, SIZE(clgrd)
-         cl1 = clgrd(jg)
-         DO ji = 1, SIZE(plon)
-            DO jj = 1, SIZE(plat)
-               zlon = plon(ji)
-               zlat = plat(jj)
-               ! modifications for RAMA moorings
-               IF( zlon ==  67. .AND. zlat ==  15. )   zlon =  65.
-               IF( zlon ==  90. .AND. zlat <=  -4. )   zlon =  95.
-               IF( zlon ==  95. .AND. zlat ==  -4. )   zlat =  -5.
-               ! modifications for PIRATA moorings
-               IF( zlon == -38. .AND. zlat == -19. )   zlon = -34.
-               IF( zlon == -38. .AND. zlat == -14. )   zlon = -32.
-               IF( zlon == -38. .AND. zlat ==  -8. )   zlon = -30.
-               IF( zlon == -38. .AND. zlat ==   0. )   zlon = -35.
-               IF( zlon == -23. .AND. zlat ==  20. )   zlat =  21.
-               IF( zlon == -10. .AND. zlat == -14. )   zlat = -10.
-               IF( zlon == -10. .AND. zlat ==  -8. )   zlat =  -6.
-               IF( zlon == -10. .AND. zlat ==   4. ) THEN   ;   zlon = 0.   ;   zlat = 0.   ;   ENDIF
-               CALL dom_ngb( zlon, zlat, ix, iy, cl1 )
-               IF( zlon >= 0. ) THEN  
-                  IF( zlon == REAL(NINT(zlon), wp) ) THEN   ;   WRITE(clon, '(i3,  a)') NINT( zlon), 'e'
-                  ELSE                                      ;   WRITE(clon, '(f5.1,a)')       zlon , 'e'
-                  ENDIF
-               ELSE             
-                  IF( zlon == REAL(NINT(zlon), wp) ) THEN   ;   WRITE(clon, '(i3,  a)') NINT(-zlon), 'w'
-                  ELSE                                      ;   WRITE(clon, '(f5.1,a)')      -zlon , 'w'
-                  ENDIF
-               ENDIF
-               IF( zlat >= 0. ) THEN  
-                  IF( zlat == REAL(NINT(zlat), wp) ) THEN   ;   WRITE(clat, '(i2,  a)') NINT( zlat), 'n'
-                  ELSE                                      ;   WRITE(clat, '(f4.1,a)')       zlat , 'n'
-                  ENDIF
-               ELSE             
-                  IF( zlat == REAL(NINT(zlat), wp) ) THEN   ;   WRITE(clat, '(i2,  a)') NINT(-zlat), 's'
-                  ELSE                                      ;   WRITE(clat, '(f4.1,a)')      -zlat , 's'
-                  ENDIF
-               ENDIF
-               clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon))
-               CALL iom_set_domain_attr (TRIM(clname)//cl1, zoom_ibegin= ix, zoom_jbegin= iy)
-               CALL iom_get_file_attr   (TRIM(clname)//cl1, name_suffix = clsuff                         )
-               CALL iom_set_file_attr   (TRIM(clname)//cl1, name_suffix = TRIM(clsuff)//'_'//TRIM(clname))
-               CALL iom_update_file_name(TRIM(clname)//cl1)
-            END DO
-         END DO
-      END DO
-      
-   END SUBROUTINE set_mooring
-
-   
-   SUBROUTINE iom_update_file_name( cdid )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE iom_update_file_name  ***
-      !!
-      !! ** Purpose :   
-      !!
-      !!----------------------------------------------------------------------
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdid
-      !
-      CHARACTER(LEN=256) ::   clname
-      CHARACTER(LEN=20)  ::   clfreq
-      CHARACTER(LEN=20)  ::   cldate
-      INTEGER            ::   idx
-      INTEGER            ::   jn
-      INTEGER            ::   itrlen
-      INTEGER            ::   iyear, imonth, iday, isec
-      REAL(wp)           ::   zsec
-      LOGICAL            ::   llexist
-      !!----------------------------------------------------------------------
-
-      DO jn = 1,2
-
-         IF( jn == 1 )   CALL iom_get_file_attr( cdid, name        = clname, output_freq = clfreq )
-         IF( jn == 2 )   CALL iom_get_file_attr( cdid, name_suffix = clname )
-
-         IF ( TRIM(clname) /= '' ) THEN 
-
-            idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@')
-            DO WHILE ( idx /= 0 ) 
-               clname = clname(1:idx-1)//TRIM(cexper)//clname(idx+9:LEN_TRIM(clname))
-               idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@')
-            END DO
-
-            idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@')
-            DO WHILE ( idx /= 0 ) 
-               IF ( TRIM(clfreq) /= '' ) THEN
-                  itrlen = LEN_TRIM(clfreq)
-                  IF ( clfreq(itrlen-1:itrlen) == 'mo' ) clfreq = clfreq(1:itrlen-1)
-                  clname = clname(1:idx-1)//TRIM(clfreq)//clname(idx+6:LEN_TRIM(clname))
-               ELSE
-                  CALL ctl_stop('error in the name of file id '//TRIM(cdid),   &
-                     & ' attribute output_freq is undefined -> cannot replace @freq@ in '//TRIM(clname) )
-               ENDIF
-               idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@')
-            END DO
-
-            idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@')
-            DO WHILE ( idx /= 0 ) 
-               cldate = iom_sdate( fjulday - rdttra(1) / rday )
-               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+11:LEN_TRIM(clname))
-               idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@')
-            END DO
-
-            idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@')
-            DO WHILE ( idx /= 0 ) 
-               cldate = iom_sdate( fjulday - rdttra(1) / rday, ldfull = .TRUE. )
-               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+15:LEN_TRIM(clname))
-               idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@')
-            END DO
-
-            idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@')
-            DO WHILE ( idx /= 0 ) 
-               cldate = iom_sdate( fjulday + rdttra(1) / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE. )
-               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+9:LEN_TRIM(clname))
-               idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@')
-            END DO
-
-            idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@')
-            DO WHILE ( idx /= 0 ) 
-               cldate = iom_sdate( fjulday + rdttra(1) / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE., ldfull = .TRUE. )
-               clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+13:LEN_TRIM(clname))
-               idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@')
-            END DO
-
-            IF( jn == 1 )   CALL iom_set_file_attr( cdid, name        = clname )
-            IF( jn == 2 )   CALL iom_set_file_attr( cdid, name_suffix = clname )
-
-         ENDIF
-
-      END DO
-
-   END SUBROUTINE iom_update_file_name
-
-
-   FUNCTION iom_sdate( pjday, ld24, ldfull )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE iom_sdate  ***
-      !!
-      !! ** Purpose :   send back the date corresponding to the given julian day
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in   )           ::   pjday         ! julian day
-      LOGICAL , INTENT(in   ), OPTIONAL ::   ld24          ! true to force 24:00 instead of 00:00
-      LOGICAL , INTENT(in   ), OPTIONAL ::   ldfull        ! true to get the compleate date: yyyymmdd_hh:mm:ss
-      !
-      CHARACTER(LEN=20) ::   iom_sdate
-      CHARACTER(LEN=50) ::   clfmt                         !  format used to write the date 
-      INTEGER           ::   iyear, imonth, iday, ihour, iminute, isec
-      REAL(wp)          ::   zsec
-      LOGICAL           ::   ll24, llfull
-      !
-      IF( PRESENT(ld24) ) THEN   ;   ll24 = ld24
-      ELSE                       ;   ll24 = .FALSE.
-      ENDIF
-
-      IF( PRESENT(ldfull) ) THEN   ;   llfull = ldfull
-      ELSE                         ;   llfull = .FALSE.
-      ENDIF
-
-      CALL ju2ymds( pjday, iyear, imonth, iday, zsec )
-      isec = NINT(zsec)
-
-      IF ( ll24 .AND. isec == 0 ) THEN   ! 00:00 of the next day -> move to 24:00 of the current day
-         CALL ju2ymds( pjday - 1., iyear, imonth, iday, zsec )
-         isec = 86400
-      ENDIF
-
-      IF( iyear < 10000 ) THEN   ;   clfmt = "i4.4,2i2.2"                ! format used to write the date 
-      ELSE                       ;   WRITE(clfmt, "('i',i1,',2i2.2')") INT(LOG10(REAL(iyear,wp))) + 1
-      ENDIF
-      
-      IF( llfull ) THEN 
-         clfmt = TRIM(clfmt)//",'_',i2.2,':',i2.2,':',i2.2"
-         ihour   = isec / 3600
-         isec    = MOD(isec, 3600)
-         iminute = isec / 60
-         isec    = MOD(isec, 60)
-         WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday, ihour, iminute, isec    ! date of the end of run
-      ELSE
-         WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday                          ! date of the end of run
-      ENDIF
-
-   END FUNCTION iom_sdate
-
-#else
-
-
-   SUBROUTINE iom_setkt( kt, cdname )
-      INTEGER         , INTENT(in)::   kt 
-      CHARACTER(LEN=*), INTENT(in) ::   cdname
-      IF( .FALSE. )   WRITE(numout,*) kt, cdname   ! useless test to avoid compilation warnings
-   END SUBROUTINE iom_setkt
-
-   SUBROUTINE iom_context_finalize( cdname )
-      CHARACTER(LEN=*), INTENT(in) ::   cdname
-      IF( .FALSE. )   WRITE(numout,*)  cdname   ! useless test to avoid compilation warnings
-   END SUBROUTINE iom_context_finalize
-
-#endif
-
-   LOGICAL FUNCTION iom_use( cdname )
-      CHARACTER(LEN=*), INTENT(in) ::   cdname
-#if defined key_iomput
-      iom_use = xios_field_is_active( cdname )
-#else
-      iom_use = .FALSE.
-#endif
-   END FUNCTION iom_use
-   
-   !!======================================================================
-END MODULE iom
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/limistate.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/limistate.F90	(revision 2446)
+++ 	(revision )
@@ -1,534 +1,0 @@
-MODULE limistate
-   !!======================================================================
-   !!                     ***  MODULE  limistate  ***
-   !!              Initialisation of diagnostics ice variables
-   !!======================================================================
-   !! History :  2.0  ! 2004-01 (C. Ethe, G. Madec)  Original code
-   !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
-   !!             -   ! 2012    (C. Rousset) add par_oce (for jp_sal)...bug?
-   !!----------------------------------------------------------------------
-#if defined key_lim3
-   !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                    LIM3 sea-ice model
-   !!----------------------------------------------------------------------
-   !!   lim_istate      :  Initialisation of diagnostics ice variables
-   !!   lim_istate_init :  initialization of ice state and namelist read
-   !!----------------------------------------------------------------------
-   USE phycst           ! physical constant
-   USE oce              ! dynamics and tracers variables
-   USE dom_oce          ! ocean domain
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE eosbn2           ! equation of state
-   USE ice              ! sea-ice variables
-   USE par_ice          ! ice parameters
-   USE par_oce          ! ocean parameters
-   USE dom_ice          ! sea-ice domain
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-   USE wrk_nemo         ! work arrays
-   USE cpl_oasis3, ONLY : lk_cpl
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   lim_istate      ! routine called by lim_init.F90
-
-   !! * Module variables
-   !                          !!** init namelist (namiceini) **
-   REAL(wp) ::   thres_sst   ! threshold water temperature for initial sea ice
-   REAL(wp) ::   hts_ini_n   ! initial snow thickness in the north
-   REAL(wp) ::   hts_ini_s   ! initial snow thickness in the south
-   REAL(wp) ::   hti_ini_n   ! initial ice thickness in the north
-   REAL(wp) ::   hti_ini_s   ! initial ice thickness in the south
-   REAL(wp) ::   ati_ini_n   ! initial leads area in the north
-   REAL(wp) ::   ati_ini_s   ! initial leads area in the south
-   REAL(wp) ::   smi_ini_n   ! initial salinity 
-   REAL(wp) ::   smi_ini_s   ! initial salinity
-   REAL(wp) ::   tmi_ini_n   ! initial temperature
-   REAL(wp) ::   tmi_ini_s   ! initial temperature
-
-   LOGICAL  ::  ln_limini    ! initialization or not
-   !!----------------------------------------------------------------------
-   !!   LIM 3.0,  UCL-LOCEAN-IPSL (2008)
-   !! $Id: limistate.F90 4765 2014-09-16 12:55:11Z rblod $
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE lim_istate
-      !!-------------------------------------------------------------------
-      !!                    ***  ROUTINE lim_istate  ***
-      !!
-      !! ** Purpose :   defined the sea-ice initial state
-      !!
-      !! ** Method  :   
-      !!                This routine will put some ice where ocean
-      !!                is at the freezing point, then fill in ice 
-      !!                state variables using prescribed initial 
-      !!                values in the namelist            
-      !!
-      !! ** Steps   :   
-      !!                1) Read namelist
-      !!                2) Basal temperature; ice and hemisphere masks
-      !!                3) Fill in the ice thickness distribution using gaussian
-      !!                4) Fill in space-dependent arrays for state variables
-      !!                5) Diagnostic arrays
-      !!                6) Lateral boundary conditions
-      !!
-      !! ** Notes   : o_i, t_su, t_s, t_i, s_i must be filled everywhere, even
-      !!              where there is no ice (clem: I do not know why but it is mandatory) 
-      !!
-      !! History :
-      !!   2.0  !  01-04  (C. Ethe, G. Madec)  Original code
-      !!   3.0  !  2007   (M. Vancoppenolle)   Rewrite for ice cats
-      !!   4.0  !  09-11  (M. Vancoppenolle)   Enhanced version for ice cats
-      !!--------------------------------------------------------------------
-
-      !! * Local variables
-      INTEGER    :: ji, jj, jk, jl             ! dummy loop indices
-      REAL(wp)   :: epsi20, ztmelts, zdh
-      INTEGER    :: i_hemis, i_fill, jl0  
-      REAL(wp)   :: ztest_1, ztest_2, ztest_3, ztest_4, ztests, zsigma, zarg, zA, zV, zA_cons, zV_cons, zconv
-      REAL(wp), POINTER, DIMENSION(:)     :: zht_i_ini, zat_i_ini, zvt_i_ini, zht_s_ini, zsm_i_ini, ztm_i_ini
-      REAL(wp), POINTER, DIMENSION(:,:)   :: zh_i_ini, za_i_ini, zv_i_ini
-      REAL(wp), POINTER, DIMENSION(:,:)   :: zswitch    ! ice indicator
-      INTEGER,  POINTER, DIMENSION(:,:)   :: zhemis   ! hemispheric index
-      !--------------------------------------------------------------------
-
-      CALL wrk_alloc( jpi, jpj, zswitch )
-      CALL wrk_alloc( jpi, jpj, zhemis )
-      CALL wrk_alloc( jpl,   2, zh_i_ini,  za_i_ini,  zv_i_ini )
-      CALL wrk_alloc(   2,      zht_i_ini, zat_i_ini, zvt_i_ini, zht_s_ini, zsm_i_ini, ztm_i_ini )
-
-      epsi20   = 1.e-20_wp
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'lim_istate : Ice initialization '
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
-
-      !--------------------------------------------------------------------
-      ! 1) Read namelist
-      !--------------------------------------------------------------------
-
-      CALL lim_istate_init     !  reading the initials parameters of the ice
-
-      ! surface temperature
-      DO jl = 1, jpl ! loop over categories
-         t_su  (:,:,jl) = rtt * tms(:,:)
-         tn_ice(:,:,jl) = rtt * tms(:,:)
-      END DO
-      ! Basal temperature is set to the freezing point of seawater in Kelvin
-      t_bo(:,:) = ( tfreez( tsn(:,:,1,jp_sal) ) + rt0 ) * tms(:,:) 
-
-      IF( ln_limini ) THEN
-
-      !--------------------------------------------------------------------
-      ! 2) Basal temperature, ice mask and hemispheric index
-      !--------------------------------------------------------------------
-      ! ice if sst <= t-freez + thres_sst
-      DO jj = 1, jpj                                       
-         DO ji = 1, jpi
-            IF( ( tsn(ji,jj,1,jp_tem)  - ( t_bo(ji,jj) - rt0 ) ) * tms(ji,jj) >= thres_sst ) THEN 
-               zswitch(ji,jj) = 0._wp * tms(ji,jj)    ! no ice
-            ELSE                                                                                   
-               zswitch(ji,jj) = 1._wp * tms(ji,jj)    !    ice
-            ENDIF
-         END DO
-      END DO
-
-
-      ! Hemispheric index
-      ! MV 2011 new initialization
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            IF( fcor(ji,jj) >= 0._wp ) THEN    
-               zhemis(ji,jj) = 1 ! Northern hemisphere
-            ELSE
-               zhemis(ji,jj) = 2 ! Southern hemisphere
-            ENDIF
-         END DO
-      END DO
-      ! END MV 2011 new initialization
-
-      !--------------------------------------------------------------------
-      ! 3) Initialization of sea ice state variables
-      !--------------------------------------------------------------------
-
-      !-----------------------------
-      ! 3.1) Hemisphere-dependent arrays
-      !-----------------------------
-      ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array
-      zht_i_ini(1) = hti_ini_n ; zht_i_ini(2) = hti_ini_s  ! ice thickness
-      zht_s_ini(1) = hts_ini_n ; zht_s_ini(2) = hts_ini_s  ! snow depth
-      zat_i_ini(1) = ati_ini_n ; zat_i_ini(2) = ati_ini_s  ! ice concentration
-      zsm_i_ini(1) = smi_ini_n ; zsm_i_ini(2) = smi_ini_s  ! bulk ice salinity
-      ztm_i_ini(1) = tmi_ini_n ; ztm_i_ini(2) = tmi_ini_s  ! temperature (ice and snow)
-
-      zvt_i_ini(:) = zht_i_ini(:) * zat_i_ini(:)   ! ice volume
-
-      !---------------------------------------------------------------------
-      ! 3.2) Distribute ice concentration and thickness into the categories
-      !---------------------------------------------------------------------
-      ! a gaussian distribution for ice concentration is used
-      ! then we check whether the distribution fullfills
-      ! volume and area conservation, positivity and ice categories bounds
-      DO i_hemis = 1, 2
-
-      ztest_1 = 0 ; ztest_2 = 0 ; ztest_3 = 0 ; ztest_4 = 0
-
-      ! note for the great nemo engineers: 
-      ! only very few of the WRITE statements are necessary for the reference version
-      ! they were one day useful, but now i personally doubt of their
-      ! potential for bringing anything useful
-
-      DO i_fill = jpl, 1, -1
-         IF ( ( ztest_1 + ztest_2 + ztest_3 + ztest_4 ) .NE. 4 ) THEN
-            !----------------------------
-            ! fill the i_fill categories
-            !----------------------------
-            ! *** 1 category to fill
-            IF ( i_fill .EQ. 1 ) THEN
-               zh_i_ini(1,i_hemis)       = zht_i_ini(i_hemis)
-               za_i_ini(1,i_hemis)       = zat_i_ini(i_hemis)
-               zh_i_ini(2:jpl,i_hemis)   = 0._wp
-               za_i_ini(2:jpl,i_hemis)   = 0._wp
-            ELSE
-
-               ! *** >1 categores to fill
-               !--- Ice thicknesses in the i_fill - 1 first categories
-               DO jl = 1, i_fill - 1
-                  zh_i_ini(jl,i_hemis)    = 0.5 * ( hi_max(jl) + hi_max(jl-1) )
-               END DO
-               
-               !--- jl0: most likely index where cc will be maximum
-               DO jl = 1, jpl
-                  IF ( ( zht_i_ini(i_hemis) .GT. hi_max(jl-1) ) .AND. &
-                     ( zht_i_ini(i_hemis) .LE. hi_max(jl)   ) ) THEN
-                     jl0 = jl
-                  ENDIF
-               END DO
-               jl0 = MIN(jl0, i_fill)
-               
-               !--- Concentrations
-               za_i_ini(jl0,i_hemis)      = zat_i_ini(i_hemis) / SQRT(REAL(jpl))
-               DO jl = 1, i_fill - 1
-                  IF ( jl .NE. jl0 ) THEN
-                     zsigma               = 0.5 * zht_i_ini(i_hemis)
-                     zarg                 = ( zh_i_ini(jl,i_hemis) - zht_i_ini(i_hemis) ) / zsigma
-                     za_i_ini(jl,i_hemis) = za_i_ini(jl0,i_hemis) * EXP(-zarg**2)
-                  ENDIF
-               END DO
-               
-               zA = 0. ! sum of the areas in the jpl categories 
-               DO jl = 1, i_fill - 1
-                 zA = zA + za_i_ini(jl,i_hemis)
-               END DO
-               za_i_ini(i_fill,i_hemis)   = zat_i_ini(i_hemis) - zA ! ice conc in the last category
-               IF ( i_fill .LT. jpl ) za_i_ini(i_fill+1:jpl, i_hemis) = 0._wp
-         
-               !--- Ice thickness in the last category
-               zV = 0. ! sum of the volumes of the N-1 categories
-               DO jl = 1, i_fill - 1
-                  zV = zV + za_i_ini(jl,i_hemis)*zh_i_ini(jl,i_hemis)
-               END DO
-               zh_i_ini(i_fill,i_hemis) = ( zvt_i_ini(i_hemis) - zV ) / za_i_ini(i_fill,i_hemis) 
-               IF ( i_fill .LT. jpl ) zh_i_ini(i_fill+1:jpl, i_hemis) = 0._wp
-
-               !--- volumes
-               zv_i_ini(:,i_hemis) = za_i_ini(:,i_hemis) * zh_i_ini(:,i_hemis)
-               IF ( i_fill .LT. jpl ) zv_i_ini(i_fill+1:jpl, i_hemis) = 0._wp
-
-            ENDIF ! i_fill
-
-            !---------------------
-            ! Compatibility tests
-            !---------------------
-            ! Test 1: area conservation
-            zA_cons = SUM(za_i_ini(:,i_hemis)) ; zconv = ABS(zat_i_ini(i_hemis) - zA_cons )
-            IF ( zconv .LT. 1.0e-6 ) THEN
-               ztest_1 = 1
-            ELSE 
-              ! this write is useful
-              IF(lwp)  WRITE(numout,*) ' * TEST1 AREA NOT CONSERVED *** zA_cons = ', zA_cons,' zat_i_ini = ',zat_i_ini(i_hemis) 
-               ztest_1 = 0
-            ENDIF
-
-            ! Test 2: volume conservation
-            zV_cons = SUM(zv_i_ini(:,i_hemis))
-            zconv = ABS(zvt_i_ini(i_hemis) - zV_cons)
-
-            IF ( zconv .LT. 1.0e-6 ) THEN
-               ztest_2 = 1
-            ELSE
-              ! this write is useful
-              IF(lwp)  WRITE(numout,*) ' * TEST2 VOLUME NOT CONSERVED *** zV_cons = ', zV_cons, &
-                            ' zvt_i_ini = ', zvt_i_ini(i_hemis)
-               ztest_2 = 0
-            ENDIF
-
-            ! Test 3: thickness of the last category is in-bounds ?
-            IF ( zh_i_ini(i_fill, i_hemis) .GT. hi_max(i_fill-1) ) THEN
-               ztest_3 = 1
-            ELSE
-               ! this write is useful
-               IF(lwp) WRITE(numout,*) ' * TEST 3 THICKNESS OF THE LAST CATEGORY OUT OF BOUNDS *** zh_i_ini(i_fill,i_hemis) = ', &
-               zh_i_ini(i_fill,i_hemis), ' hi_max(jpl-1) = ', hi_max(i_fill-1)
-               ztest_3 = 0
-            ENDIF
-
-            ! Test 4: positivity of ice concentrations
-            ztest_4 = 1
-            DO jl = 1, jpl
-               IF ( za_i_ini(jl,i_hemis) .LT. 0._wp ) THEN 
-                  ! this write is useful
-                  IF(lwp) WRITE(numout,*) ' * TEST 4 POSITIVITY NOT OK FOR CAT ', jl, ' WITH A = ', za_i_ini(jl,i_hemis)
-                  ztest_4 = 0
-               ENDIF
-            END DO
-
-         ENDIF ! ztest_1 + ztest_2 + ztest_3 + ztest_4
- 
-         ztests = ztest_1 + ztest_2 + ztest_3 + ztest_4
-
-      END DO ! i_fill
-
-      IF(lwp) THEN 
-         WRITE(numout,*), ' ztests : ', ztests
-         IF ( ztests .NE. 4 ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*), ' !!!! ALERT                  !!! '
-            WRITE(numout,*), ' !!!! Something is wrong in the LIM3 initialization procedure '
-            WRITE(numout,*)
-            WRITE(numout,*), ' *** ztests is not equal to 4 '
-            WRITE(numout,*), ' *** ztest_i (i=1,4) = ', ztest_1, ztest_2, ztest_3, ztest_4
-            WRITE(numout,*), ' zat_i_ini : ', zat_i_ini(i_hemis)
-            WRITE(numout,*), ' zht_i_ini : ', zht_i_ini(i_hemis)
-         ENDIF ! ztests .NE. 4
-      ENDIF
-      
-      END DO ! i_hemis
-
-      !---------------------------------------------------------------------
-      ! 3.3) Space-dependent arrays for ice state variables
-      !---------------------------------------------------------------------
-
-      ! Ice concentration, thickness and volume, ice salinity, ice age, surface temperature
-      DO jl = 1, jpl ! loop over categories
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               a_i(ji,jj,jl)   = zswitch(ji,jj) * za_i_ini (jl,zhemis(ji,jj))  ! concentration
-               ht_i(ji,jj,jl)  = zswitch(ji,jj) * zh_i_ini(jl,zhemis(ji,jj))  ! ice thickness
-               ht_s(ji,jj,jl)  = ht_i(ji,jj,jl) * ( zht_s_ini( zhemis(ji,jj) ) / zht_i_ini( zhemis(ji,jj) ) )  ! snow depth
-               sm_i(ji,jj,jl)  = zswitch(ji,jj) * zsm_i_ini(zhemis(ji,jj)) !+ ( 1._wp - zswitch(ji,jj) ) * s_i_min ! salinity
-               o_i(ji,jj,jl)   = zswitch(ji,jj) * 1._wp + ( 1._wp - zswitch(ji,jj) ) ! age
-               t_su(ji,jj,jl)  = zswitch(ji,jj) * ztm_i_ini(zhemis(ji,jj)) + ( 1._wp - zswitch(ji,jj) ) * rtt ! surf temp
-
-               ! This case below should not be used if (ht_s/ht_i) is ok in namelist
-               ! In case snow load is in excess that would lead to transformation from snow to ice
-               ! Then, transfer the snow excess into the ice (different from limthd_dh)
-               zdh = MAX( 0._wp, ( rhosn * ht_s(ji,jj,jl) + ( rhoic - rau0 ) * ht_i(ji,jj,jl) ) * r1_rau0 ) 
-               ! recompute ht_i, ht_s avoiding out of bounds values
-               ht_i(ji,jj,jl) = MIN( hi_max(jl), ht_i(ji,jj,jl) + zdh )
-               ht_s(ji,jj,jl) = MAX( 0._wp, ht_s(ji,jj,jl) - zdh * rhoic / rhosn )
-
-               ! ice volume, salt content, age content
-               v_i(ji,jj,jl)   = ht_i(ji,jj,jl) * a_i(ji,jj,jl)              ! ice volume
-               v_s(ji,jj,jl)   = ht_s(ji,jj,jl) * a_i(ji,jj,jl)              ! snow volume
-               smv_i(ji,jj,jl) = MIN( sm_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl) ! salt content
-               oa_i(ji,jj,jl)  = o_i(ji,jj,jl) * a_i(ji,jj,jl)               ! age content
-            END DO ! ji
-         END DO ! jj
-      END DO ! jl
-
-      ! Snow temperature and heat content
-      DO jk = 1, nlay_s
-         DO jl = 1, jpl ! loop over categories
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                   t_s(ji,jj,jk,jl) = zswitch(ji,jj) * ztm_i_ini(zhemis(ji,jj)) + ( 1._wp - zswitch(ji,jj) ) * rtt
-                   ! Snow energy of melting
-                   e_s(ji,jj,jk,jl) = zswitch(ji,jj) * rhosn * ( cpic * ( rtt - t_s(ji,jj,jk,jl) ) + lfus )
-                   ! Change dimensions
-                   e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) / unit_fac
-                   ! Multiply by volume, so that heat content in Joules
-                   e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * area(ji,jj) * v_s(ji,jj,jl) / nlay_s
-               END DO ! ji
-            END DO ! jj
-         END DO ! jl
-      END DO ! jk
-
-      ! Ice salinity, temperature and heat content
-      DO jk = 1, nlay_i
-         DO jl = 1, jpl ! loop over categories
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                   t_i(ji,jj,jk,jl) = zswitch(ji,jj) * ztm_i_ini(zhemis(ji,jj)) + ( 1._wp - zswitch(ji,jj) ) * rtt 
-                   s_i(ji,jj,jk,jl) = zswitch(ji,jj) * zsm_i_ini(zhemis(ji,jj)) !+ ( 1._wp - zswitch(ji,jj) ) * s_i_min
-                   ztmelts          = - tmut * s_i(ji,jj,jk,jl) + rtt !Melting temperature in K
-
-                   ! heat content per unit volume
-                   e_i(ji,jj,jk,jl) = zswitch(ji,jj) * rhoic * (   cpic    * ( ztmelts - t_i(ji,jj,jk,jl) ) &
-                      +   lfus    * ( 1._wp - (ztmelts-rtt) / MIN((t_i(ji,jj,jk,jl)-rtt),-epsi20) ) &
-                      -   rcp     * ( ztmelts - rtt ) )
-
-                   ! Correct dimensions to avoid big values
-                   e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / unit_fac 
-
-                   ! Mutliply by ice volume, and divide by number of layers to get heat content in J
-                   e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * area(ji,jj) * v_i(ji,jj,jl) / nlay_i
-               END DO ! ji
-            END DO ! jj
-         END DO ! jl
-      END DO ! jk
-
-      tn_ice (:,:,:) = t_su (:,:,:)
-
-      ELSE 
-         ! if ln_limini=false
-         a_i  (:,:,:) = 0._wp
-         v_i  (:,:,:) = 0._wp
-         v_s  (:,:,:) = 0._wp
-         smv_i(:,:,:) = 0._wp
-         oa_i (:,:,:) = 0._wp
-         ht_i (:,:,:) = 0._wp
-         ht_s (:,:,:) = 0._wp
-         sm_i (:,:,:) = 0._wp
-         o_i  (:,:,:) = 0._wp
-
-         e_i(:,:,:,:) = 0._wp
-         e_s(:,:,:,:) = 0._wp
-
-         DO jl = 1, jpl
-            DO jk = 1, nlay_i
-               t_i(:,:,jk,jl) = rtt * tms(:,:)
-            END DO
-            DO jk = 1, nlay_s
-               t_s(:,:,jk,jl) = rtt * tms(:,:)
-            END DO
-         END DO
-      
-      ENDIF ! ln_limini
-      
-      at_i (:,:) = 0.0_wp
-      DO jl = 1, jpl
-         at_i (:,:) = at_i (:,:) + a_i (:,:,jl)
-      END DO
-      !
-      !--------------------------------------------------------------------
-      ! 4) Global ice variables for output diagnostics                    | 
-      !--------------------------------------------------------------------
-      u_ice (:,:)     = 0._wp
-      v_ice (:,:)     = 0._wp
-      stress1_i(:,:)  = 0._wp
-      stress2_i(:,:)  = 0._wp
-      stress12_i(:,:) = 0._wp
-
-      !--------------------------------------------------------------------
-      ! 5) Moments for advection
-      !--------------------------------------------------------------------
-
-      sxopw (:,:) = 0._wp 
-      syopw (:,:) = 0._wp 
-      sxxopw(:,:) = 0._wp 
-      syyopw(:,:) = 0._wp 
-      sxyopw(:,:) = 0._wp
-
-      sxice (:,:,:)  = 0._wp   ;   sxsn (:,:,:)  = 0._wp   ;   sxa  (:,:,:)  = 0._wp
-      syice (:,:,:)  = 0._wp   ;   sysn (:,:,:)  = 0._wp   ;   sya  (:,:,:)  = 0._wp
-      sxxice(:,:,:)  = 0._wp   ;   sxxsn(:,:,:)  = 0._wp   ;   sxxa (:,:,:)  = 0._wp
-      syyice(:,:,:)  = 0._wp   ;   syysn(:,:,:)  = 0._wp   ;   syya (:,:,:)  = 0._wp
-      sxyice(:,:,:)  = 0._wp   ;   sxysn(:,:,:)  = 0._wp   ;   sxya (:,:,:)  = 0._wp
-
-      sxc0  (:,:,:)  = 0._wp   ;   sxe  (:,:,:,:)= 0._wp   
-      syc0  (:,:,:)  = 0._wp   ;   sye  (:,:,:,:)= 0._wp   
-      sxxc0 (:,:,:)  = 0._wp   ;   sxxe (:,:,:,:)= 0._wp   
-      syyc0 (:,:,:)  = 0._wp   ;   syye (:,:,:,:)= 0._wp   
-      sxyc0 (:,:,:)  = 0._wp   ;   sxye (:,:,:,:)= 0._wp   
-
-      sxsal  (:,:,:)  = 0._wp
-      sysal  (:,:,:)  = 0._wp
-      sxxsal (:,:,:)  = 0._wp
-      syysal (:,:,:)  = 0._wp
-      sxysal (:,:,:)  = 0._wp
-
-      sxage  (:,:,:)  = 0._wp
-      syage  (:,:,:)  = 0._wp
-      sxxage (:,:,:)  = 0._wp
-      syyage (:,:,:)  = 0._wp
-      sxyage (:,:,:)  = 0._wp
-
-
-      CALL wrk_dealloc( jpi, jpj, zswitch )
-      CALL wrk_dealloc( jpi, jpj, zhemis )
-      CALL wrk_dealloc( jpl,   2, zh_i_ini,  za_i_ini,  zv_i_ini )
-      CALL wrk_dealloc(   2,      zht_i_ini, zat_i_ini, zvt_i_ini, zht_s_ini, zsm_i_ini, ztm_i_ini )
-
-   END SUBROUTINE lim_istate
-
-   SUBROUTINE lim_istate_init
-      !!-------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_istate_init  ***
-      !!        
-      !! ** Purpose : Definition of initial state of the ice 
-      !!
-      !! ** Method : Read the namiceini namelist and check the parameter 
-      !!       values called at the first timestep (nit000)
-      !!
-      !! ** input : 
-      !!        Namelist namiceini
-      !!
-      !! history :
-      !!  8.5  ! 03-08 (C. Ethe) original code 
-      !!  8.5  ! 07-11 (M. Vancoppenolle) rewritten initialization
-      !!-----------------------------------------------------------------------------
-      NAMELIST/namiceini/ ln_limini, thres_sst, hts_ini_n, hts_ini_s, hti_ini_n, hti_ini_s,  &
-         &                                      ati_ini_n, ati_ini_s, smi_ini_n, smi_ini_s, tmi_ini_n, tmi_ini_s
-      INTEGER :: ios                 ! Local integer output status for namelist read
-      !!-----------------------------------------------------------------------------
-      !
-      REWIND( numnam_ice_ref )              ! Namelist namiceini in reference namelist : Ice initial state
-      READ  ( numnam_ice_ref, namiceini, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceini in reference namelist', lwp )
-
-      REWIND( numnam_ice_cfg )              ! Namelist namiceini in configuration namelist : Ice initial state
-      READ  ( numnam_ice_cfg, namiceini, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceini in configuration namelist', lwp )
-      IF(lwm) WRITE ( numoni, namiceini )
-
-      ! Define the initial parameters
-      ! -------------------------
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'lim_istate_init : ice parameters inititialisation '
-         WRITE(numout,*) '~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '   initialization with ice (T) or not (F)       ln_limini   = ', ln_limini
-         WRITE(numout,*) '   threshold water temp. for initial sea-ice    thres_sst  = ', thres_sst
-         WRITE(numout,*) '   initial snow thickness in the north          hts_ini_n  = ', hts_ini_n
-         WRITE(numout,*) '   initial snow thickness in the south          hts_ini_s  = ', hts_ini_s 
-         WRITE(numout,*) '   initial ice thickness  in the north          hti_ini_n  = ', hti_ini_n
-         WRITE(numout,*) '   initial ice thickness  in the south          hti_ini_s  = ', hti_ini_s
-         WRITE(numout,*) '   initial ice concentr.  in the north          ati_ini_n  = ', ati_ini_n
-         WRITE(numout,*) '   initial ice concentr.  in the north          ati_ini_s  = ', ati_ini_s
-         WRITE(numout,*) '   initial  ice salinity  in the north          smi_ini_n  = ', smi_ini_n
-         WRITE(numout,*) '   initial  ice salinity  in the south          smi_ini_s  = ', smi_ini_s
-         WRITE(numout,*) '   initial  ice/snw temp  in the north          tmi_ini_n  = ', tmi_ini_n
-         WRITE(numout,*) '   initial  ice/snw temp  in the south          tmi_ini_s  = ', tmi_ini_s
-      ENDIF
-
-   END SUBROUTINE lim_istate_init
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :         Empty module          NO LIM sea-ice model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE lim_istate          ! Empty routine
-   END SUBROUTINE lim_istate
-#endif
-
-   !!======================================================================
-END MODULE limistate
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/p4zopt.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/p4zopt.F90	(revision 2446)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/p4zopt.F90	(revision 2451)
@@ -49,5 +49,6 @@
    REAL(wp), DIMENSION(3,jp_rgb), PUBLIC ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption
 
-     
+
+   
    !!* Substitution
 #  include "top_substitute.h90"
@@ -101,6 +102,5 @@
                zchl = ( trn(ji,jj,jk,jpnch) + trn(ji,jj,jk,jpdch) + rtrn ) * 1.e6
                zchl = MIN(  10. , MAX( 0.05, zchl )  )
-               irgb = MAX ( 1, MIN ( jp_rgb, NINT( 41 + 20.* LOG10( zchl ) + rtrn )))
-               !                                                         
+               irgb = MAX ( 1, MIN ( jp_rgb, NINT( 41 + 20.* LOG10( zchl ) + rtrn )))               !                                                         
                zekb(ji,jj,jk) = xkrgb(1,irgb) * fse3t(ji,jj,jk)
                zekg(ji,jj,jk) = xkrgb(2,irgb) * fse3t(ji,jj,jk)
@@ -207,5 +207,5 @@
               IF( etot(ji,jj,jk) * tmask(ji,jj,jk) >= 0.0043 * qsr(ji,jj) )  THEN
                  neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer
-                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint
+                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mxl_trc_zint
                  heup(ji,jj) = fsdepw(ji,jj,jk+1)      ! Euphotic layer depth
               ENDIF
@@ -254,16 +254,14 @@
       END DO
 
-      IF( ln_diatrc ) THEN        ! save output diagnostics
-        !
-        IF( lk_iomput ) THEN
-           IF( jnt == nrdttrc ) THEN
-              CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
-              CALL iom_put( "PAR" , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
-           ENDIF
-        ELSE
-           trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
-           trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
+      IF( lk_iomput ) THEN
+        IF( jnt == nrdttrc  ) THEN
+           IF( iom_use( "Heup" ) ) CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
+           IF( iom_use( "PAR"  ) ) CALL iom_put( "PAR" , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
         ENDIF
-        !
+      ELSE
+         IF( ln_diatrc ) THEN        ! save output diagnostics
+            trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
+            trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
+         ENDIF
       ENDIF
       !
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbccpl.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbccpl.F90	(revision 2446)
+++ 	(revision )
@@ -1,1621 +1,0 @@
-MODULE sbccpl
-   !!======================================================================
-   !!                       ***  MODULE  sbccpl  ***
-   !! Surface Boundary Condition :  momentum, heat and freshwater fluxes in coupled mode
-   !!======================================================================
-   !! History :  2.0  ! 2007-06  (R. Redler, N. Keenlyside, W. Park) Original code split into flxmod & taumod
-   !!            3.0  ! 2008-02  (G. Madec, C Talandier)  surface module
-   !!            3.1  ! 2009_02  (G. Madec, S. Masson, E. Maisonave, A. Caubel) generic coupled interface
-   !!            3.4  ! 2011_11  (C. Harris) more flexibility + multi-category fields
-   !!----------------------------------------------------------------------
-#if defined key_oasis3 || defined key_oasis4
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3' or 'key_oasis4'   Coupled Ocean/Atmosphere formulation
-   !!----------------------------------------------------------------------
-   !!   namsbc_cpl      : coupled formulation namlist
-   !!   sbc_cpl_init    : initialisation of the coupled exchanges
-   !!   sbc_cpl_rcv     : receive fields from the atmosphere over the ocean (ocean only)
-   !!                     receive stress from the atmosphere over the ocean (ocean-ice case)
-   !!   sbc_cpl_ice_tau : receive stress from the atmosphere over ice
-   !!   sbc_cpl_ice_flx : receive fluxes from the atmosphere over ice
-   !!   sbc_cpl_snd     : send     fields to the atmosphere
-   !!----------------------------------------------------------------------
-   USE dom_oce         ! ocean space and time domain
-   USE sbc_oce         ! Surface boundary condition: ocean fields
-   USE sbc_ice         ! Surface boundary condition: ice fields
-   USE sbcdcy          ! surface boundary condition: diurnal cycle
-   USE phycst          ! physical constants
-#if defined key_lim3
-   USE par_ice         ! ice parameters
-   USE ice             ! ice variables
-#endif
-#if defined key_lim2
-   USE par_ice_2       ! ice parameters
-   USE ice_2           ! ice variables
-#endif
-#if defined key_oasis3
-   USE cpl_oasis3      ! OASIS3 coupling
-#endif
-#if defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling
-#endif
-   USE geo2ocean       ! 
-   USE oce   , ONLY : tsn, un, vn
-   USE albedo          !
-   USE in_out_manager  ! I/O manager
-   USE iom             ! NetCDF library
-   USE lib_mpp         ! distribued memory computing library
-   USE wrk_nemo        ! work arrays
-   USE timing          ! Timing
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-#if defined key_cpl_carbon_cycle
-   USE p4zflx, ONLY : oce_co2
-#endif
-   USE diaar5, ONLY :   lk_diaar5
-#if defined key_cice
-   USE ice_domain_size, only: ncat
-#endif
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   sbc_cpl_rcv        ! routine called by sbc_ice_lim(_2).F90
-   PUBLIC   sbc_cpl_snd        ! routine called by step.F90
-   PUBLIC   sbc_cpl_ice_tau    ! routine called by sbc_ice_lim(_2).F90
-   PUBLIC   sbc_cpl_ice_flx    ! routine called by sbc_ice_lim(_2).F90
-#if defined key_oasis_mct
-   PUBLIC   sbc_cpl_init 
-#endif
-
-   INTEGER, PARAMETER ::   jpr_otx1   =  1            ! 3 atmosphere-ocean stress components on grid 1
-   INTEGER, PARAMETER ::   jpr_oty1   =  2            ! 
-   INTEGER, PARAMETER ::   jpr_otz1   =  3            ! 
-   INTEGER, PARAMETER ::   jpr_otx2   =  4            ! 3 atmosphere-ocean stress components on grid 2
-   INTEGER, PARAMETER ::   jpr_oty2   =  5            ! 
-   INTEGER, PARAMETER ::   jpr_otz2   =  6            ! 
-   INTEGER, PARAMETER ::   jpr_itx1   =  7            ! 3 atmosphere-ice   stress components on grid 1
-   INTEGER, PARAMETER ::   jpr_ity1   =  8            ! 
-   INTEGER, PARAMETER ::   jpr_itz1   =  9            ! 
-   INTEGER, PARAMETER ::   jpr_itx2   = 10            ! 3 atmosphere-ice   stress components on grid 2
-   INTEGER, PARAMETER ::   jpr_ity2   = 11            ! 
-   INTEGER, PARAMETER ::   jpr_itz2   = 12            ! 
-   INTEGER, PARAMETER ::   jpr_qsroce = 13            ! Qsr above the ocean
-   INTEGER, PARAMETER ::   jpr_qsrice = 14            ! Qsr above the ice
-   INTEGER, PARAMETER ::   jpr_qsrmix = 15 
-   INTEGER, PARAMETER ::   jpr_qnsoce = 16            ! Qns above the ocean
-   INTEGER, PARAMETER ::   jpr_qnsice = 17            ! Qns above the ice
-   INTEGER, PARAMETER ::   jpr_qnsmix = 18
-   INTEGER, PARAMETER ::   jpr_rain   = 19            ! total liquid precipitation (rain)
-   INTEGER, PARAMETER ::   jpr_snow   = 20            ! solid precipitation over the ocean (snow)
-   INTEGER, PARAMETER ::   jpr_tevp   = 21            ! total evaporation
-   INTEGER, PARAMETER ::   jpr_ievp   = 22            ! solid evaporation (sublimation)
-   INTEGER, PARAMETER ::   jpr_sbpr   = 23            ! sublimation - liquid precipitation - solid precipitation
-   INTEGER, PARAMETER ::   jpr_semp   = 24            ! solid freshwater budget (sublimation - snow)
-   INTEGER, PARAMETER ::   jpr_oemp   = 25            ! ocean freshwater budget (evap - precip)
-   INTEGER, PARAMETER ::   jpr_w10m   = 26            ! 10m wind
-   INTEGER, PARAMETER ::   jpr_dqnsdt = 27            ! d(Q non solar)/d(temperature)
-   INTEGER, PARAMETER ::   jpr_rnf    = 28            ! runoffs
-   INTEGER, PARAMETER ::   jpr_cal    = 29            ! calving
-   INTEGER, PARAMETER ::   jpr_taum   = 30            ! wind stress module
-   INTEGER, PARAMETER ::   jpr_co2    = 31
-   INTEGER, PARAMETER ::   jpr_topm   = 32            ! topmeltn
-   INTEGER, PARAMETER ::   jpr_botm   = 33            ! botmeltn
-   INTEGER, PARAMETER ::   jprcv      = 33            ! total number of fields received
-
-   INTEGER, PARAMETER ::   jps_fice   =  1            ! ice fraction 
-   INTEGER, PARAMETER ::   jps_toce   =  2            ! ocean temperature
-   INTEGER, PARAMETER ::   jps_tice   =  3            ! ice   temperature
-   INTEGER, PARAMETER ::   jps_tmix   =  4            ! mixed temperature (ocean+ice)
-   INTEGER, PARAMETER ::   jps_albice =  5            ! ice   albedo
-   INTEGER, PARAMETER ::   jps_albmix =  6            ! mixed albedo
-   INTEGER, PARAMETER ::   jps_hice   =  7            ! ice  thickness
-   INTEGER, PARAMETER ::   jps_hsnw   =  8            ! snow thickness
-   INTEGER, PARAMETER ::   jps_ocx1   =  9            ! ocean current on grid 1
-   INTEGER, PARAMETER ::   jps_ocy1   = 10            !
-   INTEGER, PARAMETER ::   jps_ocz1   = 11            !
-   INTEGER, PARAMETER ::   jps_ivx1   = 12            ! ice   current on grid 1
-   INTEGER, PARAMETER ::   jps_ivy1   = 13            !
-   INTEGER, PARAMETER ::   jps_ivz1   = 14            !
-   INTEGER, PARAMETER ::   jps_co2    = 15
-   INTEGER, PARAMETER ::   jpsnd      = 15            ! total number of fields sended
-
-   !                                                         !!** namelist namsbc_cpl **
-   TYPE ::   FLD_C
-      CHARACTER(len = 32) ::   cldes                  ! desciption of the coupling strategy
-      CHARACTER(len = 32) ::   clcat                  ! multiple ice categories strategy
-      CHARACTER(len = 32) ::   clvref                 ! reference of vector ('spherical' or 'cartesian')
-      CHARACTER(len = 32) ::   clvor                  ! orientation of vector fields ('eastward-northward' or 'local grid')
-      CHARACTER(len = 32) ::   clvgrd                 ! grids on which is located the vector fields
-   END TYPE FLD_C
-   ! Send to the atmosphere                           !
-   TYPE(FLD_C) ::   sn_snd_temp, sn_snd_alb, sn_snd_thick, sn_snd_crt, sn_snd_co2                        
-   ! Received from the atmosphere                     !
-   TYPE(FLD_C) ::   sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau, sn_rcv_dqnsdt, sn_rcv_qsr, sn_rcv_qns, sn_rcv_emp, sn_rcv_rnf
-   TYPE(FLD_C) ::   sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2                        
-
-   TYPE ::   DYNARR     
-      REAL(wp), POINTER, DIMENSION(:,:,:)    ::   z3   
-   END TYPE DYNARR
-
-   TYPE( DYNARR ), SAVE, DIMENSION(jprcv) ::   frcv                      ! all fields recieved from the atmosphere
-
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   albedo_oce_mix     ! ocean albedo sent to atmosphere (mix clear/overcast sky)
-
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(    :) ::   nrcvinfo           ! OASIS info argument
-
-#if ! defined key_lim2   &&   ! defined key_lim3
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   u_ice, v_ice,fr1_i0,fr2_i0          ! jpi, jpj
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tn_ice, alb_ice, qns_ice, dqns_ice  ! (jpi,jpj,jpl)
-#endif
-
-#if defined key_cice
-   INTEGER, PARAMETER ::   jpl = ncat
-#elif ! defined key_lim2   &&   ! defined key_lim3
-   INTEGER, PARAMETER ::   jpl = 1 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_ice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qsr_ice
-#endif
-
-#if ! defined key_lim3   &&  ! defined key_cice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  a_i
-#endif
-
-#if ! defined key_lim3
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  ht_i, ht_s
-#endif
-
-#if ! defined key_cice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  topmelt, botmelt
-#endif
-
-   !! Substitution
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: sbccpl.F90 4162 2013-11-07 10:19:49Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-  
-   INTEGER FUNCTION sbc_cpl_alloc()
-      !!----------------------------------------------------------------------
-      !!             ***  FUNCTION sbc_cpl_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER :: ierr(4),jn
-      !!----------------------------------------------------------------------
-      ierr(:) = 0
-      !
-      ALLOCATE( albedo_oce_mix(jpi,jpj), nrcvinfo(jprcv),  STAT=ierr(1) )
-      !
-#if ! defined key_lim2 && ! defined key_lim3
-      ! quick patch to be able to run the coupled model without sea-ice...
-      ALLOCATE( u_ice(jpi,jpj) , fr1_i0(jpi,jpj) , tn_ice (jpi,jpj,1) ,     &
-                v_ice(jpi,jpj) , fr2_i0(jpi,jpj) , alb_ice(jpi,jpj,1),      &
-                emp_ice(jpi,jpj) , qns_ice(jpi,jpj,1) , dqns_ice(jpi,jpj,1) , STAT=ierr(2) )
-#endif
-
-#if ! defined key_lim3 && ! defined key_cice
-      ALLOCATE( a_i(jpi,jpj,jpl) , STAT=ierr(3) )
-#endif
-
-#if defined key_cice || defined key_lim2
-      ALLOCATE( ht_i(jpi,jpj,jpl) , ht_s(jpi,jpj,jpl) , STAT=ierr(4) )
-#endif
-      sbc_cpl_alloc = MAXVAL( ierr )
-      IF( lk_mpp            )   CALL mpp_sum ( sbc_cpl_alloc )
-      IF( sbc_cpl_alloc > 0 )   CALL ctl_warn('sbc_cpl_alloc: allocation of arrays failed')
-      !
-   END FUNCTION sbc_cpl_alloc
-
-
-   SUBROUTINE sbc_cpl_init( k_ice )     
-      !!----------------------------------------------------------------------
-      !!             ***  ROUTINE sbc_cpl_init  ***
-      !!
-      !! ** Purpose :   Initialisation of send and recieved information from
-      !!                the atmospheric component
-      !!
-      !! ** Method  : * Read namsbc_cpl namelist 
-      !!              * define the receive interface
-      !!              * define the send    interface
-      !!              * initialise the OASIS coupler
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   k_ice    ! ice management in the sbc (=0/1/2/3)
-      !!
-      INTEGER ::   jn   ! dummy loop index
-      INTEGER ::   ios  ! Local integer output status for namelist read
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zacs, zaos
-      !!
-      NAMELIST/namsbc_cpl/  sn_snd_temp, sn_snd_alb   , sn_snd_thick, sn_snd_crt   , sn_snd_co2,   &
-         &                  sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau  , sn_rcv_dqnsdt, sn_rcv_qsr,   &
-         &                  sn_rcv_qns , sn_rcv_emp   , sn_rcv_rnf  , sn_rcv_cal   , sn_rcv_iceflx  , sn_rcv_co2
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_init')
-      !
-      CALL wrk_alloc( jpi,jpj, zacs, zaos )
-
-      ! ================================ !
-      !      Namelist informations       !
-      ! ================================ !
-
-      REWIND( numnam_ref )              ! Namelist namsbc_cpl in reference namelist : Variables for OASIS coupling
-      READ  ( numnam_ref, namsbc_cpl, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cpl in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namsbc_cpl in configuration namelist : Variables for OASIS coupling
-      READ  ( numnam_cfg, namsbc_cpl, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_cpl in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namsbc_cpl )
-
-      IF(lwp) THEN                        ! control print
-         WRITE(numout,*)
-         WRITE(numout,*)'sbc_cpl_init : namsbc_cpl namelist '
-         WRITE(numout,*)'~~~~~~~~~~~~'
-         WRITE(numout,*)'  received fields (mutiple ice categogies)'
-         WRITE(numout,*)'      10m wind module                 = ', TRIM(sn_rcv_w10m%cldes  ), ' (', TRIM(sn_rcv_w10m%clcat  ), ')'
-         WRITE(numout,*)'      stress module                   = ', TRIM(sn_rcv_taumod%cldes), ' (', TRIM(sn_rcv_taumod%clcat), ')'
-         WRITE(numout,*)'      surface stress                  = ', TRIM(sn_rcv_tau%cldes   ), ' (', TRIM(sn_rcv_tau%clcat   ), ')'
-         WRITE(numout,*)'                     - referential    = ', sn_rcv_tau%clvref
-         WRITE(numout,*)'                     - orientation    = ', sn_rcv_tau%clvor
-         WRITE(numout,*)'                     - mesh           = ', sn_rcv_tau%clvgrd
-         WRITE(numout,*)'      non-solar heat flux sensitivity = ', TRIM(sn_rcv_dqnsdt%cldes), ' (', TRIM(sn_rcv_dqnsdt%clcat), ')'
-         WRITE(numout,*)'      solar heat flux                 = ', TRIM(sn_rcv_qsr%cldes   ), ' (', TRIM(sn_rcv_qsr%clcat   ), ')'
-         WRITE(numout,*)'      non-solar heat flux             = ', TRIM(sn_rcv_qns%cldes   ), ' (', TRIM(sn_rcv_qns%clcat   ), ')'
-         WRITE(numout,*)'      freshwater budget               = ', TRIM(sn_rcv_emp%cldes   ), ' (', TRIM(sn_rcv_emp%clcat   ), ')'
-         WRITE(numout,*)'      runoffs                         = ', TRIM(sn_rcv_rnf%cldes   ), ' (', TRIM(sn_rcv_rnf%clcat   ), ')'
-         WRITE(numout,*)'      calving                         = ', TRIM(sn_rcv_cal%cldes   ), ' (', TRIM(sn_rcv_cal%clcat   ), ')'
-         WRITE(numout,*)'      sea ice heat fluxes             = ', TRIM(sn_rcv_iceflx%cldes), ' (', TRIM(sn_rcv_iceflx%clcat), ')'
-         WRITE(numout,*)'      atm co2                         = ', TRIM(sn_rcv_co2%cldes   ), ' (', TRIM(sn_rcv_co2%clcat   ), ')'
-         WRITE(numout,*)'  sent fields (multiple ice categories)'
-         WRITE(numout,*)'      surface temperature             = ', TRIM(sn_snd_temp%cldes  ), ' (', TRIM(sn_snd_temp%clcat  ), ')'
-         WRITE(numout,*)'      albedo                          = ', TRIM(sn_snd_alb%cldes   ), ' (', TRIM(sn_snd_alb%clcat   ), ')'
-         WRITE(numout,*)'      ice/snow thickness              = ', TRIM(sn_snd_thick%cldes ), ' (', TRIM(sn_snd_thick%clcat ), ')'
-         WRITE(numout,*)'      surface current                 = ', TRIM(sn_snd_crt%cldes   ), ' (', TRIM(sn_snd_crt%clcat   ), ')'
-         WRITE(numout,*)'                      - referential   = ', sn_snd_crt%clvref 
-         WRITE(numout,*)'                      - orientation   = ', sn_snd_crt%clvor
-         WRITE(numout,*)'                      - mesh          = ', sn_snd_crt%clvgrd
-         WRITE(numout,*)'      oce co2 flux                    = ', TRIM(sn_snd_co2%cldes   ), ' (', TRIM(sn_snd_co2%clcat   ), ')'
-      ENDIF
-
-      !                                   ! allocate sbccpl arrays
-      IF( sbc_cpl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )
-     
-      ! ================================ !
-      !   Define the receive interface   !
-      ! ================================ !
-      nrcvinfo(:) = OASIS_idle   ! needed by nrcvinfo(jpr_otx1) if we do not receive ocean stress 
-
-      ! for each field: define the OASIS name                              (srcv(:)%clname)
-      !                 define receive or not from the namelist parameters (srcv(:)%laction)
-      !                 define the north fold type of lbc                  (srcv(:)%nsgn)
-
-      ! default definitions of srcv
-      srcv(:)%laction = .FALSE.   ;   srcv(:)%clgrid = 'T'   ;   srcv(:)%nsgn = 1.   ;   srcv(:)%nct = 1
-
-      !                                                      ! ------------------------- !
-      !                                                      ! ice and ocean wind stress !   
-      !                                                      ! ------------------------- !
-      !                                                           ! Name 
-      srcv(jpr_otx1)%clname = 'O_OTaux1'      ! 1st ocean component on grid ONE (T or U)
-      srcv(jpr_oty1)%clname = 'O_OTauy1'      ! 2nd   -      -         -     - 
-      srcv(jpr_otz1)%clname = 'O_OTauz1'      ! 3rd   -      -         -     - 
-      srcv(jpr_otx2)%clname = 'O_OTaux2'      ! 1st ocean component on grid TWO (V)
-      srcv(jpr_oty2)%clname = 'O_OTauy2'      ! 2nd   -      -         -     - 
-      srcv(jpr_otz2)%clname = 'O_OTauz2'      ! 3rd   -      -         -     - 
-      !
-      srcv(jpr_itx1)%clname = 'O_ITaux1'      ! 1st  ice  component on grid ONE (T, F, I or U)
-      srcv(jpr_ity1)%clname = 'O_ITauy1'      ! 2nd   -      -         -     - 
-      srcv(jpr_itz1)%clname = 'O_ITauz1'      ! 3rd   -      -         -     - 
-      srcv(jpr_itx2)%clname = 'O_ITaux2'      ! 1st  ice  component on grid TWO (V)
-      srcv(jpr_ity2)%clname = 'O_ITauy2'      ! 2nd   -      -         -     - 
-      srcv(jpr_itz2)%clname = 'O_ITauz2'      ! 3rd   -      -         -     - 
-      ! 
-      ! Vectors: change of sign at north fold ONLY if on the local grid
-      IF( TRIM( sn_rcv_tau%clvor ) == 'local grid' )   srcv(jpr_otx1:jpr_itz2)%nsgn = -1.
-      
-      !                                                           ! Set grid and action
-      SELECT CASE( TRIM( sn_rcv_tau%clvgrd ) )      !  'T', 'U,V', 'U,V,I', 'U,V,F', 'T,I', 'T,F', or 'T,U,V'
-      CASE( 'T' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'U,V' ) 
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'U'        ! ice components given at U-point
-         srcv(jpr_itx2:jpr_itz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_otx1:jpr_itz2)%laction = .TRUE.     ! receive oce and ice components on both grid 1 & 2
-      CASE( 'U,V,T' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'T'        ! ice components given at T-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'U,V,I' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'I'        ! ice components given at I-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'U,V,F' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'U'        ! oce components given at U-point
-         srcv(jpr_otx2:jpr_otz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'F'        ! ice components given at F-point
-         srcv(jpr_otx1:jpr_otz2)%laction = .TRUE.     ! receive oce components on grid 1 & 2
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 only
-      CASE( 'T,I' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'I'        ! ice components given at I-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'T,F' ) 
-         srcv(jpr_otx1:jpr_itz2)%clgrid  = 'T'        ! oce and ice components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'F'        ! ice components given at F-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 
-         srcv(jpr_itx1:jpr_itz1)%laction = .TRUE.     ! receive ice components on grid 1 
-      CASE( 'T,U,V' )
-         srcv(jpr_otx1:jpr_otz1)%clgrid  = 'T'        ! oce components given at T-point
-         srcv(jpr_itx1:jpr_itz1)%clgrid  = 'U'        ! ice components given at U-point
-         srcv(jpr_itx2:jpr_itz2)%clgrid  = 'V'        !           and           V-point
-         srcv(jpr_otx1:jpr_otz1)%laction = .TRUE.     ! receive oce components on grid 1 only
-         srcv(jpr_itx1:jpr_itz2)%laction = .TRUE.     ! receive ice components on grid 1 & 2
-      CASE default   
-         CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_tau%clvgrd' )
-      END SELECT
-      !
-      IF( TRIM( sn_rcv_tau%clvref ) == 'spherical' )   &           ! spherical: 3rd component not received
-         &     srcv( (/jpr_otz1, jpr_otz2, jpr_itz1, jpr_itz2/) )%laction = .FALSE. 
-      !
-      IF( TRIM( sn_rcv_tau%clvor  ) == 'local grid' ) THEN        ! already on local grid -> no need of the second grid
-            srcv(jpr_otx2:jpr_otz2)%laction = .FALSE. 
-            srcv(jpr_itx2:jpr_itz2)%laction = .FALSE. 
-            srcv(jpr_oty1)%clgrid = srcv(jpr_oty2)%clgrid   ! not needed but cleaner...
-            srcv(jpr_ity1)%clgrid = srcv(jpr_ity2)%clgrid   ! not needed but cleaner...
-      ENDIF
-      !
-      IF( TRIM( sn_rcv_tau%cldes ) /= 'oce and ice' ) THEN        ! 'oce and ice' case ocean stress on ocean mesh used
-         srcv(jpr_itx1:jpr_itz2)%laction = .FALSE.    ! ice components not received
-         srcv(jpr_itx1)%clgrid = 'U'                  ! ocean stress used after its transformation
-         srcv(jpr_ity1)%clgrid = 'V'                  ! i.e. it is always at U- & V-points for i- & j-comp. resp.
-      ENDIF
-       
-      !                                                      ! ------------------------- !
-      !                                                      !    freshwater budget      !   E-P
-      !                                                      ! ------------------------- !
-      ! we suppose that atmosphere modele do not make the difference between precipiration (liquide or solid)
-      ! over ice of free ocean within the same atmospheric cell.cd 
-      srcv(jpr_rain)%clname = 'OTotRain'      ! Rain = liquid precipitation
-      srcv(jpr_snow)%clname = 'OTotSnow'      ! Snow = solid precipitation
-      srcv(jpr_tevp)%clname = 'OTotEvap'      ! total evaporation (over oce + ice sublimation)
-      srcv(jpr_ievp)%clname = 'OIceEvap'      ! evaporation over ice = sublimation
-      srcv(jpr_sbpr)%clname = 'OSubMPre'      ! sublimation - liquid precipitation - solid precipitation 
-      srcv(jpr_semp)%clname = 'OISubMSn'      ! ice solid water budget = sublimation - solid precipitation
-      srcv(jpr_oemp)%clname = 'OOEvaMPr'      ! ocean water budget = ocean Evap - ocean precip
-      SELECT CASE( TRIM( sn_rcv_emp%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(                                 jpr_oemp   )%laction = .TRUE. 
-      CASE( 'conservative'  )
-         srcv( (/jpr_rain, jpr_snow, jpr_ievp, jpr_tevp/) )%laction = .TRUE.
-!$$ O.M.         IF ( k_ice <= 1 )  srcv(jpr_ivep)%laction = .FALSE.
-         IF ( k_ice <= 1 )  srcv(jpr_ievp)%laction = .FALSE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_ievp, jpr_sbpr, jpr_semp, jpr_oemp/) )%laction = .TRUE.
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_emp%cldes' )
-      END SELECT
-
-      !                                                      ! ------------------------- !
-      !                                                      !     Runoffs & Calving     !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_rnf   )%clname = 'O_Runoff'   ;   IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' )   srcv(jpr_rnf)%laction = .TRUE.
-! This isn't right - really just want ln_rnf_emp changed
-!                                                 IF( TRIM( sn_rcv_rnf%cldes ) == 'climato' )   THEN   ;   ln_rnf = .TRUE.
-!                                                 ELSE                                                 ;   ln_rnf = .FALSE.
-!                                                 ENDIF
-      srcv(jpr_cal   )%clname = 'OCalving'   ;   IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' )   srcv(jpr_cal)%laction = .TRUE.
-
-      !                                                      ! ------------------------- !
-      !                                                      !    non solar radiation    !   Qns
-      !                                                      ! ------------------------- !
-      srcv(jpr_qnsoce)%clname = 'O_QnsOce'
-      srcv(jpr_qnsice)%clname = 'O_QnsIce'
-      srcv(jpr_qnsmix)%clname = 'O_QnsMix'
-      SELECT CASE( TRIM( sn_rcv_qns%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(               jpr_qnsoce   )%laction = .TRUE.
-      CASE( 'conservative'  )   ;   srcv( (/jpr_qnsice, jpr_qnsmix/) )%laction = .TRUE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_qnsice, jpr_qnsoce/) )%laction = .TRUE.
-      CASE( 'mixed oce-ice' )   ;   srcv(               jpr_qnsmix   )%laction = .TRUE. 
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_qns%cldes' )
-      END SELECT
-      IF( TRIM( sn_rcv_qns%cldes ) == 'mixed oce-ice' .AND. jpl > 1 ) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qns%cldes not currently allowed to be mixed oce-ice for multi-category ice' )
-      !                                                      ! ------------------------- !
-      !                                                      !    solar radiation        !   Qsr
-      !                                                      ! ------------------------- !
-      srcv(jpr_qsroce)%clname = 'O_QsrOce'
-      srcv(jpr_qsrice)%clname = 'O_QsrIce'
-      srcv(jpr_qsrmix)%clname = 'O_QsrMix'
-      SELECT CASE( TRIM( sn_rcv_qsr%cldes ) )
-      CASE( 'oce only'      )   ;   srcv(               jpr_qsroce   )%laction = .TRUE.
-      CASE( 'conservative'  )   ;   srcv( (/jpr_qsrice, jpr_qsrmix/) )%laction = .TRUE.
-      CASE( 'oce and ice'   )   ;   srcv( (/jpr_qsrice, jpr_qsroce/) )%laction = .TRUE.
-      CASE( 'mixed oce-ice' )   ;   srcv(               jpr_qsrmix   )%laction = .TRUE. 
-      CASE default              ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_qsr%cldes' )
-      END SELECT
-      IF( TRIM( sn_rcv_qsr%cldes ) == 'mixed oce-ice' .AND. jpl > 1 ) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_qsr%cldes not currently allowed to be mixed oce-ice for multi-category ice' )
-      !                                                      ! ------------------------- !
-      !                                                      !   non solar sensitivity   !   d(Qns)/d(T)
-      !                                                      ! ------------------------- !
-      srcv(jpr_dqnsdt)%clname = 'O_dQnsdT'   
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'coupled' )   srcv(jpr_dqnsdt)%laction = .TRUE.
-      !
-      ! non solar sensitivity mandatory for LIM ice model
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'none' .AND. k_ice /= 0 .AND. k_ice /= 4) &
-         CALL ctl_stop( 'sbc_cpl_init: sn_rcv_dqnsdt%cldes must be coupled in namsbc_cpl namelist' )
-      ! non solar sensitivity mandatory for mixed oce-ice solar radiation coupling technique
-      IF( TRIM( sn_rcv_dqnsdt%cldes ) == 'none' .AND. TRIM( sn_rcv_qns%cldes ) == 'mixed oce-ice' ) &
-         CALL ctl_stop( 'sbc_cpl_init: namsbc_cpl namelist mismatch between sn_rcv_qns%cldes and sn_rcv_dqnsdt%cldes' )
-      !                                                      ! ------------------------- !
-      !                                                      !      10m wind module      !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_w10m)%clname = 'O_Wind10'   ;   IF( TRIM(sn_rcv_w10m%cldes  ) == 'coupled' )   srcv(jpr_w10m)%laction = .TRUE. 
-      !
-      !                                                      ! ------------------------- !
-      !                                                      !   wind stress module      !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_taum)%clname = 'O_TauMod'   ;   IF( TRIM(sn_rcv_taumod%cldes) == 'coupled' )   srcv(jpr_taum)%laction = .TRUE.
-      lhftau = srcv(jpr_taum)%laction
-
-      !                                                      ! ------------------------- !
-      !                                                      !      Atmospheric CO2      !
-      !                                                      ! ------------------------- !
-      srcv(jpr_co2 )%clname = 'O_AtmCO2'   ;   IF( TRIM(sn_rcv_co2%cldes   ) == 'coupled' )    srcv(jpr_co2 )%laction = .TRUE.
-      !                                                      ! ------------------------- !
-      !                                                      !   topmelt and botmelt     !   
-      !                                                      ! ------------------------- !
-      srcv(jpr_topm )%clname = 'OTopMlt'
-      srcv(jpr_botm )%clname = 'OBotMlt'
-      IF( TRIM(sn_rcv_iceflx%cldes) == 'coupled' ) THEN
-         IF ( TRIM( sn_rcv_iceflx%clcat ) == 'yes' ) THEN
-            srcv(jpr_topm:jpr_botm)%nct = jpl
-         ELSE
-            CALL ctl_stop( 'sbc_cpl_init: sn_rcv_iceflx%clcat should always be set to yes currently' )
-         ENDIF
-         srcv(jpr_topm:jpr_botm)%laction = .TRUE.
-      ENDIF
-
-      ! Allocate all parts of frcv used for received fields
-      DO jn = 1, jprcv
-         IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )
-      END DO
-      ! Allocate taum part of frcv which is used even when not received as coupling field
-      IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jn)%nct) )
-      ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE.
-      IF( k_ice /= 0 ) THEN
-         IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jn)%nct) )
-         IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jn)%nct) )
-      END IF
-
-      ! ================================ !
-      !     Define the send interface    !
-      ! ================================ !
-      ! for each field: define the OASIS name                           (ssnd(:)%clname)
-      !                 define send or not from the namelist parameters (ssnd(:)%laction)
-      !                 define the north fold type of lbc               (ssnd(:)%nsgn)
-      
-      ! default definitions of nsnd
-      ssnd(:)%laction = .FALSE.   ;   ssnd(:)%clgrid = 'T'   ;   ssnd(:)%nsgn = 1.  ; ssnd(:)%nct = 1
-         
-      !                                                      ! ------------------------- !
-      !                                                      !    Surface temperature    !
-      !                                                      ! ------------------------- !
-      ssnd(jps_toce)%clname = 'O_SSTSST'
-      ssnd(jps_tice)%clname = 'O_TepIce'
-      ssnd(jps_tmix)%clname = 'O_TepMix'
-      SELECT CASE( TRIM( sn_snd_temp%cldes ) )
-      CASE( 'none'         )       ! nothing to do
-      CASE( 'oce only'             )   ;   ssnd(   jps_toce             )%laction = .TRUE.
-      CASE( 'weighted oce and ice' )
-         ssnd( (/jps_toce, jps_tice/) )%laction = .TRUE.
-         IF ( TRIM( sn_snd_temp%clcat ) == 'yes' )  ssnd(jps_tice)%nct = jpl
-      CASE( 'mixed oce-ice'        )   ;   ssnd(   jps_tmix             )%laction = .TRUE.
-      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_temp%cldes' )
-      END SELECT
-     
-      !                                                      ! ------------------------- !
-      !                                                      !          Albedo           !
-      !                                                      ! ------------------------- !
-      ssnd(jps_albice)%clname = 'O_AlbIce' 
-      ssnd(jps_albmix)%clname = 'O_AlbMix'
-      SELECT CASE( TRIM( sn_snd_alb%cldes ) )
-      CASE( 'none'          )       ! nothing to do
-      CASE( 'weighted ice'  )   ;   ssnd(jps_albice)%laction = .TRUE.
-      CASE( 'mixed oce-ice' )   ;   ssnd(jps_albmix)%laction = .TRUE.
-      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_alb%cldes' )
-      END SELECT
-      !
-      ! Need to calculate oceanic albedo if
-      !     1. sending mixed oce-ice albedo or
-      !     2. receiving mixed oce-ice solar radiation 
-      IF ( TRIM ( sn_snd_alb%cldes ) == 'mixed oce-ice' .OR. TRIM ( sn_rcv_qsr%cldes ) == 'mixed oce-ice' ) THEN
-         CALL albedo_oce( zaos, zacs )
-         ! Due to lack of information on nebulosity : mean clear/overcast sky
-         albedo_oce_mix(:,:) = ( zacs(:,:) + zaos(:,:) ) * 0.5
-      ENDIF
-
-      !                                                      ! ------------------------- !
-      !                                                      !  Ice fraction & Thickness ! 
-      !                                                      ! ------------------------- !
-      ssnd(jps_fice)%clname = 'OIceFrc'
-      ssnd(jps_hice)%clname = 'OIceTck'
-      ssnd(jps_hsnw)%clname = 'OSnwTck'
-      IF( k_ice /= 0 ) THEN
-         ssnd(jps_fice)%laction = .TRUE.                  ! if ice treated in the ocean (even in climato case)
-! Currently no namelist entry to determine sending of multi-category ice fraction so use the thickness entry for now
-         IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_fice)%nct = jpl
-      ENDIF
-
-      SELECT CASE ( TRIM( sn_snd_thick%cldes ) )
-      CASE( 'none'         )       ! nothing to do
-      CASE( 'ice and snow' ) 
-         ssnd(jps_hice:jps_hsnw)%laction = .TRUE.
-         IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) THEN
-            ssnd(jps_hice:jps_hsnw)%nct = jpl
-         ELSE
-            IF ( jpl > 1 ) THEN
-CALL ctl_stop( 'sbc_cpl_init: use weighted ice and snow option for sn_snd_thick%cldes if not exchanging category fields' )
-            ENDIF
-         ENDIF
-      CASE ( 'weighted ice and snow' ) 
-         ssnd(jps_hice:jps_hsnw)%laction = .TRUE.
-         IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_hice:jps_hsnw)%nct = jpl
-      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_thick%cldes' )
-      END SELECT
-
-      !                                                      ! ------------------------- !
-      !                                                      !      Surface current      !
-      !                                                      ! ------------------------- !
-      !        ocean currents              !            ice velocities
-      ssnd(jps_ocx1)%clname = 'O_OCurx1'   ;   ssnd(jps_ivx1)%clname = 'O_IVelx1'
-      ssnd(jps_ocy1)%clname = 'O_OCury1'   ;   ssnd(jps_ivy1)%clname = 'O_IVely1'
-      ssnd(jps_ocz1)%clname = 'O_OCurz1'   ;   ssnd(jps_ivz1)%clname = 'O_IVelz1'
-      !
-      ssnd(jps_ocx1:jps_ivz1)%nsgn = -1.   ! vectors: change of the sign at the north fold
-
-      IF( sn_snd_crt%clvgrd == 'U,V' ) THEN
-         ssnd(jps_ocx1)%clgrid = 'U' ; ssnd(jps_ocy1)%clgrid = 'V'
-      ELSE IF( sn_snd_crt%clvgrd /= 'T' ) THEN  
-         CALL ctl_stop( 'sn_snd_crt%clvgrd must be equal to T' )
-         ssnd(jps_ocx1:jps_ivz1)%clgrid  = 'T'      ! all oce and ice components on the same unique grid
-      ENDIF
-      ssnd(jps_ocx1:jps_ivz1)%laction = .TRUE.   ! default: all are send
-      IF( TRIM( sn_snd_crt%clvref ) == 'spherical' )   ssnd( (/jps_ocz1, jps_ivz1/) )%laction = .FALSE. 
-      IF( TRIM( sn_snd_crt%clvor ) == 'eastward-northward' ) ssnd(jps_ocx1:jps_ivz1)%nsgn = 1.
-      SELECT CASE( TRIM( sn_snd_crt%cldes ) )
-      CASE( 'none'                 )   ;   ssnd(jps_ocx1:jps_ivz1)%laction = .FALSE.
-      CASE( 'oce only'             )   ;   ssnd(jps_ivx1:jps_ivz1)%laction = .FALSE.
-      CASE( 'weighted oce and ice' )   !   nothing to do
-      CASE( 'mixed oce-ice'        )   ;   ssnd(jps_ivx1:jps_ivz1)%laction = .FALSE.
-      CASE default   ;   CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_crt%cldes' )
-      END SELECT
-
-      !                                                      ! ------------------------- !
-      !                                                      !          CO2 flux         !
-      !                                                      ! ------------------------- !
-      ssnd(jps_co2)%clname = 'O_CO2FLX' ;  IF( TRIM(sn_snd_co2%cldes) == 'coupled' )    ssnd(jps_co2 )%laction = .TRUE.
-      !
-      ! ================================ !
-      !   initialisation of the coupler  !
-      ! ================================ !
-
-      CALL cpl_prism_define(jprcv, jpsnd)            
-      !
-      IF( ln_dm2dc .AND. ( cpl_prism_freq( jpr_qsroce ) + cpl_prism_freq( jpr_qsrmix ) /= 86400 ) )   &
-         &   CALL ctl_stop( 'sbc_cpl_init: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' )
-
-      CALL wrk_dealloc( jpi,jpj, zacs, zaos )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_init')
-      !
-   END SUBROUTINE sbc_cpl_init
-
-
-   SUBROUTINE sbc_cpl_rcv( kt, k_fsbc, k_ice )     
-      !!----------------------------------------------------------------------
-      !!             ***  ROUTINE sbc_cpl_rcv  ***
-      !!
-      !! ** Purpose :   provide the stress over the ocean and, if no sea-ice,
-      !!                provide the ocean heat and freshwater fluxes.
-      !!
-      !! ** Method  : - Receive all the atmospheric fields (stored in frcv array). called at each time step.
-      !!                OASIS controls if there is something do receive or not. nrcvinfo contains the info
-      !!                to know if the field was really received or not
-      !!
-      !!              --> If ocean stress was really received:
-      !!
-      !!                  - transform the received ocean stress vector from the received
-      !!                 referential and grid into an atmosphere-ocean stress in 
-      !!                 the (i,j) ocean referencial and at the ocean velocity point. 
-      !!                    The received stress are :
-      !!                     - defined by 3 components (if cartesian coordinate)
-      !!                            or by 2 components (if spherical)
-      !!                     - oriented along geographical   coordinate (if eastward-northward)
-      !!                            or  along the local grid coordinate (if local grid)
-      !!                     - given at U- and V-point, resp.   if received on 2 grids
-      !!                            or at T-point               if received on 1 grid
-      !!                    Therefore and if necessary, they are successively 
-      !!                  processed in order to obtain them 
-      !!                     first  as  2 components on the sphere 
-      !!                     second as  2 components oriented along the local grid
-      !!                     third  as  2 components on the U,V grid 
-      !!
-      !!              --> 
-      !!
-      !!              - In 'ocean only' case, non solar and solar ocean heat fluxes 
-      !!             and total ocean freshwater fluxes  
-      !!
-      !! ** Method  :   receive all fields from the atmosphere and transform 
-      !!              them into ocean surface boundary condition fields 
-      !!
-      !! ** Action  :   update  utau, vtau   ocean stress at U,V grid 
-      !!                        taum, wndm   wind stres and wind speed module at T-point
-      !!                        qns          non solar heat fluxes including emp heat content    (ocean only case)
-      !!                                     and the latent heat flux of solid precip. melting
-      !!                        qsr          solar ocean heat fluxes   (ocean only case)
-      !!                        emp          upward mass flux [evap. - precip. (- runoffs) (- calving)] (ocean only case)
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt       ! ocean model time step index
-      INTEGER, INTENT(in) ::   k_fsbc   ! frequency of sbc (-> ice model) computation 
-      INTEGER, INTENT(in) ::   k_ice    ! ice management in the sbc (=0/1/2/3)
-      !!
-      LOGICAL ::    llnewtx, llnewtau      ! update wind stress components and module??
-      INTEGER  ::   ji, jj, jn             ! dummy loop indices
-      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdttra did not change since nit000)
-      REAL(wp) ::   zcumulneg, zcumulpos   ! temporary scalars     
-      REAL(wp) ::   zcoef                  ! temporary scalar
-      REAL(wp) ::   zrhoa  = 1.22          ! Air density kg/m3
-      REAL(wp) ::   zcdrag = 1.5e-3        ! drag coefficient
-      REAL(wp) ::   zzx, zzy               ! temporary variables
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztx, zty 
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_rcv')
-      !
-      CALL wrk_alloc( jpi,jpj, ztx, zty )
-
-#if ! defined key_oasis_mct
-       IF( kt == nit000 )   CALL sbc_cpl_init( k_ice )          ! initialisation
-#endif
-      !                                                 ! Receive all the atmos. fields (including ice information)
-      isec = ( kt - nit000 ) * NINT( rdttra(1) )             ! date of exchanges
-      DO jn = 1, jprcv                                       ! received fields sent by the atmosphere
-         IF( srcv(jn)%laction )   CALL cpl_prism_rcv( jn, isec, frcv(jn)%z3, nrcvinfo(jn) )
-      END DO
-
-      !                                                      ! ========================= !
-      IF( srcv(jpr_otx1)%laction ) THEN                      !  ocean stress components  !
-         !                                                   ! ========================= !
-         ! define frcv(jpr_otx1)%z3(:,:,1) and frcv(jpr_oty1)%z3(:,:,1): stress at U/V point along model grid
-         ! => need to be done only when we receive the field
-         IF(  nrcvinfo(jpr_otx1) == OASIS_Rcv ) THEN
-            !
-            IF( TRIM( sn_rcv_tau%clvref ) == 'cartesian' ) THEN            ! 2 components on the sphere
-               !                                                       ! (cartesian to spherical -> 3 to 2 components)
-               !
-               CALL geo2oce( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), frcv(jpr_otz1)%z3(:,:,1),   &
-                  &          srcv(jpr_otx1)%clgrid, ztx, zty )
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
-               frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
-               !
-               IF( srcv(jpr_otx2)%laction ) THEN
-                  CALL geo2oce( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), frcv(jpr_otz2)%z3(:,:,1),   &
-                     &          srcv(jpr_otx2)%clgrid, ztx, zty )
-                  frcv(jpr_otx2)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
-                  frcv(jpr_oty2)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
-               ENDIF
-               !
-            ENDIF
-            !
-            IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN   ! 2 components oriented along the local grid
-               !                                                       ! (geographical to local grid -> rotate the components)
-               CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx )   
-               IF( srcv(jpr_otx2)%laction ) THEN
-                  CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty )   
-               ELSE	
-                  CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty )  
-               ENDIF
-               frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
-               frcv(jpr_oty1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 2nd grid
-            ENDIF
-            !                              
-            IF( srcv(jpr_otx1)%clgrid == 'T' ) THEN
-               DO jj = 2, jpjm1                                          ! T ==> (U,V)
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     frcv(jpr_otx1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_otx1)%z3(ji+1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1) )
-                     frcv(jpr_oty1)%z3(ji,jj,1) = 0.5 * ( frcv(jpr_oty1)%z3(ji  ,jj+1,1) + frcv(jpr_oty1)%z3(ji,jj,1) )
-                  END DO
-               END DO
-               CALL lbc_lnk( frcv(jpr_otx1)%z3(:,:,1), 'U',  -1. )   ;   CALL lbc_lnk( frcv(jpr_oty1)%z3(:,:,1), 'V',  -1. )
-            ENDIF
-            llnewtx = .TRUE.
-         ELSE
-            llnewtx = .FALSE.
-         ENDIF
-         !                                                   ! ========================= !
-      ELSE                                                   !   No dynamical coupling   !
-         !                                                   ! ========================= !
-         frcv(jpr_otx1)%z3(:,:,1) = 0.e0                               ! here simply set to zero 
-         frcv(jpr_oty1)%z3(:,:,1) = 0.e0                               ! an external read in a file can be added instead
-         llnewtx = .TRUE.
-         !
-      ENDIF
-      
-      !                                                      ! ========================= !
-      !                                                      !    wind stress module     !   (taum)
-      !                                                      ! ========================= !
-      !
-      IF( .NOT. srcv(jpr_taum)%laction ) THEN                    ! compute wind stress module from its components if not received 
-         ! => need to be done only when otx1 was changed
-         IF( llnewtx ) THEN
-!CDIR NOVERRCHK
-            DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-               DO ji = fs_2, fs_jpim1   ! vect. opt.
-                  zzx = frcv(jpr_otx1)%z3(ji-1,jj  ,1) + frcv(jpr_otx1)%z3(ji,jj,1)
-                  zzy = frcv(jpr_oty1)%z3(ji  ,jj-1,1) + frcv(jpr_oty1)%z3(ji,jj,1)
-                  frcv(jpr_taum)%z3(ji,jj,1) = 0.5 * SQRT( zzx * zzx + zzy * zzy )
-               END DO
-            END DO
-            CALL lbc_lnk( frcv(jpr_taum)%z3(:,:,1), 'T', 1. )
-            llnewtau = .TRUE.
-         ELSE
-            llnewtau = .FALSE.
-         ENDIF
-      ELSE
-         llnewtau = nrcvinfo(jpr_taum) == OASIS_Rcv
-         ! Stress module can be negative when received (interpolation problem)
-         IF( llnewtau ) THEN 
-            frcv(jpr_taum)%z3(:,:,1) = MAX( 0._wp, frcv(jpr_taum)%z3(:,:,1) )
-         ENDIF
-      ENDIF
-      
-      !                                                      ! ========================= !
-      !                                                      !      10 m wind speed      !   (wndm)
-      !                                                      ! ========================= !
-      !
-      IF( .NOT. srcv(jpr_w10m)%laction ) THEN                    ! compute wind spreed from wind stress module if not received  
-         ! => need to be done only when taumod was changed
-         IF( llnewtau ) THEN 
-            zcoef = 1. / ( zrhoa * zcdrag ) 
-!CDIR NOVERRCHK
-            DO jj = 1, jpj
-!CDIR NOVERRCHK
-               DO ji = 1, jpi 
-                  wndm(ji,jj) = SQRT( frcv(jpr_taum)%z3(ji,jj,1) * zcoef )
-               END DO
-            END DO
-         ENDIF
-      ELSE
-         IF ( nrcvinfo(jpr_w10m) == OASIS_Rcv ) wndm(:,:) = frcv(jpr_w10m)%z3(:,:,1)
-      ENDIF
-
-      ! u(v)tau and taum will be modified by ice model
-      ! -> need to be reset before each call of the ice/fsbc      
-      IF( MOD( kt-1, k_fsbc ) == 0 ) THEN
-         !
-         utau(:,:) = frcv(jpr_otx1)%z3(:,:,1)
-         vtau(:,:) = frcv(jpr_oty1)%z3(:,:,1)
-         taum(:,:) = frcv(jpr_taum)%z3(:,:,1)
-         CALL iom_put( "taum_oce", taum )   ! output wind stress module
-         !  
-      ENDIF
-
-#if defined key_cpl_carbon_cycle
-      !                                                              ! atmosph. CO2 (ppm)
-      IF( srcv(jpr_co2)%laction )   atm_co2(:,:) = frcv(jpr_co2)%z3(:,:,1)
-#endif
-
-      !                                                      ! ========================= !
-      IF( k_ice <= 1 ) THEN                                  !  heat & freshwater fluxes ! (Ocean only case)
-         !                                                   ! ========================= !
-         !
-         !                                                       ! total freshwater fluxes over the ocean (emp)
-         SELECT CASE( TRIM( sn_rcv_emp%cldes ) )                                    ! evaporation - precipitation
-         CASE( 'conservative' )
-            emp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - ( frcv(jpr_rain)%z3(:,:,1) + frcv(jpr_snow)%z3(:,:,1) )
-         CASE( 'oce only', 'oce and ice' )
-            emp(:,:) = frcv(jpr_oemp)%z3(:,:,1)
-         CASE default
-            CALL ctl_stop( 'sbc_cpl_rcv: wrong definition of sn_rcv_emp%cldes' )
-         END SELECT
-         !
-         !                                                        ! runoffs and calving (added in emp)
-         IF( srcv(jpr_rnf)%laction )   emp(:,:) = emp(:,:) - frcv(jpr_rnf)%z3(:,:,1)
-         IF( srcv(jpr_cal)%laction )   emp(:,:) = emp(:,:) - frcv(jpr_cal)%z3(:,:,1)
-         !
-!!gm :  this seems to be internal cooking, not sure to need that in a generic interface 
-!!gm                                       at least should be optional...
-!!         IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN     ! add to the total freshwater budget
-!!            ! remove negative runoff
-!!            zcumulpos = SUM( MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
-!!            zcumulneg = SUM( MIN( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
-!!            IF( lk_mpp )   CALL mpp_sum( zcumulpos )   ! sum over the global domain
-!!            IF( lk_mpp )   CALL mpp_sum( zcumulneg ) 
-!!            IF( zcumulpos /= 0. ) THEN                 ! distribute negative runoff on positive runoff grid points
-!!               zcumulneg = 1.e0 + zcumulneg / zcumulpos
-!!               frcv(jpr_rnf)%z3(:,:,1) = MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * zcumulneg
-!!            ENDIF     
-!!            ! add runoff to e-p 
-!!            emp(:,:) = emp(:,:) - frcv(jpr_rnf)%z3(:,:,1)
-!!         ENDIF
-!!gm  end of internal cooking
-         !
-         !                                                       ! non solar heat flux over the ocean (qns)
-         IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
-         IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
-         ! add the latent heat of solid precip. melting
-         IF( srcv(jpr_snow  )%laction )   THEN                         ! update qns over the free ocean with:
-              qns(:,:) = qns(:,:) - frcv(jpr_snow)%z3(:,:,1) * lfus  & ! energy for melting solid precipitation over the free ocean
-           &           - emp(:,:) * sst_m(:,:) * rcp                   ! remove heat content due to mass flux (assumed to be at SST)
-         ENDIF
-
-         !                                                       ! solar flux over the ocean          (qsr)
-         IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(jpr_qsroce)%z3(:,:,1)
-         IF( srcv(jpr_qsrmix)%laction )   qsr(:,:) = frcv(jpr_qsrmix)%z3(:,:,1)
-         IF( ln_dm2dc )   qsr(:,:) = sbc_dcy( qsr )                           ! modify qsr to include the diurnal cycle
-         !
-  
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi,jpj, ztx, zty )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_rcv')
-      !
-   END SUBROUTINE sbc_cpl_rcv
-   
-
-   SUBROUTINE sbc_cpl_ice_tau( p_taui, p_tauj )     
-      !!----------------------------------------------------------------------
-      !!             ***  ROUTINE sbc_cpl_ice_tau  ***
-      !!
-      !! ** Purpose :   provide the stress over sea-ice in coupled mode 
-      !!
-      !! ** Method  :   transform the received stress from the atmosphere into
-      !!             an atmosphere-ice stress in the (i,j) ocean referencial
-      !!             and at the velocity point of the sea-ice model (cp_ice_msh):
-      !!                'C'-grid : i- (j-) components given at U- (V-) point 
-      !!                'I'-grid : B-grid lower-left corner: both components given at I-point 
-      !!
-      !!                The received stress are :
-      !!                 - defined by 3 components (if cartesian coordinate)
-      !!                        or by 2 components (if spherical)
-      !!                 - oriented along geographical   coordinate (if eastward-northward)
-      !!                        or  along the local grid coordinate (if local grid)
-      !!                 - given at U- and V-point, resp.   if received on 2 grids
-      !!                        or at a same point (T or I) if received on 1 grid
-      !!                Therefore and if necessary, they are successively 
-      !!             processed in order to obtain them 
-      !!                 first  as  2 components on the sphere 
-      !!                 second as  2 components oriented along the local grid
-      !!                 third  as  2 components on the cp_ice_msh point 
-      !!
-      !!                Except in 'oce and ice' case, only one vector stress field 
-      !!             is received. It has already been processed in sbc_cpl_rcv
-      !!             so that it is now defined as (i,j) components given at U-
-      !!             and V-points, respectively. Therefore, only the third
-      !!             transformation is done and only if the ice-grid is a 'I'-grid. 
-      !!
-      !! ** Action  :   return ptau_i, ptau_j, the stress over the ice at cp_ice_msh point
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_taui   ! i- & j-components of atmos-ice stress [N/m2]
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_tauj   ! at I-point (B-grid) or U & V-point (C-grid)
-      !!
-      INTEGER ::   ji, jj                          ! dummy loop indices
-      INTEGER ::   itx                             ! index of taux over ice
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztx, zty 
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_ice_tau')
-      !
-      CALL wrk_alloc( jpi,jpj, ztx, zty )
-
-!AC Pour eviter un stress nul sur la glace dans le cas mixed oce-ice
-      IF( srcv(jpr_itx1)%laction .AND. TRIM( sn_rcv_tau%cldes ) == 'oce and ice') THEN   ;   itx =  jpr_itx1   
-      ELSE                                ;   itx =  jpr_otx1
-      ENDIF
-
-      ! do something only if we just received the stress from atmosphere
-      IF(  nrcvinfo(itx) == OASIS_Rcv ) THEN
-
-         !                                                                                              ! ======================= !
-!AC Pour eviter un stress nul sur la glace dans le cas mixes oce-ice
-         IF( srcv(jpr_itx1)%laction .AND. TRIM( sn_rcv_tau%cldes ) == 'oce and ice') THEN               !   ice stress received   !
-            !                                                                                           ! ======================= !
-            !  
-            IF( TRIM( sn_rcv_tau%clvref ) == 'cartesian' ) THEN            ! 2 components on the sphere
-               !                                                       ! (cartesian to spherical -> 3 to 2 components)
-               CALL geo2oce(  frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), frcv(jpr_itz1)%z3(:,:,1),   &
-                  &          srcv(jpr_itx1)%clgrid, ztx, zty )
-               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 1st grid
-               frcv(jpr_ity1)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 1st grid
-               !
-               IF( srcv(jpr_itx2)%laction ) THEN
-                  CALL geo2oce( frcv(jpr_itx2)%z3(:,:,1), frcv(jpr_ity2)%z3(:,:,1), frcv(jpr_itz2)%z3(:,:,1),   &
-                     &          srcv(jpr_itx2)%clgrid, ztx, zty )
-                  frcv(jpr_itx2)%z3(:,:,1) = ztx(:,:)   ! overwrite 1st comp. on the 2nd grid
-                  frcv(jpr_ity2)%z3(:,:,1) = zty(:,:)   ! overwrite 2nd comp. on the 2nd grid
-               ENDIF
-               !
-            ENDIF
-            !
-            IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN   ! 2 components oriented along the local grid
-               !                                                       ! (geographical to local grid -> rotate the components)
-               CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->i', ztx )   
-               IF( srcv(jpr_itx2)%laction ) THEN
-                  CALL rot_rep( frcv(jpr_itx2)%z3(:,:,1), frcv(jpr_ity2)%z3(:,:,1), srcv(jpr_itx2)%clgrid, 'en->j', zty )   
-               ELSE
-                  CALL rot_rep( frcv(jpr_itx1)%z3(:,:,1), frcv(jpr_ity1)%z3(:,:,1), srcv(jpr_itx1)%clgrid, 'en->j', zty )  
-               ENDIF
-               frcv(jpr_itx1)%z3(:,:,1) = ztx(:,:)      ! overwrite 1st component on the 1st grid
-               frcv(jpr_ity1)%z3(:,:,1) = zty(:,:)      ! overwrite 2nd component on the 1st grid
-            ENDIF
-            !                                                   ! ======================= !
-         ELSE                                                   !     use ocean stress    !
-            !                                                   ! ======================= !
-            frcv(jpr_itx1)%z3(:,:,1) = frcv(jpr_otx1)%z3(:,:,1)
-            frcv(jpr_ity1)%z3(:,:,1) = frcv(jpr_oty1)%z3(:,:,1)
-            !
-         ENDIF
-
-         !                                                      ! ======================= !
-         !                                                      !     put on ice grid     !
-         !                                                      ! ======================= !
-         !    
-         !                                                  j+1   j     -----V---F
-         ! ice stress on ice velocity point (cp_ice_msh)                 !       |
-         ! (C-grid ==>(U,V) or B-grid ==> I or F)                 j      |   T   U
-         !                                                               |       |
-         !                                                   j    j-1   -I-------|
-         !                                               (for I)         |       |
-         !                                                              i-1  i   i
-         !                                                               i      i+1 (for I)
-         SELECT CASE ( cp_ice_msh )
-            !
-         CASE( 'I' )                                         ! B-grid ==> I
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
-            CASE( 'U' )
-               DO jj = 2, jpjm1                                   ! (U,V) ==> I
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji-1,jj  ,1) + frcv(jpr_itx1)%z3(ji-1,jj-1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji  ,jj-1,1) + frcv(jpr_ity1)%z3(ji-1,jj-1,1) )
-                  END DO
-               END DO
-            CASE( 'F' )
-               DO jj = 2, jpjm1                                   ! F ==> I
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = frcv(jpr_itx1)%z3(ji-1,jj-1,1)
-                     p_tauj(ji,jj) = frcv(jpr_ity1)%z3(ji-1,jj-1,1)
-                  END DO
-               END DO
-            CASE( 'T' )
-               DO jj = 2, jpjm1                                   ! T ==> I
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.25 * ( frcv(jpr_itx1)%z3(ji,jj  ,1) + frcv(jpr_itx1)%z3(ji-1,jj  ,1)   &
-                        &                   + frcv(jpr_itx1)%z3(ji,jj-1,1) + frcv(jpr_itx1)%z3(ji-1,jj-1,1) ) 
-                     p_tauj(ji,jj) = 0.25 * ( frcv(jpr_ity1)%z3(ji,jj  ,1) + frcv(jpr_ity1)%z3(ji-1,jj  ,1)   &
-                        &                   + frcv(jpr_oty1)%z3(ji,jj-1,1) + frcv(jpr_ity1)%z3(ji-1,jj-1,1) )
-                  END DO
-               END DO
-            CASE( 'I' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! I ==> I
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
-            END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'I' ) THEN 
-               CALL lbc_lnk( p_taui, 'I',  -1. )   ;   CALL lbc_lnk( p_tauj, 'I',  -1. )
-            ENDIF
-            !
-         CASE( 'F' )                                         ! B-grid ==> F
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
-            CASE( 'U' )
-               DO jj = 2, jpjm1                                   ! (U,V) ==> F
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji  ,jj+1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji,jj,1) + frcv(jpr_ity1)%z3(ji+1,jj  ,1) )
-                  END DO
-               END DO
-            CASE( 'I' )
-               DO jj = 2, jpjm1                                   ! I ==> F
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = frcv(jpr_itx1)%z3(ji+1,jj+1,1)
-                     p_tauj(ji,jj) = frcv(jpr_ity1)%z3(ji+1,jj+1,1)
-                  END DO
-               END DO
-            CASE( 'T' )
-               DO jj = 2, jpjm1                                   ! T ==> F
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.25 * ( frcv(jpr_itx1)%z3(ji,jj  ,1) + frcv(jpr_itx1)%z3(ji+1,jj  ,1)   &
-                        &                   + frcv(jpr_itx1)%z3(ji,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj+1,1) ) 
-                     p_tauj(ji,jj) = 0.25 * ( frcv(jpr_ity1)%z3(ji,jj  ,1) + frcv(jpr_ity1)%z3(ji+1,jj  ,1)   &
-                        &                   + frcv(jpr_ity1)%z3(ji,jj+1,1) + frcv(jpr_ity1)%z3(ji+1,jj+1,1) )
-                  END DO
-               END DO
-            CASE( 'F' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! F ==> F
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
-            END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'F' ) THEN 
-               CALL lbc_lnk( p_taui, 'F',  -1. )   ;   CALL lbc_lnk( p_tauj, 'F',  -1. )
-            ENDIF
-            !
-         CASE( 'C' )                                         ! C-grid ==> U,V
-            SELECT CASE ( srcv(jpr_itx1)%clgrid )
-            CASE( 'U' )
-               p_taui(:,:) = frcv(jpr_itx1)%z3(:,:,1)                   ! (U,V) ==> (U,V)
-               p_tauj(:,:) = frcv(jpr_ity1)%z3(:,:,1)
-            CASE( 'F' )
-               DO jj = 2, jpjm1                                   ! F ==> (U,V)
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji,jj,1) + frcv(jpr_itx1)%z3(ji  ,jj-1,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(jj,jj,1) + frcv(jpr_ity1)%z3(ji-1,jj  ,1) )
-                  END DO
-               END DO
-            CASE( 'T' )
-               DO jj = 2, jpjm1                                   ! T ==> (U,V)
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj  ,1) + frcv(jpr_itx1)%z3(ji,jj,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) )
-                  END DO
-               END DO
-            CASE( 'I' )
-               DO jj = 2, jpjm1                                   ! I ==> (U,V)
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     p_taui(ji,jj) = 0.5 * ( frcv(jpr_itx1)%z3(ji+1,jj+1,1) + frcv(jpr_itx1)%z3(ji+1,jj  ,1) )
-                     p_tauj(ji,jj) = 0.5 * ( frcv(jpr_ity1)%z3(ji+1,jj+1,1) + frcv(jpr_ity1)%z3(ji  ,jj+1,1) )
-                  END DO
-               END DO
-            END SELECT
-            IF( srcv(jpr_itx1)%clgrid /= 'U' ) THEN 
-               CALL lbc_lnk( p_taui, 'U',  -1. )   ;   CALL lbc_lnk( p_tauj, 'V',  -1. )
-            ENDIF
-         END SELECT
-
-      ENDIF
-      !   
-      CALL wrk_dealloc( jpi,jpj, ztx, zty )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_ice_tau')
-      !
-   END SUBROUTINE sbc_cpl_ice_tau
-   
-
-   SUBROUTINE sbc_cpl_ice_flx( p_frld  , palbi   , psst    , pist    )
-      !!----------------------------------------------------------------------
-      !!             ***  ROUTINE sbc_cpl_ice_flx  ***
-      !!
-      !! ** Purpose :   provide the heat and freshwater fluxes of the 
-      !!              ocean-ice system.
-      !!
-      !! ** Method  :   transform the fields received from the atmosphere into
-      !!             surface heat and fresh water boundary condition for the 
-      !!             ice-ocean system. The following fields are provided:
-      !!              * total non solar, solar and freshwater fluxes (qns_tot, 
-      !!             qsr_tot and emp_tot) (total means weighted ice-ocean flux)
-      !!             NB: emp_tot include runoffs and calving.
-      !!              * fluxes over ice (qns_ice, qsr_ice, emp_ice) where
-      !!             emp_ice = sublimation - solid precipitation as liquid
-      !!             precipitation are re-routed directly to the ocean and 
-      !!             runoffs and calving directly enter the ocean.
-      !!              * solid precipitation (sprecip), used to add to qns_tot 
-      !!             the heat lost associated to melting solid precipitation
-      !!             over the ocean fraction.
-      !!       ===>> CAUTION here this changes the net heat flux received from
-      !!             the atmosphere
-      !!
-      !!                  - the fluxes have been separated from the stress as
-      !!                 (a) they are updated at each ice time step compare to
-      !!                 an update at each coupled time step for the stress, and
-      !!                 (b) the conservative computation of the fluxes over the
-      !!                 sea-ice area requires the knowledge of the ice fraction
-      !!                 after the ice advection and before the ice thermodynamics,
-      !!                 so that the stress is updated before the ice dynamics
-      !!                 while the fluxes are updated after it.
-      !!
-      !! ** Action  :   update at each nf_ice time step:
-      !!                   qns_tot, qsr_tot  non-solar and solar total heat fluxes
-      !!                   qns_ice, qsr_ice  non-solar and solar heat fluxes over the ice
-      !!                   emp_tot            total evaporation - precipitation(liquid and solid) (-runoff)(-calving)
-      !!                   emp_ice            ice sublimation - solid precipitation over the ice
-      !!                   dqns_ice           d(non-solar heat flux)/d(Temperature) over the ice
-      !!                   sprecip             solid precipitation over the ocean  
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in   ), DIMENSION(:,:)   ::   p_frld     ! lead fraction                [0 to 1]
-      ! optional arguments, used only in 'mixed oce-ice' case
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   palbi   ! ice albedo 
-      REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst    ! sea surface temperature     [Celcius]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist    ! ice surface temperature     [Kelvin]
-      !
-      INTEGER ::   jl   ! dummy loop index
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zcptn, ztmp, zicefr
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_ice_flx')
-      !
-      CALL wrk_alloc( jpi,jpj, zcptn, ztmp, zicefr )
-
-      zicefr(:,:) = 1.- p_frld(:,:)
-      zcptn(:,:) = rcp * sst_m(:,:)
-      !
-      !                                                      ! ========================= !
-      !                                                      !    freshwater budget      !   (emp)
-      !                                                      ! ========================= !
-      !
-      !                                                           ! total Precipitations - total Evaporation (emp_tot)
-      !                                                           ! solid precipitation  - sublimation       (emp_ice)
-      !                                                           ! solid Precipitation                      (sprecip)
-      SELECT CASE( TRIM( sn_rcv_emp%cldes ) )
-      CASE( 'conservative'  )   ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp
-         sprecip(:,:) = frcv(jpr_snow)%z3(:,:,1)                 ! May need to ensure positive here
-         tprecip(:,:) = frcv(jpr_rain)%z3(:,:,1) + sprecip (:,:) ! May need to ensure positive here
-         emp_tot(:,:) = frcv(jpr_tevp)%z3(:,:,1) - tprecip(:,:)
-         emp_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1)
-                           CALL iom_put( 'rain'         , frcv(jpr_rain)%z3(:,:,1)              )   ! liquid precipitation 
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_rain_cea', frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from liq. precip. 
-         ztmp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:)
-                           CALL iom_put( 'evap_ao_cea'  , ztmp                            )   ! ice-free oce evap (cell average)
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_evap_cea', ztmp(:,:         ) * zcptn(:,:) )   ! heat flux from from evap (cell ave)
-      CASE( 'oce and ice'   )   ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp
-         emp_tot(:,:) = p_frld(:,:) * frcv(jpr_oemp)%z3(:,:,1) + zicefr(:,:) * frcv(jpr_sbpr)%z3(:,:,1)
-         emp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1)
-         sprecip(:,:) = - frcv(jpr_semp)%z3(:,:,1) + frcv(jpr_ievp)%z3(:,:,1)
-      END SELECT
-
-      CALL iom_put( 'snowpre'    , sprecip                                )   ! Snow
-      CALL iom_put( 'snow_ao_cea', sprecip(:,:         ) * p_frld(:,:)    )   ! Snow        over ice-free ocean  (cell average)
-      CALL iom_put( 'snow_ai_cea', sprecip(:,:         ) * zicefr(:,:)    )   ! Snow        over sea-ice         (cell average)
-      CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) )   ! Sublimation over sea-ice         (cell average)
-      !   
-      !                                                           ! runoffs and calving (put in emp_tot)
-      IF( srcv(jpr_rnf)%laction ) THEN 
-         emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_rnf)%z3(:,:,1)
-                           CALL iom_put( 'runoffs'      , frcv(jpr_rnf)%z3(:,:,1)              )   ! rivers
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_rnf_cea' , frcv(jpr_rnf)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from rivers
-      ENDIF
-      IF( srcv(jpr_cal)%laction ) THEN 
-         emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1)
-         CALL iom_put( 'calving', frcv(jpr_cal)%z3(:,:,1) )
-      ENDIF
-      !
-!!gm :  this seems to be internal cooking, not sure to need that in a generic interface 
-!!gm                                       at least should be optional...
-!!       ! remove negative runoff                            ! sum over the global domain
-!!       zcumulpos = SUM( MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) ) 
-!!       zcumulneg = SUM( MIN( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * e1t(:,:) * e2t(:,:) * tmask_i(:,:) )
-!!       IF( lk_mpp )   CALL mpp_sum( zcumulpos )
-!!       IF( lk_mpp )   CALL mpp_sum( zcumulneg ) 
-!!       IF( zcumulpos /= 0. ) THEN                          ! distribute negative runoff on positive runoff grid points
-!!          zcumulneg = 1.e0 + zcumulneg / zcumulpos
-!!          frcv(jpr_rnf)%z3(:,:,1) = MAX( frcv(jpr_rnf)%z3(:,:,1), 0.e0 ) * zcumulneg
-!!       ENDIF     
-!!       emp_tot(:,:) = emp_tot(:,:) - frcv(jpr_rnf)%z3(:,:,1)   ! add runoff to e-p 
-!!
-!!gm  end of internal cooking
-
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_qns%cldes ) )                !   non solar heat fluxes   !   (qns)
-      !                                                      ! ========================= !
-      CASE( 'oce only' )                                     ! the required field is directly provided
-         qns_tot(:,:  ) = frcv(jpr_qnsoce)%z3(:,:,1)
-      CASE( 'conservative' )                                      ! the required fields are directly provided
-         qns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1)
-         IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN
-            qns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl)
-         ELSE
-            ! Set all category values equal for the moment
-            DO jl=1,jpl
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      CASE( 'oce and ice' )       ! the total flux is computed from ocean and ice fluxes
-         qns_tot(:,:  ) =  p_frld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1)
-         IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN
-            DO jl=1,jpl
-               qns_tot(:,:   ) = qns_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qnsice)%z3(:,:,jl)   
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,jl)
-            ENDDO
-         ELSE
-            DO jl=1,jpl
-               qns_tot(:,:   ) = qns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1)
-               qns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      CASE( 'mixed oce-ice' )     ! the ice flux is cumputed from the total flux, the SST and ice informations
-! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED **
-         qns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1)
-         qns_ice(:,:,1) = frcv(jpr_qnsmix)%z3(:,:,1)    &
-            &            + frcv(jpr_dqnsdt)%z3(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,:  ) ) * p_frld(:,:)   &
-            &                                                   +          pist(:,:,1)   * zicefr(:,:) ) )
-      END SELECT
-      ztmp(:,:) = p_frld(:,:) * sprecip(:,:) * lfus
-      qns_tot(:,:) = qns_tot(:,:)                         &            ! qns_tot update over free ocean with:
-         &          - ztmp(:,:)                           &            ! remove the latent heat flux of solid precip. melting
-         &          - (  emp_tot(:,:)                     &            ! remove the heat content of mass flux (assumed to be at SST)
-         &             - emp_ice(:,:) * zicefr(:,:)  ) * zcptn(:,:) 
-      IF( lk_diaar5 )   CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
-!!gm
-!!    currently it is taken into account in leads budget but not in the qns_tot, and thus not in 
-!!    the flux that enter the ocean....
-!!    moreover 1 - it is not diagnose anywhere.... 
-!!             2 - it is unclear for me whether this heat lost is taken into account in the atmosphere or not...
-!!
-!! similar job should be done for snow and precipitation temperature
-      !                                     
-      IF( srcv(jpr_cal)%laction ) THEN                            ! Iceberg melting 
-         ztmp(:,:) = frcv(jpr_cal)%z3(:,:,1) * lfus               ! add the latent heat of iceberg melting 
-         qns_tot(:,:) = qns_tot(:,:) - ztmp(:,:)
-         IF( lk_diaar5 )   CALL iom_put( 'hflx_cal_cea', ztmp + frcv(jpr_cal)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from calving
-      ENDIF
-
-      !                                                      ! ========================= !
-      SELECT CASE( TRIM( sn_rcv_qsr%cldes ) )                !      solar heat fluxes    !   (qsr)
-      !                                                      ! ========================= !
-      CASE( 'oce only' )
-         qsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) )
-      CASE( 'conservative' )
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
-         IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN
-            qsr_ice(:,:,1:jpl) = frcv(jpr_qsrice)%z3(:,:,1:jpl)
-         ELSE
-            ! Set all category values equal for the moment
-            DO jl=1,jpl
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1)
-            ENDDO
-         ENDIF
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
-         qsr_ice(:,:,1) = frcv(jpr_qsrice)%z3(:,:,1)
-      CASE( 'oce and ice' )
-         qsr_tot(:,:  ) =  p_frld(:,:) * frcv(jpr_qsroce)%z3(:,:,1)
-         IF ( TRIM(sn_rcv_qsr%clcat) == 'yes' ) THEN
-            DO jl=1,jpl
-               qsr_tot(:,:   ) = qsr_tot(:,:) + a_i(:,:,jl) * frcv(jpr_qsrice)%z3(:,:,jl)   
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,jl)
-            ENDDO
-         ELSE
-            DO jl=1,jpl
-               qsr_tot(:,:   ) = qsr_tot(:,:) + zicefr(:,:) * frcv(jpr_qsrice)%z3(:,:,1)
-               qsr_ice(:,:,jl) = frcv(jpr_qsrice)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      CASE( 'mixed oce-ice' )
-         qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
-! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED **
-!       Create solar heat flux over ice using incoming solar heat flux and albedos
-!       ( see OASIS3 user guide, 5th edition, p39 )
-         qsr_ice(:,:,1) = frcv(jpr_qsrmix)%z3(:,:,1) * ( 1.- palbi(:,:,1) )   &
-            &            / (  1.- ( albedo_oce_mix(:,:  ) * p_frld(:,:)       &
-            &                     + palbi         (:,:,1) * zicefr(:,:) ) )
-      END SELECT
-      IF( ln_dm2dc ) THEN   ! modify qsr to include the diurnal cycle
-         qsr_tot(:,:  ) = sbc_dcy( qsr_tot(:,:  ) )
-         DO jl=1,jpl
-            qsr_ice(:,:,jl) = sbc_dcy( qsr_ice(:,:,jl) )
-         ENDDO
-      ENDIF
-
-      SELECT CASE( TRIM( sn_rcv_dqnsdt%cldes ) )
-      CASE ('coupled')
-         IF ( TRIM(sn_rcv_dqnsdt%clcat) == 'yes' ) THEN
-            dqns_ice(:,:,1:jpl) = frcv(jpr_dqnsdt)%z3(:,:,1:jpl)
-         ELSE
-            ! Set all category values equal for the moment
-            DO jl=1,jpl
-               dqns_ice(:,:,jl) = frcv(jpr_dqnsdt)%z3(:,:,1)
-            ENDDO
-         ENDIF
-      END SELECT
-
-      SELECT CASE( TRIM( sn_rcv_iceflx%cldes ) )
-      CASE ('coupled')
-         topmelt(:,:,:)=frcv(jpr_topm)%z3(:,:,:)
-         botmelt(:,:,:)=frcv(jpr_botm)%z3(:,:,:)
-      END SELECT
-
-      !    Ice Qsr penetration used (only?)in lim2 or lim3 
-      ! fraction of net shortwave radiation which is not absorbed in the thin surface layer 
-      ! and penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-      ! Coupled case: since cloud cover is not received from atmosphere 
-      !               ===> defined as constant value -> definition done in sbc_cpl_init
-      fr1_i0(:,:) = 0.18
-      fr2_i0(:,:) = 0.82
-
-
-      CALL wrk_dealloc( jpi,jpj, zcptn, ztmp, zicefr )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_ice_flx')
-      !
-   END SUBROUTINE sbc_cpl_ice_flx
-   
-   
-   SUBROUTINE sbc_cpl_snd( kt )
-      !!----------------------------------------------------------------------
-      !!             ***  ROUTINE sbc_cpl_snd  ***
-      !!
-      !! ** Purpose :   provide the ocean-ice informations to the atmosphere
-      !!
-      !! ** Method  :   send to the atmosphere through a call to cpl_prism_snd
-      !!              all the needed fields (as defined in sbc_cpl_init)
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt
-      !
-      INTEGER ::   ji, jj, jl   ! dummy loop indices
-      INTEGER ::   isec, info   ! local integer
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztmp3, ztmp4   
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_snd')
-      !
-      CALL wrk_alloc( jpi,jpj, zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1 )
-      CALL wrk_alloc( jpi,jpj,jpl, ztmp3, ztmp4 )
-
-      isec = ( kt - nit000 ) * NINT(rdttra(1))        ! date of exchanges
-
-      zfr_l(:,:) = 1.- fr_i(:,:)
-
-      !                                                      ! ------------------------- !
-      !                                                      !    Surface temperature    !   in Kelvin
-      !                                                      ! ------------------------- !
-      IF( ssnd(jps_toce)%laction .OR. ssnd(jps_tice)%laction .OR. ssnd(jps_tmix)%laction ) THEN
-         SELECT CASE( sn_snd_temp%cldes)
-         CASE( 'oce only'             )   ;   ztmp1(:,:) =   tsn(:,:,1,jp_tem) + rt0
-         CASE( 'weighted oce and ice' )   ;   ztmp1(:,:) = ( tsn(:,:,1,jp_tem) + rt0 ) * zfr_l(:,:)   
-            SELECT CASE( sn_snd_temp%clcat )
-            CASE( 'yes' )   
-               ztmp3(:,:,1:jpl) = tn_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
-            CASE( 'no' )
-               ztmp3(:,:,:) = 0.0
-               DO jl=1,jpl
-                  ztmp3(:,:,1) = ztmp3(:,:,1) + tn_ice(:,:,jl) * a_i(:,:,jl)
-               ENDDO
-            CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' )
-            END SELECT
-         CASE( 'mixed oce-ice'        )   
-            ztmp1(:,:) = ( tsn(:,:,1,jp_tem) + rt0 ) * zfr_l(:,:) 
-            DO jl=1,jpl
-               ztmp1(:,:) = ztmp1(:,:) + tn_ice(:,:,jl) * a_i(:,:,jl)
-            ENDDO
-         CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%cldes' )
-         END SELECT
-         IF( ssnd(jps_toce)%laction )   CALL cpl_prism_snd( jps_toce, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
-         IF( ssnd(jps_tice)%laction )   CALL cpl_prism_snd( jps_tice, isec, ztmp3, info )
-         IF( ssnd(jps_tmix)%laction )   CALL cpl_prism_snd( jps_tmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
-      ENDIF
-      !
-      !                                                      ! ------------------------- !
-      !                                                      !           Albedo          !
-      !                                                      ! ------------------------- !
-      IF( ssnd(jps_albice)%laction ) THEN                         ! ice 
-         ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
-         CALL cpl_prism_snd( jps_albice, isec, ztmp3, info )
-      ENDIF
-      IF( ssnd(jps_albmix)%laction ) THEN                         ! mixed ice-ocean
-         ztmp1(:,:) = albedo_oce_mix(:,:) * zfr_l(:,:)
-         DO jl=1,jpl
-            ztmp1(:,:) = ztmp1(:,:) + alb_ice(:,:,jl) * a_i(:,:,jl)
-         ENDDO
-         CALL cpl_prism_snd( jps_albmix, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info )
-      ENDIF
-      !                                                      ! ------------------------- !
-      !                                                      !  Ice fraction & Thickness ! 
-      !                                                      ! ------------------------- !
-      ! Send ice fraction field 
-      IF( ssnd(jps_fice)%laction ) THEN
-         SELECT CASE( sn_snd_thick%clcat )
-         CASE( 'yes' )   ;   ztmp3(:,:,1:jpl) =  a_i(:,:,1:jpl)
-         CASE( 'no'  )   ;   ztmp3(:,:,1    ) = fr_i(:,:      )
-         CASE default    ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
-         END SELECT
-         CALL cpl_prism_snd( jps_fice, isec, ztmp3, info )
-      ENDIF
-
-      ! Send ice and snow thickness field 
-      IF( ssnd(jps_hice)%laction .OR. ssnd(jps_hsnw)%laction ) THEN 
-         SELECT CASE( sn_snd_thick%cldes)
-         CASE( 'none'                  )       ! nothing to do
-         CASE( 'weighted ice and snow' )   
-            SELECT CASE( sn_snd_thick%clcat )
-            CASE( 'yes' )   
-               ztmp3(:,:,1:jpl) =  ht_i(:,:,1:jpl) * a_i(:,:,1:jpl)
-               ztmp4(:,:,1:jpl) =  ht_s(:,:,1:jpl) * a_i(:,:,1:jpl)
-            CASE( 'no' )
-               ztmp3(:,:,:) = 0.0   ;  ztmp4(:,:,:) = 0.0
-               DO jl=1,jpl
-                  ztmp3(:,:,1) = ztmp3(:,:,1) + ht_i(:,:,jl) * a_i(:,:,jl)
-                  ztmp4(:,:,1) = ztmp4(:,:,1) + ht_s(:,:,jl) * a_i(:,:,jl)
-               ENDDO
-            CASE default                  ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%clcat' )
-            END SELECT
-         CASE( 'ice and snow'         )   
-            ztmp3(:,:,1:jpl) = ht_i(:,:,1:jpl)
-            ztmp4(:,:,1:jpl) = ht_s(:,:,1:jpl)
-         CASE default                     ;   CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick%cldes' )
-         END SELECT
-         IF( ssnd(jps_hice)%laction )   CALL cpl_prism_snd( jps_hice, isec, ztmp3, info )
-         IF( ssnd(jps_hsnw)%laction )   CALL cpl_prism_snd( jps_hsnw, isec, ztmp4, info )
-      ENDIF
-      !
-#if defined key_cpl_carbon_cycle
-      !                                                      ! ------------------------- !
-      !                                                      !  CO2 flux from PISCES     ! 
-      !                                                      ! ------------------------- !
-      IF( ssnd(jps_co2)%laction )   CALL cpl_prism_snd( jps_co2, isec, RESHAPE ( oce_co2, (/jpi,jpj,1/) ) , info )
-      !
-#endif
-      !                                                      ! ------------------------- !
-      IF( ssnd(jps_ocx1)%laction ) THEN                      !      Surface current      !
-         !                                                   ! ------------------------- !
-         !    
-         !                                                  j+1   j     -----V---F
-         ! surface velocity always sent from T point                     !       |
-         !                                                        j      |   T   U
-         !                                                               |       |
-         !                                                   j    j-1   -I-------|
-         !                                               (for I)         |       |
-         !                                                              i-1  i   i
-         !                                                               i      i+1 (for I)
-         SELECT CASE( TRIM( sn_snd_crt%cldes ) )
-         CASE( 'oce only'             )      ! C-grid ==> T
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj  ,1) )
-                  zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji  ,jj-1,1) ) 
-               END DO
-            END DO
-         CASE( 'weighted oce and ice' )   
-            SELECT CASE ( cp_ice_msh )
-            CASE( 'C' )                      ! Ocean and Ice on C-grid ==> T
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     zotx1(ji,jj) = 0.5 * ( un   (ji,jj,1) + un   (ji-1,jj  ,1) ) * zfr_l(ji,jj)  
-                     zoty1(ji,jj) = 0.5 * ( vn   (ji,jj,1) + vn   (ji  ,jj-1,1) ) * zfr_l(ji,jj)
-                     zitx1(ji,jj) = 0.5 * ( u_ice(ji,jj  ) + u_ice(ji-1,jj    ) ) *  fr_i(ji,jj)
-                     zity1(ji,jj) = 0.5 * ( v_ice(ji,jj  ) + v_ice(ji  ,jj-1  ) ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            CASE( 'I' )                      ! Ocean on C grid, Ice on I-point (B-grid) ==> T
-               DO jj = 2, jpjm1
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     zotx1(ji,jj) = 0.5  * ( un(ji,jj,1)      + un(ji-1,jj  ,1) ) * zfr_l(ji,jj)  
-                     zoty1(ji,jj) = 0.5  * ( vn(ji,jj,1)      + vn(ji  ,jj-1,1) ) * zfr_l(ji,jj)  
-                     zitx1(ji,jj) = 0.25 * ( u_ice(ji+1,jj+1) + u_ice(ji,jj+1)                     &
-                        &                  + u_ice(ji+1,jj  ) + u_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                     zity1(ji,jj) = 0.25 * ( v_ice(ji+1,jj+1) + v_ice(ji,jj+1)                     &
-                        &                  + v_ice(ji+1,jj  ) + v_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            CASE( 'F' )                      ! Ocean on C grid, Ice on F-point (B-grid) ==> T
-               DO jj = 2, jpjm1
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     zotx1(ji,jj) = 0.5  * ( un(ji,jj,1)      + un(ji-1,jj  ,1) ) * zfr_l(ji,jj)  
-                     zoty1(ji,jj) = 0.5  * ( vn(ji,jj,1)      + vn(ji  ,jj-1,1) ) * zfr_l(ji,jj)  
-                     zitx1(ji,jj) = 0.25 * ( u_ice(ji-1,jj-1) + u_ice(ji,jj-1)                     &
-                        &                  + u_ice(ji-1,jj  ) + u_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                     zity1(ji,jj) = 0.25 * ( v_ice(ji-1,jj-1) + v_ice(ji,jj-1)                     &
-                        &                  + v_ice(ji-1,jj  ) + v_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            END SELECT
-            CALL lbc_lnk( zitx1, 'T', -1. )   ;   CALL lbc_lnk( zity1, 'T', -1. )
-         CASE( 'mixed oce-ice'        )
-            SELECT CASE ( cp_ice_msh )
-            CASE( 'C' )                      ! Ocean and Ice on C-grid ==> T
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     zotx1(ji,jj) = 0.5 * ( un   (ji,jj,1) + un   (ji-1,jj  ,1) ) * zfr_l(ji,jj)   &
-                        &         + 0.5 * ( u_ice(ji,jj  ) + u_ice(ji-1,jj    ) ) *  fr_i(ji,jj)
-                     zoty1(ji,jj) = 0.5 * ( vn   (ji,jj,1) + vn   (ji  ,jj-1,1) ) * zfr_l(ji,jj)   &
-                        &         + 0.5 * ( v_ice(ji,jj  ) + v_ice(ji  ,jj-1  ) ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            CASE( 'I' )                      ! Ocean on C grid, Ice on I-point (B-grid) ==> T
-               DO jj = 2, jpjm1
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     zotx1(ji,jj) = 0.5  * ( un(ji,jj,1)      + un(ji-1,jj  ,1) ) * zfr_l(ji,jj)   &   
-                        &         + 0.25 * ( u_ice(ji+1,jj+1) + u_ice(ji,jj+1)                     &
-                        &                  + u_ice(ji+1,jj  ) + u_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                     zoty1(ji,jj) = 0.5  * ( vn(ji,jj,1)      + vn(ji  ,jj-1,1) ) * zfr_l(ji,jj)   & 
-                        &         + 0.25 * ( v_ice(ji+1,jj+1) + v_ice(ji,jj+1)                     &
-                        &                  + v_ice(ji+1,jj  ) + v_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            CASE( 'F' )                      ! Ocean on C grid, Ice on F-point (B-grid) ==> T
-               DO jj = 2, jpjm1
-                  DO ji = 2, jpim1   ! NO vector opt.
-                     zotx1(ji,jj) = 0.5  * ( un(ji,jj,1)      + un(ji-1,jj  ,1) ) * zfr_l(ji,jj)   &   
-                        &         + 0.25 * ( u_ice(ji-1,jj-1) + u_ice(ji,jj-1)                     &
-                        &                  + u_ice(ji-1,jj  ) + u_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                     zoty1(ji,jj) = 0.5  * ( vn(ji,jj,1)      + vn(ji  ,jj-1,1) ) * zfr_l(ji,jj)   & 
-                        &         + 0.25 * ( v_ice(ji-1,jj-1) + v_ice(ji,jj-1)                     &
-                        &                  + v_ice(ji-1,jj  ) + v_ice(ji,jj  )  ) *  fr_i(ji,jj)
-                  END DO
-               END DO
-            END SELECT
-         END SELECT
-         CALL lbc_lnk( zotx1, ssnd(jps_ocx1)%clgrid, -1. )   ;   CALL lbc_lnk( zoty1, ssnd(jps_ocy1)%clgrid, -1. )
-         !
-         !
-         IF( TRIM( sn_snd_crt%clvor ) == 'eastward-northward' ) THEN             ! Rotation of the components
-            !                                                                     ! Ocean component
-            CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 )       ! 1st component 
-            CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 )       ! 2nd component 
-            zotx1(:,:) = ztmp1(:,:)                                                   ! overwrite the components 
-            zoty1(:,:) = ztmp2(:,:)
-            IF( ssnd(jps_ivx1)%laction ) THEN                                     ! Ice component
-               CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 )    ! 1st component 
-               CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 )    ! 2nd component 
-               zitx1(:,:) = ztmp1(:,:)                                                ! overwrite the components 
-               zity1(:,:) = ztmp2(:,:)
-            ENDIF
-         ENDIF
-         !
-         ! spherical coordinates to cartesian -> 2 components to 3 components
-         IF( TRIM( sn_snd_crt%clvref ) == 'cartesian' ) THEN
-            ztmp1(:,:) = zotx1(:,:)                     ! ocean currents
-            ztmp2(:,:) = zoty1(:,:)
-            CALL oce2geo ( ztmp1, ztmp2, 'T', zotx1, zoty1, zotz1 )
-            !
-            IF( ssnd(jps_ivx1)%laction ) THEN           ! ice velocities
-               ztmp1(:,:) = zitx1(:,:)
-               ztmp1(:,:) = zity1(:,:)
-               CALL oce2geo ( ztmp1, ztmp2, 'T', zitx1, zity1, zitz1 )
-            ENDIF
-         ENDIF
-         !
-         IF( ssnd(jps_ocx1)%laction )   CALL cpl_prism_snd( jps_ocx1, isec, RESHAPE ( zotx1, (/jpi,jpj,1/) ), info )   ! ocean x current 1st grid
-         IF( ssnd(jps_ocy1)%laction )   CALL cpl_prism_snd( jps_ocy1, isec, RESHAPE ( zoty1, (/jpi,jpj,1/) ), info )   ! ocean y current 1st grid
-         IF( ssnd(jps_ocz1)%laction )   CALL cpl_prism_snd( jps_ocz1, isec, RESHAPE ( zotz1, (/jpi,jpj,1/) ), info )   ! ocean z current 1st grid
-         !
-         IF( ssnd(jps_ivx1)%laction )   CALL cpl_prism_snd( jps_ivx1, isec, RESHAPE ( zitx1, (/jpi,jpj,1/) ), info )   ! ice   x current 1st grid
-         IF( ssnd(jps_ivy1)%laction )   CALL cpl_prism_snd( jps_ivy1, isec, RESHAPE ( zity1, (/jpi,jpj,1/) ), info )   ! ice   y current 1st grid
-         IF( ssnd(jps_ivz1)%laction )   CALL cpl_prism_snd( jps_ivz1, isec, RESHAPE ( zitz1, (/jpi,jpj,1/) ), info )   ! ice   z current 1st grid
-         ! 
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi,jpj, zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1 )
-      CALL wrk_dealloc( jpi,jpj,jpl, ztmp3, ztmp4 )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc_cpl_snd')
-      !
-   END SUBROUTINE sbc_cpl_snd
-   
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                            NO coupling
-   !!----------------------------------------------------------------------
-   USE par_kind        ! kind definition
-CONTAINS
-   SUBROUTINE sbc_cpl_snd( kt )
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt
-   END SUBROUTINE sbc_cpl_snd
-   !
-   SUBROUTINE sbc_cpl_rcv( kt, k_fsbc, k_ice )     
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', kt, k_fsbc, k_ice
-   END SUBROUTINE sbc_cpl_rcv
-   !
-   SUBROUTINE sbc_cpl_ice_tau( p_taui, p_tauj )     
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_taui   ! i- & j-components of atmos-ice stress [N/m2]
-      REAL(wp), INTENT(out), DIMENSION(:,:) ::   p_tauj   ! at I-point (B-grid) or U & V-point (C-grid)
-      p_taui(:,:) = 0.   ;   p_tauj(:,:) = 0. ! stupid definition to avoid warning message when compiling...
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?'
-   END SUBROUTINE sbc_cpl_ice_tau
-   !
-   SUBROUTINE sbc_cpl_ice_flx( p_frld , palbi   , psst    , pist  )
-      REAL(wp), INTENT(in   ), DIMENSION(:,:  ) ::   p_frld     ! lead fraction                [0 to 1]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   palbi   ! ice albedo
-      REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst    ! sea surface temperature      [Celcius]
-      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist    ! ice surface temperature      [Kelvin]
-      WRITE(*,*) 'sbc_cpl_snd: You should not have seen this print! error?', p_frld(1,1), palbi(1,1,1), psst(1,1), pist(1,1,1) 
-   END SUBROUTINE sbc_cpl_ice_flx
-   
-#endif
-
-   !!======================================================================
-END MODULE sbccpl
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbcmod.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbcmod.F90	(revision 2446)
+++ 	(revision )
@@ -1,461 +1,0 @@
-MODULE sbcmod
-   !!======================================================================
-   !!                       ***  MODULE  sbcmod  ***
-   !! Surface module :  provide to the ocean its surface boundary condition
-   !!======================================================================
-   !! History :  3.0  ! 2006-07  (G. Madec)  Original code
-   !!            3.1  ! 2008-08  (S. Masson, A. Caubel, E. Maisonnave, G. Madec) coupled interface
-   !!            3.3  ! 2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps
-   !!            3.3  ! 2010-10  (S. Masson)  add diurnal cycle
-   !!            3.3  ! 2010-09  (D. Storkey) add ice boundary conditions (BDY)
-   !!             -   ! 2010-11  (G. Madec) ice-ocean stress always computed at each ocean time-step
-   !!             -   ! 2010-10  (J. Chanut, C. Bricaud, G. Madec)  add the surface pressure forcing
-   !!            3.4  ! 2011-11  (C. Harris) CICE added as an option
-   !!            3.5  ! 2012-11  (A. Coward, G. Madec) Rethink of heat, mass and salt surface fluxes
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   sbc_init       : read namsbc namelist
-   !!   sbc            : surface ocean momentum, heat and freshwater boundary conditions
-   !!----------------------------------------------------------------------
-   USE oce              ! ocean dynamics and tracers
-   USE dom_oce          ! ocean space and time domain
-   USE phycst           ! physical constants
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE sbcdcy           ! surface boundary condition: diurnal cycle
-   USE sbcssm           ! surface boundary condition: sea-surface mean variables
-   USE sbcapr           ! surface boundary condition: atmospheric pressure
-   USE sbcana           ! surface boundary condition: analytical formulation
-   USE sbcflx           ! surface boundary condition: flux formulation
-   USE sbcblk_clio      ! surface boundary condition: bulk formulation : CLIO
-   USE sbcblk_core      ! surface boundary condition: bulk formulation : CORE
-   USE sbcblk_mfs       ! surface boundary condition: bulk formulation : MFS
-   USE sbcice_if        ! surface boundary condition: ice-if sea-ice model
-   USE sbcice_lim       ! surface boundary condition: LIM 3.0 sea-ice model
-   USE sbcice_lim_2     ! surface boundary condition: LIM 2.0 sea-ice model
-   USE sbcice_cice      ! surface boundary condition: CICE    sea-ice model
-   USE sbccpl           ! surface boundary condition: coupled florulation
-   USE cpl_oasis3, ONLY:lk_cpl      ! are we in coupled mode?
-   USE sbcssr           ! surface boundary condition: sea surface restoring
-   USE sbcrnf           ! surface boundary condition: runoffs
-   USE sbcfwb           ! surface boundary condition: freshwater budget
-   USE closea           ! closed sea
-   USE icbstp           ! Icebergs!
-
-   USE prtctl           ! Print control                    (prt_ctl routine)
-   USE iom              ! IOM library
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE timing           ! Timing
-   USE sbcwave          ! Wave module
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   sbc        ! routine called by step.F90
-   PUBLIC   sbc_init   ! routine called by opa.F90
-   
-   INTEGER ::   nsbc   ! type of surface boundary condition (deduced from namsbc informations)
-      
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 4.0 , NEMO-consortium (2011) 
-   !! $Id: sbcmod.F90 4624 2014-04-28 12:09:03Z acc $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE sbc_init
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc_init ***
-      !!
-      !! ** Purpose :   Initialisation of the ocean surface boundary computation
-      !!
-      !! ** Method  :   Read the namsbc namelist and set derived parameters
-      !!                Call init routines for all other SBC modules that have one
-      !!
-      !! ** Action  : - read namsbc parameters
-      !!              - nsbc: type of sbc
-      !!----------------------------------------------------------------------
-      INTEGER ::   icpt   ! local integer
-      !!
-      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, nn_lsm, cn_iceflx
-      INTEGER  ::   ios
-      !!----------------------------------------------------------------------
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'sbc_init : surface boundary condition setting'
-         WRITE(numout,*) '~~~~~~~~ '
-      ENDIF
-
-      REWIND( numnam_ref )              ! Namelist namsbc in reference namelist : Surface boundary
-      READ  ( numnam_ref, namsbc, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namsbc in configuration namelist : Parameters of the run
-      READ  ( numnam_cfg, namsbc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namsbc )
-
-      !                          ! overwrite namelist parameter using CPP key information
-      IF( Agrif_Root() ) THEN                ! AGRIF zoom
-        IF( lk_lim2 )   nn_ice      = 2
-        IF( lk_lim3 )   nn_ice      = 3
-        IF( lk_cice )   nn_ice      = 4
-      ENDIF
-      IF( cp_cfg == 'gyre' ) THEN            ! GYRE configuration
-          ln_ana      = .TRUE.   
-          nn_ice      =   0
-      ENDIF
-     
-      IF(lwp) THEN               ! Control print
-         WRITE(numout,*) '        Namelist namsbc (partly overwritten with CPP key setting)'
-         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc
-         WRITE(numout,*) '           Type of sbc : '
-         WRITE(numout,*) '              analytical formulation                     ln_ana      = ', ln_ana
-         WRITE(numout,*) '              flux       formulation                     ln_flx      = ', ln_flx
-         WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio = ', ln_blk_clio
-         WRITE(numout,*) '              CORE bulk  formulation                     ln_blk_core = ', ln_blk_core
-         WRITE(numout,*) '              MFS  bulk  formulation                     ln_blk_mfs  = ', ln_blk_mfs
-         WRITE(numout,*) '              coupled    formulation (T if key_sbc_cpl)  ln_cpl      = ', ln_cpl
-         WRITE(numout,*) '              Flux handling over ice categories          cn_iceflx   = ', TRIM (cn_iceflx)
-         WRITE(numout,*) '           Misc. options of sbc : '
-         WRITE(numout,*) '              Patm gradient added in ocean & ice Eqs.    ln_apr_dyn  = ', ln_apr_dyn
-         WRITE(numout,*) '              ice management in the sbc (=0/1/2/3)       nn_ice      = ', nn_ice 
-         WRITE(numout,*) '              ice-ocean embedded/levitating (=0/1/2)     nn_ice_embd = ', nn_ice_embd
-         WRITE(numout,*) '              daily mean to diurnal cycle qsr            ln_dm2dc    = ', ln_dm2dc 
-         WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf      = ', ln_rnf
-         WRITE(numout,*) '              Sea Surface Restoring on SST and/or SSS    ln_ssr      = ', ln_ssr
-         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
-
-      !   Flux handling over ice categories
-#if defined key_coupled 
-      SELECT CASE ( TRIM (cn_iceflx))
-      CASE ('ave')
-         ln_iceflx_ave    = .TRUE.
-         ln_iceflx_linear = .FALSE.
-      CASE ('linear')
-         ln_iceflx_ave    = .FALSE.
-         ln_iceflx_linear = .TRUE.
-      CASE default
-         ln_iceflx_ave    = .FALSE.
-         ln_iceflx_linear = .FALSE.
-      END SELECT
-      IF(lwp) WRITE(numout,*) '              Fluxes averaged over all ice categories         ln_iceflx_ave    = ', ln_iceflx_ave
-      IF(lwp) WRITE(numout,*) '              Fluxes distributed linearly over ice categories ln_iceflx_linear = ', ln_iceflx_linear
-#endif
-      !
-#if defined key_top && ! defined key_offline
-      ltrcdm2dc = (ln_dm2dc .AND. ln_blk_core .AND. nn_ice==2)
-      IF( ltrcdm2dc )THEN
-         IF(lwp)THEN
-            WRITE(numout,*)"analytical diurnal cycle, core bulk formulation and LIM2 use: "
-            WRITE(numout,*)"Diurnal cycle on physics but not in passive tracers"
-         ENDIF
-      ENDIF
-#else 
-      ltrcdm2dc =  .FALSE.
-#endif
-
-      !
-      !                              ! allocate sbc arrays
-      IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_oce arrays' )
-
-      !                          ! Checks:
-      IF( .NOT. ln_rnf ) THEN                      ! no specific treatment in vicinity of river mouths 
-         ln_rnf_mouth  = .false.                      
-         IF( sbc_rnf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_rnf arrays' )
-         nkrnf         = 0
-         rnf     (:,:) = 0.0_wp
-         rnf_b   (:,:) = 0.0_wp
-         rnfmsk  (:,:) = 0.0_wp
-         rnfmsk_z(:)   = 0.0_wp
-      ENDIF
-      IF( nn_ice == 0  )   fr_i(:,:) = 0.e0        ! no ice in the domain, ice fraction is always zero
-
-      sfx(:,:) = 0.0_wp                            ! the salt flux due to freezing/melting will be computed (i.e. will be non-zero) 
-                                                   ! only if sea-ice is present
- 
-      fmmflx(:,:) = 0.0_wp                        ! freezing-melting array initialisation
-
-      taum(:,:) = 0.0_wp                           ! Initialise taum for use in gls in case of reduced restart
-
-      !                                            ! restartability   
-      IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 .OR.   &
-          MOD( nstock             , nn_fsbc) /= 0 ) THEN 
-         WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') or nstock (', nstock,   &
-            &           ' is NOT a multiple of nn_fsbc (', nn_fsbc, ')'
-         CALL ctl_stop( ctmp1, 'Impossible to properly do model restart' )
-      ENDIF
-      !
-      IF( MOD( rday, REAL(nn_fsbc, wp) * rdt ) /= 0 )   &
-         &  CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' )
-      !
-      IF( ( nn_ice == 2 .OR. nn_ice ==3 ) .AND. .NOT.( ln_blk_clio .OR. ln_blk_core .OR. lk_cpl ) )   &
-         &   CALL ctl_stop( 'LIM sea-ice model requires a bulk formulation or coupled configuration' )
-      IF( nn_ice == 4 .AND. .NOT.( ln_blk_core .OR. lk_cpl ) )   &
-         &   CALL ctl_stop( 'CICE sea-ice model requires ln_blk_core or lk_cpl' )
-      IF( nn_ice == 4 .AND. lk_agrif )   &
-         &   CALL ctl_stop( 'CICE sea-ice model not currently available with AGRIF' )
-      IF( ( nn_ice == 3 .OR. nn_ice == 4 ) .AND. nn_ice_embd == 0 )   &
-         &   CALL ctl_stop( 'LIM3 and CICE sea-ice models require nn_ice_embd = 1 or 2' )
-#if defined key_coupled
-      IF( ln_iceflx_ave .AND. ln_iceflx_linear ) &
-         &   CALL ctl_stop( ' ln_iceflx_ave and ln_iceflx_linear options are not compatible' )
-      IF( ( nn_ice ==3 .AND. lk_cpl) .AND. .NOT. ( ln_iceflx_ave .OR. ln_iceflx_linear ) ) &
-         &   CALL ctl_stop( ' With lim3 coupled, either ln_iceflx_ave or ln_iceflx_linear must be set to .TRUE.' )
-#endif      
-      IF( ln_dm2dc )   nday_qsr = -1   ! initialisation flag
-
-      IF( ln_dm2dc .AND. .NOT.( ln_flx .OR. ln_blk_core ) )   &
-         &   CALL ctl_stop( 'diurnal cycle into qsr field from daily values requires a flux or core-bulk formulation' )
-      
-      IF( ln_dm2dc .AND. ( ( NINT(rday) / ( nn_fsbc * NINT(rdt) ) )  < 8 ) )   &
-         &   CALL ctl_warn( 'diurnal cycle for qsr: the sampling of the diurnal cycle is too small...' )
-
-      IF ( ln_wave ) THEN
-      !Activated wave module but neither drag nor stokes drift activated
-         IF ( .NOT.(ln_cdgw .OR. ln_sdw) )   THEN
-            CALL ctl_warn( 'Ask for wave coupling but nor drag coefficient (ln_cdgw=F) neither stokes drift activated (ln_sdw=F)' )
-      !drag coefficient read from wave model definable only with mfs bulk formulae and core 
-         ELSEIF (ln_cdgw .AND. .NOT.(ln_blk_mfs .OR. ln_blk_core) )       THEN       
-             CALL ctl_stop( 'drag coefficient read from wave model definable only with mfs bulk formulae and core')
-         ENDIF
-      ELSE
-      IF ( ln_cdgw .OR. ln_sdw  )                                         & 
-         &   CALL ctl_stop('Not Activated Wave Module (ln_wave=F) but     &
-         & asked coupling with drag coefficient (ln_cdgw =T) or Stokes drift (ln_sdw=T) ')
-      ENDIF 
-      
-      !                          ! Choice of the Surface Boudary Condition (set nsbc)
-      icpt = 0
-      IF( ln_ana          ) THEN   ;   nsbc =  1   ; icpt = icpt + 1   ;   ENDIF       ! analytical      formulation
-      IF( ln_flx          ) THEN   ;   nsbc =  2   ; icpt = icpt + 1   ;   ENDIF       ! flux            formulation
-      IF( ln_blk_clio     ) THEN   ;   nsbc =  3   ; icpt = icpt + 1   ;   ENDIF       ! CLIO bulk       formulation
-      IF( ln_blk_core     ) THEN   ;   nsbc =  4   ; icpt = icpt + 1   ;   ENDIF       ! CORE bulk       formulation
-      IF( ln_blk_mfs      ) THEN   ;   nsbc =  6   ; icpt = icpt + 1   ;   ENDIF       ! MFS  bulk       formulation
-      IF( ln_cpl          ) THEN   ;   nsbc =  5   ; icpt = icpt + 1   ;   ENDIF       ! Coupled         formulation
-      IF( cp_cfg == 'gyre') THEN   ;   nsbc =  0                       ;   ENDIF       ! GYRE analytical formulation
-      IF( lk_esopa        )            nsbc = -1                                       ! esopa test, ALL formulations
-      !
-      IF( icpt /= 1 .AND. .NOT.lk_esopa ) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) '           E R R O R in setting the sbc, one and only one namelist/CPP key option '
-         WRITE(numout,*) '                     must be choosen. You choose ', icpt, ' option(s)'
-         WRITE(numout,*) '                     We stop'
-         nstop = nstop + 1
-      ENDIF
-      IF(lwp) THEN
-         WRITE(numout,*)
-         IF( nsbc == -1 )   WRITE(numout,*) '              ESOPA test All surface boundary conditions'
-         IF( nsbc ==  0 )   WRITE(numout,*) '              GYRE analytical formulation'
-         IF( nsbc ==  1 )   WRITE(numout,*) '              analytical formulation'
-         IF( nsbc ==  2 )   WRITE(numout,*) '              flux formulation'
-         IF( nsbc ==  3 )   WRITE(numout,*) '              CLIO bulk formulation'
-         IF( nsbc ==  4 )   WRITE(numout,*) '              CORE bulk formulation'
-         IF( nsbc ==  5 )   WRITE(numout,*) '              coupled formulation'
-         IF( nsbc ==  6 )   WRITE(numout,*) '              MFS Bulk formulation'
-      ENDIF
-      !
-                          CALL sbc_ssm_init               ! Sea-surface mean fields initialisation
-      !
-      IF( ln_ssr      )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation
-      !
-      IF( nn_ice == 4 )   CALL cice_sbc_init( nsbc )      ! CICE initialisation
-      !
-#if defined key_oasis_mct
-      IF( nsbc == 5 )   CALL sbc_cpl_init (nn_ice)
-#endif
-      !
-   END SUBROUTINE sbc_init
-
-
-   SUBROUTINE sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc  ***
-      !!              
-      !! ** Purpose :   provide at each time-step the ocean surface boundary
-      !!                condition (momentum, heat and freshwater fluxes)
-      !!
-      !! ** Method  :   blah blah  to be written ????????? 
-      !!                CAUTION : never mask the surface stress field (tke sbc)
-      !!
-      !! ** Action  : - set the ocean surface boundary condition at before and now 
-      !!                time step, i.e.  
-      !!                utau_b, vtau_b, qns_b, qsr_b, emp_n, sfx_b, qrp_b, erp_b
-      !!                utau  , vtau  , qns  , qsr  , emp  , sfx  , qrp  , erp
-      !!              - updte the ice fraction : fr_i
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt       ! ocean time step
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('sbc')
-      !
-      !                                            ! ---------------------------------------- !
-      IF( kt /= nit000 ) THEN                      !          Swap of forcing fields          !
-         !                                         ! ---------------------------------------- !
-         utau_b(:,:) = utau(:,:)                         ! Swap the ocean forcing fields
-         vtau_b(:,:) = vtau(:,:)                         ! (except at nit000 where before fields
-         qns_b (:,:) = qns (:,:)                         !  are set at the end of the routine)
-         ! The 3D heat content due to qsr forcing is treated in traqsr
-         ! qsr_b (:,:) = qsr (:,:)
-         emp_b(:,:) = emp(:,:)
-         sfx_b(:,:) = sfx(:,:)
-      ENDIF
-      !                                            ! ---------------------------------------- !
-      !                                            !        forcing field computation         !
-      !                                            ! ---------------------------------------- !
-      !
-      IF( ln_apr_dyn ) CALL sbc_apr( kt )                ! atmospheric pressure provided at kt+0.5*nn_fsbc
-                                                         ! (caution called before sbc_ssm)
-      !
-      CALL sbc_ssm( kt )                                 ! ocean sea surface variables (sst_m, sss_m, ssu_m, ssv_m)
-      !                                                  ! averaged over nf_sbc time-step
-
-      IF (ln_wave) CALL sbc_wave( kt )
-                                                   !==  sbc formulation  ==!
-                                                            
-      SELECT CASE( nsbc )                                ! Compute ocean surface boundary condition
-      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, sfx)
-      CASE(  0 )   ;   CALL sbc_gyre    ( kt )                    ! analytical formulation : GYRE configuration
-      CASE(  1 )   ;   CALL sbc_ana     ( kt )                    ! analytical formulation : uniform sbc
-      CASE(  2 )   ;   CALL sbc_flx     ( kt )                    ! flux formulation
-      CASE(  3 )   ;   CALL sbc_blk_clio( kt )                    ! bulk formulation : CLIO for the ocean
-      CASE(  4 )   ;   CALL sbc_blk_core( kt )                    ! bulk formulation : CORE for the ocean
-      CASE(  5 )   ;   CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   ! coupled formulation
-      CASE(  6 )   ;   CALL sbc_blk_mfs ( kt )                    ! bulk formulation : MFS for the ocean
-      CASE( -1 )                                
-                       CALL sbc_ana     ( kt )                    ! ESOPA, test ALL the formulations
-                       CALL sbc_gyre    ( kt )                    !
-                       CALL sbc_flx     ( kt )                    !
-                       CALL sbc_blk_clio( kt )                    !
-                       CALL sbc_blk_core( kt )                    !
-                       CALL sbc_cpl_rcv ( kt, nn_fsbc, nn_ice )   !
-      END SELECT
-
-      !                                            !==  Misc. Options  ==!
-      
-      SELECT CASE( nn_ice )                                       ! Update heat and freshwater fluxes over sea-ice areas
-      CASE(  1 )   ;         CALL sbc_ice_if   ( kt )                ! Ice-cover climatology ("Ice-if" model)
-      CASE(  2 )   ;         CALL sbc_ice_lim_2( kt, nsbc )          ! LIM-2 ice model
-      CASE(  3 )   ;         CALL sbc_ice_lim  ( kt, nsbc )          ! LIM-3 ice model
-      !is it useful?
-      CASE(  4 )   ;         CALL sbc_ice_cice ( kt, nsbc )          ! CICE ice model
-      END SELECT                                              
-
-      IF( ln_icebergs    )   CALL icb_stp( kt )                   ! compute icebergs
-
-      IF( ln_rnf         )   CALL sbc_rnf( kt )                   ! add runoffs to fresh water fluxes
- 
-      IF( ln_ssr         )   CALL sbc_ssr( kt )                   ! add SST/SSS damping term
-
-      IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )  ! control the freshwater budget
-
-      IF( nn_closea == 1 )   CALL sbc_clo( kt )                   ! treatment of closed sea in the model domain 
-      !                                                           ! (update freshwater fluxes)
-!RBbug do not understand why see ticket 667
-      !clem-bugsal CALL lbc_lnk( emp, 'T', 1. )
-      !
-      IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
-         !                                             ! ---------------------------------------- !
-         IF( ln_rstart .AND.    &                               !* Restart: read in restart file
-            & iom_varid( numror, 'utau_b', ldstop = .FALSE. ) > 0 ) THEN 
-            IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields red in the restart file'
-            CALL iom_get( numror, jpdom_autoglo, 'utau_b', utau_b )   ! before i-stress  (U-point)
-            CALL iom_get( numror, jpdom_autoglo, 'vtau_b', vtau_b )   ! before j-stress  (V-point)
-            CALL iom_get( numror, jpdom_autoglo, 'qns_b' , qns_b  )   ! before non solar heat flux (T-point)
-            ! The 3D heat content due to qsr forcing is treated in traqsr
-            ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b  ) ! before     solar heat flux (T-point)
-            CALL iom_get( numror, jpdom_autoglo, 'emp_b', emp_b  )    ! before     freshwater flux (T-point)
-            ! To ensure restart capability with 3.3x/3.4 restart files    !! to be removed in v3.6
-            IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN
-               CALL iom_get( numror, jpdom_autoglo, 'sfx_b', sfx_b )  ! before salt flux (T-point)
-            ELSE
-               sfx_b (:,:) = sfx(:,:)
-            ENDIF
-         ELSE                                                   !* no restart: set from nit000 values
-            IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields set to nit000'
-            utau_b(:,:) = utau(:,:) 
-            vtau_b(:,:) = vtau(:,:)
-            qns_b (:,:) = qns (:,:)
-            emp_b (:,:) = emp(:,:)
-            sfx_b (:,:) = sfx(:,:)
-         ENDIF
-      ENDIF
-      !                                                ! ---------------------------------------- !
-      IF( lrst_oce ) THEN                              !      Write in the ocean restart file     !
-         !                                             ! ---------------------------------------- !
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'sbc : ocean surface forcing fields written in ocean restart file ',   &
-            &                    'at it= ', kt,' date= ', ndastp
-         IF(lwp) WRITE(numout,*) '~~~~'
-         CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau )
-         CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau )
-         CALL iom_rstput( kt, nitrst, numrow, 'qns_b'  , qns  )
-         ! The 3D heat content due to qsr forcing is treated in traqsr
-         ! CALL iom_rstput( kt, nitrst, numrow, 'qsr_b'  , qsr  )
-         CALL iom_rstput( kt, nitrst, numrow, 'emp_b'  , emp  )
-         CALL iom_rstput( kt, nitrst, numrow, 'sfx_b' , sfx )
-      ENDIF
-
-      !                                                ! ---------------------------------------- !
-      !                                                !        Outputs and control print         !
-      !                                                ! ---------------------------------------- !
-      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
-         CALL iom_put( "empmr" , emp  - rnf )                   ! upward water flux
-         CALL iom_put( "saltflx", sfx  )                        ! downward salt flux  
-                                                                ! (includes virtual salt flux beneath ice 
-                                                                ! in linear free surface case)
-         CALL iom_put( "fmmflx", fmmflx  )                      ! Freezing-melting water flux
-         CALL iom_put( "qt"    , qns  + qsr )                   ! total heat flux 
-         CALL iom_put( "qns"   , qns        )                   ! solar heat flux
-         CALL iom_put( "qsr"   ,       qsr  )                   ! solar heat flux
-         IF( nn_ice > 0 )   CALL iom_put( "ice_cover", fr_i )   ! ice fraction 
-      ENDIF
-      !
-      CALL iom_put( "utau", utau )   ! i-wind stress   (stress can be updated at 
-      CALL iom_put( "vtau", vtau )   ! j-wind stress    each time step in sea-ice)
-      CALL iom_put( "taum", taum )   ! wind stress module 
-      CALL iom_put( "wspd", wndm )   ! wind speed  module 
-      !
-      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-         CALL prt_ctl(tab2d_1=fr_i             , clinfo1=' fr_i     - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=(emp-rnf)        , clinfo1=' emp-rnf  - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=(sfx-rnf)        , clinfo1=' sfx-rnf  - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=qns              , clinfo1=' qns      - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr      - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab3d_1=tmask            , clinfo1=' tmask    - : ', mask1=tmask, ovlap=1, kdim=jpk )
-         CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_tem), clinfo1=' sst      - : ', mask1=tmask, ovlap=1, kdim=1   )
-         CALL prt_ctl(tab3d_1=tsn(:,:,:,jp_sal), clinfo1=' sss      - : ', mask1=tmask, ovlap=1, kdim=1   )
-         CALL prt_ctl(tab2d_1=utau             , clinfo1=' utau     - : ', mask1=umask,                      &
-            &         tab2d_2=vtau             , clinfo2=' vtau     - : ', mask2=vmask, ovlap=1 )
-      ENDIF
-
-      IF( kt == nitend )   CALL sbc_final         ! Close down surface module if necessary
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('sbc')
-      !
-   END SUBROUTINE sbc
-
-
-   SUBROUTINE sbc_final
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE sbc_final  ***
-      !!
-      !! ** Purpose :   Finalize CICE (if used)
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_ice == 4 )   CALL cice_sbc_final
-      !
-   END SUBROUTINE sbc_final
-
-   !!======================================================================
-END MODULE sbcmod
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/step_oce.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/step_oce.F90	(revision 2446)
+++ 	(revision )
@@ -1,126 +1,0 @@
-MODULE step_oce
-   !!======================================================================
-   !!                       ***  MODULE step_oce  ***
-   !! Ocean time-stepping : module used in both initialisation phase and time stepping
-   !!======================================================================
-   !! History :   3.3  ! 2010-08  (C. Ethe)  Original code - reorganisation of the initial phase
-   !!----------------------------------------------------------------------
-   USE oce              ! ocean dynamics and tracers variables
-   USE dom_oce          ! ocean space and time domain variables
-   USE zdf_oce          ! ocean vertical physics variables
-   USE ldftra_oce       ! ocean tracer   - trends
-   USE ldfdyn_oce       ! ocean dynamics - trends
-   USE divcur           ! hor. divergence and curl      (div & cur routines)
-   USE in_out_manager   ! I/O manager
-   USE iom              !
-   USE lbclnk
-   USE restart          ! restart
-#if defined key_iomput
-   USE xios
-#endif
-
-   USE daymod           ! calendar                         (day     routine)
-
-   USE sbcmod           ! surface boundary condition       (sbc     routine)
-   USE sbcrnf           ! surface boundary condition: runoff variables
-   USE sbccpl           ! surface boundary condition: coupled formulation (call send at end of step)
-   USE cpl_oasis3, ONLY : lk_cpl
-   USE sbctide          ! Tide initialisation
-
-   USE traqsr           ! solar radiation penetration      (tra_qsr routine)
-   USE trasbc           ! surface boundary condition       (tra_sbc routine)
-   USE trabbc           ! bottom boundary condition        (tra_bbc routine)
-   USE trabbl           ! bottom boundary layer            (tra_bbl routine)
-   USE tradmp           ! internal damping                 (tra_dmp routine)
-   USE traadv           ! advection scheme control     (tra_adv_ctl routine)
-   USE traldf           ! lateral mixing                   (tra_ldf routine)
-   !   zdfkpp           ! KPP non-local tracer fluxes      (tra_kpp routine)
-   USE trazdf           ! vertical mixing                  (tra_zdf routine)
-   USE tranxt           ! time-stepping                    (tra_nxt routine)
-   USE tranpc           ! non-penetrative convection       (tra_npc routine)
-
-   USE eosbn2           ! equation of state                (eos_bn2 routine)
-
-   USE dynadv           ! advection                        (dyn_adv routine)
-   USE dynbfr           ! Bottom friction terms            (dyn_bfr routine)
-   USE dynvor           ! vorticity term                   (dyn_vor routine)
-   USE dynhpg           ! hydrostatic pressure grad.       (dyn_hpg routine)
-   USE dynldf           ! lateral momentum diffusion       (dyn_ldf routine)
-   USE dynzdf           ! vertical diffusion               (dyn_zdf routine)
-   USE dynspg_oce       ! surface pressure gradient        (dyn_spg routine)
-   USE dynspg           ! surface pressure gradient        (dyn_spg routine)
-   USE dynnept          ! simp. form of Neptune effect(dyn_nept_cor routine)
-
-   USE dynnxt           ! time-stepping                    (dyn_nxt routine)
-
-   USE bdy_par          ! for lk_bdy
-   USE bdy_oce          ! for dmp logical
-   USE bdydta           ! open boundary condition data     (bdy_dta routine)
-   USE bdytra           ! bdy cond. for tracers            (bdy_tra routine)
-   USE bdydyn3d         ! bdy cond. for baroclinic vel.  (bdy_dyn3d routine)
-
-   USE sshwzv           ! vertical velocity and ssh        (ssh_nxt routine)
-   !                                                       (ssh_swp routine)
-   !                                                       (wzv     routine)
-   USE domvvl           ! variable vertical scale factors  (dom_vvl_sf_nxt routine)
-   !                                                       (dom_vvl_sf_swp routine)
-
-   USE ldfslp           ! iso-neutral slopes               (ldf_slp routine)
-   USE ldfeiv           ! eddy induced velocity coef.      (ldf_eiv routine)
-   USE ldftra_smag      ! Smagirinsky diffusion            (ldftra_smag routine)
-   USE ldfdyn_smag      ! Smagorinsky viscosity            (ldfdyn_smag routine) 
-
-   USE zdftmx           ! tide-induced vertical mixing     (zdf_tmx routine)
-   USE zdfbfr           ! bottom friction                  (zdf_bfr routine)
-   USE zdftke           ! TKE vertical mixing              (zdf_tke routine)
-   USE zdfgls           ! GLS vertical mixing              (zdf_gls routine)
-   USE zdfkpp           ! KPP vertical mixing              (zdf_kpp routine)
-   USE zdfddm           ! double diffusion mixing          (zdf_ddm routine)
-   USE zdfevd           ! enhanced vertical diffusion      (zdf_evd routine)
-   USE zdfric           ! Richardson vertical mixing       (zdf_ric routine)
-   USE zdfmxl           ! Mixed-layer depth                (zdf_mxl routine)
-
-   USE zpshde           ! partial step: hor. derivative     (zps_hde routine)
-
-   USE diawri           ! Standard run outputs             (dia_wri routine)
-   USE trdicp           ! Ocean momentum/tracers trends    (trd_wri routine)
-   USE trdmld           ! mixed-layer trends               (trd_mld routine)
-   USE trdmld_rst       ! restart for mixed-layer trends
-   USE trdmod_oce       ! ocean momentum/tracers trends
-   USE trdmod           ! momentum/tracers trends
-   USE trdvor           ! vorticity budget                 (trd_vor routine)
-   USE diaptr_oce       ! poleward transports variables
-   USE diaptr           ! poleward transports              (dia_ptr routine)
-   USE diadct           ! sections transports              (dia_dct routine)
-   USE diaar5           ! AR5 diagnosics                   (dia_ar5 routine)
-   USE diahth           ! thermocline depth                (dia_hth routine)
-   USE diafwb           ! freshwater budget                (dia_fwb routine)
-   USE diahsb           ! heat, salt and volume budgets    (dia_hsb routine)
-   USE diaharm
-   USE flo_oce          ! floats variables
-   USE floats           ! floats computation               (flo_stp routine)
-
-   USE crsfld           ! Standard output on coarse grid   (crs_fld routine)
-
-   USE asminc           ! assimilation increments      (tra_asm_inc routine)
-   !                                                   (dyn_asm_inc routine)
-   USE asmbkg
-   USE stpctl           ! time stepping control            (stp_ctl routine)
-   USE prtctl           ! Print control                    (prt_ctl routine)
-
-   USE diaobs           ! Observation operator
-
-   USE timing           ! Timing
-
-#if defined key_agrif
-   USE agrif_opa_sponge ! Momemtum and tracers sponges
-#endif
-#if defined key_top
-   USE trcstp           ! passive tracer time-stepping      (trc_stp routine)
-#endif
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: step_oce.F90 4328 2013-12-06 10:25:13Z davestorkey $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!======================================================================
-END MODULE step_oce
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_cen2.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_cen2.F90	(revision 2446)
+++ 	(revision )
@@ -1,357 +1,0 @@
-MODULE traadv_cen2
-   !!======================================================================
-   !!                     ***  MODULE  traadv_cen2  ***
-   !! Ocean  tracers:  horizontal & vertical advective trend
-   !!======================================================================
-   !! History :  8.2  ! 2001-08  (G. Madec, E. Durand)  trahad+trazad=traadv 
-   !!            1.0  ! 2002-06  (G. Madec)  F90: Free form and module
-   !!            9.0  ! 2004-08  (C. Talandier) New trends organization
-   !!             -   ! 2005-11  (V. Garnier) Surface pressure gradient organization
-   !!            2.0  ! 2006-04  (R. Benshila, G. Madec) Step reorganization
-   !!             -   ! 2006-07  (G. madec)  add ups_orca_set routine
-   !!            3.2  ! 2009-07  (G. Madec) add avmb, avtb in restart for cen2 advection
-   !!            3.3  ! 2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_cen2 : update the tracer trend with the advection trends using a 2nd order centered scheme
-   !!   ups_orca_set : allow mixed upstream/centered scheme in specific area (set for orca 2 and 4 only)
-   !!----------------------------------------------------------------------
-   USE oce, ONLY: tsn  ! now ocean temperature and salinity
-   USE dom_oce         ! ocean space and time domain
-   USE eosbn2          ! equation of state
-   USE trdmod_oce      ! tracers trends
-   USE trdtra          ! tracers trends
-   USE closea          ! closed sea
-   USE sbcrnf          ! river runoffs
-   USE in_out_manager  ! I/O manager
-   USE iom             ! IOM library
-   USE diaptr_oce      ! poleward transport diagnostics
-   USE zdf_oce         ! ocean vertical physics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_cen2       ! routine called by step.F90
-   PUBLIC   ups_orca_set       ! routine used by traadv_cen2_jki.F90
-
-   LOGICAL  :: l_trd       ! flag to compute trends
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: upsmsk !: mixed upstream/centered scheme near some straits 
-   !                                                             !  and in closed seas (orca 2 and 4 configurations)
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_cen2.F90 4499 2014-02-18 15:14:31Z timgraham $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_cen2( kt, kit000, cdtype, pun, pvn, pwn,     &
-      &                                 ptb, ptn, pta, kjpt   ) 
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_adv_cen2  ***
-      !!                 
-      !! ** Purpose :   Compute the now trend due to the advection of tracers
-      !!      and add it to the general trend of passive tracer equations.
-      !!
-      !! ** Method  :   The advection is evaluated by a second order centered
-      !!      scheme using now fields (leap-frog scheme). In specific areas
-      !!      (vicinity of major river mouths, some straits, or where tn is
-      !!      approaching the freezing point) it is mixed with an upstream
-      !!      scheme for stability reasons.
-      !!         Part 0 : compute the upstream / centered flag
-      !!                  (3D array, zind, defined at T-point (0<zind<1))
-      !!         Part I : horizontal advection
-      !!       * centered flux:
-      !!               zcenu = e2u*e3u  un  mi(ptn)
-      !!               zcenv = e1v*e3v  vn  mj(ptn)
-      !!       * upstream flux:
-      !!               zupsu = e2u*e3u  un  (ptb(i) or ptb(i-1) ) [un>0 or <0]
-      !!               zupsv = e1v*e3v  vn  (ptb(j) or ptb(j-1) ) [vn>0 or <0]
-      !!       * mixed upstream / centered horizontal advection scheme
-      !!               zcofi = max(zind(i+1), zind(i))
-      !!               zcofj = max(zind(j+1), zind(j))
-      !!               zwx = zcofi * zupsu + (1-zcofi) * zcenu
-      !!               zwy = zcofj * zupsv + (1-zcofj) * zcenv
-      !!       * horizontal advective trend (divergence of the fluxes)
-      !!               ztra = 1/(e1t*e2t*e3t) { di-1[zwx] + dj-1[zwy] }
-      !!       * Add this trend now to the general trend of tracer (ta,sa):
-      !!               pta = pta + ztra
-      !!       * trend diagnostic ('key_trdtra' defined): the trend is
-      !!      saved for diagnostics. The trends saved is expressed as
-      !!      Uh.gradh(T), i.e.
-      !!                     save trend = ztra + ptn divn
-      !!
-      !!         Part II : vertical advection
-      !!      For temperature (idem for salinity) the advective trend is com-
-      !!      puted as follows :
-      !!            ztra = 1/e3t dk+1[ zwz ]
-      !!      where the vertical advective flux, zwz, is given by :
-      !!            zwz = zcofk * zupst + (1-zcofk) * zcent
-      !!      with
-      !!        zupsv = upstream flux = wn * (ptb(k) or ptb(k-1) ) [wn>0 or <0]
-      !!        zcenu = centered flux = wn * mk(tn)
-      !!         The surface boundary condition is :
-      !!      variable volume (lk_vvl = T) : zero advective flux
-      !!      lin. free-surf  (lk_vvl = F) : wn(:,:,1) * ptn(:,:,1)
-      !!         Add this trend now to the general trend of tracer (ta,sa):
-      !!             pta = pta + ztra
-      !!         Trend diagnostic ('key_trdtra' defined): the trend is
-      !!      saved for diagnostics. The trends saved is expressed as :
-      !!             save trend =  w.gradz(T) = ztra - ptn divn.
-      !!
-      !! ** Action :  - update pta  with the now advective tracer trends
-      !!              - save trends if needed
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx => ua        , zwy  => va          ! (ua,va) used as 3D workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-      !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      INTEGER  ::   ierr             ! local integer
-      REAL(wp) ::   zbtr, ztra                            ! local scalars
-      REAL(wp) ::   zfp_ui, zfp_vj, zfp_w, zcofi          !   -      -
-      REAL(wp) ::   zfm_ui, zfm_vj, zfm_w, zcofj, zcofk   !   -      -
-      REAL(wp) ::   zupsut, zcenut, zupst                 !   -      -
-      REAL(wp) ::   zupsvt, zcenvt, zcent, zice           !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: ztfreez 
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwz, zind
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_cen2')
-      !
-      CALL wrk_alloc( jpi, jpj, ztfreez )
-      CALL wrk_alloc( jpi, jpj, jpk, zwz, zind )
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv_cen2 : 2nd order centered advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~ '
-         IF(lwp) WRITE(numout,*)
-         !
-         IF ( .NOT. ALLOCATED( upsmsk ) )  THEN
-             ALLOCATE( upsmsk(jpi,jpj), STAT=ierr )
-             IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_cen2: unable to allocate array')
-         ENDIF
-
-         !
-         upsmsk(:,:) = 0._wp                             ! not upstream by default
-         ! 
-         IF( cp_cfg == "orca" )   CALL ups_orca_set      ! set mixed Upstream/centered scheme near some straits
-         !                                               ! and in closed seas (orca2 and orca4 only)
-         IF( jp_cfg == 2 .AND. .NOT. ln_rstart ) THEN    ! Increase the background in the surface layers
-            avmb(1) = 10.  * avmb(1)      ;      avtb(1) = 10.  * avtb(1)
-            avmb(2) = 10.  * avmb(2)      ;      avtb(2) = 10.  * avtb(2)
-            avmb(3) =  5.  * avmb(3)      ;      avtb(3) =  5.  * avtb(3)
-            avmb(4) =  2.5 * avmb(4)      ;      avtb(4) =  2.5 * avtb(4)
-         ENDIF
-      ENDIF
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) )   l_trd = .TRUE.
-      !
-      ! Upstream / centered scheme indicator
-      ! ------------------------------------
-!!gm  not strickly exact : the freezing point should be computed at each ocean levels...
-!!gm  not a big deal since cen2 is no more used in global ice-ocean simulations
-      ztfreez(:,:) = tfreez( tsn(:,:,1,jp_sal) )
-      DO jk = 1, jpk
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               !                                        ! below ice covered area (if tn < "freezing"+0.1 )
-               IF( tsn(ji,jj,jk,jp_tem) <= ztfreez(ji,jj) + 0.1 ) THEN   ;   zice = 1.e0
-               ELSE                                                      ;   zice = 0.e0
-               ENDIF
-               zind(ji,jj,jk) = MAX (   &
-                  rnfmsk(ji,jj) * rnfmsk_z(jk),      &  ! near runoff mouths (& closed sea outflows)
-                  upsmsk(ji,jj)               ,      &  ! some of some straits
-                  zice                               &  ! below ice covered area (if tn < "freezing"+0.1 )
-                  &                  ) * tmask(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      DO jn = 1, kjpt
-         !
-         ! I. Horizontal advection
-         !    ====================
-         !
-         DO jk = 1, jpkm1
-            !                        ! Second order centered tracer flux at u- and v-points
-            DO jj = 1, jpjm1
-               !
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  ! upstream indicator
-                  zcofi = MAX( zind(ji+1,jj,jk), zind(ji,jj,jk) )
-                  zcofj = MAX( zind(ji,jj+1,jk), zind(ji,jj,jk) )
-                  !
-                  ! upstream scheme
-                  zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) )
-                  zfm_ui = pun(ji,jj,jk) - ABS( pun(ji,jj,jk) )
-                  zfp_vj = pvn(ji,jj,jk) + ABS( pvn(ji,jj,jk) )
-                  zfm_vj = pvn(ji,jj,jk) - ABS( pvn(ji,jj,jk) )
-                  zupsut = zfp_ui * ptb(ji,jj,jk,jn) + zfm_ui * ptb(ji+1,jj  ,jk,jn)
-                  zupsvt = zfp_vj * ptb(ji,jj,jk,jn) + zfm_vj * ptb(ji  ,jj+1,jk,jn)
-                  ! centered scheme
-                  zcenut = pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj  ,jk,jn) )
-                  zcenvt = pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji  ,jj+1,jk,jn) )
-                  ! mixed centered / upstream scheme
-                  zwx(ji,jj,jk) = 0.5 * ( zcofi * zupsut + (1.-zcofi) * zcenut )
-                  zwy(ji,jj,jk) = 0.5 * ( zcofj * zupsvt + (1.-zcofj) * zcenvt )
-               END DO
-            END DO
-         END DO
-
-         ! II. Vertical advection
-         !     ==================
-         !
-         !                                                ! Vertical advective fluxes
-         zwz(:,:,jpk) = 0.e0                                   ! Bottom  value : flux set to zero
-         !                                                     ! Surface value : 
-         IF( lk_vvl ) THEN   ;   zwz(:,:, 1 ) = 0.e0                         ! volume variable
-         ELSE                ;   zwz(:,:, 1 ) = pwn(:,:,1) * ptn(:,:,1,jn)   ! linear free surface 
-         ENDIF
-         !
-         DO jk = 2, jpk              ! Second order centered tracer flux at w-point
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! upstream indicator
-                  zcofk = MAX( zind(ji,jj,jk-1), zind(ji,jj,jk) ) 
-                  ! mixed centered / upstream scheme
-                  zfp_w = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) )
-                  zfm_w = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) )
-                  zupst = zfp_w * ptb(ji,jj,jk,jn) + zfm_w * ptb(ji,jj,jk-1,jn)
-                  ! centered scheme
-                  zcent = pwn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj,jk-1,jn) )
-                  ! mixed centered / upstream scheme
-                  zwz(ji,jj,jk) = 0.5 * ( zcofk * zupst + (1.-zcofk) * zcent )
-               END DO
-            END DO
-         END DO
-
-         ! II. Divergence of advective fluxes
-         ! ----------------------------------
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) *  fse3t(ji,jj,jk) )
-                  ! advective trends
-                  ztra = - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
-                  &                + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
-                  &                + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1)  )
-                  ! advective trends added to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd ) THEN
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) )
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) )
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwz, pwn, ptn(:,:,:,jn) )
-         END IF
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-           IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-           IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-         !
-      ENDDO
-
-      ! ---------------------------  required in restart file to ensure restartability)
-      ! avmb, avtb will be read in zdfini in restart case as they are used in zdftke, kpp etc...
-      IF( lrst_oce .AND. cdtype == 'TRA' ) THEN
-         CALL iom_rstput( kt, nitrst, numrow, 'avmb', avmb )
-         CALL iom_rstput( kt, nitrst, numrow, 'avtb', avtb )
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj, ztfreez )
-      CALL wrk_dealloc( jpi, jpj, jpk, zwz, zind )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_cen2')
-      !
-   END SUBROUTINE tra_adv_cen2
-   
-   
-   SUBROUTINE ups_orca_set
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE ups_orca_set  ***
-      !!       
-      !! ** Purpose :   add a portion of upstream scheme in area where the
-      !!                centered scheme generates too strong overshoot
-      !!
-      !! ** Method  :   orca (R4 and R2) confiiguration setting. Set upsmsk
-      !!                array to nozero value in some straith. 
-      !!
-      !! ** Action : - upsmsk set to 1 at some strait, 0 elsewhere for orca
-      !!----------------------------------------------------------------------
-      INTEGER  ::   ii0, ii1, ij0, ij1      ! temporary integers
-      !!----------------------------------------------------------------------
-      
-      !
-      IF( nn_timing == 1 )  CALL timing_start('ups_orca_set')
-      !
-      ! mixed upstream/centered scheme near river mouths
-      ! ------------------------------------------------
-      SELECT CASE ( jp_cfg )
-      !                                        ! =======================
-      CASE ( 4 )                               !  ORCA_R4 configuration 
-         !                                     ! =======================
-         !                                          ! Gibraltar Strait
-         ii0 =  70   ;   ii1 =  71
-         ij0 =  52   ;   ij1 =  53   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         !
-         !                                     ! =======================
-      CASE ( 2 )                               !  ORCA_R2 configuration 
-         !                                     ! =======================
-         !                                          ! Gibraltar Strait
-         ij0 = 102   ;   ij1 = 102
-         ii0 = 138   ;   ii1 = 138   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.20
-         ii0 = 139   ;   ii1 = 139   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
-         ii0 = 140   ;   ii1 = 140   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         ij0 = 101   ;   ij1 = 102
-         ii0 = 141   ;   ii1 = 141   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         !                                          ! Bab el Mandeb Strait
-         ij0 =  87   ;   ij1 =  88
-         ii0 = 164   ;   ii1 = 164   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.10
-         ij0 =  88   ;   ij1 =  88
-         ii0 = 163   ;   ii1 = 163   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         ii0 = 162   ;   ii1 = 162   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
-         ii0 = 160   ;   ii1 = 161   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         ij0 =  89   ;   ij1 =  89
-         ii0 = 158   ;   ii1 = 160   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         ij0 =  90   ;   ij1 =  90
-         ii0 = 160   ;   ii1 = 160   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         !                                          ! Sound Strait
-         ij0 = 116   ;   ij1 = 116
-         ii0 = 144   ;   ii1 = 144   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         ii0 = 145   ;   ii1 = 147   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         ii0 = 148   ;   ii1 = 148   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         !
-      END SELECT 
-      
-      ! mixed upstream/centered scheme over closed seas
-      ! -----------------------------------------------
-      CALL clo_ups( upsmsk(:,:) )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('ups_orca_set')
-      !
-   END SUBROUTINE ups_orca_set
-
-   !!======================================================================
-END MODULE traadv_cen2
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_muscl.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_muscl.F90	(revision 2446)
+++ 	(revision )
@@ -1,307 +1,0 @@
-MODULE traadv_muscl
-   !!======================================================================
-   !!                       ***  MODULE  traadv_muscl  ***
-   !! Ocean  tracers:  horizontal & vertical advective trend
-   !!======================================================================
-   !! History :       !  2000-06  (A.Estublier)  for passive tracers
-   !!                 !  2001-08  (E.Durand, G.Madec)  adapted for T & S
-   !!   NEMO     1.0  !  2002-06  (G. Madec)  F90: Free form and module
-   !!            3.2  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!            3.4  !  2012-06  (P. Oddo, M. Vichi) include the upstream where needed
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_muscl : update the tracer trend with the horizontal
-   !!                   and vertical advection trends using MUSCL scheme
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and active tracers
-   USE dom_oce        ! ocean space and time domain
-   USE trdmod_oce     ! tracers trends 
-   USE trdtra         ! tracers trends 
-   USE in_out_manager ! I/O manager
-   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
-   USE trabbl         ! tracers: bottom boundary layer
-   USE lib_mpp        ! distribued memory computing
-   USE lbclnk         ! ocean lateral boundary condition (or mpp link) 
-   USE diaptr_oce         ! poleward transport diagnostics
-   USE trc_oce        ! share passive tracers/Ocean variables
-   USE wrk_nemo       ! Memory Allocation
-   USE timing         ! Timing
-   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-   USE eosbn2          ! equation of state
-   USE sbcrnf          ! river runoffs
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_muscl  ! routine called by step.F90
-
-   LOGICAL  :: l_trd                        ! flag to compute trends
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: upsmsk !: mixed upstream/centered scheme near some straits
-   !                                                             !  and in closed seas (orca 2 and 4 configurations)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xind         !: mixed upstream/centered index
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_muscl.F90 4499 2014-02-18 15:14:31Z timgraham $ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_muscl( kt, kit000, cdtype, p2dt, pun, pvn, pwn, &
-      &                                        ptb, pta, kjpt, ld_msc_ups )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE tra_adv_muscl  ***
-      !!
-      !! ** Purpose :   Compute the now trend due to total advection of T and 
-      !!      S using a MUSCL scheme (Monotone Upstream-centered Scheme for
-      !!      Conservation Laws) and add it to the general tracer trend.
-      !!
-      !! ** Method  : MUSCL scheme plus centered scheme at ocean boundaries
-      !!
-      !! ** Action  : - update (ta,sa) with the now advective tracer trends
-      !!              - save trends 
-      !!
-      !! References : Estubier, A., and M. Levy, Notes Techn. Pole de Modelisation
-      !!              IPSL, Sept. 2000 (http://www.lodyc.jussieu.fr/opa)
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx   => ua    , zwy   => va          ! (ua,va) used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      LOGICAL                              , INTENT(in   ) ::   ld_msc_ups      ! use upstream scheme within muscl
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb             ! before tracer field
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-
-      !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::   zu, z0u, zzwx, zw         ! local scalars
-      REAL(wp) ::   zv, z0v, zzwy, z0w        !   -      -
-      REAL(wp) ::   ztra, zbtr, zdt, zalpha   !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zslpx, zslpy
-      INTEGER  ::   ierr
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_muscl')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zslpx, zslpy )
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv : MUSCL advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '        : mixed up-stream           ', ld_msc_ups
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-         IF(lwp) WRITE(numout,*)
-         !
-         !
-         IF( ld_msc_ups ) THEN
-            IF( .NOT. ALLOCATED( upsmsk ) )  THEN
-                ALLOCATE( upsmsk(jpi,jpj), STAT=ierr )
-                IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_muscl: unable to allocate upsmsk array')
-            ENDIF
-            upsmsk(:,:) = 0._wp                             ! not upstream by default
-         ENDIF
-
-         IF( .NOT. ALLOCATED( xind ) ) THEN
-             ALLOCATE( xind(jpi,jpj,jpk), STAT=ierr )
-             IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_muscl: unable to allocate zind array')
-         ENDIF
-         !
-
-         !
-         ! Upstream / centered scheme indicator
-         ! ------------------------------------
-         xind(:,:,:) = 1._wp                             ! set equal to 1 where up-stream is not needed
-         !
-         IF( ld_msc_ups )  THEN
-            DO jk = 1, jpk
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     xind(ji,jj,jk) = 1  - MAX (           &
-                        rnfmsk(ji,jj) * rnfmsk_z(jk),      &  ! near runoff mouths (& closed sea outflows)
-                        upsmsk(ji,jj) ) * tmask(ji,jj,jk)     ! some of some straits
-                  END DO
-               END DO
-            END DO
-         ENDIF 
-         !
-      ENDIF 
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
-      
-      !                                                     ! ===========
-      DO jn = 1, kjpt                                       ! tracer loop
-         !                                                  ! ===========
-         ! I. Horizontal advective fluxes
-         ! ------------------------------
-         ! first guess of the slopes
-         zwx(:,:,jpk) = 0.e0   ;   zwy(:,:,jpk) = 0.e0        ! bottom values
-         ! interior values
-         DO jk = 1, jpkm1
-            DO jj = 1, jpjm1      
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zwx(ji,jj,jk) = umask(ji,jj,jk) * ( ptb(ji+1,jj,jk,jn) - ptb(ji,jj,jk,jn) )
-                  zwy(ji,jj,jk) = vmask(ji,jj,jk) * ( ptb(ji,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
-               END DO
-           END DO
-         END DO
-         !
-         CALL lbc_lnk( zwx, 'U', -1. )                        ! lateral boundary conditions on zwx, zwy   (changed sign)
-         CALL lbc_lnk( zwy, 'V', -1. )
-         !                                             !-- Slopes of tracer
-         zslpx(:,:,jpk) = 0.e0   ;   zslpy(:,:,jpk) = 0.e0    ! bottom values
-         DO jk = 1, jpkm1                                     ! interior values
-            DO jj = 2, jpj
-               DO ji = fs_2, jpi   ! vector opt.
-                  zslpx(ji,jj,jk) =                    ( zwx(ji,jj,jk) + zwx(ji-1,jj  ,jk) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji-1,jj  ,jk) ) )
-                  zslpy(ji,jj,jk) =                    ( zwy(ji,jj,jk) + zwy(ji  ,jj-1,jk) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwy(ji,jj,jk) * zwy(ji  ,jj-1,jk) ) )
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1                                     ! Slopes limitation
-            DO jj = 2, jpj
-               DO ji = fs_2, jpi   ! vector opt.
-                  zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji  ,jj,jk) ),   &
-                     &                                                 2.*ABS( zwx  (ji-1,jj,jk) ),   &
-                     &                                                 2.*ABS( zwx  (ji  ,jj,jk) ) )
-                  zslpy(ji,jj,jk) = SIGN( 1., zslpy(ji,jj,jk) ) * MIN(    ABS( zslpy(ji,jj  ,jk) ),   &
-                     &                                                 2.*ABS( zwy  (ji,jj-1,jk) ),   &
-                     &                                                 2.*ABS( zwy  (ji,jj  ,jk) ) )
-               END DO
-           END DO
-         END DO             ! interior values
-
-         !                                             !-- MUSCL horizontal advective fluxes
-         DO jk = 1, jpkm1                                     ! interior values
-            zdt  = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! MUSCL fluxes
-                  z0u = SIGN( 0.5, pun(ji,jj,jk) )
-                  zalpha = 0.5 - z0u
-                  zu  = z0u - 0.5 * pun(ji,jj,jk) * zdt / ( e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk) )
-                  zzwx = ptb(ji+1,jj,jk,jn) + xind(ji,jj,jk) * (zu * zslpx(ji+1,jj,jk))
-                  zzwy = ptb(ji  ,jj,jk,jn) + xind(ji,jj,jk) * (zu * zslpx(ji  ,jj,jk))
-                  zwx(ji,jj,jk) = pun(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-                  !
-                  z0v = SIGN( 0.5, pvn(ji,jj,jk) )
-                  zalpha = 0.5 - z0v
-                  zv  = z0v - 0.5 * pvn(ji,jj,jk) * zdt / ( e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk) )
-                  zzwx = ptb(ji,jj+1,jk,jn) + xind(ji,jj,jk) * (zv * zslpy(ji,jj+1,jk))
-                  zzwy = ptb(ji,jj  ,jk,jn) + xind(ji,jj,jk) * (zv * zslpy(ji,jj  ,jk))
-                  zwy(ji,jj,jk) = pvn(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-               END DO
-            END DO
-         END DO
-         !                                                    ! lateral boundary conditions on zwx, zwy   (changed sign)
-         CALL lbc_lnk( zwx, 'U', -1. )   ;   CALL lbc_lnk( zwy, 'V', -1. )
-         !
-         ! Tracer flux divergence at t-point added to the general trend
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1      
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! horizontal advective trends
-                  ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
-                  &               + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  ) )
-                  ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-           END DO
-         END DO        
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  THEN
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptb(:,:,:,jn) )
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptb(:,:,:,jn) )
-         END IF
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-            IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-            IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-
-         ! II. Vertical advective fluxes
-         ! -----------------------------
-         !                                             !-- first guess of the slopes
-         zwx (:,:, 1 ) = 0.e0    ;    zwx (:,:,jpk) = 0.e0    ! surface & bottom boundary conditions
-         DO jk = 2, jpkm1                                     ! interior values
-            zwx(:,:,jk) = tmask(:,:,jk) * ( ptb(:,:,jk-1,jn) - ptb(:,:,jk,jn) )
-         END DO
-
-         !                                             !-- Slopes of tracer
-         zslpx(:,:,1) = 0.e0                                  ! surface values
-         DO jk = 2, jpkm1                                     ! interior value
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zslpx(ji,jj,jk) =                    ( zwx(ji,jj,jk) + zwx(ji,jj,jk+1) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji,jj,jk+1) ) )
-               END DO
-            END DO
-         END DO
-         !                                             !-- Slopes limitation
-         DO jk = 2, jpkm1                                     ! interior values
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji,jj,jk  ) ),   &
-                     &                                                 2.*ABS( zwx  (ji,jj,jk+1) ),   &
-                     &                                                 2.*ABS( zwx  (ji,jj,jk  ) )  )
-               END DO
-            END DO
-         END DO
-         !                                             !-- vertical advective flux
-         !                                                    ! surface values  (bottom already set to zero)
-         IF( lk_vvl ) THEN    ;   zwx(:,:, 1 ) = 0.e0                      !  variable volume
-         ELSE                 ;   zwx(:,:, 1 ) = pwn(:,:,1) * ptb(:,:,1,jn)   ! linear free surface
-         ENDIF 
-         !
-         DO jk = 1, jpkm1                                     ! interior values
-            zdt  = p2dt(jk)
-            DO jj = 2, jpjm1      
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3w(ji,jj,jk+1) )
-                  z0w = SIGN( 0.5, pwn(ji,jj,jk+1) )
-                  zalpha = 0.5 + z0w
-                  zw  = z0w - 0.5 * pwn(ji,jj,jk+1) * zdt * zbtr 
-                  zzwx = ptb(ji,jj,jk+1,jn) + xind(ji,jj,jk) * (zw * zslpx(ji,jj,jk+1))
-                  zzwy = ptb(ji,jj,jk  ,jn) + xind(ji,jj,jk) * (zw * zslpx(ji,jj,jk  ))
-                  zwx(ji,jj,jk+1) = pwn(ji,jj,jk+1) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-               END DO 
-            END DO
-         END DO
-
-         ! Compute & add the vertical advective trend
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1      
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! vertical advective trends 
-                  ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji,jj,jk+1) )
-                  ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) =  pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !                                 ! Save the vertical advective trends for diagnostic
-         IF( l_trd ) CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwx, pwn, ptb(:,:,:,jn) )
-         !
-      ENDDO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zslpx, zslpy )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_muscl')
-      !
-   END SUBROUTINE tra_adv_muscl
-
-   !!======================================================================
-END MODULE traadv_muscl
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_muscl2.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_muscl2.F90	(revision 2446)
+++ 	(revision )
@@ -1,297 +1,0 @@
-MODULE traadv_muscl2
-   !!======================================================================
-   !!                       ***  MODULE  traadv_muscl2  ***
-   !! Ocean  tracers:  horizontal & vertical advective trend
-   !!======================================================================
-   !! History :  1.0  !  2002-06  (G. Madec) from traadv_muscl
-   !!            3.2  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_muscl2 : update the tracer trend with the horizontal
-   !!                    and vertical advection trends using MUSCL2 scheme
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trdmod_oce      ! tracers trends 
-   USE trdtra          ! tracers trends 
-   USE in_out_manager  ! I/O manager
-   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
-   USE trabbl          ! tracers: bottom boundary layer
-   USE lib_mpp         ! distribued memory computing
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_muscl2        ! routine called by step.F90
-
-   LOGICAL  :: l_trd       ! flag to compute trends
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_muscl2.F90 4499 2014-02-18 15:14:31Z timgraham $ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_muscl2( kt, kit000, cdtype, p2dt, pun, pvn, pwn,      &
-      &                                         ptb, ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE tra_adv_muscl2  ***
-      !!
-      !! ** Purpose :   Compute the now trend due to total advection of T and 
-      !!      S using a MUSCL scheme (Monotone Upstream-centered Scheme for
-      !!      Conservation Laws) and add it to the general tracer trend.
-      !!
-      !! ** Method  : MUSCL scheme plus centered scheme at ocean boundaries
-      !!
-      !! ** Action  : - update (pta) with the now advective tracer trends
-      !!              - save trends 
-      !!
-      !! References : Estubier, A., and M. Levy, Notes Techn. Pole de Modelisation
-      !!              IPSL, Sept. 2000 (http://www.lodyc.jussieu.fr/opa)
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx   => ua    , zwy   => va         ! (ua,va) used as 3D workspace
-      !!
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn        ! before & now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-      !!
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::   zu, z0u, zzwx, zw         ! local scalars
-      REAL(wp) ::   zv, z0v, zzwy, z0w        !   -      -
-      REAL(wp) ::   ztra, zbtr, zdt, zalpha   !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zslpx, zslpy
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_muscl2')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zslpx, zslpy )
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv_muscl2 : MUSCL2 advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~'
-      ENDIF
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) )   l_trd = .TRUE.
-
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         ! I. Horizontal advective fluxes
-         ! ------------------------------
-         ! first guess of the slopes
-         zwx(:,:,jpk) = 0.e0   ;   zwy(:,:,jpk) = 0.e0        ! bottom values
-         ! interior values
-         DO jk = 1, jpkm1
-            DO jj = 1, jpjm1      
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zwx(ji,jj,jk) = umask(ji,jj,jk) * ( ptb(ji+1,jj,jk,jn) - ptb(ji,jj,jk,jn) )
-                  zwy(ji,jj,jk) = vmask(ji,jj,jk) * ( ptb(ji,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
-               END DO
-           END DO
-         END DO
-         !
-         CALL lbc_lnk( zwx, 'U', -1. )                        ! lateral boundary conditions on zwx, zwy   (changed sign)
-         CALL lbc_lnk( zwy, 'V', -1. )
-         !                                             !-- Slopes of tracer
-         zslpx(:,:,jpk) = 0.e0   ;   zslpy(:,:,jpk) = 0.e0    ! bottom values
-         DO jk = 1, jpkm1                                     ! interior values
-            DO jj = 2, jpj
-               DO ji = fs_2, jpi   ! vector opt.
-                  zslpx(ji,jj,jk) =                    ( zwx(ji,jj,jk) + zwx(ji-1,jj  ,jk) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji-1,jj  ,jk) ) )
-                  zslpy(ji,jj,jk) =                    ( zwy(ji,jj,jk) + zwy(ji  ,jj-1,jk) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwy(ji,jj,jk) * zwy(ji  ,jj-1,jk) ) )
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1                                     ! Slopes limitation
-            DO jj = 2, jpj
-               DO ji = fs_2, jpi   ! vector opt.
-                  zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji  ,jj,jk) ),   &
-                     &                                                 2.*ABS( zwx  (ji-1,jj,jk) ),   &
-                     &                                                 2.*ABS( zwx  (ji  ,jj,jk) ) )
-                  zslpy(ji,jj,jk) = SIGN( 1., zslpy(ji,jj,jk) ) * MIN(    ABS( zslpy(ji,jj  ,jk) ),   &
-                     &                                                 2.*ABS( zwy  (ji,jj-1,jk) ),   &
-                     &                                                 2.*ABS( zwy  (ji,jj  ,jk) ) )
-               END DO
-           END DO
-         END DO             ! interior values
-
-        !                                             !-- MUSCL horizontal advective fluxes
-         DO jk = 1, jpkm1                                     ! interior values
-            zdt  = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! MUSCL fluxes
-                  z0u = SIGN( 0.5, pun(ji,jj,jk) )
-                  zalpha = 0.5 - z0u
-                  zu  = z0u - 0.5 * pun(ji,jj,jk) * zdt / ( e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk) )
-                  zzwx = ptb(ji+1,jj,jk,jn) + zu * zslpx(ji+1,jj,jk)
-                  zzwy = ptb(ji  ,jj,jk,jn) + zu * zslpx(ji  ,jj,jk)
-                  zwx(ji,jj,jk) = pun(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-                  !
-                  z0v = SIGN( 0.5, pvn(ji,jj,jk) )
-                  zalpha = 0.5 - z0v
-                  zv  = z0v - 0.5 * pvn(ji,jj,jk) * zdt / ( e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk) )
-                  zzwx = ptb(ji,jj+1,jk,jn) + zv * zslpy(ji,jj+1,jk)
-                  zzwy = ptb(ji,jj  ,jk,jn) + zv * zslpy(ji,jj  ,jk)
-                  zwy(ji,jj,jk) = pvn(ji,jj,jk) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-               END DO
-            END DO
-         END DO
-
-         !!  centered scheme at lateral b.C. if off-shore velocity
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  IF( umask(ji,jj,jk) == 0. ) THEN
-                     IF( pun(ji+1,jj,jk) > 0. .AND. ji /= jpi ) THEN
-                        zwx(ji+1,jj,jk) = 0.5 * pun(ji+1,jj,jk) * ( ptn(ji+1,jj,jk,jn) + ptn(ji+2,jj,jk,jn) )
-                     ENDIF
-                     IF( pun(ji-1,jj,jk) < 0. ) THEN
-                        zwx(ji-1,jj,jk) = 0.5 * pun(ji-1,jj,jk) * ( ptn(ji-1,jj,jk,jn) + ptn(ji,jj,jk,jn) ) 
-                     ENDIF
-                  ENDIF
-                  IF( vmask(ji,jj,jk) == 0. ) THEN
-                     IF( pvn(ji,jj+1,jk) > 0. .AND. jj /= jpj ) THEN
-                        zwy(ji,jj+1,jk) = 0.5 * pvn(ji,jj+1,jk) * ( ptn(ji,jj+1,jk,jn) + ptn(ji,jj+2,jk,jn) )
-                     ENDIF
-                     IF( pvn(ji,jj-1,jk) < 0. ) THEN
-                        zwy(ji,jj-1,jk) = 0.5 * pvn(ji,jj-1,jk) * ( ptn(ji,jj-1,jk,jn) + ptn(ji,jj,jk,jn) ) 
-                     ENDIF
-                  ENDIF
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zwx, 'U', -1. )   ;   CALL lbc_lnk( zwy, 'V', -1. )   ! lateral boundary condition (changed sign)
-
-         ! Tracer flux divergence at t-point added to the general trend
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! horizontal advective trends 
-                  ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
-                  &               + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  ) )
-                  ! added to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-           END DO
-         END DO
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd ) THEN
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptb(:,:,:,jn) )
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptb(:,:,:,jn) )
-         END IF
-
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN
-            IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-            IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-
-         ! II. Vertical advective fluxes
-         ! -----------------------------
-         !                                             !-- first guess of the slopes
-         zwx (:,:, 1 ) = 0.e0    ;    zwx (:,:,jpk) = 0.e0    ! surface & bottom boundary conditions
-         DO jk = 2, jpkm1                                     ! interior values
-            zwx(:,:,jk) = tmask(:,:,jk) * ( ptb(:,:,jk-1,jn) - ptb(:,:,jk,jn) )
-         END DO
-
-         !                                             !-- Slopes of tracer
-         zslpx(:,:,1) = 0.e0                                  ! surface values
-         DO jk = 2, jpkm1                                     ! interior value
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zslpx(ji,jj,jk) =                    ( zwx(ji,jj,jk) + zwx(ji,jj,jk+1) )   &
-                     &            * ( 0.25 + SIGN( 0.25, zwx(ji,jj,jk) * zwx(ji,jj,jk+1) ) )
-               END DO
-            END DO
-         END DO
-         !                                             !-- Slopes limitation
-         DO jk = 2, jpkm1                                     ! interior values
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zslpx(ji,jj,jk) = SIGN( 1., zslpx(ji,jj,jk) ) * MIN(    ABS( zslpx(ji,jj,jk  ) ),   &
-                     &                                                 2.*ABS( zwx  (ji,jj,jk+1) ),   &
-                     &                                                 2.*ABS( zwx  (ji,jj,jk  ) )  )
-               END DO
-            END DO
-         END DO
-         !                                             !-- vertical advective flux
-         !                                                    ! surface values  (bottom already set to zero)
-         IF( lk_vvl ) THEN    ;   zwx(:,:, 1 ) = 0.e0                      !  variable volume
-         ELSE                 ;   zwx(:,:, 1 ) = pwn(:,:,1) * ptb(:,:,1,jn)   ! linear free surface
-         ENDIF
-         !
-         DO jk = 1, jpkm1                                     ! interior values
-            zdt  = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3w(ji,jj,jk+1) )
-                  z0w = SIGN( 0.5, pwn(ji,jj,jk+1) )
-                  zalpha = 0.5 + z0w
-                  zw  = z0w - 0.5 * pwn(ji,jj,jk+1) * zdt * zbtr
-                  zzwx = ptb(ji,jj,jk+1,jn) + zw * zslpx(ji,jj,jk+1)
-                  zzwy = ptb(ji,jj,jk  ,jn) + zw * zslpx(ji,jj,jk  )
-                  zwx(ji,jj,jk+1) = pwn(ji,jj,jk+1) * ( zalpha * zzwx + (1.-zalpha) * zzwy )
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 2, jpkm1        ! centered near the bottom
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  IF( tmask(ji,jj,jk+1) == 0. ) THEN
-                     IF( pwn(ji,jj,jk) > 0. ) THEN
-                        zwx(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk-1,jn) + ptn(ji,jj,jk,jn) ) 
-                     ENDIF
-                  ENDIF
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1        ! Compute & add the vertical advective trend
-            DO jj = 2, jpjm1      
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! vertical advective trends 
-                  ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji,jj,jk+1) )
-                  ! added to the general tracer trends
-                  pta(ji,jj,jk,jn) =  pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !                       ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwx, pwn, ptb(:,:,:,jn) )
-         !
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zslpx, zslpy )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_muscl2')
-      !
-   END SUBROUTINE tra_adv_muscl2
-
-   !!======================================================================
-END MODULE traadv_muscl2
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_qck.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_qck.F90	(revision 2446)
+++ 	(revision )
@@ -1,485 +1,0 @@
-MODULE traadv_qck
-   !!==============================================================================
-   !!                       ***  MODULE  traadv_qck  ***
-   !! Ocean tracers:  horizontal & vertical advective trend
-   !!==============================================================================
-   !! History :  3.0  !  2008-07  (G. Reffray)  Original code
-   !!            3.3  !  2010-05  (C.Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_qck    : update the tracer trend with the horizontal advection
-   !!                    trends using a 3rd order finite difference scheme
-   !!   tra_adv_qck_i  : apply QUICK scheme in i-direction
-   !!   tra_adv_qck_j  : apply QUICK scheme in j-direction
-   !!   tra_adv_cen2_k : 2nd centered scheme for the vertical advection
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trdmod_oce      ! ocean space and time domain
-   USE trdtra          ! ocean tracers trends 
-   USE trabbl          ! advective term in the BBL
-   USE lib_mpp         ! distribued memory computing
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link)
-   USE dynspg_oce      ! surface pressure gradient variables
-   USE in_out_manager  ! I/O manager
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_qck   ! routine called by step.F90
-
-   LOGICAL  :: l_trd           ! flag to compute trends
-   REAL(wp) :: r1_6 = 1./ 6.   ! 1/6 ratio
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_qck.F90 4499 2014-02-18 15:14:31Z timgraham $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_qck ( kt, kit000, cdtype, p2dt, pun, pvn, pwn,      &
-      &                                       ptb, ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_adv_qck  ***
-      !!
-      !! ** Purpose :   Compute the now trend due to the advection of tracers
-      !!      and add it to the general trend of passive tracer equations.
-      !!
-      !! ** Method :   The advection is evaluated by a third order scheme
-      !!             For a positive velocity u :              u(i)>0
-      !!                                          |--FU--|--FC--|--FD--|------|
-      !!                                             i-1    i      i+1   i+2
-      !!
-      !!             For a negative velocity u :              u(i)<0
-      !!                                          |------|--FD--|--FC--|--FU--|
-      !!                                             i-1    i      i+1   i+2
-      !!             where  FU is the second upwind point
-      !!                    FD is the first douwning point
-      !!                    FC is the central point (or the first upwind point)
-      !!
-      !!      Flux(i) = u(i) * { 0.5(FC+FD)  -0.5C(i)(FD-FC)  -((1-C(i))/6)(FU+FD-2FC) }
-      !!                with C(i)=|u(i)|dx(i)/dt (=Courant number)
-      !!
-      !!         dt = 2*rdtra and the scalar values are tb and sb
-      !!
-      !!       On the vertical, the simple centered scheme used ptn
-      !!
-      !!               The fluxes are bounded by the ULTIMATE limiter to
-      !!             guarantee the monotonicity of the solution and to
-      !!            prevent the appearance of spurious numerical oscillations
-      !!
-      !! ** Action : - update (pta) with the now advective tracer trends
-      !!             - save the trends 
-      !!
-      !! ** Reference : Leonard (1979, 1991)
-      !!----------------------------------------------------------------------
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-      !!----------------------------------------------------------------------
-
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_qck')
-      !
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv_qck : 3rd order quickest advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
-         IF(lwp) WRITE(numout,*)
-      ENDIF
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
-
-      ! I. The horizontal fluxes are computed with the QUICKEST + ULTIMATE scheme
-      CALL tra_adv_qck_i( kt, cdtype, p2dt, pun, ptb, ptn, pta, kjpt ) 
-      CALL tra_adv_qck_j( kt, cdtype, p2dt, pvn, ptb, ptn, pta, kjpt ) 
-
-      ! II. The vertical fluxes are computed with the 2nd order centered scheme
-      CALL tra_adv_cen2_k( kt, cdtype, pwn,         ptn, pta, kjpt )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_qck')
-      !
-   END SUBROUTINE tra_adv_qck
-
-
-   SUBROUTINE tra_adv_qck_i( kt, cdtype, p2dt, pun,                  &
-      &                                        ptb, ptn, pta, kjpt   )
-      !!----------------------------------------------------------------------
-      !!
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx => ua       ! ua used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt       ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun        ! i-velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn   ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend 
-      !!
-      INTEGER  :: ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) :: ztra, zbtr, zdir, zdx, zdt, zmsk   ! local scalars
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zfu, zfc, zfd
-      !----------------------------------------------------------------------
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zfu, zfc, zfd )
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         zfu(:,:,:) = 0.0     ;   zfc(:,:,:) = 0.0  
-         zfd(:,:,:) = 0.0     ;   zwx(:,:,:) = 0.0     
-         !                                                  
-         DO jk = 1, jpkm1                                
-            !                                             
-            !--- Computation of the ustream and downstream value of the tracer and the mask
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! Upstream in the x-direction for the tracer
-                  zfc(ji,jj,jk) = ptb(ji-1,jj,jk,jn)
-                  ! Downstream in the x-direction for the tracer
-                  zfd(ji,jj,jk) = ptb(ji+1,jj,jk,jn)
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zfc(:,:,:), 'T', 1. )   ;   CALL lbc_lnk( zfd(:,:,:), 'T', 1. )   ! Lateral boundary conditions 
-         
-         !
-         ! Horizontal advective fluxes
-         ! ---------------------------
-         !
-         DO jk = 1, jpkm1                             
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.         
-                  zdir = 0.5 + SIGN( 0.5, pun(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  zfu(ji,jj,jk) = zdir * zfc(ji,jj,jk ) + ( 1. - zdir ) * zfd(ji+1,jj,jk)  ! FU in the x-direction for T 
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1  
-            zdt =  p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.   
-                  zdir = 0.5 + SIGN( 0.5, pun(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  zdx = ( zdir * e1t(ji,jj) + ( 1. - zdir ) * e1t(ji+1,jj) ) * e2u(ji,jj) * fse3u(ji,jj,jk)
-                  zwx(ji,jj,jk)  = ABS( pun(ji,jj,jk) ) * zdt / zdx    ! (0<zc_cfl<1 : Courant number on x-direction)
-                  zfc(ji,jj,jk)  = zdir * ptb(ji  ,jj,jk,jn) + ( 1. - zdir ) * ptb(ji+1,jj,jk,jn)  ! FC in the x-direction for T
-                  zfd(ji,jj,jk)  = zdir * ptb(ji+1,jj,jk,jn) + ( 1. - zdir ) * ptb(ji  ,jj,jk,jn)  ! FD in the x-direction for T
-               END DO
-            END DO
-         END DO 
-         !--- Lateral boundary conditions 
-         CALL lbc_lnk( zfu(:,:,:), 'T', 1. )   ;   CALL lbc_lnk( zfd(:,:,:), 'T', 1. )
-         CALL lbc_lnk( zfc(:,:,:), 'T', 1. )   ;   CALL lbc_lnk( zwx(:,:,:), 'T', 1. )
-
-         !--- QUICKEST scheme
-         CALL quickest( zfu, zfd, zfc, zwx )
-         !
-         ! Mask at the T-points in the x-direction (mask=0 or mask=1)
-         DO jk = 1, jpkm1  
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.               
-                  zfu(ji,jj,jk) = tmask(ji-1,jj,jk) + tmask(ji,jj,jk) + tmask(ji+1,jj,jk) - 2.
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zfu(:,:,:), 'T', 1. )      ! Lateral boundary conditions 
-
-         !
-         ! Tracer flux on the x-direction
-         DO jk = 1, jpkm1  
-            !
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.               
-                  zdir = 0.5 + SIGN( 0.5, pun(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  !--- If the second ustream point is a land point
-                  !--- the flux is computed by the 1st order UPWIND scheme
-                  zmsk = zdir * zfu(ji,jj,jk) + ( 1. - zdir ) * zfu(ji+1,jj,jk)
-                  zwx(ji,jj,jk) = zmsk * zwx(ji,jj,jk) + ( 1. - zmsk ) * zfc(ji,jj,jk)
-                  zwx(ji,jj,jk) = zwx(ji,jj,jk) * pun(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !
-         CALL lbc_lnk( zwx(:,:,:), 'T', 1. ) ! Lateral boundary conditions
-         !
-         ! Computation of the trend
-         DO jk = 1, jpkm1  
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.  
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! horizontal advective trends
-                  ztra = - zbtr * ( zwx(ji,jj,jk) - zwx(ji-1,jj,jk) )
-                  !--- add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) )
-         !
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zfu, zfc, zfd )
-      !
-   END SUBROUTINE tra_adv_qck_i
-
-
-   SUBROUTINE tra_adv_qck_j( kt, cdtype, p2dt, pvn,                &
-      &                                        ptb, ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwy => ua       ! ua used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt       ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pvn        ! j-velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn   ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend 
-      !!
-      INTEGER  :: ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) :: ztra, zbtr, zdir, zdx, zdt, zmsk   ! local scalars
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zfu, zfc, zfd
-      !----------------------------------------------------------------------
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zfu, zfc, zfd )
-      !
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         zfu(:,:,:) = 0.0     ;   zfc(:,:,:) = 0.0  
-         zfd(:,:,:) = 0.0     ;   zwy(:,:,:) = 0.0     
-         !                                                  
-         DO jk = 1, jpkm1                                
-            !                                             
-            !--- Computation of the ustream and downstream value of the tracer and the mask
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! Upstream in the x-direction for the tracer
-                  zfc(ji,jj,jk) = ptb(ji,jj-1,jk,jn)
-                  ! Downstream in the x-direction for the tracer
-                  zfd(ji,jj,jk) = ptb(ji,jj+1,jk,jn)
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zfc(:,:,:), 'T', 1. )   ;   CALL lbc_lnk( zfd(:,:,:), 'T', 1. )   ! Lateral boundary conditions 
-
-         
-         !
-         ! Horizontal advective fluxes
-         ! ---------------------------
-         !
-         DO jk = 1, jpkm1                             
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.         
-                  zdir = 0.5 + SIGN( 0.5, pvn(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  zfu(ji,jj,jk) = zdir * zfc(ji,jj,jk ) + ( 1. - zdir ) * zfd(ji,jj+1,jk)  ! FU in the x-direction for T 
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1  
-            zdt =  p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.   
-                  zdir = 0.5 + SIGN( 0.5, pvn(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  zdx = ( zdir * e2t(ji,jj) + ( 1. - zdir ) * e2t(ji,jj+1) ) * e1v(ji,jj) * fse3v(ji,jj,jk)
-                  zwy(ji,jj,jk)  = ABS( pvn(ji,jj,jk) ) * zdt / zdx    ! (0<zc_cfl<1 : Courant number on x-direction)
-                  zfc(ji,jj,jk)  = zdir * ptb(ji,jj  ,jk,jn) + ( 1. - zdir ) * ptb(ji,jj+1,jk,jn)  ! FC in the x-direction for T
-                  zfd(ji,jj,jk)  = zdir * ptb(ji,jj+1,jk,jn) + ( 1. - zdir ) * ptb(ji,jj  ,jk,jn)  ! FD in the x-direction for T
-               END DO
-            END DO
-         END DO
-
-         !--- Lateral boundary conditions 
-         CALL lbc_lnk( zfu(:,:,:), 'T', 1. )      ;     CALL lbc_lnk( zfd(:,:,:), 'T', 1. )
-         CALL lbc_lnk( zfc(:,:,:), 'T', 1. )      ;     CALL lbc_lnk( zwy(:,:,:), 'T', 1. )
-
-         !--- QUICKEST scheme
-         CALL quickest( zfu, zfd, zfc, zwy )
-         !
-         ! Mask at the T-points in the x-direction (mask=0 or mask=1)
-         DO jk = 1, jpkm1  
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.               
-                  zfu(ji,jj,jk) = tmask(ji,jj-1,jk) + tmask(ji,jj,jk) + tmask(ji,jj+1,jk) - 2.
-               END DO
-            END DO
-         END DO
-         !--- Lateral boundary conditions 
-         CALL lbc_lnk( zfu(:,:,:), 'T', 1. ) 
-         !
-         ! Tracer flux on the x-direction
-         DO jk = 1, jpkm1  
-            !
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.               
-                  zdir = 0.5 + SIGN( 0.5, pvn(ji,jj,jk) )   ! if pun > 0 : zdir = 1 otherwise zdir = 0 
-                  !--- If the second ustream point is a land point
-                  !--- the flux is computed by the 1st order UPWIND scheme
-                  zmsk = zdir * zfu(ji,jj,jk) + ( 1. - zdir ) * zfu(ji,jj+1,jk)
-                  zwy(ji,jj,jk) = zmsk * zwy(ji,jj,jk) + ( 1. - zmsk ) * zfc(ji,jj,jk)
-                  zwy(ji,jj,jk) = zwy(ji,jj,jk) * pvn(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !
-         CALL lbc_lnk( zwy(:,:,:), 'T', 1. ) ! Lateral boundary conditions
-         !
-         ! Computation of the trend
-         DO jk = 1, jpkm1  
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.  
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! horizontal advective trends
-                  ztra = - zbtr * ( zwy(ji,jj,jk) - zwy(ji,jj-1,jk) )
-                  !--- add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) )
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-           IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-           IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-         !
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zfu, zfc, zfd )
-      !
-   END SUBROUTINE tra_adv_qck_j
-
-
-   SUBROUTINE tra_adv_cen2_k( kt, cdtype, pwn,           &
-     &                                    ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!
-      !!----------------------------------------------------------------------
-      USE oce, ONLY:   zwz => ua   ! ua used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt       ! ocean time-step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt     ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pwn      ! vertical velocity 
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptn      ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! tracer trend 
-      !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::   zbtr , ztra      ! local scalars
-      !!----------------------------------------------------------------------
-
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         ! 1. Bottom value : flux set to zero
-         zwz(:,:,jpk) = 0.e0             ! Bottom value : flux set to zero
-         !
-         !                                 ! Surface value
-         IF( lk_vvl ) THEN   ;   zwz(:,:, 1 ) = 0.e0                      ! Variable volume : flux set to zero
-         ELSE                ;   zwz(:,:, 1 ) = pwn(:,:,1) * ptn(:,:,1,jn)   ! Constant volume : advective flux through the surface
-         ENDIF
-         !
-         DO jk = 2, jpkm1                  ! Interior point: second order centered tracer flux at w-point
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zwz(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk-1,jn) + ptn(ji,jj,jk,jn) )
-               END DO
-            END DO
-         END DO
-         !
-         DO jk = 1, jpkm1          !==  Tracer flux divergence added to the general trend  ==!
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! k- vertical advective trends 
-                  ztra = - zbtr * ( zwz(ji,jj,jk) - zwz(ji,jj,jk+1) ) 
-                  ! added to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !                                 ! Save the vertical advective trends for diagnostic
-         IF( l_trd )  CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zwz, pwn, ptn(:,:,:,jn) )
-         !
-      END DO
-      !
-   END SUBROUTINE tra_adv_cen2_k
-
-
-   SUBROUTINE quickest( pfu, pfd, pfc, puc )
-      !!----------------------------------------------------------------------
-      !!
-      !! ** Purpose :  Computation of advective flux with Quickest scheme
-      !!
-      !! ** Method :   
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pfu   ! second upwind point
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pfd   ! first douwning point
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pfc   ! the central point (or the first upwind point)
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   puc   ! input as Courant number ; output as flux
-      !!
-      INTEGER  ::  ji, jj, jk               ! dummy loop indices 
-      REAL(wp) ::  zcoef1, zcoef2, zcoef3   ! local scalars          
-      REAL(wp) ::  zc, zcurv, zfho          !   -      -
-      !----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('quickest')
-      !
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zc     = puc(ji,jj,jk)                         ! Courant number
-               zcurv  = pfd(ji,jj,jk) + pfu(ji,jj,jk) - 2. * pfc(ji,jj,jk)
-               zcoef1 = 0.5 *      ( pfc(ji,jj,jk) + pfd(ji,jj,jk) )
-               zcoef2 = 0.5 * zc * ( pfd(ji,jj,jk) - pfc(ji,jj,jk) )
-               zcoef3 = ( 1. - ( zc * zc ) ) * r1_6 * zcurv
-               zfho   = zcoef1 - zcoef2 - zcoef3              !  phi_f QUICKEST 
-               !
-               zcoef1 = pfd(ji,jj,jk) - pfu(ji,jj,jk)
-               zcoef2 = ABS( zcoef1 )
-               zcoef3 = ABS( zcurv )
-               IF( zcoef3 >= zcoef2 ) THEN
-                  zfho = pfc(ji,jj,jk) 
-               ELSE
-                  zcoef3 = pfu(ji,jj,jk) + ( ( pfc(ji,jj,jk) - pfu(ji,jj,jk) ) / MAX( zc, 1.e-9 ) )    ! phi_REF
-                  IF( zcoef1 >= 0. ) THEN
-                     zfho = MAX( pfc(ji,jj,jk), zfho ) 
-                     zfho = MIN( zfho, MIN( zcoef3, pfd(ji,jj,jk) ) ) 
-                  ELSE
-                     zfho = MIN( pfc(ji,jj,jk), zfho ) 
-                     zfho = MAX( zfho, MAX( zcoef3, pfd(ji,jj,jk) ) ) 
-                  ENDIF
-               ENDIF
-               puc(ji,jj,jk) = zfho
-            END DO
-         END DO
-      END DO
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('quickest')
-      !
-   END SUBROUTINE quickest
-
-   !!======================================================================
-END MODULE traadv_qck
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_tvd.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_tvd.F90	(revision 2446)
+++ 	(revision )
@@ -1,364 +1,0 @@
-MODULE traadv_tvd
-   !!==============================================================================
-   !!                       ***  MODULE  traadv_tvd  ***
-   !! Ocean  tracers:  horizontal & vertical advective trend
-   !!==============================================================================
-   !! History :  OPA  !  1995-12  (L. Mortier)  Original code
-   !!                 !  2000-01  (H. Loukos)  adapted to ORCA 
-   !!                 !  2000-10  (MA Foujols E.Kestenare)  include file not routine
-   !!                 !  2000-12  (E. Kestenare M. Levy)  fix bug in trtrd indexes
-   !!                 !  2001-07  (E. Durand G. Madec)  adaptation to ORCA config
-   !!            8.5  !  2002-06  (G. Madec)  F90: Free form and module
-   !!    NEMO    1.0  !  2004-01  (A. de Miranda, G. Madec, J.M. Molines ): advective bbl
-   !!            2.0  !  2008-04  (S. Cravatte) add the i-, j- & k- trends computation
-   !!             -   !  2009-11  (V. Garnier) Surface pressure gradient organization
-   !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_tvd   : update the tracer trend with the 3D advection trends using a TVD scheme
-   !!   nonosc        : compute monotonic tracer fluxes by a non-oscillatory algorithm 
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and active tracers
-   USE dom_oce        ! ocean space and time domain
-   USE trdmod_oce     ! tracers trends
-   USE trdtra         ! tracers trends
-   USE in_out_manager ! I/O manager
-   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
-   USE lib_mpp        ! MPP library
-   USE lbclnk         ! ocean lateral boundary condition (or mpp link) 
-   USE diaptr_oce         ! poleward transport diagnostics
-   USE trc_oce        ! share passive tracers/Ocean variables
-   USE wrk_nemo       ! Memory Allocation
-   USE timing         ! Timing
-   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_tvd    ! routine called by step.F90
-
-   LOGICAL ::   l_trd   ! flag to compute trends
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_tvd.F90 4499 2014-02-18 15:14:31Z timgraham $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_tvd ( kt, kit000, cdtype, p2dt, pun, pvn, pwn,      &
-      &                                       ptb, ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_adv_tvd  ***
-      !! 
-      !! **  Purpose :   Compute the now trend due to total advection of 
-      !!       tracers and add it to the general trend of tracer equations
-      !!
-      !! **  Method  :   TVD scheme, i.e. 2nd order centered scheme with
-      !!       corrected flux (monotonic correction)
-      !!       note: - this advection scheme needs a leap-frog time scheme
-      !!
-      !! ** Action : - update (pta) with the now advective tracer trends
-      !!             - save the trends 
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx => ua        , zwy => va          ! (ua,va) used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-      !
-      INTEGER  ::   ji, jj, jk, jn           ! dummy loop indices  
-      REAL(wp) ::   z2dtt, zbtr, ztra        ! local scalar
-      REAL(wp) ::   zfp_ui, zfp_vj, zfp_wk   !   -      -
-      REAL(wp) ::   zfm_ui, zfm_vj, zfm_wk   !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwi, zwz
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_tvd')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zwi, zwz )
-      !
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv_tvd : TVD advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
-      ENDIF
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
-      !
-      IF( l_trd )  THEN
-         CALL wrk_alloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz )
-         ztrdx(:,:,:) = 0.e0   ;    ztrdy(:,:,:) = 0.e0   ;   ztrdz(:,:,:) = 0.e0
-      ENDIF
-      !
-      zwi(:,:,:) = 0.e0
-      !
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         ! 1. Bottom value : flux set to zero
-         ! ----------------------------------
-         zwx(:,:,jpk) = 0.e0    ;    zwz(:,:,jpk) = 0.e0
-         zwy(:,:,jpk) = 0.e0    ;    zwi(:,:,jpk) = 0.e0
-
-         ! 2. upstream advection with initial mass fluxes & intermediate update
-         ! --------------------------------------------------------------------
-         ! upstream tracer flux in the i and j direction
-         DO jk = 1, jpkm1
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  ! upstream scheme
-                  zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) )
-                  zfm_ui = pun(ji,jj,jk) - ABS( pun(ji,jj,jk) )
-                  zfp_vj = pvn(ji,jj,jk) + ABS( pvn(ji,jj,jk) )
-                  zfm_vj = pvn(ji,jj,jk) - ABS( pvn(ji,jj,jk) )
-                  zwx(ji,jj,jk) = 0.5 * ( zfp_ui * ptb(ji,jj,jk,jn) + zfm_ui * ptb(ji+1,jj  ,jk,jn) )
-                  zwy(ji,jj,jk) = 0.5 * ( zfp_vj * ptb(ji,jj,jk,jn) + zfm_vj * ptb(ji  ,jj+1,jk,jn) )
-               END DO
-            END DO
-         END DO
-
-         ! upstream tracer flux in the k direction
-         ! Surface value
-         IF( lk_vvl ) THEN   ;   zwz(:,:, 1 ) = 0.e0                         ! volume variable
-         ELSE                ;   zwz(:,:, 1 ) = pwn(:,:,1) * ptb(:,:,1,jn)   ! linear free surface 
-         ENDIF
-         ! Interior value
-         DO jk = 2, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zfp_wk = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) )
-                  zfm_wk = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) )
-                  zwz(ji,jj,jk) = 0.5 * ( zfp_wk * ptb(ji,jj,jk,jn) + zfm_wk * ptb(ji,jj,jk-1,jn) )
-               END DO
-            END DO
-         END DO
-
-         ! total advective trend
-         DO jk = 1, jpkm1
-            z2dtt = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! total intermediate advective trends
-                  ztra = - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
-                     &             + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
-                     &             + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) )
-                  ! update and guess with monotonic sheme
-                  pta(ji,jj,jk,jn) =   pta(ji,jj,jk,jn)         + ztra
-                  zwi(ji,jj,jk)    = ( ptb(ji,jj,jk,jn) + z2dtt * ztra ) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !                             ! Lateral boundary conditions on zwi  (unchanged sign)
-         CALL lbc_lnk( zwi, 'T', 1. )  
-
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  THEN 
-            ! store intermediate advective trends
-            ztrdx(:,:,:) = zwx(:,:,:)   ;    ztrdy(:,:,:) = zwy(:,:,:)  ;   ztrdz(:,:,:) = zwz(:,:,:)
-         END IF
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-           IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-           IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-
-         ! 3. antidiffusive flux : high order minus low order
-         ! --------------------------------------------------
-         ! antidiffusive flux on i and j
-         DO jk = 1, jpkm1
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zwx(ji,jj,jk) = 0.5 * pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj,jk,jn) ) - zwx(ji,jj,jk)
-                  zwy(ji,jj,jk) = 0.5 * pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj+1,jk,jn) ) - zwy(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-      
-         ! antidiffusive flux on k
-         zwz(:,:,1) = 0.e0         ! Surface value
-         !
-         DO jk = 2, jpkm1          ! Interior value
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zwz(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj,jk-1,jn) ) - zwz(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( zwx, 'U', -1. )   ;   CALL lbc_lnk( zwy, 'V', -1. )         ! Lateral bondary conditions
-         CALL lbc_lnk( zwz, 'W',  1. )
-
-         ! 4. monotonicity algorithm
-         ! -------------------------
-         CALL nonosc( ptb(:,:,:,jn), zwx, zwy, zwz, zwi, p2dt )
-
-
-         ! 5. final trend with corrected fluxes
-         ! ------------------------------------
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.  
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! total advective trends
-                  ztra = - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
-                     &             + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
-                     &             + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) )
-                  ! add them to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd )  THEN 
-            ztrdx(:,:,:) = ztrdx(:,:,:) + zwx(:,:,:)  ! <<< Add to previously computed
-            ztrdy(:,:,:) = ztrdy(:,:,:) + zwy(:,:,:)  ! <<< Add to previously computed
-            ztrdz(:,:,:) = ztrdz(:,:,:) + zwz(:,:,:)  ! <<< Add to previously computed
-            
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, ztrdx, pun, ptn(:,:,:,jn) )   
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, ztrdy, pvn, ptn(:,:,:,jn) )  
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, ztrdz, pwn, ptn(:,:,:,jn) ) 
-         END IF
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-           IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) ) + htr_adv(:)
-           IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) ) + str_adv(:)
-         ENDIF
-         !
-      END DO
-      !
-                   CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz )
-      IF( l_trd )  CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_tvd')
-      !
-   END SUBROUTINE tra_adv_tvd
-
-
-   SUBROUTINE nonosc( pbef, paa, pbb, pcc, paft, p2dt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE nonosc  ***
-      !!     
-      !! **  Purpose :   compute monotonic tracer fluxes from the upstream 
-      !!       scheme and the before field by a nonoscillatory algorithm 
-      !!
-      !! **  Method  :   ... ???
-      !!       warning : pbef and paft must be masked, but the boundaries
-      !!       conditions on the fluxes are not necessary zalezak (1979)
-      !!       drange (1995) multi-dimensional forward-in-time and upstream-
-      !!       in-space based differencing for fluid
-      !!----------------------------------------------------------------------
-      !
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpk)         , INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION (jpi,jpj,jpk), INTENT(in   ) ::   pbef, paft      ! before & after field
-      REAL(wp), DIMENSION (jpi,jpj,jpk), INTENT(inout) ::   paa, pbb, pcc   ! monotonic fluxes in the 3 directions
-      !
-      INTEGER ::   ji, jj, jk   ! dummy loop indices
-      INTEGER ::   ikm1         ! local integer
-      REAL(wp) ::   zpos, zneg, zbt, za, zb, zc, zbig, zrtrn, z2dtt   ! local scalars
-      REAL(wp) ::   zau, zbu, zcu, zav, zbv, zcv, zup, zdo            !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zbetup, zbetdo, zbup, zbdo
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('nonosc')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo )
-      !
-
-      zbig  = 1.e+40_wp
-      zrtrn = 1.e-15_wp
-      zbetup(:,:,jpk) = 0._wp   ;   zbetdo(:,:,jpk) = 0._wp
-
-
-      ! Search local extrema
-      ! --------------------
-      ! max/min of pbef & paft with large negative/positive value (-/+zbig) inside land
-      zbup = MAX( pbef * tmask - zbig * ( 1.e0 - tmask ),   &
-         &        paft * tmask - zbig * ( 1.e0 - tmask )  )
-      zbdo = MIN( pbef * tmask + zbig * ( 1.e0 - tmask ),   &
-         &        paft * tmask + zbig * ( 1.e0 - tmask )  )
-
-      DO jk = 1, jpkm1
-         ikm1 = MAX(jk-1,1)
-         z2dtt = p2dt(jk)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-
-               ! search maximum in neighbourhood
-               zup = MAX(  zbup(ji  ,jj  ,jk  ),   &
-                  &        zbup(ji-1,jj  ,jk  ), zbup(ji+1,jj  ,jk  ),   &
-                  &        zbup(ji  ,jj-1,jk  ), zbup(ji  ,jj+1,jk  ),   &
-                  &        zbup(ji  ,jj  ,ikm1), zbup(ji  ,jj  ,jk+1)  )
-
-               ! search minimum in neighbourhood
-               zdo = MIN(  zbdo(ji  ,jj  ,jk  ),   &
-                  &        zbdo(ji-1,jj  ,jk  ), zbdo(ji+1,jj  ,jk  ),   &
-                  &        zbdo(ji  ,jj-1,jk  ), zbdo(ji  ,jj+1,jk  ),   &
-                  &        zbdo(ji  ,jj  ,ikm1), zbdo(ji  ,jj  ,jk+1)  )
-
-               ! positive part of the flux
-               zpos = MAX( 0., paa(ji-1,jj  ,jk  ) ) - MIN( 0., paa(ji  ,jj  ,jk  ) )   &
-                  & + MAX( 0., pbb(ji  ,jj-1,jk  ) ) - MIN( 0., pbb(ji  ,jj  ,jk  ) )   &
-                  & + MAX( 0., pcc(ji  ,jj  ,jk+1) ) - MIN( 0., pcc(ji  ,jj  ,jk  ) )
-
-               ! negative part of the flux
-               zneg = MAX( 0., paa(ji  ,jj  ,jk  ) ) - MIN( 0., paa(ji-1,jj  ,jk  ) )   &
-                  & + MAX( 0., pbb(ji  ,jj  ,jk  ) ) - MIN( 0., pbb(ji  ,jj-1,jk  ) )   &
-                  & + MAX( 0., pcc(ji  ,jj  ,jk  ) ) - MIN( 0., pcc(ji  ,jj  ,jk+1) )
-
-               ! up & down beta terms
-               zbt = e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) / z2dtt
-               zbetup(ji,jj,jk) = ( zup            - paft(ji,jj,jk) ) / ( zpos + zrtrn ) * zbt
-               zbetdo(ji,jj,jk) = ( paft(ji,jj,jk) - zdo            ) / ( zneg + zrtrn ) * zbt
-            END DO
-         END DO
-      END DO
-      CALL lbc_lnk( zbetup, 'T', 1. )   ;   CALL lbc_lnk( zbetdo, 'T', 1. )   ! lateral boundary cond. (unchanged sign)
-
-      ! 3. monotonic flux in the i & j direction (paa & pbb)
-      ! ----------------------------------------
-      DO jk = 1, jpkm1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zau = MIN( 1.e0, zbetdo(ji,jj,jk), zbetup(ji+1,jj,jk) )
-               zbu = MIN( 1.e0, zbetup(ji,jj,jk), zbetdo(ji+1,jj,jk) )
-               zcu =       ( 0.5  + SIGN( 0.5 , paa(ji,jj,jk) ) )
-               paa(ji,jj,jk) = paa(ji,jj,jk) * ( zcu * zau + ( 1.e0 - zcu) * zbu )
-
-               zav = MIN( 1.e0, zbetdo(ji,jj,jk), zbetup(ji,jj+1,jk) )
-               zbv = MIN( 1.e0, zbetup(ji,jj,jk), zbetdo(ji,jj+1,jk) )
-               zcv =       ( 0.5  + SIGN( 0.5 , pbb(ji,jj,jk) ) )
-               pbb(ji,jj,jk) = pbb(ji,jj,jk) * ( zcv * zav + ( 1.e0 - zcv) * zbv )
-
-      ! monotonic flux in the k direction, i.e. pcc
-      ! -------------------------------------------
-               za = MIN( 1., zbetdo(ji,jj,jk+1), zbetup(ji,jj,jk) )
-               zb = MIN( 1., zbetup(ji,jj,jk+1), zbetdo(ji,jj,jk) )
-               zc =       ( 0.5  + SIGN( 0.5 , pcc(ji,jj,jk+1) ) )
-               pcc(ji,jj,jk+1) = pcc(ji,jj,jk+1) * ( zc * za + ( 1.e0 - zc) * zb )
-            END DO
-         END DO
-      END DO
-      CALL lbc_lnk( paa, 'U', -1. )   ;   CALL lbc_lnk( pbb, 'V', -1. )   ! lateral boundary condition (changed sign)
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('nonosc')
-      !
-   END SUBROUTINE nonosc
-
-   !!======================================================================
-END MODULE traadv_tvd
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_ubs.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traadv_ubs.F90	(revision 2446)
+++ 	(revision )
@@ -1,386 +1,0 @@
-MODULE traadv_ubs
-   !!==============================================================================
-   !!                       ***  MODULE  traadv_ubs  ***
-   !! Ocean active tracers:  horizontal & vertical advective trend
-   !!==============================================================================
-   !! History :  1.0  !  2006-08  (L. Debreu, R. Benshila)  Original code
-   !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA + switch from velocity to transport
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_adv_ubs : update the tracer trend with the horizontal
-   !!                 advection trends using a third order biaised scheme  
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and active tracers
-   USE dom_oce        ! ocean space and time domain
-   USE trdmod_oce     ! ocean space and time domain
-   USE trdtra
-   USE lib_mpp
-   USE lbclnk         ! ocean lateral boundary condition (or mpp link)
-   USE in_out_manager ! I/O manager
-   USE diaptr_oce         ! poleward transport diagnostics
-   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
-   USE trc_oce        ! share passive tracers/Ocean variables
-   USE wrk_nemo       ! Memory Allocation
-   USE timing         ! Timing
-   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_adv_ubs   ! routine called by traadv module
-
-   LOGICAL :: l_trd  ! flag to compute trends or not
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traadv_ubs.F90 4499 2014-02-18 15:14:31Z timgraham $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_adv_ubs ( kt, kit000, cdtype, p2dt, pun, pvn, pwn,      &
-      &                                       ptb, ptn, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_adv_ubs  ***
-      !!                 
-      !! ** Purpose :   Compute the now trend due to the advection of tracers
-      !!      and add it to the general trend of passive tracer equations.
-      !!
-      !! ** Method  :   The upstream biased 3rd order scheme (UBS) is based on an
-      !!      upstream-biased parabolic interpolation (Shchepetkin and McWilliams 2005)
-      !!      It is only used in the horizontal direction.
-      !!      For example the i-component of the advective fluxes are given by :
-      !!                !  e2u e3u un ( mi(Tn) - zltu(i  ) )   if un(i) >= 0
-      !!          zwx = !  or 
-      !!                !  e2u e3u un ( mi(Tn) - zltu(i+1) )   if un(i) < 0
-      !!      where zltu is the second derivative of the before temperature field:
-      !!          zltu = 1/e3t di[ e2u e3u / e1u di[Tb] ]
-      !!      This results in a dissipatively dominant (i.e. hyper-diffusive) 
-      !!      truncation error. The overall performance of the advection scheme 
-      !!      is similar to that reported in (Farrow and Stevens, 1995). 
-      !!      For stability reasons, the first term of the fluxes which corresponds
-      !!      to a second order centered scheme is evaluated using the now velocity 
-      !!      (centered in time) while the second term which is the diffusive part 
-      !!      of the scheme, is evaluated using the before velocity (forward in time). 
-      !!      Note that UBS is not positive. Do not use it on passive tracers.
-      !!                On the vertical, the advection is evaluated using a TVD scheme,
-      !!      as the UBS have been found to be too diffusive.
-      !!
-      !! ** Action : - update (pta) with the now advective tracer trends
-      !!
-      !! Reference : Shchepetkin, A. F., J. C. McWilliams, 2005, Ocean Modelling, 9, 347-404. 
-      !!             Farrow, D.E., Stevens, D.P., 1995, J. Phys. Ocean. 25, 1731Ð1741. 
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zwx  => ua       , zwy  => va         ! (ua,va) used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt              ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype          ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt            ! number of tracers
-      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt            ! vertical profile of tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk     ), INTENT(in   ) ::   pun, pvn, pwn   ! 3 ocean transport components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb, ptn        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta             ! tracer trend 
-      !
-      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::   ztra, zbtr, zcoef, z2dtt                       ! local scalars
-      REAL(wp) ::   zfp_ui, zfm_ui, zcenut, ztak, zfp_wk, zfm_wk   !   -      -
-      REAL(wp) ::   zfp_vj, zfm_vj, zcenvt, zeeu, zeev, z_hdivn    !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztu, ztv, zltu, zltv, zti, ztw
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_adv_ubs')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, ztu, ztv, zltu, zltv, zti, ztw )
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_adv_ubs :  horizontal UBS advection scheme on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
-      ENDIF
-      !
-      l_trd = .FALSE.
-      IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
-      !
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         ! 1. Bottom value : flux set to zero
-         ! ----------------------------------
-         zltu(:,:,jpk) = 0.e0       ;      zltv(:,:,jpk) = 0.e0
-         !                                              
-         DO jk = 1, jpkm1                                 ! Horizontal slab
-            !                                   
-            !  Laplacian
-            DO jj = 1, jpjm1            ! First derivative (gradient)
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zeeu = e2u(ji,jj) * fse3u(ji,jj,jk) / e1u(ji,jj) * umask(ji,jj,jk)
-                  zeev = e1v(ji,jj) * fse3v(ji,jj,jk) / e2v(ji,jj) * vmask(ji,jj,jk)
-                  ztu(ji,jj,jk) = zeeu * ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) )
-                  ztv(ji,jj,jk) = zeev * ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
-               END DO
-            END DO
-            DO jj = 2, jpjm1            ! Second derivative (divergence)
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zcoef = 1. / ( 6. * fse3t(ji,jj,jk) )
-                  zltu(ji,jj,jk) = (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk)  ) * zcoef
-                  zltv(ji,jj,jk) = (  ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  ) * zcoef
-               END DO
-            END DO
-            !                                    
-         END DO                                           ! End of slab         
-         CALL lbc_lnk( zltu, 'T', 1. )   ;    CALL lbc_lnk( zltv, 'T', 1. )   ! Lateral boundary cond. (unchanged sgn)
-
-         !    
-         !  Horizontal advective fluxes               
-         DO jk = 1, jpkm1                                 ! Horizontal slab
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  ! upstream transport (x2)
-                  zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) )
-                  zfm_ui = pun(ji,jj,jk) - ABS( pun(ji,jj,jk) )
-                  zfp_vj = pvn(ji,jj,jk) + ABS( pvn(ji,jj,jk) )
-                  zfm_vj = pvn(ji,jj,jk) - ABS( pvn(ji,jj,jk) )
-                  ! 2nd order centered advective fluxes (x2)
-                  zcenut = pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj  ,jk,jn) )
-                  zcenvt = pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji  ,jj+1,jk,jn) )
-                  ! UBS advective fluxes
-                  zwx(ji,jj,jk) = 0.5 * ( zcenut - zfp_ui * zltu(ji,jj,jk) - zfm_ui * zltu(ji+1,jj,jk) )
-                  zwy(ji,jj,jk) = 0.5 * ( zcenvt - zfp_vj * zltv(ji,jj,jk) - zfm_vj * zltv(ji,jj+1,jk) )
-               END DO
-            END DO
-         END DO                                           ! End of slab         
-
-         zltu(:,:,:) = pta(:,:,:,jn)      ! store pta trends
-
-         ! Horizontal advective trends
-         DO jk = 1, jpkm1
-            !  Tracer flux divergence at t-point added to the general trend
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! horizontal advective
-                  ztra = - zbtr * (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk)   &
-                     &             + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk)  )
-                  ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-            !                                             
-         END DO                                           !   End of slab
-
-         ! Horizontal trend used in tra_adv_ztvd subroutine
-         zltu(:,:,:) = pta(:,:,:,jn) - zltu(:,:,:)
-
-         ! 3. Save the horizontal advective trends for diagnostic
-         ! ------------------------------------------------------
-         !                                 ! trend diagnostics (contribution of upstream fluxes)
-         IF( l_trd ) THEN
-             CALL trd_tra( kt, cdtype, jn, jptra_trd_xad, zwx, pun, ptn(:,:,:,jn) )
-             CALL trd_tra( kt, cdtype, jn, jptra_trd_yad, zwy, pvn, ptn(:,:,:,jn) )
-         END IF
-         !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-            IF( jn == jp_tem )  htr_adv(:) = ptr_vj( zwy(:,:,:) )
-            IF( jn == jp_sal )  str_adv(:) = ptr_vj( zwy(:,:,:) )
-         ENDIF
-         
-         ! TVD scheme for the vertical direction  
-         ! ----------------------
-         IF( l_trd )   zltv(:,:,:) = pta(:,:,:,jn)          ! store pta if trend diag.
-
-         !  Bottom value : flux set to zero
-         ztw(:,:,jpk) = 0.e0   ;   zti(:,:,jpk) = 0.e0
-
-         ! Surface value
-         IF( lk_vvl ) THEN   ;   ztw(:,:,1) = 0.e0                      ! variable volume : flux set to zero
-         ELSE                ;   ztw(:,:,1) = pwn(:,:,1) * ptb(:,:,1,jn)   ! free constant surface 
-         ENDIF
-         !  upstream advection with initial mass fluxes & intermediate update
-         ! -------------------------------------------------------------------
-         ! Interior value
-         DO jk = 2, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                   zfp_wk = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) )
-                   zfm_wk = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) )
-                   ztw(ji,jj,jk) = 0.5 * (  zfp_wk * ptb(ji,jj,jk,jn) + zfm_wk * ptb(ji,jj,jk-1,jn)  )
-               END DO
-            END DO
-         END DO 
-         ! update and guess with monotonic sheme
-         DO jk = 1, jpkm1
-            z2dtt = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ztak = - ( ztw(ji,jj,jk) - ztw(ji,jj,jk+1) ) * zbtr
-                  pta(ji,jj,jk,jn) =   pta(ji,jj,jk,jn) +  ztak 
-                  zti(ji,jj,jk)    = ( ptb(ji,jj,jk,jn) + z2dtt * ( ztak + zltu(ji,jj,jk) ) ) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !
-         CALL lbc_lnk( zti, 'T', 1. )      ! Lateral boundary conditions on zti, zsi   (unchanged sign)
-
-         !  antidiffusive flux : high order minus low order
-         ztw(:,:,1) = 0.e0       ! Surface value
-         DO jk = 2, jpkm1        ! Interior value
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  ztw(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj,jk-1,jn) ) - ztw(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !
-         CALL nonosc_z( ptb(:,:,:,jn), ztw, zti, p2dt )      !  monotonicity algorithm
-
-         !  final trend with corrected fluxes
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1 
-               DO ji = fs_2, fs_jpim1   ! vector opt.   
-                  zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  ! k- vertical advective trends  
-                  ztra = - zbtr * ( ztw(ji,jj,jk) - ztw(ji,jj,jk+1) )
-                  ! added to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-
-         !  Save the final vertical advective trends
-         IF( l_trd )  THEN                        ! vertical advective trend diagnostics
-            DO jk = 1, jpkm1                       ! (compute -w.dk[ptn]= -dk[w.ptn] + ptn.dk[w])
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     zbtr = 1.e0 / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                     z_hdivn = (  pwn(ji,jj,jk) - pwn(ji,jj,jk+1)  ) * zbtr
-                     zltv(ji,jj,jk) = pta(ji,jj,jk,jn) - zltv(ji,jj,jk) + ptn(ji,jj,jk,jn) * z_hdivn
-                  END DO
-               END DO
-            END DO
-            CALL trd_tra( kt, cdtype, jn, jptra_trd_zad, zltv )
-         ENDIF
-         !
-      ENDDO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, ztu, ztv, zltu, zltv, zti, ztw )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_adv_ubs')
-      !
-   END SUBROUTINE tra_adv_ubs
-
-
-   SUBROUTINE nonosc_z( pbef, pcc, paft, p2dt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE nonosc_z  ***
-      !!     
-      !! **  Purpose :   compute monotonic tracer fluxes from the upstream 
-      !!       scheme and the before field by a nonoscillatory algorithm 
-      !!
-      !! **  Method  :   ... ???
-      !!       warning : pbef and paft must be masked, but the boundaries
-      !!       conditions on the fluxes are not necessary zalezak (1979)
-      !!       drange (1995) multi-dimensional forward-in-time and upstream-
-      !!       in-space based differencing for fluid
-      !!----------------------------------------------------------------------
-      !
-      REAL(wp), INTENT(in   ), DIMENSION(jpk)          ::   p2dt   ! vertical profile of tracer time-step
-      REAL(wp),                DIMENSION (jpi,jpj,jpk) ::   pbef   ! before field
-      REAL(wp), INTENT(inout), DIMENSION (jpi,jpj,jpk) ::   paft   ! after field
-      REAL(wp), INTENT(inout), DIMENSION (jpi,jpj,jpk) ::   pcc    ! monotonic flux in the k direction
-      !
-      INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      INTEGER  ::   ikm1         ! local integer
-      REAL(wp) ::   zpos, zneg, zbt, za, zb, zc, zbig, zrtrn, z2dtt   ! local scalars
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zbetup, zbetdo
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('nonosc_z')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, zbetup, zbetdo )
-      !
-
-      zbig  = 1.e+40_wp
-      zrtrn = 1.e-15_wp
-      zbetup(:,:,:) = 0._wp   ;   zbetdo(:,:,:) = 0._wp
-
-      ! Search local extrema
-      ! --------------------
-      ! large negative value (-zbig) inside land
-      pbef(:,:,:) = pbef(:,:,:) * tmask(:,:,:) - zbig * ( 1.e0 - tmask(:,:,:) )
-      paft(:,:,:) = paft(:,:,:) * tmask(:,:,:) - zbig * ( 1.e0 - tmask(:,:,:) )
-      ! search maximum in neighbourhood
-      DO jk = 1, jpkm1
-         ikm1 = MAX(jk-1,1)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zbetup(ji,jj,jk) = MAX(  pbef(ji  ,jj  ,jk  ), paft(ji  ,jj  ,jk  ),   &
-                  &                     pbef(ji  ,jj  ,ikm1), pbef(ji  ,jj  ,jk+1),   &
-                  &                     paft(ji  ,jj  ,ikm1), paft(ji  ,jj  ,jk+1)  )
-            END DO
-         END DO
-      END DO
-      ! large positive value (+zbig) inside land
-      pbef(:,:,:) = pbef(:,:,:) * tmask(:,:,:) + zbig * ( 1.e0 - tmask(:,:,:) )
-      paft(:,:,:) = paft(:,:,:) * tmask(:,:,:) + zbig * ( 1.e0 - tmask(:,:,:) )
-      ! search minimum in neighbourhood
-      DO jk = 1, jpkm1
-         ikm1 = MAX(jk-1,1)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zbetdo(ji,jj,jk) = MIN(  pbef(ji  ,jj  ,jk  ), paft(ji  ,jj  ,jk  ),   &
-                  &                     pbef(ji  ,jj  ,ikm1), pbef(ji  ,jj  ,jk+1),   &
-                  &                     paft(ji  ,jj  ,ikm1), paft(ji  ,jj  ,jk+1)  )
-            END DO
-         END DO
-      END DO
-
-      ! restore masked values to zero
-      pbef(:,:,:) = pbef(:,:,:) * tmask(:,:,:)
-      paft(:,:,:) = paft(:,:,:) * tmask(:,:,:)
-
-
-      ! 2. Positive and negative part of fluxes and beta terms
-      ! ------------------------------------------------------
-
-      DO jk = 1, jpkm1
-         z2dtt = p2dt(jk)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               ! positive & negative part of the flux
-               zpos = MAX( 0., pcc(ji  ,jj  ,jk+1) ) - MIN( 0., pcc(ji  ,jj  ,jk  ) )
-               zneg = MAX( 0., pcc(ji  ,jj  ,jk  ) ) - MIN( 0., pcc(ji  ,jj  ,jk+1) )
-               ! up & down beta terms
-               zbt = e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) / z2dtt
-               zbetup(ji,jj,jk) = ( zbetup(ji,jj,jk) - paft(ji,jj,jk) ) / (zpos+zrtrn) * zbt
-               zbetdo(ji,jj,jk) = ( paft(ji,jj,jk) - zbetdo(ji,jj,jk) ) / (zneg+zrtrn) * zbt
-            END DO
-         END DO
-      END DO
-      ! monotonic flux in the k direction, i.e. pcc
-      ! -------------------------------------------
-      DO jk = 2, jpkm1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               za = MIN( 1., zbetdo(ji,jj,jk), zbetup(ji,jj,jk-1) )
-               zb = MIN( 1., zbetup(ji,jj,jk), zbetdo(ji,jj,jk-1) )
-               zc = 0.5 * ( 1.e0 + SIGN( 1.e0, pcc(ji,jj,jk) ) )
-               pcc(ji,jj,jk) = pcc(ji,jj,jk) * ( zc * za + ( 1.e0 - zc) * zb )
-            END DO
-         END DO
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, zbetup, zbetdo )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('nonosc_z')
-      !
-   END SUBROUTINE nonosc_z
-
-   !!======================================================================
-END MODULE traadv_ubs
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_bilap.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_bilap.F90	(revision 2446)
+++ 	(revision )
@@ -1,177 +1,0 @@
-MODULE traldf_bilap
-   !!==============================================================================
-   !!                   ***  MODULE  traldf_bilap  ***
-   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
-   !!==============================================================================
-   !! History :  OPA  !  1991-11  (G. Madec)  Original code
-   !!                 !  1993-03  (M. Guyon)  symetrical conditions
-   !!                 !  1995-11  (G. Madec)  suppress volumetric scale factors
-   !!                 !  1996-01  (G. Madec)  statement function for e3
-   !!                 !  1996-01  (M. Imbard)  mpp exchange
-   !!                 !  1997-07  (G. Madec)  optimization, and ahtt
-   !!            8.5  !  2002-08  (G. Madec)  F90: Free form and module
-   !!   NEMO     1.0  !  2004-08  (C. Talandier) New trends organization
-   !!             -   !  2005-11  (G. Madec)  zps or sco as default option
-   !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA 
-   !!==============================================================================
-
-   !!----------------------------------------------------------------------
-   !!   tra_ldf_bilap : update the tracer trend with the horizontal diffusion
-   !!                   using a iso-level biharmonic operator
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE ldftra_oce      ! ocean tracer   lateral physics
-   USE in_out_manager  ! I/O manager
-   USE ldfslp          ! iso-neutral slopes 
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo       ! Memory Allocation
-   USE timing         ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_ldf_bilap   ! routine called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "ldftra_substitute.h90"
-#  include "ldfeiv_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traldf_bilap.F90 4292 2013-11-20 16:28:04Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
- 
-   SUBROUTINE tra_ldf_bilap( kt, kit000, cdtype, pgu, pgv,      &
-      &                                  ptb, pta, kjpt )  
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_ldf_bilap  ***
-      !!
-      !! ** Purpose :   Compute the before horizontal tracer diffusive 
-      !!      trend and add it to the general trend of tracer equation.
-      !!
-      !! ** Method  :   4th order diffusive operator along model level surfaces 
-      !!      evaluated using before fields (forward time scheme). The hor.
-      !!      diffusive trends  is given by:
-      !!      Laplacian of tb:
-      !!         zlt   = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(tb) ]
-      !!                                  + dj-1[ e1v*e3v/e2v dj(tb) ]  }
-      !!      Multiply by the eddy diffusivity coef. and insure lateral bc:
-      !!        zlt   = ahtt * zlt
-      !!        call to lbc_lnk
-      !!      Bilaplacian (laplacian of zlt):
-      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(zlt) ]
-      !!                                  + dj-1[ e1v*e3v/e2v dj(zlt) ]  }
-      !!
-      !!      Add this trend to the general trend
-      !!         (pta) = (pta) + ( difft )
-      !!
-      !! ** Action : - Update pta arrays with the before iso-level
-      !!               biharmonic mixing trend.
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   ztu  => ua       , ztv  => va                           ! (ua,va) used as workspace
-      !!
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,    kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend 
-      !!
-      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::  zbtr, ztra       ! local scalars
-      REAL(wp), POINTER, DIMENSION(:,:) ::  zeeu, zeev, zlt
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start( 'tra_ldf_bilap')
-      !
-      CALL wrk_alloc( jpi, jpj, zeeu, zeev, zlt ) 
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_ldf_bilap : iso-level biharmonic operator on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~'
-      ENDIF
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         !                                               
-         DO jk = 1, jpkm1                                        ! Horizontal slab
-            !                                             
-            !                          !==  Initialization of metric arrays (for z- or s-coordinates)  ==!
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zeeu(ji,jj) = re2u_e1u(ji,jj) * fse3u_n(ji,jj,jk) * umask(ji,jj,jk)
-                  zeev(ji,jj) = re1v_e2v(ji,jj) * fse3v_n(ji,jj,jk) * vmask(ji,jj,jk)
-               END DO
-            END DO
-
-            !                          !==  Laplacian  ==!
-            !
-            DO jj = 1, jpjm1                 ! First derivative (gradient)
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) )
-                  ztv(ji,jj,jk) = zeev(ji,jj) * ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
-               END DO
-            END DO
-            IF( ln_zps ) THEN                ! set gradient at partial step level (last ocean level)
-               DO jj = 1, jpjm1
-                  DO ji = 1, jpim1
-                     IF( mbku(ji,jj) == jk )  ztu(ji,jj,jk) = zeeu(ji,jj) * pgu(ji,jj,jn)
-                     IF( mbkv(ji,jj) == jk )  ztv(ji,jj,jk) = zeev(ji,jj) * pgv(ji,jj,jn)
-                  END DO
-               END DO
-            ENDIF
-            DO jj = 2, jpjm1                 ! Second derivative (divergence) time the eddy diffusivity coefficient
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                  zlt(ji,jj) = fsahtt(ji,jj,jk) * zbtr * (   ztu(ji,jj,jk) - ztu(ji-1,jj,jk)   &
-                     &                                     + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)   )
-               END DO
-            END DO
-            CALL lbc_lnk( zlt, 'T', 1. )     ! Lateral boundary conditions (unchanged sgn)
-
-            !                          !==  Bilaplacian  ==!
-            !
-            DO jj = 1, jpjm1                 ! third derivative (gradient)
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( zlt(ji+1,jj  ) - zlt(ji,jj) )
-                  ztv(ji,jj,jk) = zeev(ji,jj) * ( zlt(ji  ,jj+1) - zlt(ji,jj) )
-               END DO
-            END DO
-            DO jj = 2, jpjm1                 ! fourth derivative (divergence) and add to the general tracer trend
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! horizontal diffusive trends
-                  zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                  ztra = zbtr * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk) + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  )
-                  ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-            !                                             
-         END DO                                           ! Horizontal slab
-         !                                                
-         ! "zonal" mean lateral diffusive heat and salt transport
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN  
-           IF( jn == jp_tem )  htr_ldf(:) = ptr_vj( ztv(:,:,:) )
-           IF( jn == jp_sal )  str_ldf(:) = ptr_vj( ztv(:,:,:) )
-         ENDIF
-         !                                                ! ===========
-      END DO                                              ! tracer loop
-      !                                                   ! ===========
-      IF( nn_timing == 1 )  CALL timing_stop( 'tra_ldf_bilap')
-      !
-      CALL wrk_dealloc( jpi, jpj, zeeu, zeev, zlt ) 
-      !
-   END SUBROUTINE tra_ldf_bilap
-
-   !!==============================================================================
-END MODULE traldf_bilap
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_bilapg.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_bilapg.F90	(revision 2446)
+++ 	(revision )
@@ -1,363 +1,0 @@
-MODULE traldf_bilapg
-   !!==============================================================================
-   !!                       ***  MODULE  traldf_bilapg  ***
-   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
-   !!==============================================================================
-   !! History : 8.0   ! 1997-07  (G. Madec)  Original code
-   !!   NEMO    1.0   ! 2002-08  (G. Madec)  F90: Free form and module
-   !!           3.3   ! 2010-06  (C. Ethe, G. Madec) Merge TRA-TRC
-   !!==============================================================================
-#if defined key_ldfslp   ||   defined key_esopa
-   !!----------------------------------------------------------------------
-   !!   'key_ldfslp'                  rotation of the lateral mixing tensor
-   !!----------------------------------------------------------------------
-   !!   tra_ldf_bilapg : update the tracer trend with the horizontal diffusion
-   !!                    using an horizontal biharmonic operator in s-coordinate 
-   !!   ldfght         :  ???
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers variables
-   USE dom_oce         ! ocean space and time domain variables
-   USE ldftra_oce      ! ocean active tracers: lateral physics
-   USE in_out_manager  ! I/O manager
-   USE ldfslp          ! iso-neutral slopes available
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link)
-   USE diaptr_oce          ! poleward transport diagnostics 
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_ldf_bilapg   ! routine called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "ldftra_substitute.h90"
-#  include "ldfeiv_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traldf_bilapg.F90 4292 2013-11-20 16:28:04Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_ldf_bilapg( kt, kit000, cdtype, ptb, pta, kjpt )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE tra_ldf_bilapg  ***
-      !!                    
-      !! ** Purpose :   Compute the before horizontal tracer diffusive 
-      !!      trend and add it to the general trend of tracer equation.
-      !!
-      !! ** Method  :   The lateral diffusive trends is provided by a 4th order
-      !!      operator rotated along geopotential surfaces. It is computed
-      !!      using before fields (forward in time) and geopotential slopes
-      !!      computed in routine inildf.
-      !!         -1- compute the geopotential harmonic operator applied to
-      !!        ptb and multiply it by the eddy diffusivity coefficient
-      !!       (done by a call to ldfght routine, result in wk1 arrays).
-      !!      Applied the domain lateral boundary conditions by call to lbc_lnk
-      !!         -2- compute the geopotential harmonic operator applied to
-      !!      wk1 by a second call to ldfght routine (result in wk2)
-      !!      arrays).
-      !!         -3- Add this trend to the general trend 
-      !!            pta = pta + wk2
-      !!
-      !! ** Action : - Update pta arrays with the before geopotential 
-      !!               biharmonic mixing trend.
-      !!----------------------------------------------------------------------
-      !
-      INTEGER         , INTENT(in   )                      ::   kt       ! ocean time-step index
-      INTEGER         , INTENT(in   )                      ::   kit000   ! first time step index
-      CHARACTER(len=3), INTENT(in   )                      ::   cdtype   ! =TRA or TRC (tracer indicator)
-      INTEGER         , INTENT(in   )                      ::   kjpt     ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb      ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! tracer trend 
-      !
-      INTEGER ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zwk1, zwk2 
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_ldf_bilapg')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, kjpt, zwk1, zwk2 ) 
-      !
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_ldf_bilapg : horizontal biharmonic operator in s-coordinate on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'
-      ENDIF
-
-      ! 1. Laplacian of ptb * aht
-      ! ----------------------------- 
-      CALL ldfght( kt, cdtype, ptb, zwk1, kjpt, 1 )      ! rotated harmonic operator applied to ptb and multiply by aht 
-      !                                                 ! output in wk1 
-      !
-      DO jn = 1, kjpt
-         CALL lbc_lnk( zwk1(:,:,:,jn) , 'T', 1. )        ! Lateral boundary conditions on wk1   (unchanged sign)
-      END DO
-
-      ! 2. Bilaplacian of ptb
-      ! -------------------------
-      CALL ldfght( kt, cdtype, zwk1, zwk2, kjpt, 2 )      ! rotated harmonic operator applied to wk1 ; output in wk2
-
-
-      ! 3. Update the tracer trends                    (j-slab :   2, jpj-1)
-      ! ---------------------------
-      DO jn = 1, kjpt
-         DO jj = 2, jpjm1
-            DO jk = 1, jpkm1
-               DO ji = 2, jpim1
-                  ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + zwk2(ji,jj,jk,jn)
-               END DO
-            END DO
-         END DO
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, kjpt, zwk1, zwk2 ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_ldf_bilapg')
-      !
-   END SUBROUTINE tra_ldf_bilapg
-
-
-   SUBROUTINE ldfght ( kt, cdtype, pt, plt, kjpt, kaht )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE ldfght  ***
-      !!          
-      !! ** Purpose :   Apply a geopotential harmonic operator to (pt) and 
-      !!      multiply it by the eddy diffusivity coefficient (if kaht=1).
-      !!      Routine only used in s-coordinates (l_sco=T) with bilaplacian
-      !!      operator (ln_traldf_bilap=T) acting along geopotential surfaces
-      !!      (ln_traldf_hor).
-      !!
-      !! ** Method  :   The harmonic operator rotated along geopotential 
-      !!      surfaces is applied to (pt) using the slopes of geopotential
-      !!      surfaces computed in inildf routine. The result is provided in
-      !!      (plt,pls) arrays. It is computed in 2 steps:
-      !!
-      !!      First step: horizontal part of the operator. It is computed on
-      !!      ==========  pt as follows (idem on ps)
-      !!      horizontal fluxes :
-      !!         zftu = e2u*e3u/e1u di[ pt ] - e2u*uslp dk[ mi(mk(pt)) ]
-      !!         zftv = e1v*e3v/e2v dj[ pt ] - e1v*vslp dk[ mj(mk(pt)) ]
-      !!      take the horizontal divergence of the fluxes (no divided by
-      !!      the volume element :
-      !!         plt  = di-1[ zftu ] +  dj-1[ zftv ]
-      !!
-      !!      Second step: vertical part of the operator. It is computed on
-      !!      ===========  pt as follows (idem on ps)
-      !!      vertical fluxes :
-      !!         zftw = e1t*e2t/e3w * (wslpi^2+wslpj^2)  dk-1[ pt ]
-      !!              -     e2t     *       wslpi        di[ mi(mk(pt)) ]
-      !!              -     e1t     *       wslpj        dj[ mj(mk(pt)) ]
-      !!      take the vertical divergence of the fluxes add it to the hori-
-      !!      zontal component, divide the result by the volume element and
-      !!      if kaht=1, multiply by the eddy diffusivity coefficient:
-      !!         plt  = aht / (e1t*e2t*e3t) { plt + dk[ zftw ] }
-      !!      else:
-      !!         plt  =  1  / (e1t*e2t*e3t) { plt + dk[ zftw ] }
-      !!
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zftv => ua       ! ua used as workspace
-      !
-      INTEGER         , INTENT(in )                              ::  kt      ! ocean time-step index
-      CHARACTER(len=3), INTENT(in )                              ::  cdtype  ! =TRA or TRC (tracer indicator) 
-      INTEGER         , INTENT(in )                              ::  kjpt    !: dimension of 
-      REAL(wp)        , INTENT(in ), DIMENSION(jpi,jpj,jpk,kjpt) ::  pt      ! tracer fields ( before for 1st call
-      !                                                         ! and laplacian of these fields for 2nd call. 
-      REAL(wp)        , INTENT(out), DIMENSION(jpi,jpj,jpk,kjpt) ::  plt     !: partial harmonic operator applied to  pt  components except
-      !                                                             !: second order vertical derivative term  
-      INTEGER         , INTENT(in )                              ::  kaht    !: =1 multiply the laplacian by the eddy diffusivity coeff.
-      !                                                             !: =2 no multiplication 
-      !!
-      INTEGER ::   ji, jj, jk,jn          ! dummy loop indices
-      !                                   ! temporary scalars
-      REAL(wp) ::  zabe1, zabe2, zmku, zmkv 
-      REAL(wp) ::  zbtr, ztah, ztav
-      REAL(wp) ::  zcof0, zcof1, zcof2, zcof3, zcof4
-      REAL(wp), POINTER, DIMENSION(:,:) ::  zftu, zdkt, zdk1t
-      REAL(wp), POINTER, DIMENSION(:,:) ::  zftw, zdit, zdjt, zdj1t
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('ldfght')
-      !
-      CALL wrk_alloc( jpi, jpj, zftu, zdkt, zdk1t ) 
-      CALL wrk_alloc( jpi, jpk, zftw, zdit, zdjt, zdj1t ) 
-      !
-      DO jn = 1, kjpt
-         !                               ! ********** !   ! ===============
-         DO jk = 1, jpkm1                ! First step !   ! Horizontal slab
-            !                            ! ********** !   ! ===============
-            
-            ! I.1 Vertical gradient of pt and ps at level jk and jk+1
-            ! -------------------------------------------------------
-            !     surface boundary condition: zdkt(jk=1)=zdkt(jk=2)
-            
-            zdk1t(:,:) = ( pt(:,:,jk,jn) - pt(:,:,jk+1,jn) ) * tmask(:,:,jk+1)
-            IF( jk == 1 ) THEN
-               zdkt(:,:) = zdk1t(:,:)
-            ELSE
-               zdkt(:,:) = ( pt(:,:,jk-1,jn) - pt(:,:,jk,jn) ) * tmask(:,:,jk)
-            ENDIF
-
-
-            ! I.2 Horizontal fluxes
-            ! ---------------------
-            
-            DO jj = 1, jpjm1
-               DO ji = 1, jpim1
-                  zabe1 = re2u_e1u(ji,jj) * fse3u_n(ji,jj,jk)
-                  zabe2 = re1v_e2v(ji,jj) * fse3v_n(ji,jj,jk)
-                  
-                  zmku = 1./MAX( tmask(ji+1,jj,jk  )+tmask(ji,jj,jk+1)   &
-                     &          +tmask(ji+1,jj,jk+1)+tmask(ji,jj,jk  ),1. )
-                  zmkv = 1./MAX( tmask(ji,jj+1,jk  )+tmask(ji,jj,jk+1)   &
-                     &          +tmask(ji,jj+1,jk+1)+tmask(ji,jj,jk  ),1. )
-                  
-                  zcof1 = -e2u(ji,jj) * uslp(ji,jj,jk) * zmku
-                  zcof2 = -e1v(ji,jj) * vslp(ji,jj,jk) * zmkv
-                  
-                  zftu(ji,jj)= umask(ji,jj,jk) *   &
-                     &         (  zabe1 *( pt   (ji+1,jj,jk,jn) - pt(ji,jj,jk,jn) )   &
-                     &          + zcof1 *( zdkt (ji+1,jj) + zdk1t(ji,jj)     &
-                     &                    +zdk1t(ji+1,jj) + zdkt (ji,jj) )  )
-                  
-                  zftv(ji,jj,jk)= vmask(ji,jj,jk) *   &
-                     &         (  zabe2 *( pt(ji,jj+1,jk,jn) - pt(ji,jj,jk,jn) )   &
-                     &          + zcof2 *( zdkt (ji,jj+1) + zdk1t(ji,jj)     &
-                     &                    +zdk1t(ji,jj+1) + zdkt (ji,jj) )  )                  
-               END DO
-            END DO
-
-
-            ! I.3 Second derivative (divergence) (not divided by the volume)
-            ! ---------------------
-            
-            DO jj = 2 , jpjm1
-               DO ji = 2 , jpim1
-                  ztah = zftu(ji,jj) - zftu(ji-1,jj) + zftv(ji,jj,jk) - zftv(ji,jj-1,jk)
-                  plt(ji,jj,jk,jn) = ztah
-               END DO
-            END DO
-            !                                             ! ===============
-         END DO                                           !   End of slab
-         !                                                ! ===============
-         ! "Poleward" diffusive heat or salt transport
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( kaht == 2 ) .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN
-            ! note sign is reversed to give down-gradient diffusive transports (#1043)
-            IF( jn == jp_tem)   htr_ldf(:) = ptr_vj( -zftv(:,:,:) )
-            IF( jn == jp_sal)   str_ldf(:) = ptr_vj( -zftv(:,:,:) )
-         ENDIF
-
-         !                             ! ************ !   ! ===============
-         DO jj = 2, jpjm1              !  Second step !   ! Horizontal slab
-            !                          ! ************ !   ! ===============
-            
-            ! II.1 horizontal tracer gradient
-            ! -------------------------------
-            
-            DO jk = 1, jpk
-               DO ji = 1, jpim1
-                  zdit (ji,jk) = ( pt(ji+1,jj  ,jk,jn) - pt(ji,jj  ,jk,jn) ) * umask(ji,jj  ,jk)
-                  zdjt (ji,jk) = ( pt(ji  ,jj+1,jk,jn) - pt(ji,jj  ,jk,jn) ) * vmask(ji,jj  ,jk)
-                  zdj1t(ji,jk) = ( pt(ji  ,jj  ,jk,jn) - pt(ji,jj-1,jk,jn) ) * vmask(ji,jj-1,jk)
-               END DO
-            END DO
-
-
-            ! II.2 Vertical fluxes
-            ! --------------------
-            
-            ! Surface and bottom vertical fluxes set to zero
-            zftw(:, 1 ) = 0.e0
-            zftw(:,jpk) = 0.e0
-            
-            ! interior (2=<jk=<jpk-1)
-            DO jk = 2, jpkm1
-               DO ji = 2, jpim1
-                  zcof0 = e12t(ji,jj) / fse3w_n(ji,jj,jk)   &
-                     &     * (  wslpi(ji,jj,jk) * wslpi(ji,jj,jk)        &
-                     &        + wslpj(ji,jj,jk) * wslpj(ji,jj,jk)  )
-                  
-                  zmku = 1./MAX(  umask(ji  ,jj,jk-1)+umask(ji-1,jj,jk)   &
-                     &           +umask(ji-1,jj,jk-1)+umask(ji  ,jj,jk), 1. )
-                  
-                  zmkv = 1./MAX(  vmask(ji,jj  ,jk-1)+vmask(ji,jj-1,jk)   &
-                     &           +vmask(ji,jj-1,jk-1)+vmask(ji,jj  ,jk), 1. )
-                  
-                  zcof3 = - e2t(ji,jj) * wslpi (ji,jj,jk) * zmku
-                  zcof4 = - e1t(ji,jj) * wslpj (ji,jj,jk) * zmkv
-                  
-                  zftw(ji,jk) = tmask(ji,jj,jk) *   &
-                     &    (  zcof0 * ( pt   (ji,jj,jk-1,jn) - pt   (ji  ,jj,jk,jn) )   &
-                     &     + zcof3 * ( zdit (ji   ,jk-1   ) + zdit (ji-1,jk      )     &
-                     &                +zdit (ji-1 ,jk-1   ) + zdit (ji  ,jk      ) )   &
-                     &     + zcof4 * ( zdjt (ji   ,jk-1   ) + zdj1t(ji  ,jk)     &
-                     &                +zdj1t(ji   ,jk-1   ) + zdjt (ji  ,jk      ) )  )                 
-               END DO
-            END DO
-
-
-            ! II.3 Divergence of vertical fluxes added to the horizontal divergence
-            ! ---------------------------------------------------------------------
-            
-            IF( kaht == 1 ) THEN
-               ! multiply the laplacian by the eddy diffusivity coefficient
-               DO jk = 1, jpkm1
-                  DO ji = 2, jpim1
-                     ! eddy coef. divided by the volume element
-                     zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                     ! vertical divergence
-                     ztav = fsahtt(ji,jj,jk) * ( zftw(ji,jk) - zftw(ji,jk+1) )
-                     ! harmonic operator applied to (pt,ps) and multiply by aht
-                     plt(ji,jj,jk,jn) = ( plt(ji,jj,jk,jn) + ztav ) * zbtr
-                  END DO
-               END DO
-            ELSEIF( kaht == 2 ) THEN
-               ! second call, no multiplication
-               DO jk = 1, jpkm1
-                  DO ji = 2, jpim1
-                     ! inverse of the volume element
-                     zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                     ! vertical divergence
-                     ztav = zftw(ji,jk) - zftw(ji,jk+1)
-                     ! harmonic operator applied to (pt,ps) 
-                     plt(ji,jj,jk,jn) = ( plt(ji,jj,jk,jn) + ztav ) * zbtr
-                  END DO
-               END DO
-            ELSE
-               IF(lwp) WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht
-               IF(lwp) WRITE(numout,*) '         We stop'
-               STOP 'ldfght'
-            ENDIF
-            !                                             ! ===============
-         END DO                                           !   End of slab
-         !                                                ! ===============
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj, zftu, zdkt, zdk1t ) 
-      CALL wrk_dealloc( jpi, jpk, zftw, zdit, zdjt, zdj1t ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('ldfght')
-      !
-   END SUBROUTINE ldfght
-
-#else  
-   !!----------------------------------------------------------------------
-   !!   Dummy module :             NO rotation of the lateral mixing tensor
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE tra_ldf_bilapg( kt, kit000, cdtype, ptb, pta, kjpt )      ! Empty routine
-      INTEGER :: kt, kit000
-      CHARACTER(len=3) ::   cdtype
-      REAL, DIMENSION(:,:,:,:) ::   ptb, pta
-      WRITE(*,*) 'tra_ldf_iso: You should not have seen this print! error?', &
-        &         kt, kit000, cdtype, ptb(1,1,1,1), pta(1,1,1,1), kjpt
-   END SUBROUTINE tra_ldf_bilapg
-#endif
-
-   !!==============================================================================
-END MODULE traldf_bilapg
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_iso.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_iso.F90	(revision 2446)
+++ 	(revision )
@@ -1,322 +1,0 @@
-MODULE traldf_iso
-   !!======================================================================
-   !!                   ***  MODULE  traldf_iso  ***
-   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
-   !!======================================================================
-   !! History :  OPA  !  1994-08  (G. Madec, M. Imbard)
-   !!            8.0  !  1997-05  (G. Madec)  split into traldf and trazdf
-   !!            NEMO !  2002-08  (G. Madec)  Free form, F90
-   !!            1.0  !  2005-11  (G. Madec)  merge traldf and trazdf :-)
-   !!            3.3  !  2010-09  (C. Ethe, G. Madec) Merge TRA-TRC
-   !!----------------------------------------------------------------------
-#if   defined key_ldfslp   ||   defined key_esopa
-   !!----------------------------------------------------------------------
-   !!   'key_ldfslp'               slope of the lateral diffusive direction
-   !!----------------------------------------------------------------------
-   !!   tra_ldf_iso  : update the tracer trend with the horizontal 
-   !!                  component of a iso-neutral laplacian operator
-   !!                  and with the vertical part of
-   !!                  the isopycnal or geopotential s-coord. operator 
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE zdf_oce         ! ocean vertical physics
-   USE ldftra_oce      ! ocean active tracers: lateral physics
-   USE ldfslp          ! iso-neutral slopes
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE in_out_manager  ! I/O manager
-   USE iom             ! I/O library
-#if defined key_diaar5
-   USE phycst          ! physical constants
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-#endif
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_ldf_iso   ! routine called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "ldftra_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traldf_iso.F90 4292 2013-11-20 16:28:04Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_ldf_iso( kt, kit000, cdtype, pgu, pgv,              &
-      &                                ptb, pta, kjpt, pahtb0 )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_ldf_iso  ***
-      !!
-      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive 
-      !!      trend for a laplacian tensor (ezxcept the dz[ dz[.] ] term) and 
-      !!      add it to the general trend of tracer equation.
-      !!
-      !! ** Method  :   The horizontal component of the lateral diffusive trends 
-      !!      is provided by a 2nd order operator rotated along neural or geopo-
-      !!      tential surfaces to which an eddy induced advection can be added
-      !!      It is computed using before fields (forward in time) and isopyc-
-      !!      nal or geopotential slopes computed in routine ldfslp.
-      !!
-      !!      1st part :  masked horizontal derivative of T  ( di[ t ] )
-      !!      ========    with partial cell update if ln_zps=T.
-      !!
-      !!      2nd part :  horizontal fluxes of the lateral mixing operator
-      !!      ========    
-      !!         zftu = (aht+ahtb0) e2u*e3u/e1u di[ tb ]
-      !!               - aht       e2u*uslp    dk[ mi(mk(tb)) ]
-      !!         zftv = (aht+ahtb0) e1v*e3v/e2v dj[ tb ]
-      !!               - aht       e2u*vslp    dk[ mj(mk(tb)) ]
-      !!      take the horizontal divergence of the fluxes:
-      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ zftu ] +  dj-1[ zftv ]  }
-      !!      Add this trend to the general trend (ta,sa):
-      !!         ta = ta + difft
-      !!
-      !!      3rd part: vertical trends of the lateral mixing operator
-      !!      ========  (excluding the vertical flux proportional to dk[t] )
-      !!      vertical fluxes associated with the rotated lateral mixing:
-      !!         zftw =-aht {  e2t*wslpi di[ mi(mk(tb)) ]
-      !!                     + e1t*wslpj dj[ mj(mk(tb)) ]  }
-      !!      take the horizontal divergence of the fluxes:
-      !!         difft = 1/(e1t*e2t*e3t) dk[ zftw ]
-      !!      Add this trend to the general trend (ta,sa):
-      !!         pta = pta + difft
-      !!
-      !! ** Action :   Update pta arrays with the before rotated diffusion
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zftu => ua       , zftv  => va         ! (ua,va) used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj    ,kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend 
-      REAL(wp)                             , INTENT(in   ) ::   pahtb0     ! background diffusion coef
-      !
-      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::  zmsku, zabe1, zcof1, zcoef3   ! local scalars
-      REAL(wp) ::  zmskv, zabe2, zcof2, zcoef4   !   -      -
-      REAL(wp) ::  zcoef0, zbtr, ztra            !   -      -
-#if defined key_diaar5
-      REAL(wp)                         ::   zztmp               ! local scalar
-#endif
-      REAL(wp), POINTER, DIMENSION(:,:  ) ::  zdkt, zdk1t, z2d
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zdit, zdjt, ztfw 
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_ldf_iso')
-      !
-      CALL wrk_alloc( jpi, jpj,      zdkt, zdk1t, z2d ) 
-      CALL wrk_alloc( jpi, jpj, jpk, zdit, zdjt, ztfw  ) 
-      !
-
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_ldf_iso : rotated laplacian diffusion operator on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
-      ENDIF
-      !
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         !                                               
-         !!----------------------------------------------------------------------
-         !!   I - masked horizontal derivative 
-         !!----------------------------------------------------------------------
-         !!bug ajout.... why?   ( 1,jpj,:) and (jpi,1,:) should be sufficient....
-         zdit (1,:,:) = 0.e0     ;     zdit (jpi,:,:) = 0.e0
-         zdjt (1,:,:) = 0.e0     ;     zdjt (jpi,:,:) = 0.e0
-         !!end
-
-         ! Horizontal tracer gradient 
-         DO jk = 1, jpkm1
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zdit(ji,jj,jk) = ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) ) * umask(ji,jj,jk)
-                  zdjt(ji,jj,jk) = ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) ) * vmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         IF( ln_zps ) THEN      ! partial steps correction at the last ocean level 
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zdit(ji,jj,mbku(ji,jj)) = pgu(ji,jj,jn)          
-                  zdjt(ji,jj,mbkv(ji,jj)) = pgv(ji,jj,jn)      
-               END DO
-            END DO
-         ENDIF
-
-         !!----------------------------------------------------------------------
-         !!   II - horizontal trend  (full)
-         !!----------------------------------------------------------------------
-!CDIR PARALLEL DO PRIVATE( zdk1t ) 
-         !                                                ! ===============
-         DO jk = 1, jpkm1                                 ! Horizontal slab
-            !                                             ! ===============
-            ! 1. Vertical tracer gradient at level jk and jk+1
-            ! ------------------------------------------------
-            ! surface boundary condition: zdkt(jk=1)=zdkt(jk=2)
-            zdk1t(:,:) = ( ptb(:,:,jk,jn) - ptb(:,:,jk+1,jn) ) * tmask(:,:,jk+1)
-            !
-            IF( jk == 1 ) THEN   ;   zdkt(:,:) = zdk1t(:,:)
-            ELSE                 ;   zdkt(:,:) = ( ptb(:,:,jk-1,jn) - ptb(:,:,jk,jn) ) * tmask(:,:,jk)
-            ENDIF
-
-            ! 2. Horizontal fluxes
-            ! --------------------   
-            DO jj = 1 , jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zabe1 = ( fsahtu(ji,jj,jk) + pahtb0 ) * re2u_e1u(ji,jj) * fse3u_n(ji,jj,jk)
-                  zabe2 = ( fsahtv(ji,jj,jk) + pahtb0 ) * re1v_e2v(ji,jj) * fse3v_n(ji,jj,jk)
-                  !
-                  zmsku = 1. / MAX(  tmask(ji+1,jj,jk  ) + tmask(ji,jj,jk+1)   &
-                     &             + tmask(ji+1,jj,jk+1) + tmask(ji,jj,jk  ), 1. )
-                  !
-                  zmskv = 1. / MAX(  tmask(ji,jj+1,jk  ) + tmask(ji,jj,jk+1)   &
-                     &             + tmask(ji,jj+1,jk+1) + tmask(ji,jj,jk  ), 1. )
-                  !
-                  zcof1 = - fsahtu(ji,jj,jk) * e2u(ji,jj) * uslp(ji,jj,jk) * zmsku
-                  zcof2 = - fsahtv(ji,jj,jk) * e1v(ji,jj) * vslp(ji,jj,jk) * zmskv
-                  !
-                  zftu(ji,jj,jk ) = (  zabe1 * zdit(ji,jj,jk)   &
-                     &              + zcof1 * (  zdkt (ji+1,jj) + zdk1t(ji,jj)      &
-                     &                         + zdk1t(ji+1,jj) + zdkt (ji,jj)  )  ) * umask(ji,jj,jk)
-                  zftv(ji,jj,jk) = (  zabe2 * zdjt(ji,jj,jk)   &
-                     &              + zcof2 * (  zdkt (ji,jj+1) + zdk1t(ji,jj)      &
-                     &                         + zdk1t(ji,jj+1) + zdkt (ji,jj)  )  ) * vmask(ji,jj,jk)                  
-               END DO
-            END DO
-
-            ! II.4 Second derivative (divergence) and add to the general trend
-            ! ----------------------------------------------------------------
-            DO jj = 2 , jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                  ztra = zbtr * ( zftu(ji,jj,jk) - zftu(ji-1,jj,jk) + zftv(ji,jj,jk) - zftv(ji,jj-1,jk)  )
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-            !                                          ! ===============
-         END DO                                        !   End of slab  
-         !                                             ! ===============
-         !
-         ! "Poleward" diffusive heat or salt transports (T-S case only)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN
-            ! note sign is reversed to give down-gradient diffusive transports (#1043)
-            IF( jn == jp_tem)   htr_ldf(:) = ptr_vj( -zftv(:,:,:) )
-            IF( jn == jp_sal)   str_ldf(:) = ptr_vj( -zftv(:,:,:) )
-         ENDIF
- 
-#if defined key_diaar5
-         IF( cdtype == 'TRA' .AND. jn == jp_tem  ) THEN
-            z2d(:,:) = 0._wp 
-            ! note sign is reversed to give down-gradient diffusive transports (#1043)
-            zztmp = -1.0_wp * rau0 * rcp
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z2d(ji,jj) = z2d(ji,jj) + zftu(ji,jj,jk) 
-                  END DO
-               END DO
-            END DO
-            z2d(:,:) = zztmp * z2d(:,:)
-            CALL lbc_lnk( z2d, 'U', -1. )
-            CALL iom_put( "udiff_heattr", z2d )                  ! heat transport in i-direction
-            z2d(:,:) = 0._wp 
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z2d(ji,jj) = z2d(ji,jj) + zftv(ji,jj,jk) 
-                  END DO
-               END DO
-            END DO
-            z2d(:,:) = zztmp * z2d(:,:)
-            CALL lbc_lnk( z2d, 'V', -1. )
-            CALL iom_put( "vdiff_heattr", z2d )                  !  heat transport in i-direction
-         END IF
-#endif
-
-         !!----------------------------------------------------------------------
-         !!   III - vertical trend of T & S (extra diagonal terms only)
-         !!----------------------------------------------------------------------
-         
-         ! Local constant initialization
-         ! -----------------------------
-         ztfw(1,:,:) = 0.e0     ;     ztfw(jpi,:,:) = 0.e0
-         
-         ! Vertical fluxes
-         ! ---------------
-         
-         ! Surface and bottom vertical fluxes set to zero
-         ztfw(:,:, 1 ) = 0.e0      ;      ztfw(:,:,jpk) = 0.e0
-         
-         ! interior (2=<jk=<jpk-1)
-         DO jk = 2, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zcoef0 = - fsahtw(ji,jj,jk) * tmask(ji,jj,jk)
-                  !
-                  zmsku = 1./MAX(   umask(ji  ,jj,jk-1) + umask(ji-1,jj,jk)      &
-                     &            + umask(ji-1,jj,jk-1) + umask(ji  ,jj,jk), 1.  )
-                  zmskv = 1./MAX(   vmask(ji,jj  ,jk-1) + vmask(ji,jj-1,jk)      &
-                     &            + vmask(ji,jj-1,jk-1) + vmask(ji,jj  ,jk), 1.  )
-                  !
-                  zcoef3 = zcoef0 * e2t(ji,jj) * zmsku * wslpi (ji,jj,jk)
-                  zcoef4 = zcoef0 * e1t(ji,jj) * zmskv * wslpj (ji,jj,jk)
-                  !
-                  ztfw(ji,jj,jk) = zcoef3 * (   zdit(ji  ,jj  ,jk-1) + zdit(ji-1,jj  ,jk)      &
-                     &                        + zdit(ji-1,jj  ,jk-1) + zdit(ji  ,jj  ,jk)  )   &
-                     &           + zcoef4 * (   zdjt(ji  ,jj  ,jk-1) + zdjt(ji  ,jj-1,jk)      &
-                     &                        + zdjt(ji  ,jj-1,jk-1) + zdjt(ji  ,jj  ,jk)  )
-               END DO
-            END DO
-         END DO
-         
-         
-         ! I.5 Divergence of vertical fluxes added to the general tracer trend
-         ! -------------------------------------------------------------------
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                  ztra = (  ztfw(ji,jj,jk) - ztfw(ji,jj,jk+1)  ) * zbtr
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
-               END DO
-            END DO
-         END DO
-         !
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj,      zdkt, zdk1t, z2d ) 
-      CALL wrk_dealloc( jpi, jpj, jpk, zdit, zdjt, ztfw  ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_ldf_iso')
-      !
-   END SUBROUTINE tra_ldf_iso
-
-#else
-   !!----------------------------------------------------------------------
-   !!   default option :   Dummy code   NO rotation of the diffusive tensor
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE tra_ldf_iso( kt, kit000,cdtype, pgu, pgv, ptb, pta, kjpt, pahtb0 )      ! Empty routine
-      INTEGER:: kt, kit000
-      CHARACTER(len=3) ::   cdtype
-      REAL, DIMENSION(:,:,:) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL, DIMENSION(:,:,:,:) ::   ptb, pta
-      WRITE(*,*) 'tra_ldf_iso: You should not have seen this print! error?', kt, kit000, cdtype,   &
-         &                       pgu(1,1,1), pgv(1,1,1), ptb(1,1,1,1), pta(1,1,1,1), kjpt, pahtb0
-   END SUBROUTINE tra_ldf_iso
-#endif
-
-   !!==============================================================================
-END MODULE traldf_iso
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_iso_grif.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_iso_grif.F90	(revision 2446)
+++ 	(revision )
@@ -1,454 +1,0 @@
-MODULE traldf_iso_grif
-   !!======================================================================
-   !!                   ***  MODULE  traldf_iso_grif  ***
-   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
-   !!======================================================================
-   !! History : 3.3  ! 2010-10  (G. Nurser, C. Harris, G. Madec)
-   !!                !          Griffies operator version adapted from traldf_iso.F90
-   !!----------------------------------------------------------------------
-#if   defined key_ldfslp   ||   defined key_esopa
-   !!----------------------------------------------------------------------
-   !!   'key_ldfslp'               slope of the lateral diffusive direction
-   !!----------------------------------------------------------------------
-   !!   tra_ldf_iso_grif  : update the tracer trend with the horizontal component
-   !!                       of the Griffies iso-neutral laplacian operator
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE zdf_oce         ! ocean vertical physics
-   USE ldftra_oce      ! ocean active tracers: lateral physics
-   USE ldfslp          ! iso-neutral slopes
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE in_out_manager  ! I/O manager
-   USE iom             ! I/O library
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
-
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_ldf_iso_grif   ! routine called by traldf.F90
-
-   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   psix_eiv, psiy_eiv   !: eiv stream function (diag only)
-   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   ah_wslp2             !: aeiv*w-slope^2
-   REAL(wp),         DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   zdkt3d               !: vertical tracer gradient at 2 levels
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "ldftra_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-#  include "ldfeiv_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traldf_iso_grif.F90 3632 2012-11-22 15:28:42Z acc $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-  SUBROUTINE tra_ldf_iso_grif( kt, kit000, cdtype, pgu, pgv,              &
-       &                                   ptb, pta, kjpt, pahtb0 )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_ldf_iso_grif  ***
-      !!
-      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive
-      !!      trend for a laplacian tensor (ezxcept the dz[ dz[.] ] term) and
-      !!      add it to the general trend of tracer equation.
-      !!
-      !! ** Method  :   The horizontal component of the lateral diffusive trends
-      !!      is provided by a 2nd order operator rotated along neural or geopo-
-      !!      tential surfaces to which an eddy induced advection can be added
-      !!      It is computed using before fields (forward in time) and isopyc-
-      !!      nal or geopotential slopes computed in routine ldfslp.
-      !!
-      !!      1st part :  masked horizontal derivative of T  ( di[ t ] )
-      !!      ========    with partial cell update if ln_zps=T.
-      !!
-      !!      2nd part :  horizontal fluxes of the lateral mixing operator
-      !!      ========
-      !!         zftu = (aht+ahtb0) e2u*e3u/e1u di[ tb ]
-      !!               - aht       e2u*uslp    dk[ mi(mk(tb)) ]
-      !!         zftv = (aht+ahtb0) e1v*e3v/e2v dj[ tb ]
-      !!               - aht       e2u*vslp    dk[ mj(mk(tb)) ]
-      !!      take the horizontal divergence of the fluxes:
-      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ zftu ] +  dj-1[ zftv ]  }
-      !!      Add this trend to the general trend (ta,sa):
-      !!         ta = ta + difft
-      !!
-      !!      3rd part: vertical trends of the lateral mixing operator
-      !!      ========  (excluding the vertical flux proportional to dk[t] )
-      !!      vertical fluxes associated with the rotated lateral mixing:
-      !!         zftw =-aht {  e2t*wslpi di[ mi(mk(tb)) ]
-      !!                     + e1t*wslpj dj[ mj(mk(tb)) ]  }
-      !!      take the horizontal divergence of the fluxes:
-      !!         difft = 1/(e1t*e2t*e3t) dk[ zftw ]
-      !!      Add this trend to the general trend (ta,sa):
-      !!         pta = pta + difft
-      !!
-      !! ** Action :   Update pta arrays with the before rotated diffusion
-      !!----------------------------------------------------------------------
-      USE oce     , ONLY:   zftu => ua       , zftv => va            ! (ua,va) used as 3D workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000     ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj    ,kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend
-      REAL(wp)                             , INTENT(in   ) ::   pahtb0     ! background diffusion coef
-      !
-      INTEGER  ::  ji, jj, jk,jn   ! dummy loop indices
-      INTEGER  ::  ip,jp,kp        ! dummy loop indices
-      INTEGER  ::  ierr            ! temporary integer
-      REAL(wp) ::  zmsku, zabe1, zcof1, zcoef3   ! local scalars
-      REAL(wp) ::  zmskv, zabe2, zcof2, zcoef4   !   -      -
-      REAL(wp) ::  zcoef0, zbtr                  !   -      -
-      !
-      REAL(wp) ::   zslope_skew, zslope_iso, zslope2, zbu, zbv
-      REAL(wp) ::   ze1ur, zdxt, ze2vr, ze3wr, zdyt, zdzt
-      REAL(wp) ::   zah, zah_slp, zaei_slp
-#if defined key_diaar5
-      REAL(wp) ::   zztmp              ! local scalar
-#endif
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: z2d
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdit, zdjt, ztfw 
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d       ! 3D workspace
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tra_ldf_iso_grif')
-      !
-      CALL wrk_alloc( jpi, jpj,      z2d ) 
-      CALL wrk_alloc( jpi, jpj, jpk, zdit, zdjt, ztfw  ) 
-      !
-
-      IF( kt == kit000 .AND. .NOT.ALLOCATED(ah_wslp2) )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_ldf_iso_grif : rotated laplacian diffusion operator on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
-         ALLOCATE( ah_wslp2(jpi,jpj,jpk) , zdkt3d(jpi,jpj,0:1), STAT=ierr )
-         IF( lk_mpp   )   CALL mpp_sum ( ierr )
-         IF( ierr > 0 )   CALL ctl_stop('STOP', 'tra_ldf_iso_grif: unable to allocate arrays')
-         IF( ln_traldf_gdia ) THEN
-            IF (.NOT. ALLOCATED(psix_eiv))THEN
-                ALLOCATE( psix_eiv(jpi,jpj,jpk) , psiy_eiv(jpi,jpj,jpk) , STAT=ierr )
-                IF( lk_mpp   )   CALL mpp_sum ( ierr )
-                IF( ierr > 0 )   CALL ctl_stop('STOP', 'tra_ldf_iso_grif: unable to allocate diagnostics')
-            ENDIF
-         ENDIF
-      ENDIF
-
-      !!----------------------------------------------------------------------
-      !!   0 - calculate  ah_wslp2, psix_eiv, psiy_eiv
-      !!----------------------------------------------------------------------
-
-      !!gm Future development: consider using Ah defined at T-points and attached to the 4 t-point triads
-
-      ah_wslp2(:,:,:) = 0._wp
-      IF( ln_traldf_gdia ) THEN
-         psix_eiv(:,:,:) = 0._wp
-         psiy_eiv(:,:,:) = 0._wp
-      ENDIF
-
-      DO ip = 0, 1
-         DO kp = 0, 1
-            DO jk = 1, jpkm1
-               DO jj = 1, jpjm1
-                  DO ji = 1, fs_jpim1
-                     ze1ur = 1._wp / e1u(ji,jj)
-                     ze3wr = 1._wp / fse3w(ji+ip,jj,jk+kp)
-                     zbu   = 0.25_wp * e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk)
-                     zah   = fsahtu(ji,jj,jk)                                  ! fsaht(ji+ip,jj,jk)
-                     zslope_skew = triadi_g(ji+ip,jj,jk,1-ip,kp)
-                     ! Subtract s-coordinate slope at t-points to give slope rel to s surfaces
-                     ! (do this by *adding* gradient of depth)
-                     zslope2 = zslope_skew + ( fsdept(ji+1,jj,jk) - fsdept(ji ,jj ,jk) ) * ze1ur * umask(ji,jj,jk+kp)
-                     zslope2 = zslope2 *zslope2
-                     ah_wslp2(ji+ip,jj,jk+kp) = ah_wslp2(ji+ip,jj,jk+kp)    &
-                        &                     + zah * ( zbu * ze3wr / ( e1t(ji+ip,jj) * e2t(ji+ip,jj) ) ) * zslope2
-                     IF( ln_traldf_gdia ) THEN
-                        zaei_slp = fsaeiw(ji+ip,jj,jk) * zslope_skew           ! fsaeit(ji+ip,jj,jk)*zslope_skew
-                        psix_eiv(ji,jj,jk+kp) = psix_eiv(ji,jj,jk+kp) + 0.25_wp * zaei_slp
-                     ENDIF
-                  END DO
-               END DO
-            END DO
-         END DO
-      END DO
-      !
-      DO jp = 0, 1
-         DO kp = 0, 1
-            DO jk = 1, jpkm1
-               DO jj = 1, jpjm1
-                  DO ji=1,fs_jpim1
-                     ze2vr = 1._wp / e2v(ji,jj)
-                     ze3wr = 1.0_wp / fse3w(ji,jj+jp,jk+kp)
-                     zbv   = 0.25_wp * e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk)
-                     zah   = fsahtv(ji,jj,jk)                                  ! fsaht(ji,jj+jp,jk)
-                     zslope_skew = triadj_g(ji,jj+jp,jk,1-jp,kp)
-                     ! Subtract s-coordinate slope at t-points to give slope rel to s surfaces
-                     !    (do this by *adding* gradient of depth)
-                     zslope2 = zslope_skew + ( fsdept(ji,jj+1,jk) - fsdept(ji,jj,jk) ) * ze2vr * vmask(ji,jj,jk+kp)
-                     zslope2 = zslope2 * zslope2
-                     ah_wslp2(ji,jj+jp,jk+kp) = ah_wslp2(ji,jj+jp,jk+kp)   &
-                        &                     + zah * ( zbv * ze3wr / ( e1t(ji,jj+jp) * e2t(ji,jj+jp) ) ) * zslope2
-                     IF( ln_traldf_gdia ) THEN
-                        zaei_slp = fsaeiw(ji,jj+jp,jk) * zslope_skew           ! fsaeit(ji,jj+jp,jk)*zslope_skew
-                        psiy_eiv(ji,jj,jk+kp) = psiy_eiv(ji,jj,jk+kp) + 0.25_wp * zaei_slp
-                     ENDIF
-                  END DO
-               END DO
-            END DO
-         END DO
-      END DO
-      !
-#if defined key_iomput
-      IF( ln_traldf_gdia .AND. cdtype == 'TRA' ) THEN
-         CALL wrk_alloc( jpi , jpj , jpk  , zw3d )
-         DO jk=1,jpkm1
-            zw3d(:,:,jk) = (psix_eiv(:,:,jk+1) - psix_eiv(:,:,jk))/fse3u(:,:,jk)  ! u_eiv = -dpsix/dz
-         END DO
-         zw3d(:,:,jpk) = 0._wp
-         CALL iom_put( "uoce_eiv", zw3d )    ! i-eiv current
-
-         DO jk=1,jpk-1
-            zw3d(:,:,jk) = (psiy_eiv(:,:,jk+1) - psiy_eiv(:,:,jk))/fse3v(:,:,jk)  ! v_eiv = -dpsiy/dz
-         END DO
-         zw3d(:,:,jpk) = 0._wp
-         CALL iom_put( "voce_eiv", zw3d )    ! j-eiv current
-
-         DO jk=1,jpk-1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1  ! vector opt.
-                  zw3d(ji,jj,jk) = (psiy_eiv(ji,jj,jk) - psiy_eiv(ji,jj-1,jk))/e2t(ji,jj) + &
-                       &    (psix_eiv(ji,jj,jk) - psix_eiv(ji-1,jj,jk))/e1t(ji,jj) ! w_eiv = dpsiy/dy + dpsiy/dx
-               END DO
-            END DO
-         END DO
-         zw3d(:,:,jpk) = 0._wp
-         CALL iom_put( "woce_eiv", zw3d )    ! vert. eiv current
-         CALL wrk_dealloc( jpi , jpj , jpk  , zw3d )
-      ENDIF
-#endif
-      !                                                          ! ===========
-      DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========
-         ! Zero fluxes for each tracer
-         ztfw(:,:,:) = 0._wp
-         zftu(:,:,:) = 0._wp
-         zftv(:,:,:) = 0._wp
-         !
-         DO jk = 1, jpkm1                          !==  before lateral T & S gradients at T-level jk  ==!
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zdit(ji,jj,jk) = ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) ) * umask(ji,jj,jk)
-                  zdjt(ji,jj,jk) = ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) ) * vmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         IF( ln_zps.and.l_grad_zps ) THEN              ! partial steps: correction at the last level
-# if defined key_vectopt_loop
-            DO jj = 1, 1
-               DO ji = 1, jpij-jpi   ! vector opt. (forced unrolling)
-# else
-            DO jj = 1, jpjm1
-               DO ji = 1, jpim1
-# endif
-                  zdit(ji,jj,mbku(ji,jj)) = pgu(ji,jj,jn)
-                  zdjt(ji,jj,mbkv(ji,jj)) = pgv(ji,jj,jn)
-               END DO
-            END DO
-         ENDIF
-
-         !!----------------------------------------------------------------------
-         !!   II - horizontal trend  (full)
-         !!----------------------------------------------------------------------
-         !
-         DO jk = 1, jpkm1
-            !
-            !                    !==  Vertical tracer gradient at level jk and jk+1
-            zdkt3d(:,:,1) = ( ptb(:,:,jk,jn) - ptb(:,:,jk+1,jn) ) * tmask(:,:,jk+1)
-            !
-            !                    ! surface boundary condition: zdkt3d(jk=0)=zdkt3d(jk=1)
-            IF( jk == 1 ) THEN   ;   zdkt3d(:,:,0) = zdkt3d(:,:,1)
-            ELSE                 ;   zdkt3d(:,:,0) = ( ptb(:,:,jk-1,jn) - ptb(:,:,jk,jn) ) * tmask(:,:,jk)
-            ENDIF
-
-
-            IF (ln_botmix_grif) THEN
-               DO ip = 0, 1              !==  Horizontal & vertical fluxes
-                  DO kp = 0, 1
-                     DO jj = 1, jpjm1
-                        DO ji = 1, fs_jpim1
-                           ze1ur = 1._wp / e1u(ji,jj)
-                           zdxt  = zdit(ji,jj,jk) * ze1ur
-                           ze3wr = 1._wp / fse3w(ji+ip,jj,jk+kp)
-                           zdzt  = zdkt3d(ji+ip,jj,kp) * ze3wr
-                           zslope_skew = triadi_g(ji+ip,jj,jk,1-ip,kp)
-                           zslope_iso  = triadi(ji+ip,jj,jk,1-ip,kp)
-
-                           zbu = 0.25_wp * e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk)
-                           ! ln_botmix_grif is .T. don't mask zah for bottom half cells
-                           zah = fsahtu(ji,jj,jk)   !*umask(ji,jj,jk+kp)         !fsaht(ji+ip,jj,jk)           ===>>  ????
-                           zah_slp  = zah * zslope_iso
-                           zaei_slp = fsaeiw(ji+ip,jj,jk) * zslope_skew    !fsaeit(ji+ip,jj,jk)*zslope_skew
-                           zftu(ji,jj,jk) = zftu(ji,jj,jk) - ( zah * zdxt + (zah_slp - zaei_slp) * zdzt ) * zbu * ze1ur
-                           ztfw(ji+ip,jj,jk+kp) = ztfw(ji+ip,jj,jk+kp) - (zah_slp + zaei_slp) * zdxt * zbu * ze3wr
-                        END DO
-                     END DO
-                  END DO
-               END DO
-
-               DO jp = 0, 1
-                  DO kp = 0, 1
-                     DO jj = 1, jpjm1
-                        DO ji = 1, fs_jpim1
-                           ze2vr = 1._wp / e2v(ji,jj)
-                           zdyt  = zdjt(ji,jj,jk) * ze2vr
-                           ze3wr = 1._wp / fse3w(ji,jj+jp,jk+kp)
-                           zdzt  = zdkt3d(ji,jj+jp,kp) * ze3wr
-                           zslope_skew = triadj_g(ji,jj+jp,jk,1-jp,kp)
-                           zslope_iso  = triadj(ji,jj+jp,jk,1-jp,kp)
-                           zbv = 0.25_wp * e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk)
-                           ! ln_botmix_grif is .T. don't mask zah for bottom half cells
-                           zah = fsahtv(ji,jj,jk)        !*vmask(ji,jj,jk+kp)  ! fsaht(ji,jj+jp,jk)
-                           zah_slp = zah * zslope_iso
-                           zaei_slp = fsaeiw(ji,jj+jp,jk) * zslope_skew        ! fsaeit(ji,jj+jp,jk)*zslope_skew
-                           zftv(ji,jj,jk) = zftv(ji,jj,jk) - ( zah * zdyt + (zah_slp - zaei_slp) * zdzt ) * zbv * ze2vr
-                           ztfw(ji,jj+jp,jk+kp) = ztfw(ji,jj+jp,jk+kp) - (zah_slp + zaei_slp) * zdyt * zbv * ze3wr
-                        END DO
-                     END DO
-                  END DO
-               END DO
-            ELSE
-               DO ip = 0, 1              !==  Horizontal & vertical fluxes
-                  DO kp = 0, 1
-                     DO jj = 1, jpjm1
-                        DO ji = 1, fs_jpim1
-                           ze1ur = 1._wp / e1u(ji,jj)
-                           zdxt  = zdit(ji,jj,jk) * ze1ur
-                           ze3wr = 1._wp / fse3w(ji+ip,jj,jk+kp)
-                           zdzt  = zdkt3d(ji+ip,jj,kp) * ze3wr
-                           zslope_skew = triadi_g(ji+ip,jj,jk,1-ip,kp)
-                           zslope_iso  = triadi(ji+ip,jj,jk,1-ip,kp)
-
-                           zbu = 0.25_wp * e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk)
-                           ! ln_botmix_grif is .F. mask zah for bottom half cells
-                           zah = fsahtu(ji,jj,jk) * umask(ji,jj,jk+kp)         ! fsaht(ji+ip,jj,jk)   ===>>  ????
-                           zah_slp  = zah * zslope_iso
-                           zaei_slp = fsaeiw(ji+ip,jj,jk) * zslope_skew        ! fsaeit(ji+ip,jj,jk)*zslope_skew
-                           zftu(ji,jj,jk) = zftu(ji,jj,jk) - ( zah * zdxt + (zah_slp - zaei_slp) * zdzt ) * zbu * ze1ur
-                           ztfw(ji+ip,jj,jk+kp) = ztfw(ji+ip,jj,jk+kp) - (zah_slp + zaei_slp) * zdxt * zbu * ze3wr
-                        END DO
-                     END DO
-                  END DO
-               END DO
-
-               DO jp = 0, 1
-                  DO kp = 0, 1
-                     DO jj = 1, jpjm1
-                        DO ji = 1, fs_jpim1
-                           ze2vr = 1._wp / e2v(ji,jj)
-                           zdyt  = zdjt(ji,jj,jk) * ze2vr
-                           ze3wr = 1._wp / fse3w(ji,jj+jp,jk+kp)
-                           zdzt  = zdkt3d(ji,jj+jp,kp) * ze3wr
-                           zslope_skew = triadj_g(ji,jj+jp,jk,1-jp,kp)
-                           zslope_iso  = triadj(ji,jj+jp,jk,1-jp,kp)
-                           zbv = 0.25_wp * e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk)
-                           ! ln_botmix_grif is .F. mask zah for bottom half cells
-                           zah = fsahtv(ji,jj,jk) * vmask(ji,jj,jk+kp)         ! fsaht(ji,jj+jp,jk)
-                           zah_slp = zah * zslope_iso
-                           zaei_slp = fsaeiw(ji,jj+jp,jk) * zslope_skew        ! fsaeit(ji,jj+jp,jk)*zslope_skew
-                           zftv(ji,jj,jk) = zftv(ji,jj,jk) - ( zah * zdyt + (zah_slp - zaei_slp) * zdzt ) * zbv * ze2vr
-                           ztfw(ji,jj+jp,jk+kp) = ztfw(ji,jj+jp,jk+kp) - (zah_slp + zaei_slp) * zdyt * zbv * ze3wr
-                        END DO
-                     END DO
-                  END DO
-               END DO
-            END IF
-            !                          !==  divergence and add to the general trend  ==!
-            DO jj = 2 , jpjm1
-               DO ji = fs_2, fs_jpim1  ! vector opt.
-                  zbtr = 1._wp / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + zbtr * (   zftu(ji-1,jj,jk) - zftu(ji,jj,jk)   &
-                     &                                           + zftv(ji,jj-1,jk) - zftv(ji,jj,jk)   )
-               END DO
-            END DO
-            !
-         END DO
-         !
-         DO jk = 1, jpkm1              !== Divergence of vertical fluxes added to the general tracer trend
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1  ! vector opt.
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + (  ztfw(ji,jj,jk+1) - ztfw(ji,jj,jk)  )   &
-                     &                                / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
-               END DO
-            END DO
-         END DO
-         !
-         !                             ! "Poleward" diffusive heat or salt transports (T-S case only)
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN
-            IF( jn == jp_tem)   htr_ldf(:) = ptr_vj( zftv(:,:,:) )        ! 3.3  names
-            IF( jn == jp_sal)   str_ldf(:) = ptr_vj( zftv(:,:,:) )
-         ENDIF
-
-#if defined key_diaar5
-         IF( cdtype == 'TRA' .AND. jn == jp_tem  ) THEN
-            z2d(:,:) = 0._wp
-            zztmp = rau0 * rcp
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z2d(ji,jj) = z2d(ji,jj) + zftu(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            z2d(:,:) = zztmp * z2d(:,:)
-            CALL lbc_lnk( z2d, 'U', -1. )
-            CALL iom_put( "udiff_heattr", z2d )                  ! heat transport in i-direction
-            z2d(:,:) = 0._wp
-            DO jk = 1, jpkm1
-               DO jj = 2, jpjm1
-                  DO ji = fs_2, fs_jpim1   ! vector opt.
-                     z2d(ji,jj) = z2d(ji,jj) + zftv(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            z2d(:,:) = zztmp * z2d(:,:)
-            CALL lbc_lnk( z2d, 'V', -1. )
-            CALL iom_put( "vdiff_heattr", z2d )                  !  heat transport in j-direction
-         END IF
-#endif
-         !
-      END DO
-      !
-      CALL wrk_dealloc( jpi, jpj,      z2d ) 
-      CALL wrk_dealloc( jpi, jpj, jpk, zdit, zdjt, ztfw  ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tra_ldf_iso_grif')
-      !
-  END SUBROUTINE tra_ldf_iso_grif
-
-#else
-   !!----------------------------------------------------------------------
-   !!   default option :   Dummy code   NO rotation of the diffusive tensor
-   !!----------------------------------------------------------------------
-   REAL, PUBLIC, DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   psix_eiv, psiy_eiv   !: eiv stream function (diag only)
-CONTAINS
-   SUBROUTINE tra_ldf_iso_grif( kt, kit000, cdtype, pgu, pgv,              &
-       &                                   ptb, pta, kjpt, pahtb0 )
-      CHARACTER(len=3) ::   cdtype
-      INTEGER          ::   kit000     ! first time step index
-      REAL, DIMENSION(:,:,:) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL, DIMENSION(:,:,:,:) ::   ptb, pta
-      WRITE(*,*) 'tra_ldf_iso_grif: You should not have seen this print! error?', kt, cdtype,    &
-         &                  pgu(1,1,1), pgv(1,1,1), ptb(1,1,1,1), pta(1,1,1,1), kjpt, pahtb0
-   END SUBROUTINE tra_ldf_iso_grif
-#endif
-
-   !!==============================================================================
-END MODULE traldf_iso_grif
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_lap.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/traldf_lap.F90	(revision 2446)
+++ 	(revision )
@@ -1,147 +1,0 @@
-MODULE traldf_lap
-   !!==============================================================================
-   !!                       ***  MODULE  traldf_lap  ***
-   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
-   !!==============================================================================
-   !! History :  OPA  !  87-06  (P. Andrich, D. L Hostis)  Original code
-   !!                 !  91-11  (G. Madec)
-   !!                 !  95-11  (G. Madec)  suppress volumetric scale factors
-   !!                 !  96-01  (G. Madec)  statement function for e3
-   !!            NEMO !  02-06  (G. Madec)  F90: Free form and module
-   !!            1.0  !  04-08  (C. Talandier) New trends organization
-   !!                 !  05-11  (G. Madec)  add zps case
-   !!            3.0  !  10-06  (C. Ethe, G. Madec) Merge TRA-TRC
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tra_ldf_lap  : update the tracer trend with the horizontal diffusion
-   !!                 using a iso-level harmonic (laplacien) operator.
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE ldftra_oce      ! ocean active tracers: lateral physics
-   USE in_out_manager  ! I/O manager
-   USE diaptr_oce          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE lib_mpp         ! MPP library
-   USE timing          ! Timing
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   tra_ldf_lap   ! routine called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "ldftra_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: traldf_lap.F90 4364 2014-01-22 13:46:03Z jchanut $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE tra_ldf_lap( kt, kit000, cdtype, pgu, pgv,      &
-      &                                ptb, pta, kjpt ) 
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE tra_ldf_lap  ***
-      !!                   
-      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive 
-      !!      trend and add it to the general trend of tracer equation.
-      !!
-      !! ** Method  :   Second order diffusive operator evaluated using before
-      !!      fields (forward time scheme). The horizontal diffusive trends of 
-      !!      the tracer is given by:
-      !!          difft = 1/(e1t*e2t*e3t) {  di-1[ aht e2u*e3u/e1u di(tb) ]
-      !!                                   + dj-1[ aht e1v*e3v/e2v dj(tb) ] }
-      !!      Add this trend to the general tracer trend pta :
-      !!          pta = pta + difft
-      !!
-      !! ** Action  : - Update pta arrays with the before iso-level 
-      !!                harmonic mixing trend.
-      !!----------------------------------------------------------------------
-      USE oce, ONLY:   ztu => ua , ztv => va  ! (ua,va) used as workspace
-      !
-      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
-      INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index
-      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
-      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj    ,kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb        ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend 
-      !
-      INTEGER  ::   ji, jj, jk, jn       ! dummy loop indices
-      INTEGER  ::   iku, ikv, ierr       ! local integers
-      REAL(wp) ::   zabe1, zabe2, zbtr   ! local scalars
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 ) CALL timing_start('tra_ldf_lap')
-      !
-      IF( kt == kit000 )  THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'tra_ldf_lap : iso-level laplacian diffusion on ', cdtype
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ '
-      ENDIF
-
-      !                                                          ! =========== !
-      DO jn = 1, kjpt                                            ! tracer loop !
-         !                                                       ! =========== !    
-         DO jk = 1, jpkm1                                            ! slab loop
-            !                                           
-            ! 1. First derivative (gradient)
-            ! -------------------
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
-                  zabe1 = fsahtu(ji,jj,jk) * umask(ji,jj,jk) * re2u_e1u(ji,jj) * fse3u_n(ji,jj,jk)
-                  zabe2 = fsahtv(ji,jj,jk) * vmask(ji,jj,jk) * re1v_e2v(ji,jj) * fse3v_n(ji,jj,jk)
-                  ztu(ji,jj,jk) = zabe1 * ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) )
-                  ztv(ji,jj,jk) = zabe2 * ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
-               END DO
-            END DO
-            IF( ln_zps ) THEN      ! set gradient at partial step level
-               DO jj = 1, jpjm1
-                  DO ji = 1, fs_jpim1   ! vector opt.
-                     ! last level
-                     iku = mbku(ji,jj)
-                     ikv = mbkv(ji,jj)
-                     IF( iku == jk ) THEN
-                        zabe1 = fsahtu(ji,jj,iku) * umask(ji,jj,iku) * re2u_e1u(ji,jj) * fse3u_n(ji,jj,iku)
-                        ztu(ji,jj,jk) = zabe1 * pgu(ji,jj,jn)
-                     ENDIF
-                     IF( ikv == jk ) THEN
-                        zabe2 = fsahtv(ji,jj,ikv) * vmask(ji,jj,ikv) * re1v_e2v(ji,jj) * fse3v_n(ji,jj,ikv)
-                        ztv(ji,jj,jk) = zabe2 * pgv(ji,jj,jn)
-                     ENDIF
-                  END DO
-               END DO
-            ENDIF
-         
-         
-            ! 2. Second derivative (divergence) added to the general tracer trends
-            ! ---------------------------------------------------------------------
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1._wp / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) )
-                  ! horizontal diffusive trends added to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + zbtr * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk)   &
-                     &                                          + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  )
-               END DO
-            END DO
-            !
-         END DO                                             !  End of slab  
-         !
-         ! "Poleward" diffusive heat or salt transports
-         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nn_fptr ) == 0 ) ) THEN
-            IF( jn  == jp_tem)   htr_ldf(:) = ptr_vj( ztv(:,:,:) )
-            IF( jn  == jp_sal)   str_ldf(:) = ptr_vj( ztv(:,:,:) )
-         ENDIF
-         !                                                  ! ==================
-      END DO                                                ! end of tracer loop
-      !                                                     ! ==================
-      IF( nn_timing == 1 ) CALL timing_stop('tra_ldf_lap')
-      !
-   END SUBROUTINE tra_ldf_lap
-
-   !!==============================================================================
-END MODULE traldf_lap
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trc_oce.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/trc_oce.F90	(revision 2446)
+++ 	(revision )
@@ -1,290 +1,0 @@
-MODULE trc_oce
-   !!======================================================================
-   !!                      ***  MODULE  trc_oce  ***
-   !! Ocean passive tracer  :  share SMS/Ocean variables
-   !!======================================================================
-   !! History :  1.0  !  2004-03  (C. Ethe)  Original code
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   trc_oce_rgb : tabulated attenuation coefficients for RGB light penetration         
-   !!----------------------------------------------------------------------
-   USE par_oce
-   USE in_out_manager  ! I/O manager
-   USE dom_oce         ! ocean space and time domain
-   USE lib_mpp         ! MPP library
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   trc_oce_rgb        ! routine called by traqsr.F90
-   PUBLIC   trc_oce_rgb_read   ! routine called by traqsr.F90
-   PUBLIC   trc_oce_ext_lev    ! function called by traqsr.F90 at least
-   PUBLIC   trc_oce_alloc      ! function called by nemogcm.F90
-
-   INTEGER , PUBLIC                                      ::   nn_dttrc      !: frequency of step on passive tracers
-   REAL(wp), PUBLIC                                      ::   r_si2         !: largest depth of extinction (blue & 0.01 mg.m-3)  (RGB)
-   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   etot3         !: light absortion coefficient
-   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   facvol        !: volume for degraded regions
-
-#if defined key_top 
-   !!----------------------------------------------------------------------
-   !!   'key_top'                                                 bio-model          
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_qsr_bio = .TRUE.   !: bio-model light absorption flag
-#else
-   !!----------------------------------------------------------------------
-   !! Default option                          No bio-model light absorption      
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_qsr_bio = .FALSE.   !: bio-model light absorption flag
-#endif
-
-#if defined key_offline
-   !!----------------------------------------------------------------------
-   !!   'key_offline'                                     OFFLINE mode          
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_offline = .TRUE.   !: offline flag
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                   NO  OFFLINE mode          
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_offline = .FALSE.   !: offline flag
-#endif
-#if defined key_degrad
-   !!----------------------------------------------------------------------
-   !!   'key_degrad'                                     Degradation mode          
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .TRUE.   !: degradation flag
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                   NO  Degradation mode          
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .FALSE.   !: degradation flag
-#endif
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: trc_oce.F90 4623 2014-04-22 15:21:41Z acc $ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   INTEGER FUNCTION trc_oce_alloc()
-      !!----------------------------------------------------------------------
-      !!                  ***  trc_oce_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER ::   ierr(2)        ! Local variables
-      !!----------------------------------------------------------------------
-      ierr(:) = 0
-                     ALLOCATE( etot3 (jpi,jpj,jpk), STAT=ierr(1) )
-      IF( lk_degrad) ALLOCATE( facvol(jpi,jpj,jpk), STAT=ierr(2) )
-      trc_oce_alloc  = MAXVAL( ierr )
-      !
-      IF( trc_oce_alloc /= 0 )   CALL ctl_warn('trc_oce_alloc: failed to allocate etot3 array')
-   END FUNCTION trc_oce_alloc
-
-
-   SUBROUTINE trc_oce_rgb( prgb )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_opt_init  ***
-      !!
-      !! ** Purpose :   Initialization of of the optical scheme
-      !!
-      !! ** Method  :   Set a look up table for the optical coefficients
-      !!                i.e. the attenuation coefficient for R-G-B light 
-      !!                tabulated in Chlorophyll class (from JM Andre)
-      !!
-      !! ** Action  :   prgb(3,61) tabulated R-G-B attenuation coef. 
-      !!
-      !! Reference  : Lengaigne et al. 2007, Clim. Dyn., V28, 5, 503-516.
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(3,61), INTENT(out) ::   prgb   ! tabulated attenuation coefficient
-      !!
-      INTEGER  ::   jc     ! dummy loop indice
-      INTEGER  ::   irgb   ! temporary integer
-      REAL(wp) ::   zchl   ! temporary scalar
-      REAL(wp), DIMENSION(4,61) ::   zrgb   ! tabulated attenuation coefficient (formerly read in 'kRGB61.txt')
-      !!----------------------------------------------------------------------
-      !
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'trc_oce_rgb : Initialisation of the optical look-up table'
-         WRITE(numout,*) '~~~~~~~~~~~ '
-      ENDIF
-      !
-      !  Chlorophyll        !     Blue attenuation     !     Green attenuation    !     Red attenuation      !
-      zrgb(1, 1) =  0.010   ;   zrgb(2, 1) = 0.01618   ;   zrgb(3, 1) = 0.07464   ;   zrgb(4, 1) = 0.37807
-      zrgb(1, 2) =  0.011   ;   zrgb(2, 2) = 0.01654   ;   zrgb(3, 2) = 0.07480   ;   zrgb(4, 2) = 0.37823
-      zrgb(1, 3) =  0.013   ;   zrgb(2, 3) = 0.01693   ;   zrgb(3, 3) = 0.07499   ;   zrgb(4, 3) = 0.37840
-      zrgb(1, 4) =  0.014   ;   zrgb(2, 4) = 0.01736   ;   zrgb(3, 4) = 0.07518   ;   zrgb(4, 4) = 0.37859
-      zrgb(1, 5) =  0.016   ;   zrgb(2, 5) = 0.01782   ;   zrgb(3, 5) = 0.07539   ;   zrgb(4, 5) = 0.37879
-      zrgb(1, 6) =  0.018   ;   zrgb(2, 6) = 0.01831   ;   zrgb(3, 6) = 0.07562   ;   zrgb(4, 6) = 0.37900
-      zrgb(1, 7) =  0.020   ;   zrgb(2, 7) = 0.01885   ;   zrgb(3, 7) = 0.07586   ;   zrgb(4, 7) = 0.37923
-      zrgb(1, 8) =  0.022   ;   zrgb(2, 8) = 0.01943   ;   zrgb(3, 8) = 0.07613   ;   zrgb(4, 8) = 0.37948
-      zrgb(1, 9) =  0.025   ;   zrgb(2, 9) = 0.02005   ;   zrgb(3, 9) = 0.07641   ;   zrgb(4, 9) = 0.37976
-      zrgb(1,10) =  0.028   ;   zrgb(2,10) = 0.02073   ;   zrgb(3,10) = 0.07672   ;   zrgb(4,10) = 0.38005
-      zrgb(1,11) =  0.032   ;   zrgb(2,11) = 0.02146   ;   zrgb(3,11) = 0.07705   ;   zrgb(4,11) = 0.38036
-      zrgb(1,12) =  0.035   ;   zrgb(2,12) = 0.02224   ;   zrgb(3,12) = 0.07741   ;   zrgb(4,12) = 0.38070
-      zrgb(1,13) =  0.040   ;   zrgb(2,13) = 0.02310   ;   zrgb(3,13) = 0.07780   ;   zrgb(4,13) = 0.38107
-      zrgb(1,14) =  0.045   ;   zrgb(2,14) = 0.02402   ;   zrgb(3,14) = 0.07821   ;   zrgb(4,14) = 0.38146
-      zrgb(1,15) =  0.050   ;   zrgb(2,15) = 0.02501   ;   zrgb(3,15) = 0.07866   ;   zrgb(4,15) = 0.38189
-      zrgb(1,16) =  0.056   ;   zrgb(2,16) = 0.02608   ;   zrgb(3,16) = 0.07914   ;   zrgb(4,16) = 0.38235
-      zrgb(1,17) =  0.063   ;   zrgb(2,17) = 0.02724   ;   zrgb(3,17) = 0.07967   ;   zrgb(4,17) = 0.38285
-      zrgb(1,18) =  0.071   ;   zrgb(2,18) = 0.02849   ;   zrgb(3,18) = 0.08023   ;   zrgb(4,18) = 0.38338
-      zrgb(1,19) =  0.079   ;   zrgb(2,19) = 0.02984   ;   zrgb(3,19) = 0.08083   ;   zrgb(4,19) = 0.38396
-      zrgb(1,20) =  0.089   ;   zrgb(2,20) = 0.03131   ;   zrgb(3,20) = 0.08149   ;   zrgb(4,20) = 0.38458
-      zrgb(1,21) =  0.100   ;   zrgb(2,21) = 0.03288   ;   zrgb(3,21) = 0.08219   ;   zrgb(4,21) = 0.38526
-      zrgb(1,22) =  0.112   ;   zrgb(2,22) = 0.03459   ;   zrgb(3,22) = 0.08295   ;   zrgb(4,22) = 0.38598
-      zrgb(1,23) =  0.126   ;   zrgb(2,23) = 0.03643   ;   zrgb(3,23) = 0.08377   ;   zrgb(4,23) = 0.38676
-      zrgb(1,24) =  0.141   ;   zrgb(2,24) = 0.03842   ;   zrgb(3,24) = 0.08466   ;   zrgb(4,24) = 0.38761
-      zrgb(1,25) =  0.158   ;   zrgb(2,25) = 0.04057   ;   zrgb(3,25) = 0.08561   ;   zrgb(4,25) = 0.38852
-      zrgb(1,26) =  0.178   ;   zrgb(2,26) = 0.04289   ;   zrgb(3,26) = 0.08664   ;   zrgb(4,26) = 0.38950
-      zrgb(1,27) =  0.200   ;   zrgb(2,27) = 0.04540   ;   zrgb(3,27) = 0.08775   ;   zrgb(4,27) = 0.39056
-      zrgb(1,28) =  0.224   ;   zrgb(2,28) = 0.04811   ;   zrgb(3,28) = 0.08894   ;   zrgb(4,28) = 0.39171
-      zrgb(1,29) =  0.251   ;   zrgb(2,29) = 0.05103   ;   zrgb(3,29) = 0.09023   ;   zrgb(4,29) = 0.39294
-      zrgb(1,30) =  0.282   ;   zrgb(2,30) = 0.05420   ;   zrgb(3,30) = 0.09162   ;   zrgb(4,30) = 0.39428
-      zrgb(1,31) =  0.316   ;   zrgb(2,31) = 0.05761   ;   zrgb(3,31) = 0.09312   ;   zrgb(4,31) = 0.39572
-      zrgb(1,32) =  0.355   ;   zrgb(2,32) = 0.06130   ;   zrgb(3,32) = 0.09474   ;   zrgb(4,32) = 0.39727
-      zrgb(1,33) =  0.398   ;   zrgb(2,33) = 0.06529   ;   zrgb(3,33) = 0.09649   ;   zrgb(4,33) = 0.39894
-      zrgb(1,34) =  0.447   ;   zrgb(2,34) = 0.06959   ;   zrgb(3,34) = 0.09837   ;   zrgb(4,34) = 0.40075
-      zrgb(1,35) =  0.501   ;   zrgb(2,35) = 0.07424   ;   zrgb(3,35) = 0.10040   ;   zrgb(4,35) = 0.40270
-      zrgb(1,36) =  0.562   ;   zrgb(2,36) = 0.07927   ;   zrgb(3,36) = 0.10259   ;   zrgb(4,36) = 0.40480
-      zrgb(1,37) =  0.631   ;   zrgb(2,37) = 0.08470   ;   zrgb(3,37) = 0.10495   ;   zrgb(4,37) = 0.40707
-      zrgb(1,38) =  0.708   ;   zrgb(2,38) = 0.09056   ;   zrgb(3,38) = 0.10749   ;   zrgb(4,38) = 0.40952
-      zrgb(1,39) =  0.794   ;   zrgb(2,39) = 0.09690   ;   zrgb(3,39) = 0.11024   ;   zrgb(4,39) = 0.41216
-      zrgb(1,40) =  0.891   ;   zrgb(2,40) = 0.10374   ;   zrgb(3,40) = 0.11320   ;   zrgb(4,40) = 0.41502
-      zrgb(1,41) =  1.000   ;   zrgb(2,41) = 0.11114   ;   zrgb(3,41) = 0.11639   ;   zrgb(4,41) = 0.41809
-      zrgb(1,42) =  1.122   ;   zrgb(2,42) = 0.11912   ;   zrgb(3,42) = 0.11984   ;   zrgb(4,42) = 0.42142
-      zrgb(1,43) =  1.259   ;   zrgb(2,43) = 0.12775   ;   zrgb(3,43) = 0.12356   ;   zrgb(4,43) = 0.42500
-      zrgb(1,44) =  1.413   ;   zrgb(2,44) = 0.13707   ;   zrgb(3,44) = 0.12757   ;   zrgb(4,44) = 0.42887
-      zrgb(1,45) =  1.585   ;   zrgb(2,45) = 0.14715   ;   zrgb(3,45) = 0.13189   ;   zrgb(4,45) = 0.43304
-      zrgb(1,46) =  1.778   ;   zrgb(2,46) = 0.15803   ;   zrgb(3,46) = 0.13655   ;   zrgb(4,46) = 0.43754
-      zrgb(1,47) =  1.995   ;   zrgb(2,47) = 0.16978   ;   zrgb(3,47) = 0.14158   ;   zrgb(4,47) = 0.44240
-      zrgb(1,48) =  2.239   ;   zrgb(2,48) = 0.18248   ;   zrgb(3,48) = 0.14701   ;   zrgb(4,48) = 0.44765
-      zrgb(1,49) =  2.512   ;   zrgb(2,49) = 0.19620   ;   zrgb(3,49) = 0.15286   ;   zrgb(4,49) = 0.45331
-      zrgb(1,50) =  2.818   ;   zrgb(2,50) = 0.21102   ;   zrgb(3,50) = 0.15918   ;   zrgb(4,50) = 0.45942
-      zrgb(1,51) =  3.162   ;   zrgb(2,51) = 0.22703   ;   zrgb(3,51) = 0.16599   ;   zrgb(4,51) = 0.46601
-      zrgb(1,52) =  3.548   ;   zrgb(2,52) = 0.24433   ;   zrgb(3,52) = 0.17334   ;   zrgb(4,52) = 0.47313
-      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,53) = 0.48080
-      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,54) = 0.48909
-      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,55) = 0.49803
-      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,56) = 0.50768
-      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,57) = 0.51810
-      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,58) = 0.52934
-      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,59) = 0.54147
-      zrgb(1,60) =  8.912   ;   zrgb(2,60) = 0.44336   ;   zrgb(3,60) = 0.25725   ;   zrgb(4,60) = 0.55457
-      zrgb(1,61) = 10.000   ;   zrgb(2,61) = 0.47804   ;   zrgb(3,61) = 0.27178   ;   zrgb(4,61) = 0.56870
-      !
-      !
-      prgb(:,:) = zrgb(2:4,:)
-      !
-      r_si2 = 1.e0 / zrgb(2, 1)        ! blue with the smallest chlorophyll concentration)
-      !!! O.M : essai type NEMO 3.2
-      IF(lwp) WRITE(numout,*) '     RGB longest depth of extinction    r_si2 set back to NEMO 3.2 value'
-      r_si2 = 62.0
-      IF(lwp) WRITE(numout,*) '      RGB longest depth of extinction    r_si2 = ', r_si2
-      !
-      DO jc = 1, 61                         ! check
-         zchl = zrgb(1,jc)
-         irgb = NINT( 41 + 20.* LOG10( zchl ) + 1.e-15 )
-         IF(lwp) WRITE(numout,*) '    jc =', jc, '  Chl = ', zchl, '  irgb = ', irgb
-         IF( irgb /= jc ) THEN
-            IF(lwp) WRITE(numout,*) '    jc =', jc, '  Chl = ', zchl, '  Chl class = ', irgb
-            CALL ctl_stop( 'trc_oce_rgb : inconsistency in Chl tabulated attenuation coeff.' )
-         ENDIF
-      END DO
-      !
-   END SUBROUTINE trc_oce_rgb
-
-
-   SUBROUTINE trc_oce_rgb_read( prgb )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_opt_init  ***
-      !!
-      !! ** Purpose :   Initialization of of the optical scheme
-      !!
-      !! ** Method  :   read the look up table for the optical coefficients
-      !!
-      !! ** input   :   xkrgb(61) precomputed array corresponding to the  
-      !!                          attenuation coefficient (from JM Andre)
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(3,61), INTENT(out) ::   prgb   ! tabulated attenuation coefficient
-      !!
-      INTEGER  ::   jc, jb ! dummy loop indice
-      INTEGER  ::   irgb   ! temporary integer
-      REAL(wp) ::   zchl   ! temporary scalar
-      INTEGER  ::   numlight
-      !!----------------------------------------------------------------------
-      !
-      IF(lwp) THEN                         ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' trc_oce_rgb_read : optical look-up table read in kRGB61.txt file'
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) 
-      ENDIF
-      !
-      CALL ctl_opn( numlight, 'kRGB61.txt', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-      DO jc = 1, 61
-         READ(numlight,*) zchl, ( prgb(jb,jc), jb = 1, 3 )
-         irgb = NINT( 41 + 20.* LOG10( zchl ) + 1.e-15 )   
-         IF(lwp) WRITE(numout,*) '    jc =', jc, '  Chl = ', zchl, '  irgb = ', irgb  
-         IF( irgb /= jc ) THEN  
-            IF(lwp) WRITE(numout,*) '    jc =', jc, '  Chl = ', zchl, '  Chl class = ', irgb
-            CALL ctl_stop( 'trc_oce_rgb_read : inconsistency in Chl tabulated attenuation coeff.' )
-         ENDIF
-      END DO
-      CLOSE( numlight )
-      !
-      r_si2 = 1.e0 / prgb(1, 1)      ! blue with the smallest chlorophyll concentration)
-      IF(lwp) WRITE(numout,*) '      RGB longest depth of extinction    r_si2 = ', r_si2
-      !
-   END SUBROUTINE trc_oce_rgb_read
-
-
-   FUNCTION trc_oce_ext_lev( prldex, pqsr_frc ) RESULT( pjl )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE trc_oce_ext_lev  ***
-      !!       
-      !! ** Purpose :   compute max. level for light penetration
-      !!          
-      !! ** Method  :   the function provides the level at which irradiance 
-      !!                becomes negligible (i.e. = 1.e-15 W/m2) for 3 or 2 bands light
-      !!                penetration: I(z) = pqsr_frc * EXP(hext/prldex) = 1.e-15 W/m2
-      !!                # prldex is the longest depth of extinction:
-      !!                   - prldex = 23 m (2 bands case)
-      !!                   - prldex = 62 m (3 bands case: blue waveband & 0.01 mg/m2 for the chlorophyll)
-      !!                # pqsr_frc is the fraction of solar radiation which penetrates,
-      !!                considering Qsr=240 W/m2 and rn_abs = 0.58:
-      !!                   - pqsr_frc = Qsr * (1-rn_abs)   = 1.00e2 W/m2 (2 bands case)
-      !!                   - pqsr_frc = Qsr * (1-rn_abs)/3 = 0.33e2 W/m2 (3 bands case & equi-partition)
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in) ::   prldex    ! longest depth of extinction
-      REAL(wp), INTENT(in) ::   pqsr_frc  ! frac. solar radiation which penetrates 
-      !!
-      INTEGER  ::   jk, pjl            ! levels
-      REAL(wp) ::   zhext              ! deepest level till which light penetrates
-      REAL(wp) ::   zprec = 15._wp     ! precision to reach -LOG10(1.e-15)
-      REAL(wp) ::   zem                ! temporary scalar 
-      !!----------------------------------------------------------------------
-      !
-      ! It is not necessary to compute anything below the following depth
-      zhext = prldex * ( LOG(10._wp) * zprec + LOG(pqsr_frc) )
-      !
-      ! Level of light extinction
-      pjl = jpkm1
-      DO jk = jpkm1, 1, -1
-         IF(SUM(tmask(:,:,jk)) > 0 ) THEN
-            zem = MAXVAL( fsdepw(:,:,jk+1) * tmask(:,:,jk) )
-            IF( zem >= zhext )   pjl = jk                       ! last T-level reached by Qsr
-         ELSE
-            pjl = jk                                            ! or regional sea-bed depth 
-         ENDIF
-      END DO
-      !
-   END FUNCTION trc_oce_ext_lev
-
-   !!======================================================================
-END MODULE trc_oce
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/zdftke.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/zdftke.F90	(revision 2446)
+++ 	(revision )
@@ -1,868 +1,0 @@
-MODULE zdftke
-   !!======================================================================
-   !!                       ***  MODULE  zdftke  ***
-   !! Ocean physics:  vertical mixing coefficient computed from the tke 
-   !!                 turbulent closure parameterization
-   !!=====================================================================
-   !! History :  OPA  !  1991-03  (b. blanke)  Original code
-   !!            7.0  !  1991-11  (G. Madec)   bug fix
-   !!            7.1  !  1992-10  (G. Madec)   new mixing length and eav
-   !!            7.2  !  1993-03  (M. Guyon)   symetrical conditions
-   !!            7.3  !  1994-08  (G. Madec, M. Imbard)  nn_pdl flag
-   !!            7.5  !  1996-01  (G. Madec)   s-coordinates
-   !!            8.0  !  1997-07  (G. Madec)   lbc
-   !!            8.1  !  1999-01  (E. Stretta) new option for the mixing length
-   !!  NEMO      1.0  !  2002-06  (G. Madec) add tke_init routine
-   !!             -   !  2004-10  (C. Ethe )  1D configuration
-   !!            2.0  !  2006-07  (S. Masson)  distributed restart using iom
-   !!            3.0  !  2008-05  (C. Ethe,  G.Madec) : update TKE physics:
-   !!                 !           - tke penetration (wind steering)
-   !!                 !           - suface condition for tke & mixing length
-   !!                 !           - Langmuir cells
-   !!             -   !  2008-05  (J.-M. Molines, G. Madec)  2D form of avtb
-   !!             -   !  2008-06  (G. Madec)  style + DOCTOR name for namelist parameters
-   !!             -   !  2008-12  (G. Reffray) stable discretization of the production term 
-   !!            3.2  !  2009-06  (G. Madec, S. Masson) TKE restart compatible with key_cpl 
-   !!                 !                                + cleaning of the parameters + bugs correction
-   !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase
-   !!----------------------------------------------------------------------
-#if defined key_zdftke   ||   defined key_esopa
-   !!----------------------------------------------------------------------
-   !!   'key_zdftke'                                   TKE vertical physics
-   !!----------------------------------------------------------------------
-   !!   zdf_tke       : update momentum and tracer Kz from a tke scheme
-   !!   tke_tke       : tke time stepping: update tke at now time step (en)
-   !!   tke_avn       : compute mixing length scale and deduce avm and avt
-   !!   zdf_tke_init  : initialization, namelist read, and parameters control
-   !!   tke_rst       : read/write tke restart in ocean restart file
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean: dynamics and active tracers variables
-   USE phycst         ! physical constants
-   USE dom_oce        ! domain: ocean
-   USE domvvl         ! domain: variable volume layer
-   USE sbc_oce        ! surface boundary condition: ocean
-   USE zdf_oce        ! vertical physics: ocean variables
-   USE zdfmxl         ! vertical physics: mixed layer
-   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
-   USE prtctl         ! Print control
-   USE in_out_manager ! I/O manager
-   USE iom            ! I/O manager library
-   USE lib_mpp        ! MPP library
-   USE wrk_nemo       ! work arrays
-   USE timing         ! Timing
-   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   zdf_tke        ! routine called in step module
-   PUBLIC   zdf_tke_init   ! routine called in opa module
-   PUBLIC   tke_rst        ! routine called in step module
-
-   LOGICAL , PUBLIC, PARAMETER ::   lk_zdftke = .TRUE.  !: TKE vertical mixing flag
-
-   !                      !!** Namelist  namzdf_tke  **
-   LOGICAL  ::   ln_mxl0   ! mixing length scale surface value as function of wind stress or not
-   INTEGER  ::   nn_mxl    ! type of mixing length (=0/1/2/3)
-   REAL(wp) ::   rn_mxl0   ! surface  min value of mixing length (kappa*z_o=0.4*0.1 m)  [m]
-   INTEGER  ::   nn_pdl    ! Prandtl number or not (ratio avt/avm) (=0/1)
-   REAL(wp) ::   rn_ediff  ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e)
-   REAL(wp) ::   rn_ediss  ! coefficient of the Kolmogoroff dissipation 
-   REAL(wp) ::   rn_ebb    ! coefficient of the surface input of tke
-   REAL(wp) ::   rn_emin   ! minimum value of tke           [m2/s2]
-   REAL(wp) ::   rn_emin0  ! surface minimum value of tke   [m2/s2]
-   REAL(wp) ::   rn_bshear ! background shear (>0) currently a numerical threshold (do not change it)
-   INTEGER  ::   nn_etau   ! type of depth penetration of surface tke (=0/1/2/3)
-   INTEGER  ::   nn_htau   ! type of tke profile of penetration (=0/1)
-   REAL(wp) ::   rn_efr    ! fraction of TKE surface value which penetrates in the ocean
-   LOGICAL  ::   ln_lc     ! Langmuir cells (LC) as a source term of TKE or not
-   REAL(wp) ::   rn_lc     ! coef to compute vertical velocity of Langmuir cells
-
-   REAL(wp) ::   ri_cri    ! critic Richardson number (deduced from rn_ediff and rn_ediss values)
-   REAL(wp) ::   rmxl_min  ! minimum mixing length value (deduced from rn_ediff and rn_emin values)  [m]
-   REAL(wp) ::   rhftau_add = 1.e-3_wp     ! add offset   applied to HF part of taum  (nn_etau=3)
-   REAL(wp) ::   rhftau_scl = 1.0_wp       ! scale factor applied to HF part of taum  (nn_etau=3)
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   en             !: now turbulent kinetic energy   [m2/s2]
-   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   htau           ! depth of tke penetration (nn_htau)
-   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   dissl          ! now mixing lenght of dissipation
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avt_k , avm_k  ! not enhanced Kz
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avmu_k, avmv_k ! not enhanced Kz
-#if defined key_c1d
-   !                                                                        !!** 1D cfg only  **   ('key_c1d')
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e_dis, e_mix   !: dissipation and mixing turbulent lengh scales
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e_pdl, e_ric   !: prandl and local Richardson numbers
-#endif
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
-   !! $Id: zdftke.F90 4147 2013-11-04 11:51:55Z cetlod $
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   INTEGER FUNCTION zdf_tke_alloc()
-      !!----------------------------------------------------------------------
-      !!                ***  FUNCTION zdf_tke_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE(                                                                    &
-#if defined key_c1d
-         &      e_dis(jpi,jpj,jpk) , e_mix(jpi,jpj,jpk) ,                          &
-         &      e_pdl(jpi,jpj,jpk) , e_ric(jpi,jpj,jpk) ,                          &
-#endif
-         &      en    (jpi,jpj,jpk) , htau  (jpi,jpj)    , dissl(jpi,jpj,jpk) ,     & 
-         &      avt_k (jpi,jpj,jpk) , avm_k (jpi,jpj,jpk),                          &
-         &      avmu_k(jpi,jpj,jpk) , avmv_k(jpi,jpj,jpk), STAT= zdf_tke_alloc      )
-         !
-      IF( lk_mpp             )   CALL mpp_sum ( zdf_tke_alloc )
-      IF( zdf_tke_alloc /= 0 )   CALL ctl_warn('zdf_tke_alloc: failed to allocate arrays')
-      !
-   END FUNCTION zdf_tke_alloc
-
-
-   SUBROUTINE zdf_tke( kt )
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE zdf_tke  ***
-      !!
-      !! ** Purpose :   Compute the vertical eddy viscosity and diffusivity
-      !!              coefficients using a turbulent closure scheme (TKE).
-      !!
-      !! ** Method  :   The time evolution of the turbulent kinetic energy (tke)
-      !!              is computed from a prognostic equation :
-      !!         d(en)/dt = avm (d(u)/dz)**2             ! shear production
-      !!                  + d( avm d(en)/dz )/dz         ! diffusion of tke
-      !!                  + avt N^2                      ! stratif. destruc.
-      !!                  - rn_ediss / emxl en**(2/3)    ! Kolmogoroff dissipation
-      !!      with the boundary conditions:
-      !!         surface: en = max( rn_emin0, rn_ebb * taum )
-      !!         bottom : en = rn_emin
-      !!      The associated critical Richardson number is: ri_cri = 2/(2+rn_ediss/rn_ediff) 
-      !!
-      !!        The now Turbulent kinetic energy is computed using the following 
-      !!      time stepping: implicit for vertical diffusion term, linearized semi
-      !!      implicit for kolmogoroff dissipation term, and explicit forward for 
-      !!      both buoyancy and shear production terms. Therefore a tridiagonal 
-      !!      linear system is solved. Note that buoyancy and shear terms are
-      !!      discretized in a energy conserving form (Bruchard 2002).
-      !!
-      !!        The dissipative and mixing length scale are computed from en and
-      !!      the stratification (see tke_avn)
-      !!
-      !!        The now vertical eddy vicosity and diffusivity coefficients are
-      !!      given by: 
-      !!              avm = max( avtb, rn_ediff * zmxlm * en^1/2 )
-      !!              avt = max( avmb, pdl * avm                 )  
-      !!              eav = max( avmb, avm )
-      !!      where pdl, the inverse of the Prandtl number is 1 if nn_pdl=0 and
-      !!      given by an empirical funtion of the localRichardson number if nn_pdl=1 
-      !!
-      !! ** Action  :   compute en (now turbulent kinetic energy)
-      !!                update avt, avmu, avmv (before vertical eddy coef.)
-      !!
-      !! References : Gaspar et al., JGR, 1990,
-      !!              Blanke and Delecluse, JPO, 1991
-      !!              Mellor and Blumberg, JPO 2004
-      !!              Axell, JGR, 2002
-      !!              Bruchard OM 2002
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time step
-      !!----------------------------------------------------------------------
-      !
-      IF( kt /= nit000 ) THEN   ! restore before value to compute tke
-         avt (:,:,:) = avt_k (:,:,:) 
-         avm (:,:,:) = avm_k (:,:,:) 
-         avmu(:,:,:) = avmu_k(:,:,:) 
-         avmv(:,:,:) = avmv_k(:,:,:) 
-      ENDIF 
-      !
-      CALL tke_tke      ! now tke (en)
-      !
-      CALL tke_avn      ! now avt, avm, avmu, avmv
-      !
-      avt_k (:,:,:) = avt (:,:,:) 
-      avm_k (:,:,:) = avm (:,:,:) 
-      avmu_k(:,:,:) = avmu(:,:,:) 
-      avmv_k(:,:,:) = avmv(:,:,:) 
-      !
-   END SUBROUTINE zdf_tke
-
-
-   SUBROUTINE tke_tke
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE tke_tke  ***
-      !!
-      !! ** Purpose :   Compute the now Turbulente Kinetic Energy (TKE)
-      !!
-      !! ** Method  : - TKE surface boundary condition
-      !!              - source term due to Langmuir cells (Axell JGR 2002) (ln_lc=T)
-      !!              - source term due to shear (saved in avmu, avmv arrays)
-      !!              - Now TKE : resolution of the TKE equation by inverting
-      !!                a tridiagonal linear system by a "methode de chasse"
-      !!              - increase TKE due to surface and internal wave breaking
-      !!
-      !! ** Action  : - en : now turbulent kinetic energy)
-      !!              - avmu, avmv : production of TKE by shear at u and v-points
-      !!                (= Kz dz[Ub] * dz[Un] )
-      !! ---------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jk                      ! dummy loop arguments
-!!bfr      INTEGER  ::   ikbu, ikbv, ikbum1, ikbvm1      ! temporary scalar
-!!bfr      INTEGER  ::   ikbt, ikbumm1, ikbvmm1          ! temporary scalar
-      REAL(wp) ::   zrhoa  = 1.22                   ! Air density kg/m3
-      REAL(wp) ::   zcdrag = 1.5e-3                 ! drag coefficient
-      REAL(wp) ::   zbbrau, zesh2                   ! temporary scalars
-      REAL(wp) ::   zfact1, zfact2, zfact3          !    -         -
-      REAL(wp) ::   ztx2  , zty2  , zcof            !    -         -
-      REAL(wp) ::   ztau  , zdif                    !    -         -
-      REAL(wp) ::   zus   , zwlc  , zind            !    -         -
-      REAL(wp) ::   zzd_up, zzd_lw                  !    -         -
-!!bfr      REAL(wp) ::   zebot                           !    -         -
-      INTEGER , POINTER, DIMENSION(:,:  ) :: imlc
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zhlc
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpelc, zdiag, zd_up, zd_lw
-      !!--------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tke_tke')
-      !
-      CALL wrk_alloc( jpi,jpj, imlc )    ! integer
-      CALL wrk_alloc( jpi,jpj, zhlc ) 
-      CALL wrk_alloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw ) 
-      !
-      zbbrau = rn_ebb / rau0       ! Local constant initialisation
-      zfact1 = -.5_wp * rdt 
-      zfact2 = 1.5_wp * rdt * rn_ediss
-      zfact3 = 0.5_wp       * rn_ediss
-      !
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     !  Surface boundary condition on tke
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      DO jj = 2, jpjm1            ! en(1)   = rn_ebb taum / rau0  (min value rn_emin0)
-         DO ji = fs_2, fs_jpim1   ! vector opt.
-            en(ji,jj,1) = MAX( rn_emin0, zbbrau * taum(ji,jj) ) * tmask(ji,jj,1)
-         END DO
-      END DO
-      
-!!bfr   - start commented area
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     !  Bottom boundary condition on tke
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !
-      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      ! Tests to date have found the bottom boundary condition on tke to have very little effect.
-      ! The condition is coded here for completion but commented out until there is proof that the
-      ! computational cost is justified
-      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     en(bot)   = (rn_ebb0/rau0)*0.5*sqrt(u_botfr^2+v_botfr^2) (min value rn_emin)
-!CDIR NOVERRCHK
-!!    DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-!!       DO ji = fs_2, fs_jpim1   ! vector opt.
-!!          ztx2 = bfrua(ji-1,jj) * ub(ji-1,jj,mbku(ji-1,jj)) + &
-!!                 bfrua(ji  ,jj) * ub(ji  ,jj,mbku(ji  ,jj) )
-!!          zty2 = bfrva(ji,jj  ) * vb(ji,jj  ,mbkv(ji,jj  )) + &
-!!                 bfrva(ji,jj-1) * vb(ji,jj-1,mbkv(ji,jj-1) )
-!!          zebot = 0.001875_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 )   !  where 0.001875 = (rn_ebb0/rau0) * 0.5 = 3.75*0.5/1000.
-!!          en (ji,jj,mbkt(ji,jj)+1) = MAX( zebot, rn_emin ) * tmask(ji,jj,1)
-!!       END DO
-!!    END DO
-!!bfr   - end commented area
-      !
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      IF( ln_lc ) THEN      !  Langmuir circulation source term added to tke       (Axell JGR 2002)
-         !                  !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-         !
-         !                        !* total energy produce by LC : cumulative sum over jk
-         zpelc(:,:,1) =  MAX( rn2b(:,:,1), 0._wp ) * fsdepw(:,:,1) * fse3w(:,:,1)
-         DO jk = 2, jpk
-            zpelc(:,:,jk)  = zpelc(:,:,jk-1) + MAX( rn2b(:,:,jk), 0._wp ) * fsdepw(:,:,jk) * fse3w(:,:,jk)
-         END DO
-         !                        !* finite Langmuir Circulation depth
-         zcof = 0.5 * 0.016 * 0.016 / ( zrhoa * zcdrag )
-         imlc(:,:) = mbkt(:,:) + 1       ! Initialization to the number of w ocean point (=2 over land)
-         DO jk = jpkm1, 2, -1
-            DO jj = 1, jpj               ! Last w-level at which zpelc>=0.5*us*us 
-               DO ji = 1, jpi            !      with us=0.016*wind(starting from jpk-1)
-                  zus  = zcof * taum(ji,jj)
-                  IF( zpelc(ji,jj,jk) > zus )   imlc(ji,jj) = jk
-               END DO
-            END DO
-         END DO
-         !                               ! finite LC depth
-# if defined key_vectopt_loop
-         DO jj = 1, 1
-            DO ji = 1, jpij   ! vector opt. (forced unrolling)
-# else
-         DO jj = 1, jpj 
-            DO ji = 1, jpi
-# endif
-               zhlc(ji,jj) = fsdepw(ji,jj,imlc(ji,jj))
-            END DO
-         END DO
-         zcof = 0.016 / SQRT( zrhoa * zcdrag )
-!CDIR NOVERRCHK
-         DO jk = 2, jpkm1         !* TKE Langmuir circulation source term added to en
-!CDIR NOVERRCHK
-            DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zus  = zcof * SQRT( taum(ji,jj) )           ! Stokes drift
-                  !                                           ! vertical velocity due to LC
-                  zind = 0.5 - SIGN( 0.5, fsdepw(ji,jj,jk) - zhlc(ji,jj) )
-                  zwlc = zind * rn_lc * zus * SIN( rpi * fsdepw(ji,jj,jk) / zhlc(ji,jj) )
-                  !                                           ! TKE Langmuir circulation source term
-                  en(ji,jj,jk) = en(ji,jj,jk) + rdt * ( zwlc * zwlc * zwlc ) / zhlc(ji,jj) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         !
-      ENDIF
-      !
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     !  Now Turbulent kinetic energy (output in en)
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     ! Resolution of a tridiagonal linear system by a "methode de chasse"
-      !                     ! computation from level 2 to jpkm1  (e(1) already computed and e(jpk)=0 ).
-      !                     ! zdiag : diagonal zd_up : upper diagonal zd_lw : lower diagonal
-      !
-      DO jk = 2, jpkm1           !* Shear production at uw- and vw-points (energy conserving form)
-         DO jj = 1, jpj                 ! here avmu, avmv used as workspace
-            DO ji = 1, jpi
-               avmu(ji,jj,jk) = avmu(ji,jj,jk) * ( un(ji,jj,jk-1) - un(ji,jj,jk) )   &
-                  &                            * ( ub(ji,jj,jk-1) - ub(ji,jj,jk) )   & 
-                  &           / (  fse3uw_n(ji,jj,jk)         &
-                  &              * fse3uw_b(ji,jj,jk) )
-               avmv(ji,jj,jk) = avmv(ji,jj,jk) * ( vn(ji,jj,jk-1) - vn(ji,jj,jk) )   &
-                  &                            * ( vb(ji,jj,jk-1) - vb(ji,jj,jk) )   &
-                  &                            / (  fse3vw_n(ji,jj,jk)               &
-                  &                              *  fse3vw_b(ji,jj,jk)  )
-            END DO
-         END DO
-      END DO
-      !
-      DO jk = 2, jpkm1           !* Matrix and right hand side in en
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zcof   = zfact1 * tmask(ji,jj,jk)
-               zzd_up = zcof * ( avm  (ji,jj,jk+1) + avm  (ji,jj,jk  ) )   &  ! upper diagonal
-                  &          / ( fse3t(ji,jj,jk  ) * fse3w(ji,jj,jk  ) )
-               zzd_lw = zcof * ( avm  (ji,jj,jk  ) + avm  (ji,jj,jk-1) )   &  ! lower diagonal
-                  &          / ( fse3t(ji,jj,jk-1) * fse3w(ji,jj,jk  ) )
-                  !                                                           ! shear prod. at w-point weightened by mask
-               zesh2  =  ( avmu(ji-1,jj,jk) + avmu(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) )   &
-                  &    + ( avmv(ji,jj-1,jk) + avmv(ji,jj,jk) ) / MAX( 1._wp , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) )    
-                  !
-               zd_up(ji,jj,jk) = zzd_up            ! Matrix (zdiag, zd_up, zd_lw)
-               zd_lw(ji,jj,jk) = zzd_lw
-               zdiag(ji,jj,jk) = 1._wp - zzd_lw - zzd_up + zfact2 * dissl(ji,jj,jk) * tmask(ji,jj,jk)
-               !
-               !                                   ! right hand side in en
-               en(ji,jj,jk) = en(ji,jj,jk) + rdt * (  zesh2  -   avt(ji,jj,jk) * rn2(ji,jj,jk)    &
-                  &                                 + zfact3 * dissl(ji,jj,jk) * en (ji,jj,jk)  ) * tmask(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-      !                          !* Matrix inversion from level 2 (tke prescribed at level 1)
-      DO jk = 3, jpkm1                             ! First recurrence : Dk = Dk - Lk * Uk-1 / Dk-1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1    ! vector opt.
-               zdiag(ji,jj,jk) = zdiag(ji,jj,jk) - zd_lw(ji,jj,jk) * zd_up(ji,jj,jk-1) / zdiag(ji,jj,jk-1)
-            END DO
-         END DO
-      END DO
-      DO jj = 2, jpjm1                             ! Second recurrence : Lk = RHSk - Lk / Dk-1 * Lk-1
-         DO ji = fs_2, fs_jpim1    ! vector opt.
-            zd_lw(ji,jj,2) = en(ji,jj,2) - zd_lw(ji,jj,2) * en(ji,jj,1)    ! Surface boudary conditions on tke
-         END DO
-      END DO
-      DO jk = 3, jpkm1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1    ! vector opt.
-               zd_lw(ji,jj,jk) = en(ji,jj,jk) - zd_lw(ji,jj,jk) / zdiag(ji,jj,jk-1) *zd_lw(ji,jj,jk-1)
-            END DO
-         END DO
-      END DO
-      DO jj = 2, jpjm1                             ! thrid recurrence : Ek = ( Lk - Uk * Ek+1 ) / Dk
-         DO ji = fs_2, fs_jpim1    ! vector opt.
-            en(ji,jj,jpkm1) = zd_lw(ji,jj,jpkm1) / zdiag(ji,jj,jpkm1)
-         END DO
-      END DO
-      DO jk = jpk-2, 2, -1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1    ! vector opt.
-               en(ji,jj,jk) = ( zd_lw(ji,jj,jk) - zd_up(ji,jj,jk) * en(ji,jj,jk+1) ) / zdiag(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-      DO jk = 2, jpkm1                             ! set the minimum value of tke
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               en(ji,jj,jk) = MAX( en(ji,jj,jk), rn_emin ) * tmask(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-
-      !                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                            !  TKE due to surface and internal wave breaking
-      !                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      IF( nn_etau == 1 ) THEN           !* penetration below the mixed layer (rn_efr fraction)
-         DO jk = 2, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  en(ji,jj,jk) = en(ji,jj,jk) + rn_efr * en(ji,jj,1) * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   &
-                     &                                               * ( 1._wp - fr_i(ji,jj) )  * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-      ELSEIF( nn_etau == 2 ) THEN       !* act only at the base of the mixed layer (jk=nmln)  (rn_efr fraction)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               jk = nmln(ji,jj)
-               en(ji,jj,jk) = en(ji,jj,jk) + rn_efr * en(ji,jj,1) * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   &
-                  &                                               * ( 1._wp - fr_i(ji,jj) )  * tmask(ji,jj,jk)
-            END DO
-         END DO
-      ELSEIF( nn_etau == 3 ) THEN       !* penetration belox the mixed layer (HF variability)
-!CDIR NOVERRCHK
-         DO jk = 2, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ztx2 = utau(ji-1,jj  ) + utau(ji,jj)
-                  zty2 = vtau(ji  ,jj-1) + vtau(ji,jj)
-                  ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 )    ! module of the mean stress 
-                  zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean 
-                  zdif = rhftau_scl * MAX( 0._wp, zdif + rhftau_add )  ! apply some modifications...
-                  en(ji,jj,jk) = en(ji,jj,jk) + zbbrau * zdif * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   &
-                     &                                        * ( 1._wp - fr_i(ji,jj) ) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-      ENDIF
-      CALL lbc_lnk( en, 'W', 1. )      ! Lateral boundary conditions (sign unchanged)
-      !
-      CALL wrk_dealloc( jpi,jpj, imlc )    ! integer
-      CALL wrk_dealloc( jpi,jpj, zhlc ) 
-      CALL wrk_dealloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tke_tke')
-      !
-   END SUBROUTINE tke_tke
-
-
-   SUBROUTINE tke_avn
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE tke_avn  ***
-      !!
-      !! ** Purpose :   Compute the vertical eddy viscosity and diffusivity
-      !!
-      !! ** Method  :   At this stage, en, the now TKE, is known (computed in 
-      !!              the tke_tke routine). First, the now mixing lenth is 
-      !!      computed from en and the strafification (N^2), then the mixings
-      !!      coefficients are computed.
-      !!              - Mixing length : a first evaluation of the mixing lengh
-      !!      scales is:
-      !!                      mxl = sqrt(2*en) / N  
-      !!      where N is the brunt-vaisala frequency, with a minimum value set
-      !!      to rmxl_min (rn_mxl0) in the interior (surface) ocean.
-      !!        The mixing and dissipative length scale are bound as follow : 
-      !!         nn_mxl=0 : mxl bounded by the distance to surface and bottom.
-      !!                        zmxld = zmxlm = mxl
-      !!         nn_mxl=1 : mxl bounded by the e3w and zmxld = zmxlm = mxl
-      !!         nn_mxl=2 : mxl bounded such that the vertical derivative of mxl is 
-      !!                    less than 1 (|d/dz(mxl)|<1) and zmxld = zmxlm = mxl
-      !!         nn_mxl=3 : mxl is bounded from the surface to the bottom usings
-      !!                    |d/dz(xml)|<1 to obtain lup, and from the bottom to 
-      !!                    the surface to obtain ldown. the resulting length 
-      !!                    scales are:
-      !!                        zmxld = sqrt( lup * ldown ) 
-      !!                        zmxlm = min ( lup , ldown )
-      !!              - Vertical eddy viscosity and diffusivity:
-      !!                      avm = max( avtb, rn_ediff * zmxlm * en^1/2 )
-      !!                      avt = max( avmb, pdlr * avm )  
-      !!      with pdlr=1 if nn_pdl=0, pdlr=1/pdl=F(Ri) otherwise.
-      !!
-      !! ** Action  : - avt : now vertical eddy diffusivity (w-point)
-      !!              - avmu, avmv : now vertical eddy viscosity at uw- and vw-points
-      !!----------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp) ::   zrn2, zraug, zcoef, zav     ! local scalars
-      REAL(wp) ::   zdku, zpdlr, zri, zsqen     !   -      -
-      REAL(wp) ::   zdkv, zemxl, zemlm, zemlp   !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zmpdl, zmxlm, zmxld
-      !!--------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('tke_avn')
-
-      CALL wrk_alloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld ) 
-
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     !  Mixing length
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !
-      !                     !* Buoyancy length scale: l=sqrt(2*e/n**2)
-      !
-      IF( ln_mxl0 ) THEN            ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rau0*g)
-         zraug = vkarmn * 2.e5_wp / ( rau0 * grav )
-         zmxlm(:,:,1) = MAX(  rn_mxl0,  zraug * taum(:,:)  )
-      ELSE                          ! surface set to the minimum value
-         zmxlm(:,:,1) = rn_mxl0
-      ENDIF
-      zmxlm(:,:,jpk)  = rmxl_min     ! last level set to the interior minium value
-      !
-!CDIR NOVERRCHK
-      DO jk = 2, jpkm1              ! interior value : l=sqrt(2*e/n^2)
-!CDIR NOVERRCHK
-         DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zrn2 = MAX( rn2(ji,jj,jk), rsmall )
-               zmxlm(ji,jj,jk) = MAX(  rmxl_min,  SQRT( 2._wp * en(ji,jj,jk) / zrn2 )  )
-            END DO
-         END DO
-      END DO
-      !
-      !                     !* Physical limits for the mixing length
-      !
-      zmxld(:,:, 1 ) = zmxlm(:,:,1)   ! surface set to the zmxlm   value
-      zmxld(:,:,jpk) = rmxl_min       ! last level  set to the minimum value
-      !
-      SELECT CASE ( nn_mxl )
-      !
-      CASE ( 0 )           ! bounded by the distance to surface and bottom
-         DO jk = 2, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zemxl = MIN( fsdepw(ji,jj,jk), zmxlm(ji,jj,jk),   &
-                  &            fsdepw(ji,jj,mbkt(ji,jj)+1) - fsdepw(ji,jj,jk) )
-                  zmxlm(ji,jj,jk) = zemxl
-                  zmxld(ji,jj,jk) = zemxl
-               END DO
-            END DO
-         END DO
-         !
-      CASE ( 1 )           ! bounded by the vertical scale factor
-         DO jk = 2, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zemxl = MIN( fse3w(ji,jj,jk), zmxlm(ji,jj,jk) )
-                  zmxlm(ji,jj,jk) = zemxl
-                  zmxld(ji,jj,jk) = zemxl
-               END DO
-            END DO
-         END DO
-         !
-      CASE ( 2 )           ! |dk[xml]| bounded by e3t :
-         DO jk = 2, jpkm1         ! from the surface to the bottom :
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zmxlm(ji,jj,jk) = MIN( zmxlm(ji,jj,jk-1) + fse3t(ji,jj,jk-1), zmxlm(ji,jj,jk) )
-               END DO
-            END DO
-         END DO
-         DO jk = jpkm1, 2, -1     ! from the bottom to the surface :
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zemxl = MIN( zmxlm(ji,jj,jk+1) + fse3t(ji,jj,jk+1), zmxlm(ji,jj,jk) )
-                  zmxlm(ji,jj,jk) = zemxl
-                  zmxld(ji,jj,jk) = zemxl
-               END DO
-            END DO
-         END DO
-         !
-      CASE ( 3 )           ! lup and ldown, |dk[xml]| bounded by e3t :
-         DO jk = 2, jpkm1         ! from the surface to the bottom : lup
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zmxld(ji,jj,jk) = MIN( zmxld(ji,jj,jk-1) + fse3t(ji,jj,jk-1), zmxlm(ji,jj,jk) )
-               END DO
-            END DO
-         END DO
-         DO jk = jpkm1, 2, -1     ! from the bottom to the surface : ldown
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zmxlm(ji,jj,jk) = MIN( zmxlm(ji,jj,jk+1) + fse3t(ji,jj,jk+1), zmxlm(ji,jj,jk) )
-               END DO
-            END DO
-         END DO
-!CDIR NOVERRCHK
-         DO jk = 2, jpkm1
-!CDIR NOVERRCHK
-            DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zemlm = MIN ( zmxld(ji,jj,jk),  zmxlm(ji,jj,jk) )
-                  zemlp = SQRT( zmxld(ji,jj,jk) * zmxlm(ji,jj,jk) )
-                  zmxlm(ji,jj,jk) = zemlm
-                  zmxld(ji,jj,jk) = zemlp
-               END DO
-            END DO
-         END DO
-         !
-      END SELECT
-      !
-# if defined key_c1d
-      e_dis(:,:,:) = zmxld(:,:,:)      ! c1d configuration : save mixing and dissipation turbulent length scales
-      e_mix(:,:,:) = zmxlm(:,:,:)
-# endif
-
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      !                     !  Vertical eddy viscosity and diffusivity  (avmu, avmv, avt)
-      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-!CDIR NOVERRCHK
-      DO jk = 1, jpkm1            !* vertical eddy viscosity & diffivity at w-points
-!CDIR NOVERRCHK
-         DO jj = 2, jpjm1
-!CDIR NOVERRCHK
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zsqen = SQRT( en(ji,jj,jk) )
-               zav   = rn_ediff * zmxlm(ji,jj,jk) * zsqen
-               avm  (ji,jj,jk) = MAX( zav,                  avmb(jk) ) * tmask(ji,jj,jk)
-               avt  (ji,jj,jk) = MAX( zav, avtb_2d(ji,jj) * avtb(jk) ) * tmask(ji,jj,jk)
-               dissl(ji,jj,jk) = zsqen / zmxld(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-      CALL lbc_lnk( avm, 'W', 1. )      ! Lateral boundary conditions (sign unchanged)
-      !
-      DO jk = 2, jpkm1            !* vertical eddy viscosity at u- and v-points
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               avmu(ji,jj,jk) = 0.5 * ( avm(ji,jj,jk) + avm(ji+1,jj  ,jk) ) * umask(ji,jj,jk)
-               avmv(ji,jj,jk) = 0.5 * ( avm(ji,jj,jk) + avm(ji  ,jj+1,jk) ) * vmask(ji,jj,jk)
-            END DO
-         END DO
-      END DO
-      CALL lbc_lnk( avmu, 'U', 1. )   ;   CALL lbc_lnk( avmv, 'V', 1. )      ! Lateral boundary conditions
-      !
-      IF( nn_pdl == 1 ) THEN      !* Prandtl number case: update avt
-         DO jk = 2, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zcoef = avm(ji,jj,jk) * 2._wp * fse3w(ji,jj,jk) * fse3w(ji,jj,jk)
-                  !                                          ! shear
-                  zdku = avmu(ji-1,jj,jk) * ( un(ji-1,jj,jk-1) - un(ji-1,jj,jk) ) * ( ub(ji-1,jj,jk-1) - ub(ji-1,jj,jk) )   &
-                    &  + avmu(ji  ,jj,jk) * ( un(ji  ,jj,jk-1) - un(ji  ,jj,jk) ) * ( ub(ji  ,jj,jk-1) - ub(ji  ,jj,jk) )
-                  zdkv = avmv(ji,jj-1,jk) * ( vn(ji,jj-1,jk-1) - vn(ji,jj-1,jk) ) * ( vb(ji,jj-1,jk-1) - vb(ji,jj-1,jk) )   &
-                    &  + avmv(ji,jj  ,jk) * ( vn(ji,jj  ,jk-1) - vn(ji,jj  ,jk) ) * ( vb(ji,jj  ,jk-1) - vb(ji,jj  ,jk) )
-                  !                                          ! local Richardson number
-                  zri   = MAX( rn2b(ji,jj,jk), 0._wp ) * zcoef / (zdku + zdkv + rn_bshear )
-                  zpdlr = MAX(  0.1_wp,  0.2 / MAX( 0.2 , zri )  )
-!!gm and even better with the use of the "true" ri_crit=0.22222...  (this change the results!)
-!!gm              zpdlr = MAX(  0.1_wp,  ri_crit / MAX( ri_crit , zri )  )
-                  avt(ji,jj,jk)   = MAX( zpdlr * avt(ji,jj,jk), avtb_2d(ji,jj) * avtb(jk) ) * tmask(ji,jj,jk)
-# if defined key_c1d
-                  e_pdl(ji,jj,jk) = zpdlr * tmask(ji,jj,jk)    ! c1d configuration : save masked Prandlt number
-                  e_ric(ji,jj,jk) = zri * tmask(ji,jj,jk)                            ! c1d config. : save Ri
-# endif
-              END DO
-            END DO
-         END DO
-      ENDIF
-      CALL lbc_lnk( avt, 'W', 1. )                      ! Lateral boundary conditions on avt  (sign unchanged)
-
-      IF(ln_ctl) THEN
-         CALL prt_ctl( tab3d_1=en  , clinfo1=' tke  - e: ', tab3d_2=avt, clinfo2=' t: ', ovlap=1, kdim=jpk)
-         CALL prt_ctl( tab3d_1=avmu, clinfo1=' tke  - u: ', mask1=umask,                   &
-            &          tab3d_2=avmv, clinfo2=       ' v: ', mask2=vmask, ovlap=1, kdim=jpk )
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld ) 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('tke_avn')
-      !
-   END SUBROUTINE tke_avn
-
-
-   SUBROUTINE zdf_tke_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE zdf_tke_init  ***
-      !!                     
-      !! ** Purpose :   Initialization of the vertical eddy diffivity and 
-      !!              viscosity when using a tke turbulent closure scheme
-      !!
-      !! ** Method  :   Read the namzdf_tke namelist and check the parameters
-      !!              called at the first timestep (nit000)
-      !!
-      !! ** input   :   Namlist namzdf_tke
-      !!
-      !! ** Action  :   Increase by 1 the nstop flag is setting problem encounter
-      !!----------------------------------------------------------------------
-      INTEGER ::   ji, jj, jk   ! dummy loop indices
-      INTEGER ::   ios
-      !!
-      NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb , rn_emin  ,   &
-         &                 rn_emin0, rn_bshear, nn_mxl , ln_mxl0  ,   &
-         &                 rn_mxl0 , nn_pdl   , ln_lc  , rn_lc    ,   &
-         &                 nn_etau , nn_htau  , rn_efr   
-      !!----------------------------------------------------------------------
-      !
-      REWIND( numnam_ref )              ! Namelist namzdf_tke in reference namelist : Turbulent Kinetic Energy
-      READ  ( numnam_ref, namzdf_tke, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tke in reference namelist', lwp )
-
-      REWIND( numnam_cfg )              ! Namelist namzdf_tke in configuration namelist : Turbulent Kinetic Energy
-      READ  ( numnam_cfg, namzdf_tke, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tke in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, namzdf_tke )
-      !
-      ri_cri   = 2._wp    / ( 2._wp + rn_ediss / rn_ediff )   ! resulting critical Richardson number
-      rmxl_min = 1.e-6_wp / ( rn_ediff * SQRT( rn_emin ) )    ! resulting minimum length to recover molecular viscosity
-      !!! O.M. 
-      rmxl_min = 1.0E-3
-      WRITE(numout,*) 'Set rmxl_min to IPSLCM5 value : ', rmxl_min
-      !
-      IF(lwp) THEN                    !* Control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'zdf_tke_init : tke turbulent closure scheme - initialisation'
-         WRITE(numout,*) '~~~~~~~~~~~~'
-         WRITE(numout,*) '   Namelist namzdf_tke : set tke mixing parameters'
-         WRITE(numout,*) '      coef. to compute avt                        rn_ediff  = ', rn_ediff
-         WRITE(numout,*) '      Kolmogoroff dissipation coef.               rn_ediss  = ', rn_ediss
-         WRITE(numout,*) '      tke surface input coef.                     rn_ebb    = ', rn_ebb
-         WRITE(numout,*) '      minimum value of tke                        rn_emin   = ', rn_emin
-         WRITE(numout,*) '      surface minimum value of tke                rn_emin0  = ', rn_emin0
-         WRITE(numout,*) '      background shear (>0)                       rn_bshear = ', rn_bshear
-         WRITE(numout,*) '      mixing length type                          nn_mxl    = ', nn_mxl
-         WRITE(numout,*) '      prandl number flag                          nn_pdl    = ', nn_pdl
-         WRITE(numout,*) '      surface mixing length = F(stress) or not    ln_mxl0   = ', ln_mxl0
-         WRITE(numout,*) '      surface  mixing length minimum value        rn_mxl0   = ', rn_mxl0
-         WRITE(numout,*) '      flag to take into acc.  Langmuir circ.      ln_lc     = ', ln_lc
-         WRITE(numout,*) '      coef to compute verticla velocity of LC     rn_lc     = ', rn_lc
-         WRITE(numout,*) '      test param. to add tke induced by wind      nn_etau   = ', nn_etau
-         WRITE(numout,*) '      flag for computation of exp. tke profile    nn_htau   = ', nn_htau
-         WRITE(numout,*) '      fraction of en which pene. the thermocline  rn_efr    = ', rn_efr
-         WRITE(numout,*)
-         WRITE(numout,*) '      critical Richardson nb with your parameters  ri_cri = ', ri_cri
-      ENDIF
-      !
-      !                              ! allocate tke arrays
-      IF( zdf_tke_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_tke_init : unable to allocate arrays' )
-      !
-      !                               !* Check of some namelist values
-      IF( nn_mxl  < 0  .OR.  nn_mxl  > 3 )   CALL ctl_stop( 'bad flag: nn_mxl is  0, 1 or 2 ' )
-      IF( nn_pdl  < 0  .OR.  nn_pdl  > 1 )   CALL ctl_stop( 'bad flag: nn_pdl is  0 or 1    ' )
-      IF( nn_htau < 0  .OR.  nn_htau > 1 )   CALL ctl_stop( 'bad flag: nn_htau is 0, 1 or 2 ' )
-#if ! key_coupled
-      IF( nn_etau == 3 )   CALL ctl_stop( 'nn_etau == 3 : HF taum only known in coupled mode' )
-#endif
-
-      IF( ln_mxl0 ) THEN
-         IF(lwp) WRITE(numout,*) '   use a surface mixing length = F(stress) :   set rn_mxl0 = rmxl_min'
-         rn_mxl0 = rmxl_min
-      ENDIF
-      
-      IF( nn_etau == 2  )   CALL zdf_mxl( nit000 )      ! Initialization of nmln 
-
-      !                               !* depth of penetration of surface tke
-      IF( nn_etau /= 0 ) THEN      
-         SELECT CASE( nn_htau )             ! Choice of the depth of penetration
-         CASE( 0 )                                 ! constant depth penetration (here 10 meters)
-            htau(:,:) = 10._wp
-         CASE( 1 )                                 ! F(latitude) : 0.5m to 30m poleward of 40 degrees
-            htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   )            
-         END SELECT
-      ENDIF
-      !                               !* set vertical eddy coef. to the background value
-      DO jk = 1, jpk
-         avt (:,:,jk) = avtb(jk) * tmask(:,:,jk)
-         avm (:,:,jk) = avmb(jk) * tmask(:,:,jk)
-         avmu(:,:,jk) = avmb(jk) * umask(:,:,jk)
-         avmv(:,:,jk) = avmb(jk) * vmask(:,:,jk)
-      END DO
-      dissl(:,:,:) = 1.e-12_wp
-      !                              
-      CALL tke_rst( nit000, 'READ' )  !* read or initialize all required files
-      !
-   END SUBROUTINE zdf_tke_init
-
-
-   SUBROUTINE tke_rst( kt, cdrw )
-     !!---------------------------------------------------------------------
-     !!                   ***  ROUTINE tke_rst  ***
-     !!                     
-     !! ** Purpose :   Read or write TKE file (en) in restart file
-     !!
-     !! ** Method  :   use of IOM library
-     !!                if the restart does not contain TKE, en is either 
-     !!                set to rn_emin or recomputed 
-     !!----------------------------------------------------------------------
-     INTEGER         , INTENT(in) ::   kt     ! ocean time-step
-     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
-     !
-     INTEGER ::   jit, jk   ! dummy loop indices
-     INTEGER ::   id1, id2, id3, id4, id5, id6   ! local integers
-     !!----------------------------------------------------------------------
-     !
-     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
-        !                                   ! ---------------
-        IF( ln_rstart ) THEN                   !* Read the restart file
-           id1 = iom_varid( numror, 'en'   , ldstop = .FALSE. )
-           id2 = iom_varid( numror, 'avt'  , ldstop = .FALSE. )
-           id3 = iom_varid( numror, 'avm'  , ldstop = .FALSE. )
-           id4 = iom_varid( numror, 'avmu' , ldstop = .FALSE. )
-           id5 = iom_varid( numror, 'avmv' , ldstop = .FALSE. )
-           id6 = iom_varid( numror, 'dissl', ldstop = .FALSE. )
-           !
-           IF( id1 > 0 ) THEN                       ! 'en' exists
-              CALL iom_get( numror, jpdom_autoglo, 'en', en )
-              IF( MIN( id2, id3, id4, id5, id6 ) > 0 ) THEN        ! all required arrays exist
-                 CALL iom_get( numror, jpdom_autoglo, 'avt'  , avt   )
-                 CALL iom_get( numror, jpdom_autoglo, 'avm'  , avm   )
-                 CALL iom_get( numror, jpdom_autoglo, 'avmu' , avmu  )
-                 CALL iom_get( numror, jpdom_autoglo, 'avmv' , avmv  )
-                 CALL iom_get( numror, jpdom_autoglo, 'dissl', dissl )
-              ELSE                                                 ! one at least array is missing
-                 CALL tke_avn                                          ! compute avt, avm, avmu, avmv and dissl (approximation)
-              ENDIF
-           ELSE                                     ! No TKE array found: initialisation
-              IF(lwp) WRITE(numout,*) ' ===>>>> : previous run without tke scheme, en computed by iterative loop'
-              en (:,:,:) = rn_emin * tmask(:,:,:)
-              CALL tke_avn                               ! recompute avt, avm, avmu, avmv and dissl (approximation)
-              DO jit = nit000 + 1, nit000 + 10   ;   CALL zdf_tke( jit )   ;   END DO
-           ENDIF
-        ELSE                                   !* Start from rest
-           en(:,:,:) = rn_emin * tmask(:,:,:)
-           DO jk = 1, jpk                           ! set the Kz to the background value
-              avt (:,:,jk) = avtb(jk) * tmask(:,:,jk)
-              avm (:,:,jk) = avmb(jk) * tmask(:,:,jk)
-              avmu(:,:,jk) = avmb(jk) * umask(:,:,jk)
-              avmv(:,:,jk) = avmb(jk) * vmask(:,:,jk)
-           END DO
-        ENDIF
-        !
-     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
-        !                                   ! -------------------
-        IF(lwp) WRITE(numout,*) '---- tke-rst ----'
-        CALL iom_rstput( kt, nitrst, numrow, 'en'   , en     )
-        CALL iom_rstput( kt, nitrst, numrow, 'avt'  , avt_k  )
-        CALL iom_rstput( kt, nitrst, numrow, 'avm'  , avm_k  )
-        CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k )
-        CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k )
-        CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl  )
-        !
-     ENDIF
-     !
-   END SUBROUTINE tke_rst
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module :                                        NO TKE scheme
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_zdftke = .FALSE.   !: TKE flag
-CONTAINS
-   SUBROUTINE zdf_tke_init           ! Dummy routine
-   END SUBROUTINE zdf_tke_init
-   SUBROUTINE zdf_tke( kt )          ! Dummy routine
-      WRITE(*,*) 'zdf_tke: You should not have seen this print! error?', kt
-   END SUBROUTINE zdf_tke
-   SUBROUTINE tke_rst( kt, cdrw )
-     CHARACTER(len=*) ::   cdrw
-     WRITE(*,*) 'tke_rst: You should not have seen this print! error?', kt, cdwr
-   END SUBROUTINE tke_rst
-#endif
-
-   !!======================================================================
-END MODULE zdftke
