Index: /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM/IGCM00/COMP/opa9.driver
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM/IGCM00/COMP/opa9.driver	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM/IGCM00/COMP/opa9.driver	(revision 1970)
@@ -49,5 +49,5 @@
     (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
 
-    # Definition from opa9.card of List_jobsbc used to do to interannual and climatological runs 
+    # Definition from opa9.card of List_jobsbc and List_runsbc used to do to interannual and climatological runs 
 	IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/COMP/opa9.card Interannual List_jobsbc
         set -A ListFormulationJobsbc -- \${opa9_Interannual_Listjobsc${opa9_Interannual_List_jobsbc}[*]}
@@ -71,21 +71,20 @@
 	typeset file 
 
-	(( final_year =${InitYear} + ${PeriodLengthInYears} - 1 ))
+ 	(( PeriodCumulPeriod =  ${CumulPeriod} - 1 )) 
+ 	(( PeriodInitYear =${InitYear} + ${PeriodCumulPeriod} * ${PeriodLengthInYears} ))
+ 	(( PeriodFinalYear =${InitYear} + ${PeriodLengthInYears}*${CumulPeriod} - 1 ))
+
         NbFileInter=${#opa9_Interannual_List_jobsbc[*]}
-
         (( NbFileInter_tot=${#opa9_Interannual_List_jobsbc[*]} * ${PeriodLengthInYears} ))
-
 	(( i = 0 ))
 
-	while [ ${year} -le ${final_year} ] ; do #copy in ONCE of ALL necessary files for all PeriodLength
+	while [ ${year} -le ${PeriodFinalYear} ] ; do #copy in ONCE of ALL necessary files for all PeriodLength
 	    
 	    while [ $i -lt ${NbFileInter} ] ; do
 		
 		eval file=${opa9_Interannual_List_jobsbc[$i]}
-		# download (year-1) if it is first year and first month of run
-		if [ X${year} = X${InitYear} ] ; then  
-		    	if [ X${Period} = X1 ] ; then
+		if [ X${year} = X${PeriodInitYear} ] ; then  
                         	if [ ${month} -eq 01 ] ; then
-		    			# if year-1 does not exist create a dummy file (NEMO will use same year)
+		    			# if year-1 does not exist we copy year in (year-1)
 		    			eval jobsbc_file_ym1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_$(( year - 1 )).nc
 		    			if  [ ! -f ${jobsbc_file_ym1} ] ; then
@@ -97,7 +96,6 @@
 		    			fi
 
-                            	IGCM_sys_Get ${jobsbc_file_ym1} ${runsbc_file_ym1}
+                            IGCM_sys_Get ${jobsbc_file_ym1} ${runsbc_file_ym1}
                         	fi
-                    fi
 		fi
 		
@@ -111,5 +109,5 @@
 		
 		# download (year+1) if it is last year of run
-		if [ X${year} = X${final_year} ] ; then 	
+		if [ X${year} = X${PeriodFinalYear} ] ; then 	
 	
 		    eval jobsbc_file_yp1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_$(( year + 1 )).nc
@@ -118,11 +116,11 @@
 		    if  [ ! -f ${runsbc_file_yp1} ] ; then
 			
-		        # if year+1 does not exist create a dummy file (NEMO will use same year)
+		        # if year+1 does not exist we copy year in (year+1)
 			if  [ ! -f ${jobsbc_file_yp1} ] ; then
-			    eval jobsbc_file_ym1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_${year}.nc
-		    	    eval runsbc_file_ym1=${file}_noy.nc
+			    eval jobsbc_file_yp1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_${year}.nc
+		    	    eval runsbc_file_yp1=${file}_noy.nc
 			else
-			    eval jobsbc_file_ym1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_$(( year + 1 )).nc
-			    eval runsbc_file_ym1=${file}_y$(( year + 1 )).nc
+			    eval jobsbc_file_yp1=${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/${file}_$(( year + 1 )).nc
+			    eval runsbc_file_yp1=${file}_y$(( year + 1 )).nc
 			fi
 			IGCM_sys_Get ${jobsbc_file_yp1} ${runsbc_file_yp1}
@@ -138,4 +136,5 @@
 	    (( i = 0 ))
 	done
+
     # End interannual
     elif [ X${opa9_UserChoices_Interannual_Run} = Xn ] ; then
Index: /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 1970)
@@ -245,16 +245,13 @@
        <field id="PFeN"        description="Primary production of nano iron"          unit="mol-Fe/m3/s"  axis_ref="deptht" />
        <field id="PFeD"        description="Primary production of diatoms iron"       unit="mol-Fe/m3/s"  axis_ref="deptht" />
-       <field id="Pcal"        description="Calcite production"                       unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Dcal"        description="Calcite dissolution"                      unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Graz"        description="Grazing by microzoo"                      unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Graz2"       description="Grazing by mesozoo"                       unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation"                        unit="mol-N/m2/s"   axis_ref="deptht" />
-       <field id="ExpPOC"      description="POC export"                               unit="mol-C/m2/s"   axis_ref="deptht" />
-       <field id="ExpGOC"      description="GOC export"                               unit="mol-C/m2/s"   axis_ref="deptht" />
-       <field id="ExpFe1"      description="Nano iron export"                         unit="mol-Fe/m2/s"  axis_ref="deptht" />
-       <field id="ExpFe2"      description="Diatoms iron export"                      unit="mol-Fe/m2/s"  axis_ref="deptht" />
-       <field id="ExpSi"       description="Silicate export"                          unit="mol-Si/m2/s"  axis_ref="deptht" />
-       <field id="Expcal"      description="Calcite export"                           unit="mol-C/m2/s"   axis_ref="deptht" />
-       <field id="Cflx"        description="DIC flux"                                 unit="mol-C/m2/s" />
+       <field id="PCAL"        description="Calcite production"                       unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="DCAL"        description="Calcite dissolution"                      unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="GRAZ"        description="Grazing by zooplankton"                   unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="mol-N/m2/s"      />
+       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="mol-C/m2/s"      />
+       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="mol-Fe/m2/s"     />
+       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="mol-Si/m2/s"     />
+       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="mol-C/m2/s"      />
+       <field id="Cflx"        description="DIC flux"                                 unit="mol-C/m2/s"      />
        <field id="Oflx"        description="Oxygen flux"                              unit="mol-C/m2/s" />
        <field id="Kg"          description="Gas transfer"                             unit="mol-C/m2/s/uatm" />
@@ -480,15 +477,12 @@
           <field ref="PFeN"     />
           <field ref="PFeD"     />
-          <field ref="Pcal"     />
-          <field ref="Dcal"     />
-          <field ref="Graz"     />
-          <field ref="Graz2"    />
+          <field ref="PCAL"     />
+          <field ref="DCAL"     />
+          <field ref="GRAZ"     />
+          <field ref="EPC100"   />
+          <field ref="EPFE100"  />
+          <field ref="EPSI100"  />
+          <field ref="EPCAL100" />
           <field ref="Cflx"     />
-          <field ref="ExpPOC"   />
-          <field ref="ExpGOC"   />
-          <field ref="ExpFe1"   />
-          <field ref="ExpFe2"   />
-          <field ref="ExpSi"    />
-          <field ref="Expcal"   />
           <field ref="Oflx"     />
           <field ref="Kg"       />
Index: /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 1970)
@@ -58,15 +58,12 @@
        <field id="PFeN"        description="Primary production of nano iron"          unit="mol-Fe/m3/s"  axis_ref="deptht" />
        <field id="PFeD"        description="Primary production of diatoms iron"       unit="mol-Fe/m3/s"  axis_ref="deptht" />
-       <field id="Pcal"        description="Calcite production"                       unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Dcal"        description="Calcite dissolution"                      unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Graz"        description="Grazing by microzoo"                      unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Graz2"       description="Grazing by mesozoo"                       unit="mol-C/m3/s"   axis_ref="deptht" />
-       <field id="Nfix"        description="Nitrogen fixation"                        unit="mol-N/m2/s"   axis_ref="deptht" />
-       <field id="ExpPOC"      description="POC export"                               unit="mol-C/m2/s"   axis_ref="deptht" />
-       <field id="ExpGOC"      description="GOC export"                               unit="mol-C/m2/s"   axis_ref="deptht" />
-       <field id="ExpFe1"      description="Nano iron export"                         unit="mol-Fe/m2/s"  axis_ref="deptht" />
-       <field id="ExpFe2"      description="Diatoms iron export"                      unit="mol-Fe/m2/s"  axis_ref="deptht" />
-       <field id="ExpSi"       description="Silicate export"                          unit="mol-Si/m2/s"  axis_ref="deptht" />
-       <field id="Expcal"      description="Calcite export"                           unit="mol-C/m2/s"   axis_ref="deptht" />
+       <field id="PCAL"        description="Calcite production"                       unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="DCAL"        description="Calcite dissolution"                      unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="GRAZ"        description="Grazing by zooplankton"                   unit="mol-C/m3/s"   axis_ref="deptht" />
+       <field id="Nfix"        description="Nitrogen fixation at surface"             unit="mol-N/m2/s"      />
+       <field id="EPC100"      description="Export of carbon particles at 100 m"      unit="mol-C/m2/s"      />
+       <field id="EPFE100"     description="Export of biogenic iron at 100 m"         unit="mol-Fe/m2/s"     />
+       <field id="EPSI100"     description="Export of Silicate at 100 m"              unit="mol-Si/m2/s"     />
+       <field id="EPCAL100"    description="Export of Calcite at 100 m"               unit="mol-C/m2/s"      />
        <field id="Cflx"        description="DIC flux"                                 unit="mol-C/m2/s" />
        <field id="Oflx"        description="Oxygen flux"                              unit="mol-C/m2/s" />
@@ -177,15 +174,12 @@
           <field ref="PFeN"     />
           <field ref="PFeD"     />
-          <field ref="Pcal"     />
-          <field ref="Dcal"     />
-          <field ref="Graz"     />
-          <field ref="Graz2"    />
+          <field ref="PCAL"     />
+          <field ref="DCAL"     />
+          <field ref="GRAZ"     />
+          <field ref="EPC100"   />
+          <field ref="EPFE100"  />
+          <field ref="EPSI100"  />
+          <field ref="EPCAL100" />
           <field ref="Cflx"     />
-          <field ref="ExpPOC"   />
-          <field ref="ExpGOC"   />
-          <field ref="ExpFe1"   />
-          <field ref="ExpFe2"   />
-          <field ref="ExpSi"    />
-          <field ref="Expcal"   />
           <field ref="Oflx"     />
           <field ref="Kg"       />
Index: /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/EXP00/namelist
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/EXP00/namelist	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/EXP00/namelist	(revision 1970)
@@ -120,5 +120,5 @@
                            !                       =2 combination of 0 and 1 cases             ("key_lim3" only)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle short wave (qsr)
-   ln_rnf      = .true.    !  runoffs (T => fill namsbc_rnf)
+   ln_rnf      = .false.    !  runoffs (T => fill namsbc_rnf)
    ln_ssr      = .true.    !  Sea Surface Restoring on T and/or S (T => fill namsbc_ssr)
    nn_fwb      = 0         !  FreshWater Budget: =0 unchecked 
@@ -170,12 +170,12 @@
 !              !   file name      ! frequency (hours) ! variable   ! time interpol. !  clim   ! 'yearly'/ ! weights  ! rotation !
 !              !                  !  (if <0  months)  !   name     !    (logical)   !  (T/F)  ! 'monthly' ! filename ! pairing  !
-   sn_wndi     = 'u10_1988'       ,       24          , 'u10'      ,    .true.      , .false. ,   'yearly' , ''
-   sn_wndj     = 'v10_1988'       ,       24          , 'v10'      ,    .true.      , .false. ,   'yearly' , ''
-   sn_qsr      = 'radsw_1988'     ,       24          , 'radsw'    ,    .true.      , .false. ,   'yearly' , ''
-   sn_qlw      = 'radlw_1988'     ,       24          , 'radlw'    ,    .true.      , .false. ,   'yearly' , ''
-   sn_tair     = 't2_1988.nc'     ,       24          , 't2'       ,    .true.      , .false. ,   'yearly' , ''
-   sn_humi     = 'q2_1988'        ,       24          , 'q2'       ,    .true.      , .false. ,   'yearly' , ''
-   sn_prec     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .false. ,   'yearly' , ''
-   sn_tdif     = 'taudif_core'    ,       24          , 'taudif'   ,    .true.      , .true.  ,   'yearly'  ,''
+   sn_wndi     = 'u10_1988'       ,       24          , 'u10'      ,    .true.      , .true. ,   'yearly' , ''
+   sn_wndj     = 'v10_1988'       ,       24          , 'v10'      ,    .true.      , .true. ,   'yearly' , ''
+   sn_qsr      = 'radsw_1988'     ,       24          , 'radsw'    ,    .true.      , .true. ,   'yearly' , ''
+   sn_qlw      = 'radlw_1988'     ,       24          , 'radlw'    ,    .true.      , .true. ,   'yearly' , ''
+   sn_tair     = 't2_1988.nc'     ,       24          , 't2'       ,    .true.      , .true. ,   'yearly' , ''
+   sn_humi     = 'q2_1988'        ,       24          , 'q2'       ,    .true.      , .true. ,   'yearly' , ''
+   sn_prec     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
+   sn_snow     = 'precip_1988.nc' ,       -1          , 'precip'   ,    .true.      , .true. ,   'yearly' , ''
 !
    cn_dir      = './'      !  root directory for the location of the bulk files
@@ -223,6 +223,6 @@
  
    cn_dir      = './'      !  root directory for the location of the runoff files
-   ln_traqsr   = .true.    !  Light penetration (T) or not (F)
-   ln_qsr_rgb  = .true.    !  RGB (Red-Green-Blue) light penetration
+   ln_traqsr   = .false.    !  Light penetration (T) or not (F)
+   ln_qsr_rgb  = .false.    !  RGB (Red-Green-Blue) light penetration
    ln_qsr_2bd  = .false.   !  2 bands              light penetration
    ln_qsr_bio  = .false.   !  bio-model light penetration
@@ -366,5 +366,5 @@
 &nambfr        !   bottom friction
 !-----------------------------------------------------------------------
-   nn_bfr      =    3      !  type of bottom friction :   = 0 : no   slip,  = 2 : nonlinear friction
+   nn_bfr      =    2      !  type of bottom friction :   = 0 : no   slip,  = 2 : nonlinear friction
                            !                              = 3 : free slip,  = 1 :    linear friction
    rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case)
Index: /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/scripts/BB_make
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/scripts/BB_make	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/CONFIG/POMME/scripts/BB_make	(revision 1970)
@@ -153,4 +153,5 @@
      key_oasis4 \
      key_obc \
+     key_off_tra \
      key_orca_lev10 \
      key_orca_r025 \
@@ -178,4 +179,5 @@
      key_vvl \
      key_zco \
+     key_zco \
      key_zdfcst \
      key_zdfddm \
@@ -189,7 +191,12 @@
 		$(MODEL_LIB)(lib_cray.o)\
 		$(MODEL_LIB)(lib_print.o)\
+		$(MODEL_LIB)(agrif_oce.o)\
 		$(MODEL_LIB)(agrif_opa_interp.o)\
 		$(MODEL_LIB)(agrif_opa_sponge.o)\
 		$(MODEL_LIB)(agrif_opa_update.o)\
+		$(MODEL_LIB)(agrif_top_interp.o)\
+		$(MODEL_LIB)(agrif_top_sponge.o)\
+		$(MODEL_LIB)(agrif_top_update.o)\
+		$(MODEL_LIB)(agrif_user.o)\
 		$(MODEL_LIB)(albedo.o)\
 		$(MODEL_LIB)(bdy_oce.o)\
@@ -561,10 +568,311 @@
 		@if [ -f $(PREF)$*.L ] ; then mv $(PREF)$*.L $(TMP) ; fi
 
+$(MODEL_LIB)(agrif_oce.o) :	\
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	par_oce.F90 \
+	KEY_CPP \
+	agrif_oce.F90
 $(MODEL_LIB)(agrif_opa_interp.o) :	\
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(lib_print.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	lib_print.f90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(phycst.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	agrif_oce.F90 \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	phycst.F90 \
+	sol_oce.F90 \
+	domzgr_substitute.h90 \
+	vectopt_loop_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
 	agrif_opa_interp.F90
 $(MODEL_LIB)(agrif_opa_sponge.o) :	\
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(lib_print.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	lib_print.f90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	agrif_oce.F90 \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	domzgr_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
 	agrif_opa_sponge.F90
 $(MODEL_LIB)(agrif_opa_update.o) :	\
+	$(MODEL_LIB)(bdy_oce.o) \
+	$(MODEL_LIB)(cla_div.o) \
+	$(MODEL_LIB)(diaar5.o) \
+	$(MODEL_LIB)(divcur.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(domvvl.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(iom.o) \
+	$(MODEL_LIB)(lbclnk.o) \
+	$(MODEL_LIB)(lib_mpp.o) \
+	$(MODEL_LIB)(obc_oce.o) \
+	$(MODEL_LIB)(obc_par.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(phycst.o) \
+	$(MODEL_LIB)(prtctl.o) \
+	$(MODEL_LIB)(restart.o) \
+	$(MODEL_LIB)(sbc_oce.o) \
+	bdy_oce.F90 \
+	cla_div.F90 \
+	diaar5.F90 \
+	divcur.F90 \
+	dom_oce.F90 \
+	domvvl.F90 \
+	in_out_manager.F90 \
+	iom.F90 \
+	lbclnk.F90 \
+	lib_mpp.F90 \
+	obc_oce.F90 \
+	obc_par.F90 \
+	oce.F90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	phycst.F90 \
+	prtctl.F90 \
+	restart.F90 \
+	sbc_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(cla_div.o) \
+	$(MODEL_LIB)(divcur.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(sshwzv.o) \
+	agrif_oce.F90 \
+	cla_div.F90 \
+	divcur.F90 \
+	dom_oce.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	sshwzv.F90 \
+	domzgr_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
 	agrif_opa_update.F90
+$(MODEL_LIB)(agrif_top_interp.o) :	\
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	agrif_oce.F90 \
+	dom_oce.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	sol_oce.F90 \
+	domzgr_substitute.h90 \
+	vectopt_loop_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
+	agrif_top_interp.F90
+$(MODEL_LIB)(agrif_top_sponge.o) :	\
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(lib_print.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	lib_print.f90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	agrif_oce.F90 \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	domzgr_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
+	agrif_top_sponge.F90
+$(MODEL_LIB)(agrif_top_update.o) :	\
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	dom_oce.F90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	agrif_oce.F90 \
+	dom_oce.F90 \
+	oce.F90 \
+	par_oce.F90 \
+	domzgr_substitute.h90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
+	agrif_top_update.F90
+$(MODEL_LIB)(agrif_user.o) :	\
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(bdy_par.o) \
+	$(MODEL_LIB)(bdyini.o) \
+	$(MODEL_LIB)(c1d.o) \
+	$(MODEL_LIB)(cla_div.o) \
+	$(MODEL_LIB)(cpl_oasis3.o) \
+	$(MODEL_LIB)(cpl_oasis4.o) \
+	$(MODEL_LIB)(diaptr.o) \
+	$(MODEL_LIB)(divcur.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(domain.o) \
+	$(MODEL_LIB)(domcfg.o) \
+	$(MODEL_LIB)(dtasal.o) \
+	$(MODEL_LIB)(dtatem.o) \
+	$(MODEL_LIB)(dyncor_c1d.o) \
+	$(MODEL_LIB)(dynhpg.o) \
+	$(MODEL_LIB)(dynspg_oce.o) \
+	$(MODEL_LIB)(eosbn2.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(iom.o) \
+	$(MODEL_LIB)(istate.o) \
+	$(MODEL_LIB)(ldfdyn.o) \
+	$(MODEL_LIB)(ldftra.o) \
+	$(MODEL_LIB)(lib_mpp.o) \
+	$(MODEL_LIB)(lib_print.o) \
+	$(MODEL_LIB)(mppini.o) \
+	$(MODEL_LIB)(obc_par.o) \
+	$(MODEL_LIB)(obcini.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(phycst.o) \
+	$(MODEL_LIB)(prtctl.o) \
+	$(MODEL_LIB)(sbc_oce.o) \
+	$(MODEL_LIB)(sbcmod.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	$(MODEL_LIB)(sshwzv.o) \
+	$(MODEL_LIB)(step.o) \
+	$(MODEL_LIB)(step_c1d.o) \
+	$(MODEL_LIB)(trdmod.o) \
+	$(MODEL_LIB)(trdmod_oce.o) \
+	$(MODEL_LIB)(zdf_oce.o) \
+	$(MODEL_LIB)(zdfini.o) \
+	$(MODEL_LIB)(zdfmxl.o) \
+	agrif_oce.F90 \
+	bdy_par.F90 \
+	bdyini.F90 \
+	c1d.F90 \
+	cla_div.F90 \
+	cpl_oasis3.F90 \
+	cpl_oasis4.F90 \
+	diaptr.F90 \
+	divcur.F90 \
+	dom_oce.F90 \
+	domain.F90 \
+	domcfg.F90 \
+	dtasal.F90 \
+	dtatem.F90 \
+	dyncor_c1d.F90 \
+	dynhpg.F90 \
+	dynspg_oce.F90 \
+	eosbn2.F90 \
+	in_out_manager.F90 \
+	iom.F90 \
+	istate.F90 \
+	ldfdyn.F90 \
+	ldftra.F90 \
+	lib_mpp.F90 \
+	lib_print.f90 \
+	mppini.F90 \
+	obc_par.F90 \
+	obcini.F90 \
+	oce.F90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	phycst.F90 \
+	prtctl.F90 \
+	sbc_oce.F90 \
+	sbcmod.F90 \
+	sol_oce.F90 \
+	sshwzv.F90 \
+	step.F90 \
+	step_c1d.F90 \
+	trdmod.F90 \
+	trdmod_oce.F90 \
+	zdf_oce.F90 \
+	zdfini.F90 \
+	zdfmxl.F90 \
+	$(MODEL_LIB)(agrif_oce.o) \
+	$(MODEL_LIB)(agrif_opa_interp.o) \
+	$(MODEL_LIB)(agrif_opa_sponge.o) \
+	$(MODEL_LIB)(agrif_opa_update.o) \
+	$(MODEL_LIB)(agrif_top_interp.o) \
+	$(MODEL_LIB)(agrif_top_sponge.o) \
+	$(MODEL_LIB)(agrif_top_update.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(obc_par.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(opa.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	$(MODEL_LIB)(tradmp.o) \
+	agrif_oce.F90 \
+	agrif_opa_interp.F90 \
+	agrif_opa_sponge.F90 \
+	agrif_opa_update.F90 \
+	agrif_top_interp.F90 \
+	agrif_top_sponge.F90 \
+	agrif_top_update.F90 \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	obc_par.F90 \
+	oce.F90 \
+	opa.F90 \
+	par_oce.F90 \
+	sol_oce.F90 \
+	tradmp.F90 \
+	$(AGRIF_LIB) \
+	KEY_CPP \
+	agrif_user.F90
 $(MODEL_LIB)(albedo.o) :	\
 	$(MODEL_LIB)(in_out_manager.o) \
@@ -1195,13 +1503,27 @@
 	diaar5.F90
 $(MODEL_LIB)(diadimg.o) :	\
-	$(MODEL_LIB)(lib_print.o) \
-	$(MODEL_LIB)(par_kind.o) \
-	$(MODEL_LIB)(par_oce.o) \
-	lib_print.f90 \
-	par_kind.F90 \
-	par_oce.F90 \
-	$(MODEL_LIB)(dom_oce.o) \
-	$(MODEL_LIB)(in_out_manager.o) \
-	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(iom.o) \
+	$(MODEL_LIB)(lib_print.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(phycst.o) \
+	$(MODEL_LIB)(prtctl.o) \
+	$(MODEL_LIB)(restart.o) \
+	dom_oce.F90 \
+	in_out_manager.F90 \
+	iom.F90 \
+	lib_print.f90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	phycst.F90 \
+	prtctl.F90 \
+	restart.F90 \
+	$(MODEL_LIB)(daymod.o) \
+	$(MODEL_LIB)(dom_oce.o) \
+	$(MODEL_LIB)(in_out_manager.o) \
+	$(MODEL_LIB)(oce.o) \
+	daymod.F90 \
 	dom_oce.F90 \
 	in_out_manager.F90 \
@@ -1358,5 +1680,4 @@
 	phycst.F90 \
 	$(IOIPSL_LIB) \
-	KEY_CPP \
 	dianam.F90
 $(MODEL_LIB)(diaptr.o) :	\
@@ -1419,4 +1740,5 @@
 	diaptr.F90
 $(MODEL_LIB)(diawri.o) :	\
+	$(MODEL_LIB)(daymod.o) \
 	$(MODEL_LIB)(dianam.o) \
 	$(MODEL_LIB)(dom_ice_2.o) \
@@ -1446,4 +1768,5 @@
 	$(MODEL_LIB)(sbcrnf.o) \
 	$(MODEL_LIB)(zdf_oce.o) \
+	daymod.F90 \
 	dianam.F90 \
 	dom_ice_2.F90 \
@@ -2845,7 +3168,10 @@
 	dynldf_lap.F90
 $(MODEL_LIB)(dynnxt.o) :	\
+	$(MODEL_LIB)(agrif_oce.o) \
 	$(MODEL_LIB)(bdy_oce.o) \
 	$(MODEL_LIB)(bdy_par.o) \
 	$(MODEL_LIB)(bdytides.o) \
+	$(MODEL_LIB)(cla_div.o) \
+	$(MODEL_LIB)(divcur.o) \
 	$(MODEL_LIB)(dom_oce.o) \
 	$(MODEL_LIB)(dynadv_cen2.o) \
@@ -2867,7 +3193,12 @@
 	$(MODEL_LIB)(phycst.o) \
 	$(MODEL_LIB)(sbc_oce.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	$(MODEL_LIB)(sshwzv.o) \
+	agrif_oce.F90 \
 	bdy_oce.F90 \
 	bdy_par.F90 \
 	bdytides.F90 \
+	cla_div.F90 \
+	divcur.F90 \
 	dom_oce.F90 \
 	dynadv_cen2.F90 \
@@ -2889,4 +3220,6 @@
 	phycst.F90 \
 	sbc_oce.F90 \
+	sol_oce.F90 \
+	sshwzv.F90 \
 	$(MODEL_LIB)(agrif_opa_interp.o) \
 	$(MODEL_LIB)(agrif_opa_update.o) \
@@ -3161,4 +3494,5 @@
 	dynspg_exp.F90
 $(MODEL_LIB)(dynspg_flt.o) :	\
+	$(MODEL_LIB)(agrif_oce.o) \
 	$(MODEL_LIB)(bdy_oce.o) \
 	$(MODEL_LIB)(bdy_par.o) \
@@ -3202,4 +3536,5 @@
 	$(MODEL_LIB)(zdfmxl.o) \
 	$(MODEL_LIB)(zpshde.o) \
+	agrif_oce.F90 \
 	bdy_oce.F90 \
 	bdy_par.F90 \
@@ -4594,5 +4929,4 @@
 	in_out_manager.F90 \
 	lbcnfd.F90 \
-	$(AGRIF_LIB) \
 	KEY_CPP \
 	lib_mpp.F90
@@ -7569,4 +7903,5 @@
 	sshwzv.F90
 $(MODEL_LIB)(step.o) :	\
+	$(MODEL_LIB)(agrif_oce.o) \
 	$(MODEL_LIB)(agrif_opa_interp.o) \
 	$(MODEL_LIB)(agrif_opa_update.o) \
@@ -7690,4 +8025,5 @@
 	$(MODEL_LIB)(zdftke_old.o) \
 	$(MODEL_LIB)(zpshde.o) \
+	agrif_oce.F90 \
 	agrif_opa_interp.F90 \
 	agrif_opa_update.F90 \
@@ -7996,4 +8332,5 @@
 	$(MODEL_LIB)(lib_print.o) \
 	$(MODEL_LIB)(limwri_2.o) \
+	$(MODEL_LIB)(obc_oce.o) \
 	$(MODEL_LIB)(obctra.o) \
 	$(MODEL_LIB)(oce.o) \
@@ -8067,4 +8404,5 @@
 	lib_print.f90 \
 	limwri_2.F90 \
+	obc_oce.F90 \
 	obctra.F90 \
 	oce.F90 \
@@ -9611,5 +9949,8 @@
 	tranpc.F90
 $(MODEL_LIB)(tranxt.o) :	\
+	$(MODEL_LIB)(agrif_oce.o) \
 	$(MODEL_LIB)(bdy_oce.o) \
+	$(MODEL_LIB)(cla_div.o) \
+	$(MODEL_LIB)(divcur.o) \
 	$(MODEL_LIB)(dom_oce.o) \
 	$(MODEL_LIB)(in_out_manager.o) \
@@ -9620,10 +9961,13 @@
 	$(MODEL_LIB)(lib_print.o) \
 	$(MODEL_LIB)(obc_oce.o) \
-	$(MODEL_LIB)(oce.o) \
-	$(MODEL_LIB)(par_kind.o) \
-	$(MODEL_LIB)(par_oce.o) \
-	$(MODEL_LIB)(phycst.o) \
-	$(MODEL_LIB)(prtctl.o) \
-	$(MODEL_LIB)(sbc_oce.o) \
+	$(MODEL_LIB)(obc_par.o) \
+	$(MODEL_LIB)(oce.o) \
+	$(MODEL_LIB)(par_kind.o) \
+	$(MODEL_LIB)(par_oce.o) \
+	$(MODEL_LIB)(phycst.o) \
+	$(MODEL_LIB)(prtctl.o) \
+	$(MODEL_LIB)(sbc_oce.o) \
+	$(MODEL_LIB)(sol_oce.o) \
+	$(MODEL_LIB)(sshwzv.o) \
 	$(MODEL_LIB)(trdicp.o) \
 	$(MODEL_LIB)(trdicp_oce.o) \
@@ -9635,5 +9979,8 @@
 	$(MODEL_LIB)(trdvor_oce.o) \
 	$(MODEL_LIB)(zdf_oce.o) \
+	agrif_oce.F90 \
 	bdy_oce.F90 \
+	cla_div.F90 \
+	divcur.F90 \
 	dom_oce.F90 \
 	in_out_manager.F90 \
@@ -9644,10 +9991,13 @@
 	lib_print.f90 \
 	obc_oce.F90 \
-	oce.F90 \
-	par_kind.F90 \
-	par_oce.F90 \
-	phycst.F90 \
-	prtctl.F90 \
-	sbc_oce.F90 \
+	obc_par.F90 \
+	oce.F90 \
+	par_kind.F90 \
+	par_oce.F90 \
+	phycst.F90 \
+	prtctl.F90 \
+	sbc_oce.F90 \
+	sol_oce.F90 \
+	sshwzv.F90 \
 	trdicp.F90 \
 	trdicp_oce.F90 \
@@ -9668,4 +10018,5 @@
 	$(MODEL_LIB)(in_out_manager.o) \
 	$(MODEL_LIB)(lbclnk.o) \
+	$(MODEL_LIB)(obc_oce.o) \
 	$(MODEL_LIB)(obctra.o) \
 	$(MODEL_LIB)(oce.o) \
@@ -9684,4 +10035,5 @@
 	in_out_manager.F90 \
 	lbclnk.F90 \
+	obc_oce.F90 \
 	obctra.F90 \
 	oce.F90 \
@@ -10172,4 +10524,5 @@
 $(MODEL_LIB)(trdmld.o) :	\
 	$(MODEL_LIB)(c1d.o) \
+	$(MODEL_LIB)(daymod.o) \
 	$(MODEL_LIB)(dom_oce.o) \
 	$(MODEL_LIB)(eosbn2.o) \
@@ -10197,4 +10550,5 @@
 	$(MODEL_LIB)(zpshde.o) \
 	c1d.F90 \
+	daymod.F90 \
 	dom_oce.F90 \
 	eosbn2.F90 \
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/NST_SRC/agrif_user.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/NST_SRC/agrif_user.F90	(revision 1970)
@@ -73,4 +73,7 @@
       USE tradmp
 #endif
+#if defined key_obc   ||   defined key_esopa
+      USE obc_par
+#endif
       USE sol_oce
       USE in_out_manager
@@ -105,4 +108,8 @@
       ! no tracer damping on fine grids
       lk_tradmp = .FALSE.
+#endif
+#if defined key_obc || defined key_esopa
+      ! no open boundary on fine grids
+      lk_obc = .FALSE.
 #endif
       ! 1. Declaration of the type of variable which have to be interpolated
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OFF_SRC/trc_oce.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OFF_SRC/trc_oce.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OFF_SRC/trc_oce.F90	(revision 1970)
@@ -39,5 +39,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) 
-   !! $Id: trc_oce.F90 1423 2009-05-06 16:22:01Z ctlod $ 
+   !! $Id: trc_oce.F90 1834 2010-04-14 11:54:19Z cetlod $ 
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    !!----------------------------------------------------------------------
@@ -126,11 +126,11 @@
       zrgb(1,51) =  3.162   ;   zrgb(2,51) = 0.22703   ;   zrgb(3,51) = 0.16599   ;   zrgb(4,51) = 0.46601
       zrgb(1,52) =  3.548   ;   zrgb(2,52) = 0.24433   ;   zrgb(3,52) = 0.17334   ;   zrgb(4,52) = 0.47313
-      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,54) = 0.48080
-      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,55) = 0.48909
-      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,56) = 0.49803
-      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,57) = 0.50768
-      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,58) = 0.51810
-      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,59) = 0.52934
-      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,50) = 0.54147
+      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,53) = 0.48080
+      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,54) = 0.48909
+      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,55) = 0.49803
+      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,56) = 0.50768
+      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,57) = 0.51810
+      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,58) = 0.52934
+      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,59) = 0.54147
       zrgb(1,60) =  8.912   ;   zrgb(2,60) = 0.44336   ;   zrgb(3,60) = 0.25725   ;   zrgb(4,60) = 0.55457
       zrgb(1,61) = 10.000   ;   zrgb(2,61) = 0.47804   ;   zrgb(3,61) = 0.27178   ;   zrgb(4,61) = 0.56870
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DIA/diaptr.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1970)
@@ -362,4 +362,95 @@
 #endif
 
+            ! Transports
+            ! T times V on T points (include bolus velocities)
+#if defined key_diaeiv 
+            DO jj = 2, jpj
+               DO ji = 1, jpi
+                  vt(ji,jj,:) = tn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) + u_eiv(ji,jj,:) + u_eiv(ji,jj-1,:) )*0.5
+                  vs(ji,jj,:) = sn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) + v_eiv(ji,jj,:) + v_eiv(ji,jj-1,:) )*0.5
+               END DO
+            END DO
+#else
+            DO jj = 2, jpj
+               DO ji = 1, jpi
+                  vt(ji,jj,:) = tn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) )*0.5
+                  vs(ji,jj,:) = sn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) )*0.5
+               END DO
+            END DO
+#endif 
+            CALL lbc_lnk( vs, 'V', -1. )   ;   CALL lbc_lnk( vt, 'V', -1. )
+
+            ht_glo(:) = SUM( ptr_vjk( vt(:,:,:)), 2 )
+            st_glo(:) = SUM( ptr_vjk( vs(:,:,:)), 2 )
+
+            IF ( ln_subbas ) THEN 
+               ht_atl(:) = SUM( ptr_vjk( vt (:,:,:), abasin(:,:)*sbasin(:,:)), 2 )
+               ht_pac(:) = SUM( ptr_vjk( vt (:,:,:), pbasin(:,:)*sbasin(:,:)), 2 )
+               ht_ind(:) = SUM( ptr_vjk( vt (:,:,:), ibasin(:,:)*sbasin(:,:)), 2 )
+               ht_ipc(:) = SUM( ptr_vjk( vt (:,:,:), dbasin(:,:)*sbasin(:,:)), 2 )
+               st_atl(:) = SUM( ptr_vjk( vs (:,:,:), abasin(:,:)*sbasin(:,:)), 2 )
+               st_pac(:) = SUM( ptr_vjk( vs (:,:,:), pbasin(:,:)*sbasin(:,:)), 2 )
+               st_ind(:) = SUM( ptr_vjk( vs (:,:,:), ibasin(:,:)*sbasin(:,:)), 2 )
+               st_ipc(:) = SUM( ptr_vjk( vs (:,:,:), dbasin(:,:)*sbasin(:,:)), 2 )
+            ENDIF
+
+            ! poleward tracer transports: 
+            ! overturning components:
+            IF ( ln_ptrcomp ) THEN 
+               pht_ove_glo(:) = SUM( v_msf_glo(:,:) * tn_jk_glo(:,:), 2 )   ! SUM over jk
+               pst_ove_glo(:) = SUM( v_msf_glo(:,:) * sn_jk_glo(:,:), 2 )  
+               IF ( ln_subbas ) THEN 
+                  pht_ove_atl(:) = SUM( v_msf_atl(:,:) * tn_jk_atl(:,:), 2 )   ! SUM over jk
+                  pst_ove_atl(:) = SUM( v_msf_atl(:,:) * sn_jk_atl(:,:), 2 )  
+                  pht_ove_pac(:) = SUM( v_msf_pac(:,:) * tn_jk_pac(:,:), 2 )   ! SUM over jk
+                  pst_ove_pac(:) = SUM( v_msf_pac(:,:) * sn_jk_pac(:,:), 2 )  
+                  pht_ove_ind(:) = SUM( v_msf_ind(:,:) * tn_jk_ind(:,:), 2 )   ! SUM over jk
+                  pst_ove_ind(:) = SUM( v_msf_ind(:,:) * sn_jk_ind(:,:), 2 )  
+                  pht_ove_ipc(:) = SUM( v_msf_ipc(:,:) * tn_jk_ipc(:,:), 2 )   ! SUM over jk
+                  pst_ove_ipc(:) = SUM( v_msf_ipc(:,:) * sn_jk_ipc(:,:), 2 )  
+               END IF
+            END IF
+
+            ! Bolus component
+#if defined key_diaeiv
+            pht_eiv_glo(:) = SUM( v_msf_eiv_glo(:,:) * tn_jk_glo(:,:), 2 )   ! SUM over jk
+            pst_eiv_glo(:) = SUM( v_msf_eiv_glo(:,:) * sn_jk_glo(:,:), 2 )   ! SUM over jk
+            IF ( ln_subbas ) THEN 
+               pht_eiv_atl(:) = SUM( v_msf_eiv_glo(:,:) * tn_jk_atl(:,:), 2 )   ! SUM over jk
+               pst_eiv_atl(:) = SUM( v_msf_eiv_glo(:,:) * sn_jk_atl(:,:), 2 )   ! SUM over jk
+               pht_eiv_pac(:) = SUM( v_msf_eiv_pac(:,:) * tn_jk_pac(:,:), 2 )   ! SUM over jk
+               pst_eiv_pac(:) = SUM( v_msf_eiv_pac(:,:) * sn_jk_pac(:,:), 2 )   ! SUM over jk
+               pht_eiv_ind(:) = SUM( v_msf_eiv_ind(:,:) * tn_jk_ind(:,:), 2 )   ! SUM over jk
+               pst_eiv_ind(:) = SUM( v_msf_eiv_ind(:,:) * sn_jk_ind(:,:), 2 )   ! SUM over jk
+               pht_eiv_ipc(:) = SUM( v_msf_eiv_ipc(:,:) * tn_jk_ipc(:,:), 2 )   ! SUM over jk
+               pst_eiv_ipc(:) = SUM( v_msf_eiv_ipc(:,:) * sn_jk_ipc(:,:), 2 )   ! SUM over jk
+            ENDIF
+#endif
+
+            ! conversion in PW and G g
+            zpwatt = zpwatt * rau0 * rcp
+            pht_adv(:) = pht_adv(:) * zpwatt  
+            pht_ldf(:) = pht_ldf(:) * zpwatt
+            pst_adv(:) = pst_adv(:) * zggram
+            pst_ldf(:) = pst_ldf(:) * zggram
+            IF ( ln_ptrcomp ) THEN 
+               pht_ove_glo(:) = pht_ove_glo(:) * zpwatt
+               pst_ove_glo(:) = pst_ove_glo(:) * zggram
+            END IF
+#if defined key_diaeiv
+            pht_eiv_glo(:) = pht_eiv_glo(:) * zpwatt
+            pst_eiv_glo(:) = pst_eiv_glo(:) * zggram
+#endif
+            IF( ln_subbas ) THEN
+               ht_atl(:) = ht_atl(:) * zpwatt
+               ht_pac(:) = ht_pac(:) * zpwatt
+               ht_ind(:) = ht_ind(:) * zpwatt
+               ht_ipc(:) = ht_ipc(:) * zpwatt
+               st_atl(:) = st_atl(:) * zggram 
+               st_pac(:) = st_pac(:) * zggram
+               st_ind(:) = st_ind(:) * zggram
+               st_ipc(:) = st_ipc(:) * zggram
+            ENDIF
+
             ! "Meridional" Stream-Function
             DO jk = 2,jpk 
