#! /bin/bash ################################## # makemeso allows you to compile # # WRF with modified LMD physics # ################################## ############################## # Author: A. Spiga # # New version : October 2008 # # Last update : January 2009 # # November 09 # # January 11 # ############################## ############################### #### Type makemeso -h for help ############################### ############################################################################################## ############################################################################################## ############################################################################################## ############################################################################################## donotcompile=0 donotallow=0 config='' donotcompilephys=0 justphys=0 debug=0 fresh_start=0 phys="" scenario="" while getopts "drc:njhgpfs:" options; do case $options in d ) donotcompile=1;; ## just to check the compile folder r ) donotallow=1;; ## allow only known config (useful with 'makemeso < last') c ) config="${OPTARG}";; ## idealized cases n ) donotcompilephys=1;; ## do not recompile physics j ) justphys=1;; ## just compile LMD physics g ) debug=1;; ## debug mode p ) phys="newphys_";; ## with new physics f ) fresh_start=1;; ## a fresh start s ) scenario="${OPTARG}";; ## a specific scenario, you need a corresponding "mars_lmd_..." h ) echo " # Use: # # makemeso ## basic use (real-case configuration) # # makemeso -d ## no compilation, just check the name of the compile folder # # makemeso -c ideal ## idealized mode (convective cell, mountain wave, etc...) # makemeso -c les ## large-eddy simulations mode based on WRFV3 # # makemeso -n ## do not recompile LMD physics (must have been compiled before) # # makemeso < last ## basic use + skip questions [! script must have been executed at least once] # makemeso -r < last ## basic use + skip questions + only known config # makemeso -nr < last ## basic use + skip questions + only known config + no LMD phys recompile # # makemeso -j ## just compile the LMD physics # # makemeso -g ## debug mode # # makemeso -h ## display options # # makemeso -p ## with new LMD physics # # makemeso -f ## fresh start [clean -a] # # makemeso -s storm ## a specific scenario, you need a corresponding mars_lmd_... (only for newphys) " ; exit ;; esac done #-------------- # talk w/ user #-------------- echo '****************************************' echo ' LMD Mesoscale Model Compiler. Welcome.' echo '****************************************' if [[ "${phys}" == "newphys_" ]] then echo '***********with new physics*************' echo '****************************************' fi # computer uname -a | grep x86_64 > /dev/null if [[ "$?" == 0 ]] then machine='64' else machine='32' fi # compiler echo "Supported compiler options are " echo " <1> pgf90" echo " <2> g95" echo " <3> pgf90 + mpi" echo " <4> ifort" echo " <5> ifort + mpi" echo " <7> xlf + mpi (IBM AIX)" echo "Your choice ?" ; read reply case ${reply} in 1) compilo='pgf' ; numproc=1 ;; 2) compilo='g95' ; numproc=1 ;; 3) compilo='mpi' if [[ "${WHERE_MPI}" = "" ]] then echo Please initialize the variable WHERE_MPI in your environnement exit fi echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; 4) compilo='ifort' ; numproc=1 ;; 5) compilo='mpifort' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; 7) compilo='mpixlf' ; echo How many processors ? e.g. 1, 2, 4, 6, 8, 12, 16, 20, 24, 32, 64, 128 ; read numproc ;; ### for tests 99) compilo='gnu' ; numproc=1 ;; *) echo not supported by this script ; exit ;; esac # dimensions if [ ${donotcompile} -eq 0 ] then echo Grid points in longitude ? ; read lon echo Grid points in latitude ? ; read lat echo Number of vertical levels ? ; read level fi echo Number of domains ? ; read dom ###PB lecture dom si < last case ${dom} in 1) single='_single' ;; *) single='_nest' ;; esac if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] then single='' fi testflag='' #### #testflag='_test' #### conf_wrf="${config}${scenario}${phys}${compilo}_${machine}${single}${testflag}" \rm what_folder 2> /dev/null echo ${conf_wrf} > what_folder if [ ${donotcompile} -eq 1 ] then #\rm what_folder 2> /dev/null #echo '**********************' #echo '*** Your folder is ...' #echo '**********************' #echo ${conf_wrf} | tee what_folder #cat what_folder #echo ${conf_wrf} > what_folder #echo ${reply} > what_compilo #echo ${numproc} > what_numproc exit fi echo Number of tracers ? ; read tra if [ ${tra} -eq 0 ] then tra=1 fi # folder mkdir ${conf_wrf} 2> /dev/null if [[ "$?" == 0 ]] then echo new folder ... link sources if [[ "${phys}" == "newphys_" ]] then \rm copy_model_tmp > /dev/null if [[ "${scenario}" == "" ]] then sed s+"mars_lmd"+"mars_lmd_new"+g copy_model > copy_model_tmp else echo SCENARIO ${scenario} DID YOU INCLUDE THE RIGHT copy_model ? ; read dummy sed s+"mars_lmd"+"mars_lmd_new_${scenario}"+g copy_model > copy_model_tmp if [[ "${config}" == "les" ]] then echo "NOT SUPPORTED, check options" fi fi if [[ "${config}" == "les" ]] then sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model_tmp > yeah mv yeah copy_model_tmp fi chmod 755 copy_model_tmp ./copy_model_tmp \rm copy_model_tmp mv WRFV2 ${conf_wrf}/ cd ${conf_wrf}/WRFV2 if [[ "${scenario}" == "" ]] then ln -sf mars_lmd_new mars_lmd else ln -sf mars_lmd_new_${scenario} mars_lmd cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/Registry.EM mars_lmd_new_${scenario}/ cp ../../SRC/WRFV2/mars_lmd_new_${scenario}/*.inc mars_lmd_new_${scenario}/ cd Registry ; ln -sf ../mars_lmd_new_${scenario}/Registry.EM . ; cd .. fi ln -sf meso_callkeys_newphys.h meso_callkeys.h cd Registry ; Registry.bash ; cd .. else #./copy_model if [[ "${config}" == "les" ]] then sed s+"PWD/SRC/"+"PWD/SRC/LES/"+g copy_model > copy_model_tmp else cp copy_model copy_model_tmp fi chmod 755 copy_model_tmp ./copy_model_tmp \rm copy_model_tmp mv WRFV2 ${conf_wrf}/ cd ${conf_wrf}/WRFV2 cd Registry ; Registry.bash ; cd .. fi #### sparadrap consequent a l'utilisation de copy_model pour les liens #### -- car alors il manque fftpack if [[ "${config}" == "les" ]] then cp ../../SRC/LES/correcfft ./ ./correcfft \rm correcfft fi else cd ${conf_wrf}/WRFV2 if [ ${fresh_start} -eq 1 ] then echo '*** FRESH START, I clean everything' clean -a > /dev/null 2> /dev/null cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. answer='y' ## a voir... pas si sur else echo Did you modify anything in the Registry or clean ? y for yes, any key for no ; read answer case ${answer} in y) cd Registry ; mv Registry Registry.bak ; Registry.bash ; cd .. ;; *) answer='no' ;; esac fi fi # summary echo '**********************' echo '*** Your folder is ...' echo '**********************' echo ${conf_wrf} echo '**********************' echo '****************************************' echo so ... echo your computer is ${machine} bits echo ${compilo} is your compiler if [[ "${compilo}" = "mpi" ]] then echo MPICH is in ${WHERE_MPI} fi echo you will use ${numproc} processors echo you have ${lon} x points echo ' '${lat} y points echo ' '${level} z points echo ' '${dom} domains echo ' '${tra} tracers echo '****************************************' # save answer \rm last 2> /dev/null touch last echo ${reply} >> last if [ "${compilo}" = "mpi" -o "${compilo}" = "mpifort" -o "${compilo}" = "mpixlf" ] then echo ${numproc} >> last fi echo ${lon} >> last echo ${lat} >> last echo ${level} >> last echo ${dom} >> last echo ${tra} >> last echo ${answer} >> last #------------ # log files #------------ \rm log_compile 2> /dev/null \rm log_error 2> /dev/null #----------------- # configure WRF #----------------- mv configure.wrf configure.wrf.bak 2> /dev/null ######################## conf_wrf_forall="${compilo}_${machine}${single}${testflag}" #### in this case options are different because for LES, WRFV3 is used if [[ "${config}" == "les" ]] then conf_wrf_forall="${config}${compilo}_${machine}${single}${testflag}" fi case ${conf_wrf_forall} in #######LES-specific (WRFV3-based) -- previously in 'makeles' ####### lesmpi_64) ## MPI (dm) 64 bits [PS: remplacer 3 par 4 pour openMP] \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 3 >> conf ; echo 1 >> conf \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g configure.wrf > yeah ; mv -f yeah configure.wrf echo "$(hostname)" if [[ "$(hostname)" == "ciclad1.ipsl.jussieu.fr" ]] then echo "SPECIFIC CHANGES FOR CICLAD CLUSTER. EDIT makemeso IF YOU ENCOUNTER PROBLEMS." #sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.2-pgf/bin/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf #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 sed s+"mpif90 -f90=$(SFC)"+"/usr/lib64/openmpi/1.4.3-pgfgcc/bin/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf 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 else sed s+"mpif90"+"$WHERE_MPI/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf fi sed s+"-fastsse"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf ### pas forcement necessaire ici mais OK sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf \rm conf > /dev/null ;; lesmpifort_64) ## MPI (dm) 64 bits IFORT \rm conf > /dev/null 2> /dev/null ; touch conf ; echo 7 >> conf ; echo 1 >> conf \rm configure.wrf > /dev/null 2> /dev/null ; ./configure < conf > /dev/null 2> /dev/null sed s+"-lnetcdf"+"-lnetcdf -L../mars_lmd/libo -llmd"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"mpif90"+"$WHERE_MPI/mpif90"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"mpicc"+"$WHERE_MPI/mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-fastsse"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-llmd"+"-llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf \rm conf > /dev/null ;; ####### #######LES-specific (WRFV3-based) -- previously in 'makeles' #######TEST TEST # GFORTRAN, 64 bits, no nesting gnu_64_single) cd arch ; ln -sf ../configure.defaults.gfortran64 configure.defaults ; cd .. echo 15 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf 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 ;; #######TEST TEST # PGF90, 32 bits, no nesting pgf_32_single) echo 1 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; # PGF90, 32 bits, nesting pgf_32_nest) echo 2 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; # PGF90, 64 bits, no nesting pgf_64_single) echo 1 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; # PGF90, 64 bits, nesting pgf_64_nest) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. echo 4 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; # G95, 32 bits, no nesting g95_32_single) echo 13 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; # G95, 64 bits, no nesting ### we modify configure.defaults to add x86_64 next to g95 in the header comment 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 .. echo 14 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf ;; #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;; # IFORT, 64 bits, no nesting ifort_64_single) echo 5 | configure > log_compile 2> log_error sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf ## !!! NETCDF must be defined sed s+"lio_grib_share"+"lio_grib_share -L../mars_lmd/libo -llmd $NETCDF/lib/libnetcdf.a"+g configure.wrf > yeah mv -f yeah configure.wrf ;; mpifort_64) # MPI+IFORT, 64 bits, no nesting / nesting echo 9 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-f90=ifort"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-cc=icc"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-DIFORT_KLUDGE"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"O3"+"O2"+g configure.wrf > yeah ; mv -f yeah configure.wrf #sed s+"O3"+"O0"+g configure.wrf > yeah ; mv -f yeah configure.wrf ### pour compilation rapide #-w -ftz -align all -fno-alias -fp-model precise >>> options indiquees dans WRF3 #http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/ #### NB: RSL is replaced by RSL_LITE, better memory capacity, less seg fault sed s+"../external/RSL/RSL"+"../external/RSL_LITE"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-DWRF_RSL_IO"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-DRSL"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"librsl.a"+"librsl_lite.a"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"../external/RSL/gen"+"../external/RSL_LITE/gen"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"../external/RSL/module"+"../external/RSL_LITE/module"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"-lrsl"+"-lrsl_lite"+g configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"linux"+" "+g configure.wrf > yeah ; mv -f yeah configure.wrf ### necessary even if mpi-selector is used (no need in makegcm though) sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g > yeah ; mv -f yeah configure.wrf sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g configure.wrf > yeah ; mv -f yeah configure.wrf ## !!! NETCDF must be defined 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 #### POUR LE TRAITEMENT PARTICULIERS des NESTS sur iDATAPLEX [cf. module_lmd_driver] sed s+"ARCHFLAGS = "+"ARCHFLAGS = -DSPECIAL_NEST_SAVE "+g configure.wrf > yeah mv -f yeah configure.wrf ;; # MPICH, 64 bits, no nesting / nesting mpi_64) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. echo 3 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah #| sed s+"fastsse"+"fast"+g > yeah mv -f yeah configure.wrf ;; #sed s+"-fastsse"+"-O2 -Munroll -Mcache_align"+g configure.wrf > yeah ##sed s+"-fastsse"+"-O2 -fpic"+g configure.wrf > yeah ## marche pas, ILM problem ##sed s+"-fastsse"+"-mcmodel=medium -Mlarge_arrays"+g configure.wrf > yeah ## marche pas, ILM problem #mv -f yeah configure.wrf ;; # MPICH, 64 bits, OK with periodic BC but no positive definite mpi_64_test) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. echo 2 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah ; mv -f yeah configure.wrf sed s+"mpif90"+"${WHERE_MPI}/mpif90"+g configure.wrf | sed s+"mpicc"+"${WHERE_MPI}/mpicc"+g | sed s+"mpicc"+"mpicc -DMPI2_SUPPORT"+g > yeah mv -f yeah configure.wrf ;; # XLF+MPICH on AIX machine (64 bits) with nesting, NB: the 32bits notice is not to be considered mpixlf_32) cd arch ; ln -sf ../configure.defaults.fix64nest configure.defaults ; cd .. echo 3 | configure > log_compile 2> log_error sed -f mars.sed configure.wrf > yeah mv -f yeah configure.wrf ;; # ANYTHING ELSE *) echo NO PRESETS ... if [ ${donotallow} -eq 0 ] then configure else # problem when an input file is used echo 'please cd to '$PWD' and type ./configure' exit fi ;; esac ######################## if [[ "${phys}" == "newphys_" ]] then if [[ "${config}" == "les" ]] ### LES is different because of WRFV3 then sed s+"ARCH_LOCAL = "+"ARCH_LOCAL = -DNEWPHYS "+g configure.wrf > yeah else sed s+"ARCHFLAGS = "+"ARCHFLAGS = -DNEWPHYS "+g configure.wrf > yeah fi mv -f yeah configure.wrf fi if [[ ! ("${scenario}" == "") ]] ### not supported with LES for the moment then sed s+"ARCHFLAGS = "+"ARCHFLAGS = -D${scenario} "+g configure.wrf > yeah mv -f yeah configure.wrf fi if [ ${debug} -ne 0 ] # not working for xlf! then echo 'DEBUG DEBUG DEBUG DEBUG' sed s+"#-g"+"-g"+g configure.wrf > yeah mv -f yeah configure.wrf fi ################################################## # compile physics ################################################## if [ ${donotcompilephys} -eq 0 ] then cd mars_lmd/ # required size #---------------- case ${numproc} in 1) physx=$(expr ${lon} - 1) physy=$(expr ${lat} - 1) physz=$(expr ${level} - 1) ;; 2) physx=$(expr ${lon} - 1) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) physz=$(expr ${level} - 1) ;; 4) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 2) physz=$(expr ${level} - 1) ;; 6) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 3) physz=$(expr ${level} - 1) ;; 8) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 2) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) physz=$(expr ${level} - 1) ;; 12) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 3) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) physz=$(expr ${level} - 1) ;; 16) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 4) physz=$(expr ${level} - 1) ;; 20) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 5) physz=$(expr ${level} - 1) ;; 24) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 6) physz=$(expr ${level} - 1) ;; 32) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 4) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8) physz=$(expr ${level} - 1) ;; 64) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 8) physz=$(expr ${level} - 1) ;; 128) physx=$(expr ${lon} - 1) ; physx=$(expr ${physx} \/ 8) physy=$(expr ${lat} - 1) ; physy=$(expr ${physy} \/ 16) physz=$(expr ${level} - 1) ;; *) echo not supported ; exit esac # change this if you change num_soil_layers in WRF # -- default is 10 if [[ "${phys}" == "newphys_" ]] then soilsize=18 ## nouvelle physique else soilsize=10 fi # GCM environment variables #-------------------------- export LMDGCM=$PWD export LIBOGCM=$PWD/libo # generate the appropriate dimphys #--------------------------------- cd libf/phymars \rm dimphys.h 2> /dev/null physize=$(expr ${physx} \* ${physy}) 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 head -15 dimphys.h ### ### TEST new new phys if [[ "${phys}" == "newphys_" ]] then touch callkeys.h.meso ln -sf meso_callkeys.h callkeys.h #touch dustlift.F.meso # ln -sf meso_dustlift.F dustlift.F ## attention avec "ancienne nouvelle physique" touch readtesassim.F90.meso ln -sf meso_readtesassim.F90 readtesassim.F90 ## attention idem touch gr_fi_dyn.F.lien ln -sf ../dyn3d/gr_fi_dyn.F . ## dommage, a corriger ## attention idem fi ### ### cd ../.. # prepare for nesting #--------------------- cd libf duplicate${dom} 2> /dev/null cd .. # compile physics #-------------------------- \rm libf/grid/dimensions.h 2> /dev/null \rm -rf libo/* 2> /dev/null echo 1. compiling LMD physics ... echo compilation info in: echo $PWD/libo/log_compile_phys if [ ${debug} -ne 0 ] then echo 'DEBUG DEBUG DEBUG DEBUG' nohup makegcm_${compilo} -debug -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys else nohup makegcm_${compilo} -t ${tra} -p mars -d ${physz} testphys1d | tee libo/log_compile_phys | grep 'warnings' >> libo/log_compile_phys fi echo ... done # clean the duplicate routines cd libf duplicate1 2> /dev/null cd .. # merge LMD executables in one lib #-------------------------------------- cd libo mkdir temp #cp -f LINUXfastI._${physz}_t${tra}_reg/*.a temp cp -f LINUX*/*.a temp cd temp ar x libbibio.a ar x libphymars.a ar x libaeronomars.a \rm *.a ar r liblmd.a * cp -f liblmd.a .. cd .. \rm -r temp nm liblmd.a > liblmd_content # finish merge cd .. # save a copy #-------------- cp -f libo/liblmd.a libo/liblmd.a_${lon}_${lat}_${level}_${dom}_${tra} echo '****************************************' # ok #---- cd .. # manage nest includes in module_lmd_driver.F #---- cp call_meso_inifis$dom.inc call_meso_inifis.inc cp call_meso_physiq$dom.inc call_meso_physiq.inc fi ################################################## # END compile physics ################################################## #------------------ # compile WRF #------------------ if [ ${justphys} -eq 0 ] then echo 2. compiling WRF dynamical core ... if [[ ! ( -f "call_meso_physiq.inc" ) ]] then echo 'did you compile the physics ? no call_meso_physiq.inc !' exit fi # be sure to compile with the most recent physics touch phys/module_lmd_driver.F # talk to user echo '>>> compiling ... this may be long ... <<<' echo check progress in: echo $PWD/log_compile echo check possible errors in: echo $PWD/log_error # compile ... case ${config} in '') compile em_real > log_compile 2> log_error # save executables cd main if [[ -f real.exe ]] then echo 'Looks good ! real.exe is here...' fi if [[ -f wrf.exe ]] then echo 'Looks good ! wrf.exe is here...' fi cp -f real.exe ../../real_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cd .. ;; 'ideal') #mkdir 'test/em_quarter_ss' 2> /dev/null echo '>>> YOUR CONFIG IS : '${config} compile em_quarter_ss > log_compile 2> log_error # save executables cd main if [[ -f ideal.exe ]] then echo 'Looks good ! ideal.exe is here...' fi if [[ -f wrf.exe ]] then echo 'Looks good ! wrf.exe is here...' fi cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cd .. ;; 'les') echo '>>> YOUR CONFIG IS : '${config} mkdir 'test/em_les' 2> /dev/null compile em_les > log_compile 2> log_error # save executables cd main if [[ -f ideal.exe ]] then echo 'Looks good ! ideal.exe is here...' fi if [[ -f wrf.exe ]] then echo 'Looks good ! wrf.exe is here...' fi cp -f ideal.exe ../../ideal_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cp -f wrf.exe ../../wrf_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc}.exe cd .. ;; *) echo not supported... please use ; echo ideal les ; exit ;; esac echo '*******last lines from log_error*********' tail -n 20 log_error fi # the end echo '****************************************' echo 'done.' echo '****************************************' cp last ../makemeso_x${lon}_y${lat}_z${level}_d${dom}_t${tra}_p${numproc} mv last ../../ # add here specific messages if [[ "${dom}" != "1" ]] then nest=$(expr ${lon} + 4) echo NB: in namelist.input, please set: echo ' max_dom = '$dom' s_we = 1,1, e_we = '$lon','$nest', s_sn = 1,1, e_sn = '$lat','$nest', s_vert = 1,1, e_vert = '$level','$level',' fi