source: trunk/lauching_area/go_ant40_cyc-Scho.sh @ 229

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

New launching area and RUNS directory

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