Index: /NEMO/trunk/cfgs/ORCA2_ICE_PISCES/EXPREF/file_def_nemo-pisces.xml
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_ICE_PISCES/EXPREF/file_def_nemo-pisces.xml	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_ICE_PISCES/EXPREF/file_def_nemo-pisces.xml	(revision 14255)
@@ -33,13 +33,13 @@
 
         <file id="file32" name_suffix="_ptrc_T" description="pisces sms variables" >
-          <field field_ref="DIC"      />
-          <field field_ref="Alkalini" />
-          <field field_ref="O2"       />
-          <field field_ref="PO4"      />
-          <field field_ref="Si"       />
-          <field field_ref="Fer"      />
-          <field field_ref="NCHL"     />
-          <field field_ref="DCHL"     />
-          <field field_ref="NO3"      />
+          <field field_ref="DIC"       name="DIC"      operation="average" freq_op="1mo" > @DIC_E3T / @e3t </field>
+          <field field_ref="Alkalini"  name="Alkalini" operation="average" freq_op="1mo" > @Alkalini_E3T / @e3t </field>
+          <field field_ref="O2"        name="O2"       operation="average" freq_op="1mo" > @O2_E3T / @e3t </field>
+          <field field_ref="PO4"       name="PO4"      operation="average" freq_op="1mo" > @PO4_E3T / @e3t </field>
+          <field field_ref="Si"        name="Si"       operation="average" freq_op="1mo" > @Si_E3T / @e3t </field>
+          <field field_ref="Fer"       name="Fer"      operation="average" freq_op="1mo" > @Fer_E3T / @e3t </field>
+          <field field_ref="NCHL"      name="NCHL"     operation="average" freq_op="1mo" > @NCHL_E3T / @e3t </field>
+          <field field_ref="DCHL"      name="DCHL"     operation="average" freq_op="1mo" > @DCHL_E3T / @e3t </field>
+          <field field_ref="NO3"       name="NO3"      operation="average" freq_op="1mo" > @NO3_E3T / @e3t </field>
         </file>
 
@@ -53,29 +53,29 @@
       <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."> <!-- real yearly files -->
 
-        <file id="file34" name_suffix="_ptrc_T" description="pisces sms variables" >
-          <field field_ref="DIC"      />
-          <field field_ref="Alkalini" />
-          <field field_ref="O2"       />
-          <field field_ref="CaCO3"    />
-          <field field_ref="PO4"      />
-          <field field_ref="POC"      />
-          <field field_ref="Si"       />
-          <field field_ref="PHY"      />
-          <field field_ref="ZOO"      />
-          <field field_ref="DOC"      />
-          <field field_ref="PHY2"     />
-          <field field_ref="ZOO2"     />
-          <field field_ref="DSi"      />
-          <field field_ref="Fer"      />
-          <field field_ref="BFe"      />
-          <field field_ref="GOC"      />
-          <field field_ref="SFe"      />
-          <field field_ref="DFe"      />
-          <field field_ref="GSi"      />
-          <field field_ref="NFe"      />
-          <field field_ref="NCHL"     />
-          <field field_ref="DCHL"     />
-          <field field_ref="NO3"      />
-          <field field_ref="NH4"      />
+	<file id="file34" name_suffix="_ptrc_T" description="pisces sms variables" >
+          <field field_ref="DIC"       name="DIC"      operation="average" freq_op="1y" > @DIC_E3T / @e3t </field>
+          <field field_ref="Alkalini"  name="Alkalini" operation="average" freq_op="1y" > @Alkalini_E3T / @e3t </field>
+          <field field_ref="O2"        name="O2"       operation="average" freq_op="1y" > @O2_E3T / @e3t </field>
+          <field field_ref="CaCO3"     name="CaCO3"    operation="average" freq_op="1y" > @CaCO3_E3T / @e3t </field>
+          <field field_ref="PO4"       name="PO4"      operation="average" freq_op="1y" > @PO4_E3T / @e3t </field>
+          <field field_ref="POC"       name="POC"      operation="average" freq_op="1y" > @POC_E3T / @e3t </field>
+          <field field_ref="Si"        name="Si"       operation="average" freq_op="1y" > @Si_E3T / @e3t </field>
+          <field field_ref="PHY"       name="PHY"      operation="average" freq_op="1y" > @PHY_E3T / @e3t </field>
+          <field field_ref="ZOO"       name="ZOO"      operation="average" freq_op="1y" > @ZOO_E3T / @e3t </field>
+          <field field_ref="DOC"       name="DOC"      operation="average" freq_op="1y" > @DOC_E3T / @e3t </field>
+          <field field_ref="PHY2"      name="PHY2"     operation="average" freq_op="1y" > @PHY2_E3T / @e3t </field>
+          <field field_ref="ZOO2"      name="ZOO2"     operation="average" freq_op="1y" > @ZOO2_E3T / @e3t </field>
+          <field field_ref="DSi"       name="DSi"      operation="average" freq_op="1y" > @DSi_E3T / @e3t </field>
+          <field field_ref="Fer"       name="Fer"      operation="average" freq_op="1y" > @Fer_E3T / @e3t </field>
+          <field field_ref="BFe"       name="BFe"      operation="average" freq_op="1y" > @BFe_E3T / @e3t </field>
+          <field field_ref="GOC"       name="GOC"      operation="average" freq_op="1y" > @GOC_E3T / @e3t </field>
+          <field field_ref="SFe"       name="SFe"      operation="average" freq_op="1y" > @SFe_E3T / @e3t </field>
+          <field field_ref="DFe"       name="DFe"      operation="average" freq_op="1y" > @DFe_E3T / @e3t </field>
+          <field field_ref="GSi"       name="GSi"      operation="average" freq_op="1y" > @GSi_E3T / @e3t </field>
+          <field field_ref="NFe"       name="NFe"      operation="average" freq_op="1y" > @NFe_E3T / @e3t </field>
+          <field field_ref="NCHL"      name="NCHL"     operation="average" freq_op="1y" > @NCHL_E3T / @e3t </field>
+          <field field_ref="DCHL"      name="DCHL"     operation="average" freq_op="1y" > @DCHL_E3T / @e3t </field>
+          <field field_ref="NO3"       name="NO3"      operation="average" freq_op="1y" > @NO3_E3T / @e3t </field>
+          <field field_ref="NH4"       name="NH4"      operation="average" freq_op="1y" > @NH4_E3T / @e3t </field>
         </file>
 
Index: /NEMO/trunk/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_cfg
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_cfg	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_cfg	(revision 14255)
@@ -313,6 +313,5 @@
    ln_dynrnf       =  .false.    !  runoffs option enabled (T) or not (F)
    ln_dynrnf_depth =  .false.    !  runoffs is spread in vertical (T) or not (F)
-!   fwbcorr        = 3.786e-06   !  annual global mean of empmr for ssh correction
-
+   !
    cn_dir      = './'      !  root directory for the ocean data location
    !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________!
Index: /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/context_nemo.xml
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/context_nemo.xml	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/context_nemo.xml	(revision 14255)
@@ -20,9 +20,10 @@
 
 <!-- Fields definition -->
