[Dart-dev] [5981] DART/branches/development/models/cam: This configuration runs a CESM1_1_1 F_AMIP_CAM5 compset on yellowstone using some

nancy at ucar.edu nancy at ucar.edu
Thu Feb 28 21:51:09 MST 2013


Revision: 5981
Author:   thoar
Date:     2013-02-28 21:51:07 -0700 (Thu, 28 Feb 2013)
Log Message:
-----------
This configuration runs a CESM1_1_1 F_AMIP_CAM5 compset on yellowstone using some 
of Kevin's ccsm 4 restart files for October 2008 generated on bluefire.
There are a lot of customizations to make it work for 2008 since the default 
datasets extend through 2005.

The configuration has not been tested for cycling. Need to ensure the RUN_STARTDATE
and START_TOD in the env_run.xml are sufficient - and that the CONTINUE_RUN = FALSE
is enough.

The short-term archiver has not been tested.

Not sure if there are not efficiencies to be had by using some SourceMods to inhibit
CAM (and other model components) from writing unneccesary files.

Not sure if we can turn the River Runoff model (ROF) off (bug listed in CESM1_1_1 for
some/all F compsets).

Not sure how many ICE instances we need - can we get by with 1?

But - since this was such a pain to get to this point - it needed to be committed for safekeeping.

Modified Paths:
--------------
    DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh
    DART/branches/development/models/cam/shell_scripts/assimilate.csh
    DART/branches/development/models/cam/work/input.nml

-------------- next part --------------
Modified: DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh	2013-02-28 19:14:33 UTC (rev 5980)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh	2013-03-01 04:51:07 UTC (rev 5981)
@@ -80,7 +80,7 @@
 #    script names; so consider it's length and information content.
 # num_instances:  Number of ensemble members
 
-setenv case                 cam_test_1
+setenv case                 cam_test
 setenv compset              F_AMIP_CAM5
 setenv cesmtag              cesm1_1_1
 setenv resolution           f09_f09
@@ -116,18 +116,14 @@
 setenv DARTroot     /glade/u/home/${USER}/svn/DART/dev
 
 # ==============================================================================
-# configure settings
+# configure settings ... run_startdate format is yyyy-mm-dd
 # ==============================================================================
-# yyyy-mm-dd
+#
 setenv run_startdate 2008-10-31
-
-setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2008_c100127.nc
+setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
 setenv year_start  1850
 setenv year_end    2010
 
-# TJH FIXME ... the sst_dataset above does not appear in that directory._CAM5
-# Try this:  ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
-
 # ==============================================================================
 # runtime settings --  How many assimilation steps will be done after this one
 #
@@ -314,8 +310,8 @@
 
 # level of debug output, 0=minimum, 1=normal, 2=more, 3=too much, valid values: 0,1,2,3 (integer)
 
-./xmlchange DEBUG=TRUE
-./xmlchange INFO_DBUG=2
+./xmlchange DEBUG=FALSE
+./xmlchange INFO_DBUG=0
 
 # ==============================================================================
 # Set up the case.
@@ -352,23 +348,26 @@
    # ===========================================================================
    # A lot of the files specified here are because the 'default' files only
    # contain data through 2005 and we are interested in timeframes after that.
+   #
+   # CAM5 does prognostic aerosols by default. If you want to prescribe them,
+   # use the following variables with your own settings ...
+#  echo " aerodep_flx_datapath  = '${chem_datapath}/aero' "                                      >> ${fname}
+#  echo " aerodep_flx_file      = 'aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc' "    >> ${fname}
+#  echo " aerodep_flx_cycle_yr  = 2000 "                                                         >> ${fname}
+#  echo " aerodep_flx_type      = 'CYCLICAL' "                                                   >> ${fname}
 
+   # This killed CAM5 ... but may work for some other compset
 #  echo " iradae               = -$stop_n "                                                      >> ${fname}
 
    echo " inithist = 'ENDOFRUN' "                                                                >> ${fname}
    echo " ncdata = 'cam_initial_${instance}.nc' "                                                >> ${fname}
-   echo " avgflag_pertape      = 'A','A' "                                                       >> ${fname}
+   echo " avgflag_pertape      = 'A' "                                                           >> ${fname}
    echo " div24del2flag        = 4 "                                                             >> ${fname}
    echo " empty_htapes         = .true. "                                                        >> ${fname}
    echo " fincl1               = 'PHIS:I' "                                                      >> ${fname}
-   echo " fincl2               = 'PS', 'Z3', 'T', 'U', 'V', 'FLNT', 'PSL', 'OMEGA' "             >> ${fname}
-   echo " nhtfrq               = -$stop_n,-1 "                                                   >> ${fname}
-   echo " mfilt                = 1,1 "                                                           >> ${fname}
+   echo " nhtfrq               = -$stop_n "                                                      >> ${fname}
+   echo " mfilt                = 1 "                                                             >> ${fname}
 
