[1471] | 1 | #! /bin/bash |
---|
| 2 | |
---|
| 3 | ################################ |
---|
| 4 | # A. Spiga 09/06/2015 |
---|
| 5 | # Install the LMD mesoscale model |
---|
| 6 | ################################ |
---|
| 7 | # prerequisite: NETCDF |
---|
| 8 | # -- NETCDF env variable |
---|
| 9 | ################################ |
---|
| 10 | ## DEFAULT |
---|
| 11 | ## name of the folder |
---|
[1568] | 12 | name="MESORUN" |
---|
[1551] | 13 | ## SVN version |
---|
| 14 | version="HEAD" |
---|
[1554] | 15 | version="1520" |
---|
[1471] | 16 | ################################ |
---|
| 17 | |
---|
[1568] | 18 | meso="on" |
---|
[1613] | 19 | gcm="" |
---|
[1852] | 20 | gcmcompile="on" |
---|
[1873] | 21 | les="off" |
---|
[1865] | 22 | fortcom="ifort" |
---|
[1873] | 23 | while getopts "gn:hv:f:ol" options; do |
---|
[1471] | 24 | case $options in |
---|
| 25 | n ) name="${OPTARG}";; |
---|
[1568] | 26 | g ) meso="off";; |
---|
[1613] | 27 | v ) version="${OPTARG}";; |
---|
| 28 | o ) gcm="old" ;; |
---|
[1873] | 29 | l ) gcmcompile="off";les="on" ;; |
---|
[1865] | 30 | f ) fortcom="${OPTARG}" ;; |
---|
[1471] | 31 | h ) echo " |
---|
| 32 | # OPTIONS |
---|
[1613] | 33 | # -n [name] --> name of the folder to be created |
---|
| 34 | # -g --> only compile GCM (for tests) |
---|
| 35 | # -v [# (or) HEAD] --> svn version |
---|
| 36 | # -o --> old GCM+meso version |
---|
[1852] | 37 | # -l --> LES version (only new physics) |
---|
[1865] | 38 | # -f --> fortran compiler (experimental) |
---|
[1471] | 39 | " ; exit ;; |
---|
| 40 | esac |
---|
| 41 | done |
---|
| 42 | |
---|
| 43 | ################################ |
---|
| 44 | ## machine on which you will compile |
---|
| 45 | machine="CICLAD" |
---|
| 46 | ## server for sources |
---|
| 47 | where_is_svn="http://svn.lmd.jussieu.fr/Planeto/trunk/" |
---|
| 48 | ## grid definition for GCM |
---|
| 49 | dimgcm="64x48x29" |
---|
| 50 | ## location of static data |
---|
[2205] | 51 | webrepo="http://www.lmd.jussieu.fr/~aslmd/mesoscale_model/data_static/" |
---|
[1865] | 52 | ## TBD: datadir: http://www.lmd.jussieu.fr/~lmdz/planets/mars/datadir/ |
---|
[1471] | 53 | ################################ |
---|
| 54 | |
---|
| 55 | ## ----------------------------- |
---|
| 56 | ## import settings and structure |
---|
| 57 | ## ----------------------------- |
---|
| 58 | echo "*** get structure" |
---|
| 59 | rm -rf $name > /dev/null 2> /dev/null |
---|
[1613] | 60 | svn -q co $where_is_svn"/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN"$gcm $name |
---|
[1471] | 61 | refrepo=$PWD/$name |
---|
| 62 | ## fill here user input to obtain independent script |
---|
[1613] | 63 | case ${fortcom}$gcm in |
---|
| 64 | "ifort") echo 1 > $refrepo/wpsin ; echo 5 > $refrepo/mesoin ; echo 1 >> $refrepo/mesoin ;; |
---|
[1852] | 65 | "ifortold") echo 1 > $refrepo/wpsin ; echo 5 > $refrepo/mesoin ; echo 4 >> $refrepo/mesoin ; |
---|
[1873] | 66 | echo 61 >> $refrepo/mesoin ; echo 61 >> $refrepo/mesoin ; echo 61 >> $refrepo/mesoin ; |
---|
| 67 | echo 1 >> $refrepo/mesoin ; echo 1 >> $refrepo/mesoin ;; |
---|
[1865] | 68 | "gnuold") echo 10 > $refrepo/wpsin ; echo 8 > $refrepo/mesoin ; |
---|
| 69 | echo 61 >> $refrepo/mesoin ; echo 61 >> $refrepo/mesoin ; echo 61 >> $refrepo/mesoin ; |
---|
| 70 | echo 1 >> $refrepo/mesoin ; echo 1 >> $refrepo/mesoin ;; |
---|
| 71 | *) echo "compiler not supported" ; exit ;; |
---|
[1471] | 72 | esac |
---|
| 73 | |
---|
| 74 | ## ---------------- |
---|
| 75 | ## create code repo |
---|
| 76 | ## ---------------- |
---|
| 77 | echo "*** get SVN repository" |
---|
[1556] | 78 | \rm $refrepo/code |
---|
[1471] | 79 | svn -q co -N $where_is_svn $refrepo/code |
---|
| 80 | |
---|
[1873] | 81 | |
---|
[1613] | 82 | ################################### |
---|
| 83 | ################################### GCM |
---|
| 84 | ################################### |
---|
| 85 | if [[ "${gcm}" == "old" ]] |
---|
| 86 | then |
---|
[1471] | 87 | |
---|
[1873] | 88 | if [[ "${gcmcompile}" == "on" ]] |
---|
| 89 | then |
---|
| 90 | log=$refrepo/code/MESOSCALE/LMDZ.MARS/logcompile_gcm |
---|
| 91 | echo "*** get and compile GCM code version "$version |
---|
| 92 | cd $refrepo/code |
---|
| 93 | svn update -r $version MESOSCALE > /dev/null |
---|
| 94 | cd $refrepo/code/MESOSCALE/LMDZ.MARS |
---|
| 95 | ln -sf makegcm_$fortcom makegcm |
---|
| 96 | ./compile > $log 2> $log |
---|
| 97 | fi |
---|
[1613] | 98 | |
---|
| 99 | else |
---|
[1471] | 100 | |
---|
[1613] | 101 | ## ------------ |
---|
| 102 | ## get GCM code |
---|
| 103 | ## ------------ |
---|
| 104 | echo "*** get GCM code version "$version |
---|
| 105 | cd $refrepo/code |
---|
[1852] | 106 | # at least get Mars physics (always needed) |
---|
[1613] | 107 | svn -q update -r $version LMDZ.MARS |
---|
[1852] | 108 | |
---|
| 109 | ## START compiling GCM PART |
---|
| 110 | if [[ "${gcmcompile}" == "on" ]] |
---|
| 111 | then |
---|
| 112 | |
---|
[1613] | 113 | svn -q update -r $version LMDZ.COMMON |
---|
| 114 | cd $refrepo/code/LMDZ.COMMON |
---|
| 115 | svn -q co http://forge.ipsl.jussieu.fr/fcm/svn/PATCHED/FCM_V1.2 |
---|
| 116 | ln -sf FCM_V1.2/bin/fcm . |
---|
[1471] | 117 | |
---|
[1613] | 118 | ## -------------- |
---|
| 119 | ## compile IOIPSL |
---|
| 120 | ## -------------- |
---|
| 121 | log=$refrepo/code/logcompile_ioipsl |
---|
| 122 | echo "*** compile IOIPSL: check progress in "$log |
---|
| 123 | rm -rf $log ; touch $log |
---|
| 124 | cd $refrepo/code/LMDZ.COMMON/ioipsl |
---|
[2205] | 125 | if [[ "${machine}" == "CICLAD" ]] |
---|
| 126 | then |
---|
| 127 | ./install_ioipsl_ciclad.bash > $log 2> $log |
---|
| 128 | else |
---|
| 129 | ./install_ioipsl_$fortcom".bash" > $log 2> $log |
---|
| 130 | fi |
---|
[1613] | 131 | |
---|
| 132 | ## ----------- |
---|
| 133 | ## compile GCM |
---|
| 134 | ## ----------- |
---|
| 135 | log=$refrepo/code/logcompile_gcm |
---|
| 136 | echo "*** compile GCM: check progress in "$log |
---|
| 137 | rm -rf $log ; touch $log |
---|
[1630] | 138 | # make a re-usable command |
---|
| 139 | echo "#! /bin/bash" > $refrepo/compile_gcm.sh |
---|
| 140 | echo "cd $refrepo/code/LMDZ.COMMON" >> $refrepo/compile_gcm.sh |
---|
| 141 | echo "./makelmdz_fcm -cpp MESOINI -j 8 -s 2 -d $dimgcm -arch $machine$fortcom -parallel mpi -p mars gcm" >> $refrepo/compile_gcm.sh |
---|
| 142 | echo "./makelmdz_fcm -j 8 -s 2 -d $dimgcm -arch $machine$fortcom -p mars newstart" >> $refrepo/compile_gcm.sh |
---|
| 143 | echo "cd $refrepo/gcm ; \rm gcm.e ; ln -sf $refrepo/code/LMDZ.COMMON/bin/gcm_${dimgcm}_phymars_para.e gcm.e" >> $refrepo/compile_gcm.sh |
---|
| 144 | echo "cd $refrepo/gcm/newstart ; \rm newstart.e ; ln -sf $refrepo/code/LMDZ.COMMON/bin/newstart_${dimgcm}_phymars_seq.e newstart.e" >> $refrepo/compile_gcm.sh |
---|
| 145 | chmod 755 $refrepo/compile_gcm.sh |
---|
| 146 | # now execute command |
---|
| 147 | $refrepo/compile_gcm.sh > $log 2> $log |
---|
[1613] | 148 | |
---|
| 149 | ## ------------------------ |
---|
| 150 | ## make a minimal startbase |
---|
| 151 | ## ------------------------ |
---|
| 152 | echo "*** make a minimal startbase" |
---|
| 153 | cd $refrepo/gcm/newstart |
---|
| 154 | ./mini_startbase.sh |
---|
| 155 | |
---|
| 156 | fi |
---|
| 157 | |
---|
[1852] | 158 | fi |
---|
| 159 | |
---|
[1613] | 160 | ################################### |
---|
| 161 | ################################### MESO |
---|
| 162 | ################################### |
---|
| 163 | |
---|
[1568] | 164 | ## START MESOSCALE PART |
---|
| 165 | if [[ "${meso}" == "on" ]] |
---|
| 166 | then |
---|
| 167 | |
---|
[1873] | 168 | ### |
---|
| 169 | if [[ "${gcm}" == "old" ]] |
---|
| 170 | then |
---|
| 171 | option="" |
---|
| 172 | else |
---|
| 173 | option="-p mars_lmd_new" |
---|
| 174 | fi |
---|
| 175 | ### |
---|
| 176 | |
---|
[1471] | 177 | ## ---------------------- |
---|
| 178 | ## get and make mesoscale |
---|
| 179 | ## ---------------------- |
---|
[1551] | 180 | echo "*** get and compile mesoscale version "$version |
---|
[1471] | 181 | cd $refrepo/code |
---|
[1551] | 182 | svn update -r $version MESOSCALE > /dev/null |
---|
[1613] | 183 | # |
---|
[1873] | 184 | if [[ "${les}" == "on" ]] |
---|
[1613] | 185 | then |
---|
[1873] | 186 | echo "*** LES LES LES LES" |
---|
| 187 | cd $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/LES/ |
---|
| 188 | ./LMD_LES_MARS_install > /dev/null |
---|
| 189 | option=$option" -c les" |
---|
[1613] | 190 | fi |
---|
| 191 | # |
---|
[1873] | 192 | cd $refrepo/code/MESOSCALE/LMD_MM_MARS |
---|
[1471] | 193 | ls $refrepo/mesoin |
---|
| 194 | if [[ "$?" == 0 ]] ; then |
---|
[1613] | 195 | ./makemeso $option < $refrepo/mesoin |
---|
[1471] | 196 | else |
---|
[1613] | 197 | ./makemeso $option |
---|
[1471] | 198 | fi |
---|
| 199 | rm -rf $refrepo/mesoin |
---|
| 200 | |
---|
[1873] | 201 | if [[ "${les}" == "off" ]] |
---|
| 202 | then |
---|
[1471] | 203 | ## ------------------------------- |
---|
| 204 | ## make ini&bdy tools in mesoscale |
---|
| 205 | ## ------------------------------- |
---|
| 206 | echo "*** compile initialization tools" |
---|
| 207 | cd $refrepo/code_compiled |
---|
| 208 | ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/prepare_ini . |
---|
| 209 | ./prepare_ini > /dev/null |
---|
| 210 | ## |
---|
| 211 | cd $refrepo/code_compiled/PREP_MARS |
---|
| 212 | ./compile"_"$fortcom |
---|
| 213 | ## |
---|
| 214 | cd $refrepo/code_compiled/WPS |
---|
| 215 | ls $refrepo/wpsin |
---|
| 216 | if [[ "$?" == 0 ]] ; then |
---|
| 217 | ./configure < $refrepo/wpsin > /dev/null 2> /dev/null |
---|
| 218 | else |
---|
| 219 | ./configure |
---|
| 220 | fi |
---|
| 221 | rm -rf $refrepo/wpsin |
---|
| 222 | rm -rf logcompile |
---|
| 223 | ./compile > logcompile 2>&1 |
---|
| 224 | |
---|
| 225 | ## ------------------ |
---|
| 226 | ## import static data |
---|
| 227 | ## ------------------ |
---|
| 228 | echo "*** get static data" |
---|
[1556] | 229 | rm -rf $refrepo/data_static |
---|
[1471] | 230 | svn co -q $where_is_svn/MESOSCALE/LMD_MM_MARS/WPS_GEOG $refrepo/data_static |
---|
| 231 | cd $refrepo/data_static |
---|
| 232 | rm -rf logdown |
---|
| 233 | wget $webrepo"/albedo_TES.tar.gz" -a logdown |
---|
| 234 | wget $webrepo"/mola_topo64.tar.gz" -a logdown |
---|
| 235 | wget $webrepo"/thermal_TES.tar.gz" -a logdown |
---|
| 236 | for fff in *.tar.gz; do |
---|
| 237 | tar xzvf $fff > /dev/null |
---|
| 238 | rm -rf $fff |
---|
| 239 | done |
---|
[1873] | 240 | fi |
---|
[1471] | 241 | |
---|
[1551] | 242 | ## ------------------------ |
---|
[1559] | 243 | ## get and compile postproc |
---|
| 244 | ## ------------------------ |
---|
| 245 | echo "*** get and compile post-processing tool" |
---|
[1561] | 246 | cd $refrepo |
---|
[1559] | 247 | svn co -q https://github.com/aymeric-spiga/api/trunk postproc |
---|
| 248 | cd $refrepo/postproc |
---|
| 249 | ./compile |
---|
| 250 | |
---|
[1568] | 251 | fi |
---|
| 252 | ## END MESOSCALE PART |
---|
| 253 | |
---|
[1471] | 254 | ## ----- |
---|
| 255 | ## check |
---|
| 256 | ## ----- |
---|
| 257 | echo "*** CHECKLIST:" |
---|
| 258 | ls -lL $refrepo/gcm/gcm.e |
---|
| 259 | ls -lL $refrepo/geogrid/geogrid.exe |
---|
| 260 | ls -lL $refrepo/metgrid/metgrid.exe |
---|
| 261 | ls -lL $refrepo/prep/readmeteo.exe |
---|
| 262 | ls -lL $refrepo/data_static/albedo_TES |
---|
| 263 | ls -lL $refrepo/real.exe |
---|
| 264 | ls -lL $refrepo/wrf.exe |
---|
[1559] | 265 | ls -lL $refrepo/postproc/api |
---|
[1471] | 266 | |
---|