[Dart-dev] [6542] DART/trunk/models/cam/shell_scripts: These are the 'best practices' scripts for running a CESM CAM (F compset).

nancy at ucar.edu nancy at ucar.edu
Wed Oct 23 17:02:43 MDT 2013


Revision: 6542
Author:   thoar
Date:     2013-10-23 17:02:43 -0600 (Wed, 23 Oct 2013)
Log Message:
-----------
These are the 'best practices' scripts for running a CESM CAM (F compset).
This requires the use of the CAM sourcemods that enable a continuation run
instead of a 'perpetual startup' run. The perpetual startup configuration
could not be extended to have multiple active model components and so is
deprecated at this time.

Note: there is a lot of embedded documentation.

Modified Paths:
--------------
    DART/trunk/models/cam/shell_scripts/CESM1_1_1_setup_hybrid
    DART/trunk/models/cam/shell_scripts/CESM_DART_config
    DART/trunk/models/cam/shell_scripts/assimilate.csh

-------------- next part --------------
Modified: DART/trunk/models/cam/shell_scripts/CESM1_1_1_setup_hybrid
===================================================================
--- DART/trunk/models/cam/shell_scripts/CESM1_1_1_setup_hybrid	2013-10-23 17:29:54 UTC (rev 6541)
+++ DART/trunk/models/cam/shell_scripts/CESM1_1_1_setup_hybrid	2013-10-23 23:02:43 UTC (rev 6542)
@@ -14,10 +14,12 @@
 # using an F compset where CAM and CLM are active. The initial states
 # come from a single multi-instance reference case so a CESM hybrid setup is used.
 #
-# Because the atmosphere assimilations typically occur every 6 hours, the methodology
-# here reflects that. All of CESM stops every 6 hours (requiring the ocean to couple
-# 4x per day) so that a CAM output file would be available for assimilation.
+# DOCN: We are using a single data ocean.
 #
+# Because the atmosphere assimilations typically occur every 6 hours, 
+# the methodology here reflects that. All of CESM stops every 6 hours 
+# so that a CAM output file would be available for assimilation.
+#
 # This script results in a viable setup for a CESM multi-instance experiment. You
 # are STRONGLY encouraged to run the multi-instance CESM a few times and experiment
 # with different settings BEFORE you try to assimilate observations. The amount of
@@ -27,8 +29,8 @@
 # CESM/DART requires some modifications to the CESM source code EVEN IF YOU ARE NOT
 # assimilating. The modifications for CAM require a modification to the 
 # CESM ${CASE}.run script. The modifications will invoke a DART script that will 
-# either assimilate or 'do nothing'. It is stronly recommended that you configure 
-# the ${CASE}.run script to 'do nothing' initially.
+# either assimilate or 'do nothing'. It is strongly recommended that you configure 
+# the ${CASE}.run script to 'do nothing' initially. This is the default behavior.
 #
 # CASEROOT/CESM_DART_config will augment the CESM case with the required setup
 # and configuration to perform a DART assimilation and modify the ${CASE}.run script 
@@ -46,37 +48,22 @@
 #    This script sets up a CESM multi-instance run as we understand them and
 #    it has almost nothing to do with DART. This is intentional.
 #
-# -- Edit and run this script in the $DART/models/CESM/shell_scripts directory
-#    or copy it to somewhere that it will be preserved and run it there.
-#    It will create a CESM 'CASE' directory, where the model will be built,
-#    and a run 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)
-#
 # -- Examine the whole script to identify things to change for your experiments.
 #
-# -- Provide the CESM initial ensemble needed by your run.
+# -- Edit this script in the $DART/models/cam/shell_scripts directory
+#    or copy it to somewhere where it will be preserved.
 #
-# -- Run this script.
-# -- Edit the DART input.nml that appears in the $CASEROOT directory, if not done here.
-# -- Submit the job using $CASEROOT/${case}.submit
+# -- Run this script. When it is executed, it will create:
+#    1) a CESM 'CASE' directory, where the model will be built,
+#    2) a run directory, where each forecast (and assimilation) will take place,
+#    3) a bld directory for the executables.
 #