-   echo " aerodep_flx_datapath  = '${chem_datapath}/aero' "                                      >> ${fname}
-   echo " aerodep_flx_file      = 'aerosoldep_monthly_1849-2006_1.9x2.5_c090803.nc' "            >> ${fname}
-   echo " aerodep_flx_cycle_yr  = 2000 "                                                         >> ${fname}
-   echo " aerodep_flx_type      = 'CYCLICAL' "                                                   >> ${fname}
    echo " bndtvghg              = '${cesm_datadir}/atm/cam/ggas/ghg_hist_1765-2009_c100902.nc' " >> ${fname}
    echo " prescribed_ozone_file = 'ozone_1.9x2.5_L26_1850-2015_rcp45_c101108.nc' "               >> ${fname}
    echo " tracer_cnst_file      = 'oxid_1.9x2.5_L26_1850-2015_rcp45_c101108.nc' "                >> ${fname}
@@ -399,13 +398,11 @@
    # ===========================================================================
    set fname = "user_nl_clm_$instance"
    # ===========================================================================
-   # faerdep does not make its way to the final namelist in the F_AMIP_CAM5 case:
 
-#  echo "faerdep  = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc' " >> ${fname}
    echo "hist_empty_htapes = .true. "                       >> ${fname}
    echo "finidat           = 'clm_restart_${instance}.nc' " >> ${fname}
+   echo "fpftdyn = '${cesm_datadir}/lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp4.5_simyr1850-2100_c100406.nc' " >> ${fname}
 
-
    # ===========================================================================
    set fname = "user_nl_cice_$instance"
    # ===========================================================================
@@ -500,11 +497,15 @@
 # ==============================================================================
 
 echo ''
-echo 'Changing Tools/ccsm_postrun.csh such that all the resubmits are "startup",'
-echo 'which means CONTINUE_RUN should be FALSE in ccsm_postrun.csh'
+echo 'Changing Tools/ccsm_postrun_setup	such that all the resubmits are "startup",'
+echo 'which means CONTINUE_RUN should be FALSE in ccsm_postrun_setup'
 echo ''
 
-ex Tools/ccsm_postrun.csh <<ex_end
+if ( ~ -e  Tools/cesm_postrun_setup.original ) then
+   ${COPY} Tools/cesm_postrun_setup Tools/cesm_postrun_setup.original
+endif
+
+ex Tools/cesm_postrun_setup <<ex_end
 /use COMP_RUN_BARRIERS as surrogate for timing run logical/
 /CONTINUE_RUN/
 s;TRUE;FALSE;
@@ -519,7 +520,9 @@
 echo 'Updating the run script to set wallclock and queue.'
 echo ''
 
-${COPY} ${case}.run ${case}.run.orig
+if ( ~ -e  ${case}.run.original ) then
+   ${COPY} ${case}.run ${case}.run.original
+endif
 
 source Tools/ccsm_getenv
 set BATCH = `echo $BATCHSUBMIT | sed 's/ .*$//'`
@@ -625,10 +628,8 @@
 # provide the lt_archive.sh script, and the one in the repos
 # did not have the -p flag, which is a good idea. So, for now ...
 
-if ( ~ -e  Tools/st_archive.sh.orig ) then
-   ${COPY} Tools/st_archive.sh      Tools/st_archive.sh.orig
-else
-   echo "a Tools/st_archive.sh backup copy already exists"
+if ( ~ -e  Tools/st_archive.sh.original ) then
+   ${COPY} Tools/st_archive.sh Tools/st_archive.sh.original
 endif
 
 # ${COPY} ${DARTroot}/models/cam/shell_scripts/st_archive.sh  Tools/
@@ -650,35 +651,36 @@
 end
 
 # This script will copy an existing prior_inflate_restart to the run dir if found.
