#!/bin/bash # script pour lancer un cycle antarctique # name of the run (7 char + iteration number): namerun="noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5" #"noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5" tmodelend="106." # 105. 305 tmodelbegin="20." # 20. 20 tmodellength="86." # 85 285 betacfile="beta-run-12S-inv5.grd" #"beta-run-12S-inv4.grd" #"beta-run-9-S-inv4.grd" # Umagbilfile="vitbil-run-MIP-SBT5.grd" parallel="yes" # "yes or no?" iteration="1" echo "-------------------------------------" echo " Now launching run: " $namerun echo " ------------------------- " #-------------------------------------------------- # Check if times are ok: #-------------------------------------------------- tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l` tcheckbis=`echo "$tmodelend + 0" | bc -l` if [ $tcheck != $tcheckbis ]; then echo "The times provided are wrong!" echo $tcheck $tcheckbis echo "Tbegin:" $tmodelbegin ", Tend:" $tmodelend ", length:" $tmodellength exit 0 else echo "The times provided are correct." fi #-------------------------------------------------- # The different directories: #-------------------------------------------------- #RUNDIR="/home/climold/aquiquet/GRISLI/GRISLI_trunk/RUNS/"$namerun #MODELMASTER="/home/climold/aquiquet/GRISLI/GRISLI_trunk/SOURCES" #MODEL=$RUNDIR"/SOURCES" LAUCHING_DIR=`pwd` GRISLI_DIR=${LAUCHING_DIR%%/lauching_area} RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun} MODELMASTER=${GRISLI_DIR}"/SOURCES" MODEL=${RUNDIR}"/SOURCES" if [ -d $RUNDIR ]; then echo "This run exists, do you really want to overwrite?" echo "You have 7 sec. to do a ctr+c..." sleep 7 echo "Ok, your choice." else mkdir $RUNDIR echo " Run will be in:" echo " " $RUNDIR fi if [ -d $MODEL ]; then echo "model dir already created, cleaning up before copying files" rm -rf $MODEL"/"* else mkdir $MODEL fi cp -R $MODELMASTER"/"* $MODEL"/." svn status $MODELMASTER > $MODEL"/svn.status.txt" svn diff $MODELMASTER > $MODEL"/svn.diff.txt" if [ -d $RUNDIR"/bin" ]; then echo "exe in bin/" else mkdir $RUNDIR"/bin" fi if [ -d $RUNDIR"/RESULTATS" ]; then echo "exe in RESULTATS/" else mkdir $RUNDIR"/RESULTATS" fi if [ -d $RUNDIR"/INPUT" ]; then echo "inputs are linked to model master" else echo "inputs will be linked to model master" mkdir $RUNDIR"/INPUT" fi echo "Now copying master files to the working directory:" echo $RUNDIR echo "And to the model directory:" echo $MODEL #cp "../Master-files/Makefile" $MODEL"/Makefile" #cp "../Master-files/anteis1_param_list.dat" $RUNDIR"/bin/anteis1_param_list.dat" #cp "Master-files/anteis1_TEMPS-NETCDF-cycle.dat" $MODEL"/Fichiers-parametres/anteis1_TEMPS-NETCDF.dat" #cp "Master-files/module_choix-antar40-0.4-cycles.f90" $MODEL"/Ant40_files/module_choix-antar40-0.4.f90" cp "../Param/ant16km_param_list.dat" $RUNDIR"/bin/ant16km_param_list.dat" # selection du module choix inversion beta : #cp $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90-iterbeta" $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90" # script gmt de calcul des vitbil et beta_c : #cp "Master-files/recup_vitbil_job.sh" $RUNDIR"/recup_vitbil_job.sh" #cp "../Param/ant16km_param_list.dat.long" $RUNDIR"/bin/ant16km_param_list.dat" # selection du module choix run std : #cp $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90-std" $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90" if [ $parallel = "yes" ]; then cp "Master-files/grisli.run.openmp_ant16" $RUNDIR"/bin/grisli.run" else cp "Master-files/grisli.run_ant16" $RUNDIR"/bin/grisli.run" fi cd $RUNDIR"/INPUT" ln -sf ${GRISLI_DIR}"/INPUT/ANT16km" . ln -sf ${GRISLI_DIR}"/INPUT/Forcage" . ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" . #-------------------------------------------------- # Replacing key words: #-------------------------------------------------- # run spec.: sed -i "s/RUNNAME/${namerun}1/" $RUNDIR"/bin/ant16km_param_list.dat" sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/ant16km_param_list.dat" sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/ant16km_param_list.dat" # submission script: sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run" sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run" sed -i "s|_RUNNAME_|$namerun|" $RUNDIR"/bin/grisli.run" sed -i "s|_RUNTBEGIN_|$tmodelbegin|" $RUNDIR"/bin/grisli.run" sed -i "s|_RUNTEND_|$tmodelend|" $RUNDIR"/bin/grisli.run" sed -i "s|_ITERATION_|$iteration|" $RUNDIR"/bin/grisli.run" # Makefile: if [ $parallel = "yes" ]; then sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile" else sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile" fi # param values: #sed -i "s/PARAMENHFACT/$enh_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMCF/$cf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMSEUILNEFF/$seuilneff_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMINFILTR/$infiltr_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMKOND0/$kond0_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/BETAMAX/$betamax_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/TOSTICK/$tostick_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/EXPOSLOPE/$exposlope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMBSLOPE/$bslope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMBEXPO/$bexpo_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMBMELTCOEF/$bmelt_fact/" $RUNDIR"/bin/anteis1_param_list.dat" #sed -i "s/PARAMSF/$sf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" sed -i "s/NOMBETAC/$betacfile/" $RUNDIR"/bin/ant16km_param_list.dat" sed -i "s/NOMVITBIL/$Umagbilfile/" $RUNDIR"/bin/ant16km_param_list.dat" #-------------------------------------------------- # Submitting the job: #-------------------------------------------------- echo "submitting the job" qsub $RUNDIR"/bin/grisli.run" echo "-------------------------------------"