Index: NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca025
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca025	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca025	(revision 11536)
@@ -624,2 +624,16 @@
     nb_cores 36180 ( 180 x 201 ), nb_points 80 ( 10 x 8 )
     nb_cores 38560 ( 160 x 241 ), nb_points 77 ( 11 x 7 )
+    nb_cores 41406 ( 206 x 201 ), nb_points 72 ( 9 x 8 )
+    nb_cores 43380 ( 180 x 241 ), nb_points 70 ( 10 x 7 )
+    nb_cores 48240 ( 240 x 201 ), nb_points 64 ( 8 x 8 )
+    nb_cores 49646 ( 206 x 241 ), nb_points 63 ( 9 x 7 )
+    nb_cores 54360 ( 180 x 302 ), nb_points 60 ( 10 x 6 )
+    nb_cores 54360 ( 360 x 151 ), nb_points 60 ( 6 x 10 )
+    nb_cores 57840 ( 240 x 241 ), nb_points 56 ( 8 x 7 )
+    nb_cores 62212 ( 206 x 302 ), nb_points 54 ( 9 x 6 )
+    nb_cores 69408 ( 288 x 241 ), nb_points 49 ( 7 x 7 )
+    nb_cores 72360 ( 360 x 201 ), nb_points 48 ( 6 x 8 )
+    nb_cores 82812 ( 206 x 402 ), nb_points 45 ( 9 x 5 )
+    nb_cores 86760 ( 360 x 241 ), nb_points 42 ( 6 x 7 )
+    nb_cores 96480 ( 240 x 402 ), nb_points 40 ( 8 x 5 )
+    nb_cores 96480 ( 480 x 201 ), nb_points 40 ( 5 x 8 )
Index: NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca12
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca12	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/best_jpni_jpnj_eorca12	(revision 11536)
@@ -1300,2 +1300,49 @@
     nb_cores 49852 ( 206 x 242 ), nb_points 345 ( 23 x 15 )
     nb_cores 49950 ( 270 x 185 ), nb_points 342 ( 18 x 19 )
+    nb_cores 50400 ( 288 x 175 ), nb_points 340 ( 17 x 20 )
+    nb_cores 50400 ( 240 x 210 ), nb_points 340 ( 20 x 17 )
+    nb_cores 51294 ( 309 x 166 ), nb_points 336 ( 16 x 21 )
+    nb_cores 52272 ( 216 x 242 ), nb_points 330 ( 22 x 15 )
+    nb_cores 53190 ( 270 x 197 ), nb_points 324 ( 18 x 18 )
+    nb_cores 53280 ( 288 x 185 ), nb_points 323 ( 17 x 19 )
+    nb_cores 54000 ( 240 x 225 ), nb_points 320 ( 20 x 16 )
+    nb_cores 55176 ( 228 x 242 ), nb_points 315 ( 21 x 15 )
+    nb_cores 56199 ( 393 x 143 ), nb_points 312 ( 13 x 24 )
+    nb_cores 56700 ( 270 x 210 ), nb_points 306 ( 18 x 17 )
+    nb_cores 57165 ( 309 x 185 ), nb_points 304 ( 16 x 19 )
+    nb_cores 58080 ( 240 x 242 ), nb_points 300 ( 20 x 15 )
+    nb_cores 58916 ( 206 x 286 ), nb_points 299 ( 23 x 13 )
+    nb_cores 59760 ( 360 x 166 ), nb_points 294 ( 14 x 21 )
+    nb_cores 60480 ( 288 x 210 ), nb_points 289 ( 17 x 17 )
+    nb_cores 60750 ( 270 x 225 ), nb_points 288 ( 18 x 16 )
+    nb_cores 61605 ( 333 x 185 ), nb_points 285 ( 15 x 19 )
+    nb_cores 63000 ( 360 x 175 ), nb_points 280 ( 14 x 20 )
+    nb_cores 64800 ( 288 x 225 ), nb_points 272 ( 17 x 16 )
+    nb_cores 65340 ( 270 x 242 ), nb_points 270 ( 18 x 15 )
+    nb_cores 66600 ( 360 x 185 ), nb_points 266 ( 14 x 19 )
+    nb_cores 68040 ( 216 x 315 ), nb_points 264 ( 22 x 12 )
+    nb_cores 68640 ( 240 x 286 ), nb_points 260 ( 20 x 13 )
+    nb_cores 69525 ( 309 x 225 ), nb_points 256 ( 16 x 16 )
+    nb_cores 69696 ( 288 x 242 ), nb_points 255 ( 17 x 15 )
+    nb_cores 70920 ( 360 x 197 ), nb_points 252 ( 14 x 18 )
+    nb_cores 72705 ( 393 x 185 ), nb_points 247 ( 13 x 19 )
+    nb_cores 74778 ( 309 x 242 ), nb_points 240 ( 16 x 15 )
+    nb_cores 75600 ( 360 x 210 ), nb_points 238 ( 14 x 17 )
+    nb_cores 77220 ( 270 x 286 ), nb_points 234 ( 18 x 13 )
+    nb_cores 79680 ( 480 x 166 ), nb_points 231 ( 11 x 21 )
+    nb_cores 79920 ( 432 x 185 ), nb_points 228 ( 12 x 19 )
+    nb_cores 80586 ( 333 x 242 ), nb_points 225 ( 15 x 15 )
+    nb_cores 81000 ( 360 x 225 ), nb_points 224 ( 14 x 16 )
+    nb_cores 82368 ( 288 x 286 ), nb_points 221 ( 17 x 13 )
+    nb_cores 84000 ( 480 x 175 ), nb_points 220 ( 11 x 20 )
+    nb_cores 84000 ( 240 x 350 ), nb_points 220 ( 20 x 11 )
+    nb_cores 85050 ( 270 x 315 ), nb_points 216 ( 18 x 12 )
+    nb_cores 87120 ( 360 x 242 ), nb_points 210 ( 14 x 15 )
+    nb_cores 88374 ( 309 x 286 ), nb_points 208 ( 16 x 13 )
+    nb_cores 90720 ( 288 x 315 ), nb_points 204 ( 17 x 12 )
+    nb_cores 90720 ( 432 x 210 ), nb_points 204 ( 12 x 17 )
+    nb_cores 94500 ( 270 x 350 ), nb_points 198 ( 18 x 11 )
+    nb_cores 94680 ( 360 x 263 ), nb_points 196 ( 14 x 14 )
+    nb_cores 95106 ( 393 x 242 ), nb_points 195 ( 13 x 15 )
+    nb_cores 97200 ( 432 x 225 ), nb_points 192 ( 12 x 16 )
+    nb_cores 99900 ( 540 x 185 ), nb_points 190 ( 10 x 19 )
Index: NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca025_like
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca025_like	(revision 11536)
@@ -9,6 +9,6 @@
    nn_it000    =       1   !  first time step
    nn_itend    =    1000   !  last time step 
