| 1 | #!/bin/ksh |
|---|
| 2 | |
|---|
| 3 | ############################################################################### |
|---|
| 4 | # Script for installing a 1D version of LMDZ. |
|---|
| 5 | # LMDZ team. For questions : lmdz-svp@lmd.jussieu.fr |
|---|
| 6 | # valid for svn version from 21/12/2012 (end of the world) or svn 1700 |
|---|
| 7 | # |
|---|
| 8 | # 1) Modifies the directory LMDZ.../modipsl/modeles/LMDZ5/libf/phy1d |
|---|
| 9 | # which contains the single column version of the model. |
|---|
| 10 | # 2) installs a series of test cases on LMDZ.../1dcases/ |
|---|
| 11 | # 3) compile the lmdz1.F with vertical resolution L39 and L40 |
|---|
| 12 | # 4) runs a subset of the cases |
|---|
| 13 | ############################################################################### |
|---|
| 14 | |
|---|
| 15 | # Check in ~lmdz/WWW/DistribG95 which 1d version to use |
|---|
| 16 | version1d=20130225 |
|---|
| 17 | modele="" |
|---|
| 18 | if [ "$modele" = "" ] ; then |
|---|
| 19 | if [ -f install.sh ] ; then |
|---|
| 20 | version=`sed -n "s/version=//p" install.sh | tail -1` |
|---|
| 21 | echo $version |
|---|
| 22 | modele=`pwd`/LMDZ${version} |
|---|
| 23 | elif [ -d modipsl ] ; then |
|---|
| 24 | modele=`pwd` |
|---|
| 25 | else |
|---|
| 26 | echo "You should run instal1d.sh either in the directory" |
|---|
| 27 | echo "containing install.sh, or in that containing modipsl" |
|---|
| 28 | echo "or specify the path of LMDZ. modele=LMDZ... in instal1d.sh" |
|---|
| 29 | exit |
|---|
| 30 | fi |
|---|
| 31 | fi |
|---|
| 32 | |
|---|
| 33 | ############################################################################### |
|---|
| 34 | # Paths of main directories |
|---|
| 35 | # Directories of simulations will be placed in |
|---|
| 36 | # $modele/1dcases |
|---|
| 37 | # Sources of physical routines in $modele/modipsl/modeles/LMDZ5/libf/phy1d |
|---|
| 38 | ############################################################################### |
|---|
| 39 | cd $modele |
|---|
| 40 | LMDGCM=`pwd` |
|---|
| 41 | LMDlibf=$LMDGCM/modipsl/modeles/LMDZ5/libf/ |
|---|
| 42 | |
|---|
| 43 | ############################################################################### |
|---|
| 44 | # Check if the svn version is more recent than 1700 |
|---|
| 45 | # If not, an older script must be used |
|---|
| 46 | ############################################################################### |
|---|
| 47 | cd $LMDGCM/modipsl/modeles |
|---|
| 48 | new1d=`svn info LMDZ5 | grep Revision | awk ' { fl = 0 ; if ( $2 > 1699 ) fl=1 ; print fl } '` |
|---|
| 49 | echo new1d $new1d |
|---|
| 50 | if [ $new1d = 0 ] ; then |
|---|
| 51 | echo Your model verison is too old for this instal1d.sh script |
|---|
| 52 | echo You should use instead |
|---|
| 53 | echo http://www.lmd.jussieu.fr/~lmdz/Distrib/install_old_archive/instal1d.sh |
|---|
| 54 | exit |
|---|
| 55 | fi |
|---|
| 56 | |
|---|
| 57 | ############################################################################### |
|---|
| 58 | # Downloading modified source files and input files |
|---|
| 59 | ############################################################################### |
|---|
| 60 | cd $LMDGCM |
|---|
| 61 | interne=no # can be modified once the files have been downloaded |
|---|
| 62 | # in order to take them directly on your computer |
|---|
| 63 | if [ $interne = no ] ; then |
|---|
| 64 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/lmdz1d_source_${version1d}.tar.gz |
|---|
| 65 | tar xvfz lmdz1d_source_${version1d}.tar.gz |
|---|
| 66 | rm -f lmdz1d_source_${version1d}.tar.gz |
|---|
| 67 | source=${LMDGCM}/lmdz1d_source_${version1d} |
|---|
| 68 | else |
|---|
| 69 | cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 . |
|---|
| 70 | source=${LMDGCM}/lmdz1d_source_20120112 |
|---|
| 71 | fi |
|---|
| 72 | |
|---|
| 73 | ################################################################################ |
|---|
| 74 | # Creating directory for 1d cases |
|---|
| 75 | ################################################################################ |
|---|
| 76 | if [ -f 1dcases ] ; then |
|---|
| 77 | echo '1dcases existe deja' |
|---|
| 78 | echo 'on continue' |
|---|
| 79 | else |
|---|
| 80 | echo 'creation du directory 1dcases' |
|---|
| 81 | mkdir 1dcases |
|---|
| 82 | fi |
|---|
| 83 | cd 1dcases |
|---|
| 84 | |
|---|
| 85 | for cas in ayotte eq_rd_cv case_e hapex92_init twpice toga rico arm_cu ; do |
|---|
| 86 | if [ -f $cas ] ; then |
|---|
| 87 | echo $cas existe deja |
|---|
| 88 | echo 'on continue, mais il faudra verifier qu il ne manque rien dans '$cas |
|---|
| 89 | else |
|---|
| 90 | echo 'creation du directory de simulation '$cas |
|---|
| 91 | cp -a ${source}/$cas . |
|---|
| 92 | fi |
|---|
| 93 | dir $cas |
|---|
| 94 | done |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | ################################################################################ |
|---|
| 99 | # Installing source files and compiling |
|---|
| 100 | ################################################################################ |
|---|
| 101 | cd $LMDlibf |
|---|
| 102 | chmod +x ../tools/install_1d_src.sh |
|---|
| 103 | ../tools/install_1d_src.sh |
|---|
| 104 | |
|---|
| 105 | ## Nettoyage |
|---|
| 106 | \rm -r ${source} |
|---|
| 107 | # |
|---|
| 108 | cd ${LMDlibf}/.. |
|---|
| 109 | \rm -f makefile |
|---|
| 110 | ./makegcm -d 39 -p 1d lmdz1d |
|---|
| 111 | if [ -f lmdz1d.e ] ; then |
|---|
| 112 | mv lmdz1d.e lmdz1d_L39.e |
|---|
| 113 | echo Compilation successfull |
|---|
| 114 | for rep in ayotte case_e eq_rd_cv hapex92_init rico toga twpice ; do |
|---|
| 115 | ln -s `pwd`/lmdz1d_L39.e ${LMDGCM}/1dcases/$rep/lmdz1d.e |
|---|
| 116 | done |
|---|
| 117 | else |
|---|
| 118 | echo Compilation aborted |
|---|
| 119 | stop |
|---|
| 120 | fi |
|---|
| 121 | |
|---|
| 122 | echo '#########################################################################' |
|---|
| 123 | echo ' 1D test cases' |
|---|
| 124 | echo '#########################################################################' |
|---|
| 125 | |
|---|
| 126 | echo ==================================== |
|---|
| 127 | echo TEST CASE : case_e |
|---|
| 128 | echo ==================================== |
|---|
| 129 | cd ${LMDGCM}/1dcases/case_e |
|---|
| 130 | ./xqt.x NPv3.1 |
|---|
| 131 | |
|---|
| 132 | echo ==================================== |
|---|
| 133 | echo TEST CASE : toga' (1 month)' |
|---|
| 134 | echo ==================================== |
|---|
| 135 | cd ${LMDGCM}/1dcases/toga |
|---|
| 136 | ./xqt.x NPv3.1 |
|---|
| 137 | |
|---|
| 138 | armcu=1 |
|---|
| 139 | if [ $armcu = 1 ] ; then |
|---|
| 140 | echo ==================================== |
|---|
| 141 | echo TEST CASE : arm_cu |
|---|
| 142 | echo ==================================== |
|---|
| 143 | cd ${LMDGCM}/1dcases/arm_cu |
|---|
| 144 | ./compile.x |
|---|
| 145 | ln -s lmdz1d_L40.e lmdz1d.e |
|---|
| 146 | ./xqt.x NPv3.1 |
|---|
| 147 | fi |
|---|
| 148 | |
|---|
| 149 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | |
|---|