-# -- Read, understand, and execute ${CASEROOT}/CESM_DART_config
+#    This script also executes ${CASEROOT}/CESM_DART_config to modify 
+#    the $CASEROOT/${CASE}.run script so that the SourceMods for CAM
+#    are effective. CESM_DART_config will also augment the case with all
+#    the pieces necessary to run DART when the time comes.
 #
-# Table of contents:
-#    Set up case and directory names
-#    Refined grid mods
-#    create_newcase
-#    cd caseroot
-#    xmlchanges
-#    cesm_setup
-#    namelist mods
-#    preview_namelists
-#    SourceMods
-#    case.build
-#    stage ICs
-#    update the run script
-#    Bring in parts of DART; executables, support files,...
+# -- Submit the job using ${CASEROOT}/${CASE}.submit
 #
 # ---------------------
 # Important features
@@ -106,19 +93,20 @@
 #   0.9x1.25_0.9x1.25 (f09_f09)
 #   1 deg grid for atm/lnd, gx1v6 mask. Normally used for CAM with prescribed lnd, ocn and ice.
 
-setenv case                 test_cam
+setenv case                 cam_test
 setenv compset              F_AMIP_CAM5
 setenv resolution           f09_f09
 setenv cesmtag              cesm1_1_1
-setenv num_instances        4
+setenv num_instances        30
 
 # ==============================================================================
 # define machines and directories
 #
 # mach            Computer name
-# cesmroot        Location of the cesm code base
+# cesm_datadir    Location of some supporting CESM data files.
+# cesmroot        Location of the CESM code base
 #                 For cesm1_1_1 on yellowstone
-# caseroot        Your (future) cesm case directory, where this CESM+DART will be built.
+# caseroot        Your (future) CESM case directory, where this CESM+DART will be built.
 #                    Preferably not a frequently scrubbed location.
 #                    This script will delete any existing caseroot, so this script,
 #                    and other useful things should be kept elsewhere.
@@ -131,8 +119,8 @@
 # ==============================================================================
 
 setenv mach         yellowstone
-setenv cesm_datadir /glade/p/cesm/cseg/inputdata
 
+setenv cesm_datadir /glade/p/cesm/cseg/inputdata
 setenv cesmroot     /glade/p/cesm/cseg/collections/$cesmtag
 setenv caseroot     /glade/p/work/${USER}/cases/${case}
 setenv exeroot      /glade/scratch/${USER}/${case}/bld
@@ -155,9 +143,10 @@
 
 # THIS IS THE LOCATION of the 'reference case'.
 
-setenv stagedir /glade/p/image/CESM_initial_ensemble/rest/${run_refdate}-${run_reftod}
+setenv CAM_stagedir /glade/p/image/CESM_initial_ensemble/rest/${run_refdate}-${run_reftod}
 
-# setenv stagedir /glade/p/work/raeder/Models/CAM_init/${run_refcase}_${run_refdate}
+# alternative reference case for different times may be available here:
+# setenv CAM_stagedir /glade/p/work/raeder/Models/CAM_init/${run_refcase}_${run_refdate}
 
 # ==============================================================================
 # runtime settings
@@ -170,7 +159,7 @@
 # stop_n        Number of time units in the first forecast
 #
 # If the long-term archiver is off, you get a chance to examine the files before
-# they get moved to long-term storage. You can always submit $CASE.l_archive
+# they get moved to long-term storage. You can always submit $case.l_archive
 # whenever you want to free up space in the short-term archive directory.
 #
 # ==============================================================================
@@ -183,7 +172,6 @@
 setenv year_start    1850
 setenv year_end      2012
 
-# setenv  sst_grid ${cesm_datadir}/ocn/docn7/domain.ocn.gx1v6.090206.nc
 setenv    sst_grid ${cesm_datadir}/share/domains/domain.ocn.fv0.9x1.25_gx1v6.130409.nc
 setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
 
@@ -199,12 +187,12 @@
 # queue      can be changed during a series by changing the ${case}.run
 # timewall   can be changed during a series by changing the ${case}.run
 #
