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

Last change on this file since 1852 was 1852, checked in by aslmd, 7 years ago

added a mode with nocompile GCM (idealized studies). corrected ifortold so that it fits the namelist. removed lines with code_compiled which is already linked OK thanks to LATEST in makemeso.

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