source: branches/GRISLIv3/launching_area/go_ant40_cycle.sh @ 487

Last change on this file since 487 was 487, checked in by aquiquet, 5 months ago

Cleaning branch: a bit of reorganisation and cleaning in the launching_area

  • Property svn:executable set to *
File size: 5.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/Param/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#--------------------------------------------------
71LAUNCHING_DIR=`pwd`
72GRISLI_DIR=${LAUNCHING_DIR%%/launching_area}
73RUNDIR=${GRISLI_DIR}"/RUNS/"${namerun}-r${rev}
74MODELMASTER=${GRISLI_DIR}"/SOURCES"
75MODEL=${RUNDIR}"/SOURCES"
76
77if [ -d $RUNDIR ]; then
78    echo "This run exists, do you really want to overwrite?"
79    echo "You have 3 sec. to do a ctr+c..."
80    sleep 3
81    echo "Ok, your choice."
82else
83    mkdir $RUNDIR
84    echo "      Run will be in:"
85    echo "  " $RUNDIR
86fi
87
88if [ -d $MODEL ]; then
89    echo "model dir already created, cleaning up before copying files"
90    rm -rf $MODEL"/"*
91else
92    mkdir $MODEL
93fi
94 
95cp -R $MODELMASTER"/"* $MODEL"/."
96svn status $MODELMASTER > $MODEL"/svn.status.txt"
97svn diff $MODELMASTER > $MODEL"/svn.diff.txt"
98
99if [ -d $RUNDIR"/bin" ]; then
100    echo "exe in bin/"
101else
102    mkdir $RUNDIR"/bin"
103fi
104
105if [ -d $RUNDIR"/RESULTATS" ]; then
106    echo "exe in RESULTATS/"
107else
108    mkdir $RUNDIR"/RESULTATS"
109fi
110
111if [ -d $RUNDIR"/INPUT" ]; then
112    echo "inputs are linked to model master"
113else
114    echo "inputs will be linked to model master"
115    mkdir $RUNDIR"/INPUT"
116fi
117
118
119   
120echo "Now copying master files to the working directory:"
121echo $RUNDIR
122echo "And to the model directory:"
123echo $MODEL
124
125
126cp $TEMPS_NETCDF_file $MODEL"/Fichiers-parametres/TEMPS-NETCDF.dat"
127cp $module_choix_file $MODEL"/Ant40_files/module_choix-antar40-0.4.f90"
128if [ $gr_select = "1" ] ; then
129  cp $param_tsai_file $RUNDIR"/bin/anteis1_param_list.dat"
130elif [ $gr_select = "2" ] ; then
131  cp $param_schoof_file $RUNDIR"/bin/anteis1_param_list.dat"
132fi
133
134cp $grisli_run_file $RUNDIR"/bin/grisli.run"
135
136cd $RUNDIR"/INPUT"
137ln -sf ${GRISLI_DIR}"/INPUT/ANTEIS1" .
138ln -sf ${GRISLI_DIR}"/INPUT/Forcage" .
139ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" .
140
141#--------------------------------------------------
142# Replacing key words:
143#--------------------------------------------------
144
145# run spec.:
146sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/anteis1_param_list.dat"
147sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/anteis1_param_list.dat"
148sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/anteis1_param_list.dat"
149
150# submission script:
151sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run"
152sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run"
153sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/grisli.run"
154sed -i "s/EXE_NAME/$exename/g" $RUNDIR"/bin/grisli.run"
155
156if [ $parallel = "yes" ]; then
157    sed -i "s/QUEUE/${queue}p/" $RUNDIR"/bin/grisli.run"
158    sed -i "s/PROC_NUMBER/$proc_number/" $RUNDIR"/bin/grisli.run"
159    sed -i "s/PPN_NUMBER/$ppn_number/" $RUNDIR"/bin/grisli.run"
160else
161    sed -i "s/QUEUE/$queue/" $RUNDIR"/bin/grisli.run"
162    sed -i "s/PROC_NUMBER/1/" $RUNDIR"/bin/grisli.run"
163    sed -i "s/PPN_NUMBER/1/" $RUNDIR"/bin/grisli.run"
164    sed -i "/export\ MKL_NUM_THREADS/d" $RUNDIR"/bin/grisli.run"
165    sed -i "/export\ OMP_NUM_THREADS/d" $RUNDIR"/bin/grisli.run"
166    sed -i "/export\ KMP_STACKSIZE/d" $RUNDIR"/bin/grisli.run"
167fi
168
169# Makefile:
170if [ $parallel = "yes" ]; then
171    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile"
172else
173    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile"
174fi
175
176
177#--------------------------------------------------
178# Submitting the job:
179#--------------------------------------------------
180cd $RUNDIR"/bin"
181echo "submitting the job"
182qsub $RUNDIR"/bin/grisli.run"
183echo "-------------------------------------"
184
185
186
Note: See TracBrowser for help on using the repository browser.