[Dart-dev] [5479] DART/branches/development/models/cam/shell_scripts: First real crack at using 'hybrid' mode for CESM.

nancy at ucar.edu nancy at ucar.edu
Fri Jan 6 16:48:40 MST 2012


Revision: 5479
Author:   thoar
Date:     2012-01-06 16:48:40 -0700 (Fri, 06 Jan 2012)
Log Message:
-----------
First real crack at using 'hybrid' mode for CESM.
Use dynamic filenames instead of the static ones that are hardwired
in the 'startup' case. Need to check that things are advancing, etc.,
and make sure the st_archive is getting invoked correctly. 
I'm getting a usage note pasted in the poe.stdout....

Modified Paths:
--------------
    DART/branches/development/models/cam/shell_scripts/CESM_setup_hybrid.csh
    DART/branches/development/models/cam/shell_scripts/clm.cpl7.template

Added Paths:
-----------
    DART/branches/development/models/cam/shell_scripts/assimilate.hybrid.csh
    DART/branches/development/models/cam/shell_scripts/st_archive_hybrid.sh

-------------- next part --------------
Modified: DART/branches/development/models/cam/shell_scripts/CESM_setup_hybrid.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/CESM_setup_hybrid.csh	2012-01-06 16:49:49 UTC (rev 5478)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_hybrid.csh	2012-01-06 23:48:40 UTC (rev 5479)
@@ -23,8 +23,8 @@
 # -- If you have source mods, the script assumes that your mods are in: mods_$case.
 #    So, if you have source mods, create a subdirectory mods_$case that contains your mods.
 #    If you don t have any source mods, the script creates an empty subdirectory mods_$case.
-# -- If you have namelist mods, you need to add them to the namelist template: user_nl_cam_$case
-#    Set your namelist variables over there (without modifying the syntax to create user_nl_cam_$case
+# -- If you have namelist mods, you need to add them to the namelist template: user_nl_cam
+#    Set your namelist variables over there (without modifying the syntax to create user_nl_cam
 # -- Now, you are ready to go. Save your script and submit your run with the command: ./$case.csh
 #    The script creates your case, configure, compile and submit your job.
 # -- The script also creates a subdirectory (nml_$case) that contains your namelists.
@@ -44,49 +44,67 @@
 # ====================================================================
 
 # had to edit the following to remove the LSB_PJL_... word too long error
-# cesm1_1_beta04/scripts/ccsm_utils/Machines/mkbatch.bluefire
+# cesm1_1_beta08/scripts/ccsm_utils/Machines/mkbatch.bluefire
 # as long as OMP_NUM_THREADS == 1 ... the default is fine.
 
+# Ensure that RUN_REFTOD has been added to 
+# cesm1_1_beta08/scripts/ccsm_utils/Case.template/config_definition.xml
+
+# Change cesm1_1_beta08/models/atm/cam/bld/cam.cpl7.template
+# ncdata  = '${RUN_REFCASE}.cam.i.${RUN_REFDATE}-00000.nc'
+# to
+# ncdata  = '\${RUN_REFCASE}.cam_\${atm_inst_string}.i.\${RUN_REFDATE}-\${RUN_REFTOD}.nc'
+
+# Change cesm1_1_beta08/models/ice/cice/bld/cice.cpl7.template
+# set ice_ic = ${RUN_REFCASE}.cice.r.${RUN_REFDATE}-00000.nc
+# to
+# set ice_ic = \${RUN_REFCASE}.cice_\${ice_inst_string}.r.\${RUN_REFDATE}-\${RUN_REFTOD}.nc
+
+# Change cesm1_1_beta08/models/lnd/clm/bld/clm.cpl7.template
+# There's more to it than this for the beta08 distribution.
+# xxdiff the DART development branch models/cam/shell_scripts/clm.cpl7.template and ...
+
 # ====================================================================
 # ====  Set case options
 # ====================================================================
 
-setenv case           F2000hybrid
-setenv compset        F_2000
-setenv ccsmtag        cesm1_1_beta04
-setenv resolution     f09_f09
-setenv num_instances  3
+setenv case                 hybrid1
+setenv compset              F_2000
+setenv ccsmtag              cesm1_1_beta08
+setenv resolution           f09_f09
+setenv num_instances        4
+setenv reuse_existing_case  true
 
-# ================================
+# --------------------------------------------------------------------
 # define machines and directories
-# ================================
+# --------------------------------------------------------------------
+#
+# mach            computer name
+# cesm_datadir    location of public CESM data files
+# cesm_public     location of public CESM code distributions
+# caseroot        your (future) cesm case directory
+# rundir          (future) run-time directory
+# archdir         (future) short-term archive directory
+# ccsmroot        location of the cesm code base
+# DARTdir         location of DART executables, scripts and input
 
