#!/bin/bash # script pour lancer un cycle antarctique echo "----------------------------------------------" echo "Launching GRISLI Ant-40 last deglaciation" echo "Schoof or Tsai parameterisation ?" echo "For Tsai : 1" echo "For Schoof : 2" read gr_select echo tmodelend="10000." tmodelbegin="-126000." #"-150000." tmodellength="136000." parallel="no" # "yes or no?" proc_number="4" # number of processor used ppn_number=$proc_number # number of cpus (ppn) exename="Ant-40" queue="long" # specify queue used : short, medium, long, xlong... # Files used grisli_run_file="Master-files/grisli.run.lsce" # grisli.run param_tsai_file="../Param/anteis1_param_list_Cyc-Tsai.dat" # param file Tsai param_schoof_file="../Param/anteis1_param_list_Cyc-Scho.dat" # param file Schoof TEMPS_NETCDF_file="Master-files/anteis1_TEMPS-NETCDF-cycle.dat" # TEMPS-NETCDF.dat module_choix_file="Master-files/module_choix-antar40-0.4-cycles.f90" # module choix #Revision number : rev=`svn info | grep "visionĀ : " | awk '{print $2}'` echo "Code revision svn "$rev # name of the run: if [ $gr_select = "1" ] ; then echo "grounding line parameterisation type : Tsai" namerun="Cyc-Tsai" elif [ $gr_select = "2" ] ; then echo "grounding line parameterisation type : Schoof" namerun="Cyc-Scho" else echo "Bad choice for gr_select (1 or 2 only) !!!" exit 0 fi echo echo "----------------------------------------------" echo " Now launching run: " $namerun echo "----------------------------------------------" 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}-r${rev} MODELMASTER=${GRISLI_DIR}"/SOURCES" MODEL=${RUNDIR}"/SOURCES" if [ -d $RUNDIR ]; then echo "This run exists, do you really want to overwrite?" echo "You have 3 sec. to do a ctr+c..." sleep 3 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 $TEMPS_NETCDF_file $MODEL"/Fichiers-parametres/TEMPS-NETCDF.dat" cp $module_choix_file $MODEL"/Ant40_files/module_choix-antar40-0.4.f90" if [ $gr_select = "1" ] ; then cp $param_tsai_file $RUNDIR"/bin/anteis1_param_list.dat" elif [ $gr_select = "2" ] ; then cp $param_schoof_file $RUNDIR"/bin/anteis1_param_list.dat" fi cp $grisli_run_file $RUNDIR"/bin/grisli.run" cd $RUNDIR"/INPUT" ln -sf ${GRISLI_DIR}"/INPUT/ANTEIS1" . ln -sf ${GRISLI_DIR}"/INPUT/Forcage" . ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" . #-------------------------------------------------- # Replacing key words: #-------------------------------------------------- # run spec.: sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/anteis1_param_list.dat" sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/anteis1_param_list.dat" sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/anteis1_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/EXE_NAME/$exename/g" $RUNDIR"/bin/grisli.run" if [ $parallel = "yes" ]; then sed -i "s/QUEUE/${queue}p/" $RUNDIR"/bin/grisli.run" sed -i "s/PROC_NUMBER/$proc_number/" $RUNDIR"/bin/grisli.run" sed -i "s/PPN_NUMBER/$ppn_number/" $RUNDIR"/bin/grisli.run" else sed -i "s/QUEUE/$queue/" $RUNDIR"/bin/grisli.run" sed -i "s/PROC_NUMBER/1/" $RUNDIR"/bin/grisli.run" sed -i "s/PPN_NUMBER/1/" $RUNDIR"/bin/grisli.run" sed -i "/export\ MKL_NUM_THREADS/d" $RUNDIR"/bin/grisli.run" sed -i "/export\ OMP_NUM_THREADS/d" $RUNDIR"/bin/grisli.run" sed -i "/export\ KMP_STACKSIZE/d" $RUNDIR"/bin/grisli.run" fi # 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" #-------------------------------------------------- # Submitting the job: #-------------------------------------------------- cd $RUNDIR"/bin" echo "submitting the job" qsub $RUNDIR"/bin/grisli.run" echo "-------------------------------------"