[Dart-dev] [5954] DART/branches/development/models/POP/shell_scripts/ CESM1_1_setup_hybrid.csh: This runs to completion for the first submission (no resubmit) with some sourcemods that

nancy at ucar.edu nancy at ucar.edu
Mon Feb 4 16:25:56 MST 2013


Revision: 5954
Author:   thoar
Date:     2013-02-04 16:25:56 -0700 (Mon, 04 Feb 2013)
Log Message:
-----------
This runs to completion for the first submission (no resubmit) with some sourcemods that
are not part of the DART repository ... yet. No assimilation was done in the current test.
The next step is to turn on assimilation and test that ... then a resubmit.

Just need to get this current (baseline) case committed.

Modified Paths:
--------------
    DART/branches/development/models/POP/shell_scripts/CESM1_1_setup_hybrid.csh

-------------- next part --------------
Modified: DART/branches/development/models/POP/shell_scripts/CESM1_1_setup_hybrid.csh
===================================================================
--- DART/branches/development/models/POP/shell_scripts/CESM1_1_setup_hybrid.csh	2013-02-01 18:54:15 UTC (rev 5953)
+++ DART/branches/development/models/POP/shell_scripts/CESM1_1_setup_hybrid.csh	2013-02-04 23:25:56 UTC (rev 5954)
@@ -28,44 +28,44 @@
 #    and an execution directory, where each forecast and assimilation will
 #    take place.  The short term archiver will use a third directory for
 #    storage of model output until it can be moved to long term storage (HPSS)
-# -- Examin the whole script to identify things to change for your experiments.
+# -- Examine the whole script to identify things to change for your experiments.
 # -- Provide any initial files needed by your run:
 #       inflation
 #       sampling error correction
 #       POP initial ensemble
 #       ...
 # -- Run this script.
-# -- Edit the DART input.nml that appears in the $caseroot directory.
-# -- Submit the job using $caseroot/${case}.${mach}.submit
+# -- Edit the DART input.nml that appears in the $CASEROOT directory.
+# -- Submit the job using $CASEROOT/${case}.submit
 #
 # ---------------------
 # Important features
 # ---------------------
 #
 # If you want to change something in your case other than the runtime
-# settings, you need to delete everything and start the run from scratch.
+# settings, it is safest to delete everything and start the run from scratch.
+# For the brave, read
 #
-# ./${CASENAME}.*.clean_build
-# ./configure -cleanall
+# http://www.cesm.ucar.edu/models/cesm1.1/cesm/doc/usersguide/x1142.html
 #
-# ====================================================================
+# and you may be able to salvage something with
+# ./cesm_setup -clean
+# ./${CASENAME}.clean_build
+#
+# ==============================================================================
 # ====  Set case options
-# ====================================================================
+# ==============================================================================
 
 # case will be used many ways;
 #    directory and file names, both locally and on HPSS, and
 #    script names; so consider it's length and information content.
 # num_instances:  Number of ensemble members
-# reuse_existing_case:
-#    false; Remove $caseroot and $exeroot and rebuild
-#    true;  configure -cleannamelist
 
-setenv case                 pop_cesm1_1
-setenv compset              GIAF 
-setenv cesmtag              cesm1_1
+setenv case                 pop_hybrid
+setenv compset              GIAF
+setenv cesmtag              cesm1_1_1
 setenv resolution           T62_gx1v6
 setenv num_instances        4
-setenv reuse_existing_case  false
 
 # ==============================================================================
 # define machines and directories
@@ -78,9 +78,10 @@
 #                    Executables, scripts and input in $DARTroot/models/dev/...
 # caseroot        Your (future) cesm case directory, where this CESM+DART will be built.
 #                    Preferably not a frequently scrubbed location.
-#                 caseroot will be deleted if reuse_existing_case is false (below)
-#                 So this script, and other useful things should be kept elsewhere.
-# exeroot         (Future) Run-time directory; scrubbable, large amount of space needed.
+#                    This script will delete any existing caseroot, so this script,
+#                    and other useful things should be kept elsewhere.
+# rundir          (Future) Run-time directory; scrubbable, large amount of space needed.
+# exeroot         (Future) directory for executables - scrubbable, large amount of space needed.
 # archdir         (Future) Short-term archive directory
 #                    until the long-term archiver moves it to permanent storage.
 # ==============================================================================
