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