Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/oasis.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/oasis.driver	(revision 2539)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/oasis.driver	(revision 2540)
@@ -67,9 +67,9 @@
     (( LagAtm = 86400 / day_step * iphysiq / nsplit_phys ))
 
-    (( LagOce = 86400 / ORCA_NPDT_JOUR ))
+    (( LagOce = 86400 / OPA_NPDT_JOUR ))
 
-    IGCM_debug_Print 1 "ORCA_NPDT_JOUR  : ${ORCA_NPDT_JOUR}"
-    IGCM_debug_Print 1 "LagAtm          : ${LagAtm}"
-    IGCM_debug_Print 1 "LagOce          : ${LagOce}"
+    IGCM_debug_Print 1 "OPA_NPDT_JOUR : ${OPA_NPDT_JOUR}"
+    IGCM_debug_Print 1 "LagAtm        : ${LagAtm}"
+    IGCM_debug_Print 1 "LagOce        : ${LagOce}"
 
     ## Use of Lucia ##
Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver	(revision 2539)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/opa9.driver	(revision 2540)
@@ -9,15 +9,8 @@
     RESOL_OCE_ICE=$( echo ${RESOL} | awk "-Fx" '{print $1}' )
     case ${RESOL_OCE_ICE} in
-	( *LIM2* )
-	SEAICE_MODEL=LIM2 
-	LIM_VERSION=2
-	;;
-
-	( *LIM3* )
-	SEAICE_MODEL=LIM3
-	LIM_VERSION=3
-	;;
-	( *CICE*) SEAICE_MODEL=CICE ;;
-	( *     ) SEAICE_MODEL=UNKNOWN ;;
+	( *LIM2* ) SEAICE_MODEL=LIM2 ; 	LIM_VERSION=2 ;;
+	( *LIM3* ) SEAICE_MODEL=LIM3 ; 	LIM_VERSION=3 ;;
+	( *CICE* ) SEAICE_MODEL=CICE                  ;;
+	( *      ) SEAICE_MODEL=UNKNOWN               ;;
     esac
     RESOL_OCE=$( echo ${RESOL_OCE_ICE} | sed "s/${SEAICE_MODEL}//" )
@@ -30,91 +23,47 @@
 
     # Local function to find namelists parameters