-if (-f ${stagedir}/DART/prior_inflate_restart) then
-   ${COPY} ${stagedir}/DART/prior_inflate_restart ${exeroot}/run/prior_inflate_restart.${run_startdate}-00000
-   echo ''
-   echo "${stagedir}/DART/prior_inflate_restart has been copied to "
-   echo "${exeroot}/run/prior_inflate_restart.${run_startdate}-00000"
-   echo 'If that has the wrong state vector, you will need to replace it before running.'
-   echo ''
-else
-   echo ''
-   echo 'If using inflation in DART you may need to copy an inflation restart file'
-   echo "to ${exeroot}/run/prior_inflate_restart.${run_startdate}-00000"
-   echo 'before running.  It must include the exact fields as your DART state vector.'
-   echo "You can make one with ${DARTroot}/models/cam/work/fill_inflation_restart"
-   echo ''
-endif
-
-
+# TJH FIXME and overwrite the one from the original stagedir!!!!!
+# if (-f ${stagedir}/DART/prior_inflate_restart) then
+#    ${COPY} ${stagedir}/DART/prior_inflate_restart ${rundir}/prior_inflate_restart.${run_startdate}-00000
+#    echo ''
+#    echo "${stagedir}/DART/prior_inflate_restart has been copied to "
+#    echo "${rundir}/prior_inflate_restart.${run_startdate}-00000"
+#    echo 'If that has the wrong state vector, you will need to replace it before running.'
+#    echo ''
+# else
+#    echo ''
+#    echo 'If using inflation in DART you may need to copy an inflation restart file'
+#    echo "to ${rundir}/prior_inflate_restart.${run_startdate}-00000"
+#    echo 'before running.  It must include the exact fields as your DART state vector.'
+#    echo "You can make one with ${DARTroot}/models/cam/work/fill_inflation_restart"
+#    echo ''
+# endif
+# 
+# 
 # only warn people if a precomputed final_full for this number of instances
 # does not already exist.
-if (! -f ${DARTroot}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}) then
-   echo ''
-   echo 'If you are using the DART sampling error correction feature'
-   echo 'the assimilate.csh script will expect to copy this file:'
-   echo "${DARTroot}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}"
-   echo 'and it does not exist for your number of ensemble members.'
-   echo "Generate one by building and running ${DARTroot}/system_simulation/work/full_error"
-   echo 'with the namelist set to your ensemble size.'
-   echo ''
-endif
+# if (! -f ${DARTroot}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}) then
+#    echo ''
+#    echo 'If you are using the DART sampling error correction feature'
+#    echo 'the assimilate.csh script will expect to copy this file:'
+#    echo "${DARTroot}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}"
+#    echo 'and it does not exist for your number of ensemble members.'
+#    echo "Generate one by building and running ${DARTroot}/system_simulation/work/full_error"
+#    echo 'with the namelist set to your ensemble size.'
+#    echo ''
+# endif
 
 # ==============================================================================
 # What to do next

Modified: DART/branches/development/models/cam/shell_scripts/assimilate.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/assimilate.csh	2013-02-28 19:14:33 UTC (rev 5980)
+++ DART/branches/development/models/cam/shell_scripts/assimilate.csh	2013-03-01 04:51:07 UTC (rev 5981)
@@ -1,4 +1,4 @@
-#!/bin/csh -f
+#!/bin/csh
 #
 # DART software - Copyright 2004 - 2011 UCAR. This open source software is
 # provided by UCAR, "as is", without charge, subject to all terms of use at
@@ -6,11 +6,11 @@
 #
 # $Id$
 
-# This block is an attempt to localize all the machine-specific 
+# This block is an attempt to localize all the machine-specific
 # changes to this script such that the same script can be used
 # on multiple platforms. This will help us maintain the script.
 
-echo "starting assimilate script at "`date`
+echo "`date` -- BEGIN ASSIMILATE"
 
 switch ("`hostname`")
    case be*:
@@ -25,8 +25,22 @@
       set BASEOBSDIR = /glade/proj3/image/Observations/ACARS
       set DARTDIR    = ${HOME}/svn/DART/dev
       set LAUNCHCMD  = mpirun.lsf
+   breaksw
 
+   case ys*:
+      # NCAR "yellowstone"
+      # The FORCE options are not optional.
+      # the VERBOSE options are useful for debugging.
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /glade/p/image/Observations/ACARS
+      set DARTDIR    = ${HOME}/svn/DART/dev
+      set LAUNCHCMD  = mpirun.lsf
    breaksw
+
    default:
       # NERSC "hopper"
       set   MOVE = 'mv -fv'
@@ -38,7 +52,7 @@
       set DARTDIR    = ${HOME}/devel
       set LAUNCHCMD  = "aprun -n $NTASKS"
    breaksw
-endsw 
+endsw
 
 set ensemble_size = ${NINST_ATM}
 
@@ -51,40 +65,55 @@
 #-------------------------------------------------------------------------
 # Determine time of model state ... from file name of first member
 # of the form "./${CASE}.cam_${ensemble_member}.i.2000-01-06-00000.nc"
+#
+# Piping stuff through 'bc' strips off any preceeding zeros.
 #-------------------------------------------------------------------------
 
 set FILE = `ls -1t ../*.cam_0001.i.* | head -n 1`
 set FILE = $FILE:t
 set FILE = $FILE:r
 set MYCASE = `echo $FILE | sed -e "s#\..*##"`
