Index: CONFIG/UNIFORM/v6/IPSLCM6/AA_make
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/AA_make	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/AA_make	(revision 2093)
@@ -98,8 +98,8 @@
 
 orca2: ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM_PISCES -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_diahth" ; cp ORCA2_LIM_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM_PISCES -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_diahth" ; cp ORCA2_LIM_PISCES/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 orca2nopisces: ../../modeles/NEMOGCM/CONFIG
-	(cd ../../modeles/NEMOGCM/CONFIG; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_diahth" ; cp ORCA2_LIM/BLD/bin/nemo.exe ../../../bin/opa ; )
+	(cd ../../modeles/NEMOGCM/CONFIG; cp ../../../config/IPSLCM6/SOURCES/NEMO/arch-${FCM_ARCH}.fcm ../ARCH/. ; ./makenemo -m ${FCM_ARCH} -n ORCA2_LIM -e "$(MYSRC_DIR)/SOURCES/NEMO" -j16 add_key "key_lim2_vp key_coupled key_oasis3 key_diahth" ; cp ORCA2_LIM/BLD/bin/nemo.exe ../../../bin/opa ; )
 
 verif: ../../bin
Index: CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/lim2.card
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/lim2.card	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/lim2.card	(revision 2093)
@@ -24,6 +24,6 @@
 
 [OutputFiles]
-List=   (ORCA2_1m_icemod.nc, ${R_OUT_ICE_O_M}/${PREFIX}_1M_icemod.nc, Post_1M_icemod), \
-        (ORCA2_1d_icemod.nc, ${R_OUT_ICE_O_D}/${PREFIX}_1D_icemod.nc, Post_1D_icemod)
+List=   (${config_UserChoices_JobName}_1m_icemod.nc, ${R_OUT_ICE_O_M}/${PREFIX}_1M_icemod.nc, Post_1M_icemod), \
+        (${config_UserChoices_JobName}_1d_icemod.nc, ${R_OUT_ICE_O_D}/${PREFIX}_1D_icemod.nc, Post_1D_icemod)
 
 [Post_1M_icemod]
Index: CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/opa9.card	(revision 2093)
@@ -52,17 +52,17 @@
 [OutputFiles]
 List=   (mesh_mask.nc      , ${R_OUT_OCE_O}/${config_UserChoices_JobName}_mesh_mask.nc, NONE),\
-        (ORCA2_1y_scalar.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_scalar.nc, Post_1Y_scalar),\
-        (ORCA2_1y_grid_T.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_T.nc, Post_1Y_grid_T),\
-        (ORCA2_1y_grid_U.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_U.nc, Post_1Y_grid_U),\
-        (ORCA2_1y_grid_V.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_V.nc, Post_1Y_grid_V),\
-        (ORCA2_1y_grid_W.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_W.nc, Post_1Y_grid_W),\
-        (ORCA2_1m_scalar.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_scalar.nc, Post_1M_scalar),\
-        (ORCA2_1m_grid_T.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_T.nc, Post_1M_grid_T),\
-        (ORCA2_1m_grid_U.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_U.nc, Post_1M_grid_U),\
-        (ORCA2_1m_grid_V.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_V.nc, Post_1M_grid_V),\
-        (ORCA2_1m_grid_W.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_W.nc, Post_1M_grid_W),\
-        (ORCA2_1d_grid_T.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_T.nc, Post_1D_grid_T),\
-        (ORCA2_1d_grid_U.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_U.nc, Post_1D_grid_U),\
-        (ORCA2_1d_grid_V.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_V.nc, Post_1D_grid_V),\
+        (${config_UserChoices_JobName}_1y_scalar.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_scalar.nc, Post_1Y_scalar),\
+        (${config_UserChoices_JobName}_1y_grid_T.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_T.nc, Post_1Y_grid_T),\
+        (${config_UserChoices_JobName}_1y_grid_U.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_U.nc, Post_1Y_grid_U),\
+        (${config_UserChoices_JobName}_1y_grid_V.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_V.nc, Post_1Y_grid_V),\
+        (${config_UserChoices_JobName}_1y_grid_W.nc, ${R_OUT_OCE_O_Y}/${PREFIX}_1Y_grid_W.nc, Post_1Y_grid_W),\
+        (${config_UserChoices_JobName}_1m_scalar.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_scalar.nc, Post_1M_scalar),\
+        (${config_UserChoices_JobName}_1m_grid_T.nc, ${R_OUT_OCE_O_M}/${PREFIX}_1M_grid_T.nc, Post_1M_grid_T),\
+        (${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, Post_1M_grid_W),\
+        (${config_UserChoices_JobName}_1d_grid_T.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_T.nc, Post_1D_grid_T),\
+        (${config_UserChoices_JobName}_1d_grid_U.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_U.nc, Post_1D_grid_U),\
+        (${config_UserChoices_JobName}_1d_grid_V.nc, ${R_OUT_OCE_O_D}/${PREFIX}_1D_grid_V.nc, Post_1D_grid_V),\
         (${PREFIX_NWRITE}_${DATE_OPA}_diaptr.nc, ${R_OUT_OCE_NWRITE}/${PREFIX}_${WF1}_diaptr.nc, Post_1M_diaptr),\
         (damping.coeff.nc , ${R_OUT_OCE_O_D}/${PREFIX}_damping.coeff.nc, NONE),\
Index: CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/pisces.card
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/pisces.card	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/EXPERIMENTS/IPSLCM/piControl/COMP/pisces.card	(revision 2093)
@@ -40,7 +40,7 @@
 
 [OutputFiles]
-List=   (ORCA2_1m_ptrc_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_ptrc_T.nc, Post_1M_ptrc_T), \
-        (ORCA2_1m_diad_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_diad_T.nc, Post_1M_diad_T), \
-        (ORCA2_1m_dbio_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_dbio_T.nc, Post_1M_dbio_T)
+List=   (${config_UserChoices_JobName}_1m_ptrc_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_ptrc_T.nc, Post_1M_ptrc_T), \
+        (${config_UserChoices_JobName}_1m_diad_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_diad_T.nc, Post_1M_diad_T), \
+        (${config_UserChoices_JobName}_1m_dbio_T.nc, ${R_OUT_MBG_O_M}/${PREFIX}_1M_dbio_T.nc, Post_1M_dbio_T)
 
 [Post_1M_ptrc_T]
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def.xml	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/field_def.xml	(revision 2093)
@@ -65,5 +65,5 @@
          <field id="taum"         long_name="wind stress module"                                           unit="N/m2"     />
          <field id="wspd"         long_name="Wind speed module at 10 m"                                    unit="m/s"      />
-         
+         <field id="fmmflx"       long_name="Freezing-melting water flux"                                  unit="Kg/m2/s" /> 
 	 <!-- * variable relative to atmospheric pressure forcing : available with ln_apr_dyn -->
 	 <field id="ssh_ib"       long_name="Inverse barometer sea surface height"                         unit="m"        />
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_56x55x19
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_56x55x19	(revision 2090)
+++ 	(revision )
@@ -1,72 +1,0 @@
-## $Header: /home/ioipsl/CVSROOT/IPSLCM4_v1_OASIS3/EXP00/gcm.def_ORCA4xLMD7245,v 1.1.1.1 2005/03/23 15:44:29 adm Exp $
-## nombre de pas par jour (multiple de iperiod) ( ici pour  dt = 1 min )      
-day_step=240
-## 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=36000.
-## temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
-tetagrot=18000.
-## temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
-tetatemp=18000.
-## 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 = 5
-##  Activation ou non de la parametrisation de Hines pour la 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
-##  [FC] Transport par les ondes stationnaires selon Francis Codron
-##  Choix possibles :
-##Â  * dissuv=y, diss_uvwin=n, dissuvz=n (local)
-##  * dissuv=n, diss_uvwin=n, dissuvz=y (moyenne zonale)
-##  * dissuv=y, diss_uvwin=y, dissuvz=n (lissage sur 120Â° de longitude)
-##Â  Dans le permier cas, mettre fact_uv Ã  0.2 ou 0.3 dans dissip_p.F,
-##  sinon c'est un peu fort...
-dissuv=n
-diss_uvwin=n
-dissuvz=n
-## [FC] fichiers instantanes de controle une fois par jour
-out_diss=n
-## Orosm pour le lissage de l'orog.
-ok_orosm=n
-# GKLIFT : Gravity Wave Drag calculation parameter
-GKLIFT=0.5
-## Fract pour le fractionnement des mailles
-ok_fract=.true.
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_96x71x19
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/gcm.def_96x71x19	(revision 2090)
+++ 	(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=10800.
-## temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
-tetagrot=18000.
-## temps de dissipation des plus petites long.d ondes pour  h ( divgrad) 
-tetatemp=18000.
-## 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
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/iodef.xml	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/iodef.xml	(revision 2093)
@@ -21,5 +21,5 @@
     -->
     
-    <file_definition type="multiple_file" sync_freq="1d" min_digits="4">
+    <file_definition type="multiple_file" name="@expname@_@freq@" sync_freq="1d" min_digits="4">
     
       <file_group id="1h" output_freq="1h"  output_level="10" enabled=".FALSE."/> <!-- 1h files -->
@@ -27,5 +27,5 @@
       <file_group id="1d" output_freq="1d"  output_level="10" enabled="_1D_ENABLE_"> <!-- 1d files -->
 
-	<file id="1d_grid_T" name="auto" description="ocean T grid variables" >
+	<file id="file1" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="sst"          name="sosstsst"  />
 	  <field field_ref="sss"          name="sosaline"  />
@@ -44,5 +44,5 @@
 	</file>
 
-	<file id="1d_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file2" name_suffix="_grid_U" description="ocean U grid variables" >
 	  <field field_ref="uoce"         name="vozocrtx"  />
 	  <field field_ref="uoce_eiv"     name="vozoeivu"  />
@@ -50,5 +50,5 @@
 	</file>
 	
-	<file id="1d_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file3" name_suffix="_grid_V" description="ocean V grid variables" >
 	  <field field_ref="voce"         name="vomecrty"  />
 	  <field field_ref="voce_eiv"     name="vomeeivv"  />
@@ -60,5 +60,5 @@
       <file_group id="1m" output_freq="1mo" output_level="10" enabled="_1M_ENABLE_"> <!-- real monthly files -->
 
-	<file id="1m_grid_T" name="auto" description="ocean T grid variables" >
+	<file id="file4" name_suffix="_grid_T" description="ocean T grid variables" >
 	  <field field_ref="sst"          name="sosstsst"  />
 	  <field field_ref="sss"          name="sosaline"  />
@@ -79,5 +79,5 @@
 	</file>
 
-	<file id="1m_grid_U" name="auto" description="ocean U grid variables" >
+	<file id="file5" name_suffix="_grid_U" description="ocean U grid variables" >
 	  <field field_ref="uoce"         name="vozocrtx"  />
 	  <field field_ref="uoce_eiv"     name="vozoeivu"  />
@@ -85,5 +85,5 @@
 	</file>
 	
-	<file id="1m_grid_V" name="auto" description="ocean V grid variables" >
+	<file id="file6" name_suffix="_grid_V" description="ocean V grid variables" >
 	  <field field_ref="voce"         name="vomecrty"  />
 	  <field field_ref="voce_eiv"     name="vomeeivv"  />
@@ -91,5 +91,5 @@
 	</file>
 
-	<file id="1m_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file7" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -103,5 +103,5 @@
 	</file>
 	
-	<file id="1m_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file8" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="Cflx"     />
           <field field_ref="Dpco2"    />
@@ -112,5 +112,5 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled="_1Y_ENABLE_"> <!-- real yearly files -->
 
-	<file id="1y_ptrc_T" name="auto" description="pisces sms variables" >
+	<file id="file8" name_suffix="_ptrc_T" description="pisces sms variables" >
           <field field_ref="DIC"      />
           <field field_ref="Alkalini" />
@@ -139,5 +139,5 @@
 	</file>
 
-	<file id="1y_diad_T" name="auto" description="additional pisces diagnostics" >
+	<file id="file9" name_suffix="_diad_T" description="additional pisces diagnostics" >
           <field field_ref="PH"       />
           <field field_ref="CO3"      />
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD5655
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD5655	(revision 2090)
+++ 	(revision )
@@ -1,585 +1,0 @@
-###############################################################################
-#
-#      Input file for OASIS3
-# 
-#      This version is for use with IPSL_CM4_v1 
-#
-#      The file will be edited at runtime to update it for
-#         - the initial date of the run
-#
-###############################################################################
-#  
-#      Input delimiters have to occupy position 1 to 9 !
-#      No blank lines allowed !
-#      Length of input lines <= 80 !
-#
-###############################################################################
-# 
-# SEQMODE : 1        if all models run simultaneously
-#           n        if  n  models run sequentially
- $SEQMODE
-              1
- $END
-###############################################################################
-#
-# CHANNEL (CHAR*4)
-#           PIPE        if named pipes + binary files are used 
-#                       for synchro and data respectively (not tested);
-#           MPI1/2      if MPI message passing is used for data exchange;
-#
- $CHANNEL
- <lib_mpi>
- <nproc_atm>  <nproc_atm>
- <nproc_oce>  <nproc_oce>
- $END
-###############################################################################
-#
-# NFIELDS : total number of fields being exchanged.
-#
- $NFIELDS
-            25
- $END
-###############################################################################
-#
-# JOBNAME : acronym for the given simulation (CHAR*3)
-#
- $JOBNAME
-            EXP   
- $END
-###############################################################################
-#
-# NBMODEL : number of models and their names (CHAR*6).
-#
- $NBMODEL
-  2  lmdz.x oceanx
- $END
-###############################################################################
-#
-# RUNTIME: total simulated time for the actual run in seconds (<I8)
-#
- $RUNTIME
- <total_time>
- $END
-###############################################################################
-#
-# INIDATE (I8)
-#         initial date of the run (YYYYMMDD)
-#
- $INIDATE
- <initial_date>
- $END
-###############################################################################
-# 
-# MODINFO (YES or NOT)
-#         Indicates whether a header is encapsulated within the field
-#
- $MODINFO
-  NOT
- $END
-###############################################################################
-#
-# NLOGPRT: printing level in output file cplout: 
-#              0 = no printing
-#              1 = main routines and field names when treated
-#              2 = complete output
-#
- $NLOGPRT
-   2
- $END
-###############################################################################
-#
-# CALTYPE: Calendar type
-#                  0      = 365 day calendar (no leap years)
-#                  1      = 365 day, or 366 days for leap years, calendar
-#                  n (>1) = n day month calendar
-#
- $CALTYPE
- <calendar_type>
- $END
-#
-# 
-###############################################################################
- $STRINGS
-###############################################################################
-#
-#                      OCEAN  --->>>  ATMOS
-#                      --------------------
-# Field 1 : Weighted Sea surface temperature (o->a 1)
-#
-O_SSTSST SISUTESW 1 86400  5  sstoc.nc  <output_mode> 
-torc  tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
-# LOCTRANS: AVERAGE to average value over coupling period
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mozaic: 1) mapping filename 2) connected unit 3) dataset rank 4) Maximum
-#         number of overlapped neighbors
-wo2a.tsg 93  1  35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-  NORSUD   WSTEST
-#  
-############################################################################
-# Field 2 : Sea ice extent  (o->a 2)
-#
-OIceFrac SIICECOV 44 86400  5  sstoc.nc <output_mode>
-torc  tlmd   LAG=5760
-P  2 P  0
-#
-LOCTRANS CHECKIN MOZAIC  CHECKOUT  REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 3 : Weighted Sea Ice Temperature (o->a 3)
-#
-O_TepIce SIICTEMW 34 86400  5  sstoc.nc  <output_mode>
-torc  tlmd   LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# 
-wo2a.tsg 93  1  35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-  NORSUD   WSTEST
-#
-############################################################################
-# Field 4 : Weighted Sea ice albedo (o->a 4)
-#
-O_AlbIce SIICEALW 17 86400  5  sstoc.nc  <output_mode>
-torc  tlmd  LAG=5760  
-P  2 P  0
-#
-LOCTRANS CHECKIN MOZAIC CHECKOUT  REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 5 : Current surface (o->a 5)
-O_OCurx1 CURRENTX 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 6 : Current surface (o->a 6)
-O_OCury1 CURRENTY 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE  
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1 
-#
-wo2a.tsg 93  1 35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#  
-NORSUD   WSTEST
-############################################################################
-# Field 7 : Current surface (o->a 7)
-O_OCurz1 CURRENTZ 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 35
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1  
-#  
-NORSUD   WSTEST
-############################################################################
-#
-#                      ATMOSPHERE  --->>>  OCEAN
-#                      -------------------------
-############################################################################   
-#
-# Field 8 : wind stress along X axis (a->o 1)
-#
-COTAUXXU O_OTaux1 23 86400  6  flxat.nc   <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse 
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 9 : stress along Y axis (a->o 2)
-#
-COTAUYYU O_OTauy1 23 86400  6  flxat.nc  <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 10 :wind stress along Z axis (a->o 3)
-#
-COTAUZZU O_OTauz1 23 86400  6  flxat.nc  <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 11 : wind stress along X axis 2 (a->o 4)
-#
-COTAUXXV O_OTaux2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 12 : wind stress along Y axis 2 (a->o 5) 
-#
-COTAUYYV O_OTauy2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 13 :  wind stress along Z axis 2 (a->o 6) 
-#
-COTAUZZV O_OTauz2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-# Field 14 :  wind speed 10m (a->o 7) 
-#
-COWINDSP O_Wind10  56 86400  6    flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR 
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1  
-# 
-#########################################################################
-# Field 15 : Total rain (a->o 8)
-#
-COTOTRAI OTotRain 26 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 16 :  Total snow (a->o 9)
-#
-COTOTSNO  OTotSnow 28 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 17 : Total evap (a->o 10)
-#
-COTOTEVA  OTotEvap 25 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 18 : Evaporation Ice  (a->o 11)
-#
-COICEVAP OIceEvap 41 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 19 : Total solar heat flux (a->o 12)
-#
-COQSRMIX  O_QsrMix  7 86400 4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method or mozaic parameters
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 20 : Total Non solar heat flux  (a->o 13)
-#
-COQNSMIX  O_QnsMix 6 86400  4   flxat.nc  <output_mode>
-tlmd    torc   LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7 
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 21 : solar heat flux on ice (a->o 14)
-#
-COSHFICE O_QsrIce  7 86400 4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method or mozaic parameters
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-############################################################################
-#
-# Field 22 : Non solar heat flux on ice (a->o 15)
-#
-CONSFICE O_QnsIce 6 86400  4  flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse 
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-############################################################################
-#
-# Field 23 : Non solar heat flux derivative (a->o 16)
-#
-CODFLXDT O_dQnsdT  35 86400  4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    7
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 24 : iceberg calving (a->o 17)
-#
-COCALVIN OCalving  36 86400  4  flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.cal  98   5   27
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 25 : liquid run-off (river + direct)  (a->o 18)
-#
-COLIQRUN  O_Runoff 32 86400  5  flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC BLASNEW CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.run 94    4   129
-# change units from m/s to kg/s
-# weights convert from kg/s to kg/m^2/s
-1000.0 0
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-# Field 26 : wind stress module (a->o 19)
-#
-##COTAUMOD  O_TauMod 466 86400  6   flxat.nc   <output_mode>
-##tlmd    torc  LAG=<lag_atm> 
-##P  0 P  2
-##INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-##NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
-## INT=1
-# Mask value
-##888888.
-# Extrapolation method
-##NINENN 2 1 1
-# Interpolation method
-##BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
-## INT=1
-#
-#########################################################################
-#
- $END
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD9671
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD9671	(revision 2090)
+++ 	(revision )
@@ -1,587 +1,0 @@
-###############################################################################
-#
-#      Input file for OASIS3
-# 
-#      This version is for use with IPSL_CM4_v1 
-#
-#      The file will be edited at runtime to update it for
-#         - the initial date of the run
-#
-###############################################################################
-#  
-#      Input delimiters have to occupy position 1 to 9 !
-#      No blank lines allowed !
-#      Length of input lines <= 80 !
-#
-###############################################################################
-# 
-# SEQMODE : 1        if all models run simultaneously
-#           n        if  n  models run sequentially
- $SEQMODE
-              1
- $END
-###############################################################################
-#
-# CHANNEL (CHAR*4)
-#           PIPE        if named pipes + binary files are used 
-#                       for synchro and data respectively (not tested);
-#           MPI1/2      if MPI message passing is used for data exchange;
-#
- $CHANNEL
- <lib_mpi>
- <nproc_atm>  <nproc_atm>
- <nproc_oce>  <nproc_oce>
- $END
-###############################################################################
-#
-# NFIELDS : total number of fields being exchanged.
-#
- $NFIELDS
-            25
- $END
-###############################################################################
-#
-# JOBNAME : acronym for the given simulation (CHAR*3)
-#
- $JOBNAME
-            EXP   
- $END
-###############################################################################
-#
-# NBMODEL : number of models and their names (CHAR*6).
-#
- $NBMODEL
-  2  lmdz.x oceanx
- $END
-###############################################################################
-#
-# RUNTIME: total simulated time for the actual run in seconds (<I8)
-#
- $RUNTIME
- <total_time>
- $END
-###############################################################################
-#
-# INIDATE (I8)
-#         initial date of the run (YYYYMMDD)
-#
- $INIDATE
- <initial_date>
- $END
-###############################################################################
-# 
-# MODINFO (YES or NOT)
-#         Indicates whether a header is encapsulated within the field
-#
- $MODINFO
-  NOT
- $END
-###############################################################################
-#
-# NLOGPRT: printing level in output file cplout: 
-#              0 = no printing
-#              1 = main routines and field names when treated
-#              2 = complete output
-#
- $NLOGPRT
-   2
- $END
-###############################################################################
-#
-# CALTYPE: Calendar type
-#                  0      = 365 day calendar (no leap years)
-#                  1      = 365 day, or 366 days for leap years, calendar
-#                  n (>1) = n day month calendar
-#
- $CALTYPE
- <calendar_type>
- $END
-#
-# 
-###############################################################################
- $STRINGS
-###############################################################################
-#
-#                      OCEAN  --->>>  ATMOS
-#                      --------------------
-# Field 1 : Weighted Sea surface temperature (o->a 1)
-#
-O_SSTSST SISUTESW 1 86400  5  sstoc.nc  <output_mode> 
-torc  tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
-# LOCTRANS: AVERAGE to average value over coupling period
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mozaic: 1) mapping filename 2) connected unit 3) dataset rank 4) Maximum
-#         number of overlapped neighbors
-wo2a.tsg 93  1  20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-  NORSUD   WSTEST
-#  
-############################################################################
-# Field 2 : Sea ice extent  (o->a 2)
-#
-OIceFrac SIICECOV 44 86400  5  sstoc.nc <output_mode>
-torc  tlmd   LAG=5760
-P  2 P  0
-#
-LOCTRANS CHECKIN MOZAIC  CHECKOUT  REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 3 : Weighted Sea Ice Temperature (o->a 3)
-#
-O_TepIce SIICTEMW 34 86400  5  sstoc.nc  <output_mode>
-torc  tlmd   LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# 
-wo2a.tsg 93  1  20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-  NORSUD   WSTEST
-#
-############################################################################
-# Field 4 : Weighted Sea ice albedo (o->a 4)
-#
-O_AlbIce SIICEALW 17 86400  5  sstoc.nc  <output_mode>
-torc  tlmd  LAG=5760  
-P  2 P  0
-#
-LOCTRANS CHECKIN MOZAIC CHECKOUT  REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 5 : Current surface (o->a 5)
-O_OCurx1 CURRENTX 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-NORSUD   WSTEST
-#
-############################################################################
-# Field 6 : Current surface (o->a 6)
-O_OCury1 CURRENTY 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE  
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1 
-#
-wo2a.tsg 93  1 20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#  
-NORSUD   WSTEST
-############################################################################
-# Field 7 : Current surface (o->a 7)
-O_OCurz1 CURRENTZ 321 86400  5  sstoc.nc  <output_mode>
-torc    tlmd  LAG=5760
-P  2 P  0
-LOCTRANS CHECKIN MOZAIC CHECKOUT REVERSE
- AVERAGE
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-#
-wo2a.tsg 93  1 20
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1  
-#  
-NORSUD   WSTEST
-#
-############################################################################
-#
-#                      ATMOSPHERE  --->>>  OCEAN
-#                      -------------------------
-############################################################################   
-#
-# Field 8 : wind stress along X axis (a->o 1)
-#
-COTAUXXU O_OTaux1 23 86400  6  flxat.nc   <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse 
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 9 : stress along Y axis (a->o 2)
-#
-COTAUYYU O_OTauy1 23 86400  6  flxat.nc  <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 10 :wind stress along Z axis (a->o 3)
-#
-COTAUZZU O_OTauz1 23 86400  6  flxat.nc  <output_mode>
-tlmd    uorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 11 : wind stress along X axis 2 (a->o 4)
-#
-COTAUXXV O_OTaux2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 12 : wind stress along Y axis 2 (a->o 5) 
-#
-COTAUYYV O_OTauy2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 13 :  wind stress along Z axis 2 (a->o 6) 
-#
-COTAUZZV O_OTauz2 24 86400  6    flxat.nc  <output_mode>
-tlmd    vorc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-# Field 14 :  wind speed 10m (a->o 7) 
-#
-COWINDSP O_Wind10  56 86400  6    flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Mask value
-888888.
-# Extrapolation method
-NINENN 2 1 1
-# Interpolation method
-BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-# 
-#########################################################################
-#
-# Field 15 : Total rain  (a->o 8)
-#
-COTOTRAI OTotRain 26 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 16 :  Total snow (a->o 9)
-#
-COTOTSNO  OTotSnow 28 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 17 : Total evap (a->o 10)
-#
-COTOTEVA  OTotEvap 25 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-##########################################################################
-#
-# Field 18 : Evaporation Ice  (a->o 11)
-#
-COICEVAP OIceEvap 41 86400  4   flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 19 : Total solar heat flux (a->o 12)
-#
-COQSRMIX O_QsrMix  7 86400 4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method or mozaic parameters
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 20 : Total Non solar heat flux (a->o 13)
-#
-COQNSMIX O_QnsMix 6 86400  4   flxat.nc  <output_mode>
-tlmd    torc   LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14 
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-#
-# Field 21 : solar heat flux on ice (a->o 14)
-#
-COSHFICE O_QsrIce  7 86400 4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method or mozaic parameters
-wa2o.flx 92  2    14  
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-############################################################################
-#
-# Field 22 : Non solar heat flux on ice (a->o 15)
-#
-CONSFICE O_QnsIce 6 86400  4  flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse 
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-############################################################################
-#
-# Field 23 : Non solar heat flux derivative (a->o 16)
-#
-CODFLXDT O_dQnsdT  35 86400  4   flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm>
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.flx 92  2    14
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 24 : iceberg calving (a->o 17)
-#
-COCALVIN OCalving  36 86400  4  flxat.nc  <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.cal  98   5   36
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-#########################################################################
-#
-# Field 25 : liquid run-off (river + direct)  (a->o 18)
-#
-COLIQRUN  O_Runoff 32 86400  5  flxat.nc   <output_mode>
-tlmd    torc  LAG=<lag_atm> 
-P  0 P  2
-INVERT CHECKIN MOZAIC BLASNEW CHECKOUT
-# Reverse
-NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
- INT=1
-# Interpolation method ou parametres mozaic
-wa2o.run 94    4   158
-# change units from m/s to kg/s
-# weights convert from kg/s to kg/m^2/s
-1000.0 0
-# CHECKOUT: indicate computation of global, land and sea field integrals.
- INT=1
-#
-###########################################################################
-# Field 26 : wind stress module (a->o 19)
-#
-##COTAUMOD  O_TauMod 466 86400  6   flxat.nc   <output_mode>
-##tlmd    torc  LAG=<lag_atm> 
-##P  0 P  2
-##INVERT CHECKIN MASK EXTRAP INTERP CHECKOUT
-# Reverse
-##NORSUD WSTEST
-# CHECKIN: indicate computation of global, land and sea field integrals.
-## INT=1
-# Mask value
-##888888.
-# Extrapolation method
-##NINENN 2 1 1
-# Interpolation method
-##BICUBIPS  Z   SCALAR
-# CHECKOUT: indicate computation of global, land and sea field integrals.
-## INT=1
-#
-#########################################################################
-#
- $END
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD9695
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD9695	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namcouple_ORCA2xLMD9695	(revision 2093)
@@ -127,5 +127,5 @@
 # Field 2 : Sea ice extent  (o->a 2)
 #
