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