source: trunk/lauching_area/go_ant40.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.1 KB
Line 
1#!/bin/bash
2# script pour lancer un cycle antarctique
3
4# name of the run:
5namerun="Ant40-02"
6
7tmodelend="10000."
8tmodelbegin="-126000."
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/Makefile" $MODEL"/Makefile"
94#cp "../Master-files/anteis1_param_list.dat" $RUNDIR"/bin/anteis1_param_list.dat"
95cp "Master-files/anteis1_TEMPS-NETCDF-cycle.dat" $MODEL"/Fichiers-parametres/anteis1_TEMPS-NETCDF.dat"
96cp "Master-files/module_choix-antar40-0.4-cycles.f90" $MODEL"/Ant40_files/module_choix-antar40-0.4.f90"
97# Schoof :
98#cp "../Param/anteis1_param_list_Cyc-Scho.dat" $RUNDIR"/bin/anteis1_param_list.dat"
99# Tsai
100cp "../Param/anteis1_param_list_Cyc-Tsai.dat" $RUNDIR"/bin/anteis1_param_list.dat"
101
102if [ $parallel = "yes" ]; then
103  cp "Master-files/grisli.run.openmp_ant40" $RUNDIR"/bin/grisli.run"
104else
105  cp "Master-files/grisli.run_ant40" $RUNDIR"/bin/grisli.run"
106fi
107
108cd $RUNDIR"/INPUT"
109ln -sf ${GRISLI_DIR}"/INPUT/ANTEIS1" .
110ln -sf ${GRISLI_DIR}"/INPUT/Forcage" .
111ln -sf ${GRISLI_DIR}"/INPUT/tracer.dat" .
112
113#--------------------------------------------------
114# Replacing key words:
115#--------------------------------------------------
116
117# run spec.:
118sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/anteis1_param_list.dat"
119sed -i "s/RUNTBEGIN/$tmodelbegin/" $RUNDIR"/bin/anteis1_param_list.dat"
120sed -i "s/RUNTEND/$tmodelend/" $RUNDIR"/bin/anteis1_param_list.dat"
121
122# submission script:
123sed -i "s|SOURCESREP|$MODEL|" $RUNDIR"/bin/grisli.run"
124sed -i "s|EXEREP|$RUNDIR\/bin|" $RUNDIR"/bin/grisli.run"
125sed -i "s/RUNNAME/$namerun/" $RUNDIR"/bin/grisli.run"
126if [ $parallel = "yes" ]; then
127    sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4p\n/' $RUNDIR"/bin/grisli.run"
128else
129    sed -i '/EXEDIR/s/$/\nmodule load netcdf\/4\n/' $RUNDIR"/bin/grisli.run"
130fi
131
132# Makefile:
133if [ $parallel = "yes" ]; then
134    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-parallel.inc/" $RUNDIR"/SOURCES/Makefile"
135else
136    sed -i "s/Makefile.tof-lsce3130.inc/Makefile.tof-asterix-sequential.inc/" $RUNDIR"/SOURCES/Makefile"
137fi
138
139# param values:
140#sed -i "s/PARAMENHFACT/$enh_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
141#sed -i "s/PARAMCF/$cf_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
142#sed -i "s/PARAMSEUILNEFF/$seuilneff_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
143#sed -i "s/PARAMINFILTR/$infiltr_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
144#sed -i "s/PARAMKOND0/$kond0_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
145#sed -i "s/BETAMAX/$betamax_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
146#sed -i "s/TOSTICK/$tostick_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
147#sed -i "s/EXPOSLOPE/$exposlope_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
148#sed -i "s/PARAMBSLOPE/$bslope_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
149#sed -i "s/PARAMBEXPO/$bexpo_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
150#sed -i "s/PARAMBMELTCOEF/$bmelt_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
151#sed -i "s/PARAMSF/$sf_fact/" $RUNDIR"/bin/anteis1_param_list.dat"
152
153
154#--------------------------------------------------
155# Submitting the job:
156#--------------------------------------------------
157
158echo "submitting the job"
159qsub $RUNDIR"/bin/grisli.run"
160echo "-------------------------------------"
161
162
163
164
165
166
167
168
Note: See TracBrowser for help on using the repository browser.