1 | #! /bin/bash |
---|
2 | |
---|
3 | #PBS -S /bin/bash |
---|
4 | #PBS -j oe |
---|
5 | #PBS -q week |
---|
6 | #PBS -N run |
---|
7 | #PBS -l nodes=1:ppn=16 |
---|
8 | #PBS -l mem=64gb |
---|
9 | #PBS -l vmem=64gb |
---|
10 | #PBS -v step=1 |
---|
11 | |
---|
12 | #### NB: "qsub -v step=XX launch" overrides value above |
---|
13 | |
---|
14 | #### PREAMBLE |
---|
15 | ulimit -s unlimited |
---|
16 | |
---|
17 | #### STEP 1 |
---|
18 | if [[ ${step} -le 1 ]] ; then |
---|
19 | cd $PBS_O_WORKDIR/gcm |
---|
20 | # |
---|
21 | year=$(more namelist.input | grep start_year | awk '{print $3}' | sed s+','+''+g) |
---|
22 | month=$(more namelist.input | grep start_month | awk '{print $3}' | sed s+','+''+g) |
---|
23 | day=$(more namelist.input | grep start_day | awk '{print $3}' | sed s+','+''+g) |
---|
24 | hour=$(more namelist.input | grep start_hour | awk '{print $3}' | sed s+','+''+g) |
---|
25 | wrf_date=${year}'-'${month}'-'${day}'_00:00:00' |
---|
26 | daygcm=$(more calendar | grep ${wrf_date} | awk '{print $2}') |
---|
27 | echo ${daygcm} | ./launch_gcm |
---|
28 | # |
---|
29 | mpirun gcm.e > log_gcm |
---|
30 | # |
---|
31 | cd $PBS_O_WORKDIR/prep |
---|
32 | echo 1 | create_readmeteo.exe |
---|
33 | readmeteo.exe < readmeteo.def |
---|
34 | fi |
---|
35 | |
---|
36 | ##### STEP 2 |
---|
37 | if [[ ${step} -le 2 ]] ; then |
---|
38 | cd $PBS_O_WORKDIR/geogrid |
---|
39 | \rm geo_em.* |
---|
40 | geogrid.exe |
---|
41 | # |
---|
42 | cd $PBS_O_WORKDIR/metgrid |
---|
43 | \rm met_em.* |
---|
44 | metgrid.exe |
---|
45 | fi |
---|
46 | |
---|
47 | ##### STEP 3 |
---|
48 | if [[ ${step} -le 3 ]] ; then |
---|
49 | cd $PBS_O_WORKDIR/ |
---|
50 | \rm wrfi* wrfb* |
---|
51 | real.exe |
---|
52 | fi |
---|
53 | |
---|
54 | ##### STEP 4 |
---|
55 | if [[ ${step} -le 4 ]] ; then |
---|
56 | rm -rf $PBS_O_WORKDIR/$PBS_JOBNAME |
---|
57 | mkdir $PBS_O_WORKDIR/$PBS_JOBNAME |
---|
58 | mv rsl.error.0000 $PBS_O_WORKDIR/$PBS_JOBNAME/real_rsl.error.0000 |
---|
59 | mv rsl.out.0000 $PBS_O_WORKDIR/$PBS_JOBNAME/real_rsl.out.0000 |
---|
60 | cp -rfL $PBS_O_WORKDIR/callphys.def $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
61 | cp -rfL $PBS_O_WORKDIR/run.def $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
62 | cp -rfL $PBS_O_WORKDIR/wrf.exe $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
63 | cp -rfL $PBS_O_WORKDIR/namelist.input $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
64 | cp -rfL $PBS_O_WORKDIR/namelist.wps $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
65 | cp -rfL $PBS_O_WORKDIR/wrfi* $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
66 | cp -rfL $PBS_O_WORKDIR/wrfb* $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
67 | cd $PBS_O_WORKDIR/$PBS_JOBNAME/ |
---|
68 | ln -sf $PBS_O_WORKDIR/data_physics ./ |
---|
69 | mpirun wrf.exe |
---|
70 | fi |
---|