-   nn_stock    =       0   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =       0   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   nn_stock    =      -1   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =      -1   !  frequency of write in the output file   (modulo referenced to nn_it000)
 /
 !-----------------------------------------------------------------------
@@ -30,5 +30,4 @@
 &namctl        !   Control prints                                       (default: OFF)
 !-----------------------------------------------------------------------
-   ln_ctl      = .false.   !  trends control print (expensive!)
    nn_print    =    0      !  level of print (0 no extra print)
    ln_timing   = .false.   !  timing by routine write out in timing.output file
Index: NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca12_like
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca12_like	(revision 11536)
@@ -9,6 +9,6 @@
    nn_it000    =       1   !  first time step
    nn_itend    =    1000   !  last time step 
-   nn_stock    =       0   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =       0   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   nn_stock    =      -1   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =      -1   !  frequency of write in the output file   (modulo referenced to nn_it000)
 /
 !-----------------------------------------------------------------------
@@ -30,5 +30,4 @@
 &namctl        !   Control prints                                       (default: OFF)
 !-----------------------------------------------------------------------
-   ln_ctl      = .false.   !  trends control print (expensive!)
    nn_print    =    0      !  level of print (0 no extra print)
    ln_timing   = .false.   !  timing by routine write out in timing.output file
Index: NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca1_like
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/namelist_cfg_orca1_like	(revision 11536)
@@ -9,6 +9,6 @@
    nn_it000    =       1   !  first time step
    nn_itend    =    1000   !  last time step 
-   nn_stock    =       0   !  frequency of creation of a restart file (modulo referenced to 1)
-   nn_write    =       0   !  frequency of write in the output file   (modulo referenced to nn_it000)
+   nn_stock    =      -1   !  frequency of creation of a restart file (modulo referenced to 1)
+   nn_write    =      -1   !  frequency of write in the output file   (modulo referenced to nn_it000)
 /
 !-----------------------------------------------------------------------
@@ -30,5 +30,4 @@
 &namctl        !   Control prints                                       (default: OFF)
 !-----------------------------------------------------------------------
-   ln_ctl      = .false.   !  trends control print (expensive!)
    nn_print    =    0      !  level of print (0 no extra print)
    ln_timing   = .false.   !  timing by routine write out in timing.output file
Index: NEMO/trunk/tests/BENCH/EXPREF/namelist_ice_cfg
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/namelist_ice_cfg	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/namelist_ice_cfg	(revision 11536)
@@ -74,4 +74,5 @@
 &namini         !   Ice initialization
 !------------------------------------------------------------------------------
+   rn_thres_sst     =   0.5           !  max delta temp. above Tfreeze with initial ice = (sst - tfreeze)
 /
 !------------------------------------------------------------------------------
Index: NEMO/trunk/tests/BENCH/EXPREF/namelist_top_cfg
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/namelist_top_cfg	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/namelist_top_cfg	(revision 11536)
@@ -57,12 +57,12 @@
 !          !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !          !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
-   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12.       ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12.       ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1.        ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1.        ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1.        ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12.       ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12.       ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
+   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1.        ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''   , ''
    rn_trfac(1)   =   1.0e-06  !  multiplicative factor
    rn_trfac(2)   =   1.0e-06  !  -      -      -     -
Index: NEMO/trunk/tests/BENCH/EXPREF/sh_bench
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/sh_bench	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/sh_bench	(revision 11536)
@@ -9,4 +9,5 @@
 machine=$( hostname | sed -e "s/[0-9]*//g" )
 case $machine in 
+    "jean-zay")     ncore_node=40 ;;
     "beaufixlogin") ncore_node=40 ;;
     "curie")        ncore_node=16 ;;
Index: NEMO/trunk/tests/BENCH/EXPREF/submit_bench
===================================================================
--- NEMO/trunk/tests/BENCH/EXPREF/submit_bench	(revision 10539)
+++ NEMO/trunk/tests/BENCH/EXPREF/submit_bench	(revision 11536)
@@ -6,5 +6,5 @@
 #
 set -u
-set -vx
+#set -vx
 #
 cores=$1
@@ -15,10 +15,73 @@
 #
 # number of processes for each executable
-    nproc_exe1=$( echo $cores | bc )
-  (( nproc = $nproc_exe1 ))
-(( nnode = $nproc / $ncore_node ))
-[ $nnode -lt 1 ] && nnode=1
+nproc_exe1=$( echo $cores | bc )
+nproc=$nproc_exe1
+nnode=$(( ( $nproc + $ncore_node - 1 )  / $ncore_node ))
 
 nproc5=$( printf "%05d\n" ${nproc_exe1} )
+
+case ${resolution} in
+    "1")
+	if [ $nproc_exe1 -lt 50 ]
+	then
+	    timejob=3600
+	elif [ $nproc_exe1 -lt 100 ]
+	then
+	    timejob=1800
+	elif [ $nproc_exe1 -lt 200 ]
+	then
+	    timejob=900
+	else
+	    timejob=600
+	fi
+	;;
+    "025")
+	if [ $nproc_exe1 -lt 50 ]
+	then
+	    timejob=15000
+	elif [ $nproc_exe1 -lt 100 ]
+	then
+	    timejob=7000
+	elif [ $nproc_exe1 -lt 200 ]
+	then
+	    timejob=3600
+	elif [ $nproc_exe1 -lt 400 ]
+	then
+	    timejob=2000
+	elif [ $nproc_exe1 -lt 800 ]
+	then
+	    timejob=1000
+	else
+	    timejob=600
+	fi
+	;;
+    "12")
+	if [ $nproc_exe1 -lt 200 ]
+	then
+	    timejob=30000
+	elif [ $nproc_exe1 -lt 400 ]
+	then
+	    timejob=15000
+	elif [ $nproc_exe1 -lt 800 ]
+	then
+	    timejob=20000
+	elif [ $nproc_exe1 -lt 1600 ]
+	then
+	    timejob=15000
+	elif [ $nproc_exe1 -lt 3200 ]
+	then
+	    timejob=7500
+	elif [ $nproc_exe1 -lt 10000 ]
+	then
+	    timejob=5000
+	elif [ $nproc_exe1 -lt 20000 ]
+	then
+	    timejob=2500
+	else
+	    timejob=1200
+	fi
+	;;
+esac
+
 
 ######################################################################
