The following example contains the steps used by Mariana Vertenstein
to create a new regional grid for running WRF-CLM within the CESM
framework, June, 2012.

0) The following instructions assume that the following grid files
have already been created, and are in the directory given by the shell
variable wrfclm:

remap_grid_nwAtl_12km_5m_ocn.nc
remap_grid_nwAtl_12km_5m_atm.nc

These are both SCRIP grid files. In this case, the two files are
identical except for the grid_imask. The atm grid_imask is 1
everywhere; the ocn grid_imask is either 0 or 1.

In addition, the shell variable YYMMDD should give the date at which
these scripts were run (e.g., YYMMDD=120606)

1) generate atm/ocn mapping files

   cd $CIMEROOT/tools/mapping/gen_mapping_files
   ./gen_cesm_maps.sh --fileocn $wrfclm/remap_grid_nwAtl_12km_5m_ocn.nc \
                      --fileatm $wrfclm/remap_grid_nwAtl_12km_5m_atm.nc \
                      --typeocn regional --typeatm regional \
                      --nameocn nwAtl_12km_5m_ocn --nameatm nwAtl_12km_5m_atm 

This generates 5 mapping files, including:
map_nwAtl_12km_5m_ocn_TO_nwAtl_12km_5m_atm_aave.$YYMMDD.nc

2) generate (atm/lnd) and (ocn/ice) domain files

   cd $CIMEROOT/tools/mapping/gen_domain_files
   [Note: you may need to build this tool... see INSTALL for instructions]
   ./gen_domain -m ../gen_mapping_files/map_nwAtl_12km_5m_ocn_TO_nwAtl_12km_5m_atm_aave.$YYMMDD.nc \
                -o nwAtl_12km_5m_ocn -l nwAtl_12km_5m_lnd

   This generates 3 domain files, including:
      domain.lnd.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc
      domain.ocn.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc

3) Generate mapping files for clm surface dataset (since this is a non-standard grid)

   cd $CIMEROOT/../components//clm/tools/mkmapdata
   ./mkmapdata.sh --gridfile $wrfclm/remap_grid_nwAtl_12km_5m_atm.nc \
                  --res nwAtl_12km_5km --gridtype regional   

   This generates many mapping files

4) Generate clm surface dataset   
   
   cd $CIMEROOT/../components/clm/tools/mksurfdata_map
   ./mksurfdata.pl -res usrspec -usr_gname nwAtl_12km_5km -usr_gdate $YYMMDD \
                   -y 2000

   This creates: surfdata_nwAtl_12km_5km_simyr2000_c$YYMMDD.nc

5) create grid file needed for create_newcase

   cd $CIMEROOT/scripts
   create nwatl_12km5km_grid_file.xml with the following contents, being sure
   to replace $CIMEROOT and $YYMMDD with the values of these variables:

<?xml version="1.0"?>
<config_horiz_grid>
<horiz_grid GLOB_GRID="nwatl1205" nx="539" ny="359" />
<horiz_grid GRID="nwatl1205_nwatl1205" SHORTNAME="nwatl_nwatl"
            ATM_GRID="nwatl1205" LND_GRID="nwatl1205" OCN_GRID="nwatl1205" ICE_GRID="nwatl1205" 
            ATM_NCPL="48" OCN_NCPL="1"
            ATM_DOMAIN_FILE="domain.lnd.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc"
            LND_DOMAIN_FILE="domain.lnd.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc"
            ICE_DOMAIN_FILE="domain.ocn.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc"
            OCN_DOMAIN_FILE="domain.ocn.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc"
            ATM_DOMAIN_PATH="$CIMEROOT/tools/mapping/gen_domain_files"
            LND_DOMAIN_PATH="$CIMEROOT/tools/mapping/gen_domain_files"
            ICE_DOMAIN_PATH="$CIMEROOT/tools/mapping/gen_domain_files"
            OCN_DOMAIN_PATH="$CIMEROOT/tools/mapping/gen_domain_files"
            DESC="wrf grid"
/>
</config_horiz_grid>

6) Create first case datm, clm, docn, dice

   cd $CIMEROOT/scripts
   ./create_newcase -case pi_nwatl -compset PI_2000 -res nwatl1205_nwatl1205 \
                    -grid_file nwatl_12km5km_grid_file.xml -mach bluefire
   cd pi_nwatl
   ./cesm_setup

   edit user_nl_cpl and add the following line at the end:

vect_map = 'none'

   edit user_nl_clm and add the following lines at the end, being sure to
   replace $CIMEROOT and $YYMMDD with the values of these variables:

fatmlndfrc = '$CIMEROOT/mapping/gen_domain_files/domain.lnd.nwAtl_12km_5m_lnd_nwAtl_12km_5m_ocn.$YYMMDD.nc'
fsurdat = '$CIMEROOT/../components/clm/tools/mksurfdata_map/surfdata_nwAtl_12km_5km_simyr2000_c$YYMMDD.nc'
      
   edit env_run.xml to change the following

<entry id="RUN_STARTDATE"   value="2003-10-01"  />
<entry id="OCN_NCPL"   value="$ATM_NCPL"  />
<entry id="OCN_TIGHT_COUPLING"   value="TRUE"  />
<entry id="CLM_BLDNML_OPTS"   value="-rtm off"  />
<entry id="DOCN_MODE"   value="prescribed"  />
<entry id="SSTICE_STREAM"   value="CAMDATA"  />
<entry id="SSTICE_DATA_FILENAME"   value="$DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_clim_c040926.nc"  /> 
<entry id="SSTICE_GRID_FILENAME"   value="$DIN_LOC_ROOT/atm/cam/ocnfrac/domain.camocn.0.9x1.25_gx1v6_090403.nc"  />
<entry id="SSTICE_YEAR_ALIGN"   value="1"  />
<entry id="SSTICE_YEAR_START"   value="0"  />
<entry id="SSTICE_YEAR_END"   value="0"  />

   ./preview_namelists
   ./pi_nwatl.build
   bsub < pi_nwatl.run

7) Create second case wrf, clm, docn, dice ***

   cd $CIMEROOT/scripts
   ./create_newcase -case pk_nwatl -compset PK_2000 -res nwatl1205_nwatl1205 -grid_file nwatl_12km5km_grid_file.xml -mach bluefire
   ./cesm_setup
   cp user_nl_clm from (5)
   cp user_nl_cpl from (5)
   edit env_run.xml to change the following

<entry id="RUN_STARTDATE"   value="2011-08-23"  />
<entry id="ATM_NCPL"   value="144"  />
<entry id="CLM_BLDNML_OPTS"   value="-rtm off"  />
<entry id="SSTICE_STREAM"   value="CAMDATA"  />
<entry id="SSTICE_DATA_FILENAME"   value="$DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_clim_c040926.nc"  />
<entry id="SSTICE_GRID_FILENAME"   value="$DIN_LOC_ROOT/atm/cam/ocnfrac/domain.camocn.0.9x1.25_gx1v6_090403.nc"  />
<entry id="SSTICE_YEAR_ALIGN"   value="2011"  />
<entry id="SSTICE_YEAR_START"   value="0"  />
<entry id="SSTICE_YEAR_END"   value="0"  /> 

   ./preview_namelists
