[292] | 1 | #!/bin/bash |
---|
| 2 | # script pour lancer un cycle antarctique |
---|
| 3 | |
---|
| 4 | # name of the run (7 char + iteration number): |
---|
| 5 | namerun="noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5" #"noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5" |
---|
| 6 | |
---|
| 7 | tmodelend="106." # 105. 305 |
---|
| 8 | tmodelbegin="20." # 20. 20 |
---|
| 9 | tmodellength="86." # 85 285 |
---|
| 10 | betacfile="beta-run-12S-inv5.grd" #"beta-run-12S-inv4.grd" #"beta-run-9-S-inv4.grd" # |
---|
| 11 | Umagbilfile="vitbil-run-MIP-SBT5.grd" |
---|
| 12 | parallel="yes" # "yes or no?" |
---|
| 13 | iteration="1" |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | echo "-------------------------------------" |
---|
| 17 | echo " Now launching run: " $namerun |
---|
| 18 | echo " ------------------------- " |
---|
| 19 | |
---|
| 20 | #-------------------------------------------------- |
---|
| 21 | # Check if times are ok: |
---|
| 22 | #-------------------------------------------------- |
---|
| 23 | |
---|
| 24 | tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l` |
---|
| 25 | tcheckbis=`echo "$tmodelend + 0" | bc -l` |
---|
| 26 | if [ $tcheck != $tcheckbis ]; then |
---|
| 27 | echo "The times provided are wrong!" |
---|
| 28 | echo $tcheck $tcheckbis |
---|
| 29 | echo "Tbegin:" $tmodelbegin ", Tend:" $tmodelend ", length:" $tmodellength |
---|
| 30 | exit 0 |
---|
| 31 | else |
---|
| 32 | echo "The times provided are correct." |
---|
| 33 | fi |
---|
| 34 | |
---|
| 35 | #-------------------------------------------------- |
---|
| 36 | # The different directories: |
---|
| 37 | #-------------------------------------------------- |
---|
| 38 | #RUNDIR="/home/climold/aquiquet/GRISLI/GRISLI_trunk/RUNS/"$namerun |
---|
| 39 | #MODELMASTER="/home/climold/aquiquet/GRISLI/GRISLI_trunk/SOURCES" |
---|
| 40 | #MODEL=$RUNDIR"/SOURCES" |
---|
| 41 | LAUCHING_DIR=`pwd` |
---|
| 42 | GRISLI_DIR=${LAUCHING_DIR%%/lauching_area} |
---|
| 43 | RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun} |
---|
| 44 | MODELMASTER=${GRISLI_DIR}"/SOURCES" |
---|
| 45 | MODEL=${RUNDIR}"/SOURCES" |
---|
| 46 | |
---|
| 47 | if [ -d $RUNDIR ]; then |
---|
| 48 | echo "This run exists, do you really want to overwrite?" |
---|
| 49 | echo "You have 7 sec. to do a ctr+c..." |
---|
| 50 | sleep 7 |
---|
| 51 | echo "Ok, your choice." |
---|
| 52 | else |
---|
| 53 | mkdir $RUNDIR |
---|
| 54 | echo " Run will be in:" |
---|
| 55 | echo " " $RUNDIR |
---|
| 56 | fi |
---|
| 57 | |
---|
| 58 | if [ -d $MODEL ]; then |
---|
| 59 | echo "model dir already created, cleaning up before copying files" |
---|
| 60 | rm -rf $MODEL"/"* |
---|
| 61 | else |
---|
| 62 | mkdir $MODEL |
---|
| 63 | fi |
---|
| 64 | |
---|
| 65 | cp -R $MODELMASTER"/"* $MODEL"/." |
---|
| 66 | svn status $MODELMASTER > $MODEL"/svn.status.txt" |
---|
| 67 | svn diff $MODELMASTER > $MODEL"/svn.diff.txt" |
---|
| 68 | |
---|
| 69 | if [ -d $RUNDIR"/bin" ]; then |
---|
| 70 | echo "exe in bin/" |
---|
| 71 | else |
---|
| 72 | mkdir $RUNDIR"/bin" |
---|
| 73 | fi |
---|
| 74 | |
---|
| 75 | if [ -d $RUNDIR"/RESULTATS" ]; then |
---|
| 76 | echo "exe in RESULTATS/" |
---|
| 77 | else |
---|
| 78 | mkdir $RUNDIR"/RESULTATS" |
---|
| 79 | fi |
---|
| 80 | |
---|
| 81 | if [ -d $RUNDIR"/INPUT" ]; then |
---|
| 82 | echo "inputs are linked to model master" |
---|
| 83 | else |
---|
| 84 | echo "inputs will be linked to model master" |
---|
| 85 | mkdir $RUNDIR"/INPUT" |
---|
| 86 | fi |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | echo "Now copying master files to the working directory:" |
---|
| 91 | echo $RUNDIR |
---|
| 92 | echo "And to the model directory:" |
---|
| 93 | echo $MODEL |
---|
| 94 | |
---|
| 95 | #cp "../Master-files/Makefile" $MODEL"/Makefile" |
---|
| 96 | #cp "../Master-files/anteis1_param_list.dat" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 97 | #cp "Master-files/anteis1_TEMPS-NETCDF-cycle.dat" $MODEL"/Fichiers-parametres/anteis1_TEMPS-NETCDF.dat" |
---|
| 98 | #cp "Master-files/module_choix-antar40-0.4-cycles.f90" $MODEL"/Ant40_files/module_choix-antar40-0.4.f90" |
---|
| 99 | |
---|
| 100 | cp "../Param/ant16km_param_list.dat" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 101 | # selection du module choix inversion beta : |
---|
| 102 | #cp $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90-iterbeta" $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90" |
---|
| 103 | |
---|
| 104 | # script gmt de calcul des vitbil et beta_c : |
---|
| 105 | #cp "Master-files/recup_vitbil_job.sh" $RUNDIR"/recup_vitbil_job.sh" |
---|
| 106 | |
---|
| 107 | #cp "../Param/ant16km_param_list.dat.long" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 108 | # selection du module choix run std : |
---|
| 109 | #cp $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90-std" $RUNDIR"/SOURCES/Ant16_files/module_choix-ant16km.f90" |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | if [ $parallel = "yes" ]; then |
---|
| 113 | cp "Master-files/grisli.run.openmp_ant16" $RUNDIR"/bin/grisli.run" |
---|
| 114 | else |
---|
| 115 | cp "Master-files/grisli.run_ant16" $RUNDIR"/bin/grisli.run" |
---|
| 116 | fi |
---|
| 117 | |
---|
| 118 | cd $RUNDIR"/INPUT" |
---|
| 119 | ln -sf ${GRISLI_DIR}"/INPUT/ANT16km" . |
---|
| 120 | ln -sf ${GRISLI_DIR}"/INPUT/Forcage" . |
---|
| 121 | ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" . |
---|
| 122 | |
---|
| 123 | #-------------------------------------------------- |
---|
| 124 | # Replacing key words: |
---|
| 125 | #-------------------------------------------------- |
---|
| 126 | |
---|
| 127 | # run spec.: |
---|
| 128 | sed -i "s/RUNNAME/${namerun}1/" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 129 | sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 130 | sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 131 | |
---|
| 132 | # submission script: |
---|
| 133 | sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run" |
---|
| 134 | sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run" |
---|
| 135 | sed -i "s|_RUNNAME_|$namerun|" $RUNDIR"/bin/grisli.run" |
---|
| 136 | sed -i "s|_RUNTBEGIN_|$tmodelbegin|" $RUNDIR"/bin/grisli.run" |
---|
| 137 | sed -i "s|_RUNTEND_|$tmodelend|" $RUNDIR"/bin/grisli.run" |
---|
| 138 | sed -i "s|_ITERATION_|$iteration|" $RUNDIR"/bin/grisli.run" |
---|
| 139 | |
---|
| 140 | # Makefile: |
---|
| 141 | if [ $parallel = "yes" ]; then |
---|
| 142 | sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile" |
---|
| 143 | else |
---|
| 144 | sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile" |
---|
| 145 | fi |
---|
| 146 | |
---|
| 147 | # param values: |
---|
| 148 | #sed -i "s/PARAMENHFACT/$enh_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 149 | #sed -i "s/PARAMCF/$cf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 150 | #sed -i "s/PARAMSEUILNEFF/$seuilneff_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 151 | #sed -i "s/PARAMINFILTR/$infiltr_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 152 | #sed -i "s/PARAMKOND0/$kond0_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 153 | #sed -i "s/BETAMAX/$betamax_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 154 | #sed -i "s/TOSTICK/$tostick_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 155 | #sed -i "s/EXPOSLOPE/$exposlope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 156 | #sed -i "s/PARAMBSLOPE/$bslope_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 157 | #sed -i "s/PARAMBEXPO/$bexpo_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 158 | #sed -i "s/PARAMBMELTCOEF/$bmelt_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 159 | #sed -i "s/PARAMSF/$sf_fact/" $RUNDIR"/bin/anteis1_param_list.dat" |
---|
| 160 | sed -i "s/NOMBETAC/$betacfile/" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 161 | sed -i "s/NOMVITBIL/$Umagbilfile/" $RUNDIR"/bin/ant16km_param_list.dat" |
---|
| 162 | |
---|
| 163 | #-------------------------------------------------- |
---|
| 164 | # Submitting the job: |
---|
| 165 | #-------------------------------------------------- |
---|
| 166 | |
---|
| 167 | echo "submitting the job" |
---|
| 168 | qsub $RUNDIR"/bin/grisli.run" |
---|
| 169 | echo "-------------------------------------" |
---|
| 170 | |
---|