-    <field_definition src="./field_def_nemo-oce.xml"/>    <!--  NEMO ocean dynamics     -->
-    <field_definition src="./field_def_nemo-innerttrc.xml"/> <!--  NEMO ocean biology      -->
+    <field_definition src="./field_def_nemo-oce.xml"/>      <!--  NEMO ocean dynamics     -->
+    <field_definition src="./field_def_nemo-pisces.xml"/>    <!--  NEMO ocean biogeochemistry     -->
+    <field_definition src="./field_def_nemo-innerttrc.xml"/> <!--  NEMO ocean passive tracers      -->
 
 <!-- Files definition -->
-    <file_definition src="./file_def_nemo-innerttrc.xml"/>  <!--  NEMO ocean biology       -->
+    <file_definition src="./file_def_nemo-innerttrc.xml"/>  <!--  NEMO ocean passive tracers       -->
 
 
Index: /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/field_def_nemo-pisces.xml
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/field_def_nemo-pisces.xml	(revision 14255)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/field_def_nemo-pisces.xml	(revision 14255)
@@ -0,0 +1,1 @@
+link ../../SHARED/field_def_nemo-pisces.xml
Index: /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/file_def_nemo-innerttrc.xml
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/file_def_nemo-innerttrc.xml	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/file_def_nemo-innerttrc.xml	(revision 14255)
@@ -31,11 +31,16 @@
 
       <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."> <!-- real yearly files -->
+	      
+	<file id="file1" name_suffix="grid_T" description="passive tracers variables" >
+           <field field_ref="e3t"     />
+           <field field_ref="ssh"    name="zos"  />
+         </file>
 
-        <file id="file1" name_suffix="_ptrc_T" description="passive tracers variables" >
-           <field field_ref="Age"    />
-           <field field_ref="CFC11"  />
-           <field field_ref="CFC12"  />
-           <field field_ref="SF6"    />
-           <field field_ref="RC14"   />
+	 <file id="file1" name_suffix="_trc" description="passive tracers variables" >
+           <field field_ref="Age"     name="Age"     operation="average" freq_op="1y"  > @Age_e3t / @e3t   </field>		      
+           <field field_ref="CFC11"   name="CFC11"   operation="average" freq_op="1y"  > @CFC11_e3t / @e3t </field>
+           <field field_ref="CFC12"   name="CFC12"   operation="average" freq_op="1y"  > @CFC12_e3t / @e3t </field>
+           <field field_ref="SF6"     name="SF6"     operation="average" freq_op="1y"  > @SF6_e3t / @e3t   </field>
+           <field field_ref="RC14"    name="RC14"    operation="average" freq_op="1y"  > @RC14_e3t / @e3t  </field>
          </file>
 
Index: /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/namelist_cfg
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/namelist_cfg	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_TRC/EXPREF/namelist_cfg	(revision 14255)
@@ -32,5 +32,4 @@
 &namdom        !   time and space domain
 !-----------------------------------------------------------------------
-   ln_linssh   = .true.   !  =T  linear free surface  ==>>  model level are fixed in time
    !
    rn_Dt      = 21600.     !  time step for the dynamics and tracer
@@ -197,4 +196,5 @@
 &namdrg        !   top/bottom drag coefficient                          (default: NO selection)
 !-----------------------------------------------------------------------
+   ln_drg_OFF  = .true.   !  free-slip  
 /
 !-----------------------------------------------------------------------
@@ -308,26 +308,28 @@
 &namdta_dyn    !   offline ocean input files                            (OFF_SRC only)
 !-----------------------------------------------------------------------
-   ln_dynrnf       =  .false.    !  runoffs option enabled (T) or not (F)
+   ln_dynrnf       =  .true.    !  runoffs option enabled (T) or not (F)
    ln_dynrnf_depth =  .false.    !  runoffs is spread in vertical (T) or not (F)
-!   fwbcorr        = 3.786e-06   !  annual global mean of empmr for ssh correction
-
+   !
    cn_dir      = './'      !  root directory for the ocean data location
-   !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________!
-   !           !  file name              ! frequency (hours) ! variable  ! time interp.!  clim  ! 'yearly'/ ! weights filename ! rotation ! land/sea mask !
-   !           !                         !  (if <0  months)  !   name    !   (logical) !  (T/F) ! 'monthly' !                  ! pairing  !    filename   !
-   sn_tem      = 'dyna_grid_T'           ,       120.        , 'votemper'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_sal      = 'dyna_grid_T'           ,       120.        , 'vosaline'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_mld      = 'dyna_grid_T'           ,       120.        , 'somixhgt'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_emp      = 'dyna_grid_T'           ,       120.        , 'sowaflup'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_fmf      = 'dyna_grid_T'           ,       120.        , 'iowaflup'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_ice      = 'dyna_grid_T'           ,       120.        , 'soicecov'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_qsr      = 'dyna_grid_T'           ,       120.        , 'soshfldo'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_wnd      = 'dyna_grid_T'           ,       120.        , 'sowindsp'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_uwd      = 'dyna_grid_U'           ,       120.        , 'uocetr_eff',  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_vwd      = 'dyna_grid_V'           ,       120.        , 'vocetr_eff',  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_wwd      = 'dyna_grid_W'           ,       120.        , 'wocetr_eff',  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_avt      = 'dyna_grid_W'           ,       120.        , 'voddmavs'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_ubl      = 'dyna_grid_U'           ,       120.        , 'sobblcox'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
-   sn_vbl      = 'dyna_grid_V'           ,       120.        , 'sobblcoy'  ,  .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   !___________!_________________________!___________________!_____________!_____________!________!___________!__________________!__________!_______________!
+   !           !  file name              ! frequency (hours) !   variable  ! time interp.!  clim  ! 'yearly'/ ! weights filename ! rotation ! land/sea mask !
+   !           !                         !  (if <0  months)  !     name    !   (logical) !  (T/F) ! 'monthly' !                  ! pairing  !    filename   !
+   sn_tem      = 'dyna_grid_T'           ,       120.        , 'thetao'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_sal      = 'dyna_grid_T'           ,       120.        , 'so'        ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_div      = 'dyna_grid_T'           ,       120.        , 'hdivtr'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_mld      = 'dyna_grid_T'           ,       120.        , 'mldr10_1'  ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_emp      = 'dyna_grid_T'           ,       120.        , 'wfo'       ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_empb     = 'dyna_grid_T'           ,       120.        , 'wfob'      ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_fmf      = 'dyna_grid_T'           ,       120.        , 'fmmflx'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_rnf      = 'dyna_grid_T'           ,       120.        , 'runoffs'   ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_ice      = 'dyna_grid_T'           ,       120.        , 'siconc'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_qsr      = 'dyna_grid_T'           ,       120.        , 'rsntds'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_wnd      = 'dyna_grid_T'           ,       120.        , 'windsp'    ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_uwd      = 'dyna_grid_U'           ,       120.        , 'uocetr_eff',    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_vwd      = 'dyna_grid_V'           ,       120.        , 'vocetr_eff',    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_wwd      = 'dyna_grid_W'           ,       120.        , 'wocetr_eff',    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_avt      = 'dyna_grid_W'           ,       120.        , 'difvsolog' ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_ubl      = 'dyna_grid_U'           ,       120.        , 'ahu_bbl'   ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
+   sn_vbl      = 'dyna_grid_V'           ,       120.        , 'ahv_bbl'   ,    .true.   , .true. , 'yearly'  , ''               , ''       , ''
 /
 !!======================================================================
