forked from jswhit/replay_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_fg_control.csh
executable file
·97 lines (90 loc) · 2.66 KB
/
run_fg_control.csh
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.
setenv charnanal "control"
echo "charnanal = $charnanal"
setenv DATOUT "${datapath}/${analdatep1}"
echo "DATOUT = $DATOUT"
mkdir -p ${DATOUT}
setenv OMP_NUM_THREADS $control_threads
setenv OMP_STACKSIZE 256M
echo "OMP_NUM_THREADS = $OMP_NUM_THREADS"
setenv nprocs `expr $control_proc \/ $OMP_NUM_THREADS`
echo "nprocs = $nprocs"
setenv mpitaskspernode `expr $corespernode \/ $OMP_NUM_THREADS`
echo "mpitaskspernode = $mpitaskspernode"
if ( ! $?SLURM_JOB_ID && $machine == 'theia') then
if ($OMP_NUM_THREADS == 1) then
setenv HOSTFILE $PBS_NODEFILE
else
setenv HOSTFILE ${datapath2}/hostfile_control
awk "NR%${OMP_NUM_THREADS} == 1" ${PBS_NODEFILE} >&! $HOSTFILE
endif
echo "HOSTFILE = $HOSTFILE"
endif
echo "RES = $RES"
echo "write_groups = $write_groups"
echo "layout = $layout"
echo "dt_atmos = $dt_atmos"
echo "fv_sg_adj = $fv_sg_adj"
echo "cdmbgwd = $cdmbgwd"
echo "nprocs = $nprocs"
# turn off stochastic physics
setenv DO_SKEB .false.
setenv DO_SPPT .false.
setenv DO_SHUM .false.
setenv SKEB 0
setenv SPPT 0
setenv SHUM 0
echo "SKEB SPPT SHUM = $SKEB $SPPT $SHUM"
if ($cleanup_fg == 'true') then
echo "deleting existing files..."
/bin/rm -f ${DATOUT}/sfg_${analdatep1}*${charnanal}
/bin/rm -f ${DATOUT}/bfg_${analdatep1}*${charnanal}
endif
setenv niter 1
set outfiles=""
set fhr=$FHMIN
while ($fhr <= $FHMAX)
set charhr="fhr`printf %02i $fhr`"
set outfiles = "${outfiles} ${datapath}/${analdatep1}/sfg_${analdatep1}_${charhr}_${charnanal} ${datapath}/${analdatep1}/bfg_${analdatep1}_${charhr}_${charnanal}"
@ fhr = $fhr + $FHOUT
end
set alldone='yes'
foreach outfile ($outfiles)
if ( ! -s $outfile) then
echo "${outfile} is missing"
set alldone='no'
else
echo "${outfile} is OK"
endif
end
echo "${analdate} compute first guesses `date`"
while ($alldone == 'no' && $niter <= $nitermax)
echo "running forecast niter = $niter"
sh ${scriptsdir}/${rungfs}
set exitstat=$status
if ($exitstat == 0) then
set alldone='yes'
foreach outfile ($outfiles)
if ( ! -s $outfile) then
echo "${outfile} is missing"
set alldone='no'
else
echo "${outfile} is OK"
endif
end
else
set alldone='no'
echo "some files missing, try again .."
@ niter = $niter + 1
setenv niter $niter
endif
end
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
exit 1
else
echo "yes" >&! ${current_logdir}/run_fg_control.log
exit 0
endif