@@ -394,95 +485,4 @@
                v_msf_ind(:,:) = v_msf_ind(:,:) * zsverdrup
                v_msf_ipc(:,:) = v_msf_ipc(:,:) * zsverdrup
-            ENDIF
-
-            ! Transports
-            ! T times V on T points (include bolus velocities)
-#if defined key_diaeiv 
-            DO jj = 2, jpj
-               DO ji = 1, jpi
-                  vt(ji,jj,:) = tn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) + u_eiv(ji,jj,:) + u_eiv(ji,jj-1,:) )*0.5
-                  vs(ji,jj,:) = sn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) + v_eiv(ji,jj,:) + v_eiv(ji,jj-1,:) )*0.5
-               END DO
-            END DO
-#else
-            DO jj = 2, jpj
-               DO ji = 1, jpi
-                  vt(ji,jj,:) = tn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) )*0.5
-                  vs(ji,jj,:) = sn(ji,jj,:) * ( vn(ji,jj,:) + vn(ji,jj-1,:) )*0.5
-               END DO
-            END DO
-#endif 
-            CALL lbc_lnk( vs, 'V', -1. )   ;   CALL lbc_lnk( vt, 'V', -1. )
-
-            ht_glo(:) = SUM( ptr_vjk( vt(:,:,:)), 2 )
-            st_glo(:) = SUM( ptr_vjk( vs(:,:,:)), 2 )
-
-            IF ( ln_subbas ) THEN 
-               ht_atl(:) = SUM( ptr_vjk( vt (:,:,:), abasin(:,:)*sbasin(:,:)), 2 )
-               ht_pac(:) = SUM( ptr_vjk( vt (:,:,:), pbasin(:,:)*sbasin(:,:)), 2 )
-               ht_ind(:) = SUM( ptr_vjk( vt (:,:,:), ibasin(:,:)*sbasin(:,:)), 2 )
-               ht_ipc(:) = SUM( ptr_vjk( vt (:,:,:), dbasin(:,:)*sbasin(:,:)), 2 )
-               st_atl(:) = SUM( ptr_vjk( vs (:,:,:), abasin(:,:)*sbasin(:,:)), 2 )
-               st_pac(:) = SUM( ptr_vjk( vs (:,:,:), pbasin(:,:)*sbasin(:,:)), 2 )
-               st_ind(:) = SUM( ptr_vjk( vs (:,:,:), ibasin(:,:)*sbasin(:,:)), 2 )
-               st_ipc(:) = SUM( ptr_vjk( vs (:,:,:), dbasin(:,:)*sbasin(:,:)), 2 )
-            ENDIF
-
-            ! poleward tracer transports: 
-            ! overturning components:
-            IF ( ln_ptrcomp ) THEN 
-               pht_ove_glo(:) = SUM( v_msf_glo(:,:) * tn_jk_glo(:,:), 2 )   ! SUM over jk
-               pst_ove_glo(:) = SUM( v_msf_glo(:,:) * sn_jk_glo(:,:), 2 )  
-               IF ( ln_subbas ) THEN 
-                  pht_ove_atl(:) = SUM( v_msf_atl(:,:) * tn_jk_atl(:,:), 2 )   ! SUM over jk
-                  pst_ove_atl(:) = SUM( v_msf_atl(:,:) * sn_jk_atl(:,:), 2 )  
-                  pht_ove_pac(:) = SUM( v_msf_pac(:,:) * tn_jk_pac(:,:), 2 )   ! SUM over jk
-                  pst_ove_pac(:) = SUM( v_msf_pac(:,:) * sn_jk_pac(:,:), 2 )  
-                  pht_ove_ind(:) = SUM( v_msf_ind(:,:) * tn_jk_ind(:,:), 2 )   ! SUM over jk
-                  pst_ove_ind(:) = SUM( v_msf_ind(:,:) * sn_jk_ind(:,:), 2 )  
-                  pht_ove_ipc(:) = SUM( v_msf_ipc(:,:) * tn_jk_ipc(:,:), 2 )   ! SUM over jk
-                  pst_ove_ipc(:) = SUM( v_msf_ipc(:,:) * sn_jk_ipc(:,:), 2 )  
-               END IF
-            END IF
-
-            ! Bolus component
-#if defined key_diaeiv
-            pht_eiv_glo(:) = SUM( v_msf_eiv_glo(:,:) * tn_jk_glo(:,:), 2 )   ! SUM over jk
-            pst_eiv_glo(:) = SUM( v_msf_eiv_glo(:,:) * sn_jk_glo(:,:), 2 )   ! SUM over jk
-            IF ( ln_subbas ) THEN 
-               pht_eiv_atl(:) = SUM( v_msf_eiv_glo(:,:) * tn_jk_atl(:,:), 2 )   ! SUM over jk
-               pst_eiv_atl(:) = SUM( v_msf_eiv_glo(:,:) * sn_jk_atl(:,:), 2 )   ! SUM over jk
-               pht_eiv_pac(:) = SUM( v_msf_eiv_pac(:,:) * tn_jk_pac(:,:), 2 )   ! SUM over jk
-               pst_eiv_pac(:) = SUM( v_msf_eiv_pac(:,:) * sn_jk_pac(:,:), 2 )   ! SUM over jk
-               pht_eiv_ind(:) = SUM( v_msf_eiv_ind(:,:) * tn_jk_ind(:,:), 2 )   ! SUM over jk
-               pst_eiv_ind(:) = SUM( v_msf_eiv_ind(:,:) * sn_jk_ind(:,:), 2 )   ! SUM over jk
-               pht_eiv_ipc(:) = SUM( v_msf_eiv_ipc(:,:) * tn_jk_ipc(:,:), 2 )   ! SUM over jk
-               pst_eiv_ipc(:) = SUM( v_msf_eiv_ipc(:,:) * sn_jk_ipc(:,:), 2 )   ! SUM over jk
-            ENDIF
-#endif
-
-            ! conversion in PW and G g
-            zpwatt = zpwatt * rau0 * rcp
-            pht_adv(:) = pht_adv(:) * zpwatt  
-            pht_ldf(:) = pht_ldf(:) * zpwatt
-            pst_adv(:) = pst_adv(:) * zggram
-            pst_ldf(:) = pst_ldf(:) * zggram
-            IF ( ln_ptrcomp ) THEN 
-               pht_ove_glo(:) = pht_ove_glo(:) * zpwatt
-               pst_ove_glo(:) = pst_ove_glo(:) * zggram
-            END IF
-#if defined key_diaeiv
-            pht_eiv_glo(:) = pht_eiv_glo(:) * zpwatt
-            pst_eiv_glo(:) = pst_eiv_glo(:) * zggram
-#endif
-            IF( ln_subbas ) THEN
-               ht_atl(:) = ht_atl(:) * zpwatt
-               ht_pac(:) = ht_pac(:) * zpwatt
-               ht_ind(:) = ht_ind(:) * zpwatt
-               ht_ipc(:) = ht_ipc(:) * zpwatt
-               st_atl(:) = st_atl(:) * zggram 
-               st_pac(:) = st_pac(:) * zggram
-               st_ind(:) = st_ind(:) * zggram
-               st_ipc(:) = st_ipc(:) * zggram
             ENDIF
          ENDIF
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 1970)
@@ -219,13 +219,4 @@
 #else
    LOGICAL, PUBLIC, PARAMETER ::   lk_agrif = .FALSE.   !: agrif flag
