Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.card
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.card	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.card	(revision 1764)
@@ -21,8 +21,8 @@
 
 [OutputFiles]
-List=   (${PREFIX_NWRITE}_${DATE_OPA}_icemod.nc, ${R_OUT_ICE_NWRITE}/${PREFIX}_${WF1}_icemod.nc, Post_1M_icemod)
+List=   (${PREFIX_WFI1}_icemod.nc, ${R_OUT_ICE_WFI1}/${PREFIX}_${WFI1}_icemod.nc, Post_5D_icemod)
 
 [Post_1M_icemod]
 Patches = ()
-GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
+GatherWithInternal = (nav_lon, nav_lat, time_counter)
 TimeSeriesVars = (iicethic, ileadfra, isnowthi, iicevelu, iicevelv)
Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.driver
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.driver	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/lim2.driver	(revision 1764)
@@ -16,4 +16,29 @@
     IGCM_debug_PushStack "ICE_Update"
 
+    NbFreq=$( echo ${config_ICE_WriteFrequency} | wc -w )
+
+    ##--Write Frequency Purpose ....
+    typeset -Z1 i=1
+    while [ $i -le ${NbFreq} ]; do
+        frequency=$( echo ${config_ICE_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
+        factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
+        case ${frequency} in
+            *Y|*y)
+                eval PREFIX_WFI${i}=${config_UserChoices_JobName}_${factor}y_${DatesPeriod} ;
+                eval R_OUT_ICE_WFI${i}=${R_OUT_ICE_O_Y} ;
+                eval WFI${i}=${factor}Y ;;
+            *M|*m)
+                eval PREFIX_WFI${i}=${config_UserChoices_JobName}_${factor}m_${DatesPeriod} ;
+                eval R_OUT_ICE_WFI${i}=${R_OUT_ICE_O_M} ;
+                eval WFI${i}=${factor}M ;;
+            *D|*d)
+                eval PREFIX_WFI${i}=${config_UserChoices_JobName}_${factor}d_${DatesPeriod} ;
+                eval R_OUT_ICE_WFI${i}=${R_OUT_ICE_O_D} ;
+                eval WFI${i}=${factor}D ;;
+            *)
+        esac
+        let i=$i+1
+
+    done
     echo UPDATE ICE !!!
 
Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.card
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.card	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.card	(revision 1764)
@@ -6,11 +6,16 @@
 #==============================================================
 #-- Name of directory for COMMON ACCOUNT at idris or CCRT
-#-- available directories are:  v3, v3_1
-#-- related to NEMO_tag_revision (nemo_v3, nemo_v3_1)
+#-- available directories are:  v3, v3_1, v3_2
+#-- related to NEMO_tag_revision (nemo_v3, nemo_v3_1, nemo_v3_2_beta)
 #-- NOTE: if you use your own directory you have to comment it
-OPA_version=v3_1
+OPA_version=v3_2
 #==============================================================
 
-#-- if you run interannual is "y", if not is "n"
+#===================================
+#-- Use (y) or not (n) of io_server
+io_server=n
+#===================================
+
+#-- if you run interannual is "y", if not (=climatology) is "n"
 Interannual_Run=n
 
@@ -24,5 +29,8 @@
 #-- MANDATORY: NAMES USED IN List_jobsbc VARIABLE MUST BE ONLY THE BASENAME
 
-List_jobsbc=(taux_1m, tauy_1m, flx)
+# default climatology, bulk_clio: 
+List_jobsbc=(flx, taux_1m, tauy_1m)
+# example for interannual, bulk core:
+#List_jobsbc=(radlw_DFS4-ORCA2, radsw_DFS4-ORCA2, q2_DFS4-ORCA2, t2_DFS4-ORCA2, u10_DFS4-ORCA2, v10_DFS4-ORCA2, snow_DFS4-ORCA2, precip_DFS4-ORCA2)
 
 #==========================================================================================
@@ -33,5 +41,8 @@
 #-- 2) leave List_runsbc empty so NEMO will read file names specified in List_jobsbc variable above
 
+# default climatology, bulk_clio: 
 List_runsbc=()
+# example for interannual, bulk core:
+#List_runsbc=(qlw_core, qsw_core, q2_core, t2_core, u10_core, v10_core, snow_core, precip_core)
 
 [InitialStateFiles]