-set MODEL_DATE_EXT = `echo $FILE:e`
-set MODEL_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
-set MODEL_YEAR     = $MODEL_DATE[1]
-set MODEL_MONTH    = $MODEL_DATE[2]
-set MODEL_DAY      = $MODEL_DATE[3]
-set MODEL_SECONDS  = $MODEL_DATE[4]
-set MODEL_HOUR     = `echo $MODEL_DATE[4] / 3600 | bc`
+set ATM_DATE_EXT = `echo $FILE:e`
+set ATM_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
+set ATM_YEAR     = `echo $ATM_DATE[1] | bc`
+set ATM_MONTH    = `echo $ATM_DATE[2] | bc`
+set ATM_DAY      = `echo $ATM_DATE[3] | bc`
+set ATM_SECONDS  = `echo $ATM_DATE[4] | bc`
+set ATM_HOUR     = `echo $ATM_DATE[4] / 3600 | bc`
 
-echo "valid time of model is $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_SECONDS (seconds)"
-echo "valid time of model is $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_HOUR (hours)"
+echo "valid time of model is $ATM_YEAR $ATM_MONTH $ATM_DAY $ATM_SECONDS (seconds)"
+echo "valid time of model is $ATM_YEAR $ATM_MONTH $ATM_DAY $ATM_HOUR (hours)"
 
 #-----------------------------------------------------------------------------
-# Set variables containing various directory names where we will GET things
+# Get observation sequence file ... or die right away.
+# Cannot specify -f on the link command and still check status.
+# The observation file names have a time that matches the stopping time of CAM.
 #-----------------------------------------------------------------------------
 
-set DART_OBS_DIR = ${MODEL_YEAR}${MODEL_MONTH}_6H
-set OBSDIR       = ${BASEOBSDIR}/${DART_OBS_DIR}
+set YYYYMM   = `printf %04d%02d ${ATM_YEAR} ${ATM_MONTH}`
+set OBSFNAME = `printf obs_seq.%04d-%02d-%02d-%05d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_SECONDS}`
+set OBS_FILE = ${BASEOBSDIR}/${YYYYMM}_6H/${OBSFNAME}
 
+if (  -e   ${OBS_FILE} ) then
+   ${LINK} ${OBS_FILE} obs_seq.out
+else
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... no observation file $OBS_FILE"
+   exit -1
+endif
+
 #=========================================================================
 # Block 1: Populate a run-time directory with the input needed to run DART.
 #=========================================================================
 
+echo "`date` -- BEGIN COPY BLOCK"
+
 if (  -e   ${CASEROOT}/input.nml ) then
    ${COPY} ${CASEROOT}/input.nml .
 else
-   echo "ERROR ... DART required file ${CASEROOT}/${FILE} not found ... ERROR"
-   echo "ERROR ... DART required file ${CASEROOT}/${FILE} not found ... ERROR"
-   exit 1
+   echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
+   echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
+   exit -2
 endif
 
 # Modify the DART input.nml such that
@@ -98,10 +127,14 @@
 wq
 ex_end
 
+echo "`date` -- END COPY BLOCK"
+
 #=========================================================================
 # Block 2: Stage the files needed for SAMPLING ERROR CORRECTION
 #
-# Each ensemble size has its own (static) file which does not need to be archived.
+# The sampling error correction is a lookup table.
+# The tables are stored in the DART distribution.
+# Each ensemble size has its own (static) file.
 # It is only needed if
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
 #=========================================================================
@@ -109,7 +142,7 @@
 set  MYSTRING = `grep sampling_error_correction input.nml`
 set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-set SECSTRING = `echo $MYSTRING[2] | tr 'A-Z' 'a-z'`
+set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
 
 if ( $SECSTRING == true ) then
    set SAMP_ERR_FILE = ${DARTDIR}/system_simulation/final_full_precomputed_tables/final_full.${ensemble_size}
@@ -118,7 +151,7 @@
    else
       echo "ERROR: no sampling error correction file for this ensemble size."
       echo "ERROR: looking for ${SAMP_ERR_FILE}"
-      exit 2
+      exit -3
    endif
 else
    echo "Sampling Error Correction not requested for this assimilation."
@@ -160,31 +193,31 @@
 #=========================================================================
 
 set  MYSTRING = `grep inf_flavor input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,]# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  PRIOR_INF = $MYSTRING[2]
 set  POSTE_INF = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_initial_from_restart input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,]# #g"`
