source: branches/GRISLIv3/lauching_area/go_ant40_cycle.sh @ 374

Last change on this file since 374 was 374, checked in by dumas, 14 months ago

Update go_ant40_cycle.sh with on general grisli.run.lsce for sequential and parallel runs

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