@@ -53,6 +64,9 @@
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/subbasins.nc, .)
 
+
 [ParametersFiles]
-List=	(${SUBMIT_DIR}/PARAM/namelist, namelist)
+List=	(${SUBMIT_DIR}/PARAM/namelist,         namelist), \
+	(${SUBMIT_DIR}/PARAM/iodef.xml,        iodef.xml),      \
+        (${SUBMIT_DIR}/PARAM/xmlio_server.def, xmlio_server.def)
 
 [RestartFiles]
@@ -60,34 +74,59 @@
 
 [OutputText]
-List=   (ocean.output, solver.stat, STRAIT.dat)
+List=   (ocean.output, solver.stat, STRAIT.dat, out_nemo)
 
 [OutputFiles]
-List=   (${PREFIX_NWRITE}_${DATE_OPA}_grid_T.nc, ${R_OUT_OCE_NWRITE}/${PREFIX}_${WF1}_grid_T.nc, Post_1M_grid_T),\
-        (${PREFIX_NWRITE}_${DATE_OPA}_grid_U.nc, ${R_OUT_OCE_NWRITE}/${PREFIX}_${WF1}_grid_U.nc, Post_1M_grid_U) ,\
-        (${PREFIX_NWRITE}_${DATE_OPA}_grid_V.nc, ${R_OUT_OCE_NWRITE}/${PREFIX}_${WF1}_grid_V.nc, Post_1M_grid_V),\
-        (${PREFIX_NWRITE}_${DATE_OPA}_grid_W.nc, ${R_OUT_OCE_NWRITE}/${PREFIX}_${WF1}_grid_W.nc, Post_1M_grid_W),\
-        (damping.coeff.nc , ${R_OUT_OCE_NWRITE}/${PREFIX}_damping.coeff.nc, NONE),\
-        (mesh_mask.nc     , ${R_OUT_OCE_O}/${config_UserChoices_JobName}_mesh_mask.nc, NONE),\
-        (output.abort.nc  , ${R_OUT_OCE_D}/${PREFIX}_output.abort.nc, NONE),\
-        (output.init.nc   , ${R_OUT_OCE_O_I}/${config_UserChoices_JobName}_${PeriodDateBegin}_output.init.nc, NONE)
+List=   (${PREFIX_WF1}_grid_T.nc,         ${R_OUT_OCE_WF1}/${PREFIX}_${WF1}_grid_T.nc,               Post_1Y_grid_T),\
+        (${PREFIX_WF2}_grid_T.nc,         ${R_OUT_OCE_WF2}/${PREFIX}_${WF2}_grid_T.nc,               Post_1M_grid_T),\
+        (${PREFIX_WF3}_grid_T.nc,         ${R_OUT_OCE_WF3}/${PREFIX}_${WF3}_grid_T.nc,               Post_5D_grid_T),\
+        (${PREFIX_WF3}_grid_U.nc,         ${R_OUT_OCE_WF3}/${PREFIX}_${WF3}_grid_U.nc,               Post_5D_grid_U) ,\
+        (${PREFIX_WF3}_grid_V.nc,         ${R_OUT_OCE_WF3}/${PREFIX}_${WF3}_grid_V.nc,               Post_5D_grid_V),\
+        (${PREFIX_WF3}_grid_W.nc,         ${R_OUT_OCE_WF3}/${PREFIX}_${WF3}_grid_W.nc,               Post_5D_grid_W),\
+        (${PREFIX_WF4}_grid_T_0n180w.nc,  ${R_OUT_OCE_WF4}/${PREFIX}_${WF4}_grid_T_0n180w.nc,        NONE ),\
+        (${PREFIX_WF4}_grid_T_Eq.nc,      ${R_OUT_OCE_WF4}/${PREFIX}_${WF4}_grid_T_Eq.nc,            NONE ),\
+        (${PREFIX_WF4}_diaptr.nc,         ${R_OUT_OCE_WF4}/${PREFIX}_${WF4}_diaptr.nc,               Post_1D_diaptr),\
+        (mesh_mask.nc     ,               ${R_OUT_OCE_O}/${config_UserChoices_JobName}_mesh_mask.nc, NONE),\
+        (output.abort.nc  ,               ${R_OUT_OCE_D}/${PREFIX}_output.abort.nc,                  NONE),\
+        (output.init.nc   ,               ${R_OUT_OCE_O_I}/${config_UserChoices_JobName}_${PeriodDateBegin}_output.init.nc, NONE)
 
 
 [Post_1M_grid_T]
