1 | #PBS -S /bin/bash |
---|
2 | #PBS -N run_month1 |
---|
3 | #PBS -q day |
---|
4 | #PBS -j eo |
---|
5 | #PBS -l nodes=1:ppn=24 |
---|
6 | #PBS -l mem=30gb |
---|
7 | #PBS -l vmem=50gb |
---|
8 | #PBS -l walltime=20:00:00 |
---|
9 | |
---|
10 | ## Script to run chained simulations on Ciclad |
---|
11 | ## (uses script "run0" and reference file "run.def.ref") |
---|
12 | ## Set values of "num_now" and "num_end" in the script below |
---|
13 | ## to set initial month # and final month # of the simulation |
---|
14 | |
---|
15 | # go to directory where the job was launched |
---|
16 | cd $PBS_O_WORKDIR |
---|
17 | |
---|
18 | # source the environment (you might need to adapt this path to your case) |
---|
19 | source ../trunk/LMDZ.COMMON/arch.env |
---|
20 | |
---|
21 | date |
---|
22 | |
---|
23 | ## set starting month and ending month below: |
---|
24 | num_now=1 |
---|
25 | num_end=12 |
---|
26 | (( num_previous = $num_now - 1 )) |
---|
27 | |
---|
28 | echo "$num_previous" > num_run |
---|
29 | # next month number |
---|
30 | (( num_next = $num_now + 1 )) |
---|
31 | # true (i.e. modulo 12) month number |
---|
32 | (( true_num = $num_now % 12 )) |
---|
33 | |
---|
34 | \rm -f error; touch error |
---|
35 | |
---|
36 | case $true_num in |
---|
37 | 1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;; #1 |
---|
38 | 2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #2 |
---|
39 | 3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #3 |
---|
40 | 4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;; #4 |
---|
41 | 5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;; #5 |
---|
42 | 6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;; #6 |
---|
43 | 7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;; #7 |
---|
44 | 8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;; #8 |
---|
45 | 9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #9 |
---|
46 | 10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #10 |
---|
47 | 11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;; #11 |
---|
48 | 0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;; #12 |
---|
49 | * ) echo "error" ;; |
---|
50 | esac |
---|
51 | |
---|
52 | # launch job for next month |
---|
53 | if (( $num_next <= $num_end )) ; then |
---|
54 | cp -f run_month$num_now tmp |
---|
55 | sed -e "s@run_month${num_now}@run_month${num_next}@" \ |
---|
56 | -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next |
---|
57 | rm tmp |
---|
58 | qsub run_month$num_next |
---|
59 | fi |
---|