@@ -100,65 +163,11 @@
 if [[ ( "$machine" == "curie" ) || ( "$machine" == "irene" ) ]]
 then
-    
-    case ${resolution} in
-	"1")
-	    if [ $nproc_exe1 -lt 50 ]
-	    then
-		timejob=3600
-	    elif [ $nproc_exe1 -lt 100 ]
-	    then
-		timejob=1800
-	    elif [ $nproc_exe1 -lt 200 ]
-	    then
-		timejob=900
-	    else
-		timejob=600
-	    fi
-	    ;;
-	"025")
-	    if [ $nproc_exe1 -lt 50 ]
-	    then
-		timejob=15000
-	    elif [ $nproc_exe1 -lt 100 ]
-	    then
-		timejob=7000
-	    elif [ $nproc_exe1 -lt 200 ]
-	    then
-		timejob=3600
-	    elif [ $nproc_exe1 -lt 400 ]
-	    then
-		timejob=2000
-	    elif [ $nproc_exe1 -lt 800 ]
-	    then
-		timejob=1000
-	    else
-		timejob=600
-	    fi
-	    ;;
-	"12")
-	    if [ $nproc_exe1 -lt 200 ]
-	    then
-		timejob=30000
-	    elif [ $nproc_exe1 -lt 400 ]
-	    then
-		timejob=15000
-	    elif [ $nproc_exe1 -lt 800 ]
-	    then
-		timejob=8000
-	    elif [ $nproc_exe1 -lt 1600 ]
-	    then
-		timejob=5000
-	    elif [ $nproc_exe1 -lt 3200 ]
-	    then
-		timejob=2500
-	    else
-		timejob=1200
-	    fi
-	;;
-    esac
 
     [ "$machine" == "curie" ] && queuename=standard || queuename=skylake
     
-    jobname=$HOME/binrun/jobbench
+    EXPjob=../EXP_${resolution}_${nproc5}_${dateref}
+    mkdir -p ${EXPjob}
+    cd ${EXPjob}
+    jobname=jobbench
     cat > $jobname << EOF
 #!/bin/bash
@@ -176,18 +185,20 @@
 #
 
-cd \${BRIDGE_MSUB_PWD}/..
-
-
-EXPjob=EXP_${resolution}_${nproc5}_${dateref}
-rsync -av --exclude="*eo" EXPREF/ \${EXPjob}/
-rsync -av EXP00/nemo \${EXPjob}/nemo
-cd \${EXPjob}
+cd \${BRIDGE_MSUB_PWD}
+
+for ff in \${BRIDGE_MSUB_PWD}/../EXPREF/namelist_*cfg \${BRIDGE_MSUB_PWD}/../EXPREF/namelist_*ref \${BRIDGE_MSUB_PWD}/../BLD/bin/nemo.exe
+do
+    cp \$ff .
+done
 
 jpni=${cores/\**/}
 jpnj=${cores/?*\*/}
 
-sed -e "s/jpni *=.*/jpni = \${jpni}/" -e "s/jpnj *=.*/jpnj = \${jpnj}/" namelist_cfg_orca${resolution}_like > namelist_cfg
-
-time ccc_mprun -n \${BRIDGE_MSUB_NPROC} ./nemo > jobout_${resolution}_${nproc5}_${dateref}
+sed -e "s/jpni *=.*/jpni = \${jpni}/" \
+    -e "s/jpnj *=.*/jpnj = \${jpnj}/"\
+    -e "s/ln_timing *= *.false./ln_timing   =  .true./" \
+     \${BRIDGE_MSUB_PWD}/../EXPREF/namelist_cfg_orca${resolution}_like > namelist_cfg
+
+time ccc_mprun -n \${BRIDGE_MSUB_NPROC} ./nemo.exe > jobout_${resolution}_${nproc5}_${dateref} 2>&1
 
 EOF
@@ -196,2 +207,70 @@
 
 fi