-Patches = ()
+Patches = (Patch_20091030_histcom_time_axis)
 GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
 TimeSeriesVars = (sohtc300, sohefldo, soicecov, somxl010, sosaline, sossheig, sosstsst, sowaflcd, sowaflup)
 
-[Post_1M_grid_U]
-Patches = ()
+[Post_1Y_grid_T]
+Patches = (Patch_20091030_histcom_time_axis)
+GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
+TimeSeriesVars = (sohtc300, sohefldo, soicecov, somxl010, sosaline, sossheig, sosstsst, sowaflcd, sowaflup)
+
+[Post_5D_grid_T]
+Patches = (Patch_20091030_histcom_time_axis)
+GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
+TimeSeriesVars = (sohtc300, sohefldo, soicecov, somxl010, sosaline, sossheig, sosstsst, sowaflcd, sowaflup)
+
+[Post_5D_grid_U]
+Patches = (Patch_20091030_histcom_time_axis)
 GatherWithInternal = (nav_lon, nav_lat, depthu, time_counter)
 TimeSeriesVars = (sozotaux)
 
-[Post_1M_grid_V]
-Patches = ()
+[Post_5D_grid_V]
+Patches = (Patch_20091030_histcom_time_axis)
 GatherWithInternal = (nav_lon, nav_lat, depthv, time_counter)
 TimeSeriesVars = (sometauy)
 
-[Post_1M_grid_W]
-Patches = ()
+[Post_5D_grid_W]
+Patches = (Patch_20091030_histcom_time_axis)
 GatherWithInternal = (nav_lon, nav_lat, depthw, time_counter)
 TimeSeriesVars =
+
+[Post_1D_diaptr]
+Patches = ()
+GatherWithInternal = (lat, deptht, depthw, time_counter)
+TimeSeriesVars = (zotemglo, zosalglo, zomsfglo, zotematl, zosalatl, zomsfatl, zotempac, zosalpac, zomsfpac, zotemind, zosalind, zomsfind, zotemipc, zosalipc, zomsfipc, sohtatl, sostatl, sohtpac, sostpac, sohtind, sostind, sohtipc, sostipc, sophtadv, sophtove, sophtldf, sopstadv, sopstove, zomsfeiv, sophteiv, sopsteiv)
+
+[Post_time]
+Patches = (Patch_20091030_histcom_time_axis)
+GatherWithInternal =
+TimeSeriesVars =
+
Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.driver
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.driver	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/opa9.driver	(revision 1764)
@@ -36,5 +36,4 @@
     PAT_NITEND=$( supergrep nn_itend    ${SUBMIT_DIR}/PARAM/namelist )
     PAT_NLEAPY=$( supergrep nn_leapy    ${SUBMIT_DIR}/PARAM/namelist )
-    PAT_NWRITE=$( supergrep nn_write    ${SUBMIT_DIR}/PARAM/namelist )
     PAT_RESTAR=$( supergrep ln_rstart ${SUBMIT_DIR}/PARAM/namelist )
     PAT_NSTOCK=$( supergrep nn_stock    ${SUBMIT_DIR}/PARAM/namelist )
@@ -42,5 +41,4 @@
     PAT_NDATE0=$( supergrep nn_date0    ${SUBMIT_DIR}/PARAM/namelist )
     PAT_NMSH=$(   supergrep nn_msh      ${SUBMIT_DIR}/PARAM/namelist ) 
-    PAT_NF_PTR=$( supergrep nf_ptr_wri ${SUBMIT_DIR}/PARAM/namelist )
     
 
@@ -57,4 +55,8 @@
         set -A ListFormulationRunsbc -- \${opa9_Interannual_Listrunsbc${opa9_Interannual_List_runsbc}[*]}
 
+    ##--Variables used for XMLIO_SERVER configuration file
+	    # using_server: .TRUE.(.FALSE.) to use(bypass) the io_server
+	    PAT_SERVER=$( supergrep using_server ${SUBMIT_DIR}/PARAM/xmlio_server.def )
+	
     IGCM_debug_PopStack "OCE_Initialize"
 }
