-
Notifications
You must be signed in to change notification settings - Fork 11
/
run_fg_control.sh
executable file
·97 lines (90 loc) · 2.64 KB
/
run_fg_control.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
96
97
# run high-res control first guess.
# first, clean up old first guesses.
export charnanal="control"
echo "charnanal = $charnanal"
export DATOUT="${datapath}/${analdatep1}"
echo "DATOUT = $DATOUT"
mkdir -p ${DATOUT}
export OMP_NUM_THREADS=$control_threads
export OMP_STACKSIZE=2048m
echo "OMP_NUM_THREADS = $OMP_NUM_THREADS"
export nprocs=`expr $control_proc \/ $OMP_NUM_THREADS`
echo "nprocs = $nprocs"
export mpitaskspernode=`expr $corespernode \/ $OMP_NUM_THREADS`
echo "mpitaskspernode = $mpitaskspernode"
export RES=$RES_CTL
echo "RES = $RES"
export LONB=$LONB_CTL
echo "LONB = ${LONB_CTL}"
export LATB=$LATB_CTL
echo "LATB = ${LATB_CTL}"
export write_groups="$write_groups_ctl"
echo "write_groups = $write_groups"
export write_tasks="$write_tasks_ctl"
echo "write_tasks = $write_tasks"
export layout="$layout_ctl"
echo "layout = $layout"
export dt_atmos=$dt_atmos_ctl
echo "dt_atmos = $dt_atmos"
export cdmbgwd="$cdmbgwd_ctl"
echo "cdmbgwd = $cdmbgwd"
export fg_proc=$nprocs
echo "fg_proc = $fg_proc"
# turn off stochastic physics
export SKEB=0
export DO_SKEB=F
export SPPT=0
export DO_SPPT=F
export SHUM=0
export DO_SHUM=F
echo "SKEB SPPT SHUM = $SKEB $SPPT $SHUM"
if [ $cleanup_fg == 'true' ]; then
echo "deleting existing files..."
/bin/rm -f ${datapath2}/fv3${charnanal}_historyp_${analdate}_latlon.nc
/bin/rm -f ${DATOUT}/sfg_${analdatep1}*${charnanal}
/bin/rm -f ${DATOUT}/bfg_${analdatep1}*${charnanal}
fi
export niter=1
outfiles=""
fhr=$FHMIN
while [ $fhr -le $FHMAX ]; do
charhr="fhr`printf %02i $fhr`"
outfiles="${outfiles} ${datapath}/${analdatep1}/sfg_${analdatep1}_${charhr}_${charnanal} ${datapath}/${analdatep1}/bfg_${analdatep1}_${charhr}_${charnanal}"
fhr=$((fhr+FHOUT))
done
alldone='yes'
for outfile in $outfiles; do
if [ ! -s $outfile ]; then
echo "${outfile} is missing"
alldone='no'
else
echo "${outfile} is OK"
fi
done
echo "${analdate} compute first guesses `date`"
while [ $alldone == 'no' ] && [ $niter -le $nitermax ]; do
sh ${enkfscripts}/${rungfs}
exitstat=$?
if [ $exitstat -eq 0 ]; then
alldone='yes'
for outfile in $outfiles; do
if [ ! -s $outfile ]; then
echo "${outfile} is missing"
alldone='no'
else
echo "${outfile} is OK"
fi
done
else
alldone='no'
echo "some files missing, try again .."
niter=$((niter+1))
export niter=$niter
fi
done
if [ $alldone == 'no' ]; then
echo "Tried ${nitermax} times to run high-res control first-guess and failed: ${analdate}"
echo "no" > ${current_logdir}/run_fg_control.log 2>&1
else
echo "yes" > ${current_logdir}/run_fg_control.log 2>&1
fi