@@ -345,4 +347,5 @@
 &namzdf        !   vertical physics manager                             (default: NO selection)
 !-----------------------------------------------------------------------
+   ln_zdfcst   = .true.      !  constant mixing
 /
 !-----------------------------------------------------------------------
Index: /NEMO/trunk/cfgs/ORCA2_OFF_TRC/cpp_ORCA2_OFF_TRC.fcm
===================================================================
--- /NEMO/trunk/cfgs/ORCA2_OFF_TRC/cpp_ORCA2_OFF_TRC.fcm	(revision 14254)
+++ /NEMO/trunk/cfgs/ORCA2_OFF_TRC/cpp_ORCA2_OFF_TRC.fcm	(revision 14255)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys   key_top key_xios
+bld::tool::fppkeys   key_top key_xios key_qco
Index: /NEMO/trunk/cfgs/SHARED/namelist_ref
===================================================================
--- /NEMO/trunk/cfgs/SHARED/namelist_ref	(revision 14254)
+++ /NEMO/trunk/cfgs/SHARED/namelist_ref	(revision 14255)
@@ -1092,6 +1092,5 @@
    ln_dynrnf       =  .false.    !  runoffs option enabled (T) or not (F)
    ln_dynrnf_depth =  .false.    !  runoffs is spread in vertical (T) or not (F)
-   fwbcorr         =    0.0      !  annual global mean of empmr for ssh correction
-
+   !
    cn_dir      = './'      !  root directory for the ocean data location
    !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________!
Index: /NEMO/trunk/src/OCE/DOM/domain.F90
===================================================================
--- /NEMO/trunk/src/OCE/DOM/domain.F90	(revision 14254)
+++ /NEMO/trunk/src/OCE/DOM/domain.F90	(revision 14255)
@@ -182,5 +182,5 @@
       !                                 != ssh initialization
       !
-      IF( l_offline .OR. l_SAS ) THEN        !* No ocean dynamics calculation : set to 0
+      IF( l_SAS ) THEN        !* No ocean dynamics calculation : set to 0
          ssh(:,:,:) = 0._wp
 #if defined key_agrif
Index: /NEMO/trunk/src/OFF/dtadyn.F90
===================================================================
--- /NEMO/trunk/src/OFF/dtadyn.F90	(revision 14254)
+++ /NEMO/trunk/src/OFF/dtadyn.F90	(revision 14255)
@@ -53,15 +53,16 @@
    PUBLIC   dta_dyn_init       ! called by nemo_init
    PUBLIC   dta_dyn            ! called by nemo_gcm
-   PUBLIC   dta_dyn_sed_init   ! called by nemo_init
-   PUBLIC   dta_dyn_sed        ! called by nemo_gcm
    PUBLIC   dta_dyn_atf        ! called by nemo_gcm
 #if ! defined key_qco
    PUBLIC   dta_dyn_sf_interp  ! called by nemo_gcm
 #endif
+#if defined key_sed_off
+   PUBLIC   dta_dyn_sed_init   ! called by nemo_init
+   PUBLIC   dta_dyn_sed        ! called by nemo_gcm
+#endif
 
    CHARACTER(len=100) ::   cn_dir          !: Root directory for location of ssr files
    LOGICAL            ::   ln_dynrnf       !: read runoff data in file (T) or set to zero (F)
    LOGICAL            ::   ln_dynrnf_depth       !: read runoff data in file (T) or set to zero (F)
-   REAL(wp)           ::   fwbcorr
 
 
@@ -138,17 +139,17 @@
       ts(:,:,:,jp_tem,Kmm) = sf_dyn(jf_tem)%fnow(:,:,:)  * tmask(:,:,:)    ! temperature
       ts(:,:,:,jp_sal,Kmm) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
-      wndm(:,:)         = sf_dyn(jf_wnd)%fnow(:,:,1)  * tmask(:,:,1)    ! wind speed - needed for gas exchange
-      fmmflx(:,:)       = sf_dyn(jf_fmf)%fnow(:,:,1)  * tmask(:,:,1)    ! downward salt flux (v3.5+)
-      fr_i(:,:)         = sf_dyn(jf_ice)%fnow(:,:,1)  * tmask(:,:,1)    ! Sea-ice fraction
-      qsr (:,:)         = sf_dyn(jf_qsr)%fnow(:,:,1)  * tmask(:,:,1)    ! solar radiation
-      emp (:,:)         = sf_dyn(jf_emp)%fnow(:,:,1)  * tmask(:,:,1)    ! E-P
+      wndm(:,:)            = sf_dyn(jf_wnd)%fnow(:,:,1)  * tmask(:,:,1)    ! wind speed - needed for gas exchange
+      fmmflx(:,:)          = sf_dyn(jf_fmf)%fnow(:,:,1)  * tmask(:,:,1)    ! downward salt flux (v3.5+)
+      fr_i(:,:)            = sf_dyn(jf_ice)%fnow(:,:,1)  * tmask(:,:,1)    ! Sea-ice fraction
+      qsr (:,:)            = sf_dyn(jf_qsr)%fnow(:,:,1)  * tmask(:,:,1)    ! solar radiation
+      emp (:,:)            = sf_dyn(jf_emp)%fnow(:,:,1)  * tmask(:,:,1)    ! E-P
       IF( ln_dynrnf ) THEN 
-         rnf (:,:)      = sf_dyn(jf_rnf)%fnow(:,:,1) * tmask(:,:,1)    ! E-P
-         IF( ln_dynrnf_depth .AND. .NOT. ln_linssh )    CALL  dta_dyn_hrnf(Kmm)
+         rnf (:,:)         = sf_dyn(jf_rnf)%fnow(:,:,1) * tmask(:,:,1)    ! E-P
+         IF( ln_dynrnf_depth .AND. .NOT. ln_linssh )    CALL  dta_dyn_rnf( Kmm )
       ENDIF
       !
       uu(:,:,:,Kmm)        = sf_dyn(jf_uwd)%fnow(:,:,:) * umask(:,:,:)    ! effective u-transport
       vv(:,:,:,Kmm)        = sf_dyn(jf_vwd)%fnow(:,:,:) * vmask(:,:,:)    ! effective v-transport
-      ww(:,:,:)        = sf_dyn(jf_wwd)%fnow(:,:,:) * tmask(:,:,:)    ! effective v-transport
+      ww(:,:,:)            = sf_dyn(jf_wwd)%fnow(:,:,:) * tmask(:,:,:)    ! effective v-transport
       !
       IF( .NOT.ln_linssh ) THEN
