1 | #! /bin/bash |
---|
2 | |
---|
3 | |
---|
4 | ################################## |
---|
5 | # makemeso allows you to compile # |
---|
6 | # WRF with modified LMD physics # |
---|
7 | ################################## |
---|
8 | |
---|
9 | ############################## |
---|
10 | # Author: A. Spiga # |
---|
11 | # New version : October 2008 # |
---|
12 | # Last update : January 2009 # |
---|
13 | # November 09 # |
---|
14 | # January 11 # |
---|
15 | ############################## |
---|
16 | |
---|
17 | ############################### |
---|
18 | #### Type makemeso -h for help |
---|
19 | ############################### |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | ############################################################################################## |
---|
24 | ############################################################################################## |
---|
25 | ############################################################################################## |
---|
26 | ############################################################################################## |
---|
27 | |
---|
28 | donotcompile=0 |
---|
29 | donotallow=0 |
---|
30 | config='' |
---|
31 | donotcompilephys=0 |
---|
32 | justphys=0 |
---|
33 | debug=0 |
---|
34 | fresh_start=0 |
---|
35 | phys="" |
---|
36 | scenario="" |
---|
37 | while getopts "drc:njhgpfs:" options; do |
---|
38 | case $options in |
---|
39 | d ) donotcompile=1;; ## just to check the compile folder |
---|
40 | r ) donotallow=1;; ## allow only known config (useful with 'makemeso < last') |
---|
41 | c ) config="${OPTARG}";; ## idealized cases |
---|
42 | n ) donotcompilephys=1;; ## do not recompile physics |
---|
43 | j ) justphys=1;; ## just compile LMD physics |
---|
44 | g ) debug=1;; ## debug mode |
---|
45 | p ) phys="newphys_";; ## with new physics |
---|
46 | f ) fresh_start=1;; ## a fresh start |
---|
47 | s ) scenario="${OPTARG}";; ## a specific scenario, you need a corresponding "mars_lmd_..." |
---|
48 | h ) echo " |
---|
49 | # Use: |
---|
50 | # |
---|
51 | # makemeso ## basic use (real-case configuration) |
---|
52 | # |
---|
53 | # makemeso -d ## no compilation, just check the name of the compile folder |
---|
54 | # |
---|
55 | # makemeso -c ideal ## idealized mode (convective cell, mountain wave, etc...) |
---|
56 | # makemeso -c les ## large-eddy simulations mode based on WRFV3 |
---|
57 | # |
---|
58 | # makemeso -n ## do not recompile LMD physics (must have been compiled before) |
---|
59 | # |
---|
60 | # makemeso < last ## basic use + skip questions [! script must have been executed at least once] |
---|
61 | # makemeso -r < last ## basic use + skip questions + only known config |
---|
62 | # makemeso -nr < last ## basic use + skip questions + only known config + no LMD phys recompile |
---|
63 | # |
---|
64 | # makemeso -j ## just compile the LMD physics |
---|
65 | # |
---|
66 | # makemeso -g ## debug mode |
---|
67 | # |
---|
68 | # makemeso -h ## display options |
---|
69 | # |
---|
70 | # makemeso -p ## with new LMD physics |
---|
71 | # |
---|
72 | # makemeso -f ## fresh start [clean -a] |
---|
73 | # |
---|
74 | # makemeso -s storm ## a specific scenario, you need a corresponding mars_lmd_... (only for newphys) |
---|
75 | " ; exit ;; |
---|
76 | esac |
---|
77 | done |
---|
78 | |
---|
79 | #-------------- |
---|
80 | # talk w/ user |
---|
81 | #-------------- |
---|
82 | echo '****************************************' |
---|
83 | echo ' LMD Mesoscale Model Compiler. Welcome.' |
---|
84 | echo '****************************************' |
---|
85 | if [[ "${phys}" == "newphys_" ]] |
---|
86 | then |
---|
87 | echo '***********with new physics*************' |
---|
88 | echo '****************************************' |
---|
89 | fi |
---|
90 | # computer |
---|
91 | uname -a | grep x86_64 > /dev/null |
---|
92 | if [[ "$?" == 0 ]] |
---|
93 | then |
---|
94 | machine='64' |
---|
95 | else |
---|
96 | machine='32' |
---|
97 | fi |
---|
98 | # compiler |
---|
99 | echo "Supported compiler options are " |
---|
100 | echo " <1> pgf90" |
---|
101 | echo " <2> g95" |
---|
102 | echo " <3> pgf90 + mpi" |
---|
103 | echo " <4> ifort" |
---|
104 | echo " <5> ifort + mpi" |
---|
105 | echo " <7> xlf + mpi (IBM AIX)" |
---|
106 | echo "Your choice ?" ; read reply |
---|
107 | case ${reply} in |
---|
108 | 1) compilo='pgf' ; numproc=1 ;; |
---|
109 | 2) compilo='g95' ; numproc=1 ;; |
---|
110 | 3) compilo='mpi' |
---|
111 | if [[ "${WHERE_MPI}" = "" ]] |
---|
112 | then |
---|
113 | echo Please initialize the variable WHERE_MPI in your environnement |
---|
114 | exit |
---|
115 | fi |
---|
116 | echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; |
---|
117 | 4) compilo='ifort' ; numproc=1 ;; |
---|
118 | 5) compilo='mpifort' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; |
---|
119 | 7) compilo='mpixlf' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; |
---|
120 | ### for tests |
---|
121 | 99) compilo='gnu' ; numproc=1 ;; |
---|
122 | *) echo not supported by this script ; exit ;; |
---|
123 | esac |
---|
124 | # dimensions |
---|
125 | if [ ${donotcompile} -eq 0 ] |
---|
126 | then |
---|
127 | echo Grid points in longitude ? ; read lon |
---|
128 | echo Grid points in latitude ? ; read lat |
---|
129 | echo Number of vertical levels ? ; read level |
---|
130 | fi |
---|
131 | echo Number of domains ? ; read dom |
---|
132 | |
---|
133 | ###PB lecture dom si < last |
---|
134 | |
---|
135 | case ${dom} in |
---|
136 | 1) single='_single' ;; |
---|
137 | *) single='_nest' ;; |
---|
138 | esac |
---|
139 | if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] |
---|
140 | then |
---|
141 | single='' |
---|
142 | fi |
---|
143 | |
---|
144 | testflag='' |
---|
145 | #### |
---|
146 | #testflag='_test' |
---|
147 | #### |
---|
148 | |
---|
149 | conf_wrf="${config}${scenario}${phys}${compilo}_${machine}${single}${testflag}" |
---|
150 | \rm what_folder 2> /dev/null |
---|
151 | echo ${conf_wrf} > what_folder |
---|
152 | if [ ${donotcompile} -eq 1 ] |
---|
153 | then |
---|
154 | #\rm what_folder 2> /dev/null |
---|
155 | #echo '**********************' |
---|
156 | #echo '*** Your folder is ...' |
---|
157 | #echo '**********************' |
---|
158 | #echo ${conf_wrf} | tee what_folder |
---|
159 | #cat what_folder |
---|
160 | #echo ${conf_wrf} > what_folder |
---|
161 | #echo ${reply} > what_compilo |
---|
162 | #echo ${numproc} > what_numproc |
---|
163 | exit |
---|
164 | fi |
---|
165 | echo Number of tracers ? ; read tra |
---|
166 | if [ ${tra} -eq 0 ] |
---|
167 | then |
---|
168 | tra=1 |
---|
169 | fi |
---|
170 | # folder |
---|
171 | mkdir ${conf_wrf} 2> /dev/null |
---|
172 | if [[ "$?" == 0 ]] |
---|
173 | then |
---|
174 | echo new folder ... link sources |
---|
175 | if [[ "${phys}" == "newphys_" ]] |
---|
176 | then |
---|
177 | \rm copy_model_tmp > /dev/null |
---|
178 | if [[ "${scenario}" == "" ]] |
---|
179 | then |
---|
180 | sed s+"mars_lmd"+"mars_lmd_new"+g copy_model > copy_model_tmp |
---|
181 | else |
---|
182 | echo SCENARIO ${scenario} DID YOU INCLUDE THE SPECIFIC folder ? ; read dummy |
---|
183 | sed s+"mars_lmd"+"mars_lmd_new_${scenario}"+g copy_model > copy_model_tmp |
---|
184 | if [[ "${config}" == "les" ]] |
---|
185 | then |
---|
186 | echo "NOT SUPPORTED, check options" |
---|
187 | exit |
---|
188 | fi |
---|
189 | fi |
---|
190 | if [[ "${config}" == "les" ]] |
---|
191 | then |
---|
192 | sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model_tmp > yeah |
---|
193 | mv yeah copy_model_tmp |
---|
194 | fi |
---|
195 | chmod 755 copy_model_tmp |
---|
196 | ./copy_model_tmp |
---|
197 | \rm copy_model_tmp |
---|
198 | mv WRFV2 ${conf_wrf}/ |
---|
199 | cd ${conf_wrf}/WRFV2 |
---|
200 | if [[ "${scenario}" == "" ]] |
---|
201 | then |
---|
202 | ln -sf mars_lmd_new mars_lmd |
---|
203 | else |
---|
204 | ln -sf mars_lmd_new_${scenario} mars_lmd |
---|
205 | cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/Registry.EM mars_lmd_new_${scenario}/ |
---|
206 | cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/*.inc mars_lmd_new_${scenario}/ |
---|
207 | cd Registry ; ln -sf ../mars_lmd_new_${scenario}/Registry.EM . ; cd .. |
---|
208 | fi |
---|
209 | ln -sf meso_callkeys_newphys.h meso_callkeys.h |
---|
210 | cd Registry ; Registry.bash ; cd .. |
---|
211 | else |
---|
212 | #./copy_model |
---|
213 | if [[ "${config}" == "les" ]] |
---|
214 | then |
---|
215 | sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model > copy_model_tmp |
---|
216 | else |
---|
217 | cp copy_model copy_model_tmp |
---|
218 | fi |
---|
219 | chmod 755 copy_model_tmp |
---|
220 | ./copy_model_tmp |
---|
221 | \rm copy_model_tmp |
---|
222 | mv WRFV2 ${conf_wrf}/ |
---|
223 | cd ${conf_wrf}/WRFV2 |
---|
224 | cd Registry ; Registry.bash ; cd .. |
---|
225 | fi |
---|
226 | #### sparadrap consequent a l'utilisation de copy_model pour les liens |
---|
227 | #### -- car alors il manque fftpack |
---|
228 | if [[ "${config}" == "les" ]] |
---|
229 | then |
---|
230 | cp ../../SRC/LES/correcfft ./ |
---|
231 | ./correcfft |
---|
232 | \rm correcfft |
---|
233 | fi |
---|
234 | else |
---|
235 | cd ${conf_wrf}/WRFV2 |
---|
236 | if [ ${fresh_start} -eq 1 ] |
---|
237 | then |
---|
238 | echo '*** FRESH START, I clean everything' |
---|
239 | clean -a > /dev/null 2> /dev/null |
---|
240 | cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. |
---|
241 | answer='y' ## a voir... pas si sur |
---|
242 | else |
---|
243 | echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer |
---|
244 | case ${answer} in |
---|
245 | y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;; |
---|
246 | *) answer='no' ;; |
---|
247 | esac |
---|
248 | fi |
---|
249 | fi |
---|
250 | if [[ "${phys}" == "newphys_" ]] |
---|
251 | then |
---|
252 | echo "How many scatterers are you using : 1,2,..." ; read scat |
---|
253 | else |
---|
254 | scat=1 ## dummy stuff |
---|
255 | fi |
---|
256 | |
---|
257 | # summary |
---|
258 | echo '**********************' |
---|
259 | echo '*** Your folder is ...' |
---|
260 | echo '**********************' |
---|
261 | echo ${conf_wrf} |
---|
262 | echo '**********************' |
---|
263 | echo '****************************************' |
---|
264 | echo so ... |
---|
265 | echo your computer is ${machine} bits |
---|
266 | echo ${compilo} is your compiler |
---|
267 | if [[ "${compilo}" = "mpi" ]] |
---|
268 | then |
---|
269 | echo MPICH is in ${WHERE_MPI} |
---|
270 | fi |
---|
271 | echo you will use ${numproc} processors |
---|
272 | echo you have ${lon} x points |
---|
273 | echo ' '${lat} y points |
---|
274 | echo ' '${level} z points |
---|
275 | echo ' '${dom} domains |
---|
276 | echo ' '${tra} tracers |
---|
277 | if [[ "${phys}" == "newphys_" ]] |
---|
278 | then |
---|
279 | echo ' '${scat} scatterers |
---|
280 | fi |
---|
281 | echo '****************************************' |
---|
282 | # save answer |
---|
283 | \rm last 2> /dev/null |
---|
284 | touch last |
---|
285 | echo ${reply} >> last |
---|
286 | if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] |
---|
287 | then |
---|
288 | echo ${numproc} >> last |
---|
289 | fi |
---|
290 | echo ${lon} >> last |
---|
291 | echo ${lat} >> last |
---|
292 | echo ${level} >> last |
---|
293 | echo ${dom} >> last |
---|
294 | echo ${tra} >> last |
---|
295 | echo ${answer} >> last |
---|
296 | echo ${scat} >> last |
---|
297 | |
---|
298 | #------------ |
---|
299 | # log files |
---|
300 | #------------ |
---|
301 | \rm log_compile 2> /dev/null |
---|
302 | \rm log_error 2> /dev/null |
---|
303 | |
---|
304 | #----------------- |
---|
305 | # configure WRF |
---|
306 | #----------------- |
---|
307 | mv configure.wrf configure.wrf.bak 2> /dev/null |
---|
308 | ######################## |
---|
309 | conf_wrf_forall="${compilo}_${machine}${single}${testflag}" |
---|
310 | |
---|
311 | #### in this case options are different because for LES, WRFV3 is used |
---|
312 | if [[ "${config}" == "les" ]] |
---|
313 | then |
---|
314 | conf_wrf_forall="${config}${compilo}_${machine}${single}${testflag}" |
---|
315 | fi |
---|
316 | |
---|
317 | case ${conf_wrf_forall} in |
---|
318 | |
---|
319 | #######LES-specific (WRFV3-based) -- previously in 'makeles' |
---|
320 | ####### |
---|
321 | |
---|
322 | lesmpi_64) ## MPI (dm) 64 bits [PS: remplacer 3 par 4 pour openMP] |
---|
323 | \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 3 >> conf ; echo 1 >> conf |
---|
324 | \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null |
---|
325 | sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
326 | if [[ "$(hostname)" == "ciclad1.ipsl.jussieu.fr" ]] |
---|
327 | then |
---|
328 | echo "SPECIFIC CHANGES FOR CICLAD CLUSTER. EDIT makemeso IF YOU ENCOUNTER PROBLEMS." |
---|
329 | #sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.2-pgf/bin/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
330 | #sed s+"mpicc -cc=$(SCC)"+"/usr/lib64/openmpi/1.4.2-gfortran/bin/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
331 | sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
332 | sed s+"mpicc -cc=$(SCC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
333 | else |
---|
334 | sed s+"mpif90"+"$WHERE_MPI/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
335 | sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
336 | fi |
---|
337 | sed s+"-fastsse"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
338 | ### pas forcement necessaire ici mais OK |
---|
339 | sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
340 | \rm conf > /dev/null ;; |
---|
341 | |
---|
342 | lesmpifort_64) ## MPI (dm) 64 bits IFORT |
---|
343 | \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 7 >> conf ; echo 1 >> conf |
---|
344 | \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null |
---|
345 | sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
346 | sed s+"mpif90"+"$WHERE_MPI/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
347 | sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
348 | sed s+"-fastsse"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
349 | sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
350 | \rm conf > /dev/null ;; |
---|
351 | |
---|
352 | ####### |
---|
353 | #######LES-specific (WRFV3-based) -- previously in 'makeles' |
---|
354 | |
---|
355 | #######TEST TEST |
---|
356 | # GFORTRAN, 64 bits, no nesting |
---|
357 | gnu_64_single) cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd .. |
---|
358 | echo 15 | configure > log_compile 2> log_error |
---|
359 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
360 | sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
361 | #######TEST TEST |
---|
362 | # PGF90, 32 bits, no nesting |
---|
363 | pgf_32_single) echo 1 | configure > log_compile 2> log_error |
---|
364 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
365 | # PGF90, 32 bits, nesting |
---|
366 | pgf_32_nest) echo 2 | configure > log_compile 2> log_error |
---|
367 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
368 | # PGF90, 64 bits, no nesting |
---|
369 | pgf_64_single) echo 1 | configure > log_compile 2> log_error |
---|
370 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
371 | # PGF90, 64 bits, nesting |
---|
372 | pgf_64_nest) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
373 | echo 4 | configure > log_compile 2> log_error |
---|
374 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
375 | # G95, 32 bits, no nesting |
---|
376 | g95_32_single) echo 13 | configure > log_compile 2> log_error |
---|
377 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
378 | # G95, 64 bits, no nesting ### we modify configure.defaults to add x86_64 next to g95 in the header comment |
---|
379 | g95_64_single) cd arch ; sed s/"PC Linux i486 i586 i686, g95 compiler"/"PC Linux i486 i586 i686 x86_64, g95 compiler"/g configure.defaults > yeahyeahyeah ; rm configure.defaults ; mv yeahyeahyeah configure.defaults ; cd .. |
---|
380 | echo 14 | configure > log_compile 2> log_error |
---|
381 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
382 | #sed s+"= g95"+"= /home/physastro/aspiga/mysoft/g95/g95-install/bin/x86_64-unknown-linux-gnu-g95"+g configure.wrf > yeah ; mv -f yeah configure.wrf;; |
---|
383 | # IFORT, 64 bits, no nesting |
---|
384 | ifort_64_single) echo 5 | configure > log_compile 2> log_error |
---|
385 | sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
386 | ## !!! NETCDF must be defined |
---|
387 | sed s+"lio_grib_share"+"lio_grib_share -L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah |
---|
388 | mv -f yeah configure.wrf ;; |
---|
389 | mpifort_64) # MPI+IFORT, 64 bits, no nesting / nesting |
---|
390 | echo 9 | configure > log_compile 2> log_error |
---|
391 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
392 | sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
393 | sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
394 | sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
395 | sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
396 | #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf ### pour compilation rapide |
---|
397 | #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3 |
---|
398 | #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/ |
---|
399 | #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault |
---|
400 | sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
401 | sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
402 | sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
403 | sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
404 | sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
405 | sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
406 | sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
407 | sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
408 | ### necessary even if mpi-selector is used (no need in makegcm though) |
---|
409 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf |
---|
410 | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
411 | ## !!! NETCDF must be defined |
---|
412 | sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah |
---|
413 | mv -f yeah configure.wrf |
---|
414 | #### POUR LE TRAITEMENT PARTICULIERS des NESTS sur iDATAPLEX [cf. module_lmd_driver] |
---|
415 | sed s+"ARCHFLAGS = "+"ARCHFLAGS = -DSPECIAL_NEST_SAVE "+g configure.wrf > yeah |
---|
416 | mv -f yeah configure.wrf ;; |
---|
417 | # MPICH, 64 bits, no nesting / nesting |
---|
418 | mpi_64) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
419 | echo 3 | configure > log_compile 2> log_error |
---|
420 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
421 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah |
---|
422 | #| sed s+"fastsse"+"fast"+g > yeah |
---|
423 | mv -f yeah configure.wrf ;; |
---|
424 | #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah |
---|
425 | ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem |
---|
426 | ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem |
---|
427 | #mv -f yeah configure.wrf ;; |
---|
428 | # MPICH, 64 bits, OK with periodic BC but no positive definite |
---|
429 | mpi_64_test) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
430 | echo 2 | configure > log_compile 2> log_error |
---|
431 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
432 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah |
---|
433 | mv -f yeah configure.wrf ;; |
---|
434 | # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered |
---|
435 | mpixlf_32) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
436 | echo 3 | configure > log_compile 2> log_error |
---|
437 | sed -f mars.sed configure.wrf > yeah |
---|
438 | mv -f yeah configure.wrf ;; |
---|
439 | # ANYTHING ELSE |
---|
440 | *) echo NO PRESETS ... |
---|
441 | if [ ${donotallow} -eq 0 ] |
---|
442 | then |
---|
443 | configure |
---|
444 | else |
---|
445 | # problem when an input file is used |
---|
446 | echo 'please cd to '$PWD' and type ./configure' |
---|
447 | exit |
---|
448 | fi ;; |
---|
449 | esac |
---|
450 | ######################## |
---|
451 | |
---|
452 | |
---|
453 | if [[ "${phys}" == "newphys_" ]] |
---|
454 | then |
---|
455 | if [[ "${config}" == "les" ]] ### LES is different because of WRFV3 |
---|
456 | then |
---|
457 | sed s+"ARCH_LOCAL = "+"ARCH_LOCAL = -DNEWPHYS "+g configure.wrf > yeah |
---|
458 | else |
---|
459 | sed s+"ARCHFLAGS = "+"ARCHFLAGS = -DNEWPHYS "+g configure.wrf > yeah |
---|
460 | fi |
---|
461 | mv -f yeah configure.wrf |
---|
462 | fi |
---|
463 | |
---|
464 | if [[ ! ("${scenario}" == "") ]] ### not supported with LES for the moment |
---|
465 | then |
---|
466 | sed s+"ARCHFLAGS = "+"ARCHFLAGS = -D${scenario} "+g configure.wrf > yeah |
---|
467 | mv -f yeah configure.wrf |
---|
468 | fi |
---|
469 | |
---|
470 | if [ ${debug} -ne 0 ] # not working for xlf! |
---|
471 | then |
---|
472 | echo 'DEBUG DEBUG DEBUG DEBUG' |
---|
473 | sed s+"#-g"+"-g"+g configure.wrf > yeah |
---|
474 | mv -f yeah configure.wrf |
---|
475 | fi |
---|
476 | |
---|
477 | |
---|
478 | ################################################## |
---|
479 | # compile physics |
---|
480 | ################################################## |
---|
481 | if [ ${donotcompilephys} -eq 0 ] |
---|
482 | then |
---|
483 | |
---|
484 | cd mars_lmd/ |
---|
485 | |
---|
486 | # required size |
---|
487 | #---------------- |
---|
488 | case ${numproc} in |
---|
489 | 1) physx=$(expr ${lon} - 1) |
---|
490 | physy=$(expr ${lat} - 1) |
---|
491 | physz=$(expr ${level} - 1) ;; |
---|
492 | 2) physx=$(expr ${lon} - 1) |
---|
493 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) |
---|
494 | physz=$(expr ${level} - 1) ;; |
---|
495 | 4) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
496 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) |
---|
497 | physz=$(expr ${level} - 1) ;; |
---|
498 | 6) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
499 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 3) |
---|
500 | physz=$(expr ${level} - 1) ;; |
---|
501 | 8) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
502 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
503 | physz=$(expr ${level} - 1) ;; |
---|
504 | 12) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 3) |
---|
505 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
506 | physz=$(expr ${level} - 1) ;; |
---|
507 | 16) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) |
---|
508 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
509 | physz=$(expr ${level} - 1) ;; |
---|
510 | 20) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) |
---|
511 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 5) |
---|
512 | physz=$(expr ${level} - 1) ;; |
---|
513 | 24) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) |
---|
514 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 6) |
---|
515 | physz=$(expr ${level} - 1) ;; |
---|
516 | 32) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) |
---|
517 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8) |
---|
518 | physz=$(expr ${level} - 1) ;; |
---|
519 | 64) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8) |
---|
520 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8) |
---|
521 | physz=$(expr ${level} - 1) ;; |
---|
522 | 128) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8) |
---|
523 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 16) |
---|
524 | physz=$(expr ${level} - 1) ;; |
---|
525 | *) echo not supported ; exit |
---|
526 | esac |
---|
527 | |
---|
528 | # change this if you change num_soil_layers in WRF |
---|
529 | # -- default is 10 |
---|
530 | if [[ "${phys}" == "newphys_" ]] |
---|
531 | then |
---|
532 | soilsize=18 ## nouvelle physique |
---|
533 | else |
---|
534 | soilsize=10 |
---|
535 | fi |
---|
536 | |
---|
537 | # GCM environment variables |
---|
538 | #-------------------------- |
---|
539 | export LMDGCM=$PWD |
---|
540 | export LIBOGCM=$PWD/libo |
---|
541 | |
---|
542 | # generate the appropriate dimphys |
---|
543 | #--------------------------------- |
---|
544 | cd libf/phymars |
---|
545 | \rm dimphys.h 2> /dev/null |
---|
546 | physize=$(expr ${physx} \* ${physy}) |
---|
547 | sed s/--xsize--/${physx}/g meso_dimphys.h_ref | sed s/--ysize--/${physy}/g | sed s/--physize--/${physize}/g | sed s/--zsize--/${physz}/g | sed s/--soilsize--/${soilsize}/g > dimphys.h |
---|
548 | head -15 dimphys.h |
---|
549 | ### |
---|
550 | ### TEST new new phys |
---|
551 | if [[ "${phys}" == "newphys_" ]] |
---|
552 | then |
---|
553 | touch callkeys.h.meso |
---|
554 | ln -sf meso_callkeys.h callkeys.h |
---|
555 | #touch dustlift.F.meso |
---|
556 | # ln -sf meso_dustlift.F dustlift.F ## attention avec "ancienne nouvelle physique" |
---|
557 | touch readtesassim.F90.meso |
---|
558 | ln -sf meso_readtesassim.F90 readtesassim.F90 ## attention idem |
---|
559 | touch gr_fi_dyn.F.lien |
---|
560 | ln -sf ../dyn3d/gr_fi_dyn.F . ## dommage, a corriger ## attention idem |
---|
561 | ############################### |
---|
562 | ############################### |
---|
563 | \rm scatterers.h |
---|
564 | cat << EOF > scatterers.h |
---|
565 | !----------------------------------------------------------------------- |
---|
566 | ! INCLUDE 'scatterers.h' |
---|
567 | ! |
---|
568 | ! Number of kind of tracer radiative properties |
---|
569 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
570 | ! (ex: naerkind=1 if you use one dust mode without ice ...) |
---|
571 | ! (ex: naerkind=2 if you use one dust mode and active ice ...) |
---|
572 | !----------------------------------------------------------------------- |
---|
573 | |
---|
574 | integer, parameter :: naerkind=${scat} |
---|
575 | |
---|
576 | !----------------------------------------------------------------------- |
---|
577 | EOF |
---|
578 | ############################### |
---|
579 | ############################### |
---|
580 | fi |
---|
581 | ### |
---|
582 | ### |
---|
583 | cd ../.. |
---|
584 | |
---|
585 | # prepare for nesting |
---|
586 | #--------------------- |
---|
587 | cd libf |
---|
588 | duplicate${dom} 2> /dev/null |
---|
589 | cd .. |
---|
590 | |
---|
591 | # compile physics |
---|
592 | #-------------------------- |
---|
593 | \rm libf/grid/dimensions.h 2> /dev/null |
---|
594 | \rm -rf libo/* 2> /dev/null |
---|
595 | echo 1. compiling LMD physics ... |
---|
596 | echo compilation info in: |
---|
597 | echo $PWD/libo/log_compile_phys |
---|
598 | |
---|
599 | if [ ${debug} -ne 0 ] |
---|
600 | then |
---|
601 | echo 'DEBUG DEBUG DEBUG DEBUG' |
---|
602 | nohup makegcm_${compilo} -debug -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys |
---|
603 | else |
---|
604 | nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys |
---|
605 | fi |
---|
606 | echo ... done |
---|
607 | # clean the duplicate routines |
---|
608 | cd libf |
---|
609 | duplicate1 2> /dev/null |
---|
610 | cd .. |
---|
611 | |
---|
612 | # merge LMD executables in one lib |
---|
613 | #-------------------------------------- |
---|
614 | cd libo |
---|
615 | mkdir temp |
---|
616 | #cp -f LINUXfastI._${physz}_t${tra}_reg/*.a temp |
---|
617 | cp -f LINUX*/*.a temp |
---|
618 | cd temp |
---|
619 | ar x libbibio.a |
---|
620 | ar x libphymars.a |
---|
621 | ar x libaeronomars.a |
---|
622 | \rm *.a |
---|
623 | ar r liblmd.a * |
---|
624 | cp -f liblmd.a .. |
---|
625 | cd .. |
---|
626 | \rm -r temp |
---|
627 | nm liblmd.a > liblmd_content |
---|
628 | # finish merge |
---|
629 | cd .. |
---|
630 | |
---|
631 | # save a copy |
---|
632 | #-------------- |
---|
633 | cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra}_${scat} |
---|
634 | echo '****************************************' |
---|
635 | |
---|
636 | # ok |
---|
637 | #---- |
---|
638 | cd .. |
---|
639 | |
---|
640 | # manage nest includes in module_lmd_driver.F |
---|
641 | #---- |
---|
642 | cp call_meso_inifis$dom.inc call_meso_inifis.inc |
---|
643 | cp call_meso_physiq$dom.inc call_meso_physiq.inc |
---|
644 | |
---|
645 | |
---|
646 | fi |
---|
647 | ################################################## |
---|
648 | # END compile physics |
---|
649 | ################################################## |
---|
650 | |
---|
651 | #------------------ |
---|
652 | # compile WRF |
---|
653 | #------------------ |
---|
654 | if [ ${justphys} -eq 0 ] |
---|
655 | then |
---|
656 | |
---|
657 | echo 2. compiling WRF dynamical core ... |
---|
658 | |
---|
659 | if [[ ! ( -f "call_meso_physiq.inc" ) ]] |
---|
660 | then |
---|
661 | echo 'did you compile the physics ? no call_meso_physiq.inc !' |
---|
662 | exit |
---|
663 | fi |
---|
664 | |
---|
665 | # be sure to compile with the most recent physics |
---|
666 | touch phys/module_lmd_driver.F |
---|
667 | |
---|
668 | # talk to user |
---|
669 | echo '>>> compiling ... this may be long ... <<<' |
---|
670 | echo check progress in: |
---|
671 | echo $PWD/log_compile |
---|
672 | echo check possible errors in: |
---|
673 | echo $PWD/log_error |
---|
674 | |
---|
675 | # compile ... |
---|
676 | case ${config} in |
---|
677 | '') compile em_real > log_compile 2> log_error |
---|
678 | # save executables |
---|
679 | cd main |
---|
680 | if [[ -f real.exe ]] |
---|
681 | then |
---|
682 | echo 'Looks good ! real.exe is here...' |
---|
683 | fi |
---|
684 | if [[ -f wrf.exe ]] |
---|
685 | then |
---|
686 | echo 'Looks good ! wrf.exe is here...' |
---|
687 | fi |
---|
688 | cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
689 | cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
690 | cd .. ;; |
---|
691 | 'ideal') #mkdir 'test/em_quarter_ss' 2> /dev/null |
---|
692 | echo '>>> YOUR CONFIG IS : '${config} |
---|
693 | compile em_quarter_ss > log_compile 2> log_error |
---|
694 | # save executables |
---|
695 | cd main |
---|
696 | if [[ -f ideal.exe ]] |
---|
697 | then |
---|
698 | echo 'Looks good ! ideal.exe is here...' |
---|
699 | fi |
---|
700 | if [[ -f wrf.exe ]] |
---|
701 | then |
---|
702 | echo 'Looks good ! wrf.exe is here...' |
---|
703 | fi |
---|
704 | cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
705 | cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
706 | cd .. ;; |
---|
707 | 'les') echo '>>> YOUR CONFIG IS : '${config} |
---|
708 | mkdir 'test/em_les' 2> /dev/null |
---|
709 | compile em_les > log_compile 2> log_error |
---|
710 | # save executables |
---|
711 | cd main |
---|
712 | if [[ -f ideal.exe ]] |
---|
713 | then |
---|
714 | echo 'Looks good ! ideal.exe is here...' |
---|
715 | fi |
---|
716 | if [[ -f wrf.exe ]] |
---|
717 | then |
---|
718 | echo 'Looks good ! wrf.exe is here...' |
---|
719 | fi |
---|
720 | cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
721 | cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat}.exe |
---|
722 | cd .. ;; |
---|
723 | *) echo not supported... please use ; echo ideal les ; exit ;; |
---|
724 | esac |
---|
725 | echo '*******last lines from log_error*********' |
---|
726 | tail -n 20 log_error |
---|
727 | fi |
---|
728 | |
---|
729 | # the end |
---|
730 | echo '****************************************' |
---|
731 | echo 'done.' |
---|
732 | echo '****************************************' |
---|
733 | cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}_s${scat} |
---|
734 | mv last ../../ |
---|
735 | |
---|
736 | # add here specific messages |
---|
737 | if [[ "${dom}" != "1" ]] |
---|
738 | then |
---|
739 | nest=$(expr ${lon} + 4) |
---|
740 | echo NB: in namelist.input, please set: |
---|
741 | echo ' |
---|
742 | max_dom = '$dom' |
---|
743 | s_we = 1,1, |
---|
744 | e_we = '$lon','$nest', |
---|
745 | s_sn = 1,1, |
---|
746 | e_sn = '$lat','$nest', |
---|
747 | s_vert = 1,1, |
---|
748 | e_vert = '$level','$level',' |
---|
749 | fi |
---|
750 | |
---|