#======================================================================= # This is a CCM3 stand alone atm model NQS batch job script for an # non-NCAR CRAY computer #======================================================================= # # This is a sample build script as one possible means to configure, compile, # link and run the model. In general advanced users are expected to # customize this script for their own needs or to drop it entirely and come # up with their own procedures. This script is written with the begining # user in mind, and has been configured in such a way to try to make it # simple, yet powerful to use. And it has been configured such that a user # need only edit this script to make changes to the model configuration, # build, or run. # #======================================================================= # # o Edit 1a if source, executable and/or input data directories are # different from default # # o Edit 1b if SSD usage, MAXCPUS or location of netCDF libraries and # include files is different from default # # o Edit 1c if choice of model dynamics or ocean model is different # from default # # o Edit 2 if model input datasets are different from default # # o Edit 3 if input ozone dataset is different from default # # o Edit 3 and 4 if model resolution is different from default # # o Edit 5 if input namelist is different from default #======================================================================= #----------------------------------------------------------------------- # Set NQS options #----------------------------------------------------------------------- # QSUB -q high # normal # select batch queue # QSUB -lT 25:00 # CPU time limit # QSUB -lM 35Mw # memory limit without SSD (comment out if use SSD) ### QSUB -lM 23Mw # memory limit with SSD (uncomment if use SSD) ### QSUB -lQ 12Mw # set SSD memory limit (uncomment if use SSD) # QSUB -eo # combine stderr & stout # QSUB -o out.build1 # Name of the output file # QSUB -s /bin/csh # select shell script ## QSUB -x # export all environment variables # QSUB # no more QSUB options #----------------------------------------------------------------------- cd $TMP/ccm/bld pwd module swap ProgEnv ProgEnv.new f90 -V which cpp which f90 #----------------------------------------------------------------------- # 1a. Set environment variables for source, executable and input data # directories #----------------------------------------------------------------------- # Determine environment variables for paths # # setenv MODEL_EXEDIR to directory where model executable should reside # setenv MODEL_SRCDIR to directory where model source code resides # setenv MODEL_DATDIR to directory where model input data resides setenv MODEL_EXEDIR `pwd`/../run setenv MODEL_SRCDIR `pwd`/../src setenv MODEL_DATDIR `pwd`/../data if !(-d $MODEL_DATDIR) mkdir -p $MODEL_DATDIR if !(-d $MODEL_EXEDIR) mkdir -p $MODEL_EXEDIR; cd $MODEL_EXEDIR; if !(-d obj) mkdir obj ; cd obj #----------------------------------------------------------------------- # 1b. Set environment variables for platform related information #----------------------------------------------------------------------- # Determine platform and and related information # # setenv CPU to CRAY (must be uppercase) # setenv NCAR_CRAY to "TRUE" if using an NCAR CRAY # setenv SSD to "TRUE" if SSD is used # setenv MAXCPUS to number of processors # # Determine location of NetCDF include files and library # (These are set for NCAR CRAY's below) # # setenv LIB_NETCDF /usr/local/lib # setenv INC_NETCDF /usr/local/include # # The following default settings are for running the stand-alone model # on an NCAR CRAY, without the SSD on 8 CPUS. Eulerian dynamics and the # data ocean model will be used. setenv CPU CRAY setenv NCAR_CRAY FALSE setenv SSD FALSE setenv LIB_NETCDF /usr/local/apps/netcdf-3.3.1/lib setenv INC_NETCDF /usr/local/apps/netcdf-3.3.1/include setenv MAXCPUS 14 #----------------------------------------------------------------------- # 1c. Set environment variables for model grid resolution # # PCNST = number of advected tracers # PLEV = number of vertical levels # PLEVR = number of vertical levels in radiation (set to PLEV) # PLON = number of longitudes # PLAT = number of latitudes # PTRM = spectral truncation # PTRN = spectral truncation # PTRK = spectral truncation #----------------------------------------------------------------------- setenv PLON 128 setenv PLAT 64 setenv PLEV 18 setenv PTRM 42 setenv PTRN 42 setenv PTRK 42 setenv PCNST 5 #----------------------------------------------------------------------- # 1d. Set environment variables for choice of model dynamics and # ocean model #----------------------------------------------------------------------- # Determine type of dynamics (Default is eulerian) # # setenv DYNAMICS to "eul" for eulerian dynamics # setenv DYNAMICS to "sld" for semi-lagrange dynamics # # Determine ocean model component (Default is data-ocean model) # # setenv OCEAN to "dom" for data ocean model # setenv OCEAN to "som" for slab ocean model # # The following default settings are for running the stand-alone model # with Eulerian dynamics and the data ocean model setenv DYNAMICS eul setenv OCEAN dom #----------------------------------------------------------------------- # 2. Determine the input datasets #----------------------------------------------------------------------- # set the file names of the required input data files set DATINI = SEP1.T42.0198.nc # CCM3 initial data set DATSST = T42M5079.nc # sst data set DATOZN = ozn.0596.r8.nc # ozone data set DATLSM = 'arbitrary initialization' # LSM initial data #----------------------------------------------------------------------- # 3. Determine input namelist #----------------------------------------------------------------------- # the following namelist is the minimum namelist for running # the stand-alone ccm3. set INCORE = true if ( $SSD == 'TRUE' ) then set INCORE = false endif cd $MODEL_EXEDIR cat >! atm.parm << EOF \$CCMEXP caseid = 'ccm3T2' CTITLE = 'With all 4 non-CO2 greenhouse gases on 1/25/99' datadir = '$MODEL_DATDIR' ncdata = '$DATINI' bndtvs = '$DATSST' bndtvo = '$DATOZN' incorbuf = .$INCORE. incorhst = .$INCORE. incorrad = .$INCORE. iradsw = -1 iradlw = -1 iradae = -12 dtime = 1200. nestep = -2 iyear_ad = 1950 \$ \$lsmexp datadir = '$MODEL_DATDIR' finidat = '$DATLSM' \$ EOF #----------------------------------------------------------------------- # IN GENERAL NEED NOT EDIT BELOW THIS POINT #----------------------------------------------------------------------- echo echo "BUILDING CCM3 WITH THE FOLLOWING OPTIONS" echo "========================================" echo "Target Machine : $CPU" echo "Dynamics : $DYNAMICS" echo "Ocean config : $OCEAN" echo "Buffers incore : $INCORE" echo "Initial dataset : $DATINI" echo "SST Dataset : $DATSST" echo "Ozone Dataset : $DATOZN" echo "LSM Dataset : $DATLSM" echo "Number of Longitudes: $PLON" echo "Number of Latitudes : $PLAT" echo "Number of tracers : $PCNST" echo "Spectral truncation : $PTRM, $PTRN, $PTRK" echo "========================================" echo #----------------------------------------------------------------------- # The source code filepath file, "Filepath", # Modify Filepath only if user modified code is to be inserted into the model #----------------------------------------------------------------------- # SEE THE file, Filepath.examples, in this directory to determine how to edit # the following Filepath appropriately. # the following "Filepath" is for stand-alone ccm3 running on an NCAR CRAY # with Eulerian dynamics and the data ocean model. cd $MODEL_EXEDIR set FN = obj/Filepath cat >! tmp << EOF $MODEL_SRCDIR/control $MODEL_SRCDIR/dynamics $MODEL_SRCDIR/dynamics/$DYNAMICS $MODEL_SRCDIR/$OCEAN $MODEL_SRCDIR/physics $MODEL_SRCDIR/csm_share $MODEL_SRCDIR/ccmlsm_share $MODEL_SRCDIR/lsm $MODEL_SRCDIR/mathutil EOF # # Compare Filepath to previous Filepath (if any) if they are # the same leave everything in place. If they are different # delete all the files, and re-build everything from scratch. # cmp -s $FN tmp if ( $status != 0 )then if ( -e Filepath ) then echo "Filepath changed, removing all files except Filepath" else echo "creating Filepath" endif \rm $MODEL_EXEDIR/obj/[A-Z]*.o \rm $MODEL_EXEDIR/obj/[a-l]*.o \rm $MODEL_EXEDIR/obj/[m-z]*.o \rm $MODEL_EXEDIR/obj/[A-Z]*.d \rm $MODEL_EXEDIR/obj/[a-l]*.d \rm $MODEL_EXEDIR/obj/[m-z]*.d mv -f tmp $FN else echo "Use previous $FN" \rm tmp endif #----------------------------------------------------------------------- # 3. Determine the atmosphere resolution include file, "params.h" # Default is 18 level T42 with 23 level ozone datset #----------------------------------------------------------------------- # Edit only #define settings below for # PNATS,POZLEV # PNATS = number of non-advected tracers # POZLEV = number of ozone levels on ozone dataset # the following "params.h" assumes: # 18 level T42 model with only water as an advected tracer, no # non-advected tracers and a 23 level ozone dataset cd $MODEL_EXEDIR/obj set FN = params.h cat >! tmp << EOF #ifndef PARAMS_SET #define PARAMS_SET #define PNATS 0 #define POZLEV 23 #define PCNST $PCNST #define PLEV $PLEV #define PLEVR $PLEV #define PLON $PLON #define PLAT $PLAT #define PTRM $PTRM #define PTRN $PTRN #define PTRK $PTRK #endif EOF cmp -s $FN tmp if ( $status != 0 )then echo "Create new $FN" mv -f tmp $FN else echo "Use previous $FN" \rm tmp endif #----------------------------------------------------------------------- # 4. Edit the lsm resolution include file, "preproc.h" # The default is 18 level T42 #----------------------------------------------------------------------- # Edit only #define settings below for # LSMLON, LSMLAT # LSMLON = number of longitudes # LSMLAT = number of latitudes # the following "preproc.h" assumes a an output # NetCDF that is single precision. cd $MODEL_EXEDIR/obj set FN = preproc.h cat >! tmp << EOF #ifndef PREPROC_SET #define PREPROC_SET #define LSMLON $PLON #define LSMLAT $PLAT #endif EOF cmp -s $FN tmp if ( $status != 0 )then echo "Create new $FN" mv -f tmp $FN else echo "Use previous $FN" \rm tmp endif #----------------------------------------------------------------------- # The general include file "misc.h" # Modify misc.h only if NCPREC is to be changed to NF_DOUBLE #----------------------------------------------------------------------- # CRAY,SUN,SGI = platform type (this is set to $CPU below) # PVP = parallel vector processor # define for CRAY # REALTYPE = set to MPI_REAL for CRAY # COUP_CSM = if defined, ccm3 is run through flux coupler # undefine for stand-alone model # COUP_SOM = if defined , slab ocean model is enabled for stand-alone ccm3 # if undefined, data ocean model is enabled for stand-alone ccm3 # NCPREC = precision of output NetCDF history file # set to NF_FLOAT or NF_DOUBLE, default is NF_FLOAT # SHELL_MSS = define when interface to routine mswrite does not exist # FORTFFT = undefine for NCAR CRAY # SPMD = undefine for CRAY # the following "misc.h" assumes: # a stand-alone model running on an NCAR CRAY. if ( $OCEAN == 'dom' ) then set coup_som = '#undef COUP_SOM' endif if ( $OCEAN == 'som' ) then set coup_som = '#define COUP_SOM' endif cd $MODEL_EXEDIR/obj set FN = misc.h cat >! tmp << EOF #ifndef MISC_SET #define MISC_SET #define $CPU #define PVP #define REALTYPE MPI_REAL $coup_som #undef COUP_CSM #define NCPREC NF_FLOAT #define SHELL_MSS #define FORTFFT #undef SPMD #endif EOF cmp -s $FN tmp if ( $status != 0 )then echo "Create new $FN" mv -f tmp $FN else echo "Use previous $FN" \rm tmp endif #----------------------------------------------------------------------- # Generate the executable #----------------------------------------------------------------------- cd $MODEL_EXEDIR/obj echo "Compiling CCM ... see $MODEL_EXEDIR/compile_log.atm for log" echo touch $MODEL_EXEDIR/compile_log.atm echo '------------------------------------------------------------------' >>& $MODEL_EXEDIR/compile_log.atm date >>& $MODEL_EXEDIR/compile_log.atm echo '------------------------------------------------------------------' >>& $MODEL_EXEDIR/compile_log.atm # # Make the model: "-j" means multi-process # "-e" means override default settings # with environment variables set here. # echo ' before entering gmake' which f90 which cpp echo ' now entering gmake' gmake -j4 -e -f $MODEL_SRCDIR/../bld/Makefile >>& $MODEL_EXEDIR/compile_log.atm || exit 3 #----------------------------------------------------------------------- # Do not Run the model ... for now at least exit #----------------------------------------------------------------------- echo 'Running CCM ... ' echo cd $MODEL_EXEDIR env NCPUS=$MAXCPUS atm < atm.parm >&! atm.log.$$ echo "CCM Finished - see atm.log.$$ for log" echo /work/u13338/ccm/bld 4 %