+
+######################################################################
+### Jean-Zay
+######################################################################
+
+if [ "$machine" == "jean-zay" ]
+then
+    hh=$( printf "%02d\n" $(( ${timejob} / 3600 )) )
+    mm=$( printf "%02d\n" $(( ( ${timejob} % 3600 ) / 60 )) )
+    ss=$( printf "%02d\n" $(( ( ${timejob} % 3600 ) % 60 )) )
+
+    EXPjob=../EXP_${resolution}_${nproc5}_${dateref}
+    mkdir -p ${EXPjob}
+    cd ${EXPjob}
+    jobname=jobbench
+    cat > $jobname << EOF
+#!/bin/bash
+#SBATCH --job-name=Seq        # nom du job
+#SBATCH --partition=cpu_gct3   # demande d'allocation sur la partition CPU
+#SBATCH --nodes=${nnode}             # nombre de noeuds
+#SBATCH --ntasks-per-node=${ncore_node}  # nombre de taches MPI par noeud
+#SBATCH --ntasks-per-core=1        # 1 processus MPI par coeur physique (pas d'hyperthreading)
+#SBATCH --time=${hh}:${mm}:${ss}       # temps d execution maximum demande (HH:MM:SS)
+#SBATCH --output=bench_${resolution}_${nproc5}_%j.eo        # nom du fichier de sortie
+#SBATCH --error=bench_${resolution}_${nproc5}_%j.eo         # nom du fichier d'erreur (ici en commun avec la sortie)
+#==========================================
+set -u
+#set -xv
+#
+#cd \${SLURM_SUBMIT_DIR}
+cd \${JOBSCRATCH}
+pwd
+
+for ff in \${SLURM_SUBMIT_DIR}/../EXPREF/namelist_*cfg \${SLURM_SUBMIT_DIR}/../EXPREF/namelist_*ref \${SLURM_SUBMIT_DIR}/../BLD/bin/nemo.exe
+do
+    cp \$ff .
+done
+
+jpni=${cores/\**/}
+jpnj=${cores/?*\*/}
+
+sed -e "s/jpni *=.*/jpni = \${jpni}/" \
+    -e "s/jpnj *=.*/jpnj = \${jpnj}/" \
+    -e "s/ln_timing *= *.false./ln_timing   =  .true./" \
+    \${SLURM_SUBMIT_DIR}/../EXPREF/namelist_cfg_orca${resolution}_like > namelist_cfg
+
+ls -l
+
+echo 
+echo 
+echo " =========== start the model ==========="
+echo 
+echo 
+
+time srun --mpi=pmi2 --cpu-bind=cores -K1 -n ${nproc} ./nemo.exe > jobout_${resolution}_${nproc5}_${dateref} 2>&1
+
+ls -l
+
+if [ "\$( pwd )" != "\${SLURM_SUBMIT_DIR}" ]
+then 
+    rsync -av namelist_cfg time.step ocean.output jobout_${resolution}_${nproc5}_${dateref} communication_report.txt layout.dat timing.output output.namelist* \${SLURM_SUBMIT_DIR}
+fi
+
+EOF
+
+    sbatch $jobname
+
+fi
Index: NEMO/trunk/tests/BENCH/MY_SRC/diawri.F90
===================================================================
--- NEMO/trunk/tests/BENCH/MY_SRC/diawri.F90	(revision 10539)
+++ 	(revision )
@@ -1,491 +1,0 @@
-MODULE diawri
-   !!======================================================================
-   !!                     ***  MODULE  diawri  ***
-   !! Ocean diagnostics :  write ocean output files
-   !!=====================================================================
-   !! History :  OPA  ! 1991-03  (M.-A. Foujols)  Original code
-   !!            4.0  ! 1991-11  (G. Madec)
-   !!                 ! 1992-06  (M. Imbard)  correction restart file
-   !!                 ! 1992-07  (M. Imbard)  split into diawri and rstwri
-   !!                 ! 1993-03  (M. Imbard)  suppress writibm
-   !!                 ! 1998-01  (C. Levy)  NETCDF format using ioipsl INTERFACE
-   !!                 ! 1999-02  (E. Guilyardi)  name of netCDF files + variables
-   !!            8.2  ! 2000-06  (M. Imbard)  Original code (diabort.F)
-   !!   NEMO     1.0  ! 2002-06  (A.Bozec, E. Durand)  Original code (diainit.F)
-   !!             -   ! 2002-09  (G. Madec)  F90: Free form and module
-   !!             -   ! 2002-12  (G. Madec)  merge of diabort and diainit, F90
-   !!                 ! 2005-11  (V. Garnier) Surface pressure gradient organization
-   !!            3.2  ! 2008-11  (B. Lemaire) creation from old diawri
-   !!            3.7  ! 2014-01  (G. Madec) remove eddy induced velocity from no-IOM output
-   !!                 !                     change name of output variables in dia_wri_state
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dia_wri       : create the standart output files
-   !!   dia_wri_state : create an output NetCDF file for a single instantaeous ocean state and forcing fields
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers 
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   USE dianam         ! build name of file (routine)
-   USE diahth         ! thermocline diagnostics
-   USE dynadv   , ONLY: ln_dynadv_vec
-   USE icb_oce        ! Icebergs
-   USE icbdia         ! Iceberg budgets
-   USE ldftra         ! lateral physics: eddy diffusivity coef.
-   USE ldfdyn         ! lateral physics: eddy viscosity   coef.
-   USE sbc_oce        ! Surface boundary condition: ocean fields
-   USE sbc_ice        ! Surface boundary condition: ice fields
-   USE sbcssr         ! restoring term toward SST/SSS climatology
-   USE sbcwave        ! wave parameters
-   USE wet_dry        ! wetting and drying
-   USE zdf_oce        ! ocean vertical physics
-   USE zdfdrg         ! ocean vertical physics: top/bottom friction
-   USE zdfmxl         ! mixed layer
-   !
-   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
-   USE in_out_manager ! I/O manager
-   USE diatmb         ! Top,middle,bottom output
-   USE dia25h         ! 25h Mean output
-   USE iom            ! 
-   USE ioipsl         ! 
-
-#if defined key_si3
-   USE ice
-   USE icewri 
-#endif
-   USE lib_mpp         ! MPP library
-   USE timing          ! preformance summary
-   USE diurnal_bulk    ! diurnal warm layer
-   USE cool_skin       ! Cool skin
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dia_wri                 ! routines called by step.F90
-   PUBLIC   dia_wri_state
-   PUBLIC   dia_wri_alloc           ! Called by nemogcm module
-
-   INTEGER ::   nid_T, nz_T, nh_T, ndim_T, ndim_hT   ! grid_T file
-   INTEGER ::          nb_T              , ndim_bT   ! grid_T file
-   INTEGER ::   nid_U, nz_U, nh_U, ndim_U, ndim_hU   ! grid_U file
-   INTEGER ::   nid_V, nz_V, nh_V, ndim_V, ndim_hV   ! grid_V file
-   INTEGER ::   nid_W, nz_W, nh_W                    ! grid_W file
-   INTEGER ::   ndex(1)                              ! ???
-   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV
-   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_T, ndex_U, ndex_V
-   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT
-
-   !! * Substitutions
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
-   !! $Id: diawri.F90 9598 2018-05-15 22:47:16Z nicolasmartin $
-   !! Software governed by the CeCILL licence     (./LICENSE)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-#if defined key_iomput
-   !!----------------------------------------------------------------------
-   !!   'key_iomput'                                        use IOM library
-   !!----------------------------------------------------------------------
-   INTEGER FUNCTION dia_wri_alloc()
-      !
-      dia_wri_alloc = 0
-      !
-   END FUNCTION dia_wri_alloc
-
-   
-   SUBROUTINE dia_wri( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dia_wri  ***
-      !!                   
-      !! ** Purpose :   Standard output of opa: dynamics and tracer fields 
-      !!      NETCDF format is used by default 
-      !!
-      !! ** Method  :  use iom_put
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
-      !!
-      INTEGER ::   ji, jj, jk       ! dummy loop indices
-      INTEGER ::   ikbot            ! local integer
-      REAL(wp)::   zztmp , zztmpx   ! local scalar
-      REAL(wp)::   zztmp2, zztmpy   !   -      -
-      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d   ! 2D workspace
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   z3d   ! 3D workspace
-      !!----------------------------------------------------------------------
-      ! 
-      IF( ln_timing )   CALL timing_start('dia_wri')
-      ! 
-      ! Output the initial state and forcings
-      IF( ninist == 1 ) THEN                       
-         CALL dia_wri_state( 'output.init' )
-         ninist = 0
-      ENDIF
-
-      ! Output of initial vertical scale factor
-      CALL iom_put("e3t_0", e3t_0(:,:,:) )
-      CALL iom_put("e3u_0", e3u_0(:,:,:) )
-      CALL iom_put("e3v_0", e3v_0(:,:,:) )
-      !
-      CALL iom_put( "e3t" , e3t_n(:,:,:) )
-      CALL iom_put( "e3u" , e3u_n(:,:,:) )
-      CALL iom_put( "e3v" , e3v_n(:,:,:) )
-      CALL iom_put( "e3w" , e3w_n(:,:,:) )
-      IF( iom_use("e3tdef") )   &
-         CALL iom_put( "e3tdef"  , ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 )
-
-      IF( ll_wd ) THEN
-         CALL iom_put( "ssh" , (sshn+ssh_ref)*tmask(:,:,1) )   ! sea surface height (brought back to the reference used for wetting and drying)
-      ELSE
-         CALL iom_put( "ssh" , sshn )              ! sea surface height
-      ENDIF
-
-      IF( iom_use("wetdep") )   &                  ! wet depth
-         CALL iom_put( "wetdep" , ht_0(:,:) + sshn(:,:) )
-      
-      CALL iom_put( "toce", tsn(:,:,:,jp_tem) )    ! 3D temperature
-      CALL iom_put(  "sst", tsn(:,:,1,jp_tem) )    ! surface temperature
-      IF ( iom_use("sbt") ) THEN
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ikbot = mbkt(ji,jj)
-               z2d(ji,jj) = tsn(ji,jj,ikbot,jp_tem)
-            END DO
-         END DO
-         CALL iom_put( "sbt", z2d )                ! bottom temperature
-      ENDIF
-      
-      CALL iom_put( "soce", tsn(:,:,:,jp_sal) )    ! 3D salinity
-      CALL iom_put(  "sss", tsn(:,:,1,jp_sal) )    ! surface salinity
-      IF ( iom_use("sbs") ) THEN
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ikbot = mbkt(ji,jj)
-               z2d(ji,jj) = tsn(ji,jj,ikbot,jp_sal)
-            END DO
-         END DO
-         CALL iom_put( "sbs", z2d )                ! bottom salinity
-      ENDIF
-
-      IF ( iom_use("taubot") ) THEN                ! bottom stress
-         zztmp = rau0 * 0.25
-         z2d(:,:) = 0._wp
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zztmp2 = (  ( rCdU_bot(ji+1,jj)+rCdU_bot(ji  ,jj) ) * un(ji  ,jj,mbku(ji  ,jj))  )**2   &
-                  &   + (  ( rCdU_bot(ji  ,jj)+rCdU_bot(ji-1,jj) ) * un(ji-1,jj,mbku(ji-1,jj))  )**2   &
-                  &   + (  ( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj  ) ) * vn(ji,jj  ,mbkv(ji,jj  ))  )**2   &
-                  &   + (  ( rCdU_bot(ji,jj  )+rCdU_bot(ji,jj-1) ) * vn(ji,jj-1,mbkv(ji,jj-1))  )**2
-               z2d(ji,jj) = zztmp * SQRT( zztmp2 ) * tmask(ji,jj,1) 
-               !
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'T', 1. )
-         CALL iom_put( "taubot", z2d )           
-      ENDIF
-         
-      CALL iom_put( "uoce", un(:,:,:) )            ! 3D i-current
-      CALL iom_put(  "ssu", un(:,:,1) )            ! surface i-current
-      IF ( iom_use("sbu") ) THEN
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ikbot = mbku(ji,jj)
-               z2d(ji,jj) = un(ji,jj,ikbot)
-            END DO
-         END DO
-         CALL iom_put( "sbu", z2d )                ! bottom i-current
-      ENDIF
-      
-      CALL iom_put( "voce", vn(:,:,:) )            ! 3D j-current
-      CALL iom_put(  "ssv", vn(:,:,1) )            ! surface j-current
-      IF ( iom_use("sbv") ) THEN
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ikbot = mbkv(ji,jj)
-               z2d(ji,jj) = vn(ji,jj,ikbot)
-            END DO
-         END DO
-         CALL iom_put( "sbv", z2d )                ! bottom j-current
-      ENDIF
-
-      CALL iom_put( "woce", wn )                   ! vertical velocity
-      IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value
-         ! Caution: in the VVL case, it only correponds to the baroclinic mass transport.
-         z2d(:,:) = rau0 * e1e2t(:,:)
-         DO jk = 1, jpk
-            z3d(:,:,jk) = wn(:,:,jk) * z2d(:,:)
-         END DO
-         CALL iom_put( "w_masstr" , z3d )  
-         IF( iom_use('w_masstr2') )   CALL iom_put( "w_masstr2", z3d(:,:,:) * z3d(:,:,:) )
-      ENDIF
-
-      CALL iom_put( "avt" , avt )                  ! T vert. eddy diff. coef.
-      CALL iom_put( "avs" , avs )                  ! S vert. eddy diff. coef.
-      CALL iom_put( "avm" , avm )                  ! T vert. eddy visc. coef.
-
-      IF( iom_use('logavt') )   CALL iom_put( "logavt", LOG( MAX( 1.e-20_wp, avt(:,:,:) ) ) )
-      IF( iom_use('logavs') )   CALL iom_put( "logavs", LOG( MAX( 1.e-20_wp, avs(:,:,:) ) ) )
-
-      IF ( iom_use("sstgrad") .OR. iom_use("sstgrad2") ) THEN
-         DO jj = 2, jpjm1                                    ! sst gradient
-            DO ji = fs_2, fs_jpim1   ! vector opt.
-               zztmp  = tsn(ji,jj,1,jp_tem)
-               zztmpx = ( tsn(ji+1,jj,1,jp_tem) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) * r1_e1u(ji-1,jj)
-               zztmpy = ( tsn(ji,jj+1,1,jp_tem) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) * r1_e2v(ji,jj-1)
-               z2d(ji,jj) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   &
-                  &              * umask(ji,jj,1) * umask(ji-1,jj,1) * vmask(ji,jj,1) * umask(ji,jj-1,1)
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'T', 1. )
-         CALL iom_put( "sstgrad2",  z2d )          ! square of module of sst gradient
-         z2d(:,:) = SQRT( z2d(:,:) )
-         CALL iom_put( "sstgrad" ,  z2d )          ! module of sst gradient
-      ENDIF
-         
-      ! heat and salt contents
-      IF( iom_use("heatc") ) THEN
-         z2d(:,:)  = 0._wp 
-         DO jk = 1, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         CALL iom_put( "heatc", rau0_rcp * z2d )   ! vertically integrated heat content (J/m2)
-      ENDIF
-
-      IF( iom_use("saltc") ) THEN
-         z2d(:,:)  = 0._wp 
-         DO jk = 1, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-         CALL iom_put( "saltc", rau0 * z2d )          ! vertically integrated salt content (PSU*kg/m2)
-      ENDIF
-      !
-      IF ( iom_use("eken") ) THEN
-         z3d(:,:,jpk) = 0._wp 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zztmp  = 0.25_wp * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk)
-                  z3d(ji,jj,jk) = zztmp * (  un(ji-1,jj,jk)**2 * e2u(ji-1,jj) * e3u_n(ji-1,jj,jk)   &
-                     &                     + un(ji  ,jj,jk)**2 * e2u(ji  ,jj) * e3u_n(ji  ,jj,jk)   &
-                     &                     + vn(ji,jj-1,jk)**2 * e1v(ji,jj-1) * e3v_n(ji,jj-1,jk)   &
-                     &                     + vn(ji,jj  ,jk)**2 * e1v(ji,jj  ) * e3v_n(ji,jj  ,jk)   )
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z3d, 'T', 1. )
-         CALL iom_put( "eken", z3d )                 ! kinetic energy
-      ENDIF
-      !
-      CALL iom_put( "hdiv", hdivn )                  ! Horizontal divergence
-      !
-      IF( iom_use("u_masstr") .OR. iom_use("u_masstr_vint") .OR. iom_use("u_heattr") .OR. iom_use("u_salttr") ) THEN
-         z3d(:,:,jpk) = 0.e0
-         z2d(:,:) = 0.e0
-         DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * e3u_n(:,:,jk) * umask(:,:,jk)
-            z2d(:,:) = z2d(:,:) + z3d(:,:,jk)
-         END DO
-         CALL iom_put( "u_masstr"     , z3d )         ! mass transport in i-direction
-         CALL iom_put( "u_masstr_vint", z2d )         ! mass transport in i-direction vertical sum
-      ENDIF
-      
-      IF( iom_use("u_heattr") ) THEN
-         z2d(:,:) = 0._wp 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) )
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'U', -1. )
-         CALL iom_put( "u_heattr", 0.5*rcp * z2d )    ! heat transport in i-direction
-      ENDIF
-
-      IF( iom_use("u_salttr") ) THEN
-         z2d(:,:) = 0.e0 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) )
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'U', -1. )
-         CALL iom_put( "u_salttr", 0.5 * z2d )        ! heat transport in i-direction
-      ENDIF
-
-      
-      IF( iom_use("v_masstr") .OR. iom_use("v_heattr") .OR. iom_use("v_salttr") ) THEN
-         z3d(:,:,jpk) = 0.e0
-         DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * e3v_n(:,:,jk) * vmask(:,:,jk)
-         END DO
-         CALL iom_put( "v_masstr", z3d )              ! mass transport in j-direction
-      ENDIF
-      
-      IF( iom_use("v_heattr") ) THEN
-         z2d(:,:) = 0.e0 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) )
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'V', -1. )
-         CALL iom_put( "v_heattr", 0.5*rcp * z2d )    !  heat transport in j-direction
-      ENDIF
-
-      IF( iom_use("v_salttr") ) THEN
-         z2d(:,:) = 0._wp 
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj+1,jk,jp_sal) )
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'V', -1. )
-         CALL iom_put( "v_salttr", 0.5 * z2d )        !  heat transport in j-direction
-      ENDIF
-
-      IF( iom_use("tosmint") ) THEN
-         z2d(:,:) = 0._wp
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) *  tsn(ji,jj,jk,jp_tem)
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'T', -1. )
-         CALL iom_put( "tosmint", rau0 * z2d )        ! Vertical integral of temperature
-      ENDIF
-      IF( iom_use("somint") ) THEN
-         z2d(:,:)=0._wp
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  z2d(ji,jj) = z2d(ji,jj) + e3t_n(ji,jj,jk) * tsn(ji,jj,jk,jp_sal)
-               END DO
-            END DO
-         END DO
-         CALL lbc_lnk( 'diawri', z2d, 'T', -1. )
-         CALL iom_put( "somint", rau0 * z2d )         ! Vertical integral of salinity
-      ENDIF
-
-      CALL iom_put( "bn2", rn2 )                      ! Brunt-Vaisala buoyancy frequency (N^2)
-      !
-
-      IF (ln_diatmb)   CALL dia_tmb                   ! tmb values 
-          
-      IF (ln_dia25h)   CALL dia_25h( kt )             ! 25h averaging
-
-      IF( ln_timing )   CALL timing_stop('dia_wri')
-      !
-   END SUBROUTINE dia_wri
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                  use IOIPSL  library
-   !!----------------------------------------------------------------------
-
-   INTEGER FUNCTION dia_wri_alloc()
-      !
-      dia_wri_alloc = 0
-      !
-   END FUNCTION dia_wri_alloc
-
-   SUBROUTINE dia_wri( kt )
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
-
-      IF( ninist == 1 ) THEN     !==  Output the initial state and forcings  ==!
-         CALL dia_wri_state( 'output.init' )
-         ninist = 0
-      ENDIF
-
-   END SUBROUTINE dia_wri
-
-#endif
-
-   SUBROUTINE dia_wri_state( cdfile_name )
-      !!---------------------------------------------------------------------
-      !!                 ***  ROUTINE dia_wri_state  ***
-      !!        
-      !! ** Purpose :   create a NetCDF file named cdfile_name which contains 
-      !!      the instantaneous ocean state and forcing fields.
-      !!        Used to find errors in the initial state or save the last
-      !!      ocean state in case of abnormal end of a simulation
-      !!
-      !! ** Method  :   NetCDF files using ioipsl
-      !!      File 'output.init.nc'  is created if ninist = 1 (namelist)
-      !!      File 'output.abort.nc' is created in case of abnormal job end
-      !!----------------------------------------------------------------------
-      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created
-      !!
-      INTEGER :: inum
-      !!----------------------------------------------------------------------
-      ! 
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'dia_wri_state : single instantaneous ocean state'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~   and forcing fields file created '
-      IF(lwp) WRITE(numout,*) '                and named :', cdfile_name, '...nc'
-
-#if defined key_si3
-     CALL iom_open( TRIM(cdfile_name), inum, ldwrt = .TRUE., kdlev = jpl )
-#else
-     CALL iom_open( TRIM(cdfile_name), inum, ldwrt = .TRUE. )
-#endif
-
-      CALL iom_rstput( 0, 0, inum, 'votemper', tsn(:,:,:,jp_tem) )    ! now temperature
-      CALL iom_rstput( 0, 0, inum, 'vosaline', tsn(:,:,:,jp_sal) )    ! now salinity
-      CALL iom_rstput( 0, 0, inum, 'sossheig', sshn              )    ! sea surface height
-      CALL iom_rstput( 0, 0, inum, 'vozocrtx', un                )    ! now i-velocity
-      CALL iom_rstput( 0, 0, inum, 'vomecrty', vn                )    ! now j-velocity
-      CALL iom_rstput( 0, 0, inum, 'vovecrtz', wn                )    ! now k-velocity
-      IF( ALLOCATED(ahtu) ) THEN
-         CALL iom_rstput( 0, 0, inum,  'ahtu', ahtu              )    ! aht at u-point
-         CALL iom_rstput( 0, 0, inum,  'ahtv', ahtv              )    ! aht at v-point
-      ENDIF
-      IF( ALLOCATED(ahmt) ) THEN
-         CALL iom_rstput( 0, 0, inum,  'ahmt', ahmt              )    ! ahmt at u-point
-         CALL iom_rstput( 0, 0, inum,  'ahmf', ahmf              )    ! ahmf at v-point
-      ENDIF
-      CALL iom_rstput( 0, 0, inum, 'sowaflup', emp - rnf         )    ! freshwater budget
-      CALL iom_rstput( 0, 0, inum, 'sohefldo', qsr + qns         )    ! total heat flux
-      CALL iom_rstput( 0, 0, inum, 'soshfldo', qsr               )    ! solar heat flux
-      CALL iom_rstput( 0, 0, inum, 'soicecov', fr_i              )    ! ice fraction
-      CALL iom_rstput( 0, 0, inum, 'sozotaux', utau              )    ! i-wind stress
-      CALL iom_rstput( 0, 0, inum, 'sometauy', vtau              )    ! j-wind stress
-      IF(  .NOT.ln_linssh  ) THEN             
-         CALL iom_rstput( 0, 0, inum, 'vovvldep', gdept_n        )    !  T-cell depth 
-         CALL iom_rstput( 0, 0, inum, 'vovvle3t', e3t_n          )    !  T-cell thickness  
-      END IF
-      IF( ln_wave .AND. ln_sdw ) THEN
-         CALL iom_rstput( 0, 0, inum, 'sdzocrtx', usd            )    ! now StokesDrift i-velocity
-         CALL iom_rstput( 0, 0, inum, 'sdmecrty', vsd            )    ! now StokesDrift j-velocity
-         CALL iom_rstput( 0, 0, inum, 'sdvecrtz', wsd            )    ! now StokesDrift k-velocity
-      ENDIF
- 
-#if defined key_si3
-      IF( nn_ice == 2 ) THEN   ! condition needed in case agrif + ice-model but no-ice in child grid
-         CALL ice_wri_state( inum )
-      ENDIF
-#endif
-      !
-      CALL iom_close( inum )
-      ! 
-   END SUBROUTINE dia_wri_state
-
-   !!======================================================================
-END MODULE diawri
Index: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_istate.F90
===================================================================
--- NEMO/trunk/tests/BENCH/MY_SRC/usrdef_istate.F90	(revision 10539)
+++ NEMO/trunk/tests/BENCH/MY_SRC/usrdef_istate.F90	(revision 11536)
@@ -64,5 +64,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            z2d(ji,jj) = 0.1 * ( 0.5 - REAL( nimpp + ji - 1 + ( njmpp + jj - 2 ) * jpiglo, wp ) / REAL( jpiglo * jpjglo, wp ) )
+            z2d(ji,jj) = 0.1 * ( 0.5 - REAL( mig(ji) + mjg(jj) * jpiglo, wp ) / REAL( jpiglo * jpjglo, wp ) )
          ENDDO
       ENDDO