@@ -138,29 +140,26 @@
 
     ##--Write Frequency Purpose ....
-    frequency=$( echo ${config_OCE_WriteFrequency} | awk "-F " '{print $1}' )
-    factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
-    case ${frequency} in
-	1Y|1y)
-	    (( OPA_NWRITE = OPA_NDT_DAY * factor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}y ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_Y} ;
-	    R_OUT_ICE_NWRITE=${R_OUT_ICE_O_Y} ;
-	    WF1=${factor}Y ;;
-	1M|1m)
-	    (( OPA_NWRITE = OPA_NDT_DAY * factor * $( IGCM_date_DaysInMonth ${year} ${month} ) )) ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}m ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_M} ;
-	    R_OUT_ICE_NWRITE=${R_OUT_ICE_O_M} ;
-	    WF1=${factor}M ;;
-	*D|*d)
-	    (( OPA_NWRITE = OPA_NDT_DAY * factor  ))  ;
-	    PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}d ;
-	    R_OUT_OCE_NWRITE=${R_OUT_OCE_O_D} ;
-	    R_OUT_ICE_NWRITE=${R_OUT_ICE_O_D} ;
-	    WF1=${factor}D ;;
-	*)
-	    (( OPA_NWRITE = 0 ))                                                            ;;
-    esac
-
+    typeset -Z1 i=1
+    while [ $i -le ${NbFreq} ]; do
+        frequency=$( echo ${config_OCE_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
+    	factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
+    	case ${frequency} in
+    	    *Y|*y)
+    	        eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}y_${DatesPeriod} ;
+    	        eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_Y} ;
+    	        eval WF${i}=${factor}Y ;;
+    	    *M|*m)
+    	        eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}m_${DatesPeriod} ;
+    	        eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_M} ;
+    	        eval WF${i}=${factor}M ;;
+    	    *D|*d)
+    	        eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}d_${DatesPeriod} ;
+    	        eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_D} ;
+    	        eval WF${i}=${factor}D ;;
+    	    *)
+    	esac
+        let i=$i+1
+
+    done
     # Period Length In Days between DateBegin and first day of calendar 0001 01 01
     # Needed by OPA namelist to compute correct file names 
@@ -228,5 +227,4 @@
 	-e "s%${PAT_NIT000}%       nn_it000=${OPA_NIT000}%"                    \
 	-e "s%${PAT_NITEND}%       nn_itend=${OPA_NITEND}%"                    \
-	-e "s%${PAT_NWRITE}%       nn_write=${OPA_NWRITE}%"                    \
 	-e "s%${PAT_RESTAR}%       ln_rstart=${OPA_LRSTAR}%"                 \
 	-e "s%${PAT_NSTOCK}%       nn_stock=${OPA_NSTOCK}%"                    \
@@ -235,12 +233,16 @@
 	-e "s%${PAT_NMSH}%         nn_msh=${OPA_NMSH}%"                        \
 	-e "s%${PAT_NLEAPY}%       nn_leapy=${OPA_NLEAPY}%"	              \
-        -e "s%${PAT_NF_PTR}%       nf_ptr_wri=${OPA_NWRITE}%"                \
 	namelist > namelist.tmp
 
     IGCM_sys_Mv namelist.tmp namelist
 
-    echo 'Variables automatically updated in namelists'
-    grep AUTO namelist*
-
+    # update xmlio_server.def
+
+    if [ X${opa9_UserChoices_io_server} = Xy ] ; then
+        sed -e "s/${PAT_SERVER}/  using_server = .TRUE./" \
+        xmlio_server.def > xmlio_server.def.tmp
+        IGCM_sys_Mv xmlio_server.def.tmp xmlio_server.def
+    fi
+	
     IGCM_debug_PopStack "OCE_Update"
 }
Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.card
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.card	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.card	(revision 1764)
@@ -14,5 +14,5 @@
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_NO3_nomask.nc, .), \
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_PO4_nomask.nc, .), \
-            (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_Si_nomask.nc, .), \
+            (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_Si_nomask.nc,  .), \
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_DOC_nomask.nc, .), \
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/data_1m_Fer_nomask.nc, .), \
@@ -21,9 +21,9 @@
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/bathy.orca.nc, .), \
             (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/river.orca.nc, .), \