@@ -156,5 +157,5 @@
          zhdivtr(:,:,:) = sf_dyn(jf_div)%fnow(:,:,:)  * tmask(:,:,:)    ! effective u-transport
          emp_b  (:,:)   = sf_dyn(jf_empb)%fnow(:,:,1) * tmask(:,:,1)    ! E-P
-         zemp   (:,:)   = ( 0.5_wp * ( emp(:,:) + emp_b(:,:) ) + rnf(:,:) + fwbcorr ) * tmask(:,:,1)
+         zemp   (:,:)   = ( 0.5_wp * ( emp(:,:) + emp_b(:,:) ) + rnf(:,:) ) * tmask(:,:,1)
 #if defined key_qco
          CALL dta_dyn_ssh( kt, zhdivtr, ssh(:,:,Kbb), zemp, ssh(:,:,Kaa) )
@@ -225,7 +226,4 @@
       INTEGER  :: ios                                ! Local integer output status for namelist read
       INTEGER  :: ji, jj, jk
-      REAL(wp) :: zcoef
-      INTEGER  :: nkrnf_max
-      REAL(wp) :: hrnf_max
       !!
       CHARACTER(len=100)            ::  cn_dir        !   Root directory for location of core files
@@ -237,5 +235,5 @@
       TYPE(FLD_N) :: sn_div  ! informations about the fields to be read
       !!
-      NAMELIST/namdta_dyn/cn_dir, ln_dynrnf, ln_dynrnf_depth,  fwbcorr, &
+      NAMELIST/namdta_dyn/cn_dir, ln_dynrnf, ln_dynrnf_depth, &
          &                sn_uwd, sn_vwd, sn_wwd, sn_emp,               &
          &                sn_avt, sn_tem, sn_sal, sn_mld , sn_qsr ,     &
@@ -259,5 +257,4 @@
          WRITE(numout,*) '      runoffs option enabled (T) or not (F)            ln_dynrnf        = ', ln_dynrnf
          WRITE(numout,*) '      runoffs is spread in vertical                    ln_dynrnf_depth  = ', ln_dynrnf_depth
-         WRITE(numout,*) '      annual global mean of empmr for ssh correction   fwbcorr          = ', fwbcorr
          WRITE(numout,*)
       ENDIF
@@ -355,42 +352,147 @@
         DO jk = 1, jpkm1
            e3t(:,:,jk,Kmm) = e3t_0(:,:,jk) * ( 1._wp + ssh(:,:,Kmm) * r1_ht_0(:,:) * tmask(:,:,jk) )
+           e3t(:,:,jk,Kbb) = e3t_0(:,:,jk) * ( 1._wp + ssh(:,:,Kbb) * r1_ht_0(:,:) * tmask(:,:,jk) )
         ENDDO
-        e3t(:,:,jpk,Kaa) = e3t_0(:,:,jpk)
-
-        ! Horizontal scale factor interpolations
-        ! --------------------------------------
-        CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' )
-        CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' )
-
-        ! Vertical scale factor interpolations
-        ! ------------------------------------
-        CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w(:,:,:,Kmm), 'W' )
-!!gm this should be computed from ssh(Kbb)  
-        e3t(:,:,:,Kbb)  = e3t(:,:,:,Kmm)
-        e3u(:,:,:,Kbb)  = e3u(:,:,:,Kmm)
-        e3v(:,:,:,Kbb)  = e3v(:,:,:,Kmm)
-
-        ! t- and w- points depth
-        ! ----------------------
-        gdept(:,:,1,Kmm) = 0.5_wp * e3w(:,:,1,Kmm)
-        gdepw(:,:,1,Kmm) = 0.0_wp
-
-        DO_3D( 1, 1, 1, 1, 2, jpk )
-          !    zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))   ! 0 everywhere
-          !    tmask = wmask, ie everywhere expect at jk = mikt
-                                                             ! 1 for jk =
-                                                             ! mikt
-           zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))
-           gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
-           gdept(ji,jj,jk,Kmm) =      zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm))  &
-               &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) + e3w(ji,jj,jk,Kmm))
-        END_3D
-
-        gdept(:,:,:,Kbb) = gdept(:,:,:,Kmm)
-        gdepw(:,:,:,Kbb) = gdepw(:,:,:,Kmm)
-        !
+
+        CALL dta_dyn_sf_interp( kt, Kmm )
+        CALL dta_dyn_sf_interp( kt, Kbb )
 #endif
       ENDIF
       !
