In order to run PORT, you need to specify time samples of the atmospheric state. 

Creating the data from CAM is quite straightforward, using namelist options

What follows is run of CAM with the namelist string "rad_data_output = .true." added so that CAM will output data for offline radiation analysis.

Note also that the McICA routines work off of the last digits of the pressure variable, so ndens = 1 is required.

By default, rad_data_histfile_num = 2, however you can change the output history file, if you wish.

A typical namelist option, sampling the diurnal cycle is:

ndens = 0,1
nhtfrq = 0,73
avgflag_pertape = 'A','I'
rad_data_output = .true.
rad_data_histfile_num=2
rad_data_avgflag='I'

rad_data_output = .true. Indicates to output data for the offline driver.

nhtfrq = 73 Indicates to sample every 73 time steps (every day and a half plus a little)

avgflag_pertape = 'I' Indicates to sample instantaneous states (to capture diurnal cycle)

rad_data_histfile_num=2 Indicates to output the data in "h1" files

rad_data_avgflag='I' Indicates that the radiation data should be instantaneous.

This particular run will produce a file, RAD_BASE.cam2.h1.0000-01-01-00000.nc, containing 4 time samples of the atmospheric state.  This file will be analyzed in the section: Configure & Build & Run PORT


 #! /bin/tcsh -f
#
set ntasks = 4

setenv USER_FC lf95
##setenv USER_FC pgf90

setenv USER_CC gcc

if ( $USER_FC == "lf95" ) then

 set NETCDF = /usr/local/netcdf-lf95
 set mpich =  /usr/local/mpich2-lf95

else if ( $USER_FC == "pgf90" ) then

 set NETCDF = /usr/local/netcdf-3.6.2-pgf90
 set mpich = /usr/local/mpich2-pgf90

endif

setenv INC_NETCDF ${NETCDF}/include
setenv LIB_NETCDF ${NETCDF}/lib
setenv MOD_NETCDF $INC_NETCDF

setenv INC_MPI ${mpich}/include
setenv LIB_MPI ${mpich}/lib
setenv ${mpich}/bin:${PATH}


setenv MPI_TYPE_MAX 100000

## Do our best to get sufficient stack memory
limit stacksize unlimited

## ROOT OF CAM DISTRIBUTION - probably needs to be customized.
## Contains the source code for the CAM distribution.
## (the root directory contains the subdirectory "models")

set curdir = `pwd`

set camroot = $curdir/..

## ROOT OF CAM DATA DISTRIBUTION - needs to be customized unless running at NCAR.
## Contains the initial and boundary data for the CAM distribution.
## (the root directory contains the subdirectories "atm" and "lnd")
setenv CSMDATA  /path_to_ccsm_inputdata/cam-in

## Default namelist settings:
## $case is the case identifier for this run. It will be placed in the namelist.
## $runtype is the run type: initial, restart, or branch.
## $nelapse is the number of timesteps to integrate, or number of days if negative.
set case = RAD_BASE
set runtype      = startup
set stop_n       = 3

## $wrkdir is a working directory where the model will be built and run.
## $blddir is the directory where model will be compiled.
## $rundir is the directory where the model will be run.
## $cfgdir is the directory containing the CAM configuration scripts.
set wrkdir       = /data/$LOGNAME
set blddir       = $wrkdir/$case/bld
set rundir       = $wrkdir/$case
set cfgdir       = $camroot/models/atm/cam/bld

#rm -fr $rundir
#rm $blddir/cam
#rm $rundir/*

## Ensureq that run and build directories exist
mkdir -p $rundir/timing                || echo "cannot create $rundir" && exit 1
mkdir -p $blddir                || echo "cannot create $blddir" && exit 1

echo " "
echo "before configure..."
echo " "

## If an executable doesn't exist, build one.
if ( ! -x $blddir/cam ) then
    cd $blddir                  || echo "cd $blddir failed" && exit 1
    $cfgdir/configure \
      -fc $USER_FC \
      -chem none \
      -phys cam4 \
      -rad camrt\
      -debug \
      -spmd \
      -nosmp \
      -res 10x15 \
      -dyn fv \
      -ntasks $ntasks\
      -ice csim4\
    || echo "configure failed" && exit 1
    echo " "
    echo "building CAM in $blddir ..."
    echo " "
    rm -f Depends
    /usr/bin/gmake -j4 >&! MAKE.out      || echo "CAM build failed: see $blddir/MAKE.out" && exit 1
#    rm -f *.o *.mod
endif
echo " "
echo "build complete"
echo " "

## Create the namelist
cd $blddir                      || echo "cd $blddir failed" && exit 1
$cfgdir/build-namelist -case $case -runtype $runtype -d $rundir -ignore_ic_date -test \
 -namelist "&camexp  stop_n=$stop_n, stop_option='nsteps' \
   iradsw = 1 \
   iradlw = 1 \
   iradae = 1 \
   nhtfrq = 0,3,3,3,3,3\
   ndens=1,1,1,1,1,1\
   nhtfrq = 0,1,1,1,1,1\
   avgflag_pertape = 'A','I','I','I','I','I'\
   mfilt = 1,100,100,100,100,100\
   empty_htapes=.false.\
   fincl3 = 'SOLIN', 'QRS', 'FSNS', 'FSNT','FSNSC', 'FSDSC',\
            'FSNTOA', 'FSUTOA', 'FSNTOAC', 'FSNTC', 'FSDSC', 'FSDS', 'SWCF',\
            'QRL', 'FLNS', 'FLDS', 'FLNT', 'LWCF', 'FLUT' ,'FLUTC', 'FLNTC', 'FLNSC', 'FLDSC'\
   rad_data_output = .true.\
 / "  || echo "build-namelist failed" && exit 1
#exit 0

## Run CAM
cd $rundir                      || echo "cd $rundir failed" && exit 1
echo "running CAM in $rundir..."

mpirun -l -np $ntasks  $blddir/cam || echo "CAM run failed" && exit 1

exit 0 
  • No labels