-            (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/ndeposition.orca.nc, .), \
+            (${R_BC}/OCE/${config_UserChoices_TagName}/${opa9_UserChoices_OPA_version}/ndeposition.orca.nc, .)
 
 [ParametersFiles]
 List=	(${SUBMIT_DIR}/PARAM/namelist_top, .), \
-        (${SUBMIT_DIR}/PARAM/namelist_pisces,    .)
+        (${SUBMIT_DIR}/PARAM/namelist_pisces, .), \
 
 [RestartFiles]
@@ -31,18 +31,10 @@
 
 [OutputText]
-List=   (namelist_top, namelist_pisces)
+List=   ()
 
 [OutputFiles]
-List=   (${PREFIX_NWRITETRC}_${DATE_OPA}_ptrc_T.nc, ${R_OUT_MBG_NWRITE}/${PREFIX}_${WFT1}_ptrc_T.nc, Post_1M_ptrc_T), \
-        (${PREFIX_NWRITETRC}_${DATE_OPA}_diad_T.nc, ${R_OUT_MBG_NWRITE}/${PREFIX}_${WFT1}_diad_T.nc, Post_1M_diad_T)
+List=   (${PREFIX_WFT1}_ptrc_T.nc, ${R_OUT_MBG_WFT1}/${PREFIX}_${WFT1}_ptrc_T.nc, NONE), \
+        (${PREFIX_WFT1}_diad_T.nc, ${R_OUT_MBG_WFT1}/${PREFIX}_${WFT1}_diad_T.nc, NONE), \
+        (${PREFIX_WFT2}_ptrc_T.nc, ${R_OUT_MBG_WFT2}/${PREFIX}_${WFT2}_ptrc_T.nc, Post_1M_ptrc_T), \
+        (${PREFIX_WFT3}_diad_T.nc, ${R_OUT_MBG_WFT3}/${PREFIX}_${WFT3}_diad_T.nc, Post_5D_ptrc_T)
 
-[Post_1M_ptrc_T]
-Patches= ()
-GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
-TimeSeriesVars = (DCHL, NCHL, NO3, PO4, O2, Si, Fer, DIC, Alkalini, DOC)
-
-[Post_1M_diad_T]
-Patches = ()
-GatherWithInternal = (nav_lon, nav_lat, deptht, time_counter)
-TimeSeriesVars = (PMO, PMO2, Delc, Cflx, PPPHY, PPPHY2)
-
Index: trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.driver
===================================================================
--- trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.driver	(revision 1762)
+++ trunk/CONFIG/ORCA2_LIM_PISCES/IGCM00/COMP/pisces.driver	(revision 1764)
@@ -6,16 +6,4 @@
     IGCM_debug_PushStack "MBG_Initialize"
 
-    ##--Variables used by MBG --
-
-    # nwritetrc frequency of write in the tracer output file
-    # lrsttr    boolean term for tracer model restart (true or false)
-    # nrsttr    control of the time step (0, 1 or 2)
-    # ntrd_trc   time step frequency of write in the trends file for tracers
-    # ln_trdmld_trc_restart boolean term for trc trends restart (true or false)
-    
-    ##--Variables used by PISCES --
- 
-    # nwritedia frequency of write in the additional diag output file
-
 # Local function to find namelists parameters
 supergrep () {
@@ -23,11 +11,14 @@
 }
 
-    PAT_TOP_NWRITETRC=$( supergrep nwritetrc             ${SUBMIT_DIR}/PARAM/namelist_top )
+    ##--Variables used by MBG --
+
+    # lrsttr    boolean term for tracer model restart (true or false)
+    # nrsttr    control of the time step (0, 1 or 2)
+    
+    ##--Variables used by PISCES --
+ 
     PAT_TOP_LRSTTR=$( supergrep ln_rsttr                 ${SUBMIT_DIR}/PARAM/namelist_top )
     PAT_TOP_NRSTTR=$( supergrep nrsttr                   ${SUBMIT_DIR}/PARAM/namelist_top )
