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