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