-    supergrep () {
- 	grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
-    }
-
+    #supergrep () { grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" ; }
+    supergrep () { grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" -e "s%^ *$1 *=%%" ; }
     ##--Variables used by OPA --
-
-    # cn_exp    experience name
-    # nn_it000  number of the first time step
-    # nn_itend  number of the last time step
-    # nn_date0  initial calendar date yymmdd (used if  nn_rstctl=1)
-    # nn_leapy  Leap year calendar (1) or not (0), or 360 days calendar (30)
-    # nn_stock  frequency of creation of a restart file (modulo referenced to 1)
-    # nn_write  frequency of write in the output file   (modulo referenced to nn_it000)
-    # ln_rstart start from rest (F) or from a restart file (T)
-    # nn_rstctl restart control = 0 nn_it000 is not compared to the restart file value
-    #                           = 1 use nn_date0 in namelist_cfg (not the value in the restart file)
-    #                           = 2 calendar parameters read in the restart file
-    # nn_msh    =1 create a mesh file (coordinates, scale factors, masks)
-    # rn_rdt    time step in seconds for the dynamics (and tracer if nacc=0)   ==> 5760 (coming from namelist)
-    # nn_prg    time-step frequency of gap print in model output
-    # nn_fwri   frequency of zonal means and transport output
-
     NAMELIST_OPA_CFG=${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE}_cfg
-    NAMELIST_OPA_REF=${SUBMIT_DIR}/PARAM/namelist_ref
-    IGCM_debug_Print 1 "namelist_ref : ${NAMELIST_OPA_REF}"
-    if [ ! -r ${NAMELIST_OPA_REF} ] ; then
-	echo "${NAMELIST_OPA_REF} non trouve"
-    fi
     IGCM_debug_Print 1 "namelist_cfg : ${NAMELIST_OPA_CFG}"
     if [ ! -r ${NAMELIST_OPA_CFG} ] ; then
-	echo "${NAMELIST_OPA_CFG} non trouve"
+        IGCM_debug_Exit "${NAMELIST_OPA_CFG} not found"
+	IGCM_debug_Verif_Exit
     fi
-
-    PAT_CEXPER=$(   supergrep cn_exp      ${NAMELIST_OPA_CFG} )
-    PAT_NIT000=$(   supergrep nn_it000    ${NAMELIST_OPA_CFG} )
-    PAT_NITEND=$(   supergrep nn_itend    ${NAMELIST_OPA_CFG} )
-    PAT_NDATE0=$(   supergrep nn_date0    ${NAMELIST_OPA_CFG} )
-    PAT_NLEAPY=$(   supergrep nn_leapy    ${NAMELIST_OPA_CFG} )
-    PAT_NSTOCK=$(   supergrep nn_stock    ${NAMELIST_OPA_CFG} )
-    PAT_NWRITE=$(   supergrep nn_write    ${NAMELIST_OPA_CFG} )
-    PAT_RESTAR=$(   supergrep ln_rstart   ${NAMELIST_OPA_CFG} )
-    PAT_NRSTAR=$(   supergrep nn_rstctl   ${NAMELIST_OPA_CFG} )
-    PAT_NMSH=$(     supergrep nn_msh      ${NAMELIST_OPA_CFG} )
-    PAT_NN_WRITE=$( supergrep nn_write    ${NAMELIST_OPA_CFG} )
-    PAT_NN_FWRI=$(  supergrep nn_fwri     ${NAMELIST_OPA_CFG} )
-    PAT_ICE_EMBD=$( supergrep nn_ice_embd ${NAMELIST_OPA_CFG} )
-    PAT_ICEFLX=$(   supergrep cn_iceflx   ${NAMELIST_OPA_CFG} )
-    PAT_JPNI=$(     supergrep jpni        ${NAMELIST_OPA_CFG} )
-    PAT_JPNJ=$(     supergrep jpnj        ${NAMELIST_OPA_CFG} )
-    PAT_JPNIJ=$(    supergrep jpnij       ${NAMELIST_OPA_CFG} )
-    PAT_NN_FSBC=$(  supergrep nn_fsbc     ${NAMELIST_OPA_CFG} ) 
-
-    ORCA_RDT=$(       supergrep rn_rdt        ${NAMELIST_OPA_CFG} | sed 's/ *rn_rdt *=//'  | sed 's/\. *//' )
-    ORCA_NN_FSBC=$(   supergrep nn_fsbc       ${NAMELIST_OPA_CFG} | sed 's/ *nn_fsbc *=//' | sed 's/\. *//' )
-    (( ORCA_NPDT_JOUR  = 86400 / ORCA_RDT     ))
-    #(( ORCA_NPDT_SBC   = ORCA_NPDT_JOUR / ORCA_NN_FSBC ))
-    (( ORCA_RDT_SBC =  ORCA_RDT * ORCA_NN_FSBC ))
+    OPA_RDT=$(       supergrep rn_rdt        ${NAMELIST_OPA_CFG} )
+    OPA_NN_FSBC=$(   supergrep nn_fsbc       ${NAMELIST_OPA_CFG} )
+    #
+    # OPA_RDT=$(       supergrep rn_rdt        namelist_cfg )
+    # OPA_NN_FSBC=$(   supergrep nn_fsbc       namelist_cfg )
+    (( OPA_NPDT_JOUR  =  86400 / OPA_RDT        ))
+    (( OPA_RDT_SBC    =  OPA_RDT * OPA_NN_FSBC ))
  
-
     # Period Length In Days between DateBegin and first day of calendar 0001 01 01
     # /!\ Needed by OPA namelist to compute file names /!\
     (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
 
-    IGCM_debug_Print 1 "PAT_CEXPER   $PAT_CEXPER "
-    IGCM_debug_Print 1 "PAT_NIT000   $PAT_NIT000"
-    IGCM_debug_Print 1 "PAT_NITEND   $PAT_NITEND"
-    IGCM_debug_Print 1 "PAT_NDATE0   $PAT_NDATE0"
-    IGCM_debug_Print 1 "PAT_NLEAPY   $PAT_NLEAPY"
-    IGCM_debug_Print 1 "PAT_NSTOCK   $PAT_NSTOCK"
-    IGCM_debug_Print 1 "PAT_NWRITE   $PAT_NWRITE"
-    IGCM_debug_Print 1 "PAT_RESTAR   $PAT_RESTAR"
-    IGCM_debug_Print 1 "PAT_NRSTAR   $PAT_NRSTAR"
-    IGCM_debug_Print 1 "PAT_NMSH     $PAT_NMSH"
-    IGCM_debug_Print 1 "PAT_NN_WRITE $PAT_NN_WRITE"
-    IGCM_debug_Print 1 "PAT_NN_FWRI  $PAT_NN_FWRI"
-    IGCM_debug_Print 1 "PAT_ICE_EMBD $PAT_ICE_EMBD"
-    IGCM_debug_Print 1 "PAT_ICEFLX   $PAT_ICEFLX"
-    IGCM_debug_Print 1 "PAT_JPNI     $PAT_JPNI"
-    IGCM_debug_Print 1 "PAT_JPNJ     $PAT_JPNJ"
-    IGCM_debug_Print 1 "PAT_JPNIJ    $PAT_JPNIJ"
-    IGCM_debug_Print 1 "PAT_NN_FSBC  $PAT_NN_FSBC"
     IGCM_debug_Print 1 " "
-    IGCM_debug_Print 1 "ORCA_RDT        $ORCA_RDT"
-    IGCM_debug_Print 1 "ORCA_NN_FSBC    $ORCA_NN_FSBC"
-    IGCM_debug_Print 1 "ORCA_RDT_SBC    $ORCA_RDT_SBC"
-    IGCM_debug_Print 1 "ORCA_NPDT_JOUR  $ORCA_NPDT_JOUR"
-    IGCM_debug_Print 1 "DaysSinceJC     $DaysSinceJC"
+    IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
+    IGCM_debug_Print 1 "OPA_NN_FSBC    ${OPA_NN_FSBC}"
+    IGCM_debug_Print 1 "OPA_RDT_SBC    ${OPA_RDT_SBC}"
+    IGCM_debug_Print 1 "OPA_NPDT_JOUR  ${OPA_NPDT_JOUR}"
+    IGCM_debug_Print 1 "DaysSinceJC    ${DaysSinceJC}"
+
+    ## Check that nn_fsbc is correct compare to coupling frequency
+    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
+    
+    ## This informations are used for diaptr, trends and diagap files
+    ## only the first frequency is used for this files
+    
+    IGCM_debug_Print 1 "FreqCoupling    ${FreqCoupling}"
+    IGCM_debug_Print 1 "OPA_NN_FSBC    ${OPA_NN_FSBC}"
+    IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
+    IGCM_debug_Print 1 "OPA_RDT_SBC    ${OPA_RDT_SBC}"
+    
+    if [[ ${OPA_RDT_SBC} -gt ${FreqCoupling} ]] ; then
+	IGCM_debug_Exit "OPA_RDT_SBC=${OPA_RDT_SBC} is greater than FreqCoupling=${FreqCoupling}"
+     	IGCM_debug_Verif_Exit
+    fi
     
     IGCM_debug_PopStack "OCE_Initialize"
@@ -126,22 +75,5 @@
 {
     IGCM_debug_PushStack "OCE_Update"
-
-    ## Check that nn_fsbc is correct compare to coupling frequency
-
-    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
-
-    ## This informations are used for diaptr, trends and diagap files
-    ## only the first frequency is used for this files
-   
-    IGCM_debug_Print 1 "FreqCoupling    $FreqCoupling"
-    IGCM_debug_Print 1 "ORCA_NN_FSBC    $ORCA_NN_FSBC"
-    IGCM_debug_Print 1 "ORCA_RDT        $ORCA_RDT"
-    IGCM_debug_Print 1 "ORCA_RDT_SBC    $ORCA_RDT_SBC"
-
-    if [[ ${ORCA_RDT_SBC} -gt ${FreqCoupling} ]] ; then
-	IGCM_debug_Exit "ORCA_RDT_SBC=${ORCA_RDT_SBC} is greater than FreqCoupling=${FreqCoupling}"
-     	IGCM_debug_Verif_Exit
-    fi
-    
+  
     ##--Write Frequency for iomput
     ## Differents frequencies are allowed for grid_[TUVW] and icemod files
@@ -153,19 +85,13 @@
     for frequency in ${config_OCE_WriteFrequency} ; do
         case ${frequency} in
-            1D|1d) V1D_ENABLE=".TRUE." ;;
-        esac
-        case ${frequency} in
-            1M|1m) V1M_ENABLE=".TRUE." ;;
-        esac
-        case ${frequency} in
-            *[yY]) V1Y_ENABLE=".TRUE." ;;
+            ( 1D|1d ) V1D_ENABLE=".TRUE." ;;
+            ( 1M|1m ) V1M_ENABLE=".TRUE." ;;
+            ( *[yY] ) V1Y_ENABLE=".TRUE." ;;
         esac
     done
