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