source: trunk/lauching_area/go_ant40_cycle.sh @ 334

Last change on this file since 334 was 241, checked in by dumas, 5 years ago

go_ant40_cycle.sh replace go_ant40_cyc-Scho.sh and go_ant40_cyc-Tsai.sh

  • Property svn:executable set to *
File size: 5.8 KB
Line 
1#!/bin/bash
2# script pour lancer un cycle antarctique
3
4echo "----------------------------------------------"
5echo "Launching GRISLI Ant-40 last deglaciation"
6echo "Schoof or Tsai parameterisation ?"
7echo "For Tsai   : 1"
8echo "For Schoof : 2"
9read gr_select
10echo
11
12tmodelend="10000."
13tmodelbegin="-126000." #"-150000."
14tmodellength="136000."
15
16parallel="yes" # "yes or no?"
17
18#Revision number :
19rev=`svn info | grep "Révision : " | awk '{print $2}'`
20echo "Code revision svn "$rev
21
22# name of the run:
23if [ $gr_select = "1" ] ; then
24  echo "grounding line parameterisation type : Tsai"
25  namerun="Cyc-Tsai"
26elif [ $gr_select = "2" ] ; then
27  echo "grounding line parameterisation type : Schoof"
28  namerun="Cyc-Scho"
29else
30  echo "Bad choice for gr_select (1 or 2 only) !!!"
31  exit 0
32fi
33
34echo
35echo "----------------------------------------------"
36echo "    Now launching run: "   $namerun
37echo "----------------------------------------------"
38echo
39
40#--------------------------------------------------
41# Check if times are ok:
42#--------------------------------------------------
43
44tcheck=`echo "$tmodelbegin + $tmodellength" | bc -l`
45tcheckbis=`echo "$tmodelend + 0" | bc -l`
46if [ $tcheck != $tcheckbis ]; then
47    echo "The times provided are wrong!"
48    echo $tcheck $tcheckbis
49    echo "Tbegin:" $tmodelbegin ", Tend:" $tmodelend ", length:" $tmodellength
50    exit 0
51else
52    echo "The times provided are correct."
53fi
54
55#--------------------------------------------------
56# The different directories:
57#--------------------------------------------------
58#RUNDIR="/home/climold/aquiquet/GRISLI/GRISLI_trunk/RUNS/"$namerun
59#MODELMASTER="/home/climold/aquiquet/GRISLI/GRISLI_trunk/SOURCES"
60#MODEL=$RUNDIR"/SOURCES"
61LAUCHING_DIR=`pwd`
62GRISLI_DIR=${LAUCHING_DIR%%/lauching_area}
63RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun}-r${rev}
64MODELMASTER=${GRISLI_DIR}"/SOURCES"
65MODEL=${RUNDIR}"/SOURCES"
66
67if [ -d $RUNDIR ]; then
68    echo "This run exists, do you really want to overwrite?"
69    echo "You have 3 sec. to do a ctr+c..."
70    sleep 3
71    echo "Ok, your choice."
72else
73    mkdir $RUNDIR
74    echo "      Run will be in:"
75    echo "  " $RUNDIR
76fi
77
78if [ -d $MODEL ]; then
79    echo "model dir already created, cleaning up before copying files"
80    rm -rf $MODEL"/"*
81else
82    mkdir $MODEL
83fi
84 
85cp -R $MODELMASTER"/"* $MODEL"/."
86svn status $MODELMASTER > $MODEL"/svn.status.txt"
87svn diff $MODELMASTER > $MODEL"/svn.diff.txt"
88
89if [ -d $RUNDIR"/bin" ]; then
90    echo "exe in bin/"
91else
92    mkdir $RUNDIR"/bin"
93fi
94
95if [ -d $RUNDIR"/RESULTATS" ]; then
96    echo "exe in RESULTATS/"
97else
98    mkdir $RUNDIR"/RESULTATS"
99fi
100
101if [ -d $RUNDIR"/INPUT" ]; then
102    echo "inputs are linked to model master"
103else
104    echo "inputs will be linked to model master"
105    mkdir $RUNDIR"/INPUT"
106fi
107
108
109   
110echo "Now copying master files to the working directory:"
111echo $RUNDIR
112echo "And to the model directory:"
113echo $MODEL
114
115#cp "../Master-files/Makefile" $MODEL"/Makefile"
116#cp "../Master-files/anteis1_param_list.dat" $RUNDIR"/bin/anteis1_param_list.dat"
117cp "Master-files/anteis1_TEMPS-NETCDF-cycle.dat" $MODEL"/Fichiers-parametres/anteis1_TEMPS-NETCDF.dat"
118cp "Master-files/module_choix-antar40-0.4-cycles.f90" $MODEL"/Ant40_files/module_choix-antar40-0.4.f90"
119if [ $gr_select = "1" ] ; then
120  cp "../Param/anteis1_param_list_Cyc-Tsai.dat" $RUNDIR"/bin/anteis1_param_list.dat"
121elif [ $gr_select = "2" ] ; then
122  cp "../Param/anteis1_param_list_Cyc-Scho.dat" $RUNDIR"/bin/anteis1_param_list.dat"
123fi
124
125if [ $parallel = "yes" ]; then
126  cp "Master-files/grisli.run.openmp_ant40" $RUNDIR"/bin/grisli.run"
127else
128  cp "Master-files/grisli.run_ant40" $RUNDIR"/bin/grisli.run"
129fi
130
131cd $RUNDIR"/INPUT"
132ln -sf ${GRISLI_DIR}"/INPUT/ANTEIS1" .
133ln -sf ${GRISLI_DIR}"/INPUT/Forcage" .
134ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" .
135
136#--------------------------------------------------
137# Replacing key words:
138#--------------------------------------------------
139
140# run spec.:
141sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/anteis1_param_list.dat"
142sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/anteis1_param_list.dat"
143sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/anteis1_param_list.dat"
144
145# submission script:
146sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run"
147sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run"
148sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/grisli.run"
149if [ $parallel = "yes" ]; then
150    sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4p\n/' $RUNDIR"/bin/grisli.run"
151else
152    sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4\n/' $RUNDIR"/bin/grisli.run"
153fi
154
155# Makefile:
156if [ $parallel = "yes" ]; then
157    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile"
158else
159    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile"
160fi
161
162# param values:
163#sed -i "s/PARAMENHFACT/$enh_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
164#sed -i "s/PARAMCF/$cf_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
165#sed -i "s/PARAMSEUILNEFF/$seuilneff_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
166#sed -i "s/PARAMINFILTR/$infiltr_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
167#sed -i "s/PARAMKOND0/$kond0_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
168#sed -i "s/BETAMAX/$betamax_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
169#sed -i "s/TOSTICK/$tostick_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
170#sed -i "s/EXPOSLOPE/$exposlope_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
171#sed -i "s/PARAMBSLOPE/$bslope_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
172#sed -i "s/PARAMBEXPO/$bexpo_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
173#sed -i "s/PARAMBMELTCOEF/$bmelt_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
174#sed -i "s/PARAMSF/$sf_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
175
176
177#--------------------------------------------------
178# Submitting the job:
179#--------------------------------------------------
180
181echo "submitting the job"
182qsub $RUNDIR"/bin/grisli.run"
183echo "-------------------------------------"
184
185
186
187
188
189
190
191
Note: See TracBrowser for help on using the repository browser.