-
-CONTAINS
-   LOGICAL FUNCTION Agrif_Root()
-      Agrif_Root = .TRUE.
-   END FUNCTION Agrif_Root
-
-   CHARACTER(len=3) FUNCTION Agrif_CFixed()
-     Agrif_CFixed = '0' 
-   END FUNCTION Agrif_CFixed
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/phycst.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/phycst.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DOM/phycst.F90	(revision 1970)
@@ -4,9 +4,8 @@
    !!     Definition of of both ocean and ice parameters used in the code
    !!=====================================================================
-   !! History :        !  90-10  (C. Levy - G. Madec)  Original code
-   !!                  !  91-11  (G. Madec)
-   !!                  !  91-12  (M. Imbard)
-   !!             8.5  !  02-08  (G. Madec, C. Ethe)  F90, add ice constants
-   !!             9.0  !  06-08  (G. Madec)  style 
+   !! History :   OPA  !  1990-10  (C. Levy, G. Madec)  Original code
+   !!                  !  1991-11  (G. Madec, M. Imbard)
+   !!  NEMO       1.0  !  2002-08  (G. Madec, C. Ethe)  F90, add ice constants
+   !!              -   !  2006-08  (G. Madec)  style 
    !!----------------------------------------------------------------------
 
@@ -59,5 +58,4 @@
       rcdic   =   2.034396_wp ,   &  !: thermal conductivity of fresh ice
       cpic    = 2067.0        ,   &
