source: branches/GRISLIv3/launching_area/go_ant16.sh @ 492

Last change on this file since 492 was 492, checked in by dumas, 5 months ago

user mail automatically completed in batch scripts

  • Property svn:executable set to *
File size: 4.1 KB
Line 
1#!/bin/bash
2# script pour lancer un cycle antarctique
3
4# name of the run (7 char + iteration number):
5namerun="noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5"   #"noresm1-m_rcp8.5_medium_ISMIP6_Ant16_relax_inv5"
6
7tmodelend="106."         # 105.  305
8tmodelbegin="20."        # 20.   20
9tmodellength="86."       # 85    285
10betacfile="beta-run-12S-inv5.grd"  #"beta-run-12S-inv4.grd" #"beta-run-9-S-inv4.grd" #
11Umagbilfile="vitbil-run-MIP-SBT5.grd"
12parallel="yes" # "yes or no?"
13iteration="1"
14
15
16echo "-------------------------------------"
17echo "    Now launching run: "   $namerun
18echo "      -------------------------      "
19
20#--------------------------------------------------
21# Check if times are ok:
22#--------------------------------------------------
23
24tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l`
25tcheckbis=`echo "$tmodelend + 0" | bc -l`
26if [ $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
31else
32    echo "The times provided are correct."
33fi
34
35#--------------------------------------------------
36# The different directories:
37#--------------------------------------------------
38LAUNCHING_DIR=`pwd`
39GRISLI_DIR=${LAUNCHING_DIR%%/launching_area}
40RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun}
41MODELMASTER=${GRISLI_DIR}"/SOURCES"
42MODEL=${RUNDIR}"/SOURCES"
43
44if [ -d $RUNDIR ]; then
45    echo "This run exists, do you really want to overwrite?"
46    echo "You have 7 sec. to do a ctr+c..."
47    sleep 7
48    echo "Ok, your choice."
49else
50    mkdir $RUNDIR
51    echo "      Run will be in:"
52    echo "  " $RUNDIR
53fi
54
55if [ -d $MODEL ]; then
56    echo "model dir already created, cleaning up before copying files"
57    rm -rf $MODEL"/"*
58else
59    mkdir $MODEL
60fi
61 
62cp -R $MODELMASTER"/"* $MODEL"/."
63svn status $MODELMASTER > $MODEL"/svn.status.txt"
64svn diff $MODELMASTER > $MODEL"/svn.diff.txt"
65
66if [ -d $RUNDIR"/bin" ]; then
67    echo "exe in bin/"
68else
69    mkdir $RUNDIR"/bin"
70fi
71
72if [ -d $RUNDIR"/RESULTATS" ]; then
73    echo "exe in RESULTATS/"
74else
75    mkdir $RUNDIR"/RESULTATS"
76fi
77
78if [ -d $RUNDIR"/INPUT" ]; then
79    echo "inputs are linked to model master"
80else
81    echo "inputs will be linked to model master"
82    mkdir $RUNDIR"/INPUT"
83fi
84
85   
86echo "Now copying master files to the working directory:"
87echo $RUNDIR
88echo "And to the model directory:"
89echo $MODEL
90
91
92cp "../Param/ant16km_param_list.dat" $RUNDIR"/bin/ant16km_param_list.dat"
93
94
95if [ $parallel = "yes" ]; then
96  cp "Master-files/grisli.run.openmp_ant16" $RUNDIR"/bin/grisli.run"
97else
98  cp "Master-files/grisli.run_ant16" $RUNDIR"/bin/grisli.run"
99fi
100
101cd $RUNDIR"/INPUT"
102ln -sf ${GRISLI_DIR}"/INPUT/ANT16km" .
103ln -sf ${GRISLI_DIR}"/INPUT/Forcage" .
104ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" .
105
106#--------------------------------------------------
107# Replacing key words:
108#--------------------------------------------------
109
110# run spec.:
111sed -i "s/RUNNAME/${namerun}1/" $RUNDIR"/bin/ant16km_param_list.dat"
112sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/ant16km_param_list.dat"
113sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/ant16km_param_list.dat"
114
115# submission script:
116sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run"
117sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run"
118sed -i "s|_RUNNAME_|$namerun|" $RUNDIR"/bin/grisli.run"
119sed -i "s|_RUNTBEGIN_|$tmodelbegin|" $RUNDIR"/bin/grisli.run"
120sed -i "s|_RUNTEND_|$tmodelend|" $RUNDIR"/bin/grisli.run"
121sed -i "s|_ITERATION_|$iteration|" $RUNDIR"/bin/grisli.run"
122sed -i "s|USERNAME|$USER|" $RUNDIR"/bin/grisli.run"
123
124# Makefile:
125if [ $parallel = "yes" ]; then
126    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile"
127else
128    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile"
129fi
130
131# param values:
132sed -i "s/NOMBETAC/$betacfile/" $RUNDIR"/bin/ant16km_param_list.dat"
133sed -i "s/NOMVITBIL/$Umagbilfile/" $RUNDIR"/bin/ant16km_param_list.dat"
134
135#--------------------------------------------------
136# Submitting the job:
137#--------------------------------------------------
138cd $RUNDIR"/bin"
139echo "submitting the job"
140qsub grisli.run
141echo "-------------------------------------"
142
Note: See TracBrowser for help on using the repository browser.