[1693] | 1 | #!/bin/ksh |
---|
[1704] | 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 |
---|
[1693] | 7 | # |
---|
[1704] | 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/ |
---|
[2050] | 11 | # 3) compile the lmdz1.F with vertical resolution L59 and L40 |
---|
[1704] | 12 | # 4) runs a subset of the cases |
---|
| 13 | ############################################################################### |
---|
[1693] | 14 | |
---|
[2033] | 15 | PATH=~/bin:$PATH |
---|
| 16 | |
---|
| 17 | armcu=1 |
---|
| 18 | toga=1 |
---|
| 19 | twpice=1 |
---|
[2050] | 20 | # |
---|
| 21 | llm=59 |
---|
[2033] | 22 | |
---|
[1726] | 23 | # Check in ~lmdz/WWW/DistribG95 which 1d version to use |
---|
[2035] | 24 | version1d=20140428 |
---|
[1704] | 25 | modele="" |
---|
| 26 | if [ "$modele" = "" ] ; then |
---|
| 27 | if [ -f install.sh ] ; then |
---|
[1841] | 28 | version=`sed -n "s/^version=//p" install.sh | tail -1` |
---|
[1704] | 29 | echo $version |
---|
| 30 | modele=`pwd`/LMDZ${version} |
---|
| 31 | elif [ -d modipsl ] ; then |
---|
| 32 | modele=`pwd` |
---|
| 33 | else |
---|
| 34 | echo "You should run instal1d.sh either in the directory" |
---|
| 35 | echo "containing install.sh, or in that containing modipsl" |
---|
| 36 | echo "or specify the path of LMDZ. modele=LMDZ... in instal1d.sh" |
---|
| 37 | exit |
---|
| 38 | fi |
---|
| 39 | fi |
---|
[1693] | 40 | |
---|
[1704] | 41 | ############################################################################### |
---|
| 42 | # Paths of main directories |
---|
| 43 | # Directories of simulations will be placed in |
---|
| 44 | # $modele/1dcases |
---|
| 45 | # Sources of physical routines in $modele/modipsl/modeles/LMDZ5/libf/phy1d |
---|
| 46 | ############################################################################### |
---|
[1693] | 47 | cd $modele |
---|
| 48 | LMDGCM=`pwd` |
---|
[1704] | 49 | LMDlibf=$LMDGCM/modipsl/modeles/LMDZ5/libf/ |
---|
[2050] | 50 | cd $LMDlibf |
---|
| 51 | rev=`svn info -r BASE | grep vision | tail -1 | awk ' { print $NF } '` |
---|
| 52 | cd $LMDGCM |
---|
[1693] | 53 | |
---|
[1704] | 54 | ############################################################################### |
---|
| 55 | # Check if the svn version is more recent than 1700 |
---|
| 56 | # If not, an older script must be used |
---|
| 57 | ############################################################################### |
---|
| 58 | cd $LMDGCM/modipsl/modeles |
---|
| 59 | new1d=`svn info LMDZ5 | grep Revision | awk ' { fl = 0 ; if ( $2 > 1699 ) fl=1 ; print fl } '` |
---|
| 60 | echo new1d $new1d |
---|
| 61 | if [ $new1d = 0 ] ; then |
---|
| 62 | echo Your model verison is too old for this instal1d.sh script |
---|
| 63 | echo You should use instead |
---|
| 64 | echo http://www.lmd.jussieu.fr/~lmdz/Distrib/install_old_archive/instal1d.sh |
---|
| 65 | exit |
---|
| 66 | fi |
---|
[1693] | 67 | |
---|
[1704] | 68 | ############################################################################### |
---|
| 69 | # Downloading modified source files and input files |
---|
| 70 | ############################################################################### |
---|
[1693] | 71 | cd $LMDGCM |
---|
[1704] | 72 | interne=no # can be modified once the files have been downloaded |
---|
| 73 | # in order to take them directly on your computer |
---|
| 74 | if [ $interne = no ] ; then |
---|
[1726] | 75 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/lmdz1d_source_${version1d}.tar.gz |
---|
| 76 | tar xvfz lmdz1d_source_${version1d}.tar.gz |
---|
| 77 | rm -f lmdz1d_source_${version1d}.tar.gz |
---|
| 78 | source=${LMDGCM}/lmdz1d_source_${version1d} |
---|
[1693] | 79 | else |
---|
[1704] | 80 | cp -a /home/jygz/LMDZ/SLMDZ/LMDZ5_source_20120112/lmdz1d_source_20120112 . |
---|
| 81 | source=${LMDGCM}/lmdz1d_source_20120112 |
---|
[1693] | 82 | fi |
---|
| 83 | |
---|
[1704] | 84 | ################################################################################ |
---|
| 85 | # Creating directory for 1d cases |
---|
| 86 | ################################################################################ |
---|
[1876] | 87 | if [ -d 1dcases ] ; then |
---|
[1693] | 88 | echo '1dcases existe deja' |
---|
| 89 | echo 'on continue' |
---|
| 90 | else |
---|
| 91 | echo 'creation du directory 1dcases' |
---|
| 92 | mkdir 1dcases |
---|
| 93 | fi |
---|
| 94 | cd 1dcases |
---|
| 95 | |
---|
[1868] | 96 | for cas in amma arm_cu ayotte case_e eq_rd_cv fire hapex92_init rico toga sanduref sandufast sanduslow twpice ; do |
---|
[1876] | 97 | if [ -d $cas ] ; then |
---|
[1693] | 98 | echo $cas existe deja |
---|
| 99 | echo 'on continue, mais il faudra verifier qu il ne manque rien dans '$cas |
---|
| 100 | else |
---|
| 101 | echo 'creation du directory de simulation '$cas |
---|
| 102 | cp -a ${source}/$cas . |
---|
| 103 | fi |
---|
| 104 | dir $cas |
---|
| 105 | done |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | |
---|
[1704] | 109 | ################################################################################ |
---|
| 110 | # Installing source files and compiling |
---|
| 111 | ################################################################################ |
---|
[2050] | 112 | |
---|
| 113 | if [ $rev -le 2015 ] ; then |
---|
[1693] | 114 | cd $LMDlibf |
---|
[2050] | 115 | if [ -f phy1d/thermcell_dq.F90 ] ; then |
---|
| 116 | echo phy1d a deja ete modifie. On repart d une version sauvegardee |
---|
| 117 | if [ ! -d phy1dorig ] ; then |
---|
| 118 | echo Cas a retravailler : le phy1d d origine n est plus dispo |
---|
| 119 | exit |
---|
| 120 | fi |
---|
| 121 | mv phy1d phy1d$$ |
---|
| 122 | cp -r phy1dorig phy1d |
---|
| 123 | else |
---|
| 124 | cp -r phy1d phy1dorig # sauvegarde du phy1d d'origine |
---|
| 125 | fi |
---|
[1704] | 126 | chmod +x ../tools/install_1d_src.sh |
---|
| 127 | ../tools/install_1d_src.sh |
---|
[2050] | 128 | fi |
---|
[1693] | 129 | |
---|
| 130 | ## Nettoyage |
---|
| 131 | \rm -r ${source} |
---|
| 132 | # |
---|
[2050] | 133 | cd ${LMDlibf} |
---|
| 134 | physique=lmd |
---|
| 135 | if [ -d phy1d ] ; then |
---|
| 136 | physique=1d |
---|
| 137 | fi |
---|
| 138 | |
---|
| 139 | cd ../ |
---|
[1693] | 140 | \rm -f makefile |
---|
[2050] | 141 | ./makelmdz -d ${llm} -p ${physique} lmdz1d |
---|
[1704] | 142 | if [ -f lmdz1d.e ] ; then |
---|
[2050] | 143 | mv lmdz1d.e lmdz1d_L${llm}.e |
---|
[1704] | 144 | echo Compilation successfull |
---|
[1868] | 145 | for cas in amma ayotte case_e eq_rd_cv fire hapex92_init rico toga sanduref sandufast sanduslow twpice ; do |
---|
| 146 | rm -f ${LMDGCM}/1dcases/$cas/lmdz1d.e |
---|
[2050] | 147 | ln -s `pwd`/lmdz1d_L${llm}.e ${LMDGCM}/1dcases/$cas/lmdz1d.e |
---|
[1704] | 148 | done |
---|
[1693] | 149 | else |
---|
[1704] | 150 | echo Compilation aborted |
---|
[1868] | 151 | exit |
---|
[1693] | 152 | fi |
---|
[1704] | 153 | |
---|
| 154 | echo '#########################################################################' |
---|
| 155 | echo ' 1D test cases' |
---|
| 156 | echo '#########################################################################' |
---|
| 157 | |
---|
[2033] | 158 | if [ $toga = 1 ] ; then |
---|
[1704] | 159 | echo ==================================== |
---|
[1868] | 160 | echo TEST CASE : toga' (1 month)' |
---|
[1704] | 161 | echo ==================================== |
---|
[1868] | 162 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
| 163 | cd ${LMDGCM}/1dcases/toga |
---|
[1693] | 164 | ./xqt.x NPv3.1 |
---|
[1868] | 165 | \rm tmp.jnl ; touch tmp.jnl |
---|
| 166 | rm -f var.gif |
---|
| 167 | cat <<eod>> tmp.jnl |
---|
| 168 | use histhf_NPv3.1.nc |
---|
| 169 | shade/title="cas toga: cloud fraction (-)" rneb |
---|
| 170 | frame/file=var.gif |
---|
| 171 | eod |
---|
| 172 | ferret <<eod |
---|
| 173 | go tmp.jnl |
---|
| 174 | quit |
---|
| 175 | eod |
---|
[2033] | 176 | display var.gif :& |
---|
[1868] | 177 | rm -f tmp.jnl |
---|
| 178 | rm -f var.gif |
---|
[2033] | 179 | cd .. |
---|
| 180 | fi |
---|
[1704] | 181 | |
---|
[2033] | 182 | if [ $twpice = 1 ] ; then |
---|
[1704] | 183 | echo ==================================== |
---|
[1868] | 184 | echo TEST CASE : twpice |
---|
[1704] | 185 | echo ==================================== |
---|
[1868] | 186 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
[2033] | 187 | cd twpice |
---|
[1693] | 188 | ./xqt.x NPv3.1 |
---|
[1868] | 189 | \rm tmp.jnl ; touch tmp.jnl |
---|
| 190 | rm -f var.gif |
---|
| 191 | cat <<eod>> tmp.jnl |
---|
[2033] | 192 | use histhf_NPv3.1.nc |
---|
[1868] | 193 | shade/title="cas twpice: cloud fraction (-)" rneb |
---|
| 194 | frame/file=var.gif |
---|
| 195 | eod |
---|
| 196 | ferret <<eod |
---|
| 197 | go tmp.jnl |
---|
| 198 | quit |
---|
| 199 | eod |
---|
[2033] | 200 | display -remote var.gif :& |
---|
[1868] | 201 | rm -f tmp.jnl |
---|
| 202 | rm -f var.gif |
---|
[2033] | 203 | cd .. |
---|
| 204 | fi |
---|
[1693] | 205 | |
---|
[1704] | 206 | if [ $armcu = 1 ] ; then |
---|
[1868] | 207 | echo ==================================== |
---|
| 208 | echo TEST CASE : arm_cu |
---|
| 209 | echo ==================================== |
---|
| 210 | echo if the last line \"SIMULATION FINISHED\" is \"Everything is cool!\", the situation went to its end |
---|
[2033] | 211 | cd arm_cu |
---|
[1868] | 212 | ./compile.x |
---|
[2033] | 213 | ln -s lmdz1d.e lmdz1d_L40.e |
---|
[1868] | 214 | ./xqt.x NPv3.1 |
---|
| 215 | \rm tmp.jnl ; touch tmp.jnl |
---|
| 216 | rm -f var.gif |
---|
| 217 | cat <<eod>> tmp.jnl |
---|
[2033] | 218 | use histhf_NPv3.1.nc |
---|
[1868] | 219 | shade/title="cas arm_cu: cloud fraction (-)" rneb |
---|
| 220 | frame/file=var.gif |
---|
| 221 | eod |
---|
| 222 | ferret <<eod |
---|
| 223 | go tmp.jnl |
---|
| 224 | quit |
---|
| 225 | eod |
---|
[2033] | 226 | display -remote var.gif :& |
---|
[1868] | 227 | rm -f tmp.jnl |
---|
| 228 | rm -f var.gif |
---|
[2033] | 229 | cd .. |
---|
[1693] | 230 | fi |
---|
| 231 | |
---|