forked from kuechenrole/waom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqsub_nci_2.longjob
50 lines (46 loc) · 1.72 KB
/
qsub_nci_2.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 normalbw
#PBS -l mem=2048gb,walltime=02:00:00,ncpus=224
#PBS -l wd
#PBS -m b
#PBS -N 2km_long
logname=$(date +%Y%m%d%H%M%S)
mpiexec oceanM ROMS/External/ocean_waom2.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 "512" ]; then #7 years and 5 days in 5 day chunks
sed -i 's/NRREC == 0/NRREC == -1/' ROMS/External/ocean_waom2.in
sed -i 's/ININAME == \/g\/data2\/gh9\/oxr581\/waom_frc\/waom2_ini_premixed.nc/ININAME == ocean_rst.nc/' ROMS/External/ocean_waom2.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 "658" ]; then
run_number_old=$[$run_number * 2400] # 5 day chunks
run_number_new=$[$run_number_old + 2400]
sed -i 's/NTIMES == '$run_number_old'/NTIMES == '$run_number_new'/' ROMS/External/ocean_waom2.in
run_number=$[$run_number + 1]
echo $run_number > qsub.number
qsub qsub_nci_2.longjob
else
echo "not resubmitting as reached max qsub.number"
fi
else
echo "not resubmitting as blowupstatus is $error"
fi
exit