-    PAT_TOP_NWRITETRD=$( supergrep ntrd_trc              ${SUBMIT_DIR}/PARAM/namelist_top )
-    PAT_TOP_RSTRTTRD=$( supergrep ln_trdmld_trc_restart  ${SUBMIT_DIR}/PARAM/namelist_top )
-
-    PAT_PIS_NWRITEDIA=$( supergrep nwritedia             ${SUBMIT_DIR}/PARAM/namelist_pisces )
+    PAT_PIS_LRIVER=$( supergrep ln_river                 ${SUBMIT_DIR}/PARAM/namelist_pisces )
 
     IGCM_debug_PopStack "MBG_Initialize"
@@ -39,25 +30,28 @@
     IGCM_debug_PushStack "MBG_Update"
 
-    ##--Write Frequency Purpose ....
-    topfrequency=$( echo ${config_MBG_WriteFrequency} | awk "-F " '{print $1}' )
-    topfactor=$( echo ${topfrequency} | sed -e "s/[yYmMdD]//" )
-    case ${topfrequency} in
-        1Y|1y)
-            (( TOP_NWRITE = OPA_NDT_DAY * topfactor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
-            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}y ;
-            R_OUT_MBG_NWRITE=${R_OUT_MBG_O_Y} ;
-            WFT1=${topfactor}Y ;;
-        1M|1m)
-            (( TOP_NWRITE = OPA_NDT_DAY * topfactor * $( IGCM_date_DaysInMonth  ${year} ${month} ) ))          ;
-            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}m ;
-            R_OUT_MBG_NWRITE=${R_OUT_MBG_O_M} ;
-            WFT1=${topfactor}M ;;
-        *D|*d)
-            (( TOP_NWRITE = OPA_NDT_DAY * topfactor  ))          ;
-            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}d ;
-            R_OUT_MBG_NWRITE=${R_OUT_MBG_O_D} ;
-            WFT1=${topfactor}D ;;
-        *)
-    esac
+
+    ##--Write Frequency Purpose
+    Nbfreq=$( echo ${config_MBG_WriteFrequency} | wc -w )
+    typeset -Z1 i=1
+    while [ $i -le ${Nbfreq} ]; do
+       topfrequency=$( echo ${config_MBG_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
+       topfactor=$( echo ${topfrequency} | sed -e "s/[yYmMdD]//" )
+       case ${topfrequency} in
+         *Y|*y)
+            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}y_${DatesPeriod} ;
+            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_Y} ;
+            eval WFT${i}=${topfactor}Y ;;
+         *M|*m)
+            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}m_${DatesPeriod} ;
+            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_M} ;
+            eval WFT${i}=${topfactor}M ;;
+         *D|*d)
+            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}d_${DatesPeriod} ;
+            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_D} ;
+            eval WFT${i}=${topfactor}D ;;
+         *)
+      esac
+       let i=$i+1
+    done
 
     ##-- Restart configuration
@@ -68,4 +62,6 @@
         TOP_NRSTTR=0
 
+        PISCES_LRIVER=.FALSE.
+
     elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
 
@@ -74,4 +70,6 @@
         TOP_NRSTTR=0
 
+        PISCES_LRIVER=.TRUE.
+
     else
 
@@ -79,9 +77,12 @@
         TOP_LRSTTR=.TRUE.
         TOP_NRSTTR=2
+
+        PISCES_LRIVER=.TRUE.
+
     fi
 
-    sed -e "s%${PAT_TOP_NWRITETRC}%       nwritetrc=${TOP_NWRITE}%"               \
-        -e "s%${PAT_TOP_NWRITETRD}%       ntrd_trc=${TOP_NWRITE}%"                \
-        -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
+# on force les sorties PISCES comme les sorties OPA
+
+    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
         -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
         namelist_top > namelist_top.tmp
@@ -89,13 +90,9 @@
     IGCM_sys_Mv namelist_top.tmp namelist_top
 
-# on force les sorties PISCES comme les sorties OPA
-
-    sed -e "s%${PAT_PIS_NWRITEDIA}%       nwritedia=${TOP_NWRITE}%"              \
+    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
         namelist_pisces > namelist_pisces.tmp
 
     IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
 
-    echo 'Variables automatically updated in namelists'
-    grep AUTO namelist*
 
     IGCM_debug_PopStack "MBG_Update"
