[Dart-dev] [5516] DART/branches/development/models/cam/shell_scripts: The DART executables now get copied to the 'EXEROOT' AKA 'rundir'

nancy at ucar.edu nancy at ucar.edu
Wed Jan 18 20:24:07 MST 2012


Revision: 5516
Author:   thoar
Date:     2012-01-18 20:24:07 -0700 (Wed, 18 Jan 2012)
Log Message:
-----------
The DART executables now get copied to the 'EXEROOT' AKA 'rundir'
(not the EXEROOT/run directory) and the assimilate.csh script 
now utilizes them in-situ ... no copying or linking.
The DART input.nml gets staged into the caseroot directory,
alongside the env_run.xml file CESM folks are familiar with modifying.
Just because I could (and I needed to test things) I changed the
CESM_setup_startup.csh in conjunction with the assimilate.csh

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

-------------- 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	2012-01-18 23:19:36 UTC (rev 5515)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh	2012-01-19 03:24:07 UTC (rev 5516)
@@ -56,7 +56,7 @@
 setenv ccsmtag              cesm1_1_beta04
 setenv resolution           f09_f09
 setenv num_instances        4
-setenv reuse_existing_case  false
+setenv reuse_existing_case  true
 
 # ================================
 # define machines and directories
@@ -75,8 +75,8 @@
 setenv cesm_datadir /glade/proj3/cseg/inputdata
 setenv cesm_public  /glade/proj3/cseg
 setenv caseroot     /glade/user/${USER}/cases/${case}
-setenv rundir       /glade/scratch/${USER}/${case}
-setenv archdir      /glade/scratch/${USER}/archive/${case}
+setenv rundir       /ptmp/${USER}/${case}
+setenv archdir      /ptmp/${USER}/archive/${case}
 setenv DARTdir      /glade/home/thoar/svn/DART/dev
 
 setenv ccsmroot     /glade/home/thoar/${ccsmtag}
@@ -321,17 +321,26 @@
 
 cd ${caseroot}
 
-\mv Tools/st_archive.sh Tools/st_archive.sh.org
+if ( ! -e Tools/st_archive.sh.org ) then
+      # save one copy and only one, we can execute this multiple times
+      \mv Tools/st_archive.sh Tools/st_archive.sh.org
+endif
 \cp -f ${DARTdir}/models/cam/shell_scripts/st_archive.sh Tools/st_archive.sh
 # only needed for beta04 - fixed in more recent versions
 \cp -f ${ccsmroot}/scripts/ccsm_utils/Tools/lt_archive.csh Tools/.
 
-\cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.startup.csh assimilate.csh
-\cp -f ${DARTdir}/models/cam/work/input.nml    .
-\cp -f ${DARTdir}/models/cam/work/filter       .
-\cp -f ${DARTdir}/models/cam/work/cam_to_dart  .
-\cp -f ${DARTdir}/models/cam/work/dart_to_cam  .
+\cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.csh .
+\cp -f ${DARTdir}/models/cam/work/input.nml               .
 
+foreach FILE ( filter cam_to_dart dart_to_cam ) 
+   \cp -f ${DARTdir}/models/cam/work/${FILE} ${rundir}/.
+   if ( $status != 0 ) then
+      echo "ERROR: ${DARTdir}/models/cam/work/${FILE} not copied to ${rundir}"
+      echo "ERROR: ${DARTdir}/models/cam/work/${FILE} not copied to ${rundir}"
+      exit 3
+   endif
+end
+
 # ====================================================================
 # Update the scripts that build the namelists.
 # The active components scripts need to support the multi-instance naming.
@@ -448,6 +457,24 @@
 endif
 
 # ====================================================================
+# Edit the run script to reflect project, queue, and wallclock
+# ====================================================================
+
+set PROJ=`grep BSUB $case.$mach.run | grep -e '-P' `
+sed s/$PROJ[3]/$proj/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+set TIMEWALL=`grep BSUB $case.$mach.run | grep -e '-W' `
+sed s/$TIMEWALL[3]/$timewall/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+set QUEUE=`grep BSUB $case.$mach.run | grep -e '-q' `
+sed s/$QUEUE[3]/$queue/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+chmod 0744 $case.$mach.run
+
+# ====================================================================
 # IMPORTANT: All resubmits must be type 'startup'.
 # Change Tools/ccsm_postrun.csh line 83 to CONTINUE_RUN -val FALSE'
 # ====================================================================
@@ -511,24 +538,6 @@
 echo "must stage a ${rundir}/[prior,pos]_inflate_restart.YYYY-MM-DD-SSSSS"
 
 # ====================================================================
-# Edit the run script to reflect project, queue, and wallclock
-# ====================================================================
-
-set PROJ=`grep BSUB $case.$mach.run | grep -e '-P' `
-sed s/$PROJ[3]/$proj/ < $case.$mach.run >! temp
-/bin/mv temp  $case.$mach.run
-
-set TIMEWALL=`grep BSUB $case.$mach.run | grep -e '-W' `
-sed s/$TIMEWALL[3]/$timewall/ < $case.$mach.run >! temp
-/bin/mv temp  $case.$mach.run
-
-set QUEUE=`grep BSUB $case.$mach.run | grep -e '-q' `
-sed s/$QUEUE[3]/$queue/ < $case.$mach.run >! temp
-/bin/mv temp  $case.$mach.run
-
-chmod 0744 $case.$mach.run
-
-# ====================================================================
 # Submit job
 # ====================================================================
 