@@ -90,6 +91,7 @@
 setenv cesmroot     /glade/p/cesm/cseg/collections/$cesmtag
 setenv caseroot     /glade/p/work/${USER}/cases/${case}
 setenv exeroot      /glade/scratch/${USER}/${case}/bld
+setenv rundir       /glade/scratch/${USER}/${case}/run
 setenv archdir      /glade/scratch/${USER}/archive/${case}
 
 setenv DARTroot     /glade/u/home/${USER}/svn/DART/dev
@@ -98,20 +100,19 @@
 # configure settings
 # ==============================================================================
 
-setenv refyear 2004
 setenv stream_year_first 2004
 setenv stream_year_last  2004
 setenv stream_year_align 2004
-setenv refmon  01
-setenv refday  01
+setenv refyear     2004
+setenv refmon      01
+setenv refday      01
+setenv run_reftod  00000
 setenv run_refdate $refyear-$refmon-$refday
-setenv run_reftod  00000
 
 # ==============================================================================
 # runtime settings --  How many assimilation steps will be done after this one
 #
 # stop_option   Units for determining the forecast length between assimilations
-#               Changing stop_option requires changes to user_nl_clm below.
 # stop_n        Number of time units in the forecast
 # ==============================================================================
 
@@ -125,16 +126,17 @@
 # timewall   can be changed during a series by changing the ${case}.run
 # queue      can be changed during a series by changing the ${case}.run
 #
-# TJH How many f19_f19 CLM instances can fit on 1 'regular' node?
+# TJH: How many T62_gx1v6 POP instances can fit on 1 node?
 # ==============================================================================
 
-setenv proj         P86850054
+setenv ACCOUNT      P86850054
 setenv timewall     0:30
-setenv queue        regular
+setenv queue        premium
+setenv ptile        15
 
-# ====================================================================
+# ==============================================================================
 # set these standard commands based on the machine you are running on.
-# ====================================================================
+# ==============================================================================
 
 switch ("`hostname`")
    case be*:
@@ -157,18 +159,20 @@
    breaksw
 endsw
 
-# ====================================================================
+# ==============================================================================
 # Create the case.
 #
 # For list of the pre-defined cases: ./create_newcase -list
 # To create a variant case, see the CESM documentation and carefully
 # incorporate any needed changes into this script.
-# ====================================================================
+# ==============================================================================
 
-if ("${reuse_existing_case}" == "false") then
-   echo "removing old files from ${caseroot} and ${exeroot}"
+   echo "removing old files from ${caseroot}"
+   echo "removing old files from ${exeroot}"
+   echo "removing old files from ${rundir}"
    ${REMOVE} ${caseroot}
    ${REMOVE} ${exeroot}
