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 |
---|
12 | name="MESORUN" |
---|
13 | ## SVN version |
---|
14 | version="HEAD" |
---|
15 | version="1520" |
---|
16 | ################################ |
---|
17 | |
---|
18 | meso="on" |
---|
19 | gcm="" |
---|
20 | gcmcompile="on" |
---|
21 | while 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 |
---|
37 | done |
---|
38 | |
---|
39 | ################################ |
---|
40 | ## machine on which you will compile |
---|
41 | machine="CICLAD" |
---|
42 | ## fortran compiler used |
---|
43 | fortcom="ifort" |
---|
44 | ## server for sources |
---|
45 | where_is_svn="http://svn.lmd.jussieu.fr/Planeto/trunk/" |
---|
46 | ## grid definition for GCM |
---|
47 | dimgcm="64x48x29" |
---|
48 | ## location of static data |
---|
49 | webrepo="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 | ## ----------------------------- |
---|
56 | echo "*** get structure" |
---|
57 | rm -rf $name > /dev/null 2> /dev/null |
---|
58 | svn -q co $where_is_svn"/MESOSCALE/LMD_MM_MARS/SIMU/MESORUN"$gcm $name |
---|
59 | refrepo=$PWD/$name |
---|
60 | ## fill here user input to obtain independent script |
---|
61 | case ${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 ;; |
---|
66 | esac |
---|
67 | |
---|
68 | ## ---------------- |
---|
69 | ## create code repo |
---|
70 | ## ---------------- |
---|
71 | echo "*** get SVN repository" |
---|
72 | \rm $refrepo/code |
---|
73 | svn -q co -N $where_is_svn $refrepo/code |
---|
74 | |
---|
75 | ################################### |
---|
76 | ################################### GCM |
---|
77 | ################################### |
---|
78 | if [[ "${gcm}" == "old" ]] |
---|
79 | then |
---|
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 | |
---|
89 | else |
---|
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 |
---|
100 | if [[ "${gcmcompile}" == "on" ]] |
---|
101 | then |
---|
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 | |
---|
141 | fi |
---|
142 | |
---|
143 | fi |
---|
144 | |
---|
145 | ################################### |
---|
146 | ################################### MESO |
---|
147 | ################################### |
---|
148 | |
---|
149 | ## START MESOSCALE PART |
---|
150 | if [[ "${meso}" == "on" ]] |
---|
151 | then |
---|
152 | |
---|
153 | ## ---------------------- |
---|
154 | ## get and make mesoscale |
---|
155 | ## ---------------------- |
---|
156 | echo "*** get and compile mesoscale version "$version |
---|
157 | cd $refrepo/code |
---|
158 | svn update -r $version MESOSCALE > /dev/null |
---|
159 | cd $refrepo/code/MESOSCALE/LMD_MM_MARS |
---|
160 | # |
---|
161 | if [[ "${gcm}" == "old" ]] |
---|
162 | then |
---|
163 | option="" |
---|
164 | else |
---|
165 | option="-p mars_lmd_new" |
---|
166 | fi |
---|
167 | # |
---|
168 | ls $refrepo/mesoin |
---|
169 | if [[ "$?" == 0 ]] ; then |
---|
170 | ./makemeso $option < $refrepo/mesoin |
---|
171 | else |
---|
172 | ./makemeso $option |
---|
173 | fi |
---|
174 | rm -rf $refrepo/mesoin |
---|
175 | |
---|
176 | ## ------------------------------- |
---|
177 | ## make ini&bdy tools in mesoscale |
---|
178 | ## ------------------------------- |
---|
179 | echo "*** compile initialization tools" |
---|
180 | cd $refrepo/code_compiled |
---|
181 | ln -sf $refrepo/code/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/prepare_ini . |
---|
182 | ./prepare_ini > /dev/null |
---|
183 | ## |
---|
184 | cd $refrepo/code_compiled/PREP_MARS |
---|
185 | ./compile"_"$fortcom |
---|
186 | ## |
---|
187 | cd $refrepo/code_compiled/WPS |
---|
188 | ls $refrepo/wpsin |
---|
189 | if [[ "$?" == 0 ]] ; then |
---|
190 | ./configure < $refrepo/wpsin > /dev/null 2> /dev/null |
---|
191 | else |
---|
192 | ./configure |
---|
193 | fi |
---|
194 | rm -rf $refrepo/wpsin |
---|
195 | rm -rf logcompile |
---|
196 | ./compile > logcompile 2>&1 |
---|
197 | |
---|
198 | ## ------------------ |
---|
199 | ## import static data |
---|
200 | ## ------------------ |
---|
201 | echo "*** get static data" |
---|
202 | rm -rf $refrepo/data_static |
---|
203 | svn co -q $where_is_svn/MESOSCALE/LMD_MM_MARS/WPS_GEOG $refrepo/data_static |
---|
204 | cd $refrepo/data_static |
---|
205 | rm -rf logdown |
---|
206 | wget $webrepo"/albedo_TES.tar.gz" -a logdown |
---|
207 | wget $webrepo"/mola_topo64.tar.gz" -a logdown |
---|
208 | wget $webrepo"/thermal_TES.tar.gz" -a logdown |
---|
209 | for fff in *.tar.gz; do |
---|
210 | tar xzvf $fff > /dev/null |
---|
211 | rm -rf $fff |
---|
212 | done |
---|
213 | |
---|
214 | ## ------------------------ |
---|
215 | ## get and compile postproc |
---|
216 | ## ------------------------ |
---|
217 | echo "*** get and compile post-processing tool" |
---|
218 | cd $refrepo |
---|
219 | svn co -q https://github.com/aymeric-spiga/api/trunk postproc |
---|
220 | cd $refrepo/postproc |
---|
221 | ./compile |
---|
222 | |
---|
223 | fi |
---|
224 | ## END MESOSCALE PART |
---|
225 | |
---|
226 | ## ----- |
---|
227 | ## check |
---|
228 | ## ----- |
---|
229 | echo "*** CHECKLIST:" |
---|
230 | ls -lL $refrepo/gcm/gcm.e |
---|
231 | ls -lL $refrepo/geogrid/geogrid.exe |
---|
232 | ls -lL $refrepo/metgrid/metgrid.exe |
---|
233 | ls -lL $refrepo/prep/readmeteo.exe |
---|
234 | ls -lL $refrepo/data_static/albedo_TES |
---|
235 | ls -lL $refrepo/real.exe |
---|
236 | ls -lL $refrepo/wrf.exe |
---|
237 | ls -lL $refrepo/postproc/api |
---|
238 | |
---|