Index: dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/example.sh
===================================================================
--- dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/example.sh	(revision 4035)
+++ dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/example.sh	(revision 4037)
@@ -1,16 +1,41 @@
 #!/bin/bash
+# How to use this script :
+# 1    Create a directory EXP for your experiment ; ALL commands below must be run from EXP
+# 2    Create a directory STORE to store the outputs of your experiment ; run "ln -s STORE storedir"
+# 3    run "BASE/example.sh copy" where BASE is the directory containing this script
+# 4a   (optional) Edit EXP/run_icosa.def to change nbp, dt, itau_physics
+# 4b   (optional) Edit EXP/prepare.sh to change NB_MPI_DYNAMICO
+# 4c   (optional) Edit EXP/example.sh to change ARCH, NB_YEARS
+# 5    run "./example.sh create"
+# 6    EXP run "./example.sh submit"
+
+function fullpath() 
+{ 
+    echo "$(cd -P $1 ; pwd)"
+}
+
+function years()
+{
+    for ((i=$1;i<=$2;i++)) ; do
+	echo $(printf 'year%02d' $i)
+    done
+}
 
 function cmd_create()
 {
-    export ESM_ROOT="$PWD/../../"
-    export ARCH=X64_CURIE
-    STORE_ROOT="$STOREDIR/aquaplanet"
-    STORE0L="$STORE_ROOT/ce0l"
-    for DIR in ce0l year01 year02 ; do
+    export ESM_ROOT=$(fullpath ESM_ROOT)
+    STORE_ROOT=$( fullpath $PWD/storedir )
+    YEARS=$(years 1 $NB_YEARS)
+    for DIR in ce0l $YEARS ; do
 	rm -rf $DIR $STORE_ROOT/$DIR
     done
-    ./prepare.sh ce0l                                ce0l   "$STORE0L"
-    ./prepare.sh first $STORE0L                      year01 "$STORE_ROOT/year01"
-    ./prepare.sh next  $STORE0L "$STORE_ROOT/year01" year02 "$STORE_ROOT/year02"
+    STORE0L="$STORE_ROOT/ce0l"
+    $BASEDIR/prepare.sh ce0l ce0l "$STORE0L"
+    $BASEDIR/prepare.sh first $STORE0L year01 "$STORE_ROOT/year01"
+    PREV=year01
+    for YEAR in $(years 2 $NB_YEARS) ; do
+	$BASEDIR/prepare.sh next  $STORE0L "$STORE_ROOT/$PREV" $YEAR "$STORE_ROOT/$YEAR"
+	PREV=$YEAR
+    done
 }
 
@@ -29,6 +54,15 @@
     DEP=""
     submit_$ARCH ce0l
-    submit_$ARCH year01 $DEP
-    submit_$ARCH year02 $DEP
+    for YEAR in $(years 1 $NB_YEARS) ; do
+	submit_$ARCH $YEAR $DEP
+    done
+}
+
+function cmd_copy()
+{
+    export ESM_ROOT=$( fullpath $BASEDIR/../../ )
+    ln -sf $ESM_ROOT ESM_ROOT
+    cp -fp $BASEDIR/*.sh $BASEDIR/*.xml $BASEDIR/*.def .
+    ls -lrh
 }
 
@@ -38,6 +72,11 @@
 }
 
+NB_YEARS=10
+BASEDIR=$(dirname ${BASH_SOURCE[0]})
+BASEDIR=$( fullpath $BASEDIR )
 echo "Your command : $0 $*"
-echo "Usage : $0 [create|submit]"
-ARCH=X64_CURIE
+echo "Script base dir : $BASEDIR"
+echo "Run from : $(fullpath $PWD)"
+echo "Usage : $0 [copy|create|submit]"
+export ARCH=X64_CURIE
 cmd_$1
Index: dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/iodef.xml
===================================================================
--- dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/iodef.xml	(revision 4035)
+++ dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/iodef.xml	(revision 4037)
@@ -13,5 +13,6 @@
         	<variable_group id="parameters" >
         	   <variable id="info_level" type="int">100</variable>
-        	</variable_group>
+                   <variable id="using_server" type="bool">USING_SERVER</variable>
+         	</variable_group>
 		</variable_definition>
 	</context>
Index: dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/prepare.sh
===================================================================
--- dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/prepare.sh	(revision 4035)
+++ dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/prepare.sh	(revision 4037)
@@ -149,7 +149,9 @@
 function epilogue_all() {
     cat <<EOF
-cp *.def *.xml job.sh store/
-mv apbp.nc hist*.nc xios_*.err xios_*.out gcm.log store/
-ls -l > store/ls
+mkdir logs
+cp *.def *.xml job.sh logs/
+mv apbp.nc *.err *.out gcm.log logs/
+tar czf logs.tgz logs
+mv hist*.nc logs.tgz store/
 # cleanup
 rm -f *.nc
@@ -193,4 +195,5 @@
 
 function batch_X64_CURIE() { # $1 = first or next
+NB_MPI_TOTAL=$(( $NB_MPI_DYNAMICO + $NB_MPI_XIOS ))
 cat <<EOF
 #!/bin/bash
@@ -201,7 +204,7 @@
 #MSUB -x
 ## Number of tasks (=MPI processes) to use
-#MSUB -n 176
+#MSUB -n $NB_MPI_TOTAL
 ## Elapsed time limit in seconds
-#MSUB -T 7200
+#MSUB -T 10800
 ## Quality of Service required (long [3 days], normal [1 day], test [30 min])
 #MSUB -Q normal
@@ -209,8 +212,6 @@
 $( prologue_all )
 $( prologue_$1 )
-date > gcm.log
 export OMP_NUM_THREADS=1
-ccc_mprun -f mpmd.conf >> gcm.log
-date >> gcm.log
+ccc_mprun -f mpmd.conf
 $( epilogue_$1 )
 $( epilogue_all )
@@ -218,8 +219,17 @@
 
 cat <<EOF > $MYDIR/mpmd.conf
-160 $ICOSA_LMDZ
-16 $XIOS_SERVER
-EOF
-
+$NB_MPI_DYNAMICO ./gcm.sh
+$NB_MPI_XIOS $XIOS_SERVER
+EOF
+
+cat <<EOF > $MYDIR/gcm.sh
+#!/bin/bash
+ME=\${BRIDGE_MPRUN_RANKID}
+GCM=\$(printf 'dynamico.%04d' \$ME)
+date > \${GCM}.out
+$ICOSA_LMDZ >> \${GCM}.out 2>\${GCM}.err
+date >> \${GCM}.out
+EOF
+chmod a+x $MYDIR/gcm.sh
 }
 
@@ -235,4 +245,7 @@
 XIOS_SERVER=$(fullpath "$ESM_ROOT/XIOS/bin/xios_server.exe")
 ICOSA_LMDZ=$(fullpath "$ESM_ROOT/ICOSA_LMDZ/bin/icosa_lmdz.exe")
+
+NB_MPI_DYNAMICO=160
+NB_MPI_XIOS=16
 
 TYPE=$1