-
 
     ##-- Output level : 3 for more 1D variables
     eval opa9_OUTPUT_LEVEL=\${opa9_UserChoices_OUTPUT_LEVEL} > /dev/null 2>&1
     OUTPUT_LEVEL=${opa9_OUTPUT_LEVEL}
-
 
     # Period Length In Days between DateBegin and first day of calendar 0001 01 01
@@ -174,27 +100,27 @@
 
     ##-- Number of time steps updated : the first, the last and the number of time steps
-    (( ORCA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * ORCA_NPDT_JOUR + 1 ))
-    (( ORCA_NPDT   = PeriodLengthInDays * ORCA_NPDT_JOUR ))
-    (( ORCA_NITEND = ORCA_NIT000 + ORCA_NPDT - 1))
+    (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NPDT_JOUR + 1 ))
+    (( OPA_NPDT   = PeriodLengthInDays * OPA_NPDT_JOUR ))
+    (( OPA_NITEND = OPA_NIT000 + OPA_NPDT - 1))
 
     ##-- We force one restart file at the end of the trunk
-    ORCA_NSTOCK="${ORCA_NITEND}"
+    OPA_NSTOCK="${OPA_NITEND}"
 
     ##-- Restart configuration
     if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then
-	ORCA_LRSTAR=.FALSE.
-	ORCA_NRSTDT=0
-        # Put ORCA_NMSH=0 when OPA running in parallel mode
-	ORCA_NMSH=1
+	OPA_LRSTAR=.FALSE.
+	OPA_NRSTDT=0
+        # Put OPA_NMSH=0 when OPA running in parallel mode
+	OPA_NMSH=1
 	#echo "NO OPA RESTART"
     elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "y" ] ) ; then