+   ${REMOVE} ${rundir}
    ${cesmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
                    -res ${resolution} -compset ${compset}
 
@@ -176,22 +180,16 @@
       echo "ERROR: Case could not be created."
       exit 1
    endif
-else
-   cd ${caseroot}
-   ./configure -cleannamelist
-   ./configure -cleanmach
 
-endif
+# ==============================================================================
+# Configure the case - this creates the CASEROOT directory.
+# ==============================================================================
 
-# ====================================================================
-# Configure the case.
-# ====================================================================
-
 cd ${caseroot}
 
-# This is just for debug purposes
+# Save a copy for debug purposes
 foreach FILE ( *xml )
-   cp $FILE ${FILE}.original
+   ${COPY} $FILE ${FILE}.original
 end
 
 # This is only for the purpose of debugging the code.
@@ -206,7 +204,7 @@
 @ lnd_pes  = $total_nt / 8
 @ ocn_pes  = $total_nt - ($cpl_pes + $ice_pes + $lnd_pes + $atm_pes)
 
-echo "task partitioning"
+echo "task partitioning ..."
 echo ""
 echo "LND gets $lnd_pes"
 echo "ATM gets $atm_pes"
@@ -224,32 +222,29 @@
 ./xmlchange NTHRDS_CPL=1,NTASKS_CPL=$cpl_pes
 
 # http://www.cesm.ucar.edu/models/cesm1.1/cesm/doc/usersguide/c1158.html#run_start_stop
-# "A hybrid run indicates that CESM is initialized more like a startup, but uses 
-# initialization datasets from a previous case. This is somewhat analogous to a 
-# branch run with relaxed restart constraints. A hybrid run allows users to bring 
-# together combinations of initial/restart files from a previous case (specified 
-# by $RUN_REFCASE) at a given model output date (specified by $RUN_REFDATE). 
-# Unlike a branch run, the starting date of a hybrid run (specified by $RUN_STARTDATE) 
-# can be modified relative to the reference case. In a hybrid run, the model does not 
-# continue in a bit-for-bit fashion with respect to the reference case. The resulting 
-# climate, however, should be continuous provided that no model source code or 
-# namelists are changed in the hybrid run. In a hybrid initialization, the ocean 
-# model does not start until the second ocean coupling (normally the second day), 
+# "A hybrid run indicates that CESM is initialized more like a startup, but uses
+# initialization datasets from a previous case. This is somewhat analogous to a
+# branch run with relaxed restart constraints. A hybrid run allows users to bring
+# together combinations of initial/restart files from a previous case (specified
+# by $RUN_REFCASE) at a given model output date (specified by $RUN_REFDATE).
+# Unlike a branch run, the starting date of a hybrid run (specified by $RUN_STARTDATE)
+# can be modified relative to the reference case. In a hybrid run, the model does not
+# continue in a bit-for-bit fashion with respect to the reference case. The resulting
+# climate, however, should be continuous provided that no model source code or
+# namelists are changed in the hybrid run. In a hybrid initialization, the ocean
+# model does not start until the second ocean coupling (normally the second day),
 # and the coupler does a "cold start" without a restart file.
 
 ./xmlchange RUN_TYPE=hybrid
 ./xmlchange RUN_STARTDATE=$run_refdate
-./xmlchange RUN_REFCASE=None.Exists
+./xmlchange RUN_REFCASE=b40.20th.005
 ./xmlchange RUN_REFDATE=$run_refdate
 ./xmlchange RUN_REFTOD=$run_reftod
 ./xmlchange BRNCH_RETAIN_CASENAME=FALSE
 ./xmlchange GET_REFCASE=FALSE
-
 ./xmlchange CALENDAR=GREGORIAN
 ./xmlchange EXEROOT=${exeroot}
 
-# TJH FIXME Temporary setup ... 
-
 ./xmlchange STOP_OPTION=$stop_option
 ./xmlchange STOP_N=$stop_n
 ./xmlchange CONTINUE_RUN=FALSE
@@ -268,6 +263,21 @@
 ./xmlchange DATM_CPLHIST_YR_START=$refyear
 ./xmlchange DATM_CPLHIST_YR_END=$refyear
 
+# 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=3
+
+# The river transport model ON is useful only when using an active ocean or
+# land surface diagnostics. Setting ROF_GRID to 'null' turns off the RTM.
+
+#./xmlchange ROF_GRID='null'
+
+# ==============================================================================
+# Set up the case.
+# This creates the EXEROOT and RUNDIR directories.
+# ==============================================================================
+
 ./cesm_setup
 
 if ( $status != 0 ) then
@@ -275,7 +285,7 @@
    exit 2
 endif
 
-# ====================================================================
+# ==============================================================================
 # Modify namelist templates for each instance.
 #
 # hist_empty_htapes = .true.     suppresses the creation of all history files
@@ -284,10 +294,7 @@
 # hist_mfilt  =  1,              with precisely one day in it
 # hist_avgflag_pertape = 'I'     use instantaneous values - no average
 #
-# The fincl2 history tape has the half-hourly flux tower observations.
-# The observation operators in obs_def_tower_mod.f90
-# are going to read from the .h1. history file for these values.
-# ====================================================================
+# ==============================================================================
 
 @ inst = 1
 while ($inst <= $num_instances)
@@ -297,35 +304,34 @@
 
    set fname = "user_nl_datm_$instance"
 
-   echo "dtlimit = 1.5, 1.5, 1.5"                    >> $fname
-   echo "fillalgo = 'nn', 'nn', 'nn'"                >> $fname
-   echo "fillmask = 'nomask','nomask','nomask'"      >> $fname
-   echo "mapalgo = 'bilinear','bilinear','bilinear'" >> $fname
-   echo "mapmask = 'nomask','nomask','nomask'"       >> $fname
-   echo "streams = 'datm.streams.txt.CPLHIST3HrWx.Solar_"$instance             $stream_year_align $stream_year_first $stream_year_last"'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.Precip_"$instance            $stream_year_align $stream_year_first $stream_year_last"'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip_"$instance $stream_year_align $stream_year_first $stream_year_last"'" >> $fname
-   echo "taxmode = 'cycle','cycle','cycle'"          >> $fname
-   echo "tintalgo = 'coszen','coszen','coszen'"      >> $fname
-   echo "restfils = 'unset'"                         >> $fname
-   echo "restfilm = 'unset'"                         >> $fname
+   echo "streams = 'datm.streams.txt.CPLHIST3HrWx.Solar_$instance             $stream_year_align $stream_year_first $stream_year_last'," >> $fname
+   echo "          'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip_$instance $stream_year_align $stream_year_first $stream_year_last'"  >> $fname
+   echo "dtlimit = 1.5, 1.5"               >> $fname
+   echo "fillalgo = 'nn', 'nn'"            >> $fname
+   echo "fillmask = 'nomask','nomask'"     >> $fname
+   echo "mapalgo = 'bilinear','bilinear'"  >> $fname
+   echo "mapmask = 'nomask','nomask'"      >> $fname
+   echo "taxmode = 'cycle','cycle'"        >> $fname
+   echo "tintalgo = 'linear','linear'"     >> $fname
+   echo "restfils = 'unset'"               >> $fname
+   echo "restfilm = 'unset'"               >> $fname
 
    # CICE Namelists
-   # this is only used for the hybrid start,else rpointers are used.
+   # this is only used for a hybrid start, else rpointers are used.
    echo "ice_ic = 'b40.20th.005_ens"$instance2".cice.r.2004-01-01-00000.nc'" >> user_nl_cice_$instance
 
    # POP Namelists
    # init_ts_suboption = 'data_assim'   for non bit-for-bit restarting (assimilation mode)
    # init_ts_suboption = 'null'         for 'perfect' restarting/forecasting
 
-   echo "init_ts_suboption = 'data_assim'" >> user_nl_pop2_$instance
-   
+   echo "init_ts_suboption = 'null'" >> user_nl_pop2_$instance
+
    @ inst ++
 end
 
 # DLND
 
-echo "streams = 'dlnd.streams.txt.rof.diatren_iaf_rx1" 1948 1948 2004"'" >> user_nl_drof
+echo "streams = 'drof.streams.txt.rof.diatren_iaf_rx1" 1 1948 2009"'" >> user_nl_drof
 
 # ==============================================================================
 # to create custom streamfiles ...
@@ -333,110 +339,170 @@
 #  obtain the contents of the stream txt files in CaseDocs, and then place a copy
 #  of the modified stream txt file in $CASEROOT with the string user_ prepended."
 #
-# -or- 
+# -or-
 #
-# we copy a template stream txt file from the 
+# we copy a template stream txt file from the
 # $DARTroot/models/POP/shell_scripts directory and modify one for each instance.
 #
 # ==============================================================================
 
 ./preview_namelists
 
-# This gives us the right number of stream files
+# This gives us a stream txt file for each instance that we can
+# modify for our own purpose.
 
 foreach FILE (CaseDocs/*streams*)
    set FNAME = $FILE:t
-   cp -v $FILE user_$FNAME
-   chmod 644   user_$FNAME
+
+   switch ( ${FNAME} )
+      case *presaero*:
+         echo "Using default prescribed aerosol stream.txt file ${FNAME}"
+         breaksw
+      case *diatren*:
+         echo "Using default runoff stream.txt file ${FNAME}"
+         breaksw
+      case *\.Precip_*:
+         echo "Precipitation in nonSolarNonPrecip stream.txt file - not ${FNAME}"
+         breaksw
+      default:
+         ${COPY} $FILE user_$FNAME
+         chmod   644   user_$FNAME
+         breaksw
+   endsw
+
 end
 
-# This gives us the right number of stream files
+# Replace each default stream txt file with one that uses the CAM DATM
+# conditions for a default year and modify the instance number.
 
-foreach FILE (user*streams*)
-   set FNAME = $FILE
-   set name_parse = `echo $FNAME:q | sed 's/\_/ /g'`
-   set ss = `echo $name_parse[3]   | grep -c '0'`
+foreach FNAME (user*streams*)
+   set name_parse = `echo $FNAME | sed 's/\_/ /g'`
+   @ filename_index = $#name_parse - 1
+   @ instance_index = $#name_parse
+   set streamname = $name_parse[$filename_index]
+   set   instance = $name_parse[$instance_index]
+   set          n = `printf %d $instance`
 
-   if ($ss == 1) then
-      echo "Looking for multi-instance templates"
-      if (-e $DARTroot/models/POP/shell_scripts/*$name_parse[2]*template) then
-         echo "Copying over multi-instance template for $FNAME and changing instances"
-         cp $DARTroot/models/POP/shell_scripts/*$name_parse[2]*template $FNAME
-         set inst = `expr $name_parse[3] + 0`
-         sed s/ninst/$inst/g $FNAME >! out
-         mv out $FNAME
-      endif
-   endif
+   if (-e $DARTroot/models/POP/shell_scripts/user_$streamname*template) then
 
-   if ($ss == 0) then
-      echo "Looking for single instance templates"
-      if (-e $DARTroot/models/POP/shell_scripts/"$FNAME"_template) then
-         echo "Copying over the single instance template for $FNAME"
-         cp $DARTroot/models/POP/shell_scripts/"$FNAME"_template $FNAME
-      endif
+      echo "Copying DART template for $FNAME and changing instances."
+
+      ${COPY} $DARTroot/models/POP/shell_scripts/user_$streamname*template $FNAME
+
+      sed s/NINST/$n/g $FNAME >! out.$$
+      ${MOVE} out.$$ $FNAME
+
+   else
+      echo "DIED Looking for a DART stream txt template for $FNAME"
+      echo "DIED Looking for a DART stream txt template for $FNAME"
+      exit 3
    endif
 
 end
 
 ./preview_namelists
 
-# ====================================================================
+# ==============================================================================
 # Update source files if need be
 #    Ideally, using DART will not require any source mods.
 #    Until then, this script accesses source mods from a hard-wired location below.
 #    Those may eventually be packaged into the DART repository.
 #    If you have additional source mods, they will need to be merged into any DART
 #    mods and put in the SourceMods subdirectory found in the 'case' directory.
-# ====================================================================
+# ==============================================================================
 
-# this one needs a recursive copy to get all the files in the subdirs
-${COPY} -r  ~thoar/${cesmtag}/SourceMods/* ${caseroot}/SourceMods/
-if ( $status == 0) then
-   echo "FYI - Local Source Modifications used for this case:"
-   ls -lr ${caseroot}/SourceMods/*
+if ( -d ~/${cesmtag}/SourceMods ) then
+   ${COPY} -r  ~/${cesmtag}/SourceMods/* ${caseroot}/SourceMods/
 else
    echo "FYI - No SourceMods for this case"
 endif
 
-# ====================================================================
-# Stage the required parts of DART in the caseroot directory.
-# ====================================================================
+# ==============================================================================
+# build
+# ==============================================================================
 
-foreach FILE ( input.nml filter pop_to_dart dart_to_pop )
-   ${COPY} ${DARTroot}/models/POP/work/${FILE} ${caseroot}/
-   if ( $status != 0 ) then
-      echo "ERROR: ${DARTroot}/models/POP/work/${FILE} not copied to ${caseroot}"
-      echo "ERROR: ${DARTroot}/models/POP/work/${FILE} not copied to ${caseroot}"
-      exit 3
-   endif
+echo ''
+echo 'Building the case'
+echo ''
+
+./${case}.build
+
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be built."
+   exit 4
+endif
+
+# ==============================================================================
+# Stage the restarts now that the run directory exists
+# ==============================================================================
+
+set stagedir = /glade/scratch/thoar/DART_POP_RESTARTS/2004-01-01-00000
+
+echo "Copying the restart files from ${stagedir}"
+
+@ i = 1
+while ($i <= $num_instances)
+   set n4 = `printf %04d $i`
+   set n2 = `printf %02d $i`
+
+   echo "Staging restarts for instance $i of $num_instances"
+   #AK: Note that the pop ocean must have the .hdr file to describe the
+   #    metadata for binary restarts.
+   ${COPY} ${stagedir}/rpointer.ocn_${n4}.restart                       ${rundir}
+   ${COPY} ${stagedir}/rpointer.ocn_${n4}.ovf                           ${rundir}
+   ${COPY} ${stagedir}/rpointer.ice_${n4}                               ${rundir}
+   ${COPY} ${stagedir}/b40.20th.005_ens${n2}.pop.r.2004-01-01-00000     ${rundir}
+   ${COPY} ${stagedir}/b40.20th.005_ens${n2}.pop.r.2004-01-01-00000.hdr ${rundir}
+   ${COPY} ${stagedir}/b40.20th.005_ens${n2}.pop.ro.2004-01-01-00000    ${rundir}
+   ${COPY} ${stagedir}/b40.20th.005_ens${n2}.cice.r.2004-01-01-00000.nc ${rundir}
+
+   #${COPY} ${stagedir}/rpointer.atm_${n4}                               ${rundir}
+   echo ""
+
+   @ i ++
+
 end
 
-# AK note: you must use this assimilate.csh script.
-#          It has hardcoded variables that point to the location of 
-#          the observations sequence files and the DART working 
-#          directory and the PE layout for DART.
+# ==============================================================================
+# Edit the run script to reflect project, queue, and wallclock
+# ==============================================================================
 
-${COPY} ${DARTroot}/models/POP/shell_scripts/assimilate.csh  assimilate.csh
+echo ''
+echo 'Updating the run script to set wallclock and queue.'
+echo ''
 
-# AK: the standard CESM short-term archiving script may need to be altered
-# to archive addtional or subsets of things, or to reduce the amount of 
-# data that is sent to the long-term archive.  Put a verstionof st_archive.sh
-# in  ${DARTroot}/models/POP/shell_scripts when/if necessary
+${COPY} ${case}.run ${case}.run.orig
 
-if ("${reuse_existing_case}" == "false") then
-   ${MOVE} Tools/st_archive.sh Tools/st_archive.sh.orig
-endif
+source Tools/ccsm_getenv
+set BATCH = `echo $BATCHSUBMIT | sed 's/ .*$//'`
+switch ( $BATCH )
+   case bsub*:
+      # NCAR "bluefire", "yellowstone"
+      sed s/ptile=32/ptile=$ptile/ < ${case}.run >! temp.$$
+      ${MOVE} temp.$$  ${case}.run
 
-${COPY} ${DARTroot}/models/POP/shell_scripts/st_archive.sh Tools/
+      set TIMEWALL=`grep BSUB ${case}.run | grep -e '-W' `
+      sed s/$TIMEWALL[3]/$timewall/ < ${case}.run >! temp.$$
+      ${MOVE} temp.$$  ${case}.run
 
-# ====================================================================
+      set QUEUE=`grep BSUB ${case}.run | grep -e '-q' `
+      sed s/$QUEUE[3]/$queue/ < ${case}.run >! temp.$$
+      ${MOVE} temp.$$  ${case}.run
+   breaksw
+
+   default:
+
+   breaksw
+endsw
+
+# ==============================================================================
 # The *.run script must be modified to call the DART assimilate script.
 # The modifications are contained in a "here" document that MUST NOT
 # expand the wildcards etc., before it is run. This is achieved by
 # double-quoting the characters used to delineate the start/stop of
 # the "here" document. No kidding. It has to be "EndOfText",
 # not 'EndOfText' or EndOfText.
-# ====================================================================
+# ==============================================================================
 
 echo ''
 echo 'Adding the call to assimilate.csh to the *.run script.'
@@ -451,26 +517,29 @@
 
 set CplLogFile = `ls -1t cpl.log* | head -n 1`
 if ($CplLogFile == "") then
- echo 'ERROR: Model did not complete - no cpl.log file present - exiting'
- echo 'ERROR: Assimilation will not be attempted.'
- exit -4
+   echo 'ERROR: Model did not complete - no cpl.log file present - exiting.'
+   echo 'ERROR: Assimilation will not be attempted.'
+   exit 1
 endif
 
 grep 'SUCCESSFUL TERMINATION' $CplLogFile
 if ( $status == 0 ) then
-  ${CASEROOT}/assimilate.csh
+   ${CASEROOT}/assimilate.csh
 
-  if ( $status == 0 ) then
-     echo "`date` -- DART HAS FINISHED"
-  else
-     echo "`date` -- DART FILTER ERROR - ABANDON HOPE"
-     exit -5
-  endif
+   if ( $status == 0 ) then
+      echo "`date` -- DART HAS FINISHED"
+   else
+      echo "`date` -- DART FILTER ERROR - ABANDON HOPE"
+      exit 3
+   endif
+else
+   echo 'ERROR: Model did not complete successfully - exiting.'
+   echo 'ERROR: Assimilation will not be attempted.'
+   exit 2
 endif
 
 # END OF DART BLOCK
 # -------------------------------------------------------------------------
-
 "EndOfText"
 
 # Now that the "here" document is created,
@@ -490,102 +559,56 @@
    @ keep = $MYSTRING[1]
    @ lastlines = $origlen - $keep
 
-   mv ${case}.run ${case}.run.orig
+   head -n $keep      ${case}.run    >! temp.$$
+   cat                add_to_run.txt >> temp.$$
+   tail -n $lastlines ${case}.run    >> temp.$$
 
-   head -n $keep      ${case}.run.orig >! ${case}.run
-   cat                add_to_run.txt   >> ${case}.run
-   tail -n $lastlines ${case}.run.orig >> ${case}.run
+#  ${MOVE} temp.$$ ${case}.run    TJH DEBUG
 
 endif
 
-# ====================================================================
-# Edit the run script to reflect project, queue, and wallclock
-# ====================================================================
+chmod 0744 ${case}.run
 
-echo ''
-echo 'Updating the run script to set project number, wallclock, and queue.'
-echo ''
+# ==============================================================================
+# Stage the required parts of DART in the CASEROOT directory.
+# ==============================================================================
 
-set PROJ=`grep BSUB $case.run | grep -e '-P' `
-sed s/$PROJ[3]/$proj/ < $case.run >! temp
-${MOVE} temp  $case.run
+# AK: the standard CESM short-term archiving script may need to be altered
+# to archive addtional or subsets of things, or to reduce the amount of
+# data that is sent to the long-term archive.  Put a version of st_archive.sh
+# in  ${DARTroot}/models/POP/shell_scripts when/if necessary
+#
+if ( ~ -e  Tools/st_archive.sh.orig ) then
+   ${MOVE} Tools/st_archive.sh      Tools/st_archive.sh.orig
+else
+   echo "a Tools/st_archive.sh backup copy already exists"
+endif
 
-set TIMEWALL=`grep BSUB $case.run | grep -e '-W' `
-sed s/$TIMEWALL[3]/$timewall/ < $case.run >! temp
-${MOVE} temp  $case.run
+# AK note: you must use this assimilate.csh script.
+#          It has hardcoded variables that point to the location of
+#          the observations sequence files and the DART working
+#          directory and the PE layout for DART.
 
-set QUEUE=`grep BSUB $case.run | grep -e '-q' `
-sed s/$QUEUE[3]/$queue/ < $case.run >! temp
-${MOVE} temp  $case.run
+# ${COPY} ${DARTroot}/models/POP/shell_scripts/st_archive.sh   Tools/ TJH DEBUG
+${COPY} ${DARTroot}/models/POP/shell_scripts/assimilate.csh  assimilate.csh
+${COPY} ${DARTroot}/models/POP/work/input.nml                input.nml
 
-chmod 0744 $case.run
+# ==============================================================================
+# Stage the DART executables in the CESM execution root directory: EXEROOT
+# ==============================================================================
 
-# ====================================================================
-# build
-# ====================================================================
-
-echo ''
-echo 'Building the case'
-echo ''
-
-./$case.build
-
-if ( $status != 0 ) then
-   echo "ERROR: Case could not be built."
-   exit 3
-endif
-
-# ====================================================================
-# Stage the required parts of DART in the execution root directory,
-# now that EXEROOT exists.
-# ====================================================================
-
-foreach FILE ( input.nml filter pop_to_dart dart_to_pop )
-   ${COPY} ${caseroot}/${FILE} ${exeroot}/
+foreach FILE ( filter pop_to_dart dart_to_pop )
+   ${COPY} ${DARTroot}/models/POP/work/${FILE} ${exeroot}/
    if ( $status != 0 ) then
-      echo "ERROR: ${FILE} not copied to ${exeroot}"
-      echo "ERROR: ${FILE} not copied to ${exeroot}"
+      echo "ERROR: ${DARTroot}/models/POP/work/${FILE} not copied to ${exeroot}"
+      echo "ERROR: ${DARTroot}/models/POP/work/${FILE} not copied to ${exeroot}"
       exit 3
    endif
 end
 
-# ====================================================================
-# Stage the restarts now that the run directory exists
-# ====================================================================
-
-#prestage the restart files from which to branch
-set stagedir = /glade/scratch/thoar/DART_POP_RESTARTS
-
-echo "Copying the restart files from ${stagedir}"
-#echo ''
-#${COPY} ${stagedir}/rpointer.drv ${exeroot}/run/
-#${COPY} ${stagedir}/rpointer.ice ${exeroot}/run/
-
-@ i = 1
-while ($i <= $num_instances)
-   set n4 = `printf %04d $i`
-   set n2 = `printf %02d $i`
-
-   echo "Staging restarts for instance $i of $num_instances"
-   #AK: Note that the pop ocean must have the .hdr file to describe the 
-   #meta data for binary restarts.
-   ${COPY} ${stagedir}/rpointer.ocn_$n4.restart                       ${exeroot}/run/
-   ${COPY} ${stagedir}/rpointer.ocn_$n4.ovf                           ${exeroot}/run/
-   ${COPY} ${stagedir}/rpointer.ice_$n4                               ${exeroot}/run/
-   ${COPY} ${stagedir}/b40.20th.005_ens$n2.pop.r.2004-01-01-00000     ${exeroot}/run/
-   ${COPY} ${stagedir}/b40.20th.005_ens$n2.pop.r.2004-01-01-00000.hdr ${exeroot}/run/
-   ${COPY} ${stagedir}/b40.20th.005_ens$n2.pop.ro.2004-01-01-00000    ${exeroot}/run/
-   ${COPY} ${stagedir}/b40.20th.005_ens$n2.cice.r.2004-01-01-00000.nc ${exeroot}/run/
-   
-   #${COPY} ${stagedir}/rpointer.atm_$n4                               ${exeroot}/run/
-
-   @ i ++
-
-end
-
-# ====================================================================
+# ==============================================================================
 # What to do next
-# ====================================================================
+# ==============================================================================
 
 echo ''
 echo 'Time to check the case.'
@@ -593,19 +616,18 @@
 echo 'Modify what you like in input.nml, make sure the observation directory'
 echo 'names set in assimilate.csh match those on your system, and submit'
 echo 'the CESM job by running:'
-echo "./$case.submit"
+echo "./${case}.submit"
 echo ''
 
-# ====================================================================
-# for continued submissions after the initial startup one, 
+# ==============================================================================
+# for continued submissions after the initial startup one,
 # make the following changes to the env_run variables:
+#
 #    ./xmlchange -file env_run.xml -id STOP_N        -val 1
-#    ./xmlchange -file env_run.xml -id CONTINUE_RUN  -val TRUE
-#    ./xmlchange -file env_run.xml -id RESUBMIT      -val $resubmit
-#    source ./Tools/ccsm_getenv
-# 
+#    ./xmlchange -file env_run.xml -id RESUBMIT      -val <your_favorite_number>
+#
 # Check the streams listed in the streams text files.  If more or different
 # dates need to be added, then do this in the $CASEROOT/user_*files*
-# then invoke > preview_namelists for this information to be moved to 
+# then invoke "preview_namelists" for this information to be moved to
 # the CaseDocs and the executable directory.
-# ====================================================================
+# ==============================================================================


More information about the Dart-dev mailing list