-# TJH: Advancing 30 instances for 6 hours with 900 pes
-#      took less than 10 minutes on yellowstone.
+# TJH: Advancing 30 instances for 6 hours and assimilating took
+#      less than 10 minutes on yellowstone using 1800 pes (120 nodes)
 # ==============================================================================
 
-setenv ACCOUNT      P86850054
-setenv queue        premium
+setenv ACCOUNT      P8685xxxx
+setenv queue        economy
 setenv timewall     0:20
 
 # ==============================================================================
@@ -240,7 +228,7 @@
 # VAR is the shell variable name, DIR is the value
 # ==============================================================================
 
-foreach VAR ( cesmroot dartroot stagedir )
+foreach VAR ( cesmroot dartroot CAM_stagedir )
    set DIR = `eval echo \${$VAR}`
    if ( ! -d $DIR ) then
       echo "ERROR: directory '$DIR' not found"
@@ -295,7 +283,7 @@
 # ==============================================================================
 
 if ( ! -e CESM_DART_config ) then
-   ${COPY} ${dartroot}/models/cam/shell_CESM/CESM_DART_config .
+   ${COPY} ${dartroot}/models/cam/shell_scripts/CESM_DART_config .
 endif
 
 if (   -e CESM_DART_config ) then
@@ -441,11 +429,6 @@
 ./xmlchange NCPL_BASE_PERIOD=day
 ./xmlchange ATM_NCPL=48
 
-# TJH FIXME ... any reason to turn ON the biogeochemistry in CLM when atmos only?
-# There is no compset that has everything we want,
-# so we are also turning on the CLM biogeochemistry.
-#./xmlchange CLM_CONFIG_OPTS='-bgc cn'
-
 if ($short_term_archiver == 'off') then
    ./xmlchange DOUT_S=FALSE
 else
@@ -469,9 +452,8 @@
 ./xmlchange RTM_MODE='NULL'
 
 # level of debug output, 0=minimum, 1=normal, 2=more, 3=too much, valid values: 0,1,2,3 (integer)
-# Early versions (late 2012) of CAM-SE could not handle these being other than FALSE and 0.
-./xmlchange DEBUG=TRUE
-./xmlchange INFO_DBUG=1
+./xmlchange DEBUG=FALSE
+./xmlchange INFO_DBUG=0
 
 # ==============================================================================
 # Set up the case.
@@ -517,7 +499,7 @@
 endsw
 
 # This is the part that modifies the run script to allow CESM to advance
-# correctly given the modifications necessary for CAM. It also copies several
+# correctly given the modifications of CAM for DART. It also copies several
 # required DART files to the caseroot directory.
 
 ./CESM_DART_config
@@ -568,17 +550,17 @@
 endif
 
 # ==============================================================================
-# Modify namelist templates for each instance. This is a bit of a nuisance in
-# that we are pulling in restart and initial files from 'all over the place'
-# and each model component has a different strategy.
+# Modify namelist templates for each instance.
+# CAM SourceMods force CAM to ALWAYS read INITIAL files specified by namelist var 'ncdata'
 #
-# In a hybrid run with CONTINUE_RUN = FALSE (i.e. just starting up):
+# When CONTINUE_RUN = FALSE (i.e. just starting up):
 #
-# CAM has been forced to read initial files - specified by namelist var:ncdata
 # CICE reads from namelist variable 'ice_ic'
 # CLM builds its own 'finidat' value from the REFCASE variables but in CESM1_1_1
 #     it does not use the instance string. There is a patch for clm.buildnml.csh
 #
+# When CONTINUE_RUN = TRUE, CICE and CLM read from pointer files. 
+#
 # All of these must later on be staged with these same filenames.
 # OR - all these namelists can be changed to match whatever has been staged.
 # MAKE SURE THE STAGING SECTION OF THIS SCRIPT MATCHES THESE VALUES.
@@ -605,8 +587,8 @@
    echo " nhtfrq        = -$stop_n "                      >> ${fname}
    echo " mfilt         = 1 "                             >> ${fname}
 
-   # 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.
+   # Files specified below are because the 'default' files only
+   # contain data through 2005 and we may be interested in timeframes after that.
 
    set chem_datapath = "${cesm_datadir}/atm/cam/chem/trop_mozart_aero"
 
