PORT is released as part of CESM1 or on any development branch since cam4_1_05.

Note that configure -rad_driver produces PORT rather than CAM.  Under this configuration, the only CAM process that runs is CAM initializations and radiation.

Note the build_namelist which will read data from rad_drv_infile and produce a corresponding file rad_drv_case containing results of computing radiative transfer on atmosphere specified in rad_drv_infile.  (If you are using the data generated by Create Data you will have 4 time samples of atmospheric state, and this run of PORT will create 4 time samples of heating rates and fluxes.)

Additional calls to radiation can be performed using the usual namelist specifications rad_diag_1 = ... as described in the CAM user's guide.

#! /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 = /path_to_cesm_with_tag_after/cesm1_0_rel_01_cam5_0_00

## 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_cam_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_DRVR
set runtype      = startup
set stop_n       = 1

## $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 $blddir/cam

## 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 \
      -rad_driver \
      -phys cam4 \
      -fc $USER_FC \
      -chem none \
      -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 \
   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_drv_case = 'RAD_drv_test'\
   rad_drv_infile = '/Location_of_offline_data_to_be_analyzed/RAD_BASE.cam2.h1.0000-01-01-00000.nc'\
   rad_data_output = .true.\
   start_ymd = 00000101\
 / "  || 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
  • No labels