-
Notifications
You must be signed in to change notification settings - Fork 29
/
run_gen_be_wrf.sh
executable file
·96 lines (81 loc) · 2.22 KB
/
run_gen_be_wrf.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#####header for jet######
#PBS -A hfip-psu
#PBS -N bamex
#PBS -l walltime=8:00:00
#PBS -q batch
#PBS -l partition=ujet:tjet
#PBS -l procs=288
#PBS -j oe
#PBS -o ./log
#PBS -d .
#####header for stampede######
##SBATCH -J run_cycle
##SBATCH -n 336
##SBATCH -p normal
##SBATCH -t 2:00:00
source ~/.bashrc
#load configuration files, functions, parameters
cd $WORK/DA
export CONFIG_FILE=$WORK/DA/config/katrina
. $CONFIG_FILE
. util.sh
if [[ ! -d $WORK_DIR ]]; then mkdir -p $WORK_DIR; fi
cd $WORK_DIR
if [ $JOB_SUBMIT_MODE == 1 ]; then
if [[ $HOSTTYPE == "stampede" ]]; then
export total_ntasks=$SLURM_NTASKS
fi
if [[ $HOSTTYPE == "jet" ]]; then
export total_ntasks=$PBS_NP
fi
else
export total_ntasks=9999999
fi
#start cycling
date
export DATE=$DATE_START
export PREVDATE=$DATE
export NEXTDATE=$DATE
while [[ $NEXTDATE -le $DATE_CYCLE_END ]]; do #CYCLE LOOP
#TIME CALCULATION
if [[ $DATE == $DATE_START ]]; then
export run_minutes_cycle=`diff_time $DATE $DATE_CYCLE_START`
else
export run_minutes_cycle=$CYCLE_PERIOD
fi
export NEXTDATE=`advance_time $DATE $run_minutes_cycle`
if $FORECAST_TO_END; then
export run_minutes_forecast=`diff_time $DATE $DATE_END`
else
export run_minutes_forecast=`max $run_minutes_cycle $FORECAST_MINUTES`
fi
#LBDATE = Closest to DATE when FG is available
export minute_off=`echo "(${DATE:8:2}*60+${DATE:10:2})%$LBC_INTERVAL" |bc`
export LBDATE=`advance_time $DATE -$minute_off`
echo "----------------------------------------------------------------------"
echo "CURRENT CYCLE: `wrf_time_string $DATE` => `wrf_time_string $NEXTDATE`"
mkdir -p {run,rc,fc,output,obs}/$DATE
#CLEAR ERROR TAGS
for d in `ls run/$DATE/`; do
if [[ `cat run/$DATE/$d/stat` != "complete" ]]; then
echo waiting > run/$DATE/$d/stat
fi
done
#RUN COMPONENTS---------------------------------------
# ICBC
$SCRIPT_DIR/module_icbc.sh &
$SCRIPT_DIR/module_wrf_rc.sh &
# wait
#CHECK ERRORS
for d in `ls -t run/$DATE/`; do
if [[ `cat run/$DATE/$d/stat` == "error" ]]; then
echo CYCLING STOP DUE TO FAILED COMPONENT: $d
exit 1
fi
done
#ADVANCE TO NEXT CYCLE
export PREVDATE=$DATE
export DATE=$NEXTDATE
done
echo CYCLING COMPLETE