source:
branches/2011/dev_r2802_UKMET3_rebuild/NEMOGCM/TOOLS/REBUILD_NEMO/rebuild_nemo
@
2898
Last change on this file since 2898 was 2898, checked in by edblockley, 13 years ago | |
---|---|
|
|
File size: 1.2 KB |
Line | |
---|---|
1 | #!/bin/ksh |
2 | # |
3 | # Script to run the NEMO rebuild tool to rebuild NEMO |
4 | # diagnostic or restart files. |
5 | # |
6 | # The scripts creates the nam_rebuild namelist based upon |
7 | # the command line options you give it (see usage below) |
8 | # |
9 | # Ed Blockley, September 2011 |
10 | # |
11 | # |
12 | |
13 | #set -ax |
14 | usage () |
15 | { |
16 | echo |
17 | echo " NEMO Rebuild" |
18 | echo " ************" |
19 | echo |
20 | echo " usage: ${0##*/} [-t] filebase ndomain [rebuild dimensions]" |
21 | echo |
22 | echo " flags: -t num use num threads" |
23 | echo |
24 | exit 1 |
25 | } |
26 | |
27 | while getopts t: opt |
28 | do |
29 | case ${opt} in |
30 | t) |
31 | OMP_NUM_THREADS=${OPTARG} |
32 | ;; |
33 | esac |
34 | done |
35 | shift $(expr ${OPTIND} - 1) |
36 | |
37 | if [[ $# < 2 ]] ; then |
38 | usage |
39 | fi |
40 | |
41 | script_dir=$(dirname $0) |
42 | |
43 | file=$1 |
44 | ndomain=$2 |
45 | DIM1=$3 |
46 | DIM2=$4 |
47 | export OMP_NUM_THREADS=${OMP_NUM_THREADS:-16} |
48 | |
49 | if [[ -n ${DIM1} && -n ${DIM2} ]] ; then |
50 | dim_str=" dims '${DIM1}','${DIM2}'" |
51 | dims="dims='${DIM1}','${DIM2}'" |
52 | echo ${dim_str} >> nam_rebuild |
53 | fi |
54 | |
55 | echo "file ${file}, num_domains ${ndomain}, num_threads ${OMP_NUM_THREADS}${dim_str}" |
56 | |
57 | cat > nam_rebuild << EOC |
58 | &nam_rebuild |
59 | filebase='${file}' |
60 | ndomain=${ndomain} |
61 | EOC |
62 | if [[ -n ${dims} ]] ; then |
63 | echo ${dims} >> nam_rebuild |
64 | fi |
65 | echo "/" >> nam_rebuild |
66 | |
67 | # run the rebuild code |
68 | ${script_dir}/rebuild_nemo.exe |
Note: See TracBrowser
for help on using the repository browser.