-      ! add the following lines
       lsub    = 2.834e+6      ,   &  !: pure ice latent heat of sublimation (J.kg-1)
       lfus    = 0.334e+6      ,   &  !: latent heat of fusion of fresh ice   (J.kg-1)
@@ -69,6 +67,7 @@
       rcpsn   =   6.9069e+5_wp,   &  !: density times specific heat for snow
       rcpic   =   1.8837e+6_wp,   &  !: volumetric latent heat fusion of sea ice
-      xlsn    = 110.121e+6_wp ,   &  !: volumetric latent heat fusion of snow
-      xlic    = 300.33e+6_wp  ,   &  !: volumetric latent heat fusion of ice
+      lfus    = 0.3337e+6     ,   &  !: latent heat of fusion of fresh ice   (J.kg-1)
+      xlsn    = 110.121e+6_wp ,   &  !: = lfus * rhosn, volumetric latent heat fusion of snow
+      xlic    = 300.33e+6_wp  ,   &  !: = lfus * rhosn, volumetric latent heat fusion of ice
       xsn     =   2.8e+6      ,   &  !: latent heat of sublimation of snow
       rhoic   = 900._wp       ,   &  !: volumic mass of sea ice (kg/m3)
@@ -83,7 +82,7 @@
       stefan  =   5.67e-8_wp         !: Stefan-Boltzmann constant 
       !!----------------------------------------------------------------------
-      !!  OPA 9.0 , LOCEAN-IPSL (2005) 
+      !! NEMO/OPA 3.2 , LOCEAN-IPSL (2010) 
       !! $Id$ 
-      !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+      !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
       !!----------------------------------------------------------------------
    
@@ -160,4 +159,10 @@
       IF(lwp) WRITE(numout,*) '                       1. / ( rau0 * rcp ) = ro0cpr = ', ro0cpr
 
+#if defined key_lim3
+      xlsn = lfus * rhosn        ! volumetric latent heat fusion of snow [J/m3]
+#else
+      lfus = xlsn / rhosn        ! latent heat of fusion of fresh ice
+#endif
+
       IF(lwp) THEN
          WRITE(numout,*)
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 1970)
@@ -146,5 +146,5 @@
 # if defined key_obc
       !                                !* OBC open boundaries
-      CALL obc_dyn( kt )
+      IF( lk_obc )   CALL obc_dyn( kt )
       !
       IF ( lk_dynspg_exp .OR. lk_dynspg_ts ) THEN
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 1970)
@@ -186,6 +186,6 @@
 
 #if defined key_obc