@@ -73,7 +73,6 @@
       DO jk = 1, jpk
          zfact = REAL(jk-1,wp) / REAL(jpk-1,wp)   ! 0 to 1 to add a basic stratification
-         ! temperature choosen to lead to 20% ice
-         pts(:,:,jk,jp_tem) = 2._wp - 0.1_wp * zfact + z2d(:,:) * 100._wp ! 2 to 1.9 +/- 5 degG
-         WHERE ( pts(:,:,jk,jp_tem) < -1.5_wp ) pts(:,:,jk,jp_tem) = -1.5_wp + z2d(:,:) * 0.2_wp  
+         ! temperature choosen to lead to ~50% ice at the beginning if rn_thres_sst = 0.5
+         pts(:,:,jk,jp_tem) = 20._wp*z2d(:,:) - 1._wp - 0.5_wp * zfact    ! -1 to -1.5 +/-1.0 degG
          ! salinity:  
          pts(:,:,jk,jp_sal) = 30._wp + 1._wp * zfact + z2d(:,:)           ! 30 to 31 +/- 0.05 psu
@@ -84,7 +83,7 @@
       !
       CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )            ! apply boundary conditions
-      CALL lbc_lnk( 'usrdef_istate', pts, 'T',  1. )            ! apply boundary conditions
-      CALL lbc_lnk(  'usrdef_istate', pu, 'U', -1. )            ! apply boundary conditions
-      CALL lbc_lnk(  'usrdef_istate', pv, 'V', -1. )            ! apply boundary conditions
+      CALL lbc_lnk('usrdef_istate',  pts, 'T',  1. )            ! apply boundary conditions
+      CALL lbc_lnk('usrdef_istate',   pu, 'U', -1. )            ! apply boundary conditions
+      CALL lbc_lnk('usrdef_istate',   pv, 'V', -1. )            ! apply boundary conditions
       
    END SUBROUTINE usr_def_istate