+      CALL dta_dyn_rnf_init( Kmm )
+      !
+      CALL dta_dyn( nit000, Kbb, Kmm, Kaa )
+      !
+   END SUBROUTINE dta_dyn_init
+
+   SUBROUTINE dta_dyn_atf( kt, Kbb, Kmm, Kaa )
+     !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE dta_dyn_swp  ***
+      !!
+      !! ** Purpose :   Asselin time filter of now SSH
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt             ! time step
+      INTEGER, INTENT(in) :: Kbb, Kmm, Kaa  ! ocean time level indices
+      !
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'dta_dyn_atf : Asselin time filter of sea surface height'
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ '
+      ENDIF
+
+      ssh(:,:,Kmm) = ssh(:,:,Kmm) + rn_atfp * ( ssh(:,:,Kbb) - 2 * ssh(:,:,Kmm) + ssh(:,:,Kaa))  
+
+      !
+   END SUBROUTINE dta_dyn_atf
+   
+   
+#if ! defined key_qco  
+
+   SUBROUTINE dta_dyn_sf_interp( kt, Kmm )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE dta_dyn_sf_interp  ***
+      !!
+      !! ** Purpose :   Calculate scale factors at U/V/W points and depths
+      !!                given the after e3t field
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt   ! time step
+      INTEGER, INTENT(in) :: Kmm  ! ocean time level indices
+      !
+      INTEGER             :: ji, jj, jk
+      REAL(wp)            :: zcoef
+      !!---------------------------------------------------------------------
+
+      ! Horizontal scale factor interpolations
+      ! --------------------------------------
+      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' )
+      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' )
+
+      ! Vertical scale factor interpolations
+      ! ------------------------------------
+      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w (:,:,:,Kmm), 'W' )
+
+      ! t- and w- points depth
+      ! ----------------------
+      gdept(:,:,1,Kmm) = 0.5_wp * e3w(:,:,1,Kmm)
+      gdepw(:,:,1,Kmm) = 0.0_wp
+      !
+      DO_3D( 1, 1, 1, 1, 2, jpk )
+         zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))
+         gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
+         gdept(ji,jj,jk,Kmm) =      zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm))  &
+            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) + e3w(ji,jj,jk,Kmm))
+      END_3D
+      !
+   END SUBROUTINE dta_dyn_sf_interp
+
+#endif
+
+   SUBROUTINE dta_dyn_ssh( kt, phdivtr, psshb,  pemp, pssha, pe3ta )
+      !!----------------------------------------------------------------------
+      !!                ***  ROUTINE dta_dyn_wzv  ***
+      !!                   
+      !! ** Purpose :   compute the after ssh (ssh(:,:,Kaa)) and the now vertical velocity
+      !!
+      !! ** Method  : Using the incompressibility hypothesis, 
+      !!        - the ssh increment is computed by integrating the horizontal divergence 
+      !!          and multiply by the time step.
+      !!
+      !!        - compute the after scale factor : repartition of ssh INCREMENT proportionnaly
+      !!                                           to the level thickness ( z-star case )
+      !!
+      !!        - the vertical velocity is computed by integrating the horizontal divergence  
+      !!          from the bottom to the surface minus the scale factor evolution.
+      !!          The boundary conditions are w=0 at the bottom (no flux)
+      !!
+      !! ** action  :   ssh(:,:,Kaa) / e3t(:,:,k,Kaa) / ww
+      !!
+      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
+      !!----------------------------------------------------------------------
+      INTEGER,                                   INTENT(in )    :: kt        !  time-step
+      REAL(wp), DIMENSION(jpi,jpj,jpk)          , INTENT(in )   :: phdivtr   ! horizontal divergence transport
+      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(in )   :: psshb     ! now ssh
+      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(in )   :: pemp      ! evaporation minus precipitation
+      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(inout) :: pssha     ! after ssh
+      REAL(wp), DIMENSION(jpi,jpj,jpk), OPTIONAL, INTENT(out)   :: pe3ta     ! after vertical scale factor
+      !
+      INTEGER                       :: jk
+      REAL(wp), DIMENSION(jpi,jpj)  :: zhdiv  
+      REAL(wp)  :: z2dt  
+      !!----------------------------------------------------------------------
+      !
+      z2dt = 2._wp * rn_Dt
+      !
+      zhdiv(:,:) = 0._wp
+      DO jk = 1, jpkm1
+         zhdiv(:,:) = zhdiv(:,:) +  phdivtr(:,:,jk) * tmask(:,:,jk)
+      END DO
+      !                                                ! Sea surface  elevation time-stepping
+      pssha(:,:) = ( psshb(:,:) - z2dt * ( r1_rho0 * pemp(:,:)  + zhdiv(:,:) ) ) * ssmask(:,:)
+      !
+      IF( PRESENT( pe3ta ) ) THEN                      ! After acale factors at t-points ( z_star coordinate )
+      DO jk = 1, jpkm1
+            pe3ta(:,:,jk) = e3t_0(:,:,jk) * ( 1._wp + pssha(:,:) * r1_ht_0(:,:) * tmask(:,:,jk) )
+      END DO
+      ENDIF
+      !
+   END SUBROUTINE dta_dyn_ssh
+
+   SUBROUTINE dta_dyn_rnf_init( Kmm )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dta_dyn_rnf_init  ***
+      !!
+      !! ** Purpose :   Initialisation of the runoffs if (ln_rnf=T)
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) :: Kmm  ! ocean time level indices
+      !
+      INTEGER  :: inum                   ! local integer
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcoef
+      INTEGER  :: nkrnf_max
+      REAL(wp) :: hrnf_max
+
       IF( ln_dynrnf .AND. ln_dynrnf_depth ) THEN       ! read depht over which runoffs are distributed
          IF(lwp) WRITE(numout,*) 
@@ -435,252 +537,12 @@
       IF(lwp) WRITE(numout,*) ' '
       !