-      CALL obc_dyn( kt )      ! Update velocities on each open boundary with the radiation algorithm
-      CALL obc_vol( kt )      ! Correction of the barotropic componant velocity to control the volume of the system
+      IF( lk_obc )   CALL obc_dyn( kt )   ! Update velocities on each open boundary with the radiation algorithm
+      IF( lk_obc )   CALL obc_vol( kt )   ! Correction of the barotropic componant velocity to control the volume of the system
 #endif
 #if defined key_bdy
@@ -315,6 +315,11 @@
 #if defined key_obc
             ! caution : grad D = 0 along open boundaries
-            spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
-            spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
+            IF( Agrif_Root() ) THEN
+               spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
+               spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
+            ELSE
+               spgu(ji,jj) = z2dt * ztdgu
+               spgv(ji,jj) = z2dt * ztdgv
+            ENDIF
 #elif defined key_bdy
             ! caution : grad D = 0 along open boundaries
@@ -330,5 +335,5 @@
       END DO
 
-#if defined key_agrif
+#if defined key_agrif      
       IF( .NOT. Agrif_Root() ) THEN
          ! caution : grad D (fine) = grad D (coarse) at coarse/fine interface
@@ -338,6 +343,5 @@
          IF( nbondj ==  1 .OR. nbondj == 2 ) spgv(:,nlcj-2) = z2dtg * z2dt * laplacv(:,nlcj-2) * vmask(:,nlcj-2,1)
       ENDIF
-#endif
-
+#endif      
       ! Add the trends multiplied by z2dt to the after velocity
       ! -------------------------------------------------------
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 1970)
@@ -25,5 +25,9 @@
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.   !: Ocean Boundary Condition flag
+#if ! defined key_agrif
+   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
+#else
+   LOGICAL, PUBLIC            ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
+#endif
 
 # if defined key_eel_r5
@@ -43,10 +47,10 @@
    !! open boundary parameter
    !!---------------------------------------------------------------------
-   INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
+   INTEGER ::     &  !: time dimension of the BCS fields on input
       jptobc  =	      2 
    !! * EAST open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_east = .FALSE.     !: to active or not the East open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     & 
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -56,7 +60,7 @@
 
    !! * WEST open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_west = .FALSE.     !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -66,7 +70,7 @@
 
    !! * NORTH open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -76,7 +80,7 @@
 
    !! * SOUTH open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 1970)
@@ -15,5 +15,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !: to active or not the East open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -25,5 +30,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.      !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -35,5 +45,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -45,5 +60,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 1970)
@@ -4,21 +4,23 @@
    !! open boundary parameter : POMME configuration
    !!---------------------------------------------------------------------
-     INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
-      jptobc  =	      14
+   INTEGER, PARAMETER ::  jptobc  =	      14   
+   !: time dimension of the BCS fields on input
 
    !! * EAST open boundary
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !:
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       !jpjed  =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
       !jpjef  = jpjglo-1,    &  !: j-ending   indice of the East open boundary (must be land T-point)
-
       jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed  =        1,    &  !: j-starting indice of the East open boundary (must be land T-point)
       jpjef  =   jpjglo,    &  !: j-ending   indice of the East open boundary (must be land T-point)
-
       jpjedp1 =  jpjed+1,    &  !: first ocean point         "                 "
       jpjefm1 =  jpjef-1        !: last  ocean point         "                 "
@@ -27,15 +29,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.     !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       !jpjwd   =        2,   &  !: j-starting indice of the West open boundary (must be land T-point)
       !jpjwf   = jpjglo-1,   &  !: j-ending   indice of the West open boundary (must be land T-point)
-
       jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =        1,   &  !: j-starting indice of the West open boundary (must be land T-point)
       jpjwf   =   jpjglo,   &  !: j-ending   indice of the West open boundary (must be land T-point)
-
       jpjwdp1 =  jpjwd+1,    &  !: first ocean point         "                 "
       jpjwfm1 =  jpjwf-1        !: last  ocean point         "                 "
@@ -44,15 +48,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .TRUE.     !:
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       !jpind  =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
       !jpinf  = jpiglo-1,    &  !: i-ending   indice of the North open boundary (must be land T-point)
-
       jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind  =        1,    &  !: i-starting indice of the North open boundary (must be land T-point)
       jpinf  =   jpiglo,    &  !: i-ending   indice of the North open boundary (must be land T-point)
-
       jpindp1 =  jpind+1,    &  !: first ocean point         "                 "
       jpinfm1 =  jpinf-1        !: last  ocean point         "                 "
@@ -61,15 +67,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .TRUE.     !: INDICE to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       !jpisd  =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
       !jpisf  = jpiglo-1,    &  !: i-ending   indice of the South open boundary (must be land T-point)
-
       jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd  =        1,    &  !: i-starting indice of the South open boundary (must be land T-point)
       jpisf  =   jpiglo,    &  !: i-ending   indice of the South open boundary (must be land T-point)
-
       jpisdp1 =  jpisd+1,    &  !: first ocean point         "                 "
       jpisfm1 =  jpisf-1        !: last  ocean point         "                 "
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obcdta.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 1970)
@@ -469,5 +469,9 @@
        ENDIF
     ELSE
+#if defined key_agrif
+       IF ( ASSOCIATED(ztcobc) ) DEALLOCATE ( ztcobc )
+#else
        IF ( ALLOCATED(ztcobc) ) DEALLOCATE ( ztcobc )
+#endif
        ALLOCATE (ztcobc(itobc))
        DO ji=1,1   ! use a dummy loop to read ztcobc only once
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/fldread.F90	(revision 1970)
@@ -186,5 +186,5 @@
                         &                    nday   + 1                   - nmonth_len(nmonth) * COUNT((/llnxtmth/)), llstop )
 
-                     IF( sd(jf)%num == 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist
+                     IF( sd(jf)%num <= 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist
                         CALL ctl_warn('next year/month/day file: '//TRIM(sd(jf)%clname)//     &
                                 &     ' not present -> back to current year/month/day')
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/geo2ocean.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/geo2ocean.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/geo2ocean.F90	(revision 1970)
@@ -311,8 +311,8 @@
 
       ! 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. )
+      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
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 1970)
@@ -23,4 +23,5 @@
    USE sbc_oce         ! Surface boundary condition: ocean fields
    USE sbc_ice         ! Surface boundary condition: ice fields
+   USE phycst          ! physical constants
 #if defined key_lim3
    USE par_ice         ! ice parameters
@@ -45,5 +46,4 @@
    USE lib_mpp         ! distribued memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE phycst, ONLY : xlsn, rhosn, xlic, rhoic
 #if defined key_cpl_carbon_cycle
    USE p4zflx, ONLY : oce_co2
@@ -274,5 +274,6 @@
       srcv(jpr_itz2)%clname = 'O_ITauz2'      ! 3rd   -      -         -     - 
       ! 
-      srcv(jpr_otx1:jpr_itz2)%nsgn = -1                           ! Vectors: change of sign at north fold
+      ! Vectors: change of sign at north fold ONLY if on the local grid
+      IF( TRIM( cn_rcv_tau(3) ) == 'local grid' )   srcv(jpr_otx1:jpr_itz2)%nsgn = -1.
       
       !                                                           ! Set grid and action
@@ -714,7 +715,6 @@
          IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(:,:,jpr_qnsoce)
          IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(:,:,jpr_qnsmix)        
-         !   energy for melting solid precipitation over free ocean
-         zcoef = xlsn / rhosn
-         qns(:,:) = qns(:,:) - frcv(:,:,jpr_snow) * zcoef
+         qns(:,:) = qns(:,:) - frcv(:,:,jpr_snow) * lfus              ! add the latent heat of solid precip. melting 
+
          !                                                       ! solar flux over the ocean          (qsr)
          IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(:,:,jpr_qsroce) 
@@ -1117,9 +1117,6 @@
             &                                                   +          pist(:,:,1)   * zicefr(:,:,1) ) )
       END SELECT
-      !                                                           ! snow melting heat flux ....
-      !   energy for melting solid precipitation over ice-free ocean
-      zcoef = xlsn / rhosn
-      ztmp(:,:) = p_frld(:,:,1) * zsnow(:,:) * zcoef
-      pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)
+      ztmp(:,:) = p_frld(:,:,1) * zsnow(:,:) * lfus               ! add the latent heat of solid precip. melting
+      pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)                   ! over free ocean 
       IF( lk_diaar5 )   CALL iom_put( 'hflx_snow_cea', ztmp + zsnow(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
 !!gm
@@ -1130,9 +1127,7 @@
 !!
 !! similar job should be done for snow and precipitation temperature
-      !                                                           ! Iceberg melting heat flux ....
-      !   energy for iceberg melting 
-      IF( srcv(jpr_cal)%laction ) THEN 
-         zcoef = xlic / rhoic
-         ztmp(:,:) = frcv(:,:,jpr_cal) * zcoef
+      !                                     
+      IF( srcv(jpr_cal)%laction ) THEN                            ! Iceberg melting 
+         ztmp(:,:) = frcv(:,:,jpr_cal) * lfus                     ! add the latent heat of iceberg melting 
          pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)
          IF( lk_diaar5 )   CALL iom_put( 'hflx_cal_cea', ztmp + frcv(:,:,jpr_cal) * zcptn(:,:) )   ! heat flux from calving
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 1970)
@@ -65,5 +65,5 @@
       INTEGER  ::   inum                  ! temporary logical unit
       INTEGER  ::   ikty, iyear           ! 
-      REAL(wp) ::   z_emp, z_emp_nsrf       ! temporary scalars
+      REAL(wp) ::   z_emp, z_emp_nsrf, zsum_emp, zsum_erp       ! temporary scalars
       REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread
       REAL(wp), DIMENSION(jpi,jpj) ::   ztmsk_neg, ztmsk_pos, ztmsk_tospread
@@ -165,4 +165,6 @@
             !
             IF( lk_mpp )   CALL  mpp_sum( z_emp )
+            IF( lk_mpp )   CALL  mpp_sum( zsurf_neg )
+            IF( lk_mpp )   CALL  mpp_sum( zsurf_pos )
             
             IF( z_emp < 0.e0 ) THEN
@@ -177,7 +179,12 @@
 
             ! emp global mean over <0 or >0 erp area
-            z_emp_nsrf = SUM( e1e2_i(:,:) * z_emp ) / ( zsurf_tospread + rsmall )
+            zsum_emp = SUM( e1e2_i(:,:) * z_emp )
+            IF( lk_mpp )   CALL  mpp_sum( zsum_emp )
+            z_emp_nsrf =  zsum_emp / ( zsurf_tospread + rsmall )
             ! weight to respect erp field 2D structure 
-            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( SUM( ztmsk_tospread(:,:) * erp(:,:) * e1e2_i(:,:) ) + rsmall )
+            zsum_erp = SUM( ztmsk_tospread(:,:) * erp(:,:) * e1e2_i(:,:) )
+            IF( lk_mpp )   CALL  mpp_sum( zsum_erp )
+            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall )
+
             ! final correction term to apply
             zerp_cor(:,:) = -1. * z_emp_nsrf * zsurf_tospread * z_wgt(:,:)
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SOL/solmat.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SOL/solmat.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/SOL/solmat.F90	(revision 1970)
@@ -99,48 +99,50 @@
       
 #  elif defined key_dynspg_flt && defined key_obc
-
-      DO jj = 2, jpjm1                      ! matrix of free surface elliptic system with open boundaries
-         DO ji = 2, jpim1
-            zcoef = z2dt * z2dt * grav * bmask(ji,jj)
-            !                                    ! south coefficient
-            IF( lp_obc_south .AND. ( jj == njs0p1 ) ) THEN
-               zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)*(1.-vsmsk(ji,1))
-            ELSE
-               zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)
-            END IF
-            gcp(ji,jj,1) = zcoefs
-            !
-            !                                    ! west coefficient
-            IF( lp_obc_west  .AND. ( ji == niw0p1 ) ) THEN
-               zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)*(1.-uwmsk(jj,1))
-            ELSE
-               zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)
-            END IF
-            gcp(ji,jj,2) = zcoefw
-            !
-            !                                    ! east coefficient
-            IF( lp_obc_east  .AND. ( ji == nie0 ) ) THEN
-               zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)*(1.-uemsk(jj,1))
-            ELSE
-               zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)
-            END IF
-            gcp(ji,jj,3) = zcoefe
-            !
-            !                                    ! north coefficient
-            IF( lp_obc_north .AND. ( jj == njn0 ) ) THEN
-               zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)*(1.-vnmsk(ji,1))
-            ELSE
+      IF( Agrif_Root() ) THEN
+         DO jj = 2, jpjm1                      ! matrix of free surface elliptic system with open boundaries
+            DO ji = 2, jpim1
+               zcoef = z2dt * z2dt * grav * bmask(ji,jj)
+               !                                    ! south coefficient
+               IF( lp_obc_south .AND. ( jj == njs0p1 ) ) THEN
+                  zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)*(1.-vsmsk(ji,1))
+               ELSE
+                  zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)
+               END IF
+               gcp(ji,jj,1) = zcoefs
+               !
+               !                                    ! west coefficient
+               IF( lp_obc_west  .AND. ( ji == niw0p1 ) ) THEN
+                  zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)*(1.-uwmsk(jj,1))
+               ELSE
+                  zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)
+               END IF
+               gcp(ji,jj,2) = zcoefw
+               !
+               !                                    ! east coefficient
+               IF( lp_obc_east  .AND. ( ji == nie0 ) ) THEN
+                  zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)*(1.-uemsk(jj,1))
+               ELSE
+                  zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)
+               END IF
+               gcp(ji,jj,3) = zcoefe
+               !
+               !                                    ! north coefficient
+               IF( lp_obc_north .AND. ( jj == njn0 ) ) THEN
+                  zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)*(1.-vnmsk(ji,1))
+               ELSE
                zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)
