source: branches/GRISLIv3/lauching_area/go_GRISLI_PMIP.sh @ 367

Last change on this file since 367 was 367, checked in by aquiquet, 14 months ago

Cleaning branch: a few additions to make basic runs, degla Hemin40 and cycle Ant40, possible

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