Index: CONFIG/UNIFORM/v7/ICOLMDZOR_v7/compile_icolmdzor.sh
===================================================================
--- CONFIG/UNIFORM/v7/ICOLMDZOR_v7/compile_icolmdzor.sh	(revision 4275)
+++ CONFIG/UNIFORM/v7/ICOLMDZOR_v7/compile_icolmdzor.sh	(revision 4278)
@@ -14,9 +14,10 @@
 export ROOT=$modipsl/modeles/DYNAMICO
 
-#### 1.1 Set default options 
+#### Set default options 
 # Optimization mode
 # optmode=prod/dev/debug
 optmode=prod
 # Resolution if compiling LMDZ in regular mode without DYNAMICO
+# Use for example following "./compile_icolmdzor.sh -regular_lonlat 144x142x79"
 regular_latlon=no
 # fcm_arch
@@ -27,12 +28,12 @@
 full_flag=""
 
-#### 1.2 Read arguments 
+#### Read arguments 
 # Loop over all arguments to modify default set up
 while (($# > 0)) ; do
-case $1 in
-"-h") cat <<fin
+    case $1 in
+	"-h") cat <<fin
 
 ########################################################################
-# Usage of the script compile_config
+# Usage of the script compile_icolmdzor.sh
 #
 ########################################################################
@@ -40,62 +41,70 @@
 ./compile_config [Options] 
 
-Options
-....
-
-Example 1 : ...
-...
+Options: -full, -regular_latlon
+
+Example 1: Default compilation of DYNAMICO-LMDZ-ORCHIDEE with XIOS and IOIPSL
+./compile_icolmdzor.sh
+
+Example 2: Default compilation with full recompilation of all components
+./compile_icolmdzor.sh -full
+
+Example 3: Compilation of LMDZ in regular lat-lon for dimension 144x142x79. 
+The dimension can be changed to any other 3d dimension. DYNAMICO is also compiled as default.
+./compile_icolmdzor.sh -regular_latlon 144x142x79
 
 fin
-exit;;
-
-"-parallel")
-parallel=$2 ; shift ; shift ;; 
-               
-"-arch")
-fcm_arch="$2" ; shift ; shift ;;
-
-"-xios")
-xios="$2" ; shift ; shift ;;
-
-"-optmode")
-optmode=$2 ; shift ; shift ;;
-
-"-regular_latlon")
-regular_latlon=$2 ; shift ; shift ;;
-
-"-full")
-full_flag="-full"; shift ;;
-*)
-echo "unknown option "$2" , exiting..."
-exit 
-esac
+	    exit;;
+
+	"-parallel")
+	    parallel=$2 ; shift ; shift ;; 
+	
+	"-arch")
+	    fcm_arch="$2" ; shift ; shift ;;
+	
+	"-xios")
+	    xios="$2" ; shift ; shift ;;
+	
+	"-optmode")
+	    optmode=$2 ; shift ; shift ;;
+	
+	"-regular_latlon")
+	    regular_latlon=yes ;
+	    resol_atm_3d=$2 ; shift ; shift ;;
+	
+	"-full")
+	    full_flag="-full"; shift ;;
+	
+	*)
+	    echo "unknown option "$2" , exiting..."
+	    exit 
+    esac
 done
-echo full_flag=$full_flag
-
-### 1.3 Read host dependent default values
-###     These variables will not be changed if they were set as argument
+
+
+### Read host dependent default values
+### These variables will not be changed if they were set as argument
 ###./host.sh $host
 # Later : Following lines should be set in host.sh file
 # begin host.sh
 if [ $fcm_arch == default ] ; then
-# Find out current host and source specific paths and commands for the host
-case $( hostname -s ) in
-ada*)
-fcm_arch=X64_ADA;;
-irene*)
-fcm_arch=X64_IRENE;
-source /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/irene/env_irene ;;
-asterix*|obelix*)
-fcm_arch=ifort_LSCE;;
-*)
-echo Current host is not known. You must use option -fcm_arch to specify which architecuture files to use.
-echo Exit now.
-exit
-esac
+    # Find out current host and source specific paths and commands for the host
+    case $( hostname -s ) in
+	ada*)
+	    fcm_arch=X64_ADA;;
+	irene*)
+	    fcm_arch=X64_IRENE;
+	    source /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/irene/env_irene ;;
+	asterix*|obelix*)
+	    fcm_arch=ifort_LSCE;;
+	*)
+	    echo Current host is not known. You must use option -fcm_arch to specify which architecuture files to use.
+	    echo Exit now.
+	    exit
+    esac
 fi
 
 ##### End host.sh
 echo
-echo Following arguments are set in current compiling:
+echo "Following arguments are set in current compiling:"
 echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch, full_flag=$full regular_latlon=$regular_latlon"
 
@@ -103,27 +112,27 @@
 ## 2.1 Compile ioipsl
 cd $modipsl/modeles/IOIPSL
-echo; echo NOW COMPILE IOIPSL
+echo; echo "NOW COMPILE IOIPSL"
 echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag
 ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag
 # Test if compiling succeded 
 if [[ $? != 0 ]] ; then 
-  echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
-  exit
+    echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
+    exit
 fi
 
 ## 2.2 Compile xios
 cd $modipsl/modeles/XIOS
-echo; echo NOW COMPILE XIOS
+echo; echo "NOW COMPILE XIOS"
 echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 8 $full_flag
 ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 8 $full_flag
 # Test if compiling succeded 
 if [[ $? != 0 ]] ; then 
