Script for Executing the CCM3.6.6 on the SGI Origin 2000 (ute)

Appended to this message is a script for executing the CCM3.6.6 on ute. The script uses CCM3.6.6 code (i.e., latest available on the web) that has been untarred in the /ccm directory on ute. It was recently tested to ensure that (a) it worked and (b) it resulted in solutions that identically matched those produced by the run script provided with the web distribution. Please regard this to be a starting point, recognizing that the working environment is subject to change. Some points users should also be aware of are:

  setenv _DSM_WAIT SPIN
  setenv OMP_DYNAMIC FALSE


----------------------------Cut Here-----------------------------------
#!/bin/csh -x

## -q       : queue to use
## -l mpp_p : Max number of processes (always 4 greater than the queue limit)
## -lT      : job time limit (CPU seconds)
## -lt      : single command time limit (CPU seconds)
## -eo      : glue together stdout and stderr

#QSUB -q ded_32
#QSUB -l mpp_p=36
#QSUB -lT 90010
#QSUB -lt 90000
#QSUB -eo

## ALWAYS set the number of processors (OMP_NUM_THREADS) to the queue limit
## Define the case id (required by both the model and this script).

setenv OMP_NUM_THREADS 32
set caseid = test

## Runtime machine-specific environment variables
##
## _DSM_PLACEMENT: Ensure efficient memory allocation 
## _DSM_WAIT     : Assume dedicated access to processors
## _DSM_VERBOSE  : Print diagnostic info about system-level software
## OMP_DYNAMIC   : False => Don't give up processors even if machine is busy
## MPC_GANG      : Gang scheduling.  Does not work well so turn off
## TRAP_FPE      : Abort on overflow or divide by zero

setenv _DSM_PLACEMENT ROUND_ROBIN
setenv _DSM_WAIT SPIN
#setenv _DSM_VERBOSE
setenv OMP_DYNAMIC FALSE
setenv MPC_GANG    OFF
setenv TRAP_FPE "UNDERFL=FLUSH_ZERO; OVERFL=ABORT,TRACE; DIVZERO=ABORT,TRACE"

## Build and run the model in a temporary directory

mkdir -p $TMPDIR/$caseid        || exit 1
cd $TMPDIR/$caseid              || exit 1

## Set search path for CCM3.6.6 source code. Then set hierarchical source 
## code search path for standalone CCM (i.e. uncoupled) run with Eularian 
## dynamics.

set srcdir = /ccm/ccm3.6.6

cat >! Filepath << EOF          || exit 1
$srcdir/ccm/src/control
$srcdir/ccm/src/dynamics
$srcdir/ccm/src/dynamics/eul
$srcdir/ccm/src/physics
$srcdir/ccm/src/ccmlsm_share
$srcdir/ccm/src/csm_share
$srcdir/ccm/src/dom
$srcdir/ccm/src/lsm
$srcdir/ccm/src/mathutil
$srcdir/ccm/src/srchutil
EOF

## Build appropriate misc.h, params.h, and preproc.h files for standalone,
## T42, 18-level model.  
##
## Any additional source code mods should probably go here as well. This is 
## because when gmake is run, it will look in the directory from which it is 
## run (i.e. $TMPDIR/$caseid) for source files *before* the directories 
## specified in Filepath.

cat >! misc.h << EOF            || exit 1
#ifndef MISC_SET
#define MISC_SET
#define SGI
#define FORTFFT
#define NCPREC NF_FLOAT
#endif
EOF

cat >! params.h << EOF          || exit 1
#ifndef PARAMS_SET
#define PARAMS_SET
#define PCNST 1
#define PNATS 0
#define PLEV 18
#define PLEVR 18
#define PLON 128
#define PLAT 64
#define PTRM 42
#define PTRN 42
#define PTRK 42
#define POZLEV 23
#endif
EOF

cat >! preproc.h << EOF         || exit 1
#ifndef PREPROC_SET
#define PREPROC_SET
#define LSMLON 128
#define LSMLAT 64
#endif
EOF

## Copy a Makefile specific to running CCM on NCAR's O2K to the local
## directory

cp /ccm/ccm3.6.6/ccm/bld/Makefile .   || exit 1

## Build the model

/usr/gnu/bin/gmake -j4                || exit 1

## Build a namelist and run the model

cat >! namelist << EOF                || exit 1
 &CCMEXP
 CASEID   = '$caseid'
 CTITLE   = '$caseid run on ute'
 NCDATA   = 'SEP1.T42.0198.nc'
 BNDTVS   = 'T42M5079.nc'
 BNDTVO   = 'ozn.0596.r8.nc'
 NSWRPS   = 'passwd'
 NSREST   = 0
 IRT      = 10
 MFILT    = 11
 DTIME    = 1200.
 NESTEP   = 72
 NHTFRQ   = 72
 INCORBUF = .TRUE.
 INCORHST = .TRUE.
 INCORRAD = .TRUE.
 DATADIR  = '/ccm/ccm3.6.6/ccm/datasets'
 IYEAR_AD = 1950
 &END

 &LSMEXP
 datadir  = '/ccm/ccm3.6.6/ccm/datasets'
 finidat = 'CCM3.5LSMICSEP1.0198.nc'
 &END
EOF

timex ./ccm3bin < namelist || exit 1

## Tar up the source code for the case and write to the mass store

set curdate = `date +%y-%m-%d.%H:%M`
set tarname = $caseid.$curdate.tar
tar cf $tarname *.[Fch] $srcdir/ccm/src Makefile namelist
/usr/sbin/gzip $tarname
set mslogname = `echo $LOGNAME | tr '[a-z]' '[A-Z]'`
/usr/local/bin/mswrite -w passwd -t 1000 $tarname.gz
/$mslogname/csm/$caseid/ccm3/$tarname.gz

exit 0