-set  PRIOR_TF = `echo $MYSTRING[2] | tr [A-Z] [a-z]`
-set  POSTE_TF = `echo $MYSTRING[3] | tr [A-Z] [a-z]`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+set  PRIOR_TF = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+set  POSTE_TF = `echo $MYSTRING[3] | tr '[:upper:]' '[:lower:]'`
 
 # its a little tricky to remove both styles of quotes from the string.
 
 set  MYSTRING = `grep inf_in_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_IFNAME = $MYSTRING[2]
 set  POSTE_INF_IFNAME = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_out_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_OFNAME = $MYSTRING[2]
 set  POSTE_INF_OFNAME = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_diag_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_DIAG = $MYSTRING[2]
 set  POSTE_INF_DIAG = $MYSTRING[3]
@@ -193,98 +226,100 @@
 
 if ( $PRIOR_INF > 0 ) then
 
-   if ($PRIOR_TF == ".false.") then
-      echo "ERROR: inf_flavor(1) = $PRIOR_INF, yet inf_initial_from_restart = $PRIOR_TF"
-      echo "ERROR: fix input.nml to reflect whether you want prior inflation or not."
-      exit 3
-   endif
+   if ($PRIOR_TF == false) then
+      echo "inf_flavor(1) = $PRIOR_INF, using namelist values."
+   else
+      # Look for the output from the previous assimilation
+      (ls -rt1 ../${PRIOR_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
+      set nfiles = `cat latestfile | wc -l`
 
-   # Look for the output from the previous assimilation
-   (ls -rt1 ../${PRIOR_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
-   set nfiles = `cat latestfile | wc -l`
+      # If one exists, use it as input for this assimilation
+      if ( $nfiles > 0 ) then
+         set latest = `cat latestfile`
+         ${LINK} $latest ${PRIOR_INF_IFNAME}
+      else
+         echo "ERROR: Requested PRIOR inflation but specified no incoming inflation file."
+         echo "ERROR: expected something like ../${PRIOR_INF_OFNAME}.YYYY-MM-DD-SSSSS"
+         exit -4
+      endif
 
-   # If one exists, use it as input for this assimilation
-   if ( $nfiles > 0 ) then
-      set latest = `cat latestfile`
-      ${LINK} $latest ${PRIOR_INF_IFNAME}
-   else
-      echo "ERROR: Requested prior inflation but specified no incoming prior inflation file."
-      echo "ERROR: expected something like ../${PRIOR_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-      exit 4
    endif
 else
-   echo "Prior Inflation not requested for this assimilation."
+   echo "Prior Inflation           not requested for this assimilation."
 endif
 
 # POSTERIOR: We look for the 'newest' and use it - IFF we need it.
 
 if ( $POSTE_INF > 0 ) then
 
-   if ($POSTE_TF == ".false.") then
-      echo "ERROR: inf_flavor(2) = $POSTE_INF, yet inf_initial_from_restart = $POSTE_TF"
-      echo "ERROR: fix input.nml to reflect whether you want posterior inflation or not."
-      exit 5
-   endif
+   if ($POSTE_TF == false) then
+      echo "inf_flavor(2) = $POSTE_INF, using namelist values."
+   else
 
-   # Look for the output from the previous assimilation
-   (ls -rt1 ../${POSTE_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
-   set nfiles = `cat latestfile | wc -l`
+      # Look for the output from the previous assimilation
+      (ls -rt1 ../${POSTE_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
+      set nfiles = `cat latestfile | wc -l`
 
-   # If one exists, use it as input for this assimilation
-   if ( $nfiles > 0 ) then
-      set latest = `cat latestfile`
-      ${LINK} $latest ${POSTE_INF_IFNAME}
-   else
-      echo "ERROR: Requested POSTERIOR inflation but specified no incoming POSTERIOR inflation file."
-      echo "ERROR: expected something like ../${POSTE_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-      exit 6
+      # If one exists, use it as input for this assimilation
+      if ( $nfiles > 0 ) then
+         set latest = `cat latestfile`
+         ${LINK} $latest ${POSTE_INF_IFNAME}
+      else
+         echo "ERROR: Requested POSTERIOR inflation but specified no incoming inflation file."
+         echo "ERROR: expected something like ../${POSTE_INF_OFNAME}.YYYY-MM-DD-SSSSS"
+         exit -5
+      endif
    endif
 else
-   echo "Posterior Inflation not requested for this assimilation."
+   echo "Posterior Inflation       not requested for this assimilation."
 endif
 
 #=========================================================================
-#
-# Block 4: Convert CAM restart files to DART initial condition files.
+# Block 4: Convert N CAM restart files to DART initial condition files.
 # cam_to_dart is serial code, we can do all of these at the same time
-# as long as we can have unique namelists for all of them.
+# as long as we can have unique namelists for each of them.
 #
-# DART namelist settings appropriate/required:
-# &filter_nml:           restart_in_file_name    = 'filter_ic_old'
+# At the end of the block, we have DART initial condition files  filter_ics.[1-N]
+# that came from pointer files ../rpointer.atm.[1-N].restart
+#
+# REQUIRED DART namelist settings:
+# &filter_nml:           restart_in_file_name    = 'filter_ics'
+#                        restart_out_file_name   = 'filter_restart'
 # &ensemble_manager_nml: single_restart_file_in  = '.false.'
 # &cam_to_dart_nml:      cam_to_dart_output_file = 'dart_ics',
-#
+# &dart_to_cam_nml:      dart_to_cam_input_file  = 'dart_restart',
+#                        advance_time_present    = .false.
 #=========================================================================
 
+echo "`date` -- BEGIN CAM TO DART"
+
 set member = 1
 while ( ${member} <= ${ensemble_size} )
 
    # Each member will do its job in its own directory.
    # That way, we can do N of them simultaneously -
-   # they all read their OWN 'input.nml' ... the output
-   # filenames must inserted into the appropriate input.nml
 
-   # Turns out the .h0. files are timestamped with the START of the 
-   # run, which is *not* MODEL_DATE_EXT ...  I just link to a whatever 
+   # Turns out the .h0. files are timestamped with the START of the
+   # run, which is *not* ATM_DATE_EXT ...  I just link to a whatever
    # is convenient (since the info is static).
 
    set MYTEMPDIR = member_${member}
    mkdir -p $MYTEMPDIR
    cd $MYTEMPDIR
 
-   set ATM_INITIAL_FILENAME = `printf ../../${MYCASE}.cam_%04d.i.${MODEL_DATE_EXT}.nc ${member}`
+   set ATM_INITIAL_FILENAME = `printf ../../${MYCASE}.cam_%04d.i.${ATM_DATE_EXT}.nc ${member}`
    set ATM_HISTORY_FILENAME = `ls -1t ../../${MYCASE}.cam*.h0.* | head -n 1`
-   set DART_IC_FILE = `printf ../filter_ic_old.%04d ${member}`
+   set     DART_IC_FILENAME = `printf filter_ics.%04d     ${member}`
+   set    DART_RESTART_FILE = `printf filter_restart.%04d ${member}`
 
+   sed -e "s/dart_ics/..\/${DART_IC_FILENAME}/" \
+       -e "s/dart_restart/..\/${DART_RESTART_FILE}/" < ../input.nml >! input.nml
+
    ${LINK} $ATM_INITIAL_FILENAME caminput.nc
    ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
-   ${LINK} $DART_IC_FILE         dart_ics
 
-   cp ../input.nml .
-
    echo "starting cam_to_dart for member ${member} at "`date`
    ${EXEROOT}/cam_to_dart >! output.${member}.cam_to_dart &
-   echo "finished cam_to_dart for member ${member} at "`date`
 
    cd ..
 
@@ -296,9 +331,11 @@
 if ($status != 0) then
    echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
    echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
-   exit 7
+   exit -6
 endif
 
+echo "`date` -- END CAM-TO-DART for all ${ensemble_size} members."
+
 #=========================================================================
 # Block 5: Actually run the assimilation.
 # Will result in a set of files : 'filter_restart.xxxx'
@@ -306,8 +343,8 @@
 # DART namelist settings required:
 # &filter_nml:           async                  = 0,
 # &filter_nml:           adv_ens_command        = "./no_model_advance.csh",
-# &filter_nml:           restart_in_file_name   = 'filter_ic_old'
-# &filter_nml:           restart_out_file_name  = 'filter_ic_new'
+# &filter_nml:           restart_in_file_name   = 'filter_ics'
+# &filter_nml:           restart_out_file_name  = 'filter_restart'
 # &filter_nml:           obs_sequence_in_name   = 'obs_seq.out'
 # &filter_nml:           obs_sequence_out_name  = 'obs_seq.final'
 # &filter_nml:           init_time_days         = -1,
@@ -323,27 +360,33 @@
 # CAM:static_init_model() always needs a caminput.nc and a cam_phis.nc
 # for geometry information, etc.
 
-set ATM_INITIAL_FILENAME = ../${MYCASE}.cam_0001.i.${MODEL_DATE_EXT}.nc
+set ATM_INITIAL_FILENAME = ../${MYCASE}.cam_0001.i.${ATM_DATE_EXT}.nc
 set ATM_HISTORY_FILENAME = `ls -1t ../${MYCASE}.cam*.h0.* | head -n 1`
 
 ${LINK} $ATM_INITIAL_FILENAME caminput.nc
 ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
 
-# Determine proper observation sequence file.
+# On yellowstone, you can explore task layouts with the following:
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv ORIGINAL_LAYOUT "${LSB_PJL_TASK_GEOMETRY}"
 
-set OBSFNAME = `printf obs_seq${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY}%02d ${MODEL_HOUR}`
-set OBS_FILE = ${OBSDIR}/${OBSFNAME}
+   # setenv NANCY_GEOMETRY_54_1NODE \
+   #    "{(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)}";
+   # setenv LSB_PJL_TASK_GEOMETRY "${NANCY_GEOMETRY_54_1NODE}"
+endif
 
-${LINK} ${OBS_FILE} obs_seq.out
+echo "`date` -- BEGIN FILTER"
+${LAUNCHCMD} ${EXEROOT}/filter || exit -7
+echo "`date` -- END FILTER"
 
-echo "assimilate:starting filter at "`date`
-${LAUNCHCMD} ${EXEROOT}/filter || exit 7
-echo "assimilate:finished filter at "`date`
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv LSB_PJL_TASK_GEOMETRY "${ORIGINAL_LAYOUT}"
+endif
 
-${MOVE} Prior_Diag.nc      ../Prior_Diag.${MODEL_DATE_EXT}.nc
-${MOVE} Posterior_Diag.nc  ../Posterior_Diag.${MODEL_DATE_EXT}.nc
-${MOVE} obs_seq.final      ../obs_seq.${MODEL_DATE_EXT}.final
-${MOVE} dart_log.out       ../dart_log.${MODEL_DATE_EXT}.out
+${MOVE} Prior_Diag.nc      ../Prior_Diag.${ATM_DATE_EXT}.nc
+${MOVE} Posterior_Diag.nc  ../Posterior_Diag.${ATM_DATE_EXT}.nc
+${MOVE} obs_seq.final      ../obs_seq.${ATM_DATE_EXT}.final
+${MOVE} dart_log.out       ../dart_log.${ATM_DATE_EXT}.out
 
 # Accomodate any possible inflation files
 # 1) rename file to reflect current date
@@ -352,37 +395,27 @@
 
 foreach FILE ( ${PRIOR_INF_OFNAME} ${POSTE_INF_OFNAME} ${PRIOR_INF_DIAG} ${POSTE_INF_DIAG} )
    if ( -e ${FILE} ) then
-      ${MOVE} ${FILE} ../${FILE}.${MODEL_DATE_EXT}
+      ${MOVE} ${FILE} ../${FILE}.${ATM_DATE_EXT}
    else
-      echo "No ${FILE} for ${MODEL_DATE_EXT}"
+      echo "No ${FILE} for ${ATM_DATE_EXT}"
    endif
 end
 
 #=========================================================================
-# Block 6: Update the cam restart files. 
+# Block 6: Update the cam restart files ... simultaneously ...
 #
-# DART namelist settings required:
-# &filter_nml:           restart_out_file_name  = 'filter_ic_new'
-# &ensemble_manager_nml: single_restart_file_in = '.false.'
-# &dart_to_cam_nml:      dart_to_cam_input_file = 'temp_ic',
-# &dart_to_cam_nml:      advance_time_present   = .false.
-# &atm_in_xxxx:ncdata = 'cam_initial_x.nc'
+# Each member will do its job in its own directory, which already exists
+# and has the required input files remaining from 'Block 4'
 #=========================================================================
 
+echo "`date` -- BEGIN DART TO CAM"
 set member = 1
-while ( ${member} <= ${ensemble_size} )
+while ( $member <= $ensemble_size )
 
-   # Each member will do its job in its own directory, which already exists
-   # and has the required input files remaining from 'Block 4'
-
    cd member_${member}
 
-   set DART_RESTART_FILE = `printf ../filter_ic_new.%04d ${member}`
-   ${LINK} $DART_RESTART_FILE temp_ic
-
    echo "starting dart_to_cam for member ${member} at "`date`
    ${EXEROOT}/dart_to_cam >! output.${member}.dart_to_cam &
-   echo "finished dart_to_cam for member ${member} at "`date`
 
    cd ..
 
@@ -394,56 +427,64 @@
 if ($status != 0) then
    echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
    echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
-   exit 8
+   exit -8
 endif
 
+echo "`date` -- END DART TO CAM for all ${ensemble_size} members."
+
 #=========================================================================
 # Block 7: The cam files have now been updated, move them into position.
 #
 # As implemented, the input filenames are static in the CESM namelists.
 # Since the short-term archiver creates unique directories for these,
-# it is OK to move the uniquely-named files to static names.
+# we must link the uniquely-named files to static names. When the short-term
+# archiver 'restores' the CESM files, the links will still be valid.
 #
 # IMPORTANT: the DART/models/cam/shell_scripts/st_archive.sh MUST be used
 # instead of the CESM st_archive.sh script.
 #=========================================================================
 
+cd ${RUNDIR}
+
 set member = 1
 while ( ${member} <= ${ensemble_size} )
 
-   cd member_${member}
+   set n4 = `printf %04d $member`
 
    set LND_POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
    set ICE_POINTER_FILENAME = `printf rpointer.ice_%04d ${member}`
+   # the ATM pointer file points to a restart file - which we cannot use
 
-   set LND_RESTART_FILENAME = `head -n 1 ../../${LND_POINTER_FILENAME}`
-   set ICE_RESTART_FILENAME = `head -n 1 ../../${ICE_POINTER_FILENAME}`
-   set ATM_INITIAL_FILENAME = `printf ${MYCASE}.cam_%04d.i.${MODEL_DATE_EXT}.nc ${member}`
+   set LND_RESTART_FILENAME = `head -n 1 ${LND_POINTER_FILENAME}`
+   set ICE_RESTART_FILENAME = `head -n 1 ${ICE_POINTER_FILENAME}`
+   set ATM_INITIAL_FILENAME = `printf ${MYCASE}.cam_%04d.i.${ATM_DATE_EXT}.nc ${member}`
 
-   ${MOVE} ../../$LND_RESTART_FILENAME ../../clm_restart_${member}.nc || exit 9
-   ${MOVE} ../../$ICE_RESTART_FILENAME ../../ice_restart_${member}.nc || exit 9
-   ${MOVE} ../../$ATM_INITIAL_FILENAME ../../cam_initial_${member}.nc || exit 9
+   ${LINK} ${LND_RESTART_FILENAME} clm_restart_${n4}.nc || exit -9
+   ${LINK} ${ICE_RESTART_FILENAME} ice_restart_${n4}.nc || exit -9
+   ${LINK} ${ATM_INITIAL_FILENAME} cam_initial_${n4}.nc || exit -9
 
-   cd ..
+   @ member++
 
-   @ member++
 end
 
 #-------------------------------------------------------------------------
-# Now that everything is staged, we have to communicate the current
-# model time to the drv_in&seq_timemgr_inparm namelist
-# which is built from CASEROOT/user_nl_drv by the *.run script
+# We have to communicate the current model time to the env_run.xml script
 #-------------------------------------------------------------------------
 
-ex ${CASEROOT}/Buildconf/cpl.buildnml.csh << ex_end
-g; start_ymd;s;=[ ]*.*;= ${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY};
-g; start_tod;s;=[ ]*.*;= $MODEL_SECONDS;
-wq
-ex_end
+cd ${CASEROOT}
 
+set YYYYMMDD = `printf %04d-%02d-%02d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY}`
+set    SSSSS = `printf %05d ${ATM_SECONDS}`
+
+./xmlchange RUN_STARTDATE=${YYYYMMDD}
+./xmlchange START_TOD=${SSSSS}
+
+cd ${RUNDIR}
+
 # we (DART) do not need these files, and CESM does not need them either
 # to continue a run.  if we remove them here they do not get moved to
 # the short-term archiver.
+
 ${REMOVE} ../*.rs.*
 ${REMOVE} ../*.rh0.*
 ${REMOVE} ../*.rs1.*
@@ -453,6 +494,7 @@
 # Cleanup
 #-------------------------------------------------------------------------
 echo "finished assimilate script at "`date`
+echo "`date` -- END ASSIMILATE"
 
 exit 0
 

Modified: DART/branches/development/models/cam/work/input.nml
===================================================================
--- DART/branches/development/models/cam/work/input.nml	2013-02-28 19:14:33 UTC (rev 5980)
+++ DART/branches/development/models/cam/work/input.nml	2013-03-01 04:51:07 UTC (rev 5981)
@@ -6,8 +6,8 @@
    output_restart           = .true.,
    obs_sequence_in_name     = "obs_seq.out",
    obs_sequence_out_name    = "obs_seq.final",
-   restart_in_file_name     = "filter_ic_old",
-   restart_out_file_name    = "filter_ic_new", 
+   restart_in_file_name     = "filter_ics",
+   restart_out_file_name    = "filter_restart", 
    init_time_days           = -1,
    init_time_seconds        = -1,
    first_obs_days           = -1,
@@ -98,9 +98,9 @@
    /
 
 &dart_to_cam_nml
-  dart_to_cam_input_file  = 'temp_ic',
+  dart_to_cam_input_file  = 'dart_restart',
   dart_to_cam_output_file = 'caminput.nc',
-  advance_time_present    = .true.,
+  advance_time_present    = .false.,
    /
 
 # common setups:


More information about the Dart-dev mailing list