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