source: trunk/MESOSCALE/LMD_MM_MARS/SIMU/meso_install.sh @ 2613

Last change on this file since 2613 was 2474, checked in by aslmd, 4 years ago

MESOSCALE: updated SVN address in workflow installation script

File size: 7.4 KB
RevLine 
[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]12name="MESORUN"
[2445]13## git version or tag
14version="tags/mesoscale-jezero"
15version="tags/gcm-mesoini-ok"
[2472]16version="841f9fc0b74168c34dbbcd47fef2544654a3d763" #2315
17version="tags/mesoscale-compile-run"
18## once folder created, code may be updated using git reset --hard $commit_SHA
[1471]19################################
20
[1568]21meso="on"
[1613]22gcm=""
[1852]23gcmcompile="on"
[1873]24les="off"
[1865]25fortcom="ifort"
[1873]26while 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
44done
45
46################################
47## machine on which you will compile
48machine="CICLAD"
49## server for sources
[2474]50where_is_svn="https://svn.lmd.jussieu.fr/Planeto/trunk/"
[2445]51## server for sources
52where_is_git="git@gitlab.in2p3.fr:la-communaut-des-mod-les-atmosph-riques-plan-taires/git-trunk.git"
53## depth of git checkout
54depth=500 # should be enough and avoid too big a directory
[1471]55## grid definition for GCM
56dimgcm="64x48x29"
57## location of static data
[2205]58webrepo="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## -----------------------------
66echo "*** get structure"
67rm -rf $name > /dev/null 2> /dev/null
[1613]68svn -q co $where_is_svn"/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN"$gcm $name
[1471]69refrepo=$PWD/$name
70## fill here user input to obtain independent script
[1613]71case ${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]80esac
81
82## ----------------
83## create code repo
84## ----------------
[2445]85echo "*** get gitlab repository"
[1556]86\rm $refrepo/code
[2445]87git clone --depth $depth $where_is_git $refrepo/code
88echo "*** set a branch with same name as repo for version "$version
89cd $refrepo/code
90git checkout $version -b $name
[1471]91
[1613]92###################################
93################################### GCM
94###################################
95if [[ "${gcm}" == "old" ]]
96then
[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]107fi
[1471]108
[1852]109## START compiling GCM PART
110if [[ "${gcmcompile}" == "on" ]]
111then
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
155fi
156
157###################################
158################################### MESO
159###################################
160
[1568]161## START MESOSCALE PART
162if [[ "${meso}" == "on" ]]
163then
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]177echo "*** compile mesoscale"
[1613]178#
[1873]179if [[ "${les}" == "on" ]]
[1613]180then
[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]185fi
186#
[1873]187cd $refrepo/code/MESOSCALE/LMD_MM_MARS
[1471]188ls $refrepo/mesoin
189if [[ "$?" == 0 ]] ; then
[1613]190  ./makemeso $option < $refrepo/mesoin
[1471]191else
[1613]192  ./makemeso $option
[1471]193fi
194rm -rf $refrepo/mesoin
195
[1873]196if [[ "${les}" == "off" ]]
197then
[1471]198## -------------------------------
199## make ini&bdy tools in mesoscale
200## -------------------------------
201echo "*** compile initialization tools"
202cd $refrepo/code_compiled
203ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/prepare_ini .
204./prepare_ini > /dev/null
205##
206cd $refrepo/code_compiled/PREP_MARS
207./compile"_"$fortcom
208##
209cd $refrepo/code_compiled/WPS
210ls $refrepo/wpsin
211if [[ "$?" == 0 ]] ; then
212  ./configure < $refrepo/wpsin > /dev/null 2> /dev/null
213else
214  ./configure
215fi
216rm -rf $refrepo/wpsin
217rm -rf logcompile
218./compile > logcompile 2>&1
219
220## ------------------
221## import static data
222## ------------------
223echo "*** get static data"
[1556]224rm -rf $refrepo/data_static
[1471]225svn co -q $where_is_svn/MESOSCALE/LMD_MM_MARS/WPS_GEOG $refrepo/data_static
226cd $refrepo/data_static
227rm -rf logdown
228wget $webrepo"/albedo_TES.tar.gz" -a logdown
229wget $webrepo"/mola_topo64.tar.gz" -a logdown
230wget $webrepo"/thermal_TES.tar.gz" -a logdown
231for fff in *.tar.gz; do
232  tar xzvf $fff > /dev/null
233  rm -rf $fff
234done
[1873]235fi
[1471]236
[1551]237## ------------------------
[1559]238## get and compile postproc
239## ------------------------
240echo "*** get and compile post-processing tool"
[1561]241cd $refrepo
[1559]242svn co -q https://github.com/aymeric-spiga/api/trunk postproc
243cd $refrepo/postproc
244./compile
245
[1568]246fi
247## END MESOSCALE PART
248
[1471]249## -----
250## check
251## -----
252echo "*** CHECKLIST:"
253ls -lL $refrepo/gcm/gcm.e
254ls -lL $refrepo/geogrid/geogrid.exe
255ls -lL $refrepo/metgrid/metgrid.exe
256ls -lL $refrepo/prep/readmeteo.exe
257ls -lL $refrepo/data_static/albedo_TES
258ls -lL $refrepo/real.exe
259ls -lL $refrepo/wrf.exe
[1559]260ls -lL $refrepo/postproc/api
[1471]261
Note: See TracBrowser for help on using the repository browser.