-            END IF
-            gcp(ji,jj,4) = zcoefn
-            !
-            !                                    ! diagonal coefficient
-            gcdmat(ji,jj) = e1t(ji,jj)*e2t(ji,jj)*bmask(ji,jj)   &
-               &            - zcoefs -zcoefw -zcoefe -zcoefn
+               END IF
+               gcp(ji,jj,4) = zcoefn
+               !
+               !                                    ! diagonal coefficient
+               gcdmat(ji,jj) = e1t(ji,jj)*e2t(ji,jj)*bmask(ji,jj)   &
+                  &            - zcoefs -zcoefw -zcoefe -zcoefn
+            END DO
          END DO
-      END DO
+      ENDIF
 #endif
 
-      IF( .NOT. Agrif_Root() ) THEN   ! Fine grid boundaries
+#if defined key_agrif
+      IF( .NOT.AGRIF_ROOT() ) THEN
          !
          IF( nbondi == -1 .OR. nbondi == 2 )   bmask(2     ,:     ) = 0.e0
@@ -191,4 +193,5 @@
          ! 
       ENDIF
+#endif
 
       ! 2. Boundary conditions 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 1970)
@@ -179,4 +179,9 @@
       END DO
 
+      ! "zonal" mean advective heat and salt transport
+      IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN
+         pht_adv(:) = ptr_vj( ztv(:,:,:) )
+         pst_adv(:) = ptr_vj( zsv(:,:,:) )
+      ENDIF
 
       ! Save the intermediate i / j / k advective trends for diagnostics
@@ -366,6 +371,6 @@
       ! "zonal" mean advective heat and salt transport
       IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN
-         pht_adv(:) = ptr_vj( ztv(:,:,:) )
-         pst_adv(:) = ptr_vj( zsv(:,:,:) )
+         pht_adv(:) = ptr_vj( ztv(:,:,:) ) + pht_adv(:)
+         pst_adv(:) = ptr_vj( zsv(:,:,:) ) + pst_adv(:)
       ENDIF
       !
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 1970)
@@ -38,4 +38,5 @@
    USE agrif_opa_update
    USE agrif_opa_interp
+   USE obc_oce 
 
    IMPLICIT NONE
@@ -101,5 +102,5 @@
       !
 #if defined key_obc
-      CALL obc_tra( kt )               ! OBC open boundaries
+      IF( lk_obc )   CALL obc_tra( kt )  ! OBC open boundaries
 #endif
 #if defined key_bdy
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/lib_mpp.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/lib_mpp.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/lib_mpp.F90	(revision 1970)
@@ -2049,4 +2049,5 @@
       ijpj   = 4
       ijpjm1 = 3
+      ztab(:,:,:) = 0.e0
       !
       DO jj = nlcj - ijpj +1, nlcj          ! put in znorthloc the last 4 jlines of pt3d
@@ -2114,4 +2115,5 @@
       ijpj   = 4
       ijpjm1 = 3
+      ztab(:,:) = 0.e0
       !
       DO jj = nlcj-ijpj+1, nlcj             ! put in znorthloc the last 4 jlines of pt2d
@@ -2179,4 +2181,5 @@
       !
       ijpj=4
+      ztab(:,:) = 0.e0
 
       ij=0
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/par_POMME_R025.h90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 1970)
@@ -22,9 +22,7 @@
       jp_cfg = 025  ,        &  !: resolution of the configuration (degrees)
       ! Original data size
-
       ! ORCA025 global grid size
       jpiglo_ORCA025 = 1442, &
       jpjglo_ORCA025 = 1021, &  ! not used currently
-
       ! POMME "global" domain localisation in the ORCA025 global grid
       jpi_iw    = 1059,      & 
@@ -32,9 +30,7 @@
       jpj_js    = 661,       &
       jpj_jn    = 700,       &
-
       jpidta  = ( jpi_ie - jpi_iw + 1 ), &   !: =30 first horizontal dimension > or = to jpi
       jpjdta  = ( jpj_jn - jpj_js + 1 ), &   !: =40 second                     > or = to jpj
       jpkdta  = 46 ,         &  !: number of levels           > or = to jpk
-
       ! total domain matrix size
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/trc_oce.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/trc_oce.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/OPA_SRC/trc_oce.F90	(revision 1970)
@@ -126,11 +126,11 @@
       zrgb(1,51) =  3.162   ;   zrgb(2,51) = 0.22703   ;   zrgb(3,51) = 0.16599   ;   zrgb(4,51) = 0.46601
       zrgb(1,52) =  3.548   ;   zrgb(2,52) = 0.24433   ;   zrgb(3,52) = 0.17334   ;   zrgb(4,52) = 0.47313
-      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,54) = 0.48080
-      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,55) = 0.48909
-      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,56) = 0.49803
-      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,57) = 0.50768
-      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,58) = 0.51810
-      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,59) = 0.52934
-      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,50) = 0.54147
+      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,53) = 0.48080
+      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,54) = 0.48909
+      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,55) = 0.49803
+      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,56) = 0.50768
+      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,57) = 0.51810
+      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,58) = 0.52934
+      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,59) = 0.54147
       zrgb(1,60) =  8.912   ;   zrgb(2,60) = 0.44336   ;   zrgb(3,60) = 0.25725   ;   zrgb(4,60) = 0.55457
       zrgb(1,61) = 10.000   ;   zrgb(2,61) = 0.47804   ;   zrgb(3,61) = 0.27178   ;   zrgb(4,61) = 0.56870
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zflx.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 1970)
@@ -204,12 +204,19 @@
           CALL mpp_sum( t_oce_co2_flx )   ! sum over the global domain
         ENDIF
+        ! Conversion in GtC/yr ; negative for outgoing from ocean
+        t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15
+        !
         WRITE(numout,*) ' Atmospheric pCO2    :'
         WRITE(numout,*) '-------------------- : ',kt,'  ',t_atm_co2_flx
         WRITE(numout,*) '(ppm)'
-        WRITE(numout,*) 'Total Flux of Carbon :'
-        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx * 12. / 1e15
-        WRITE(numout,*) '(GtC/an)'
+        WRITE(numout,*) 'Total Flux of Carbon out of the ocean :'
+        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx
+        WRITE(numout,*) '(GtC/yr)'
         t_atm_co2_flx = 0.
         t_oce_co2_flx = 0.
+# if defined key_iomput
+        CALL iom_put( "tatpco2" , t_atm_co2_flx  )
+        CALL iom_put( "tco2flx" , t_oce_co2_flx  )
+#endif
       ENDIF
 #endif
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zlys.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 1970)
@@ -67,5 +67,5 @@
 #if defined key_trc_dia3d && defined key_iomput
       REAL(wp) ::   zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zcaldiss, zw3d
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zcaldiss
 #endif
       CHARACTER (len=25) :: charout
@@ -94,4 +94,7 @@
                   ! SET DUMMY VARIABLE FOR TOTAL BORATE
                   zbot  = borat(ji,jj,jk)
+
+                  ! SET DUMMY VARIABLE FOR TOTAL BORATE
+                  zbot  = borat(ji,jj,jk)
                   zfact = rhop (ji,jj,jk) / 1000. + rtrn
 
@@ -171,12 +174,8 @@
 #  else
       zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = hi  (:,:,:)                    * tmask(:,:,:)
-      CALL iom_put( "PH", zw3d )
-      zw3d(:,:,:) = zco3(:,:,:)                    * tmask(:,:,:)
-      CALL iom_put( "CO3", zw3d )
-      zw3d(:,:,:) = aksp(:,:,:) / calcon           * tmask(:,:,:)
-      CALL iom_put( "CO3sat", zw3d )
-      zw3d(:,:,:) = zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:)
-      CALL iom_put( "Dcal", zw3d )
+      CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) )
+      CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) )
+      CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) )
+      CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) )
 #  endif
 # endif
@@ -232,5 +231,4 @@
    END SUBROUTINE p4z_lys
 #endif 
-
    !!======================================================================
 END MODULE  p4zlys
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmeso.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 1970)
@@ -76,5 +76,4 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
       REAL(wp) :: zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
 #endif
 
@@ -203,4 +202,10 @@
       END DO
       
+#if defined key_trc_dia3d
+      ! Total grazing ( grazing by microzoo is already computed in p4zmicro ) 
+      grazing(:,:,:) = grazing(:,:,:) + (  zgrazd  (:,:,:) + zgrazz  (:,:,:) + zgrazn(:,:,:) &
+                     &                   + zgrazpoc(:,:,:) + zgrazffe(:,:,:)  )
+#endif
+
 
       DO jk = 1,jpkm1
@@ -311,10 +316,12 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
       zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = (     zgrazd(:,:,:) +   zgrazz(:,:,:) + zgrazn(:,:,:) &
-                    & + zgrazpoc(:,:,:) + zgrazffe(:,:,:)                 ) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Graz2" , zw3d )
-
-      zw3d(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Pcal"  , zw3d )
+      ! Total grazing of phyto by zoo
+      grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)
+      ! Calcite production
+      prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)
+      IF( jnt == nrdttrc ) then 
+         CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton
+         CALL iom_put( "PCAL" , prodcal  )  ! Calcite production
+      ENDIF
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmicro.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 1970)
@@ -70,8 +70,4 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zgrazmf, zgrazsf, zgrazpf
       CHARACTER (len=25) :: charout
-#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
-      REAL(wp) :: zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
-#endif
 
       !!---------------------------------------------------------------------
@@ -88,4 +84,7 @@
       zgrazpf(:,:,:) = 0.
 
+#if defined key_trc_dia3d
+      grazing(:,:,:) = 0.  !: Initialisation of  grazing
+#endif
 
       zstep = rfact2 / rday      ! Time step duration for biology
@@ -156,4 +155,8 @@
       END DO
       
+#if defined key_trc_dia3d
+      ! Grazing by microzooplankton
+      grazing(:,:,:) = grazing(:,:,:) + zgrazp(:,:,:) + zgrazm(:,:,:) + zgrazsd(:,:,:) 
+#endif
 
       DO jk = 1,jpkm1
@@ -231,15 +234,9 @@
       END DO
       !
-#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
-      zrfact2 = 1.e3 * rfact2r
-      zw3d(:,:,:) = ( zgrazp(:,:,:) + zgrazm(:,:,:) + zgrazsd(:,:,:) ) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Graz" , zw3d )
-#endif
-
-       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
          WRITE(charout, FMT="('micro')")
          CALL prt_ctl_trc_info(charout)
          CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-       ENDIF
+      ENDIF
 
    END SUBROUTINE p4z_micro
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zopt.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 1970)
@@ -61,8 +61,4 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zekg, zekr, zekb
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze1 , ze2 , ze3, ze0
-#if defined key_trc_diaadd && defined key_iomput
-     REAL(wp), DIMENSION(jpi,jpj)      ::   zw2d
-     REAL(wp), DIMENSION(jpi,jpj,jpk)  ::   zw3d
-#endif
       !!---------------------------------------------------------------------
 
@@ -238,8 +234,8 @@
 # else
       ! write diagnostics 
-      zw2d(:,:  ) =  heup(:,:  ) * tmask(:,:,1)
-      zw3d(:,:,:) =  etot(:,:,:) * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Heup", zw2d )               
-      IF( jnt == nrdttrc ) CALL iom_put( "PAR" , zw3d )
+      IF( jnt == nrdttrc ) then 
+         CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
+         CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
+      ENDIF
 # endif
 #endif
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zprod.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 1970)
@@ -81,7 +81,4 @@
 #if defined key_trc_diaadd && defined key_trc_dia3d
       REAL(wp) ::   zrfact2
-#if  defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
-#endif
 #endif
       REAL(wp), DIMENSION(jpi,jpj)     ::   zmixnano   , zmixdiat, zstrn
@@ -352,12 +349,11 @@
         WRITE(numout,*) 'Total PP :'
         WRITE(numout,*) '-------------------- : ',tpp * 12. / 1.E12
-        WRITE(numout,*) '(GtC/an)'
+        WRITE(numout,*) '(GtC/yr)'
         tpp = 0.
       ENDIF
 
-#if defined key_trc_diaadd && defined key_trc_dia3d
+#if defined key_trc_diaadd && defined key_trc_dia3d && ! defined key_iomput
+      !   Supplementary diagnostics
       zrfact2 = 1.e3 * rfact2r
