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