Modified: DART/branches/development/models/cam/shell_scripts/assimilate.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/assimilate.csh	2012-01-18 23:19:36 UTC (rev 5515)
+++ DART/branches/development/models/cam/shell_scripts/assimilate.csh	2012-01-19 03:24:07 UTC (rev 5516)
@@ -53,7 +53,7 @@
 # of the form "./${CASE}.cam_${ensemble_member}.i.2000-01-06-00000.nc"
 #-------------------------------------------------------------------------
 
-set FILE = `ls -1t ../*.cam_0001.i.* | head -1`
+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#\..*##"`
@@ -76,18 +76,16 @@
 set OBSDIR       = ${BASEOBSDIR}/${DART_OBS_DIR}
 
 #=========================================================================
-# Block 1: Populate a run-time directory with the bits needed to run DART.
+# Block 1: Populate a run-time directory with the input needed to run DART.
 #=========================================================================
 
-foreach FILE ( input.nml filter cam_to_dart dart_to_cam )
-   if (  -e   ${CASEROOT}/${FILE} ) then
-      ${COPY} ${CASEROOT}/${FILE} .
-   else
-      echo "ERROR ... DART required file ${CASEROOT}/${FILE} not found ... ERROR"
-      echo "ERROR ... DART required file ${CASEROOT}/${FILE} not found ... ERROR"
-      exit 1
-   endif
-end
+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
+endif
 
 # Modify the DART input.nml such that
 # the DART ensemble size matches the CESM number of instances
@@ -266,22 +264,26 @@
    # 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 
+   # 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_HISTORY_FILENAME = `printf ../../${MYCASE}.cam_%04d.h0.${MODEL_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}`
 
    ${LINK} $ATM_INITIAL_FILENAME caminput.nc
    ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
+   ${LINK} $DART_IC_FILE         dart_ics
 
-   set DART_IC_FILE = `printf ../filter_ic_old.%04d ${member}`
+   cp ../input.nml .
 
-   sed -e "s#dart_ics#${DART_IC_FILE}#" < ../input.nml >! input.nml
-
    echo "starting cam_to_dart for member ${member} at "`date`
-   ../cam_to_dart >! output.${member}.cam_to_dart &
+   ${EXEROOT}/cam_to_dart >! output.${member}.cam_to_dart &
    echo "finished cam_to_dart for member ${member} at "`date`
 
    cd ..
@@ -322,7 +324,7 @@
 # for geometry information, etc.
 
 set ATM_INITIAL_FILENAME = ../${MYCASE}.cam_0001.i.${MODEL_DATE_EXT}.nc
-set ATM_HISTORY_FILENAME = ../${MYCASE}.cam_0001.h0.${MODEL_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
@@ -335,7 +337,7 @@
 ${LINK} ${OBS_FILE} obs_seq.out
 
 echo "assimilate:starting filter at "`date`
-$LAUNCHCMD ./filter || exit 7
+${LAUNCHCMD} ${EXEROOT}/filter || exit 7
 echo "assimilate:finished filter at "`date`
 
 ${MOVE} Prior_Diag.nc      ../Prior_Diag.${MODEL_DATE_EXT}.nc
@@ -375,11 +377,11 @@
 
    cd member_${member}
 
-   set DART_RESTART_FILE = `printf filter_ic_new.%04d ${member}`
-   ${LINK} ../$DART_RESTART_FILE temp_ic
+   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`
-   ../dart_to_cam >! output.${member}.dart_to_cam &
+   ${EXEROOT}/dart_to_cam >! output.${member}.dart_to_cam &
    echo "finished dart_to_cam for member ${member} at "`date`
 
    cd ..
@@ -395,9 +397,16 @@
    exit 8
 endif
 
-#-------------------------------------------------------------------------
-# Block 4: The cam files have now been updated, move them into position.
-#-------------------------------------------------------------------------
+#=========================================================================
+# 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.
+#
+# IMPORTANT: the DART/models/cam/shell_scripts/st_archive.sh MUST be used
+# instead of the CESM st_archive.sh script.
+#=========================================================================
 
 set member = 1
 while ( ${member} <= ${ensemble_size} )
@@ -407,21 +416,14 @@
    set LND_POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
    set ICE_POINTER_FILENAME = `printf rpointer.ice_%04d ${member}`
 
-   set LND_RESTART_FILENAME = `head -1 ../../${LND_POINTER_FILENAME}`
-   set ICE_RESTART_FILENAME = `head -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.${MODEL_DATE_EXT}.nc ${member}`
 
-   # As implemented, the input filenames are static in the namelists.
-   # In order to archive the 'dynamic' files (i.e. with the dates) 
-   # and restage the 'static' files, we must copy the updated files 
-   # to the static names.
-   #
-   # IMPORTANT: The Tools/st_archive.sh script must be substantially modified.
+   ${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
 
-   ${MOVE} ../../$LND_RESTART_FILENAME ../../clm_restart_${member}.nc
-   ${MOVE} ../../$ICE_RESTART_FILENAME ../../ice_restart_${member}.nc
-   ${MOVE} ../../$ATM_INITIAL_FILENAME ../../cam_initial_${member}.nc
-
    cd ..
 
    @ member++


More information about the Dart-dev mailing list