-
Notifications
You must be signed in to change notification settings - Fork 1
/
wrf_auto.sh
97 lines (66 loc) · 2.53 KB
/
wrf_auto.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
#!/usr/bin/env bash
#: wrf model automation script
#: written by Quamrul Hasan, Meteorologis, BMD
#: modified by Nazmul Ahasan, CIL, RIMES
export WRF_EM_CORE=1
export WRF_NMM_CORE=0
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
ulimit -s unlimited
# script source directory
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# var definations
INIT_DATE=`date +%Y%m%d` # init date
INIT_TIME='12' # init time
NCORE=90 # number of cores to be used for simulation
GFS_DIR=/disk1/quamrul/GFS_Data # gfs data directory
WRF_DIR=/disk1/quamrul/WRF413/WRF/run # wrf run directory
ARWPOST_DIR=/disk1/quamrul/WRF413/ARWpost # arwpost directory
WPS_DIR=/disk1/quamrul/WRF413/WPS # wps directory
LOG_DIR=/disk1/quamrul/logs # log output directory
DEBUG_LOG=$LOG_DIR/debug_12.log # debug log location
PERF_LOG=$LOG_DIR/perf_12.log # perf log location
DOWN_LOG=$LOG_DIR/gfs_down_12.log # gfs data download log
# download-gfs-data
cd $GFS_DIR
echo "::started gfs download @ `date`" >> $DEBUG_LOG
# download gfs data (recursively wait)
python3 $BASE_DIR/recursive_download_gfs.py $INIT_DATE $INIT_TIME
echo "::end gfs download @ `date`" >> $DEBUG_LOG
# change configuration files [always for 10 day]
python3 $BASE_DIR/namelist_editor.py $INIT_DATE $INIT_TIME
# execute wps.exe
cd $WPS_DIR
rm GRIBFILE*
rm met_em.d01*
rm GFS*
# link gfs grib files
./link_grib.csh ${GFS_DIR}/${INIT_DATE}${INIT_TIME}/gfs* ./
# execute geogrid+ungrib+metgrid
./geogrid.exe
./ungrib.exe
./metgrid.exe
cd $WRF_DIR
rm ./met_em_d01*
ln -sf $WPS_DIR/met_em.d01* ./
./real.exe
# drop caches before running wrf
sudo $BASE_DIR/drop_memcache.sh > $PERF_LOG
# disable ASLR and NUMA Balancing
sudo $BASE_DIR/disable_aslr_numabal.sh >> $PERF_LOG
# configure cpu idle state & frequency govornor
sudo cpupower idle-set -d 2 >> $PERF_LOG
sudo cpupower frequency-set -g performance >> $PERF_LOG
# run wrf.exe
echo "::started wrf.exe @ `date` - ${NCORE} core" >> $DEBUG_LOG
mpirun.mpich -np $NCORE ./wrf.exe
echo "::end wrf.exe @ `date`" >> $DEBUG_LOG
# revert to initial cpu state
sudo cpupower idle-set -e 2 >> $PERF_LOG
sudo cpupower frequency-set -g ondemand >> $PERF_LOG
# wrf data postprocessing
cd $ARWPOST_DIR
./ARWpost.exe
# >> do data processing here <<
# again drop cache to clean the system at the end of run
sudo $BASE_DIR/drop_memcache.sh >> $PERF_LOG
# file checking and cleanup