-setenv mach bluefire                                  ;# machine
-setenv DARTdir /glade/home/thoar/svn/DART/dev         ;# DART executables, scripts and input
-
-setenv cesm_public  /glade/proj3/cseg                 ;# location of public CESM sandbox
+setenv mach         bluefire
 setenv cesm_datadir /glade/proj3/cseg/inputdata
-setenv caseroot /glade/user/thoar/cases/${case}       ;# your (future) cesm case directory
-setenv rundir   /glade/scratch/thoar/${case}          ;# (future) run-time directory
-setenv archdir  /glade/scratch/thoar/archive/${case}  ;# (future) short-term archive directory
+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 ccsmroot /glade/home/thoar/${ccsmtag}          ;# location of your personal cesm code
-setenv ccsmroot ${cesm_public}/collections/${ccsmtag} ;# location of the public cesm code
+setenv ccsmroot     ${cesm_public}/collections/${ccsmtag}
+setenv ccsmroot     /glade/home/thoar/${ccsmtag}
+setenv DARTdir      /glade/home/thoar/svn/DART/dev
 
 # ======================
-# clear out previous builds
-# ======================
-
-echo "removing old files from ${caseroot} and ${rundir}"
-\rm -fr ${caseroot}
-\rm -fr ${rundir}
-
-# ======================
 # configure settings
 # ======================
 
-setenv run_startdate 2008-08-01
-setenv run_starttod 21600
+setenv run_refdate 2008-10-31
+setenv run_reftod  00000
 
 setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
 setenv year_start  1850
@@ -97,7 +115,7 @@
 # ======================
 
 setenv resubmit      0
-setenv stop_n        12
+setenv stop_n        6
 setenv stop_option   nhours
 
 # ======================
@@ -105,7 +123,7 @@
 # ======================
 
 setenv proj         93300315
-setenv timewall     5:00
+setenv timewall     1:30
 setenv queue        lrg_regular
 
 # ====================================================================
@@ -113,147 +131,28 @@
 # For list of the cases: ./create_newcase -list
 # ====================================================================
 