-  echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
-  exit
+    echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
+    exit
 fi
 
 ## 2.3 Compile orchidee
 cd $modipsl/modeles/ORCHIDEE
-echo; echo NOW COMPILE ORCHIDEE
+echo; echo "NOW COMPILE ORCHIDEE"
 echo 	./makeorchidee_fcm -j 8 -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag -driver
 ./makeorchidee_fcm -j 8 -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag -driver
@@ -134,27 +143,19 @@
 fi
 
-
-## 2.5 Compile lmdz
+## 2.4 Compile lmdz
 cd $modipsl/modeles/LMDZ
-if [ ${regular_latlon} = no ] ; then
-    # Compile as library to couple to DYNAMICO
-    echo; echo NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO
-    echo ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
-    ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
-else
-    # Compile regular lat-lon exectuable
-    echo; echo NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${regular_latlon}
-    echo ./makelmdz_fcm -d ${regular_latlon} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_flag gcm
-    ./makelmdz_fcm -d ${regular_latlon} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_flag gcm
-fi
-
-# Test if compiling finished
-if [[ $? != 0 ]] ; then
-    echo "THERE IS A PROBLEM IN LMDZ COMPILATION - STOP"
-    exit
-fi
-
-# Compile DYNAMICO
-echo; echo NOW COMPILE DYNAMICO 
+# Compile LMDZ as library to couple to DYNAMICO
+echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"
+echo ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
+./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
+# Test if compiling finished
+if [[ $? != 0 ]] ; then
+    echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP"
+    exit
+fi
+
+
+## 2.5 Compile DYNAMICO
+echo; echo "NOW COMPILE DYNAMICO "
 cd $modipsl/modeles/DYNAMICO
 echo ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_flag
@@ -162,10 +163,10 @@
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
-  echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
-  exit
-fi
-
-# Compile interface ICOSA_LMDZ
-echo; echo NOW COMPILE ICOSA_LMDZ 
+    echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
+    exit
+fi
+
+## 2.6 Compile interface ICOSA_LMDZ
+echo; echo "NOW COMPILE ICOSA_LMDZ "
 cd $modipsl/modeles/ICOSA_LMDZ
 echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_flag
@@ -174,9 +175,55 @@
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
-  echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
-  exit
-fi
-
-# Move executables to modipsl/bin folder
+    echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
+    exit
+fi
+
+
+## 2.7 Compile LMDZ for regular latlon configuration
+if [ $regular_latlon = yes ] ; then
+
+    cd $modipsl/modeles/LMDZ
+    # Compile LMDZ regular lat-lon exectuable
+    echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm_3d}"
+    echo ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag gcm
+    ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag gcm
+    # Test if compiling finished
+    if [[ $? != 0 ]] ; then
+	echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
+	exit
+    fi
+
+    # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
+    echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm_3d}"
+    echo ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag ce0l
+    ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag ce0l
+    # Test if compiling finished
+    if [[ $? != 0 ]] ; then
+	echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP"
+	exit
+    fi
+
+    # Find executable suffix
+    if [ $parallel == seq ] || [ $parallel == none ] ; then
+	suffix=_${resol_atm_3d}_phylmd_seq_orch
+    else
+	suffix=_${resol_atm_3d}_phylmd_para_mem_orch
+    fi
+    echo suffix = $suffix
+    
+    # Move executables to modipsl/bin folder
+    echo "Move gcm.e and ce0l executable to modipsl/bin"
+    if [ $modipsl/modeles/LMDZ/bin/gcm${suffix}.e ] ;  then mv $modipsl/modeles/LMDZ/bin/gcm${suffix}.e $modipsl/bin/gcm_${resol_atm_3d}.e ; fi
+    if [ $modipsl/modeles/LMDZ/bin/ce0l${suffix}.e ] ;  then mv $modipsl/modeles/LMDZ/bin/ce0l${suffix}.e $modipsl/bin/ce0l_${resol_atm_3d}.e ; fi
+
+    # Write .resol file
+    cd $submitdir   
+    resol2D=$( echo ${resol_atm_3d} | awk '-Fx' '{print $1}' )$( echo ${resol_atm_3d} | awk '-Fx' '{print $2}' )
+    echo "noORCAxLMD$resol2D" >.resol
+    echo "RESOL_ATM_3D=${resol_atm_3d}" >>.resol
+fi
+
+
+##  Move executables to modipsl/bin folder
 echo "Move executables to modipsl/bin"
 if [ $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/. ; fi
@@ -184,27 +231,8 @@
 
 
-# Write resolution into .resol file
-if [ $regular_latlon != no ] ; then
-    # Copy executable
-# Find executable suffix 
-if [ $parallel == seq ] || [ $parallel == none ] ; then
-    suffix=_seq
-else
-    suffix=_para
-fi
-suffix=${suffix}_orch
-echo suffix = $suffix
-    
-
-    # Write .resol file
-    cd $submitdir   
-    resol2D=$( echo ${regular_latlon} | awk '-Fx' '{print $1}' )$( echo ${regular_latlon} | awk '-Fx' '{print $2}' )
-    echo "noORCAxLMD$resol2D" >.resol
-    echo "RESOL_ATM_3D=${regular_latlon}" >>.resol
-fi
-
 echo 
-echo ALL COMPILING FINISHED
+echo "ALL COMPILING FINISHED"
 echo
+
 exit
 