-OIceFrac SIICECOV 44 86400  5  sstoc.nc <output_mode>
+OIceFrc SIICECOV 44 86400  5  sstoc.nc <output_mode>
 torc  tlmd   LAG=5760
 P  2 P  0
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_ORCA2	(revision 2093)
@@ -246,13 +246,13 @@
 sn_snd_alb    =       'weighted ice'         ,    'no'    ,     ''      ,         ''           ,   ''
 sn_snd_thick  =       'none'                 ,    'no'   ,     ''      ,         ''           ,   ''
-sn_snd_crt    =       'none'                 ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'
+sn_snd_crt    =       'none'        ,    'no'    , 'cartesian' , '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_w10m   =       'coupled'                 ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_taumod =       'none'              ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_tau    =       'mixed oce-ice'             ,    '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_qsr    =       'conservative'          ,    'no'    ,     ''      ,         ''          ,   ''
+sn_rcv_qns    =       'conservative'          ,    'no'    ,     ''      ,         ''          ,   ''
 sn_rcv_emp    =       'conservative'         ,    'no'    ,     ''      ,         ''          ,   ''
 sn_rcv_rnf    =       'coupled'              ,    'no'    ,     ''      ,         ''          ,   ''
@@ -824,7 +824,7 @@
    nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
    ln_nnogather=  .false.  !  activate code to avoid mpi_allgather use at the northfold
