[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 | |
---|
| 17 | ############################# |
---|
| 18 | # Use: |
---|
| 19 | # |
---|
| 20 | # makemeso ## basic use (real configuration) |
---|
| 21 | # |
---|
| 22 | # makemeso -d ## no compilation, just check the name of the compile folder |
---|
| 23 | # |
---|
| 24 | # makemeso -c real ## real-case mode [default] |
---|
| 25 | # makemeso -c convection ## idealized mode: convective cell |
---|
| 26 | # |
---|
| 27 | # makemeso < last ## basic use + skip questions [! script must have been executed at least once] |
---|
| 28 | # makemeso -r < last ## basic use + skip questions + only known config |
---|
| 29 | # makemeso -nr < last ## basic use + skip questions + only known config + no LMD phys recompile |
---|
| 30 | # |
---|
| 31 | # makemeso -j ## just compile the LMD physics |
---|
| 32 | # |
---|
| 33 | # makemeso -g ## debug mode |
---|
| 34 | # |
---|
| 35 | # makemeso -h ## display options |
---|
| 36 | # |
---|
| 37 | ############################# |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | # todo: netcdf support |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | ############################################################################################## |
---|
| 44 | ############################################################################################## |
---|
| 45 | ############################################################################################## |
---|
| 46 | ############################################################################################## |
---|
| 47 | |
---|
| 48 | donotcompile=0 |
---|
| 49 | donotallow=0 |
---|
| 50 | config='real' |
---|
| 51 | donotcompilephys=0 |
---|
| 52 | justphys=0 |
---|
| 53 | debug=0 |
---|
[29] | 54 | phys="" |
---|
| 55 | while getopts "drc:njhgp" options; do |
---|
[11] | 56 | case $options in |
---|
| 57 | d ) donotcompile=1;; ## just to check the compile folder |
---|
| 58 | r ) donotallow=1;; ## allow only known config (useful with 'makemeso < last') |
---|
| 59 | c ) config="${OPTARG}";; ## idealized cases |
---|
| 60 | n ) donotcompilephys=1;; ## do not recompile physics |
---|
| 61 | j ) justphys=1;; ## just compile LMD physics |
---|
| 62 | g ) debug=1;; ## debug mode |
---|
[29] | 63 | p ) phys="newphys_";; |
---|
[11] | 64 | h ) echo " |
---|
| 65 | # Use: |
---|
| 66 | # |
---|
| 67 | # makemeso ## basic use (real configuration) |
---|
| 68 | # |
---|
| 69 | # makemeso -d ## no compilation, just check the name of the compile folder |
---|
| 70 | # |
---|
| 71 | # makemeso -c real ## real-case mode [default] |
---|
| 72 | # makemeso -c convection ## idealized mode: convective cell |
---|
| 73 | # |
---|
| 74 | # makemeso < last ## basic use + skip questions [! script must have been executed at least once] |
---|
| 75 | # makemeso -r < last ## basic use + skip questions + only known config |
---|
| 76 | # makemeso -nr < last ## basic use + skip questions + only known config + no LMD phys recompile |
---|
| 77 | # |
---|
| 78 | # makemeso -j ## just compile the LMD physics |
---|
| 79 | # |
---|
| 80 | # makemeso -g ## debug mode |
---|
| 81 | # |
---|
| 82 | # makemeso -h ## display options |
---|
[29] | 83 | # |
---|
| 84 | # makemeso -p ## with new LMD physics |
---|
[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 '****************************************' |
---|
[29] | 95 | if [[ "${phys}" == "newphys_" ]] |
---|
| 96 | then |
---|
| 97 | echo '***********with new physics*************' |
---|
| 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)" |
---|
| 116 | echo "Your choice ?" ; read reply |
---|
| 117 | case ${reply} in |
---|
| 118 | 1) compilo='pgf' ; numproc=1 ;; |
---|
| 119 | 2) compilo='g95' ; numproc=1 ;; |
---|
| 120 | 3) compilo='mpi' |
---|
| 121 | if [[ "${WHERE_MPI}" = "" ]] |
---|
| 122 | then |
---|
| 123 | echo Please initialize the variable WHERE_MPI in your environnement |
---|
| 124 | exit |
---|
| 125 | fi |
---|
| 126 | echo How many processors ? 1, 2, 4, 6, 8, 12, 16 ; read numproc ;; |
---|
| 127 | 4) compilo='ifort' ; numproc=1 ;; |
---|
| 128 | 5) compilo='mpifort' ; echo How many processors ? 1, 2, 4, 6, 8, 12, 16 ; read numproc ;; |
---|
| 129 | 7) compilo='mpixlf' ; echo How many processors ? 1, 2, 4, 6, 8, 12, 16 ; read numproc ;; |
---|
| 130 | ### for tests |
---|
| 131 | 99) compilo='gnu' ; numproc=1 ;; |
---|
| 132 | *) echo not supported by this script ; exit ;; |
---|
| 133 | esac |
---|
| 134 | # dimensions |
---|
| 135 | if [ ${donotcompile} -eq 0 ] |
---|
| 136 | then |
---|
| 137 | echo Grid points in longitude ? ; read lon |
---|
| 138 | echo Grid points in latitude ? ; read lat |
---|
| 139 | echo Number of vertical levels ? ; read level |
---|
| 140 | fi |
---|
| 141 | echo Number of domains ? ; read dom |
---|
| 142 | |
---|
| 143 | ###PB lecture dom si < last |
---|
| 144 | |
---|
| 145 | case ${dom} in |
---|
| 146 | 1) single='_single' ;; |
---|
| 147 | *) single='_nest' ;; |
---|
| 148 | esac |
---|
| 149 | if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] |
---|
| 150 | then |
---|
| 151 | single='' |
---|
| 152 | fi |
---|
| 153 | |
---|
| 154 | testflag='' |
---|
| 155 | #### |
---|
| 156 | #testflag='_test' |
---|
| 157 | #### |
---|
| 158 | |
---|
[29] | 159 | conf_wrf="${phys}${compilo}_${machine}${single}${testflag}" |
---|
[11] | 160 | \rm what_folder 2> /dev/null |
---|
| 161 | echo ${conf_wrf} > what_folder |
---|
| 162 | if [ ${donotcompile} -eq 1 ] |
---|
| 163 | then |
---|
| 164 | #\rm what_folder 2> /dev/null |
---|
| 165 | #echo '**********************' |
---|
| 166 | #echo '*** Your folder is ...' |
---|
| 167 | #echo '**********************' |
---|
| 168 | #echo ${conf_wrf} | tee what_folder |
---|
| 169 | #cat what_folder |
---|
| 170 | #echo ${conf_wrf} > what_folder |
---|
| 171 | #echo ${reply} > what_compilo |
---|
| 172 | #echo ${numproc} > what_numproc |
---|
| 173 | exit |
---|
| 174 | fi |
---|
| 175 | echo Number of tracers ? ; read tra |
---|
| 176 | if [ ${tra} -eq 0 ] |
---|
| 177 | then |
---|
| 178 | tra=1 |
---|
| 179 | fi |
---|
| 180 | # folder |
---|
| 181 | mkdir ${conf_wrf} 2> /dev/null |
---|
| 182 | if [[ "$?" == 0 ]] |
---|
| 183 | then |
---|
| 184 | echo new folder ... link sources |
---|
[29] | 185 | if [[ "${phys}" == "newphys_" ]] |
---|
| 186 | then |
---|
| 187 | sed s+"mars_lmd"+"mars_lmd_new"+g copy_model > copy_model_tmp |
---|
[30] | 188 | chmod 755 copy_model_tmp |
---|
| 189 | ./copy_model_tmp |
---|
| 190 | \rm copy_model_tmp |
---|
| 191 | mv WRFV2 ${conf_wrf}/ |
---|
| 192 | cd ${conf_wrf}/WRFV2 |
---|
| 193 | ln -sf mars_lmd_new mars_lmd |
---|
| 194 | ln -sf meso_callkeys_newphys.h meso_callkeys.h |
---|
| 195 | cd Registry ; Registry.bash ; cd .. |
---|
[29] | 196 | else |
---|
[11] | 197 | ./copy_model |
---|
| 198 | mv WRFV2 ${conf_wrf}/ |
---|
| 199 | cd ${conf_wrf}/WRFV2 |
---|
| 200 | cd Registry ; Registry.bash ; cd .. |
---|
[30] | 201 | fi |
---|
[11] | 202 | else |
---|
| 203 | cd ${conf_wrf}/WRFV2 |
---|
| 204 | echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer |
---|
| 205 | case ${answer} in |
---|
| 206 | y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;; |
---|
| 207 | *) answer='no' ;; |
---|
| 208 | esac |
---|
| 209 | fi |
---|
| 210 | # summary |
---|
| 211 | echo '**********************' |
---|
| 212 | echo '*** Your folder is ...' |
---|
| 213 | echo '**********************' |
---|
| 214 | echo ${conf_wrf} |
---|
| 215 | echo '**********************' |
---|
| 216 | echo '****************************************' |
---|
| 217 | echo so ... |
---|
| 218 | echo your computer is ${machine} bits |
---|
| 219 | echo ${compilo} is your compiler |
---|
| 220 | if [[ "${compilo}" = "mpi" ]] |
---|
| 221 | then |
---|
| 222 | echo MPICH is in ${WHERE_MPI} |
---|
| 223 | fi |
---|
| 224 | echo you will use ${numproc} processors |
---|
| 225 | echo you have ${lon} x points |
---|
| 226 | echo ' '${lat} y points |
---|
| 227 | echo ' '${level} z points |
---|
| 228 | echo ' '${dom} domains |
---|
| 229 | echo ' '${tra} tracers |
---|
| 230 | echo '****************************************' |
---|
| 231 | # save answer |
---|
| 232 | \rm last 2> /dev/null |
---|
| 233 | touch last |
---|
| 234 | echo ${reply} >> last |
---|
| 235 | if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] |
---|
| 236 | then |
---|
| 237 | echo ${numproc} >> last |
---|
| 238 | fi |
---|
| 239 | echo ${lon} >> last |
---|
| 240 | echo ${lat} >> last |
---|
| 241 | echo ${level} >> last |
---|
| 242 | echo ${dom} >> last |
---|
| 243 | echo ${tra} >> last |
---|
| 244 | echo ${answer} >> last |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | #------------ |
---|
| 248 | # log files |
---|
| 249 | #------------ |
---|
| 250 | \rm log_compile 2> /dev/null |
---|
| 251 | \rm log_error 2> /dev/null |
---|
| 252 | |
---|
| 253 | #----------------- |
---|
| 254 | # configure WRF |
---|
| 255 | #----------------- |
---|
| 256 | mv configure.wrf configure.wrf.bak 2> /dev/null |
---|
| 257 | ######################## |
---|
[30] | 258 | conf_wrf_forall="${compilo}_${machine}${single}${testflag}" |
---|
| 259 | case ${conf_wrf_forall} in |
---|
[11] | 260 | #######TEST TEST |
---|
| 261 | # GFORTRAN, 64 bits, no nesting |
---|
| 262 | gnu_64_single) cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd .. |
---|
| 263 | echo 15 | configure > log_compile 2> log_error |
---|
| 264 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 265 | sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 266 | #######TEST TEST |
---|
| 267 | # PGF90, 32 bits, no nesting |
---|
| 268 | pgf_32_single) echo 1 | configure > log_compile 2> log_error |
---|
| 269 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 270 | # PGF90, 32 bits, nesting |
---|
| 271 | pgf_32_nest) echo 2 | configure > log_compile 2> log_error |
---|
| 272 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 273 | # PGF90, 64 bits, no nesting |
---|
| 274 | pgf_64_single) echo 1 | configure > log_compile 2> log_error |
---|
| 275 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 276 | # PGF90, 64 bits, nesting |
---|
| 277 | pgf_64_nest) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
| 278 | echo 4 | configure > log_compile 2> log_error |
---|
| 279 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 280 | # G95, 32 bits, no nesting |
---|
| 281 | g95_32_single) echo 13 | configure > log_compile 2> log_error |
---|
| 282 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
[24] | 283 | # G95, 64 bits, no nesting ### we modify configure.defaults to add x86_64 next to g95 in the header comment |
---|
| 284 | 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 .. |
---|
| 285 | echo 14 | configure > log_compile 2> log_error |
---|
| 286 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; |
---|
| 287 | #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] | 288 | # IFORT, 64 bits, no nesting |
---|
| 289 | ifort_64_single) echo 5 | configure > log_compile 2> log_error |
---|
| 290 | sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 291 | ## !!! NETCDF must be defined |
---|
| 292 | sed s+"lio_grib_share"+"lio_grib_share -L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah |
---|
| 293 | mv -f yeah configure.wrf ;; |
---|
| 294 | mpifort_64) # MPI+IFORT, 64 bits, no nesting / nesting |
---|
| 295 | echo 9 | configure > log_compile 2> log_error |
---|
| 296 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 297 | sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 298 | sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 299 | sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 300 | sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 301 | #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf ### pour compilation rapide |
---|
| 302 | #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3 |
---|
| 303 | #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/ |
---|
| 304 | #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault |
---|
| 305 | sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 306 | sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 307 | sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 308 | sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 309 | sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 310 | sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 311 | sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 312 | sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 313 | ### necessary even if mpi-selector is used (no need in makegcm though) |
---|
| 314 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf |
---|
| 315 | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 316 | ## !!! NETCDF must be defined |
---|
| 317 | sed s+"-L../mars_lmd/libo -llmd"+"-L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah |
---|
| 318 | mv -f yeah configure.wrf ;; |
---|
| 319 | # MPICH, 64 bits, no nesting / nesting |
---|
| 320 | mpi_64) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
| 321 | echo 3 | configure > log_compile 2> log_error |
---|
| 322 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 323 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah |
---|
| 324 | #| sed s+"fastsse"+"fast"+g > yeah |
---|
[28] | 325 | mv -f yeah configure.wrf ;; |
---|
| 326 | #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah |
---|
| 327 | ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem |
---|
| 328 | ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem |
---|
| 329 | #mv -f yeah configure.wrf ;; |
---|
[11] | 330 | # MPICH, 64 bits, OK with periodic BC but no positive definite |
---|
| 331 | mpi_64_test) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
| 332 | echo 2 | configure > log_compile 2> log_error |
---|
| 333 | sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf |
---|
| 334 | sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah |
---|
| 335 | mv -f yeah configure.wrf ;; |
---|
| 336 | # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered |
---|
| 337 | mpixlf_32) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. |
---|
| 338 | echo 3 | configure > log_compile 2> log_error |
---|
| 339 | sed -f mars.sed configure.wrf > yeah |
---|
| 340 | mv -f yeah configure.wrf ;; |
---|
| 341 | # ANYTHING ELSE |
---|
| 342 | *) echo NO PRESETS ... |
---|
| 343 | if [ ${donotallow} -eq 0 ] |
---|
| 344 | then |
---|
| 345 | configure |
---|
| 346 | else |
---|
| 347 | # problem when an input file is used |
---|
| 348 | echo 'please cd to '$PWD' and type ./configure' |
---|
| 349 | exit |
---|
| 350 | fi ;; |
---|
| 351 | esac |
---|
| 352 | ######################## |
---|
| 353 | |
---|
[29] | 354 | if [[ "${phys}" == "newphys_" ]] |
---|
| 355 | then |
---|
[31] | 356 | sed s+"ARCHFLAGS = "+"ARCHFLAGS = -DNEWPHYS "+g configure.wrf > yeah |
---|
[29] | 357 | mv -f yeah configure.wrf |
---|
| 358 | fi |
---|
[11] | 359 | |
---|
| 360 | if [ ${debug} -ne 0 ] # not working for xlf! |
---|
| 361 | then |
---|
| 362 | echo 'DEBUG DEBUG DEBUG DEBUG' |
---|
| 363 | sed s+"#-g"+"-g"+g configure.wrf > yeah |
---|
| 364 | mv -f yeah configure.wrf |
---|
| 365 | fi |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | ################################################## |
---|
| 369 | # compile physics |
---|
| 370 | ################################################## |
---|
| 371 | if [ ${donotcompilephys} -eq 0 ] |
---|
| 372 | then |
---|
| 373 | |
---|
| 374 | cd mars_lmd/ |
---|
| 375 | |
---|
| 376 | # required size |
---|
| 377 | #---------------- |
---|
| 378 | case ${numproc} in |
---|
| 379 | 1) physx=$(expr ${lon} - 1) |
---|
| 380 | physy=$(expr ${lat} - 1) |
---|
| 381 | physz=$(expr ${level} - 1) ;; |
---|
| 382 | 2) physx=$(expr ${lon} - 1) |
---|
| 383 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) |
---|
| 384 | physz=$(expr ${level} - 1) ;; |
---|
| 385 | 4) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
| 386 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) |
---|
| 387 | physz=$(expr ${level} - 1) ;; |
---|
| 388 | 6) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
| 389 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 3) |
---|
| 390 | physz=$(expr ${level} - 1) ;; |
---|
| 391 | 8) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) |
---|
| 392 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
| 393 | physz=$(expr ${level} - 1) ;; |
---|
| 394 | 12) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 3) |
---|
| 395 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
| 396 | physz=$(expr ${level} - 1) ;; |
---|
| 397 | 16) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) |
---|
| 398 | physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) |
---|
| 399 | physz=$(expr ${level} - 1) ;; |
---|
| 400 | *) echo not supported ; exit |
---|
| 401 | esac |
---|
| 402 | |
---|
| 403 | # change this if you change num_soil_layers in WRF |
---|
| 404 | # -- default is 10 |
---|
[30] | 405 | if [[ "${phys}" == "newphys_" ]] |
---|
| 406 | then |
---|
| 407 | soilsize=18 ## nouvelle physique |
---|
| 408 | else |
---|
| 409 | soilsize=10 |
---|
| 410 | fi |
---|
[11] | 411 | |
---|
| 412 | # GCM environment variables |
---|
| 413 | #-------------------------- |
---|
| 414 | export LMDGCM=$PWD |
---|
| 415 | export LIBOGCM=$PWD/libo |
---|
| 416 | |
---|
| 417 | # generate the appropriate dimphys |
---|
| 418 | #--------------------------------- |
---|
| 419 | cd libf/phymars |
---|
| 420 | \rm dimphys.h 2> /dev/null |
---|
| 421 | physize=$(expr ${physx} \* ${physy}) |
---|
| 422 | 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 |
---|
| 423 | head -15 dimphys.h |
---|
| 424 | cd ../.. |
---|
| 425 | |
---|
| 426 | # prepare for nesting |
---|
| 427 | #--------------------- |
---|
| 428 | cd libf |
---|
| 429 | duplicate${dom} 2> /dev/null |
---|
| 430 | cd .. |
---|
| 431 | |
---|
| 432 | # compile physics |
---|
| 433 | #-------------------------- |
---|
| 434 | \rm libf/grid/dimensions.h 2> /dev/null |
---|
| 435 | \rm -rf libo/* 2> /dev/null |
---|
| 436 | echo 1. compiling LMD physics ... |
---|
| 437 | echo compilation info in: |
---|
| 438 | echo $PWD/libo/log_compile_phys |
---|
| 439 | |
---|
| 440 | if [ ${debug} -ne 0 ] |
---|
| 441 | then |
---|
| 442 | echo 'DEBUG DEBUG DEBUG DEBUG' |
---|
| 443 | nohup makegcm_${compilo} -debug -t ${tra} -p mars -d ${physz} meso_testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys |
---|
| 444 | else |
---|
| 445 | nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} meso_testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys |
---|
| 446 | fi |
---|
| 447 | echo ... done |
---|
| 448 | # clean the duplicate routines |
---|
| 449 | cd libf |
---|
| 450 | duplicate1 2> /dev/null |
---|
| 451 | cd .. |
---|
| 452 | |
---|
| 453 | # merge LMD executables in one lib |
---|
| 454 | #-------------------------------------- |
---|
| 455 | cd libo |
---|
| 456 | mkdir temp |
---|
| 457 | #cp -f LINUXfastI._${physz}_t${tra}_reg/*.a temp |
---|
| 458 | cp -f LINUX*/*.a temp |
---|
| 459 | cd temp |
---|
| 460 | ar x libbibio.a |
---|
| 461 | ar x libphymars.a |
---|
| 462 | ar x libaeronomars.a |
---|
| 463 | \rm *.a |
---|
| 464 | ar r liblmd.a * |
---|
| 465 | cp -f liblmd.a .. |
---|
| 466 | cd .. |
---|
| 467 | \rm -r temp |
---|
| 468 | nm liblmd.a > liblmd_content |
---|
| 469 | # finish merge |
---|
| 470 | cd .. |
---|
| 471 | |
---|
| 472 | # save a copy |
---|
| 473 | #-------------- |
---|
| 474 | cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra} |
---|
| 475 | echo '****************************************' |
---|
| 476 | |
---|
| 477 | # ok |
---|
| 478 | #---- |
---|
| 479 | cd .. |
---|
| 480 | |
---|
| 481 | # manage nest includes in module_lmd_driver.F |
---|
| 482 | #---- |
---|
| 483 | cp call_meso_inifis$dom.inc call_meso_inifis.inc |
---|
| 484 | cp call_meso_physiq$dom.inc call_meso_physiq.inc |
---|
| 485 | |
---|
| 486 | |
---|
| 487 | fi |
---|
| 488 | ################################################## |
---|
| 489 | # END compile physics |
---|
| 490 | ################################################## |
---|
| 491 | |
---|
| 492 | #------------------ |
---|
| 493 | # compile WRF |
---|
| 494 | #------------------ |
---|
| 495 | if [ ${justphys} -eq 0 ] |
---|
| 496 | then |
---|
| 497 | |
---|
| 498 | echo 2. compiling WRF dynamical core ... |
---|
| 499 | |
---|
| 500 | if [[ ! ( -f "call_meso_physiq.inc" ) ]] |
---|
| 501 | then |
---|
| 502 | echo 'did you compile the physics ? no call_meso_physiq.inc !' |
---|
| 503 | exit |
---|
| 504 | fi |
---|
| 505 | |
---|
| 506 | # be sure to compile with the most recent physics |
---|
| 507 | touch phys/module_lmd_driver.F |
---|
| 508 | |
---|
| 509 | # talk to user |
---|
| 510 | echo '>>> YOUR CONFIG IS : '${config} |
---|
| 511 | echo '>>> compiling ... this may be long ... <<<' |
---|
| 512 | echo check progress in: |
---|
| 513 | echo $PWD/log_compile |
---|
| 514 | echo check possible errors in: |
---|
| 515 | echo $PWD/log_error |
---|
| 516 | |
---|
| 517 | # compile ... |
---|
| 518 | case ${config} in |
---|
| 519 | 'real') compile em_real > log_compile 2> log_error |
---|
| 520 | # save executables |
---|
| 521 | cd main |
---|
| 522 | if [[ -f wrf.exe ]] |
---|
| 523 | then |
---|
| 524 | echo 'Looks good ! wrf.exe is here...' |
---|
| 525 | fi |
---|
| 526 | cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe |
---|
| 527 | cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe |
---|
| 528 | cd .. ;; |
---|
| 529 | 'convection') #mkdir 'test/em_quarter_ss' 2> /dev/null |
---|
| 530 | compile em_quarter_ss > log_compile 2> log_error |
---|
| 531 | # save executables |
---|
| 532 | cd main |
---|
| 533 | if [[ -f wrf.exe ]] |
---|
| 534 | then |
---|
| 535 | echo 'Looks good ! wrf.exe is here...' |
---|
| 536 | fi |
---|
| 537 | cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe |
---|
| 538 | cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe |
---|
| 539 | cd .. ;; |
---|
| 540 | *) echo not supported please use ; echo real convection ; exit ;; |
---|
| 541 | esac |
---|
| 542 | echo '*******last lines from log_error*********' |
---|
| 543 | tail -n 20 log_error |
---|
| 544 | fi |
---|
| 545 | |
---|
| 546 | # the end |
---|
| 547 | echo '****************************************' |
---|
| 548 | echo 'done.' |
---|
| 549 | echo '****************************************' |
---|
| 550 | cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc} |
---|
| 551 | mv last ../../ |
---|
| 552 | |
---|
| 553 | # add here specific messages |
---|
| 554 | if [[ "${dom}" != "1" ]] |
---|
| 555 | then |
---|
| 556 | nest=$(expr ${lon} + 4) |
---|
| 557 | echo NB: in namelist.input, please set: |
---|
| 558 | echo ' |
---|
| 559 | max_dom = '$dom' |
---|
| 560 | s_we = 1,1, |
---|
| 561 | e_we = '$lon','$nest', |
---|
| 562 | s_sn = 1,1, |
---|
| 563 | e_sn = '$lat','$nest', |
---|
| 564 | s_vert = 1,1, |
---|
| 565 | e_vert = '$level','$level',' |
---|
| 566 | fi |
---|
| 567 | |
---|