Index: /trunk/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN/launch
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN/launch	(revision 2498)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN/launch	(revision 2499)
@@ -1,19 +1,41 @@
 #! /bin/bash
 
+########################################################
 #PBS -S  /bin/bash
 #PBS -j  oe
-##PBS -q  week
-#PBS -q day
+########################################################
+### available queues: 
+### short std h12 day days3 week weeks2 infini
+### 2h    6h  12h 24h 72h   168h 340h   840h
+########################################################
+#PBS -q  week
 #PBS -N  run
-#PBS -l  nodes=1:ppn=8
+########################################################
+### single processor (e.g. testing)
 ##PBS -l  nodes=1:ppn=1
-#PBS -l  mem=64gb
-#PBS -l  vmem=64gb
+########################################################
+## standard run 121x121x61
+#PBS -l  nodes=1:ppn=4,mem=4gb,vmem=6gb
+########################################################
+### large-domain run 321x321x61 (OK but slower)
+##PBS -l  nodes=1:ppn=16,mem=16gb,vmem=24gb
+########################################################
+### large-domain run 321x321x61
+##PBS -l  nodes=1:ppn=32,mem=32gb,vmem=48gb
+########################################################
+### need for large memory
+##PBS -l  mem=120gb
+##PBS -l  vmem=120gb
+########################################################
 #PBS -v  step=1
-
-#### NB: "qsub -v step=XX launch" overrides value above
+## NB: "qsub -v step=XX launch" overrides value above
+########################################################
 
 #### PREAMBLE
 ulimit -s unlimited
+
+# This finds out the number of nodes we have
+NP=$(wc -l $PBS_NODEFILE | awk '{print $1}')
+echo "Total CPU count = $NP"
 
 #### STEP 1
@@ -21,13 +43,14 @@
   cd $PBS_O_WORKDIR/gcm
   #
-  year=$(more namelist.input | grep start_year | awk '{print $3}' | sed s+','+''+g)
-  month=$(more namelist.input | grep start_month | awk '{print $3}' | sed s+','+''+g)
-  day=$(more namelist.input | grep start_day | awk '{print $3}' | sed s+','+''+g)
-  hour=$(more namelist.input | grep start_hour | awk '{print $3}' | sed s+','+''+g)
-  wrf_date=${year}'-'${month}'-'${day}'_00:00:00'
-  daygcm=$(more calendar | grep ${wrf_date} | awk '{print $2}')
-  echo ${daygcm} | ./launch_gcm
+  ./get_startday_from_namelist.sh | ./launch_gcm
   #
-  $WHERE_MPI/mpirun gcm.e > log_gcm
+  if [[ $NP -gt 24 ]] ; then
+    echo "--- Total CPU count is above 24"
+    echo "--- For the standard GCM resolution, this is too much"
+    echo "--- So we run the GCM only with 24 processors"
+    $WHERE_MPI/mpirun -np 24 gcm.e > log_gcm
+  else
+    $WHERE_MPI/mpirun gcm.e > log_gcm
+  fi
   #
   cd $PBS_O_WORKDIR/prep