-   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
-   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
-   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
+   jpni        =   1       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   5       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   5       !  jpnij  number of local domains (set automatically if < 1)
 /
 !-----------------------------------------------------------------------
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2	(revision 2090)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/PARAM/namelist_pisces_ORCA2	(revision 2093)
@@ -30,5 +30,5 @@
    cn_dir      = './'     !  root directory for the location of the dynamical files
 !
-   ln_presatm  = .true.   ! constant atmopsheric pressure (F) or from a file (T)
+   ln_presatm  = .false.   ! constant atmopsheric pressure (F) or from a file (T)
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm	(revision 2093)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/arch-X64_CURIE.fcm	(revision 2093)
@@ -0,0 +1,56 @@
+# Curie BULL at TGCC, http://www-hpc.cea.fr/en/complexe/tgcc-curie.htm
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+#
+%XIOS_HOME           ${PWD}/../../XIOS
+%OASIS_HOME          ${PWD}/../../../prism/X64
+
+%NCDF_INC            -I${NETCDF_INC_DIR} 
+%NCDF_LIB            -L${NETCDF_LIB_DIR} -lnetcdff -lnetcdf 
+%XIOS_INC            -I%XIOS_HOME/inc 
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+%OASIS_INC           -I%OASIS_HOME/build/lib/psmile.MPI1 
+%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmpp_io
+
+%FC                  mpif90 -c -cpp
+# for Curie Fat Node
+#%FCFLAGS             -i4 -r8 -O3 -fp-model precise -xSSE4.2 
+# for Curie Thin Node
+#%FCFLAGS             -i4 -r8 -O3 -fp-model precise -xAVX
+# for Curie all Node
+%FCFLAGS             -i4 -r8 -O3 -fp-model precise
+%FFLAGS              %FCFLAGS
+%LD                  mpif90
+%LDFLAGS             -lstdc++
+%FPPFLAGS            -P -C -traditional
+%AR                  ar
+%ARFLAGS             rs
+%MK                  gmake
+%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC
+%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/geo2ocean.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/geo2ocean.F90	(revision 2093)
+++ CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/geo2ocean.F90	(revision 2093)
@@ -0,0 +1,577 @@
+MODULE geo2ocean
+   !!======================================================================
+   !!                     ***  MODULE  geo2ocean  ***
+   !! Ocean mesh    :  ???
+   !!======================================================================
+   !! History :  OPA  !  07-1996  (O. Marti)  Original code
+   !!   NEMO     1.0  !  02-2008  (G. Madec)  F90: Free form
+   !!            3.0  !  
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   repcmo      : 
+   !!   angle       :
+   !!   geo2oce     :
+   !!   repere      :   old routine suppress it ???
+   !!----------------------------------------------------------------------
+   USE dom_oce         ! mesh and scale factors
+   USE phycst          ! physical constants
+   USE in_out_manager  ! I/O manager
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE lib_mpp         ! MPP library
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   rot_rep, repcmo, repere, geo2oce, oce2geo   ! only rot_rep should be used
+                                             ! repcmo and repere are keep only for compatibility.
+                                             ! they are only a useless overlay of rot_rep
+
+   PUBLIC   obs_rot
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   &
+      gsint, gcost,   &  ! cos/sin between model grid lines and NP direction at T point
+      gsinu, gcosu,   &  ! cos/sin between model grid lines and NP direction at U point
+      gsinv, gcosv,   &  ! cos/sin between model grid lines and NP direction at V point
+      gsinf, gcosf       ! cos/sin between model grid lines and NP direction at F point
+
+   LOGICAL ,              SAVE, DIMENSION(4)     ::   linit = .FALSE.
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gsinlon, gcoslon, gsinlat, gcoslat
+
+   LOGICAL ::   lmust_init = .TRUE.        !: used to initialize the cos/sin variables (se above)
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: geo2ocean.F90 2715 2011-03-30 15:58:35Z rblod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE repcmo ( pxu1, pyu1, pxv1, pyv1,   &
+                       px2 , py2 )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE repcmo  ***
+      !!
+      !! ** Purpose :   Change vector componantes from a geographic grid to a
+      !!      stretched coordinates grid.
+      !!
+      !! ** Method  :   Initialization of arrays at the first call.
+      !!
+      !! ** Action  : - px2 : first  componante (defined at u point)
+      !!              - py2 : second componante (defined at v point)
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pxu1, pyu1   ! geographic vector componantes at u-point
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pxv1, pyv1   ! geographic vector componantes at v-point
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   px2          ! i-componante (defined at u-point)
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   py2          ! j-componante (defined at v-point)
+      !!----------------------------------------------------------------------
+      
+      ! Change from geographic to stretched coordinate
+      ! ----------------------------------------------
+      CALL rot_rep( pxu1, pyu1, 'U', 'en->i',px2 )
+      CALL rot_rep( pxv1, pyv1, 'V', 'en->j',py2 )
+      
+   END SUBROUTINE repcmo
+
+
+   SUBROUTINE rot_rep ( pxin, pyin, cd_type, cdtodo, prot )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE rot_rep  ***
+      !!
+      !! ** Purpose :   Rotate the Repere: Change vector componantes between
+      !!                geographic grid <--> stretched coordinates grid.
+      !!
+      !! History :
+      !!   9.2  !  07-04  (S. Masson)  
+      !!                  (O. Marti ) Original code (repere and repcmo)
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT( IN ) ::   pxin, pyin   ! vector componantes
+      CHARACTER(len=1),             INTENT( IN ) ::   cd_type      ! define the nature of pt2d array grid-points
+      CHARACTER(len=5),             INTENT( IN ) ::   cdtodo       ! specify the work to do:
+      !!                                                           ! 'en->i' east-north componantes to model i componante
+      !!                                                           ! 'en->j' east-north componantes to model j componante
+      !!                                                           ! 'ij->e' model i-j componantes to east componante
+      !!                                                           ! 'ij->n' model i-j componantes to east componante
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::   prot      
+      !!----------------------------------------------------------------------
+
+      ! Initialization of gsin* and gcos* at first call
+      ! -----------------------------------------------
+
+      IF( lmust_init ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' rot_rep : geographic <--> stretched'
+         IF(lwp) WRITE(numout,*) ' ~~~~~    coordinate transformation'
+         !
+         CALL angle       ! initialization of the transformation
+         lmust_init = .FALSE.
+      ENDIF
+      
+      SELECT CASE (cdtodo)
+      CASE ('en->i')      ! 'en->i' est-north componantes to model i componante
+         SELECT CASE (cd_type)
+         CASE ('T')   ;   prot(:,:) = pxin(:,:) * gcost(:,:) + pyin(:,:) * gsint(:,:)
+         CASE ('U')   ;   prot(:,:) = pxin(:,:) * gcosu(:,:) + pyin(:,:) * gsinu(:,:)
+         CASE ('V')   ;   prot(:,:) = pxin(:,:) * gcosv(:,:) + pyin(:,:) * gsinv(:,:)
+         CASE ('F')   ;   prot(:,:) = pxin(:,:) * gcosf(:,:) + pyin(:,:) * gsinf(:,:)
+         CASE DEFAULT   ;   CALL ctl_stop( 'Only T, U, V and F grid points are coded' )
+         END SELECT
+      CASE ('en->j')      ! 'en->j' est-north componantes to model j componante
+         SELECT CASE (cd_type)
+         CASE ('T')   ;   prot(:,:) = pyin(:,:) * gcost(:,:) - pxin(:,:) * gsint(:,:)
+         CASE ('U')   ;   prot(:,:) = pyin(:,:) * gcosu(:,:) - pxin(:,:) * gsinu(:,:)
+         CASE ('V')   ;   prot(:,:) = pyin(:,:) * gcosv(:,:) - pxin(:,:) * gsinv(:,:)   
+         CASE ('F')   ;   prot(:,:) = pyin(:,:) * gcosf(:,:) - pxin(:,:) * gsinf(:,:)   
+         CASE DEFAULT   ;   CALL ctl_stop( 'Only T, U, V and F grid points are coded' )
+         END SELECT
+      CASE ('ij->e')      ! 'ij->e' model i-j componantes to est componante
+         SELECT CASE (cd_type)
+         CASE ('T')   ;   prot(:,:) = pxin(:,:) * gcost(:,:) - pyin(:,:) * gsint(:,:)
+         CASE ('U')   ;   prot(:,:) = pxin(:,:) * gcosu(:,:) - pyin(:,:) * gsinu(:,:)
+         CASE ('V')   ;   prot(:,:) = pxin(:,:) * gcosv(:,:) - pyin(:,:) * gsinv(:,:)
+         CASE ('F')   ;   prot(:,:) = pxin(:,:) * gcosf(:,:) - pyin(:,:) * gsinf(:,:)
+         CASE DEFAULT   ;   CALL ctl_stop( 'Only T, U, V and F grid points are coded' )
+         END SELECT
+      CASE ('ij->n')      ! 'ij->n' model i-j componantes to est componante
+         SELECT CASE (cd_type)
+         CASE ('T')   ;   prot(:,:) = pyin(:,:) * gcost(:,:) + pxin(:,:) * gsint(:,:)
+         CASE ('U')   ;   prot(:,:) = pyin(:,:) * gcosu(:,:) + pxin(:,:) * gsinu(:,:)
+         CASE ('V')   ;   prot(:,:) = pyin(:,:) * gcosv(:,:) + pxin(:,:) * gsinv(:,:)
+         CASE ('F')   ;   prot(:,:) = pyin(:,:) * gcosf(:,:) + pxin(:,:) * gsinf(:,:)
+         CASE DEFAULT   ;   CALL ctl_stop( 'Only T, U, V and F grid points are coded' )
+         END SELECT
+      CASE DEFAULT   ;   CALL ctl_stop( 'rot_rep: Syntax Error in the definition of cdtodo' )
+      END SELECT
+      
+   END SUBROUTINE rot_rep
+
+
+   SUBROUTINE angle
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE angle  ***
+      !! 
+      !! ** Purpose :   Compute angles between model grid lines and the North direction
+      !!
+      !! ** Method  :
+      !!
+      !! ** Action  :   Compute (gsint, gcost, gsinu, gcosu, gsinv, gcosv, gsinf, gcosf) arrays:
+      !!      sinus and cosinus of the angle between the north-south axe and the 
+      !!      j-direction at t, u, v and f-points
+      !!
+      !! History :
+      !!   7.0  !  96-07  (O. Marti )  Original code
+      !!   8.0  !  98-06  (G. Madec )
+      !!   8.5  !  98-06  (G. Madec )  Free form, F90 + opt.
+      !!   9.2  !  07-04  (S. Masson)  Add T, F points and bugfix in cos lateral boundary
+      !!----------------------------------------------------------------------
+      INTEGER ::   ji, jj   ! dummy loop indices
+      INTEGER ::   ierr     ! local integer
+      REAL(wp) ::   &
+         zlam, zphi,            &  ! temporary scalars
+         zlan, zphh,            &  !    "         "
+         zxnpt, zynpt, znnpt,   &  ! x,y components and norm of the vector: T point to North Pole
+         zxnpu, zynpu, znnpu,   &  ! x,y components and norm of the vector: U point to North Pole
+         zxnpv, zynpv, znnpv,   &  ! x,y components and norm of the vector: V point to North Pole
+         zxnpf, zynpf, znnpf,   &  ! x,y components and norm of the vector: F point to North Pole
+         zxvvt, zyvvt, znvvt,   &  ! x,y components and norm of the vector: between V points below and above a T point
+         zxffu, zyffu, znffu,   &  ! x,y components and norm of the vector: between F points below and above a U point
+         zxffv, zyffv, znffv,   &  ! x,y components and norm of the vector: between F points left  and right a V point
+         zxuuf, zyuuf, znuuf       ! x,y components and norm of the vector: between U points below and above a F point
+      !!----------------------------------------------------------------------
+      IF( .NOT. ALLOCATED( gsint ) ) THEN
+          ALLOCATE( gsint(jpi,jpj), gcost(jpi,jpj),   & 
+             &      gsinu(jpi,jpj), gcosu(jpi,jpj),   & 
+             &      gsinv(jpi,jpj), gcosv(jpi,jpj),   &  
+             &      gsinf(jpi,jpj), gcosf(jpi,jpj), STAT=ierr )
+      ENDIF
+      IF(lk_mpp)   CALL mpp_sum( ierr )
+      IF( ierr /= 0 )   CALL ctl_stop('STOP', 'angle_msh_geo: unable to allocate arrays' )
+
+      ! ============================= !
+      ! Compute the cosinus and sinus !
+      ! ============================= !
+      ! (computation done on the north stereographic polar plane)
+
+      DO jj = 2, jpjm1
+!CDIR NOVERRCHK
+         DO ji = fs_2, jpi   ! vector opt.
+
+            ! north pole direction & modulous (at t-point)
+            zlam = glamt(ji,jj)
+            zphi = gphit(ji,jj)
+            zxnpt = 0. - 2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            zynpt = 0. - 2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            znnpt = zxnpt*zxnpt + zynpt*zynpt
+
+            ! north pole direction & modulous (at u-point)
+            zlam = glamu(ji,jj)
+            zphi = gphiu(ji,jj)
+            zxnpu = 0. - 2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            zynpu = 0. - 2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            znnpu = zxnpu*zxnpu + zynpu*zynpu
+
+            ! north pole direction & modulous (at v-point)
+            zlam = glamv(ji,jj)
+            zphi = gphiv(ji,jj)
+            zxnpv = 0. - 2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            zynpv = 0. - 2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            znnpv = zxnpv*zxnpv + zynpv*zynpv
+
+            ! north pole direction & modulous (at f-point)
+            zlam = glamf(ji,jj)
+            zphi = gphif(ji,jj)
+            zxnpf = 0. - 2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            zynpf = 0. - 2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )
+            znnpf = zxnpf*zxnpf + zynpf*zynpf
+
+            ! j-direction: v-point segment direction (around t-point)
+            zlam = glamv(ji,jj  )
+            zphi = gphiv(ji,jj  )
+            zlan = glamv(ji,jj-1)
+            zphh = gphiv(ji,jj-1)
+            zxvvt =  2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * COS( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            zyvvt =  2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * SIN( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            znvvt = SQRT( znnpt * ( zxvvt*zxvvt + zyvvt*zyvvt )  )
+            znvvt = MAX( znvvt, 1.e-14 )
+
+            ! j-direction: f-point segment direction (around u-point)
+            zlam = glamf(ji,jj  )
+            zphi = gphif(ji,jj  )
+            zlan = glamf(ji,jj-1)
+            zphh = gphif(ji,jj-1)
+            zxffu =  2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * COS( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            zyffu =  2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * SIN( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            znffu = SQRT( znnpu * ( zxffu*zxffu + zyffu*zyffu )  )
+            znffu = MAX( znffu, 1.e-14 )
+
+            ! i-direction: f-point segment direction (around v-point)
+            zlam = glamf(ji  ,jj)
+            zphi = gphif(ji  ,jj)
+            zlan = glamf(ji-1,jj)
+            zphh = gphif(ji-1,jj)
+            zxffv =  2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * COS( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            zyffv =  2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * SIN( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            znffv = SQRT( znnpv * ( zxffv*zxffv + zyffv*zyffv )  )
+            znffv = MAX( znffv, 1.e-14 )
+
+            ! j-direction: u-point segment direction (around f-point)
+            zlam = glamu(ji,jj+1)
+            zphi = gphiu(ji,jj+1)
+            zlan = glamu(ji,jj  )
+            zphh = gphiu(ji,jj  )
+            zxuuf =  2. * COS( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * COS( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            zyuuf =  2. * SIN( rad*zlam ) * TAN( rpi/4. - rad*zphi/2. )   &
+               &  -  2. * SIN( rad*zlan ) * TAN( rpi/4. - rad*zphh/2. )
+            znuuf = SQRT( znnpf * ( zxuuf*zxuuf + zyuuf*zyuuf )  )
+            znuuf = MAX( znuuf, 1.e-14 )
+
+            ! cosinus and sinus using scalar and vectorial products
+            gsint(ji,jj) = ( zxnpt*zyvvt - zynpt*zxvvt ) / znvvt
+            gcost(ji,jj) = ( zxnpt*zxvvt + zynpt*zyvvt ) / znvvt
+
+            gsinu(ji,jj) = ( zxnpu*zyffu - zynpu*zxffu ) / znffu
+            gcosu(ji,jj) = ( zxnpu*zxffu + zynpu*zyffu ) / znffu
+
+            gsinf(ji,jj) = ( zxnpf*zyuuf - zynpf*zxuuf ) / znuuf
+            gcosf(ji,jj) = ( zxnpf*zxuuf + zynpf*zyuuf ) / znuuf
+
+            ! (caution, rotation of 90 degres)
+            gsinv(ji,jj) = ( zxnpv*zxffv + zynpv*zyffv ) / znffv
+            gcosv(ji,jj) =-( zxnpv*zyffv - zynpv*zxffv ) / znffv
+
+         END DO
+      END DO
+
+      ! =============== !
+      ! Geographic mesh !
+      ! =============== !
+
+      DO jj = 2, jpjm1
+         DO ji = fs_2, jpi   ! vector opt.
+            IF( MOD( ABS( glamv(ji,jj) - glamv(ji,jj-1) ), 360. ) < 1.e-8 ) THEN
+               gsint(ji,jj) = 0.
+               gcost(ji,jj) = 1.
+            ENDIF
+            IF( MOD( ABS( glamf(ji,jj) - glamf(ji,jj-1) ), 360. ) < 1.e-8 ) THEN
+               gsinu(ji,jj) = 0.
+               gcosu(ji,jj) = 1.
+            ENDIF
+            IF(      ABS( gphif(ji,jj) - gphif(ji-1,jj) )         < 1.e-8 ) THEN
+               gsinv(ji,jj) = 0.
+               gcosv(ji,jj) = 1.
+            ENDIF
+            IF( MOD( ABS( glamu(ji,jj) - glamu(ji,jj+1) ), 360. ) < 1.e-8 ) THEN
+               gsinf(ji,jj) = 0.
+               gcosf(ji,jj) = 1.
+            ENDIF
+         END DO
+      END DO
+
+      ! =========================== !
+      ! Lateral boundary conditions !
+      ! =========================== !
+
+      ! lateral boundary cond.: T-, U-, V-, F-pts, sgn
+      CALL lbc_lnk( gcost, 'T', -1. )   ;   CALL lbc_lnk( gsint, 'T', -1. )
+      CALL lbc_lnk( gcosu, 'U', -1. )   ;   CALL lbc_lnk( gsinu, 'U', -1. )
+      CALL lbc_lnk( gcosv, 'V', -1. )   ;   CALL lbc_lnk( gsinv, 'V', -1. )
+      CALL lbc_lnk( gcosf, 'F', -1. )   ;   CALL lbc_lnk( gsinf, 'F', -1. )
+
+   END SUBROUTINE angle
+
+
+   SUBROUTINE geo2oce ( pxx, pyy, pzz, cgrid,     &
+                        pte, ptn )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE geo2oce  ***
+      !!      
+      !! ** Purpose :
+      !!
+      !! ** Method  :   Change wind stress from geocentric to east/north
+      !!
+      !! History :
+      !!        !         (O. Marti)  Original code
+      !!        !  91-03  (G. Madec)
+      !!        !  92-07  (M. Imbard)
+      !!        !  99-11  (M. Imbard) NetCDF format with IOIPSL
+      !!        !  00-08  (D. Ludicone) Reduced section at Bab el Mandeb
+      !!   8.5  !  02-06  (G. Madec)  F90: Free form
+      !!   3.0  !  07-08  (G. Madec)  geo2oce suppress lon/lat agruments
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::  pxx, pyy, pzz
+      CHARACTER(len=1)            , INTENT(in   ) ::  cgrid
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) ::  pte, ptn
+      !!
+      REAL(wp), PARAMETER :: rpi = 3.141592653e0
+      REAL(wp), PARAMETER :: rad = rpi / 180.e0
+      INTEGER ::   ig     !
+      INTEGER ::   ierr   ! local integer
+      !!----------------------------------------------------------------------
+
+      IF( .NOT. ALLOCATED( gsinlon ) ) THEN
+         ALLOCATE( gsinlon(jpi,jpj,4) , gcoslon(jpi,jpj,4) ,   &
+            &      gsinlat(jpi,jpj,4) , gcoslat(jpi,jpj,4) , STAT=ierr )
+         IF( lk_mpp    )   CALL mpp_sum( ierr )
+         IF( ierr /= 0 )   CALL ctl_stop('STOP', 'angle_msh_geo: unable to allocate arrays' )
+      ENDIF
+
+      SELECT CASE( cgrid)
+         CASE ( 'T' )   
+            ig = 1
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamt(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamt(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphit(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphit(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'U' )   
+            ig = 2
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamu(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamu(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphiu(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphiu(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'V' )   
+            ig = 3
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamv(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamv(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphiv(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphiv(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'F' )   
+            ig = 4
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamf(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamf(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphif(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphif(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE default   
+            WRITE(ctmp1,*) 'geo2oce : bad grid argument : ', cgrid
+            CALL ctl_stop( ctmp1 )
+      END SELECT
+      
+      pte = - gsinlon(:,:,ig) * pxx + gcoslon(:,:,ig) * pyy
+      ptn = - gcoslon(:,:,ig) * gsinlat(:,:,ig) * pxx    &
+            - gsinlon(:,:,ig) * gsinlat(:,:,ig) * pyy    &
+            + gcoslat(:,:,ig) * pzz
+!!$   ptv =   gcoslon(:,:,ig) * gcoslat(:,:,ig) * pxx    &
+!!$         + gsinlon(:,:,ig) * gcoslat(:,:,ig) * pyy    &
+!!$         + gsinlat(:,:,ig) * pzz
+      !
+   END SUBROUTINE geo2oce
+
+   SUBROUTINE oce2geo ( pte, ptn, cgrid,     &
+                        pxx , pyy , pzz )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE oce2geo  ***
+      !!      
+      !! ** Purpose :
+      !!
+      !! ** Method  :   Change vector from east/north to geocentric
+      !!
+      !! History :
+      !!        !         (A. Caubel)  oce2geo - Original code
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT( IN    ) ::  pte, ptn
+      CHARACTER(len=1)            , INTENT( IN    ) ::  cgrid
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(   OUT ) ::  pxx , pyy , pzz
+      !!
+      REAL(wp), PARAMETER :: rpi = 3.141592653E0
+      REAL(wp), PARAMETER :: rad = rpi / 180.e0
+      INTEGER ::   ig     !
+      INTEGER ::   ierr   ! local integer
+      !!----------------------------------------------------------------------
+
+      IF( .NOT. ALLOCATED( gsinlon ) ) THEN
+         ALLOCATE( gsinlon(jpi,jpj,4) , gcoslon(jpi,jpj,4) ,   &
+            &      gsinlat(jpi,jpj,4) , gcoslat(jpi,jpj,4) , STAT=ierr )
+         IF( lk_mpp    )   CALL mpp_sum( ierr )
+         IF( ierr /= 0 )   CALL ctl_stop('STOP', 'angle_msh_geo: unable to allocate arrays' )
+      ENDIF
+
+      SELECT CASE( cgrid)
+         CASE ( 'T' )   
+            ig = 1
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamt(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamt(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphit(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphit(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'U' )   
+            ig = 2
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamu(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamu(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphiu(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphiu(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'V' )   
+            ig = 3
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamv(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamv(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphiv(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphiv(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE ( 'F' )   
+            ig = 4
+            IF( .NOT. linit(ig) ) THEN 
+               gsinlon(:,:,ig) = SIN( rad * glamf(:,:) )
+               gcoslon(:,:,ig) = COS( rad * glamf(:,:) )
+               gsinlat(:,:,ig) = SIN( rad * gphif(:,:) )
+               gcoslat(:,:,ig) = COS( rad * gphif(:,:) )
+               linit(ig) = .TRUE.
+            ENDIF
+         CASE default   
+            WRITE(ctmp1,*) 'geo2oce : bad grid argument : ', cgrid
+            CALL ctl_stop( ctmp1 )
+      END SELECT
+
+       pxx = - gsinlon(:,:,ig) * pte - gcoslon(:,:,ig) * gsinlat(:,:,ig) * ptn 
+       pyy =   gcoslon(:,:,ig) * pte - gsinlon(:,:,ig) * gsinlat(:,:,ig) * ptn
+       pzz =   gcoslat(:,:,ig) * ptn
+
+      
+   END SUBROUTINE oce2geo
+
+
+   SUBROUTINE repere ( px1, py1, px2, py2, kchoix, cd_type )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE repere  ***
+      !!        
+      !! ** Purpose :   Change vector componantes between a geopgraphic grid 
+      !!      and a stretched coordinates grid.
+      !!
+      !! ** Method  :   
+      !!
+      !! ** Action  :
+      !!
+      !! History :
+      !!        !  89-03  (O. Marti)  original code
+      !!        !  92-02  (M. Imbard)
+      !!        !  93-03  (M. Guyon)  symetrical conditions
+      !!        !  98-05  (B. Blanke)
+      !!   8.5  !  02-08  (G. Madec)  F90: Free form
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   px1, py1   ! two horizontal components to be rotated
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   px2, py2   ! the two horizontal components in the model repere
+      INTEGER , INTENT(in   )                     ::   kchoix     ! type of transformation
+      !                                                           ! = 1 change from geographic to model grid.
+      !                                                           ! =-1 change from model to geographic grid
+      CHARACTER(len=1), INTENT(in   ), OPTIONAL   ::   cd_type    ! define the nature of pt2d array grid-points
+      !
+      CHARACTER(len=1) ::   cl_type      ! define the nature of pt2d array grid-points (T point by default)
+      !!----------------------------------------------------------------------
+
+      cl_type = 'T'
+      IF( PRESENT(cd_type) )   cl_type = cd_type
+         !
+      SELECT CASE (kchoix)
+      CASE ( 1)      ! change from geographic to model grid.
+         CALL rot_rep( px1, py1, cl_type, 'en->i', px2 )
+         CALL rot_rep( px1, py1, cl_type, 'en->j', py2 )
+      CASE (-1)      ! change from model to geographic grid
+         CALL rot_rep( px1, py1, cl_type, 'ij->e', px2 )
+         CALL rot_rep( px1, py1, cl_type, 'ij->n', py2 )
+      CASE DEFAULT   ;   CALL ctl_stop( 'repere: Syntax Error in the definition of kchoix (1 OR -1' )
+      END SELECT
+      
+   END SUBROUTINE repere
+
+
+   SUBROUTINE obs_rot ( psinu, pcosu, psinv, pcosv )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE obs_rot  ***
+      !!
+      !! ** Purpose :   Copy gsinu, gcosu, gsinv and gsinv
+      !!                to input data for rotations of
+      !!                current at observation points
+      !!
+      !! History :
+      !!   9.2  !  09-02  (K. Mogensen)
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT( OUT )::   psinu, pcosu, psinv, pcosv   ! copy of data
+      !!----------------------------------------------------------------------
+
+      ! Initialization of gsin* and gcos* at first call
+      ! -----------------------------------------------
+
+      IF( lmust_init ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' obs_rot : geographic <--> stretched'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~   coordinate transformation'
+
+         CALL angle       ! initialization of the transformation
+         lmust_init = .FALSE.
+
+      ENDIF
+
+      psinu(:,:) = gsinu(:,:)
+      pcosu(:,:) = gcosu(:,:)
+      psinv(:,:) = gsinv(:,:)
+      pcosv(:,:) = gcosv(:,:)
+
+   END SUBROUTINE obs_rot
+
+  !!======================================================================
+END MODULE geo2ocean
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/iom.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/iom.F90	(revision 2090)
+++ 	(revision )
@@ -1,1302 +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 domngb          ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE dianam          ! build name of file
-   USE xios
-# endif
-
-   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
-
-   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_set_grid_attr
-   PRIVATE set_grid, set_scalar, set_xmlatt, set_mooring
-# 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
-#if defined key_iomput
-   INTERFACE iom_setkt
-      MODULE PROCEDURE xios_update_calendar
-   END INTERFACE
-# endif
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id: iom.F90 3771 2013-02-05 14:02:22Z smasson $
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE iom_init
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** Purpose :   
-      !!
-      !!----------------------------------------------------------------------
-#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 = "nemo"
-      IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname)
-      CALL xios_context_initialize(TRIM(clname), mpi_comm_opa)
-      CALL iom_swap
-
-      ! 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
-      CALL set_grid( "T", glamt, gphit ) 
-      CALL set_grid( "U", glamu, gphiu )
-      CALL set_grid( "V", glamv, gphiv )
-      CALL set_grid( "W", glamt, gphit )
-
-      ! vertical grid definition
-      CALL iom_set_axis_attr( "deptht", gdept_0 )
-      CALL iom_set_axis_attr( "depthu", gdept_0 )
-      CALL iom_set_axis_attr( "depthv", gdept_0 )
-      CALL iom_set_axis_attr( "depthw", gdepw_0 )
-# if defined key_floats
-      CALL iom_set_axis_attr( "nfloat", (ji, ji=1,nfloat) )
-# endif
-      
-      ! 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
-      !!---------------------------------------------------------------------
-      !!                   ***  SUBROUTINE  iom_swap  ***
-      !!
-      !! ** Purpose :  swap context between different agrif grid for xmlio_server
-      !!---------------------------------------------------------------------
-#if defined key_iomput
-      TYPE(xios_context) :: nemo_hdl
-
-     IF( TRIM(Agrif_CFixed()) == '0' ) THEN
-        CALL xios_get_handle("nemo",nemo_hdl)
-     ELSE
-        CALL xios_get_handle(TRIM(Agrif_CFixed())//"_nemo",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=100)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu]
-      CHARACTER(LEN=100)    ::   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=100)    ::   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
-         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, 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
-      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 )
-                  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
-            ENDIF
-         ENDIF
-      ENDIF
-      !
-   END FUNCTION iom_varid
-
-
-   !!----------------------------------------------------------------------
-   !!                   INTERFACE iom_get
-   !!----------------------------------------------------------------------
-   SUBROUTINE iom_g0d( kiomid, cdvar, pvar )
-      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               :: idvar   ! variable id
-      !
-      IF( kiomid > 0 ) THEN
-         idvar = iom_varid( kiomid, cdvar )
-         IF( iom_file(kiomid)%nfid > 0 .AND. idvar > 0 ) THEN
-            SELECT CASE (iom_file(kiomid)%iolib)
-            CASE (jpioipsl )   ;   CALL iom_ioipsl_get(  kiomid, idvar, pvar )
-            CASE (jpnf90   )   ;   CALL iom_nf90_get(    kiomid, idvar, pvar )
-            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=100)             ::   clinfo      ! info character
-      CHARACTER(LEN=100)             ::   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 more than '//cldmspc//' spatial dimension',   &
-                     &                         '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: ',i4,') 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
-#if defined key_iomput
-      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( cdname, 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) ::   cdname
-      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     (cdname) ) THEN
-         CALL xios_set_domain_attr     ( cdname, 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(cdname) ) THEN
-         CALL xios_set_domaingroup_attr( cdname, 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
-
-   END SUBROUTINE iom_set_domain_attr
-
-
-   SUBROUTINE iom_set_axis_attr( cdname, paxis )
-      CHARACTER(LEN=*)      , INTENT(in) ::   cdname
-      REAL(wp), DIMENSION(:), INTENT(in) ::   paxis
-      IF ( xios_is_valid_axis     (cdname) )   CALL xios_set_axis_attr     ( cdname, size=size(paxis),value=paxis )
-      IF ( xios_is_valid_axisgroup(cdname) )   CALL xios_set_axisgroup_attr( cdname, size=size(paxis),value=paxis )
-   END SUBROUTINE iom_set_axis_attr
-
-
-   SUBROUTINE iom_set_field_attr( cdname, freq_op)
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdname
-      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   freq_op
-      IF ( xios_is_valid_field     (cdname) )   CALL xios_set_field_attr     ( cdname, freq_op=freq_op )
-      IF ( xios_is_valid_fieldgroup(cdname) )   CALL xios_set_fieldgroup_attr( cdname, freq_op=freq_op )
-   END SUBROUTINE iom_set_field_attr
-
-
-   SUBROUTINE iom_set_file_attr( cdname, name, name_suffix )
-      CHARACTER(LEN=*)          , INTENT(in) ::   cdname
-      CHARACTER(LEN=*),OPTIONAL , INTENT(in) ::   name, name_suffix
-      IF ( xios_is_valid_file     (cdname) )   CALL xios_set_file_attr     ( cdname, name=name, name_suffix=name_suffix )
-      IF ( xios_is_valid_filegroup(cdname) )   CALL xios_set_filegroup_attr( cdname, name=name, name_suffix=name_suffix )
-   END SUBROUTINE iom_set_file_attr
-
-
-   SUBROUTINE iom_set_grid_attr( cdname, mask )
-      CHARACTER(LEN=*)                   , INTENT(in) ::   cdname
-      LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) ::   mask
-      IF ( xios_is_valid_grid     (cdname) )   CALL xios_set_grid_attr     ( cdname, mask=mask )
-      IF ( xios_is_valid_gridgroup(cdname) )   CALL xios_set_gridgroup_attr( cdname, mask=mask )
-   END SUBROUTINE iom_set_grid_attr
-
-
-   SUBROUTINE set_grid( cdgrd, plon, plat )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** 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 = zmask(:,:,1) /= 0. )
-         !CALL iom_set_grid_attr  ( "grid_"//cdgrd//"_3D", mask = zmask(:,:,:) /= 0. )
-
-         CALL iom_set_domain_attr( "grid_"//cdgrd       , mask = zmask(nldi:nlei, nldj:nlej, 1) /= 0. )
-         CALL iom_set_grid_attr  ( "grid_"//cdgrd//"_3D", mask = zmask(nldi:nlei, nldj:nlej, :) /= 0. )
-
-      ENDIF
-      
-   END SUBROUTINE set_grid
-
-
-   SUBROUTINE set_scalar
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** Purpose :   define fake grids for scalar point
-      !!
-      !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(1,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=1)
-      CALL iom_set_domain_attr('scalarpoint', lonvalue=(/ zz /), latvalue=(/ zz /))
-
-   END SUBROUTINE set_scalar
-
-
-   SUBROUTINE set_xmlatt
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** Purpose :   automatic definitions of some of the xml attributs...
-      !!
-      !!----------------------------------------------------------------------
-      CHARACTER(len=6),DIMENSION( 8) ::   clsuff                   ! suffix name
-      CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name
-      CHARACTER(len=50)              ::   clname                   ! file name
-      CHARACTER(len=1)               ::   cl1                      ! 1 character
-      CHARACTER(len=2)               ::   cl2                      ! 1 character
-      CHARACTER(len=255)             ::   tfo
-      INTEGER                        ::   idt                      ! time-step in seconds
-      INTEGER                        ::   iddss, ihhss             ! number of seconds in 1 day, 1 hour and 1 year
-      INTEGER                        ::   iyymo                    ! number of months in 1 year
-      INTEGER                        ::   jg, jh, jd, jm, jy       ! 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
-      !!----------------------------------------------------------------------
-      ! 
-      idt   = NINT( rdttra(1)     )
-      iddss = NINT( rday          )                                         ! number of seconds in 1 day
-      ihhss = NINT( rmmss * rhhmm )                                         ! number of seconds in 1 hour
-      iyymo = NINT( raamo         )                                         ! number of months in 1 year
-
-      ! frequency of the call of iom_put (attribut: freq_op)
-      tfo = TRIM(i2str(idt))//'s'
-      CALL iom_set_field_attr('field_definition', freq_op=tfo)
-      CALL iom_set_field_attr('SBC'   , freq_op=TRIM(i2str(idt* nn_fsbc ))//'s')
-      CALL iom_set_field_attr('ptrc_T', freq_op=TRIM(i2str(idt* nn_dttrc))//'s')
-      CALL iom_set_field_attr('diad_T', freq_op=TRIM(i2str(idt* nn_dttrc))//'s')
-       
-      ! output file names (attribut: name)
-      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'scalar' /)      
-      DO jg = 1, SIZE(clsuff)                                                                  ! grid type
-         DO jh = 1, 24                                                                         ! 1-24 hours
-            WRITE(cl2,'(i2)') jh 
-            CALL dia_nam( clname, jh * ihhss, clsuff(jg), ldfsec = .TRUE. )
-            CALL iom_set_file_attr(TRIM(ADJUSTL(cl2))//'h_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jd = 1, 30                                                                         ! 1-30 days
-            WRITE(cl1,'(i1)') jd 
-            CALL dia_nam( clname, jd * iddss, clsuff(jg), ldfsec = .TRUE. )
-            CALL iom_set_file_attr(cl1//'d_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jm = 1, 11                                                                         ! 1-11 months
-            WRITE(cl1,'(i1)') jm 
-            CALL dia_nam( clname, -jm, clsuff(jg) )
-            CALL iom_set_file_attr(cl1//'m_'//clsuff(jg), name=TRIM(clname))
-         END DO
-         DO jy = 1, 50                                                                         ! 1-50 years  
-            WRITE(cl2,'(i2)') jy 
-            CALL dia_nam( clname, -jy * iyymo, clsuff(jg) )
-            CALL iom_set_file_attr(TRIM(ADJUSTL(cl2))//'y_'//clsuff(jg), name=TRIM(clname))
-         END DO
-      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_set_file_attr('Eq'//cl1, name_suffix= '_Eq')
-      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 )
-      
-   END SUBROUTINE set_xmlatt
-
-
-   SUBROUTINE set_mooring( plon, plat)
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE   ***
-      !!
-      !! ** 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=50)             ::   clname                   ! file 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_set_file_attr(TRIM(clname)//cl1, name_suffix= '_'//TRIM(clname))
-            END DO
-         END DO
-      END DO
-      
-   END SUBROUTINE set_mooring
-
-#else
-
-   SUBROUTINE iom_setkt( kt )
-      INTEGER, INTENT(in   )::   kt 
-      IF( .FALSE. )   WRITE(numout,*) kt   ! useless test to avoid compilation warnings
-   END SUBROUTINE iom_setkt
-
-#endif
-
-   FUNCTION i2str(int)
-   IMPLICIT NONE
-      INTEGER, INTENT(IN) :: int
-      CHARACTER(LEN=255) :: i2str
-
-      WRITE(i2str,*) int
-      
-   END FUNCTION i2str  
-   
-   !!======================================================================
-END MODULE iom
Index: CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbccpl.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/SOURCES/NEMO/sbccpl.F90	(revision 2090)
+++ 	(revision )
@@ -1,1630 +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
-
-   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 3680 2012-11-27 14:42:24Z rblod $
-   !! 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
-      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       !
-      ! ================================ !
-
-      ! default definitions
-      !                    !     description       !  multiple  !    vector   !      vector          ! vector !
-      !                    !                       ! categories !  reference  !    orientation       ! grids  !
-      ! send
-      sn_snd_temp   = FLD_C( 'weighted oce and ice',    'no'    ,     ''      ,         ''           ,   ''   ) 
-      sn_snd_alb    = FLD_C( 'weighted ice'        ,    'no'    ,     ''      ,         ''           ,   ''   ) 
-      sn_snd_thick  = FLD_C( 'none'                ,    'no'    ,     ''      ,         ''           ,   ''   ) 
-      sn_snd_crt    = FLD_C( 'none'                ,    'no'    , 'spherical' , 'eastward-northward' ,  'T'   )     
-      sn_snd_co2    = FLD_C( 'none'                ,    'no'    ,     ''      ,         ''           ,   ''   )     
-      ! receive
-      sn_rcv_w10m   = FLD_C( 'none'                ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_taumod = FLD_C( 'coupled'             ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_tau    = FLD_C( 'oce only'            ,    'no'    , 'cartesian' , 'eastward-northward',  'U,V'  )  
-      sn_rcv_dqnsdt = FLD_C( 'coupled'             ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_qsr    = FLD_C( 'oce and ice'         ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_qns    = FLD_C( 'oce and ice'         ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_emp    = FLD_C( 'conservative'        ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_rnf    = FLD_C( 'coupled'             ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_cal    = FLD_C( 'coupled'             ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_iceflx = FLD_C( 'none'                ,    'no'    ,     ''      ,         ''          ,   ''    )
-      sn_rcv_co2    = FLD_C( 'none'                ,    'no'    ,     ''      ,         ''          ,   ''    )
-
-      REWIND( numnam )                    ! ... read namlist namsbc_cpl
-      READ  ( numnam, 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.
-      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' )
-      !                                                      ! ------------------------- !
-      !                                                      !    Ice Qsr penetration    !   
-      !                                                      ! ------------------------- !
-      ! 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
-      !                                                      ! ------------------------- !
-      !                                                      !      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 ) THEN
-            IF (lwp) WRITE (numout,*) 'Allocation frcv (jn), jn = ', jn
-            ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )
-         END IF
-      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) )
-      
-      IF ( .NOT. ASSOCIATED (  frcv(jpr_itx1)%z3 ))  ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) )
-      IF ( .NOT. ASSOCIATED (  frcv(jpr_ity1)%z3 ))  ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) )
-
-      ! ================================ !
-      !     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( kt == nit000 )   CALL sbc_cpl_init( k_ice )          ! initialisation
-
-      !                                                 ! 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 
-      !!
-      !!                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, here 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 )
-
-      IF( srcv(jpr_itx1)%laction ) 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
-
-         !                                                      ! ======================= !
-         IF( srcv(jpr_itx1)%laction ) 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' ) 
-               IF (lwp) WRITE (numout,*) 'Usage, jn = jpr_itx1 : ', jpr_itx1, ASSOCIATED( frcv(jpr_itx1)%z3 )
-               IF (lwp) WRITE (numout,*) 'Usage, jn = jpr_ity1 : ', jpr_ity1, ASSOCIATED( frcv(jpr_ity1)%z3 )
-               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
-
-      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,1) + 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