@@ -630,8 +612,8 @@
    # Making a compact .h0. file is a good idea, since the clm restart files
    # do not have all the metadata required to reconstruct a gridded field.
    # 'TSA' is 2m surface air temperature.
-   # TJH ... should make monthly average file or something ... 
-   # 1.3 MB is 100x bigger than CAM history file. See page 65 of 
+   # TJH ... should make monthly average file or something ...
+   # 1.3 MB is 100x bigger than CAM history file. See page 65 of
    # http://www.cesm.ucar.edu/models/cesm1.1/clm/models/lnd/clm/doc/UsersGuide/clm_ug.pdf
    #
    # Every 6 hours
@@ -643,7 +625,7 @@
 
 # KDR; Was the ntapes bug fixed?
 #      That's where the CLM restart file always has dimension ntapes,
-#      but it's set = 0 for hist_empty_htapes = .false.,
+#      but it's set = 0 for hist_empty_htapes = .true. and empty hist_fincl1,
 #      which prevents the next forecast from starting.
 #      Kluzek fixed it in some recent (<9/2013) version, but not 1_1_1.
 #      There's a supposed fix in ~/cesm1_1_1/SourceMods/src.clm/HistFileMod.F90,
@@ -710,7 +692,7 @@
 
       # the restarts should be in the short term archive directory
       # http://www.cesm.ucar.edu/models/cesm1.1/cesm/doc/usersguide/x1631.html#running_ccsm_restart_back