-	ORCA_LRSTAR=.TRUE.
-	ORCA_NRSTDT=0
-	ORCA_NMSH=1
+	OPA_LRSTAR=.TRUE.
+	OPA_NRSTDT=0
+	OPA_NMSH=1
 	#echo "OPA RESTART"
     else
-	ORCA_LRSTAR=.TRUE.
-	ORCA_NRSTDT=2
-	ORCA_NMSH=0
+	OPA_LRSTAR=.TRUE.
+	OPA_NRSTDT=2
+	OPA_NMSH=0
 	#echo "OPA RESTART"
     fi
@@ -204,5 +130,5 @@
 
     if [ "${opa9_UserChoices_mesh_mask}" = "y" ]; then
-        ORCA_NMSH=1
+        OPA_NMSH=1
         IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/opa9.card UserChoices mesh_mask "n"
     fi
@@ -210,66 +136,32 @@
     # nleapy configuration
     case ${config_UserChoices_CalendarType} in
-        leap|gregorian)
-            ORCA_NLEAPY=1;;
-        noleap)
-            ORCA_NLEAPY=0;;
-        360d)
-            ORCA_NLEAPY=30;;
-        *)
-            ORCA_NLEAPY=30
+        ( leap|gregorian) OPA_NLEAPY=1  ;;
+        ( noleap        ) OPA_NLEAPY=0  ;;
+        ( 360d          ) OPA_NLEAPY=30 ;;
+        ( *             ) OPA_NLEAPY=30 ;;
     esac
 
     typeset -r PRECIS=8
-    NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${ORCA_NITEND} }" ) ) 
+    NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) ) 
 
