forked from kuechenrole/waom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqsub_nci_10.longjob
50 lines (46 loc) · 1.68 KB
/
qsub_nci_10.longjob
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#PBS -P gi0
#PBS -q normal
#PBS -l mem=96gb,walltime=20:00:00,ncpus=256
#PBS -l wd
#PBS -m b
#PBS -N 10km_long
logname=$(date +%Y%m%d%H%M%S)
mpiexec oceanM ROMS/External/ocean_waom10.in > ocean.log.$logname
find *.nc -user oxr581 -group m68 -exec chgrp -ch gh9 {} \;
# Check for blowup
grep -iE 'error:|Abnormal|blow|blowup' ocean.log.$logname | wc -l > blowupstatus #output_error
error=`cat blowupstatus`
if [ $error -eq "0" ]; then
#setenv run_number_new
#setenv run_number_old
run_number=`cat qsub.number`
# Change .in to accept restarts:
if [ $run_number -eq "1" ]; then
sed -i 's/NRREC == 0/NRREC == -1/' ROMS/External/ocean_waom10.in
sed -i 's/ININAME == \/g\/data2\/gh9\/oxr581\/hr_exp\/waom10_ini.nc/ININAME == ocean_rst.nc/' ROMS/External/ocean_waom10.in
fi
## # Make high resolution output:
## if [ $run_number -eq "4" ]; then
## sed -i 's/NHIS == 43680/NHIS == 180/' /short/m68/deg581/tisom011/ROMS/External/ocean_tisom.in
## sed -i 's/NDEFHIS == 524160/NDEFHIS == 21915/' /short/m68/deg581/tisom011/ROMS/External/ocean_tisom.in
## fi
if [ $((($run_number+1)%1)) -eq "0" ]; then
cp ocean_rst.nc ocean_rst_$run_number.nc
fi
echo "resubmitting next job"
# resubmit job
if [ $run_number -lt "7" ]; then
run_number_old=$[$run_number * 525600]
run_number_new=$[$run_number_old + 525600] # 5 years more
sed -i 's/NTIMES == '$run_number_old'/NTIMES == '$run_number_new'/' ROMS/External/ocean_waom10.in
run_number=$[$run_number + 1]
echo $run_number > qsub.number
qsub qsub_nci_10.longjob
else
echo "not resubmitting as reached max qsub.number"
fi
else
echo "not resubmitting as blowupstatus is $error"
fi
exit