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