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