Index: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_nam.F90
===================================================================
--- NEMO/trunk/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 10539)
+++ NEMO/trunk/tests/BENCH/MY_SRC/usrdef_nam.F90	(revision 11536)
@@ -29,5 +29,5 @@
 CONTAINS
 
-   SUBROUTINE usr_def_nam( ldtxt, ldnam, cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
+   SUBROUTINE usr_def_nam( cd_cfg, kk_cfg, kpi, kpj, kpk, kperio )
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE dom_nam  ***
@@ -41,5 +41,4 @@
       !! ** input   : - namusr_def namelist found in namelist_cfg
       !!----------------------------------------------------------------------
-      CHARACTER(len=*), DIMENSION(:), INTENT(out) ::   ldtxt, ldnam    ! stored print information
       CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name
       INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution
@@ -48,5 +47,5 @@
       !
       !
-      INTEGER ::   ios, ii      ! Local integer
+      INTEGER ::   ios         ! Local integer
       !                              !!* namusr_def namelist *!!
       INTEGER ::   nn_isize    ! number of point in i-direction of global(local) domain if >0 (<0)  
@@ -55,29 +54,29 @@
       INTEGER ::   nn_perio    ! periodicity
       !                              !!* nammpp namelist *!!
-      CHARACTER(len=1) ::   cn_mpi_send
-      INTEGER          ::   nn_buffer, jpni, jpnj
+      INTEGER          ::   jpni, jpnj
       LOGICAL          ::   ln_nnogather
       !!
       NAMELIST/namusr_def/ nn_isize, nn_jsize, nn_ksize, nn_perio
-      NAMELIST/nammpp/ cn_mpi_send, nn_buffer, jpni, jpnj, ln_nnogather
+      NAMELIST/nammpp/ jpni, jpnj, ln_nnogather
       !!----------------------------------------------------------------------     
       !
       REWIND( numnam_cfg )          ! Namelist namusr_def (exist in namelist_cfg only)
       READ  ( numnam_cfg, namusr_def, IOSTAT = ios, ERR = 903 )
-903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist', .TRUE. )
-      WRITE( ldnam(:), namusr_def )      
+903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namusr_def in configuration namelist' )
+      !
+      IF(lwm)   WRITE( numond, namusr_def )      
       !
       cd_cfg = 'BENCH'             ! name & resolution (not used)
       kk_cfg = 0
-
+      !
       IF( nn_isize < 0 .AND. nn_jsize < 0 ) THEN
       !
          REWIND( numnam_ref )              ! Namelist nammpp in reference namelist: mpi variables
          READ  ( numnam_ref, nammpp, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist', lwp )
+901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nammpp in reference namelist' )
          !
          REWIND( numnam_cfg )              ! Namelist nammpp in configuration namelist: mpi variables
          READ  ( numnam_cfg, nammpp, IOSTAT = ios, ERR = 902 )
-902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist', lwp )
+902      IF( ios >  0 )   CALL ctl_nam ( ios , 'nammpp in configuration namelist' )
 
          kpi = ( -nn_isize - 2*nn_hls ) * jpni + 2*nn_hls
@@ -87,30 +86,30 @@
          kpj = nn_jsize
       ENDIF
- 
+      !
       kpk = nn_ksize
       kperio = nn_perio
-
       !                             ! control print
-      ii = 1
-      WRITE(ldtxt(ii),*) '   '                                                                          ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'   ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '~~~~~~~~~~~ '                                                                 ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '   Namelist namusr_def : BENCH test case'                                     ;   ii = ii + 1
-      IF( nn_isize > 0 ) THEN
-         WRITE(ldtxt(ii),*) '      global domain size-x            nn_isize = ',  nn_isize              ;   ii = ii + 1
-      ELSE
-         WRITE(ldtxt(ii),*) '                                          jpni = ', jpni                   ;   ii = ii + 1
-         WRITE(ldtxt(ii),*) '       local domain size-x           -nn_isize = ', -nn_isize              ;   ii = ii + 1
-         WRITE(ldtxt(ii),*) '      global domain size-x                 kpi = ', kpi                    ;   ii = ii + 1
+      IF(lwp) THEN
+         WRITE(numout,*) '   '
+         WRITE(numout,*) 'usr_def_nam  : read the user defined namelist (namusr_def) in namelist_cfg'
+         WRITE(numout,*) '~~~~~~~~~~~ '
+         WRITE(numout,*) '   Namelist namusr_def : BENCH test case'
+         IF( nn_isize > 0 ) THEN
+            WRITE(numout,*) '      global domain size-x            nn_isize = ',  nn_isize
+         ELSE
+            WRITE(numout,*) '                                          jpni = ', jpni
+            WRITE(numout,*) '       local domain size-x           -nn_isize = ', -nn_isize
+            WRITE(numout,*) '      global domain size-x                 kpi = ', kpi
+         ENDIF
+         IF( nn_jsize > 0 ) THEN
+            WRITE(numout,*) '      global domain size-y            nn_jsize = ', nn_jsize
+         ELSE
+            WRITE(numout,*) '                                          jpnj = ', jpnj
+            WRITE(numout,*) '       local domain size-y           -nn_jsize = ', -nn_jsize
+            WRITE(numout,*) '      global domain size-y                 kpj = ', kpj
+         ENDIF
+         WRITE(numout,*) '      global domain size-z            nn_ksize = ', nn_ksize
+         WRITE(numout,*) '      LBC of the global domain          kperio = ', kperio
       ENDIF
-      IF( nn_jsize > 0 ) THEN
-         WRITE(ldtxt(ii),*) '      global domain size-y            nn_jsize = ', nn_jsize               ;   ii = ii + 1
-      ELSE
-         WRITE(ldtxt(ii),*) '                                          jpnj = ', jpnj                   ;   ii = ii + 1
-         WRITE(ldtxt(ii),*) '       local domain size-y           -nn_jsize = ', -nn_jsize              ;   ii = ii + 1
-         WRITE(ldtxt(ii),*) '      global domain size-y                 kpj = ', kpj                    ;   ii = ii + 1
-      ENDIF
-      WRITE(ldtxt(ii),*) '      global domain size-z            nn_ksize = ', nn_ksize                  ;   ii = ii + 1
-      WRITE(ldtxt(ii),*) '      LBC of the global domain          kperio = ', kperio                    ;   ii = ii + 1
       !
    END SUBROUTINE usr_def_nam
Index: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_zgr.F90
===================================================================
--- NEMO/trunk/tests/BENCH/MY_SRC/usrdef_zgr.F90	(revision 10539)
+++ NEMO/trunk/tests/BENCH/MY_SRC/usrdef_zgr.F90	(revision 11536)
@@ -194,4 +194,9 @@
       z2d(:,:) = REAL( jpkm1 , wp )          ! flat bottom
       !
+      IF( jperio == 3 .OR. jperio ==4 ) THEN   ! add a small island in the upper corners to avoid model instabilities...
+         z2d(mi0(       1):mi1(     3),mj0(jpjglo-2):mj1(jpjglo)) = 0.
+         z2d(mi0(jpiglo-2):mi1(jpiglo),mj0(jpjglo-2):mj1(jpjglo)) = 0.
+      ENDIF
+      !
       CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )           ! set surrounding land to zero (here jperio=0 ==>> closed)
       !
Index: NEMO/trunk/tests/BENCH/MY_SRC/zdfiwm.F90
===================================================================
--- NEMO/trunk/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 10539)
+++ NEMO/trunk/tests/BENCH/MY_SRC/zdfiwm.F90	(revision 11536)
@@ -406,9 +406,9 @@
       REWIND( numnam_ref )              ! Namelist namzdf_iwm in reference namelist : Wave-driven mixing
       READ  ( numnam_ref, namzdf_iwm, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_iwm in reference namelist', lwp )
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_iwm in reference namelist' )
       !
       REWIND( numnam_cfg )              ! Namelist namzdf_iwm in configuration namelist : Wave-driven mixing
       READ  ( numnam_cfg, namzdf_iwm, IOSTAT = ios, ERR = 902 )
-902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_iwm in configuration namelist', lwp )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_iwm in configuration namelist' )
       IF(lwm) WRITE ( numond, namzdf_iwm )
       !