-      ${COPY} \$DOUT_S_ROOT/rest/\${restart_time}/* .
+      ${COPY} \$DOUT_S_ROOT/rest/\${restart_time}/* . || exit -1
 
    else
 
@@ -722,10 +704,10 @@
 
          set inst_string = \`printf _%04d \$inst\`
 
-         echo "${CASE}.cpl.r.\${restart_time}.nc"                  >! rpointer.drv
-         echo "${CASE}.clm2\${inst_string}.r.\${restart_time}.nc"  >! rpointer.lnd\${inst_string}
-         echo "${CASE}.cice\${inst_string}.r.\${restart_time}.nc"  >! rpointer.ice\${inst_string}
-         echo "${CASE}.cam\${inst_string}.r.\${restart_time}.nc"   >! rpointer.atm\${inst_string}
+         echo "${case}.cpl.r.\${restart_time}.nc"                  >! rpointer.drv
+         echo "${case}.clm2\${inst_string}.r.\${restart_time}.nc"  >! rpointer.lnd\${inst_string}
+         echo "${case}.cice\${inst_string}.r.\${restart_time}.nc"  >! rpointer.ice\${inst_string}
+         echo "${case}.cam\${inst_string}.r.\${restart_time}.nc"   >! rpointer.atm\${inst_string}
 
 
          @ inst ++
@@ -737,16 +719,16 @@
    @ inst=1
    while (\$inst <= $num_instances)
       set inst_string = \`printf _%04d \$inst\`
-      ${LINK} ${CASE}.cam\${inst_string}.i.\${restart_time}.nc cam_initial\${inst_string}.nc
+      ${LINK} ${case}.cam\${inst_string}.i.\${restart_time}.nc cam_initial\${inst_string}.nc
       @ inst ++
    end
 
    # relink the pointer file for the data ocean
-   echo "${CASE}.docn.r.\${restart_time}.nc"    >! rpointer.ocn
+   echo "${case}.docn.r.\${restart_time}.nc"    >! rpointer.ocn
    echo ""                                      >> rpointer.ocn
-   echo "${CASE}.docn.rs1.\${restart_time}.bin" >> rpointer.ocn
+   echo "${case}.docn.rs1.\${restart_time}.bin" >> rpointer.ocn
    echo ""                                      >> rpointer.ocn
-   
+
    exit 0
 endif
 
@@ -754,7 +736,7 @@
 # This block prepares the initial run directory for a startup run.
 # The CLM, CICE, ROF namelists specify a relative path for the initial file.
 # The CAM namelist specifies a static name.
-# POP uses pointer files. 
+# POP uses pointer files.
 #
 # The reference case may more instances than we need,
 # and it certainly has more files than we need.
@@ -764,7 +746,7 @@
 # the run_refdate and the time in the filenames can be unrelated.
 #----------------------------------------------------------------------
 
-set filedir = ${stagedir}
+set filedir = ${CAM_stagedir}
 
 @ inst=1
 while (\$inst <= $num_instances)
@@ -821,16 +803,12 @@
 echo ""
 echo "3) If you want to simply advance CESM without using DART, make sure the"
 echo "   ${case}.run script references the 'no_assimilate.csh' script."
-echo "   If you want to assimilate, reference the 'assimilate.csh' script."
-echo "   The default action is to assimilate."
+echo "   This is the default behavior."
 echo ""
 echo "4) Verify the contents of env_run.xml and submit the CESM job:"
 echo "   ./${case}.submit"
 echo ""
-echo "5) After the job has run, check to make sure it worked and that"
-echo "   a: the right restart files exist in the run directory,"
-echo "   b: (if you're running DART) the archive dart/hist directory has the DART output,"
-echo "   c: everything is working correctly ..."
+echo "5) After the job has run, check to make sure it worked."
 echo ""
 echo "6) To extend the run in $stop_n '"$stop_option"' steps,"
 echo "   change the env_run.xml variables:"
@@ -841,8 +819,9 @@
 echo ""
 echo "   and"
 echo "   ./${case}.submit"
-echo ""
 
+cat ${caseroot}/DART_instructions.txt
+
 exit 0
 
 # <next few lines under version control, do not edit>

Modified: DART/trunk/models/cam/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/cam/shell_scripts/CESM_DART_config	2013-10-23 17:29:54 UTC (rev 6541)
+++ DART/trunk/models/cam/shell_scripts/CESM_DART_config	2013-10-23 23:02:43 UTC (rev 6542)
@@ -267,7 +267,7 @@
 end
 
 # ==============================================================================
-# Initial setup for the default inflation scenario.
+# INFLATION : Initial setup for the default inflation scenario.
 # ==============================================================================
 # CAM usually uses adaptive state-space prior inflation. The initial settings
 # are in the filter_nml and ... during an assimilation experiment, the output
@@ -283,6 +283,9 @@
 # file before it performs the assimilation. After the first assimilation takes
 # place, the cookie file must be 'eaten' so that subsequent assimilations do not
 # overwrite whatever _should_ be there.
+#
+# IMPORTANT: If you stage your own inflation file, you must REMOVE the cookie
+# file from the RUNDIR directory.
 
 date >! ${RUNDIR}/cam_inflation_cookie
 
@@ -313,7 +316,7 @@
 if ( $status == 0 ) then
 
    # If you want to simply run CESM, use 'no_assimilate.csh'
-   # If you want to use DART , use 'DARTSCRIPTNAME'
+   # If you want to use DART, use 'DARTSCRIPTNAME'
    # You can only use one of the two.
 
    ${CASEROOT}/no_assimilate.csh
@@ -393,7 +396,7 @@
 
 cat << EndOfText >! DART_instructions.txt
 
-------------------------------------------------------------
+-------------------------------------------------------------------------
 
 Check the DART configuration:
 
@@ -403,21 +406,23 @@
 2) When you want to run DART, edit the ${CASE}.run script to
    reference "$DARTscript" instead of "no_assimilate.csh".
 
-3) Modify what you need to in the DART namelists. These are 
-   ${CASEROOT}/input.nml
+3) Modify what you need to in the DART namelist file, i.e. ${CASEROOT}/input.nml
 
 4) If you have recompiled any part of the DART system, 'refresh_dart_files'
    will copy them into the correct places.
 
-5) Make sure the observation directory names in $DARTscript match
-   those on your system, and submit the CESM job in the normal way.
+5) If you stage your own inflation files, make sure you read the INFLATION section
+   in ${CASEROOT}/CESM_DART_config
 
-6) Inflation files? Observation files for the time of interest?
+6) Make sure the observation directory names in $DARTscript match
+   those on your system.
 
-7) You can use ${CASEROOT}/stage_cesm_files
+7) Submit the CESM job in the normal way.
+
+8) You can use ${CASEROOT}/stage_cesm_files
     to stage files to restart a run.
 
-------------------------------------------------------------
+-------------------------------------------------------------------------
 
 EndOfText
 

Modified: DART/trunk/models/cam/shell_scripts/assimilate.csh
===================================================================
--- DART/trunk/models/cam/shell_scripts/assimilate.csh	2013-10-23 17:29:54 UTC (rev 6541)
+++ DART/trunk/models/cam/shell_scripts/assimilate.csh	2013-10-23 23:02:43 UTC (rev 6542)
@@ -16,7 +16,7 @@
 
 # The FORCE options are not optional.
 # The VERBOSE options are useful for debugging though
-# some systems don't like the -v option to any of the following 
+# some systems don't like the -v option to any of the following
 switch ("`hostname`")
    case be*:
       # NCAR "bluefire"
@@ -36,6 +36,9 @@
       set   LINK = 'ln -fvs'
       set REMOVE = 'rm -fr'
 
+      # BASEOBSDIR needs the whole path name except for the date directory and file name.
+      # You can set this to point to directories of synthetic observations, too.
+      # set BASEOBSDIR = /glade/p/image/Observations/Synthetic/UVT_ne30_12H
       set BASEOBSDIR = /glade/p/image/Observations/ACARS
       set  LAUNCHCMD = mpirun.lsf
    breaksw
@@ -94,6 +97,7 @@
 # Get observation sequence file ... or die right away.
 # The observation file names have a time that matches the stopping time of CAM.
 #-----------------------------------------------------------------------------
+# Make sure the file name structure matches the obs you will be using.
 
 set YYYYMM   = `printf %04d%02d ${ATM_YEAR} ${ATM_MONTH}`
 set OBSFNAME = `printf obs_seq%04d%02d%02d%02d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_HOUR}`
@@ -127,7 +131,8 @@
 # Block 2: Stage the files needed for SAMPLING ERROR CORRECTION
 #
 # The sampling error correction is a lookup table.
-# The tables are stored in the DART distribution.
+# The tables were originally in the DART distribution, but should
+# have been staged to $CASEROOT at setup time.
 # Each ensemble size has its own (static) file.
 # It is only needed if
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
@@ -170,24 +175,28 @@
 # files to be as listed above. When being archived, the filenames get a
 # unique extension (describing the assimilation time) appended to them.
 #
-# The inflation file is essentially a duplicate of the DART model state ...  
-# For the purpose of this script, they are the output of a previous assimilation, 
+# The inflation file is essentially a duplicate of the DART model state ...
+# For the purpose of this script, they are the output of a previous assimilation,
 # so they should be named something like prior_inflate_restart.YYYY-MM-DD-SSSSS
 #
 # NOTICE: inf_initial_from_restart and inf_sd_initial_from_restart are somewhat
 # problematic. During the bulk of an experiment, these should be FALSE, since
 # we want to read existing inflation files. However, the first assimilation
 # might need these to be TRUE and then subsequently be set to FALSE.
-# There are two ways to handle this.
-# 1) Create the initial files offline with values of unity by using  
-#    'fill_inflation_restart' and stage them with the appropriate names
-#    in the RUNDIR.
-# 2) create a cookie file called RUNDIR/make_cam_inflation_cookie
+# There are two ways to handle this:
+#
+# 1) Create the initial files offline (perhaps with 'fill_inflation_restart')
+#    and stage them with the appropriate names in the RUNDIR.
+#    You must manually remove the cam_inflation_cookie file
+#    from the RUNDIR in this case.
+#    - OR -
+# 2) create a cookie file called RUNDIR/cam_inflation_cookie
 #    The existence of this file will cause this script to set the
 #    namelist appropriately. This script will 'eat' the cookie file
 #    to prevent this from happening for subsequent executions. If the
 #    inflation file does not exist for them, and it needs to, this script
-#    should die.
+#    should die. The CESM_DART_config script automatically creates a cookie
+#    file to support this option.
 #
 # The strategy is to use the LATEST inflation file from the CESM 'rundir'.
 # After an assimilation, the new inflation values/files will be moved to
@@ -234,14 +243,14 @@
       # we are not using an existing inflation file.
       echo "inf_flavor(1) = $PRIOR_INF, using namelist values."
 
-   else if ( -e ../make_cam_inflation_cookie ) then
+   else if ( -e ../cam_inflation_cookie ) then
       # We want to use an existing inflation file, but this is
       # the first assimilation so there is no existing inflation
-      # file. This is the signal we need to to coerce the namelist 
+      # file. This is the signal we need to to coerce the namelist
       # to have different values for this execution ONLY.
       # Since the local namelist comes from CASEROOT each time, we're golden.
 
-      set PRIOR_TF = FALSE    
+      set PRIOR_TF = FALSE
 
 ex input.nml <<ex_end
 g;inf_initial_from_restart ;s;= .*;= .${PRIOR_TF}., .${POSTE_TF}.,;
@@ -249,7 +258,7 @@
 wq
 ex_end
 
-   else 
+   else
       # Look for the output from the previous assimilation
       (ls -rt1 ../cam_${PRIOR_INF_OFNAME}.* | tail -n 1 >! latestfile) > & /dev/null
       set nfiles = `cat latestfile | wc -l`
@@ -277,14 +286,14 @@
       # we are not using an existing inflation file.
       echo "inf_flavor(2) = $POSTE_INF, using namelist values."
 
-   else if ( -e ../make_cam_inflation_cookie ) then
+   else if ( -e ../cam_inflation_cookie ) then
       # We want to use an existing inflation file, but this is
       # the first assimilation so there is no existing inflation
-      # file. This is the signal we need to to coerce the namelist 
+      # file. This is the signal we need to to coerce the namelist
       # to have different values for this execution ONLY.
       # Since the local namelist comes from CASEROOT each time, we're golden.
 
-      set POSTE_TF = FALSE    
+      set POSTE_TF = FALSE
 
 ex input.nml <<ex_end
 g;inf_initial_from_restart ;s;= .*;= .${PRIOR_TF}., .${POSTE_TF}.,;
@@ -312,15 +321,15 @@
 endif
 
 # Eat the cookie regardless
-${REMOVE} ../make_cam_inflation_cookie
+${REMOVE} ../cam_inflation_cookie
 
 #=========================================================================
-# Block 4: Convert N CAM restart files to DART initial condition files.
+# Block 4: Convert N CAM initial 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 each of them.
 #
 # 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
+# that came from pointer files ../rpointer.atm_[1-N]
 #
 # REQUIRED DART namelist settings:
 # &filter_nml:           restart_in_file_name    = 'filter_ics'
@@ -329,6 +338,20 @@
 # &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.
+#
+# KDR; NOTE; when starting an OSSE by perturbing a single file, use
+# &filter_nml
+#   start_from_restart        = .false.,
+#   output_restart            = .true.,
+#   restart_in_file_name      = "filter_ics.0001",
+#   restart_out_file_name     = "filter_restart", 
+# &ensemble_manager_nml
+#   single_restart_file_in    = .true.,
+#   single_restart_file_out   = .false.,
+# &model_nml
+#   pert_names          = 'T'
+#   pert_sd             = 1.0e-11,
+#   pert_base_vals      = -888888.0d0,
 #=========================================================================
 
 echo "`date` -- BEGIN CAM-TO-DART"
@@ -339,15 +362,15 @@
    # Each member will do its job in its own directory.
    # That way, we can do N of them simultaneously -
 
-   # 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
 
+   # 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).
    # make sure there are no old output logs hanging around
+
    $REMOVE output.${member}.cam_to_dart
 
    set ATM_INITIAL_FILENAME = `printf ../../${MYCASE}.cam_%04d.i.${ATM_DATE_EXT}.nc ${member}`
@@ -355,8 +378,8 @@
    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
+   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
@@ -385,19 +408,18 @@
 # Will result in a set of files : 'filter_restart.xxxx'
 #
 # DART namelist settings required:
-# &filter_nml:           async                  = 0,
-# &filter_nml:           adv_ens_command        = "./no_model_advance.csh",
-# &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,
-# &filter_nml:           init_time_seconds      = -1,
-# &filter_nml:           first_obs_days         = -1,
-# &filter_nml:           first_obs_seconds      = -1,
-# &filter_nml:           last_obs_days          = -1,
-# &filter_nml:           last_obs_seconds       = -1,
-# &ensemble_manager_nml: single_restart_file_in = .false.
+# &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,
+# &filter_nml:           init_time_seconds       = -1,
+# &filter_nml:           first_obs_days          = -1,
+# &filter_nml:           first_obs_seconds       = -1,
+# &filter_nml:           last_obs_days           = -1,
+# &filter_nml:           last_obs_seconds        = -1,
+# &ensemble_manager_nml: single_restart_file_in  = .false.
+# &ensemble_manager_nml: single_restart_file_out = .false.
 #
 #=========================================================================
 
@@ -410,23 +432,10 @@
 ${LINK} $ATM_INITIAL_FILENAME caminput.nc
 ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
 
-# On yellowstone, you can explore task layouts with the following:
-if ( $?LSB_PJL_TASK_GEOMETRY ) then
-   setenv ORIGINAL_LAYOUT "${LSB_PJL_TASK_GEOMETRY}"
-
-   # setenv GEOMETRY_32_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)}";
-   # setenv LSB_PJL_TASK_GEOMETRY "${GEOMETRY_32_1NODE}"
-endif
-
 echo "`date` -- BEGIN FILTER"
 ${LAUNCHCMD} ${EXEROOT}/filter || exit -7
 echo "`date` -- END FILTER"
 
-if ( $?LSB_PJL_TASK_GEOMETRY ) then
-   setenv LSB_PJL_TASK_GEOMETRY "${ORIGINAL_LAYOUT}"
-endif
-
 ${MOVE} Prior_Diag.nc      ../cam_Prior_Diag.${ATM_DATE_EXT}.nc
 ${MOVE} Posterior_Diag.nc  ../cam_Posterior_Diag.${ATM_DATE_EXT}.nc
 ${MOVE} obs_seq.final      ../cam_obs_seq.${ATM_DATE_EXT}.final
@@ -434,7 +443,7 @@
 
 # Accomodate any possible inflation files
 # 1) rename file to reflect current date
-# 2) move to CENTRALDIR so the DART INFLATION BLOCK works next time and
+# 2) move to RUNDIR so the DART INFLATION BLOCK works next time and
 #    that they can get archived.
 
 foreach FILE ( ${PRIOR_INF_OFNAME} ${POSTE_INF_OFNAME} ${PRIOR_INF_DIAG} ${POSTE_INF_DIAG} )
@@ -496,47 +505,17 @@
 set member = 1
 while ( ${member} <= ${ensemble_size} )
 
-   set n4 = `printf %04d $member`
+   set inst_string = `printf _%04d $member`
 
-   set LND_RESTART_FILENAME = `printf ${MYCASE}.clm2_%04d.r.${ATM_DATE_EXT}.nc ${member}`
-   set ICE_RESTART_FILENAME = `printf ${MYCASE}.cice_%04d.r.${ATM_DATE_EXT}.nc ${member}`
-   set ATM_INITIAL_FILENAME = `printf ${MYCASE}.cam_%04d.i.${ATM_DATE_EXT}.nc  ${member}`
+   set ATM_INITIAL_FILENAME = ${MYCASE}.cam${inst_string}.i.${ATM_DATE_EXT}.nc
 
-   ${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
+   ${LINK} ${ATM_INITIAL_FILENAME} cam_initial${inst_string}.nc || exit -9
 
    @ member++
 
 end
 
 #-------------------------------------------------------------------------
-# We have to communicate the current model time to the env_run.xml script
-# CAM is running in a 'perpetual startup' mode, so it constantly needs new
-# start time information. The other models are running 'restart', so they
-# keep track of it internally.
-#-------------------------------------------------------------------------
-
-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}
-
-#-------------------------------------------------------------------------
-# 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} ${RUNDIR}/*.rs.*
-${REMOVE} ${RUNDIR}/*.rh0.*
-${REMOVE} ${RUNDIR}/*.rs1.*
-${REMOVE} ${RUNDIR}/PET*ESMF_LogFile
-
-#-------------------------------------------------------------------------
 # Cleanup
 #-------------------------------------------------------------------------
 


More information about the Dart-dev mailing list