-      CALL dta_dyn( nit000, Kbb, Kmm, Kaa )
-      !
-   END SUBROUTINE dta_dyn_init
-
-   
-   SUBROUTINE dta_dyn_sed( kt, Kmm )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_dyn  ***
-      !!
-      !! ** Purpose :  Prepares dynamics and physics fields from a NEMO run
-      !!               for an off-line simulation of passive tracers
-      !!
-      !! ** Method : calculates the position of data
-      !!             - computes slopes if needed
-      !!             - interpolates data if needed
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      INTEGER, INTENT(in) ::   Kmm  ! ocean time level index
-      !
-      !!----------------------------------------------------------------------
-      !
-      IF( ln_timing )   CALL timing_start( 'dta_dyn_sed')
-      !
-      nsecdyn = nsec_year + nsec1jan000   ! number of seconds between Jan. 1st 00h of nit000 year and the middle of time step
-      !
-      IF( kt == nit000 ) THEN    ;    nprevrec = 0
-      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa)
-      ENDIF
-      CALL fld_read( kt, 1, sf_dyn )      !=  read data at kt time step   ==!
-      !
-      ts(:,:,:,jp_tem,Kmm) = sf_dyn(jf_tem)%fnow(:,:,:)  * tmask(:,:,:)    ! temperature
-      ts(:,:,:,jp_sal,Kmm) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
-      !
-      CALL eos    ( ts(:,:,:,:,Kmm), rhd, rhop, gdept_0(:,:,:) ) ! In any case, we need rhop
-
-      IF(sn_cfctl%l_prtctl) THEN                     ! print control
-         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' tn      - : ', mask1=tmask,  kdim=jpk   )
-         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_sal,Kmm), clinfo1=' sn      - : ', mask1=tmask,  kdim=jpk   )
-      ENDIF
-      !
-      IF( ln_timing )   CALL timing_stop( 'dta_dyn_sed')
-      !
-   END SUBROUTINE dta_dyn_sed
-
-
-   SUBROUTINE dta_dyn_sed_init( Kmm )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_dyn_init  ***
-      !!
-      !! ** Purpose :   Initialisation of the dynamical data
-      !! ** Method  : - read the data namdta_dyn namelist
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT( in ) :: Kmm                   ! ocean time level index
-      !
-      INTEGER  :: ierr, ierr0, ierr1, ierr2, ierr3   ! return error code
-      INTEGER  :: ifpr                               ! dummy loop indice
-      INTEGER  :: jfld                               ! dummy loop arguments
-      INTEGER  :: inum, idv, idimv                   ! local integer
-      INTEGER  :: ios                                ! Local integer output status for namelist read
-      !!
-      CHARACTER(len=100)            ::  cn_dir        !   Root directory for location of core files
-      TYPE(FLD_N), DIMENSION(2) ::  slf_d         ! array of namelist informations on the fields to read
-      TYPE(FLD_N) :: sn_tem , sn_sal   !   "                 "
-      !!
-      NAMELIST/namdta_dyn/cn_dir, ln_dynrnf, ln_dynrnf_depth,  fwbcorr, &
-         &                sn_tem, sn_sal
-      !!----------------------------------------------------------------------
-      !
-      READ  ( numnam_ref, namdta_dyn, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdta_dyn in reference namelist' )
-      READ  ( numnam_cfg, namdta_dyn, IOSTAT = ios, ERR = 902 )
-902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdta_dyn in configuration namelist' )
-      IF(lwm) WRITE ( numond, namdta_dyn )
-      !                                         ! store namelist information in an array
-      !                                         ! Control print
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'dta_dyn : offline dynamics '
-         WRITE(numout,*) '~~~~~~~ '
-         WRITE(numout,*) '   Namelist namdta_dyn'
-         WRITE(numout,*) '      runoffs option enabled (T) or not (F)            ln_dynrnf        = ', ln_dynrnf
-         WRITE(numout,*) '      runoffs is spread in vertical                    ln_dynrnf_depth  = ', ln_dynrnf_depth
-         WRITE(numout,*) '      annual global mean of empmr for ssh correction   fwbcorr          = ', fwbcorr
-         WRITE(numout,*)
-      ENDIF
-      !
-      jf_tem  = 1     ;   jf_sal  = 2    ;   jfld   = jf_sal
-      !
-      slf_d(jf_tem)  = sn_tem    ;   slf_d(jf_sal)  = sn_sal
-      !
-      ALLOCATE( sf_dyn(jfld), STAT=ierr )         ! set sf structure
-      IF( ierr > 0 )  THEN
-         CALL ctl_stop( 'dta_dyn: unable to allocate sf structure' )   ;   RETURN
-      ENDIF
-      !                                         ! fill sf with slf_i and control print
-      CALL fld_fill( sf_dyn, slf_d, cn_dir, 'dta_dyn_init', 'Data in file', 'namdta_dyn' )
-      !
-      ! Open file for each variable to get his number of dimension
-      DO ifpr = 1, jfld
-         CALL fld_def( sf_dyn(ifpr) )
-         CALL iom_open( sf_dyn(ifpr)%clname, sf_dyn(ifpr)%num )
-         idv   = iom_varid( sf_dyn(ifpr)%num , slf_d(ifpr)%clvar )        ! id of the variable sdjf%clvar
-         idimv = iom_file ( sf_dyn(ifpr)%num )%ndims(idv)                 ! number of dimension for variable sdjf%clvar
-         CALL iom_close( sf_dyn(ifpr)%num )                               ! close file if already open
-         ierr1=0
-         IF( idimv == 3 ) THEN    ! 2D variable
-                                      ALLOCATE( sf_dyn(ifpr)%fnow(jpi,jpj,1)    , STAT=ierr0 )
-            IF( slf_d(ifpr)%ln_tint ) ALLOCATE( sf_dyn(ifpr)%fdta(jpi,jpj,1,2)  , STAT=ierr1 )
-         ELSE                     ! 3D variable
-                                      ALLOCATE( sf_dyn(ifpr)%fnow(jpi,jpj,jpk)  , STAT=ierr0 )
-            IF( slf_d(ifpr)%ln_tint ) ALLOCATE( sf_dyn(ifpr)%fdta(jpi,jpj,jpk,2), STAT=ierr1 )
-         ENDIF
-         IF( ierr0 + ierr1 > 0 ) THEN
-            CALL ctl_stop( 'dta_dyn_init : unable to allocate sf_dyn array structure' )   ;   RETURN
-         ENDIF
-      END DO
-      !
-      CALL dta_dyn_sed( nit000, Kmm )
-      !
-   END SUBROUTINE dta_dyn_sed_init
-
-   
-   SUBROUTINE dta_dyn_atf( kt, Kbb, Kmm, Kaa )
-     !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE dta_dyn_swp  ***
-      !!
-      !! ** Purpose :   Asselin time filter of now SSH
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) :: kt             ! time step
-      INTEGER, INTENT(in) :: Kbb, Kmm, Kaa  ! ocean time level indices
-      !
-      !!---------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dta_dyn_atf : Asselin time filter of sea surface height'
-         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ '
-      ENDIF
-
-      ssh(:,:,Kmm) = ssh(:,:,Kmm) + rn_atfp * ( ssh(:,:,Kbb) - 2 * ssh(:,:,Kmm) + ssh(:,:,Kaa))  
-
-      !! Do we also need to time filter e3t??
-      !
-   END SUBROUTINE dta_dyn_atf
-   
-   
-#if ! defined key_qco    
-   SUBROUTINE dta_dyn_sf_interp( kt, Kmm )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE dta_dyn_sf_interp  ***
-      !!
-      !! ** Purpose :   Calculate scale factors at U/V/W points and depths
-      !!                given the after e3t field
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) :: kt   ! time step
-      INTEGER, INTENT(in) :: Kmm  ! ocean time level indices
-      !
-      INTEGER             :: ji, jj, jk
-      REAL(wp)            :: zcoef
-      !!---------------------------------------------------------------------
-
-      ! Horizontal scale factor interpolations
-      ! --------------------------------------
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' )
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' )
-
-      ! Vertical scale factor interpolations
-      ! ------------------------------------
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w (:,:,:,Kmm), 'W' )
-
-      ! t- and w- points depth
-      ! ----------------------
-      gdept(:,:,1,Kmm) = 0.5_wp * e3w(:,:,1,Kmm)
-      gdepw(:,:,1,Kmm) = 0.0_wp
-      !
-      DO_3D( 1, 1, 1, 1, 2, jpk )
-         zcoef = (tmask(ji,jj,jk) - wmask(ji,jj,jk))
-         gdepw(ji,jj,jk,Kmm) = gdepw(ji,jj,jk-1,Kmm) + e3t(ji,jj,jk-1,Kmm)
-         gdept(ji,jj,jk,Kmm) =      zcoef  * ( gdepw(ji,jj,jk  ,Kmm) + 0.5 * e3w(ji,jj,jk,Kmm))  &
-            &                + (1-zcoef) * ( gdept(ji,jj,jk-1,Kmm) + e3w(ji,jj,jk,Kmm))
-      END_3D
-      !
-   END SUBROUTINE dta_dyn_sf_interp
-#endif
-
-
-   SUBROUTINE dta_dyn_ssh( kt, phdivtr, psshb,  pemp, pssha, pe3ta )
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE dta_dyn_wzv  ***
-      !!                   
-      !! ** Purpose :   compute the after ssh (ssh(:,:,Kaa)) and the now vertical velocity
-      !!
-      !! ** Method  : Using the incompressibility hypothesis, 
-      !!        - the ssh increment is computed by integrating the horizontal divergence 
-      !!          and multiply by the time step.
-      !!
-      !!        - compute the after scale factor : repartition of ssh INCREMENT proportionnaly
-      !!                                           to the level thickness ( z-star case )
-      !!
-      !!        - the vertical velocity is computed by integrating the horizontal divergence  
-      !!          from the bottom to the surface minus the scale factor evolution.
-      !!          The boundary conditions are w=0 at the bottom (no flux)
-      !!
-      !! ** action  :   ssh(:,:,Kaa) / e3t(:,:,k,Kaa) / ww
-      !!
-      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
-      !!----------------------------------------------------------------------
-      INTEGER,                                   INTENT(in )    :: kt        !  time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk)          , INTENT(in )   :: phdivtr   ! horizontal divergence transport
-      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(in )   :: psshb     ! now ssh
-      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(in )   :: pemp      ! evaporation minus precipitation
-      REAL(wp), DIMENSION(jpi,jpj)    , OPTIONAL, INTENT(inout) :: pssha     ! after ssh
-      REAL(wp), DIMENSION(jpi,jpj,jpk), OPTIONAL, INTENT(out)   :: pe3ta     ! after vertical scale factor
-      !
-      INTEGER                       :: jk
-      REAL(wp), DIMENSION(jpi,jpj)  :: zhdiv  
-      REAL(wp)  :: z2dt  
-      !!----------------------------------------------------------------------
-      !
-      z2dt = 2._wp * rn_Dt
-      !
-      zhdiv(:,:) = 0._wp
-      DO jk = 1, jpkm1
-         zhdiv(:,:) = zhdiv(:,:) +  phdivtr(:,:,jk) * tmask(:,:,jk)
-      END DO
-      !                                                ! Sea surface  elevation time-stepping
-      pssha(:,:) = ( psshb(:,:) - z2dt * ( r1_rho0 * pemp(:,:)  + zhdiv(:,:) ) ) * ssmask(:,:)
-      !
-      IF( PRESENT( pe3ta ) ) THEN                      ! After acale factors at t-points ( z_star coordinate )
-      DO jk = 1, jpkm1
-            pe3ta(:,:,jk) = e3t_0(:,:,jk) * ( 1._wp + pssha(:,:) * r1_ht_0(:,:) * tmask(:,:,jk) )
-      END DO
-      ENDIF
-      !
-   END SUBROUTINE dta_dyn_ssh
-
-
-   SUBROUTINE dta_dyn_hrnf( Kmm )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE sbc_rnf  ***
+   END SUBROUTINE dta_dyn_rnf_init
+
+   SUBROUTINE dta_dyn_rnf( Kmm )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dta_dyn_rnf  ***
       !!
       !! ** Purpose :   update the horizontal divergence with the runoff inflow
       !!
