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