-${ccsmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
-                -res ${resolution} -compset ${compset} -skip_rundb
+# if reuse_existing_case is false and the directory does not exist, ...
 
-if ( $status != 0 ) then
-   echo "ERROR: Case could not be created."
-   exit 1
+if ("${reuse_existing_case}" == "false") then
+   echo "removing old files from ${caseroot} and ${rundir}"
+   \rm -fr ${caseroot}
+   \rm -fr ${rundir}
+   ${ccsmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
+                   -res ${resolution} -compset ${compset} -skip_rundb
+
+   if ( $status != 0 ) then
+      echo "ERROR: Case could not be created."
+      exit 1
+   endif
+else
+   cd ${caseroot}
+   ./configure  -cleannamelist
 endif
 
-
 # ====================================================================
 # Configure the case.
 # ====================================================================
 
-cd ${caseroot}/Tools
-
-# Fix a scripting error on their part
-\cp -f ${ccsmroot}/scripts/ccsm_utils/Tools/lt_archive.csh .
-
-# --------------------------------------------------------------------
-# As of cesm_1_1_beta06, the hybrid runs do not allow for a start TOD
-# other than 00000. Assimilation runs will need to modify that. There
-# is a RUN_REFDATE, we are adding a companion RUN_REFTOD.
-# Tools/config_definition.xml must define it, the *buildnml* scripts
-# must ultimately use it,  ...
-
-cat << EndOfText >! myblock.txt
-<entry id="RUN_REFTOD" 
- type="char"
- valid_values="" 
- value="12321" 
- group="conf_def"
- sdesc="Reference time of day (seconds) for hybrid or branch runs (sssss)"
- ldesc="Reference time of day (seconds) for hybrid or branch runs (sssss).
-        Used to determine the component dataset that the model starts from.
-        Ignored for startup runs "
-></entry>
-
-EndOfText
-
-# Now that the "here" document is created, determine WHERE to insert it.
-# could put it anywhere ... nice to insert it near its brethren, i.e.
-# between the declarations of RUN_REFDATE and BRNCH_RETAIN_CASENAME.
-
-set ENTRY1 = `grep --line-number RUN_REFDATE config_definition.xml`
-set ENTRY1 = `echo $ENTRY1 | sed -e "s#:# #g"`
-set LINE1  = $ENTRY1[1]
-set ENTRY2 = `grep --line-number BRNCH_RETAIN_CASENAME config_definition.xml`
-set ENTRY2 = `echo $ENTRY2 | sed -e "s#:# #g"`
-set LINE2  = $ENTRY2[1]
-
-@ orglen = `cat config_definition.xml | wc -l`
-@ keep = $ENTRY2[1] - 1
-@ lastlines = $orglen - $keep
-
-mv config_definition.xml config_definition.xml.orig
-
-head -$keep      config_definition.xml.orig >! config_definition.xml
-cat              myblock.txt                >> config_definition.xml
-tail -$lastlines config_definition.xml.orig >> config_definition.xml
-
-# IMPORTANT
-# Add the instance number and ability to have restarts at RUN_REFTOD
-# to the Buildconf/*.buildnml.* scripts which only exist after the 
-# case has been built.
-
-# after configure, change:
-#  Tools/Templates/cam.cpl7.template
-#  Tools/Templates/clm.cpl7.template
-#  Tools/Templates/cice.cpl7.template
-
-cd ${caseroot}/Tools/Templates
-
-# The CAM buildnml script needs changing ...
-# ncdata  = '${RUN_REFCASE}.cam.i.${RUN_REFDATE}-00000.nc'
-# to
-# ncdata  = '${RUN_REFCASE}.cam_\$atm_inst_string.i.${RUN_REFDATE}-${RUN_REFTOD}.nc'
-
-ex cam.cpl7.template <<ex_end
-/ncdata/
-s;00000;\${RUN_REFTOD};
-wq
-ex_end
-
-# The CICE buildnml script only needs changing in one place.
-
-ex cice.cpl7.template <<ex_end
-/ice_ic/
-/RUN_REFDATE/
-s;00000;\${RUN_REFTOD};
-wq
-ex_end
-
-# The CLM buildnml script needs changing in MANY places.
-
-ex clm.cpl7.template <<ex_end
-/set finidat/
-/RUN_REFDATE/
-s;00000;\${RUN_REFTOD};
-wq
-ex_end
-
-# ====================================================================
-# Create user namelists
-# ${caseroot}/user_nl_clm/user_nl_clm_x  namelists 
-# ====================================================================
-
-cat <<EOF >! user_nl_cam
-&camexp
- inithist                     = 'ENDOFRUN'
- div24del2flag                = 4
- aerodep_flx_datapath         = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero'
- aerodep_flx_file             = 'aerosoldep_monthly_1849-2006_1.9x2.5_c090803.nc'
- aerodep_flx_cycle_yr         = 2000
- aerodep_flx_type             = 'CYCLICAL'
- iradae                       = -12
-/
-EOF
-# empty_htapes                 = .true.
-# nhtfrq                       = -12
-
-mkdir user_nl_clm
-
-@ instance = 1
-while ( $instance <= $num_instances ) 
-   set clm_inst_string = `printf "%04d" $instance`
-   cat <<EOF >! user_nl_clm/user_nl_clm_$instance
-&clmexp
-  fatmgrid = '${cesm_datadir}/lnd/clm2/griddata/griddata_0.9x1.25_070212.nc'
-  faerdep  = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
-  outnc_large_files = .true.
-  finidat = ${case}.clm2_${clm_inst_string}.r.${run_startdate}-${run_starttod}.nc;
-/
-EOF
-   @ instance++
-end
-# hist_nhtfrq = -12
-# hist_empty_htapes = .true.
-
-
-# --------------------------------------------------------------------
-
 cd ${caseroot}
 
 ./xmlchange -file env_build.xml    -id EXEROOT        -val ${rundir}
@@ -280,39 +179,76 @@
 ./xmlchange -file env_mach_pes.xml -id  NINST_ICE -val $num_instances
 
 ./xmlchange -file env_conf.xml -id RUN_TYPE                -val hybrid
-./xmlchange -file env_conf.xml -id RUN_STARTDATE           -val $run_startdate
-./xmlchange -file env_conf.xml -id RUN_REFDATE             -val $run_startdate
-./xmlchange -file env_conf.xml -id RUN_REFTOD              -val $run_starttod
+./xmlchange -file env_conf.xml -id RUN_STARTDATE           -val $run_refdate
+./xmlchange -file env_conf.xml -id RUN_REFDATE             -val $run_refdate
+./xmlchange -file env_conf.xml -id RUN_REFTOD              -val $run_reftod
 ./xmlchange -file env_conf.xml -id RUN_REFCASE             -val ${case}
 ./xmlchange -file env_conf.xml -id GET_REFCASE             -val FALSE
 ./xmlchange -file env_conf.xml -id BRNCH_RETAIN_CASENAME   -val TRUE
-./xmlchange -file env_conf.xml -id DOCN_SSTDATA_FILENAME   -val $sst_dataset
-./xmlchange -file env_conf.xml -id DOCN_SSTDATA_YEAR_START -val $year_start
-./xmlchange -file env_conf.xml -id DOCN_SSTDATA_YEAR_END   -val $year_end
-
+./xmlchange -file env_conf.xml -id SSTICE_DATA_FILENAME    -val $sst_dataset
+./xmlchange -file env_conf.xml -id SSTICE_YEAR_ALIGN       -val $year_start
+./xmlchange -file env_conf.xml -id SSTICE_YEAR_START       -val $year_start
+./xmlchange -file env_conf.xml -id SSTICE_YEAR_END         -val $year_end
 ./xmlchange -file env_conf.xml -id CLM_CONFIG_OPTS         -val '-rtm off'
 
-./xmlchange -file env_run.xml -id RESUBMIT    -val $resubmit
-./xmlchange -file env_run.xml -id STOP_OPTION -val $stop_option
-./xmlchange -file env_run.xml -id STOP_N      -val $stop_n
-./xmlchange -file env_run.xml -id CALENDAR    -val GREGORIAN
+# The river transport model ON is useful only when using an active ocean or
+# land surface diagnostics.
 
+./xmlchange -file env_run.xml      -id RESUBMIT         -val $resubmit
+./xmlchange -file env_run.xml      -id STOP_OPTION      -val $stop_option
+./xmlchange -file env_run.xml      -id STOP_N           -val $stop_n
+./xmlchange -file env_run.xml      -id CALENDAR         -val GREGORIAN
+
 # Substantial archiving changes exist in the Tools/st_archive.sh script.
 # DOUT_S     is to turn on/off the short-term archiving
 # DOUT_L_MS  is to store to the HPSS (formerly "MSS")
 ./xmlchange -file env_run.xml -id DOUT_S_ROOT                -val ${archdir}
 ./xmlchange -file env_run.xml -id DOUT_S                     -val TRUE
 ./xmlchange -file env_run.xml -id DOUT_S_SAVE_INT_REST_FILES -val TRUE
-./xmlchange -file env_run.xml -id DOUT_L_MS                  -val TRUE
-./xmlchange -file env_run.xml -id DOUT_L_HTAR                -val TRUE
+./xmlchange -file env_run.xml -id DOUT_L_MS                  -val FALSE 
+./xmlchange -file env_run.xml -id DOUT_L_HTAR                -val FALSE
 
+# ====================================================================
+# Create namelist template: user_nl_cam, user_nl_clm
+# ====================================================================
 
+cd ${caseroot}
 
+cat <<EOF >! user_nl_cam
+&camexp
+ inithist             = 'ENDOFRUN'
+ div24del2flag        = 4
+ empty_htapes         = .true.
+ fincl1               = 'PHIS:I'
+ nhtfrq               = -$stop_n
+ iradae               = -$stop_n
+ aerodep_flx_datapath = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero'
+ aerodep_flx_file     = 'aerosoldep_monthly_1849-2006_1.9x2.5_c090803.nc'
+ aerodep_flx_cycle_yr = 2000
+ aerodep_flx_type     = 'CYCLICAL'
+/
+EOF
+
+# at least one of these caused problems when running with the full cesm:
+# empty_htapes                 = .true.
+# nhtfrq                       = -12
+# faerdep ... perhaps only used if CN modeling on ... 
+
+cat <<EOF >! user_nl_clm
+&clmexp
+  fatmgrid = '${cesm_datadir}/lnd/clm2/griddata/griddata_0.9x1.25_070212.nc'
+/
+EOF
+
+# at least one of these caused problems when running with the full cesm:
+#  hist_nhtfrq = -12
+#  hist_empty_htapes = .true.
+
 # ====================================================================
 # Update source files if need be
 # ====================================================================
 
-\cp -rf ~/${ccsmtag}/SourceMods/* ${caseroot}/SourceMods/
+\cp -rf ~thoar/${ccsmtag}/SourceMods/* ${caseroot}/SourceMods/
 if ( $status == 0) then
    echo "FYI - Local Source Modifications used for this case:"
    ls -lr ${caseroot}/SourceMods/*
@@ -325,6 +261,7 @@
 # ====================================================================
 
 cd ${caseroot}
+
 ./configure -case
 
 if ( $status != 0 ) then
@@ -338,79 +275,13 @@
 
 cd ${caseroot}
 
-# \mv Tools/st_archive.sh Tools/st_archive.sh.org
-# \cp -f ${DARTdir}/models/cam/shell_scripts/st_archive.sh Tools/st_archive.sh
+\mv Tools/st_archive.sh Tools/st_archive.sh.org
+\cp -f ${DARTdir}/models/cam/shell_scripts/st_archive_hybrid.sh Tools/st_archive.sh
 
-\cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.csh .
+# TJH Until I get it working, use a link ... 
+ln -sf ${DARTdir}/models/cam/shell_scripts/assimilate.hybrid.csh assimilate.csh
 
 # ====================================================================
-# Update the scripts that build the namelists.
-# The active components scripts need to support the multi-instance naming.
-# ====================================================================
-
-# cesm1_1_beta04/models/ice/cice/bld/cice.cpl7.template
-# cesm1_1_beta04/models/atm/cam/bld/cam.cpl7.template
-# cesm1_1_beta04/models/lnd/clm/bld/clm.cpl7.template
-
-# stuff like 
-# ncdata  = '${RUN_REFCASE}.cam.i.${RUN_REFDATE}-${RUN_REFTOD}.nc'
-# to
-# ncdata  = '${RUN_REFCASE}.cam_\$atm_inst_string.i.${RUN_REFDATE}-${RUN_REFTOD}.nc'
-
-# set ice_ic = ${RUN_REFCASE}.cice.r.${RUN_REFDATE}-00000.nc
-# to
-# set ice_ic = ${RUN_REFCASE}.cice_\$ice_inst_string.r.${RUN_REFDATE}-${RUN_REFTOD}.nc
-
-# set finidat = " finidat = '${RUN_REFCASE}.clm2.r.${RUN_REFDATE}-00000.nc' "
-# to
-# set finidat = " finidat = '${RUN_REFCASE}.clm2_\$lnd_inst_string.r.${RUN_REFDATE}-${RUN_REFTOD}.nc' "
-
-echo ''
-echo 'Editing the Buildconf/{cam,cice,clm}.buildnml.csh files'
-echo ''
-
-cd ${caseroot}/Buildconf
-
-cp -f  cam.buildnml.csh  cam.buildnml.csh.org
-cp -f cice.buildnml.csh cice.buildnml.csh.org
-cp -f  clm.buildnml.csh  clm.buildnml.csh.org
-
-# The CAM buildnml script only needs changing in one place.
-
-ex cam.buildnml.csh <<ex_end
-/cam_inparm/
-/ncdata/
-s;.cam.;.cam_\${atm_inst_string}.;
-s;';";g
-wq
-ex_end
-
-# The CICE buildnml script only needs changing in one place.
-
-ex cice.buildnml.csh <<ex_end
-/setup_nml/
-/ice_ic/
-s;.cice.;.cice_\${ice_inst_string}.;
-s;';";g
-wq
-ex_end
-
-# The CLM buildnml script needs changing in MULTIPLE places.
-
-@ n = 1
-while ($n <= $num_instances)
-   set inst = `printf "%04d" $n`
-   ex clm.buildnml.csh <<ex_end
-/lnd_in_$inst/
-/finidat/
-s;.clm2.;.clm2_${inst}.;
-s;';";g
-wq
-ex_end
-   @ n++
-end
-
-# ====================================================================
 # 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
@@ -456,38 +327,43 @@
 "EndOfText"
 
 # Now that the "here" document is created, 
-# determine WHERE to insert it.
+# determine WHERE to insert it -- ONLY IF it is not already there.
 
-set MYSTRING = `grep --line-number "CSM EXECUTION HAS FINISHED" ${case}.${mach}.run`
-set MYSTRING = `echo $MYSTRING | sed -e "s#:# #g"`
+grep --line-number "ABANDON HOPE" ${case}.run
+if ( $status > 1 ) then
 
-@ orglen = `cat ${case}.${mach}.run | wc -l`
-@ keep = $MYSTRING[1]
-@ lastlines = $orglen - $keep 
+   set MYSTRING = `grep --line-number "CSM EXECUTION HAS FINISHED" ${case}.run`
+   set MYSTRING = `echo $MYSTRING | sed -e "s#:# #g"`
 
-mv ${case}.${mach}.run ${case}.${mach}.run.orig
+   @ orglen = `cat ${case}.run | wc -l`
+   @ keep = $MYSTRING[1]
+   @ lastlines = $orglen - $keep 
 
-head -$keep      ${case}.${mach}.run.orig >! ${case}.${mach}.run
-cat              add_to_run.txt           >> ${case}.${mach}.run
-tail -$lastlines ${case}.${mach}.run.orig >> ${case}.${mach}.run
+   mv ${case}.run ${case}.run.orig
 
+   head -$keep      ${case}.run.orig >! ${case}.run
+   cat              add_to_run.txt   >> ${case}.run
+   tail -$lastlines ${case}.run.orig >> ${case}.run
+
+endif
+
 # ====================================================================
-# Still true.
+# We are trying to make all resubmits to be continuation ... 
 # ====================================================================
 
-cd ${caseroot}/Tools
+# TJH cd ${caseroot}/Tools
 
-echo ''
-echo 'Require all resubmits to be hybrid starts, which means'
-echo 'CONTINUE_RUN should be FALSE in Tools/ccsm_postrun.csh'
-echo ''
+# TJH echo ''
+# TJH echo 'Require all resubmits to be hybrid starts, which means'
+# TJH echo 'CONTINUE_RUN should be FALSE in Tools/ccsm_postrun.csh'
+# TJH echo ''
 
-ex ccsm_postrun.csh <<ex_end
-/use COMP_RUN_BARRIERS as surrogate for timing run logical/
-/CONTINUE_RUN/
-s;TRUE;FALSE;
-wq
-ex_end
+# TJH ex ccsm_postrun.csh <<ex_end
+# TJH /use COMP_RUN_BARRIERS as surrogate for timing run logical/
+# TJH /CONTINUE_RUN/
+# TJH s;TRUE;FALSE;
+# TJH wq
+# TJH ex_end
 
 # ====================================================================
 # build
@@ -499,7 +375,7 @@
 echo 'Building the case'
 echo ''
 
-./$case.$mach.build
+./$case.build
 
 if ( $status != 0 ) then
    echo "ERROR: Case could not be built."
@@ -513,6 +389,7 @@
 # 20081031 ... /ptmp/thoar/restarts
 # 20080801 ... /glade/proj3/DART/raeder/FV1deg_4.0/Exp1/obs_0000
 set stagedir = /glade/proj3/DART/raeder/FV1deg_4.0/Exp1/obs_0000
+set stagedir = /ptmp/thoar/restarts
 
 echo ''
 echo "Staging the restarts from {$stagedir}"
@@ -556,13 +433,13 @@
 
    # create new filenames
 
-   set NEWATMFILE = `printf "${case}.cam_%04d.i.%04d-%02d-%02d-%05d.nc" $n $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_TOD`
+   set NEWATMFILE = `printf "${case}.cam_%04d.i.%04d-%02d-%02d-%05d.nc"  $n $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_TOD`
    set NEWLNDFILE = `printf "${case}.clm2_%04d.r.%04d-%02d-%02d-%05d.nc" $n $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_TOD`
    set NEWICEFILE = `printf "${case}.cice_%04d.r.%04d-%02d-%02d-%05d.nc" $n $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_TOD`
 
-   cp ${ATMFILE} ${rundir}/run/${NEWATMFILE}
-   cp ${LNDFILE} ${rundir}/run/${NEWLNDFILE}
-   cp ${ICEFILE} ${rundir}/run/${NEWICEFILE}
+   cp --preserve=timestamps ${ATMFILE} ${rundir}/run/${NEWATMFILE}
+   cp --preserve=timestamps ${LNDFILE} ${rundir}/run/${NEWLNDFILE}
+   cp --preserve=timestamps ${ICEFILE} ${rundir}/run/${NEWICEFILE}
 
  @ n++
 end
@@ -574,19 +451,19 @@
 # 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 PROJ=`grep BSUB $case.run | grep -e '-P' `
+sed s/$PROJ[3]/$proj/ < $case.run >! temp
+/bin/mv temp  $case.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 TIMEWALL=`grep BSUB $case.run | grep -e '-W' `
+sed s/$TIMEWALL[3]/$timewall/ < $case.run >! temp
+/bin/mv temp  $case.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
+set QUEUE=`grep BSUB $case.run | grep -e '-q' `
+sed s/$QUEUE[3]/$queue/ < $case.run >! temp
+/bin/mv temp  $case.run
 
-chmod 0744 $case.$mach.run
+chmod 0744 $case.run
 
 # ====================================================================
 # Submit job
@@ -599,11 +476,6 @@
 echo 'case is ready to submit after you check the'
 echo "DART settings in ${DARTDIR}/input.nml"
 echo 'After you check them,'
-echo "cd into ${caseroot} and run: ./$case.$mach.submit"
+echo "cd into ${caseroot} and run: ./$case.submit"
 echo ''
 
-exit
-
-cd ${caseroot}
-./$case.$mach.submit
-

Added: DART/branches/development/models/cam/shell_scripts/assimilate.hybrid.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/assimilate.hybrid.csh	                        (rev 0)
+++ DART/branches/development/models/cam/shell_scripts/assimilate.hybrid.csh	2012-01-06 23:48:40 UTC (rev 5479)
@@ -0,0 +1,396 @@
+#!/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
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# $Id$
+
+# The FORCE options are not optional.
+# the VERBOSE options are useful for debugging.
+set   MOVE = '/usr/local/bin/mv -fv'
+set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
+set   LINK = '/usr/local/bin/ln -fvs'
+set REMOVE = '/usr/local/bin/rm -fr'
+
+set ensemble_size = ${NINST_ATM}
+
+# Create temporary working directory for the assimilation
+set temp_dir = assimilate_dir
+echo "temp_dir is $temp_dir"
+mkdir -p $temp_dir
+cd $temp_dir
+
+#-------------------------------------------------------------------------
+# Determine time of model state ... from file name of first member
+# of the form "./${CASE}.cam_${ensemble_member}.i.2000-01-06-00000.nc"
+#-------------------------------------------------------------------------
+
+set FILE = `ls -1t ../*.cam_0001.i.* | head -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`
+
+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)"
+
+#-----------------------------------------------------------------------------
+# Set variables containing various directory names where we will GET things
+#-----------------------------------------------------------------------------
+
+set DARTDIR      = ${HOME}/svn/DART/dev
+set DART_OBS_DIR = ${MODEL_YEAR}${MODEL_MONTH}_6H
+set OBSDIR       = /glade/proj3/image/Observations/ACARS/${DART_OBS_DIR}
+
+#=========================================================================
+# Block 1: Populate a run-time directory with the bits needed to run DART.
+#=========================================================================
+
+foreach FILE ( input.nml filter cam_to_dart dart_to_cam )
+   if (  -e   ${DARTDIR}/models/cam/work/${FILE} ) then
+      ${COPY} ${DARTDIR}/models/cam/work/${FILE} .
+   else
+      echo "ERROR ... DART required file ${DARTDIR}/${FILE} not found ... ERROR"
+      echo "ERROR ... DART required file ${DARTDIR}/${FILE} not found ... ERROR"
+      exit 1
+   endif
+end
+
+# Modify the DART input.nml such that
+# the DART ensemble size matches the CESM number of instances
+# WARNING: the output files contain ALL enemble members ==> BIG
+
+ex input.nml <<ex_end
+g;ens_size ;s;= .*;= $ensemble_size;
+g;num_output_state_members ;s;= .*;= $ensemble_size;
+g;num_output_obs_members ;s;= .*;= $ensemble_size;
+wq
+ex_end
+
+#=========================================================================
+# 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.
+# It is only needed if
+# input.nml:&assim_tools_nml:sampling_error_correction = .true.,
+#=========================================================================
+
+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'`
+
+if ( $SECSTRING == true ) then
+   set SAMP_ERR_FILE = ${DARTDIR}/system_simulation/final_full_precomputed_tables/final_full.${ensemble_size}
+   if (  -e   ${SAMP_ERR_FILE} ) then
+      ${COPY} ${SAMP_ERR_FILE} .
+   else
+      echo "ERROR: no sampling error correction file for this ensemble size."
+      echo "ERROR: looking for ${SAMP_ERR_FILE}"
+      exit 2
+   endif
+else
+   echo "Sampling Error Correction not requested for this assimilation."
+endif
+
+#=========================================================================
+# Block 3: DART INFLATION
+# This stages the files that contain the inflation values.
+# The inflation values change through time and should be archived.
+#
+# This file is only relevant if 'inflation' is turned on -
+# i.e. if inf_flavor(1) /= 0 AND inf_initial_from_restart = .TRUE.
+#
+# filter_nml
+# inf_flavor                  = 2,                       0,
+# inf_initial_from_restart    = .true.,                  .false.,
+# inf_in_file_name            = 'prior_inflate_ics',     'post_inflate_ics',
+# inf_out_file_name           = 'prior_inflate_restart', 'post_inflate_restart',
+# inf_diag_file_name          = 'prior_inflate_diag',    'post_inflate_diag',
+#
+# NOTICE: the archiving scripts more or less require the names of these
+# 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 model state ...
+# it is slaved to a specific geometry. The initial files are created
+# offline with values of unity. For the purpose of this script, they are
+# thought to be the output of a previous assimilation, so they should be
+# named something like prior_inflate_restart.YYYY-MM-DD-SSSSS
+#
+# The first inflation file can be created with 'fill_inflation_restart'
+# which can be built in the usual DART manner.
+#
+# 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
+# the CESM rundir to be used for subsequent assimilations. If the short-term
+# archiver has worked correctly, only the LATEST files will available. Of
+# course, it is not required to have short-term archiving turned on, so ...
+#=========================================================================
+
+set  MYSTRING = `grep inf_flavor input.nml`
+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]`
+
+# 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  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  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  PRIOR_INF_DIAG = $MYSTRING[2]
+set  POSTE_INF_DIAG = $MYSTRING[3]
+
+# IFF we want PRIOR inflation:
+
+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
+
+   # 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 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."
+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
+
+   # 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
+   endif
+else
+   echo "Posterior Inflation not requested for this assimilation."
+endif
+
+#=========================================================================
+#
+# Block 4: Convert 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.
+#
+# At the end of this block, we have DART restart files  filter_ic_old.[1-N]
+# that came from pointer files ../rpointer.atm_[1-N]
+#
+# DART namelist settings appropriate/required:
+# &filter_nml:           restart_in_file_name    = 'filter_ic_old'
+# &ensemble_manager_nml: single_restart_file_in  = '.false.'
+# &cam_to_dart_nml:      cam_to_dart_output_file = 'dart_ics',
+#
+#=========================================================================
+
+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
+
+   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 = `ls -1t ../../${MYCASE}.cam*.h0.* | head -1`
+
+   ${LINK} $ATM_INITIAL_FILENAME caminput.nc
+   ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
+
+   set DART_IC_FILE = `printf ../filter_ic_old.%04d ${member}`
+
+   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 &
+   echo "finished cam_to_dart for member ${member} at "`date`
+
+   cd ..
+
+   @ member++
+end
+
+wait
+
+if ($status != 0) then
+   echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
+   echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
+   exit 7
+endif
+
+#=========================================================================
+# Block 5: Actually run the assimilation.
+# 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_ic_old'
+# &filter_nml:           restart_out_file_name  = 'filter_ic_new'
+# &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.
+#
+#=========================================================================
+
+# 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_HISTORY_FILENAME = `ls -1t ../${MYCASE}.cam_0001.h0.* | head -1`
+
+${LINK} $ATM_INITIAL_FILENAME caminput.nc
+${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
+
+# Determine proper observation sequence file.
+
+set OBSFNAME = `printf obs_seq${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY}%02d ${MODEL_HOUR}`
+set OBS_FILE = ${OBSDIR}/${OBSFNAME}
+
+${LINK} ${OBS_FILE} obs_seq.out
+
+mpirun.lsf ./filter || exit 7
+
+${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
+
+# 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
+#    that they can get archived.
+
+foreach FILE ( ${PRIOR_INF_OFNAME} ${POSTE_INF_OFNAME} ${PRIOR_INF_DIAG} ${POSTE_INF_DIAG} )
+   if ( -e ${FILE} ) then
+      ${MOVE} ${FILE} ../${FILE}.${MODEL_DATE_EXT}
+   else
+      echo "No ${FILE} for ${MODEL_DATE_EXT}"
+   endif
+end
+
+#=========================================================================
+# Block 6: Update the cam restart files. 
+#
+# 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'
+#=========================================================================
+
+set member = 1
+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`
+   ../dart_to_cam >! output.${member}.dart_to_cam &
+   echo "finished dart_to_cam for member ${member} at "`date`
+
+   cd ..
+
+   @ member++
+end
+
+wait
+
+if ($status != 0) then
+   echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
+   echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
+   exit 8
+endif
+
+#-------------------------------------------------------------------------
+# Now that all instances are updated, 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
+#-------------------------------------------------------------------------
+
+set mydir = `pwd`
+cd ${CASEROOT}
+./xmlchange -file env_conf.xml -id RUN_REFDATE -val ${MODEL_YEAR}-${MODEL_MONTH}-${MODEL_DAY}
+./xmlchange -file env_conf.xml -id RUN_REFTOD  -val ${MODEL_SECONDS}
+${COPY} env_conf.xml LockedFiles/env_conf.xml.locked
+cd $mydir 
+
+#-------------------------------------------------------------------------
+# Cleanup
+#-------------------------------------------------------------------------
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/branches/development/models/cam/shell_scripts/assimilate.hybrid.csh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native

Modified: DART/branches/development/models/cam/shell_scripts/clm.cpl7.template
===================================================================
--- DART/branches/development/models/cam/shell_scripts/clm.cpl7.template	2012-01-06 16:49:49 UTC (rev 5478)
+++ DART/branches/development/models/cam/shell_scripts/clm.cpl7.template	2012-01-06 23:48:40 UTC (rev 5479)
@@ -142,11 +142,6 @@
    set options = "$options -glc_grid $GLC_GRID -glc_smb $GLC_SMB"
 endif
 
-#TJH checking
-echo $options
-echo $CLM_NAMELIST_OPTS
-echo $CASEBUILD
-
 $CODEROOT/lnd/clm*/bld/build-namelist $options \
     -namelist "&clm_inparm $CLM_NAMELIST_OPTS /" \
     -csmdata \$DIN_LOC_ROOT \

Added: DART/branches/development/models/cam/shell_scripts/st_archive_hybrid.sh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/st_archive_hybrid.sh	                        (rev 0)
+++ DART/branches/development/models/cam/shell_scripts/st_archive_hybrid.sh	2012-01-06 23:48:40 UTC (rev 5479)
@@ -0,0 +1,286 @@
+#!/bin/sh
+
+#short-term archive script - move model output out of run directory
+#to free disc space for next invocation of model run
+#must be executed from run directory
+#
+# DART $Id$
+#
+# This must exist as ${CASEROOT}/Tools/st_archive.sh 
+# ./xmlchange -file env_run.xml -id DOUT_S_SAVE_INT_REST_FILES -val 'TRUE'
+#
+# The original has been substantially modified to restage the CAM INITIAL files
+# for successive coldstarts - as opposed to restage restart files. As of
+# Nov 10, 2011 ... DART is using CAM initial files. This will change SOON.
+
+#function dispose:
+#moves output files to specified area of st archive and will

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list