-
-    case ${SEAICE_MODEL} in
-	( LIM2 ) 
-	NN_ICE_EMBD=0
-	ICEFLX=none
-	;;
-	( LIM3 ) 
-	NN_ICE_EMBD=1
-	ICEFLX=${opa9_UserChoices_iceflx:-linear}
-	;;
-    esac
-
-    IGCM_debug_Print 1 "NUM_PROC_OCE : " ${NUM_PROC_OCE}
-
-    sed -e "s/${PAT_CEXPER}/       cn_exp=\"${config_UserChoices_JobName}\"/"   \
-	-e "s/${PAT_NIT000}/       nn_it000=${ORCA_NIT000}/"                    \
-	-e "s/${PAT_NITEND}/       nn_itend=${ORCA_NITEND}/"                    \
-	-e "s/${PAT_NDATE0}/       nn_date0=${PeriodDateBegin}/"                \
-        -e "s%${PAT_NLEAPY}%       nn_leapy=${ORCA_NLEAPY}%"                    \
-	-e "s/${PAT_NSTOCK}/       nn_stock=${ORCA_NSTOCK}/"                    \
-	-e "s/${PAT_RESTAR}/       ln_rstart=${ORCA_LRSTAR}/"                   \
-	-e "s/${PAT_NRSTAR}/       nn_rstctl=${ORCA_NRSTDT}/"                   \
-	-e "s/${PAT_NMSH}/         nn_msh=${ORCA_NMSH}/"                        \
-	-e "s/${PAT_NN_FSBC}/      nn_fsbc=${ORCA_NN_FSBC}/"                    \
-	-e "s/${PAT_ICE_EMBD}/     nn_ice_embd=${NN_ICE_EMBD}/"                 \
-	-e "s/${PAT_ICEFLX}/       cn_iceflx=\'${ICEFLX}'/"                     \
-	-e "s/${PAT_JPNI}/         jpni=1/"                                     \
-	-e "s/${PAT_JPNJ}/         jpnj=${NUM_PROC_OCE}/"                       \
-	-e "s/${PAT_JPNIJ}/        jpnij=${NUM_PROC_OCE}/"                      \
-	namelist_cfg > namelist_cfg.tmp
-
-    IGCM_sys_Mv namelist_cfg.tmp namelist_cfg
-
-    IGCM_debug_Print 1 'Variables automatically updated in ORCA namelist_cfg'
-    grep AUTO namelist_cfg
-
-    # update iodef.xml
+    IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp    ${config_UserChoices_JobName}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000  ${OPA_NIT000}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend  ${OPA_NITEND}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg ln_rstart ${OPA_LRSTAR}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock  ${OPA_NSTOCK}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_rstctl ${OPA_NRSTDT}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0  ${PeriodDateBegin}
+    IGCM_comp_modifyNamelist nonblocker namelist_cfg nn_msh    ${OPA_NMSH}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy  ${OPA_NLEAPY}
+    
+    # Update iodef.xml
 
     IGCM_debug_Print 1 'Informations into iodef.xml : V1D_ENABLE V1M_ENABLE V1Y_ENABLE OUTPUT_LEVEL'
     IGCM_debug_Print 1 ${V1D_ENABLE} ${V1M_ENABLE} ${V1Y_ENABLE} ${OUTPUT_LEVEL}
 
-    sed -e "s/_1D_ENABLE_/${V1D_ENABLE}/" \
-        -e "s/_1M_ENABLE_/${V1M_ENABLE}/" \
-        -e "s/_1Y_ENABLE_/${V1Y_ENABLE}/" \
-        -e "s/_OUTPUT_LEVEL_/${OUTPUT_LEVEL}/" \
-        context_nemo.xml > context_nemo.xml.tmp
-
-    IGCM_sys_Mv context_nemo.xml.tmp context_nemo.xml
-
+    IGCM_comp_modifyXmlFile force context_nemo.xml 1d enabled ${V1D_ENABLE}
+    IGCM_comp_modifyXmlFile force context_nemo.xml 1m enabled ${V1M_ENABLE}
+    IGCM_comp_modifyXmlFile force context_nemo.xml 1y enabled ${V1Y_ENABLE}
+	
     # vargas/titane/MPP and switch from 1 proc to 5 procs. We need to suppres restartopa the second month, if restartopa_0000 exist
     # same thing for restart_trc and restart_ice_in
@@ -288,5 +180,4 @@
     rm iodef.xml.tmp add.tmp
 
-
     IGCM_debug_PopStack "OCE_Update"
 }
