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