-      !   Supplementary diagnostics
-#  if ! defined key_iomput
       trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
@@ -366,24 +362,20 @@
       trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
-#if ! defined key_kriest
+#  if ! defined key_kriest
       trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
+#  endif
 #endif
 
-# else
-      zw3d(:,:,:) = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPPHY" , zw3d )
-      zw3d(:,:,:) = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPPHY2", zw3d )
-      zw3d(:,:,:) = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPNEWN" , zw3d )
-      zw3d(:,:,:) = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PPNEWD", zw3d )
-      zw3d(:,:,:) = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PBSi"  , zw3d )
-      zw3d(:,:,:) = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PFeD"  , zw3d )
-      zw3d(:,:,:) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PFeN"  , zw3d )
-# endif
+#if defined key_trc_diaadd && defined key_trc_dia3d && defined key_iomput
+      zrfact2 = 1.e3 * rfact2r
+      IF ( jnt == nrdttrc ) then
+         CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
+         CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
+         CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
+         CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
+         CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
+         CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
+         CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
+      ENDIF
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsed.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 1970)
@@ -96,5 +96,4 @@
       REAL(wp) :: zrfact2
 # if defined key_iomput
-     REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d 
      REAL(wp), DIMENSION(jpi,jpj)    ::    zw2d 
 # endif
@@ -332,12 +331,11 @@
       trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zrfact2 * fse3t(:,:,1) * tmask(:,:,1)
 # else
-      ! write diagnostics
-      zw2d(:,:)   =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) &
-      &            * zrfact2 * fse3t(:,:,1) * tmask(:,:,1)     
+      ! surface downward net flux of iron
+      zw2d(:,:)   =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zrfact2 * fse3t(:,:,1) * tmask(:,:,1) 
       IF( jnt == nrdttrc ) CALL iom_put( "Irondep", zw2d )
-      zw3d(:,:,:) = znitrpot(:,:,:) * 1.e-7 * zrfact2  * fse3t(:,:,:) * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Nfix", zw3d  ) 
-# endif
-
+      ! nitrogen fixation at surface
+      zw2d(:,:)   =  znitrpot(:,:,1) * 1.e-7 * zrfact2  * fse3t(:,:,1) * tmask(:,:,1)
+      IF( jnt == nrdttrc ) CALL iom_put( "Nfix" , zw2d )
+# endif
 # endif
       !
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 1970)
@@ -99,8 +99,5 @@
 #if defined key_trc_diaadd
       REAL(wp) :: zrfact2
-      INTEGER  :: iksed1
-#if defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
-#endif
+      INTEGER  :: ik1
 #endif
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znum3d
@@ -286,11 +283,11 @@
 #if defined key_trc_diaadd
       zrfact2 = 1.e3 * rfact2r
-      iksed1 = iksed + 1
+      ik1 = iksed + 1
 #  if ! defined key_iomput
-      trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,iksed1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
       trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:)
       trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:)
@@ -301,28 +298,18 @@
       trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:)
 #else
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PMO" , zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "PMO2", zw3d )
-      zw3d(:,:,:)  = sinkfer (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe1", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpSi", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpCaCO3", zw3d )
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "POCFlx", zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "GOCFlx", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "SiFlx", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "CaCO3Flx", zw3d )
-      zw3d(:,:,:)  = znum3d  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "xnum", zw3d )
-      zw3d(:,:,:)  = wsbio3  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "W1", zw3d )
-      zw3d(:,:,:)  = wsbio4  (:,:,:)           * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "W2", zw3d )
+      IF( jnt == nrdttrc ) then
+        CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export
+        CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export
+        CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export
+        CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export
+        CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats
+        CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC
+        CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats
+        CALL iom_put( "PMO"     , sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! POC export at 100m
+        CALL iom_put( "PMO2"    , sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Num export at 100m
+        CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m
+        CALL iom_put( "ExpSi"   , sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m
+        CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m
+     ENDIF
 #  endif
 
@@ -489,8 +476,5 @@
 #if defined key_trc_dia3d
       REAL(wp) ::   zrfact2
-      INTEGER  ::   iksed1
-#endif
-#if defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zw3d
+      INTEGER  ::   ik1
 #endif
       CHARACTER (len=25) :: charout
@@ -613,26 +597,20 @@
 #if defined key_trc_diaadd
       zrfact2 = 1.e3 * rfact2r
-      iksed1 = iksed + 1
+      ik1  = iksed + 1
 #  if ! defined key_iomput
-      trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,iksed1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,iksed1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+      trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
 #  else
-      zw3d(:,:,:)  = sinking (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpPOC" , zw3d )
-      zw3d(:,:,:)  = sinking2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpGOC", zw3d )
-      zw3d(:,:,:)  = sinkfer (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe1", zw3d )
-      zw3d(:,:,:)  = sinkfer2(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpFe2", zw3d )
-      zw3d(:,:,:)  = sinksil (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "ExpSi", zw3d )
-      zw3d(:,:,:)  = sinkcal (:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) CALL iom_put( "Expcal", zw3d )
-#  endif
+      IF( jnt == nrdttrc )  then
+         CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m
+         CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m
+         CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m
+         CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m
+      ENDIF
+#endif
 #endif
       !
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 1970)
@@ -64,4 +64,5 @@
 #if defined key_trc_dia3d
    REAL(wp), DIMENSION(jpi,jpj,jpk) ::   prodcal    !: Calcite production
+   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   grazing    !: Total zooplankton grazing
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 1970)
@@ -263,7 +263,5 @@
 #if defined key_dtatrc
       ! Restore close seas values to initial data
-      nmonth = 1
-      nday   = 1
-      CALL trc_dta( nittrc000) 
+      CALL trc_dta( nittrc000 ) 
       DO jn = 1, jptra
          IF( lutini(jn) ) THEN
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/par_trc.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/par_trc.F90	(revision 1970)
@@ -18,6 +18,6 @@
    USE par_lobster   ! LOBSTER model
    USE par_pisces    ! PISCES  model
+   USE par_c14b      ! C14 bomb tracer
    USE par_cfc       ! CFC 11 and 12 tracers
-   USE par_c14b      ! C14 bomb tracer 
    USE par_my_trc    ! user defined passive tracers
 
@@ -27,9 +27,9 @@
    ! Passive tracers : Total size
    ! ---------------               ! total number of passive tracers, of 2d and 3d output and trend arrays
-   INTEGER, PUBLIC, PARAMETER ::   jptra    =  jp_lobster    + jp_pisces     + jp_cfc     + jp_c14b     + jp_my_trc
-   INTEGER, PUBLIC, PARAMETER ::   jpdia2d  =  jp_lobster_2d + jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d  + jp_my_trc_2d
-   INTEGER, PUBLIC, PARAMETER ::   jpdia3d  =  jp_lobster_3d + jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d  + jp_my_trc_3d
+   INTEGER, PUBLIC, PARAMETER ::   jptra    =  jp_lobster    + jp_pisces     + jp_cfc     + jp_my_trc
+   INTEGER, PUBLIC, PARAMETER ::   jpdia2d  =  jp_lobster_2d + jp_pisces_2d  + jp_cfc_2d  + jp_my_trc_2d
+   INTEGER, PUBLIC, PARAMETER ::   jpdia3d  =  jp_lobster_3d + jp_pisces_3d  + jp_cfc_3d  + jp_my_trc_3d
    !                     ! total number of sms diagnostic arrays
-   INTEGER, PUBLIC, PARAMETER ::   jpdiabio = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_c14b_trd + jp_my_trc_trd
+   INTEGER, PUBLIC, PARAMETER ::   jpdiabio = jp_lobster_trd + jp_pisces_trd + jp_cfc_trd + jp_my_trc_trd
    
    !  1D configuration ("key_c1d")
@@ -40,18 +40,34 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_trc_c1d   = .FALSE.  !: 1D pass. tracer configuration flag
 # endif
-
    ! Passive tracers : size for TRP trends diagnotics (used if 'key_trc_diatrd' defined)
-#if defined key_trcldf_eiv
-# if defined key_trcdmp
-   INTEGER, PARAMETER :: jpdiatrc = 11      !: trends: 3*(advection + diffusion + eiv ) + damping + sms
-# else
-   INTEGER, PARAMETER :: jpdiatrc = 10      !: trends: 3*(advection + diffusion + eiv )           + sms
-# endif
-#else
-# if defined key_trcdmp
-   INTEGER, PARAMETER :: jpdiatrc =  8      !: trends: 3*(advection + diffusion       ) + damping + sms
-# else
-   INTEGER, PARAMETER :: jpdiatrc =  7      !: trends: 3*(advection + diffusion       ) + damping + sms
-# endif
+# if defined key_trc_diatrd
+   ! Passive tracers : size for TRP trends diagnotics (used if 'key_trc_diatrd' defined)
+   INTEGER, PARAMETER ::   jptrc_xad     =  1   !: x- horizontal advection
+   INTEGER, PARAMETER ::   jptrc_yad     =  2   !: y- horizontal advection
+   INTEGER, PARAMETER ::   jptrc_zad     =  3   !: z- vertical   advection
+   INTEGER, PARAMETER ::   jptrc_xdf     =  4   !: lateral       diffusion
+   INTEGER, PARAMETER ::   jptrc_ydf     =  5   !: lateral       diffusion
+   INTEGER, PARAMETER ::   jptrc_zdf     =  6   !: vertical diffusion (Kz)
+   INTEGER, PARAMETER ::   jptrc_sbc     =  7   !: surface boundary condition
+#if ! defined key_trcldf_eiv && ! defined key_trcdmp
+   INTEGER, PARAMETER ::   jpdiatrc      =  7  !: trends: 3*(advection + diffusion       ) + sbc
+#endif
+#if defined key_trcldf_eiv && defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_xei     =  8   !: x- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_yei     =  9   !: y- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_zei     = 10   !: z- vert.  EIV advection
+   INTEGER, PARAMETER ::   jptrc_dmp     = 11   !: damping
+   INTEGER, PARAMETER ::   jpdiatrc      = 11   !: trends: 3*(advection + diffusion + eiv ) + sbc + damping
+#endif
+#if defined key_trcldf_eiv && ! defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_xei     =  8   !: x- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_yei     =  9   !: y- horiz. EIV advection
+   INTEGER, PARAMETER ::   jptrc_zei     = 10   !: z- vert.  EIV advection
+   INTEGER, PARAMETER ::   jpdiatrc      = 10   !: trends: 3*(advection + diffusion + eiv ) + sbc 
+#endif
+#if ! defined key_trcldf_eiv && defined key_trcdmp
+   INTEGER, PARAMETER ::   jptrc_dmp     =  8   !: damping
+   INTEGER, PARAMETER ::   jpdiatrc      =  8   !: trends: 3*(advection + diffusion       ) + sbc + damping
+#endif
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcdia.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcdia.F90	(revision 1970)
@@ -25,4 +25,5 @@
    USE trc
    USE trp_trc
+   USE par_trc
    USE trdmld_trc_oce, ONLY : luttrd
    USE dianam    ! build name of file (routine)
@@ -41,5 +42,5 @@
    INTEGER  ::   ndimt50   !: number of ocean points in index array
    INTEGER  ::   ndimt51   !: number of ocean points in index array
-   REAL(wp) ::   xjulian   !: ????   not DOCTOR !
+   REAL(wp) ::   zjulian   !: ????   not DOCTOR !
    INTEGER , DIMENSION (jpij*jpk) ::   ndext50   !: integer arrays for ocean 3D index
    INTEGER , DIMENSION (jpij)     ::   ndext51   !: integer arrays for ocean surface index
@@ -157,10 +158,10 @@
 
          ! Compute julian date from starting date of the run
-         CALL ymds2ju( nyear, nmonth, nday, rdt, xjulian )
-         xjulian = xjulian - adatrj   !   set calendar origin to the beginning of the experiment
+         CALL ymds2ju( nyear, nmonth, nday, rdt, zjulian )
+         zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment
          IF(lwp)WRITE(numout,*)' '  
          IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000                         &
             &                 ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday   &
-            &                 ,'Julian day : ', xjulian  
+            &                 ,'Julian day : ', zjulian  
   
          IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
@@ -171,5 +172,5 @@
          IF(lwp) THEN
             CALL dia_nam( clhstnam, nwritetrc,' ' )
-            CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea )
+            CALL ctlopn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', 1, numout, lwp, narea )
             WRITE(inum,*) clhstnam
             CLOSE(inum)
@@ -184,5 +185,5 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     &
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
-            &          nittrc000-ndttrc, xjulian, zdt, nhorit5, nit5 , domain_id=nidom)
+            &          nittrc000-ndttrc, zjulian, zdt, nhorit5, nit5 , domain_id=nidom)
 
          ! Vertical grid for tracer : gdept
@@ -258,5 +259,5 @@
       CHARACTER (len=80) ::   cltral
       CHARACTER (len=10) ::   csuff
-      INTEGER  ::   jn, jl
+      INTEGER  ::   jn, jl, ikn
       INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod
       REAL(wp) ::   zsto, zout, zdt
@@ -313,5 +314,5 @@
                CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,       &
                   &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,   &
-                  &          nittrc000-ndttrc, xjulian, zdt, nhorit6(jn),  &
+                  &          nittrc000-ndttrc, zjulian, zdt, nhorit6(jn),  &
                   &          nit6(jn) , domain_id=nidom )
 