-      !! ** Method  :
-      !!                CAUTION : rnf is positive (inflow) decreasing the
-      !!                          divergence and expressed in m/s
-      !!
-      !! ** Action  :   phdivn   decreased by the runoff inflow
       !!----------------------------------------------------------------------
       !!
@@ -697,7 +559,5 @@
       END_2D
       !
-   END SUBROUTINE dta_dyn_hrnf
-
-
+   END SUBROUTINE dta_dyn_rnf
 
    SUBROUTINE dta_dyn_slp( kt, Kbb, Kmm )
@@ -790,5 +650,4 @@
    END SUBROUTINE dta_dyn_slp
 
-
    SUBROUTINE compute_slopes( kt, pts, puslp, pvslp, pwslpi, pwslpj, Kbb, Kmm )
       !!---------------------------------------------------------------------
@@ -835,4 +694,121 @@
    END SUBROUTINE compute_slopes
 
+#if defined key_sed_off
+
+   SUBROUTINE dta_dyn_sed( kt, Kmm )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dta_dyn  ***
+      !!
+      !! ** Purpose :  Prepares dynamics and physics fields from a NEMO run
+      !!               for an off-line simulation of passive tracers
+      !!
+      !! ** Method : calculates the position of data
+      !!             - computes slopes if needed
+      !!             - interpolates data if needed
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
+      INTEGER, INTENT(in) ::   Kmm  ! ocean time level index
+      !
+      !!----------------------------------------------------------------------
+      !
+      IF( ln_timing )   CALL timing_start( 'dta_dyn_sed')
+      !
+      nsecdyn = nsec_year + nsec1jan000   ! number of seconds between Jan. 1st 00h of nit000 year and the middle of time step
+      !
+      IF( kt == nit000 ) THEN    ;    nprevrec = 0
+      ELSE                       ;    nprevrec = sf_dyn(jf_tem)%nrec(2,sf_dyn(jf_tem)%naa)
+      ENDIF
+      CALL fld_read( kt, 1, sf_dyn )      !=  read data at kt time step   ==!
+      !
+      ts(:,:,:,jp_tem,Kmm) = sf_dyn(jf_tem)%fnow(:,:,:)  * tmask(:,:,:)    ! temperature
+      ts(:,:,:,jp_sal,Kmm) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
+      !
+      CALL eos    ( ts(:,:,:,:,Kmm), rhd, rhop, gdept_0(:,:,:) ) ! In any case, we need rhop
+
+      IF(sn_cfctl%l_prtctl) THEN                     ! print control
+         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' tn      - : ', mask1=tmask,  kdim=jpk   )
+         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_sal,Kmm), clinfo1=' sn      - : ', mask1=tmask,  kdim=jpk   )
+      ENDIF
+      !
+      IF( ln_timing )   CALL timing_stop( 'dta_dyn_sed')
+      !
+   END SUBROUTINE dta_dyn_sed
+
+
+   SUBROUTINE dta_dyn_sed_init( Kmm )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE dta_dyn_init  ***
+      !!
+      !! ** Purpose :   Initialisation of the dynamical data
+      !! ** Method  : - read the data namdta_dyn namelist
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) :: Kmm                   ! ocean time level index
+      !
+      INTEGER  :: ierr, ierr0, ierr1, ierr2, ierr3   ! return error code
+      INTEGER  :: ifpr                               ! dummy loop indice
+      INTEGER  :: jfld                               ! dummy loop arguments
+      INTEGER  :: inum, idv, idimv                   ! local integer
+      INTEGER  :: ios                                ! Local integer output status for namelist read
+      !!
+      CHARACTER(len=100)            ::  cn_dir        !   Root directory for location of core files
+      TYPE(FLD_N), DIMENSION(2) ::  slf_d         ! array of namelist informations on the fields to read
+      TYPE(FLD_N) :: sn_tem , sn_sal   !   "                 "
+      !!
+      NAMELIST/namdta_dyn/cn_dir, ln_dynrnf, ln_dynrnf_depth,  &
+         &                sn_tem, sn_sal
+      !!----------------------------------------------------------------------
+      !
+      READ  ( numnam_ref, namdta_dyn, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdta_dyn in reference namelist' )
+      READ  ( numnam_cfg, namdta_dyn, IOSTAT = ios, ERR = 902 )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namdta_dyn in configuration namelist' )
+      IF(lwm) WRITE ( numond, namdta_dyn )
+      !                                         ! store namelist information in an array
+      !                                         ! Control print
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'dta_dyn : offline dynamics '
+         WRITE(numout,*) '~~~~~~~ '
+         WRITE(numout,*) '   Namelist namdta_dyn'
+         WRITE(numout,*) '      runoffs option enabled (T) or not (F)            ln_dynrnf        = ', ln_dynrnf
+         WRITE(numout,*) '      runoffs is spread in vertical                    ln_dynrnf_depth  = ', ln_dynrnf_depth
+         WRITE(numout,*)
+      ENDIF
+      !
+      jf_tem  = 1     ;   jf_sal  = 2    ;   jfld   = jf_sal
+      !
+      slf_d(jf_tem)  = sn_tem    ;   slf_d(jf_sal)  = sn_sal
+      !
+      ALLOCATE( sf_dyn(jfld), STAT=ierr )         ! set sf structure
+      IF( ierr > 0 )  THEN
+         CALL ctl_stop( 'dta_dyn: unable to allocate sf structure' )   ;   RETURN
+      ENDIF
+      !                                         ! fill sf with slf_i and control print
+      CALL fld_fill( sf_dyn, slf_d, cn_dir, 'dta_dyn_init', 'Data in file', 'namdta_dyn' )
+      !
+      ! Open file for each variable to get his number of dimension
+      DO ifpr = 1, jfld
+         CALL fld_def( sf_dyn(ifpr) )
+         CALL iom_open( sf_dyn(ifpr)%clname, sf_dyn(ifpr)%num )
+         idv   = iom_varid( sf_dyn(ifpr)%num , slf_d(ifpr)%clvar )        ! id of the variable sdjf%clvar
+         idimv = iom_file ( sf_dyn(ifpr)%num )%ndims(idv)                 ! number of dimension for variable sdjf%clvar
+         CALL iom_close( sf_dyn(ifpr)%num )                               ! close file if already open
+         ierr1=0
+         IF( idimv == 3 ) THEN    ! 2D variable
+                                      ALLOCATE( sf_dyn(ifpr)%fnow(jpi,jpj,1)    , STAT=ierr0 )
+            IF( slf_d(ifpr)%ln_tint ) ALLOCATE( sf_dyn(ifpr)%fdta(jpi,jpj,1,2)  , STAT=ierr1 )
+         ELSE                     ! 3D variable
+                                      ALLOCATE( sf_dyn(ifpr)%fnow(jpi,jpj,jpk)  , STAT=ierr0 )
+            IF( slf_d(ifpr)%ln_tint ) ALLOCATE( sf_dyn(ifpr)%fdta(jpi,jpj,jpk,2), STAT=ierr1 )
+         ENDIF
+         IF( ierr0 + ierr1 > 0 ) THEN
+            CALL ctl_stop( 'dta_dyn_init : unable to allocate sf_dyn array structure' )   ;   RETURN
+         ENDIF
+      END DO
+      !
+      CALL dta_dyn_sed( nit000, Kmm )
+      !
+   END SUBROUTINE dta_dyn_sed_init
+#endif
    !!======================================================================
 END MODULE dtadyn
Index: /NEMO/trunk/src/OFF/nemogcm.F90
===================================================================
--- /NEMO/trunk/src/OFF/nemogcm.F90	(revision 14254)
+++ /NEMO/trunk/src/OFF/nemogcm.F90	(revision 14255)
@@ -138,10 +138,6 @@
          IF( istp /= nit000 )   CALL day        ( istp )         ! Calendar (day was already called at nit000 in day_init)
                                 CALL iom_setkt  ( istp - nit000 + 1, cxios_context )   ! say to iom that we are at time step kstp
-#if defined key_sed_off
-                                CALL dta_dyn_sed( istp,      Nnn      )       ! Interpolation of the dynamical fields
-#else
+#if ! defined key_sed_off
                                 CALL dta_dyn    ( istp, Nbb, Nnn, Naa )       ! Interpolation of the dynamical fields
-#endif
-#if ! defined key_sed_off
          IF( .NOT.ln_linssh ) THEN
                                 CALL dta_dyn_atf( istp, Nbb, Nnn, Naa )       ! time filter of sea  surface height and vertical scale factors
@@ -151,21 +147,18 @@
          ENDIF
                                 CALL trc_stp    ( istp, Nbb, Nnn, Nrhs, Naa ) ! time-stepping
-# if defined key_qco
-                                !r3t(:,:,Nnn) = r3t_f(:,:)                     ! update ssh to h0 ratio
-                                !r3u(:,:,Nnn) = r3u_f(:,:)
-                                !r3v(:,:,Nnn) = r3v_f(:,:)
-# endif
-#endif
          ! Swap time levels
          Nrhs = Nbb
-         Nbb = Nnn
-         Nnn = Naa
-         Naa = Nrhs
+         Nbb  = Nnn
+         Nnn  = Naa
+         Naa  = Nrhs
          !
 #if ! defined key_qco
-# if ! defined key_sed_off
          IF( .NOT.ln_linssh )   CALL dta_dyn_sf_interp( istp, Nnn )  ! calculate now grid parameters
-# endif
-#endif         
+#endif  
+
+#else
+                                CALL dta_dyn_sed( istp,      Nnn      )       ! Interpolation of the dynamical fields
+
+#endif
          CALL stp_ctl    ( istp )             ! Time loop: control and print
          istp = istp + 1
Index: /NEMO/trunk/src/TOP/trcwri.F90
===================================================================
--- /NEMO/trunk/src/TOP/trcwri.F90	(revision 14254)
+++ /NEMO/trunk/src/TOP/trcwri.F90	(revision 14255)
@@ -28,4 +28,8 @@
    PUBLIC trc_wri      
 
+   !! * Substitutions
+#  include "do_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
+
 CONTAINS
 
@@ -39,8 +43,9 @@
       INTEGER, INTENT( in )     :: Kmm  ! time level indices
       !
-      INTEGER                   :: jn
+      INTEGER                   :: jk, jn
       CHARACTER (len=20)        :: cltra
       CHARACTER (len=40)        :: clhstnam
       INTEGER ::   inum = 11            ! temporary logical unit
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   z3d   ! 3D workspace
       !!---------------------------------------------------------------------
       !
@@ -53,18 +58,34 @@
            WRITE(inum,*) clhstnam
            CLOSE(inum)
-        ENDIF
+         ENDIF
 
-       ! Output of initial vertical scale factor
-       CALL iom_put( "e3t_0", e3t_0(:,:,:) )
-       CALL iom_put( "e3u_0", e3u_0(:,:,:) )
-       CALL iom_put( "e3v_0", e3v_0(:,:,:) )
-       !
-#if ! defined key_qco
-       CALL iom_put( "e3t" , e3t(:,:,:,Kmm) )
-       CALL iom_put( "e3u" , e3u(:,:,:,Kmm) )
-       CALL iom_put( "e3v" , e3v(:,:,:,Kmm) )
-#endif 
-       !
+         ! Output of initial vertical scale factor
+         CALL iom_put( "e3t_0", e3t_0(:,:,:) )
+         CALL iom_put( "e3u_0", e3u_0(:,:,:) )
+         CALL iom_put( "e3v_0", e3v_0(:,:,:) )
+         !
+         IF( .NOT.ln_linssh )  CALL iom_put( "ssh" , ssh(:,:,Kmm) )              ! sea surface height
+         !
+         IF ( iom_use("e3t") ) THEN  ! time-varying e3t
+            DO jk = 1, jpk
+               z3d(:,:,jk) =  e3t(:,:,jk,Kmm)
+            END DO
+            CALL iom_put( "e3t", z3d(:,:,:) )
+         ENDIF
+         IF ( iom_use("e3u") ) THEN                         ! time-varying e3u
+            DO jk = 1, jpk
+               z3d(:,:,jk) =  e3u(:,:,jk,Kmm)
+            END DO
+            CALL iom_put( "e3u", z3d(:,:,:) )
+         ENDIF
+         IF ( iom_use("e3v") ) THEN                         ! time-varying e3v
+            DO jk = 1, jpk
+               z3d(:,:,jk) =  e3v(:,:,jk,Kmm)
+            END DO
+            CALL iom_put( "e3v", z3d(:,:,:) )
+         ENDIF
+         !
       ENDIF
+      !
       ! write the tracer concentrations in the file
       ! ---------------------------------------
