New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
rebuild_nemo in trunk/NEMOGCM/TOOLS/REBUILD_NEMO – NEMO

source: trunk/NEMOGCM/TOOLS/REBUILD_NEMO/rebuild_nemo @ 4990

Last change on this file since 4990 was 3025, checked in by edblockley, 12 years ago

6th commit for rebuild branch; Rewirkign the code to allow time chunk splitting for 4D variables giving the user the option to save memory at the expense of run time. see ticket:#871

  • Property svn:executable set to *
File size: 1.4 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 -c] filebase ndomain [rebuild dimensions]"
21   echo
22   echo "  flags:  -t num      use num threads"
23   echo "          -c num      split 4D vars into time chuncks of size num"
24   echo
25   exit 1
26}
27
28while getopts c:t: opt
29do
30  case ${opt} in
31      t)
32         OMP_NUM_THREADS=${OPTARG}
33      ;;
34      c)
35         NCHUNKSIZE=${OPTARG}
36      ;;
37  esac
38done
39shift $(expr ${OPTIND} - 1)
40
41if [[ $# < 2 ]] ; then
42   usage
43fi
44
45script_dir=$(dirname $0)
46
47file=$1
48ndomain=$2
49DIM1=$3
50DIM2=$4
51export OMP_NUM_THREADS=${OMP_NUM_THREADS:-16}
52
53if [[ -n ${DIM1} && -n ${DIM2} ]] ; then
54   dim_str=" dims '${DIM1}','${DIM2}'"
55   dims="dims='${DIM1}','${DIM2}'"
56   echo ${dim_str} >> nam_rebuild
57fi
58
59echo "file ${file},  num_domains ${ndomain}, num_threads ${OMP_NUM_THREADS}${dim_str}"
60
61cat > nam_rebuild << EOC
62&nam_rebuild
63filebase='${file}'
64ndomain=${ndomain}
65EOC
66if [[ -n ${dims} ]] ; then
67   echo ${dims} >> nam_rebuild
68fi
69if [[ -n ${NCHUNKSIZE} ]] ; then
70   echo " nchunksize=${NCHUNKSIZE}" >> nam_rebuild
71fi
72echo "/" >> nam_rebuild
73
74# run the rebuild code
75${script_dir}/rebuild_nemo.exe
Note: See TracBrowser for help on using the repository browser.