@@ -322,80 +323,68 @@
 
           ! Declare all the output fields as NETCDF variables
-
-          ! trends for tracer concentrations
           DO jn = 1, jptra
             IF( luttrd(jn) ) THEN
                 DO jl = 1, jpdiatrc
-                  IF( jl == 1 ) THEN
+                  IF( jl == jptrc_xad ) THEN
                       ! short and long title for x advection for tracer
                       WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("X advective trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF( jl == 2 ) THEN
+                      WRITE (cltral,'("X advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_yad ) THEN
                       ! short and long title for y advection for tracer
                       WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Y advective trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF( jl == 3 ) THEN
+                      WRITE (cltral,'("Y advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_zad ) THEN
                       ! short and long title for Z advection for tracer
                       WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Z advective trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF( jl == 4 ) THEN
+                      WRITE (cltral,'("Z advective trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_xdf ) THEN
                       ! short and long title for X diffusion for tracer
                       WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("X diffusion trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF( jl == 5 ) THEN
+                      WRITE (cltral,'("X diffusion trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_ydf ) THEN
                       ! short and long title for Y diffusion for tracer
                       WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Y diffusion trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
-                  END IF
-                  IF( jl == 6 ) THEN
+                      WRITE (cltral,'("Y diffusion trend for ",58a)') ctrcnl(jn)(1:58)
+                  END IF
+                  IF( jl == jptrc_zdf ) THEN
                       ! short and long title for Z diffusion for tracer
                       WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Z diffusion trend for ",58a)')  &
-                         &      ctrcnl(jn)(1:58)
+                      WRITE (cltral,'("Z diffusion trend for ",58a)') ctrcnl(jn)(1:58)
                   END IF
 # if defined key_trcldf_eiv
-                  IF( jl == 7 ) THEN
+                  IF( jl == jptrc_xei ) THEN
                       ! short and long title for x gent velocity for tracer
                       WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("X gent velocity trend for ",53a)')  &
-                         &      ctrcnl(jn)(1:53)
-                  END IF
-                  IF( jl == 8 ) THEN
+                      WRITE (cltral,'("X gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == jptrc_yei ) THEN
                       ! short and long title for y gent velocity for tracer
                       WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Y gent velocity trend for ",53a)')  &
-                         &      ctrcnl(jn)(1:53)
-                  END IF
-                  IF( jl == 9 ) THEN
+                      WRITE (cltral,'("Y gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
+                  END IF
+                  IF( jl == jptrc_zei ) THEN
                       ! short and long title for Z gent velocity for tracer
                       WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Z gent velocity trend for ",53a)')  &
-                         &      ctrcnl(jn)(1:53)
+                      WRITE (cltral,'("Z gent velocity trend for ",53a)') ctrcnl(jn)(1:53)
                   END IF
 # endif
 # if defined key_trcdmp
-                  IF( jl == jpdiatrc - 1 ) THEN
+                  IF( jl == jptrc_dmp ) THEN
                       ! last trends for tracer damping : short and long title
                       WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Tracer damping trend for ",55a)')  &
-                         &      ctrcnl(jn)(1:55)
-                  END IF
-# endif
-                  IF( jl == jpdiatrc ) THEN
+                      WRITE (cltral,'("Tracer damping trend for ",55a)') ctrcnl(jn)(1:55)
+                  END IF
+# endif
+                  IF( jl == jptrc_sbc ) THEN
                       ! last trends for tracer damping : short and long title
                       WRITE (cltra,'("SBC_",16a)') ctrcnm(jn)
-                      WRITE (cltral,'("Surface boundary flux ",58a)')  &
-                      &      ctrcnl(jn)(1:58)
-                  END IF
-
+                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55)
+                  END IF
+                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55)
+                  END IF
                   CALL FLUSH( numout )
                   cltrau = ctrcun(jn)      ! UNIT for tracer /trends
@@ -406,5 +395,4 @@
             END IF
          END DO
-
          ! CLOSE netcdf Files
           DO jn = 1, jptra
@@ -432,23 +420,24 @@
       DO jn = 1, jptra
          IF( luttrd(jn) ) THEN
+            ikn = ikeep(jn) 
             DO jl = 1, jpdiatrc
-               ! short titles 
-               IF( jl == 1)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)      ! x advection for tracer
-               IF( jl == 2)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)      ! z advection for tracer
-               IF( jl == 3)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)      ! z advection for tracer
-               IF( jl == 4)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)      ! x diffusion for tracer
-               IF( jl == 5)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)      ! y diffusion for tracer
-               IF( jl == 6)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)      ! z diffusion for tracer
+               ! short titles
+               IF( jl == jptrc_xad)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_yad)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zad)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_xdf)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_ydf)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zdf)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)
 # if defined key_trcldf_eiv
-               IF( jl == 7)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)      ! x gent velocity for tracer
-               IF( jl == 8)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)      ! y gent velocity for tracer
-               IF( jl == 9)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)      ! z gent velocity for tracer
+               IF( jl == jptrc_xei)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_yei)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)
+               IF( jl == jptrc_zei)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)
 # endif
 # if defined key_trcdmp
-               IF( jl == jpdiatrc - 1 )   WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)      ! damping
-# endif
-               IF( jl == jpdiatrc )   WRITE (cltra,'("SBC_",a)') ctrcnm(jn)      ! surface boundary conditions
+               IF( jl == jptrc_dmp )  WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)
+# endif
+               IF( jl == jptrc_sbc )  WRITE (cltra,'("SBC_",16a)') ctrcnm(jn)
                !
-               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl),ndimt50, ndext50)
+               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikn,jl),ndimt50, ndext50)
             END DO
          END IF
@@ -552,5 +541,5 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             &
             &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
-            &          nittrc000-ndttrc, xjulian, zdt, nhoritd, nitd , domain_id=nidom )
+            &          nittrc000-ndttrc, zjulian, zdt, nhoritd, nitd , domain_id=nidom )
 
          ! Vertical grid for 2d and 3d arrays
@@ -700,5 +689,5 @@
          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,      &
             &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          &
-            &    nittrc000-ndttrc, xjulian, zdt, nhoritb, nitb , domain_id=nidom )
+            &    nittrc000-ndttrc, zjulian, zdt, nhoritb, nitb , domain_id=nidom )
          ! Vertical grid for biological trends
          CALL histvert(nitb, 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepitb)
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcini.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcini.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcini.F90	(revision 1970)
@@ -122,8 +122,7 @@
          trb(:,:,:,:) = trn(:,:,:,:)
       ELSE
+         !
          CALL trc_rst_read      ! restart from a file
-#if defined key_off_tra
-         CALL day_init          ! calendar
-#endif
+         !
       ENDIF
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcrst.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcrst.F90	(revision 1970)
@@ -33,5 +33,7 @@
    USE trcrst_c14b     ! C14 bomb restart
    USE trcrst_my_trc   ! MY_TRC   restart
-
+#if defined key_off_tra
+    USE daymod
+#endif
    IMPLICIT NONE
    PRIVATE
@@ -277,4 +279,7 @@
            WRITE(numout,*)
          ENDIF
+         !
+         CALL day_init          ! compute calendar
+         !
 #endif
 
Index: /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcwri.F90
===================================================================
--- /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcwri.F90	(revision 1969)
+++ /branches/DEV_r1784_mid_year_merge_2010/NEMO/TOP_SRC/trcwri.F90	(revision 1970)
@@ -1,9 +1,9 @@
 MODULE trcwri
-   !!======================================================================
+   !!===================================================================================
    !!                       *** MODULE trcwri ***
-   !!    TOP :   Output of passive tracers 
-   !!======================================================================
-   !!             1.0  !  
-   !!                  !  2009-05 (C. Ethe )
+   !!    TOP :   Output of passive tracers
+   !!====================================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!                  !  2010-03 (C. Ethe, R. Seferian ) Add the tracer transport trends
    !!----------------------------------------------------------------------
 #if defined key_top &&  defined key_iomput
@@ -11,7 +11,12 @@
    !!   'key_top' && 'key_iomput'                              TOP models
    !!----------------------------------------------------------------------
-   !! trc_wri     :  outputs of concentration fields
+   !! trc_wri_trc   :  outputs of concentration fields
+   !! trc_wri_trd   :  outputs of transport trends
    !!----------------------------------------------------------------------
+   USE dom_oce         ! ocean space and time domain variables
+   USE oce_trc
+   USE trp_trc
    USE trc
+   USE trdmld_trc_oce, ONLY : luttrd
    USE iom
 #if defined key_off_tra
@@ -35,7 +40,24 @@
 CONTAINS
 
-   SUBROUTINE trc_wri( kt )  
+   SUBROUTINE trc_wri( kt )
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE trc_wri  ***
+      !! 
+      !! ** Purpose :   output passive tracers fields and dynamical trends
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT( in ) :: kt
+      !!---------------------------------------------------------------------
+
+      !
+      CALL iom_setkt  ( kt + ndttrc - 1 )       ! set the passive tracer time step
+      CALL trc_wri_trc( kt              )       ! outputs for tracer concentration
+      CALL trc_wri_trd( kt              )       ! outputs for dynamical trends
+      CALL iom_setkt  ( kt              )       ! set the model time step
+      !
+   END SUBROUTINE trc_wri
+
+   SUBROUTINE trc_wri_trc( kt )  
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
       !!
       !! ** Purpose :   output passive tracers fields 
@@ -43,17 +65,11 @@
       INTEGER, INTENT( in ) :: kt       ! ocean time-step
       INTEGER               :: jn
-      CHARACTER (len=20)    :: cltra
+      CHARACTER (len=20)    :: cltra, cltras
 #if defined key_off_tra
       CHARACTER (len=40) :: clhstnam
       INTEGER ::   inum = 11            ! temporary logical unit
 #endif
-
       !!---------------------------------------------------------------------
  
-      ! Initialisation
-      ! --------------
-
-      CALL iom_setkt( kt + ndttrc - 1 ) ! set the passive tracer time step
-
 #if defined key_off_tra
       IF( kt == nittrc000 ) THEN
@@ -67,6 +83,4 @@
       ENDIF
 #endif
-
-
       ! write the tracer concentrations in the file
       ! ---------------------------------------
@@ -76,9 +90,53 @@
       END DO
       !
-      CALL iom_setkt( kt )       ! set the model time step
+   END SUBROUTINE trc_wri_trc
 
+# if defined key_trc_diatrd
+
+   SUBROUTINE trc_wri_trd( kt )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trd  ***
+      !!
+      !! ** Purpose :   output of passive tracer : advection-diffusion trends
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
+      !!
+      CHARACTER (len=3) ::   cltra
+      INTEGER  ::   jn, jl, ikn
+      !!----------------------------------------------------------------------
+
+      DO jn = 1, jptra
+         IF( luttrd(jn) ) THEN
+            ikn = ikeep(jn)
+            DO jl = 1, jpdiatrc
+               IF( jl == jptrc_xad ) WRITE (cltra,"(3a)") 'XAD' ! x advection for tracer
+               IF( jl == jptrc_yad ) WRITE (cltra,"(3a)") 'YAD'  ! y advection for tracer
+               IF( jl == jptrc_zad ) WRITE (cltra,"(3a)") 'ZAD'  ! z advection for tracer
+               IF( jl == jptrc_xdf ) WRITE (cltra,"(3a)") 'XDF'  ! x diffusion for tracer
+               IF( jl == jptrc_ydf ) WRITE (cltra,"(3a)") 'YDF'  ! y diffusion for tracer
+               IF( jl == jptrc_zdf ) WRITE (cltra,"(3a)") 'ZDF'  ! z diffusion for tracer
+# if defined key_trcldf_eiv
+               IF( jl == jptrc_xei ) WRITE (cltra,"(3a)") 'XGV'  ! x gent velocity for tracer
+               IF( jl == jptrc_yei ) WRITE (cltra,"(3a)") 'YGV'  ! y gent velocity for tracer
+               IF( jl == jptrc_zei ) WRITE (cltra,"(3a)") 'ZGV'  ! z gent velocity for tracer
+# endif
+# if defined key_trcdmp
+               IF( jl == jptrc_dmp ) WRITE (cltra,"(3a)") 'DMP'  ! damping
+# endif
+               IF( jl == jptrc_sbc ) WRITE (cltra,"(3a)") 'SBC'  ! surface boundary conditions
+               ! write the trends
+               CALL iom_put( cltra, trtrd(:,:,:,ikn,jl) )
+            END DO
+         END IF
+      END DO
       !
-   END SUBROUTINE trc_wri
+   END SUBROUTINE trc_wri_trd
 
+# else
+   SUBROUTINE trc_wri_trd( kt )                      ! Dummy routine
+      INTEGER, INTENT ( in ) ::   kt
+   END SUBROUTINE trc_wri_trd
+#endif
 #else
    !!----------------------------------------------------------------------
@@ -90,5 +148,4 @@
    INTEGER, INTENT(in) :: kt
    END SUBROUTINE trc_wri
-
 #endif
 
