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, 10 years ago

4th commit for rebuild branch; Moving rebuild_nemo code from TOOLS/REBUILD to TOOLS/REBUILD_NEMO (NB. this could be renamed REBUILD at a later date if that directory were to be removed) . see ticket:#871

  • Property svn:executable set to *
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
14usage ()
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
27while getopts t: opt
28do
29  case ${opt} in
30      t)
31         OMP_NUM_THREADS=${OPTARG}
32      ;;
33  esac
34done
35shift $(expr ${OPTIND} - 1)
36
37if [[ $# < 2 ]] ; then
38   usage
39fi
40
41script_dir=$(dirname $0)
42
43file=$1
44ndomain=$2
45DIM1=$3
46DIM2=$4
47export OMP_NUM_THREADS=${OMP_NUM_THREADS:-16}
48
49if [[ -n ${DIM1} && -n ${DIM2} ]] ; then
50   dim_str=" dims '${DIM1}','${DIM2}'"
51   dims="dims='${DIM1}','${DIM2}'"
52   echo ${dim_str} >> nam_rebuild
53fi
54
55echo "file ${file},  num_domains ${ndomain}, num_threads ${OMP_NUM_THREADS}${dim_str}"
56
57cat > nam_rebuild << EOC
58&nam_rebuild
59filebase='${file}'
60ndomain=${ndomain}
61EOC
62if [[ -n ${dims} ]] ; then
63   echo ${dims} >> nam_rebuild
64fi
65echo "/" >> nam_rebuild
66
67# run the rebuild code
68${script_dir}/rebuild_nemo.exe
Note: See TracBrowser for help on using the repository browser.