[Dart-dev] [5449] DART/branches/development/models/cam/shell_scripts: Updates to the scripts to run the Zagar test on hopper.

nancy at ucar.edu nancy at ucar.edu
Wed Dec 14 16:28:56 MST 2011


Revision: 5449
Author:   nancy
Date:     2011-12-14 16:28:55 -0700 (Wed, 14 Dec 2011)
Log Message:
-----------
Updates to the scripts to run the Zagar test on hopper.
Should be in sync with tim's scripts to run the same
test on bluefire.

Modified Paths:
--------------
    DART/branches/development/models/cam/shell_scripts/setup_cesm_case.ned.csh
    DART/branches/development/models/cam/shell_scripts/setup_cesm_case.pmo.csh

-------------- next part --------------
Modified: DART/branches/development/models/cam/shell_scripts/setup_cesm_case.ned.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/setup_cesm_case.ned.csh	2011-12-14 23:24:07 UTC (rev 5448)
+++ DART/branches/development/models/cam/shell_scripts/setup_cesm_case.ned.csh	2011-12-14 23:28:55 UTC (rev 5449)
@@ -1,58 +1,66 @@
 #!/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: setup_cesm_case.hopper.csh 5404 2011-11-16 15:30:00Z nancy $
-#
-# ====================================================================
-#
+# $Id: CESM_setup_zagar.csh 5444 2011-12-14 22:22:12Z thoar $
+
 # ---------------------
 # Purpose
 # ---------------------
-# 
+#
+# The real purpose of this set of notes is to record what is needed to configure
+# and build a CESM instance that has CAM, CLM, and CICE as active components
+# in a multi-instance configuration over a single data ocean ... etc.
+# Despite looking like a script, it might best be used as a set of notes.
 # ---------------------
 # How to set the script
 # ---------------------
 # -- Copy this script into your directory
 # -- Choose a case name (by changing "setenv case" ) and save the script as $case.csh
-# -- Set the case options at the top of the script 
-# -- If you have source mods, the script assumes that your mods are in: mods_$case. 
+# -- Set the case options at the top of the script
+# -- 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 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
-# -- 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. 
+# -- 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.
-# 
+#
 # ---------------------
 # Important features
 # ---------------------
-# -- If you want to change something in your case other than the runtime settings above,
-#    you need to delete everything and start the run from scratch. 
+#
+# 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.
+#
+# ./${CASENAME}.*.clean_build
+# ./configure -cleanall
 
 # ====================================================================
 # ====  Set case options
-# ==================================================================== 
+# ====================================================================
 
 # ======================
-# case settings 
+# case settings
 # ======================
 
-# according to docs, F == F_2000
 # beta05 is also available, but i'm still using 04 for now
 # because i have a fixed copy in my home directory.
-setenv ccsmtag       cesm1_1_beta04
-setenv case          F_ZAGAR3
-setenv compset       F_2000
-setenv resolution    f09_f09   
+setenv ccsmtag        cesm1_1_beta04
+setenv case           F_ZAGAR3
+setenv compset        F_2000
+setenv resolution     f09_f09
+setenv num_instances  80
 
+# had to edit the following to remove the LSB_PJL_... word too long error
+# /glade/home/thoar/cesm1_1_beta04/scripts/ccsm_utils/Machines/mkbatch.bluefire
+# as long as OMP_NUM_THREADS == 1 ... the default is fine.
 
 # ================================
-#  define machines and directories 
+# define machines and directories
 # ================================
 
 # my home, and temp/scratch space
@@ -60,7 +68,7 @@
 setenv my_scratch $SCRATCH
 
 setenv mach hopp2                                       ;# machine - must match cesm names
-setenv cesm_public /project/projectdirs/ccsm1
+setenv cesm_datadir /project/projectdirs/ccsm1/inputdata
 
 setenv ccsmroot ${my_home}/${ccsmtag}                   ;# this is where the cesm code lives
 #setenv ccsmroot ${cesm_public}/collections/${ccsmtag}  ;# this is where the cesm code lives
@@ -69,6 +77,8 @@
 setenv lockroot ${my_home}/locked_cases                 ;## locked cases
 setenv rundir ${my_scratch}/${case}
 
+setenv DARTdir ${my_home}/devel
+
 # for data files not in the public cems area
 setenv my_datadir ${my_scratch}/cesm_datafiles
 
@@ -76,192 +86,207 @@
 # clear out previous builds
 # ======================
 
-echo removing old files from $caseroot and $rundir
-rm -fr $caseroot
-rm -fr $rundir
+echo "removing old files from ${caseroot} and ${rundir}"
+\rm -fr ${caseroot}
+\rm -fr ${rundir}
 
 # ======================
 # configure settings
 # ======================
 
-setenv num_instances    80
-
 setenv run_startdate 2008-08-01
 
-setenv sst_dataset $my_datadir/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
+setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
 setenv year_start  1850
 setenv year_end    2010
 
 # ======================
-# job settings to alter in run script
+# runtime settings
 # ======================
 
-setenv queue     premium
-setenv timewall  02:00:00
+setenv resubmit      0
+setenv stop_n        12
+setenv stop_option   nhours
 
 # ======================
-# runtime settings
+# job settings
 # ======================
 
-# each 'job' is 12 hours, so 8 resubmits should be 4 full days
-setenv resubmit      0  
-setenv stop_n        12
-setenv stop_option   nhours
+setenv timewall     01:45:00
+setenv queue        premium
 
 # ======================
 # namelist variables
 # ======================
-# We create namelist templates that get copied once the case has been configured.
+# Create namelist templates that get copied once the case has been configured.
 
 setenv this_dir `pwd`
 
 cat <<EOF >! user_nl_cam_${case}
 &camexp
- inithist                   = 'ENDOFRUN'
- div24del2flag              = 4
- bndtvghg                   = '${cesm_public}/inputdata/atm/cam/ggas/ghg_rcp45_1765-2500_c100405.nc'
- prescribed_ozone_datapath  = '${cesm_public}/inputdata/atm/cam/ozone'
- prescribed_ozone_file      = 'ozone_1.9x2.5_L26_1850-2015_rcp45_c101108.nc'
- prescribed_ozone_name      = 'O3'
- prescribed_ozone_type      = 'INTERP_MISSING_MONTHS'
- prescribed_volcaero_datapath = "$my_datadir"
- prescribed_volcaero_file   = 'CCSM4_volcanic_1850-2011_prototype1.nc'
- solar_data_file            = '${cesm_public}/inputdata/atm/cam/solar/SOLAR_TSI_Lean_1610-2140_annual_c100301.nc'
- prescribed_aero_datapath   = '${cesm_public}/inputdata/atm/cam/chem/trop_mozart_aero/aero'
- prescribed_aero_file       = 'aero_rcp45_v1_1.9x2.5_L26_1995-2105_c100316.nc'
- aerodep_flx_datapath       = "$my_datadir"
- aerodep_flx_file           = 'aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
+ 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
+ empty_htapes                 = .true.
+ nhtfrq                       = -12
 /
 EOF
 
- #aerodep_flx_datapath       = '${cesm_public}/inputdata/atm/cam/chem/trop_mozart_aero/aero'
- #prescribed_volcaero_file   = 'CCSM4_volcanic_1850-2011_prototype1.nc'
- 
 cat <<EOF >! user_nl_clm_${case}
 &clmexp
-  fsurdat  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr1850_c091006.nc'
-  fpftdyn  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp2.6_simyr1850-2100_c100323.nc'
-  faerdep  = "$my_datadir/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc"
+  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.
+  hist_nhtfrq = -12
+  hist_empty_htapes = .true.
 /
 EOF
 
-  #fsurdat  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr2000_c100505.nc'
-
-
 # ====================================================================
 # ====  End of case options
-# ==================================================================== 
+# ====================================================================
 
 # ====================================================================
-# Create a new case, configure, and build 
-# for list of the cases: ./create_newcase -list
+# Create a new case, configure, and build.
+# For list of the cases: ./create_newcase -list
 # ====================================================================
 
-cd  $ccsmroot/scripts
-./create_newcase -case $caseroot -mach $mach -res $resolution -compset $compset -skip_rundb  
+${ccsmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
+                -res ${resolution} -compset ${compset} -skip_rundb
 
-cd $caseroot
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be created."
+   exit 1
+endif
 
+cd ${caseroot}
+
+./xmlchange -file env_build.xml    -id EXEROOT        -val ${rundir}
 ./xmlchange -file env_build.xml    -id USE_ESMF_LIB   -val TRUE
-./xmlchange -file env_build.xml    -id ESMF_LIBDIR    -val ${my_scratch}/esmf-mpi
+#./xmlchange -file env_build.xml    -id ESMF_LIBDIR    -val ${nancy_scratch}/esmf-mpi
 
-# number of instances == ensemble size
-./xmlchange -file env_mach_pes.xml -id NINST_ATM -val $num_instances
-./xmlchange -file env_mach_pes.xml -id NINST_LND -val $num_instances
-./xmlchange -file env_mach_pes.xml -id NINST_ICE -val $num_instances
-
-# was 12 when nthreads was 1
 set num_tasks_per_instance = 2
 set nthreads = 6
 @ total_nt = $num_instances * $num_tasks_per_instance
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_ATM -val '0'
+./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_ATM -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_ATM -val $num_instances
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_LND -val '0'
+./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_LND -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_LND -val $num_instances
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_ICE -val '0'
-   
+./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_ICE -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_ICE -val $num_instances
 
 ./xmlchange -file env_conf.xml -id RUN_TYPE                -val startup
 ./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 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 CLM_CONFIG_OPTS         -val '-bgc cn -rtm off'
+./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 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
+./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
 
-# Have not sorted out the archiving just yet ... turning it off for now.
+# 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      -val 'TRUE' 
-./xmlchange -file env_run.xml -id DOUT_L_MS   -val 'TRUE' 
-./xmlchange -file env_run.xml -id DOUT_S_SAVE_INT_REST_FILES      -val 'TRUE'
+./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
 
-#------------------
-#  Create namelist template: user_nl_cam 
-#------------------
+# ====================================================================
+# Create namelist template: user_nl_cam
+# ====================================================================
 
 \mv -f ${this_dir}/user_nl_cam_{$case} ${caseroot}/user_nl_cam
 \mv -f ${this_dir}/user_nl_clm_{$case} ${caseroot}/user_nl_clm
 
-# FIXME: updated source files
+# ====================================================================
+# Update source files if need be
+# ====================================================================
 cp ~/cesm_mods/seq*F90  $caseroot/SourceMods/src.drv
 cp ~/cesm_mods/hist*F90 $caseroot/SourceMods/src.clm
-echo updated source files not in standard distribution:
-ls -l $caseroot/SourceMods/src.drv/*
-ls -l $caseroot/SourceMods/src.clm/*
 
-#------------------
-# configure
-#------------------
+if ( $status == 0) then
+   echo "FYI - Local Source Modifications used for this case:"
+   ls -lr ${caseroot}/SourceMods/*
+else
+   echo "FYI - No SourceMods for this case"
+endif
 
-  cd $caseroot
-  ./configure -case
+# ====================================================================
+# Configure
+# ====================================================================
 
-#------------------
-#  Stage a copy of the DART assimilate.csh script HERE
-#------------------
+cd ${caseroot}
+./configure -case
 
-  cd $caseroot
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be configured."
+   exit 2
+endif
 
-  setenv SCRIPTHOME $HOME/devel/models/cam/shell_scripts/
-  ln -sf $SCRIPTHOME/assimilate.ned.csh .
-  ln -sf $SCRIPTHOME/st_archive.sh Tools/
+# ====================================================================
+# Stage a copy of the DART assimilate.csh script HERE
+# ====================================================================
 
+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
+
+\cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.ned.csh assimilate.csh
+
+# ====================================================================
 # update the namelists and scripts as needed
-#------------------
+# ====================================================================
 
-
-echo
+echo ''
 echo 'Editing the Buildconf/{cam,cice,clm}.buildnml.csh files'
-echo
+echo ''
 
-cd Buildconf
-mv cam.buildnml.csh cam.buildnml.csh.orig
-sed -e '/ ncdata/c  ncdata = "cam_initial_${atm_inst_counter}.nc" ' cam.buildnml.csh.orig >! cam.buildnml.csh
-chmod 0755 cam.buildnml.csh
+cd ${caseroot}/Buildconf
 
-mv cice.buildnml.csh cice.buildnml.csh.orig
-sed -e '/ ice_ic/c  ice_ic = "ice_restart_${ice_inst_counter}.nc" ' cice.buildnml.csh.orig >! cice.buildnml.csh
-chmod 0755 cice.buildnml.csh
+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
 
-#mv clm.buildnml.csh clm.buildnml.csh.orig
-#sed -e '/ finidat/c  finidat = "clm_restart_X.nc" ' clm.buildnml.csh.orig >! clm.buildnml.csh
-cp -f clm.buildnml.csh clm.buildnml.csh.orig
+# The CAM buildnml script only needs changing in one place.
+
+ex cam.buildnml.csh <<ex_end
+/cam_inparm/
+/ncdata/
+s;= '.*';= "cam_initial_\${atm_inst_counter}.nc";
+wq
+ex_end
+
+# The CICE buildnml script only needs changing in one place.
+
+ex cice.buildnml.csh <<ex_end
+/setup_nml/
+/ice_ic/
+s;= '.*';= "ice_restart_\${ice_inst_counter}.nc";
+wq
+ex_end
+
+# The CLM buildnml script needs changing in MANY places.
+
 @ n = 1
 while ($n <= $num_instances)
    set inst = `printf "%04d" $n`
@@ -271,145 +296,146 @@
 s;= '.*';= "clm_restart_${n}.nc";
 wq
 ex_end
-   @ n++ 
+   @ n++
 end
 
 chmod 0755 clm.buildnml.csh
 
-cd ..
+# ====================================================================
+# 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"
+# ====================================================================
 
-echo
-echo 'Adding the call to assimilate.ned.csh to the *.run script.'
-echo 
+cd ${caseroot}
 
-# save original file minus the last 4 lines; insert the
-# call to the assimilate script in front of those 4 lines.
-# could also do this with an ex script
+echo ''
+echo 'Adding the call to assimilate.csh to the *.run script.'
+echo ''
 
-cat <<"EOF" >! add_to_run.csh
+cat << "EndOfText" >! add_to_run.txt
 
 # -------------------------------------------------------------------------
-# START OF DART STUFF:
-# See if CSM finishes correctly (pirated from ccsm_postrun.csh) and if so,
+# START OF DART: if CESM finishes correctly (pirated from ccsm_postrun.csh);
 # perform an assimilation with DART.
 # -------------------------------------------------------------------------
 
 set CplLogFile = `ls -1t cpl.log* | head -1`
 if ($CplLogFile == "") then
- echo "ERROR: Model did not complete - no cpl.log file present - exiting"
- echo "ERROR: Perfect_model run will not be attempted."
+ echo 'ERROR: Model did not complete - no cpl.log file present - exiting'
+ echo 'ERROR: Assimilation will not be attempted.'
  exit -4
 endif
 
 grep 'SUCCESSFUL TERMINATION' $CplLogFile
 if ( $status == 0 ) then
-  ${CASEROOT}/assimilate.ned.csh
+  ${CASEROOT}/assimilate.csh
 
   if ( $status == 0 ) then
      echo "`date` -- DART HAS FINISHED"
   else
-     echo "`date` -- DART PMO ERROR - ABANDON HOPE"
+     echo "`date` -- DART FILTER ERROR - ABANDON HOPE"
      exit -5
   endif
 endif
 
-# END OF DART STUFF
+# END OF DART BLOCK
 # -------------------------------------------------------------------------
 
+"EndOfText"
 
-"EOF"
+# Now that the "here" document is created, 
+# determine WHERE to insert it.
 
+set MYSTRING = `grep --line-number "CSM EXECUTION HAS FINISHED" ${case}.${mach}.run`
+set MYSTRING = `echo $MYSTRING | sed -e "s#:# #g"`
+
+@ orglen = `cat ${case}.${mach}.run | wc -l`
+@ keep = $MYSTRING[1]
+@ lastlines = $orglen - $keep 
+
 mv ${case}.${mach}.run ${case}.${mach}.run.orig
-set len = `cat ${case}.${mach}.run.orig | wc -l`
-set lastlines = `grep -A 500 "CSM EXECUTION HAS FINISHED" ${case}.${mach}.run.orig | wc -l`
-@ lastlines -= 2
-@ keep = $len - $lastlines
 
-head -$keep ${case}.${mach}.run.orig > ${case}.${mach}.run
-cat ./add_to_run.csh >> ${case}.${mach}.run
+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
 
 chmod 0755 ${case}.${mach}.run
 
-cd Tools
+# ====================================================================
+# IMPORTANT: All resubmits must be coldstarts.
+# Change Tools/ccsm_postrun.csh line 83 to CONTINUE_RUN -val FALSE'
+# ====================================================================
+
+echo 'Changing Tools/ccsm_postrun.csh:83 to CONTINUE_RUN -val FALSE'
+echo 'so all the resubmits are coldstarts.'
+
+cd ${caseroot}/Tools
 cp ccsm_postrun.csh ccsm_postrun.orig
 sed -e '/CONTINUE_RUN/s/TRUE/FALSE/' ccsm_postrun.orig >! ccsm_postrun.csh
 chmod 0755 ccsm_postrun.csh 
-cd ..
 
-echo 'Changed Change Tools/ccsm_postrun.csh:83 to CONTINUE_RUN -val FALSE'
-echo 'so all the resubmits are coldstarts.'
+# if run fails, you need to back up, or you want to check what
+# the current run time is, look here:
+#   Buildconf/cpl.buildnml.csh: start_ymd, start_tod
 
+# ====================================================================
+# build
+# ====================================================================
 
-# if start date was not set above, set:
-#   Buildconf/cpl.buildnml.csh: start_ymd, start_tod
+cd ${caseroot}
 
-#------------------
-#  build 
-#------------------
-   
-echo
+echo ''
 echo 'Building the case'
-echo
+echo ''
 
-  cd $caseroot
-  ./$case.$mach.build 
+./$case.$mach.build
 
-#------------------
-#  restarts  - rundir does not exist until build runs
-#------------------
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be built."
+   exit 3
+endif
 
-echo
-echo 'Staging the restarts'
-echo
+# ====================================================================
+# Stage the restarts now that the run directory exists
+# ====================================================================
 
+set stagedir = ${my_scratch}/ned_datafiles
+
+echo ''
+echo "Staging the restarts from {$stagedir}"
+echo ''
+
 @ n = 1
 while ($n <= $num_instances)
 
    echo "Staging restarts for instance $n of $num_instances"
-   cp ${my_scratch}/ned_datafiles/CAM/caminput_${n}.nc ${rundir}/run/cam_initial_${n}.nc
-   cp ${my_scratch}/ned_datafiles/CLM/clminput_${n}.nc ${rundir}/run/clm_restart_${n}.nc
-   cp ${my_scratch}/ned_datafiles/ICE/iceinput_${n}.nc ${rundir}/run/ice_restart_${n}.nc
+   cp ${stagedir}/CAM/caminput_${n}.nc ${rundir}/run/cam_initial_${n}.nc
+   cp ${stagedir}/CLM/clminput_${n}.nc ${rundir}/run/clm_restart_${n}.nc
+   cp ${stagedir}/ICE/iceinput_${n}.nc ${rundir}/run/ice_restart_${n}.nc
 
  @ n++
 end
 
-# no inflation in this experiment
-#cp ${my_scratch}/ned_datafiles/DART/p*inflate_restart.* ${rundir}/run/
+echo 'If inflation is being used ... '
+echo "must stage a ${rundir}/[prior,pos]_inflate_restart.YYYY-MM-DD-SSSSS"
 
-#------------------
-#  Save another copy of the original 'initial' namelist so we 
-# can tell if build changes anything?
-#------------------
-   
-
 # ====================================================================
-#  Continue run
+# Edit the run script to reflect project, queue, and wallclock
 # ====================================================================
 
-# if ($create_build_case == false) then
-#   echo "Found:" {$lockroot}/{$case}.locked
-#   echo "set parameters for continue run"
-#   cd $caseroot 
-#   ./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 CONTINUE_RUN -val TRUE  
-# endif 
 
-# ====================================================================
-# Edit the run script if any vars are defined
-# ====================================================================
-
 if ($?proj) then
   set PROJ=`grep '^#PBS ' $case.$mach.run | grep -e '-P' `
   sed -e s/$PROJ[3]/$proj/ < $case.$mach.run >! temp
   /bin/mv temp  $case.$mach.run
 endif
- 
+
 if ($?timewall) then
   set TIMEWALL=`grep '^#PBS ' $case.$mach.run | grep walltime `
-  sed -e /${TIMEWALL}/s/=.\$/=$timewall/ < $case.$mach.run >! temp
+  sed -e /"${TIMEWALL}"/s/=.\$/=$timewall/ < $case.$mach.run >! temp
   /bin/mv temp  $case.$mach.run
 endif
 
@@ -418,16 +444,23 @@
   sed -e s/$QUEUE[3]/$queue/ < $case.$mach.run >! temp
   /bin/mv temp  $case.$mach.run
 endif
+chmod 0744 $case.$mach.run
 
 # ====================================================================
-# Submit job  
+# Submit job
 # ====================================================================
 
-echo 
-echo 'Job ready to be submitted here'
-echo "cd into $caseroot and run: ./$case.$mach.submit"
-echo 
+set MYSTRING = `grep "set DARTDIR" assimilate.csh`
+set DARTDIR = $MYSTRING[4]
 
+echo ''
+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 $caseroot
 #  ./$case.$mach.submit
 

Modified: DART/branches/development/models/cam/shell_scripts/setup_cesm_case.pmo.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/setup_cesm_case.pmo.csh	2011-12-14 23:24:07 UTC (rev 5448)
+++ DART/branches/development/models/cam/shell_scripts/setup_cesm_case.pmo.csh	2011-12-14 23:28:55 UTC (rev 5449)
@@ -1,58 +1,66 @@
 #!/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: setup_cesm_case.hopper.csh 5404 2011-11-16 15:30:00Z nancy $
-#
-# ====================================================================
-#
+# $Id: CESM_setup_zagar.csh 5444 2011-12-14 22:22:12Z thoar $
+
 # ---------------------
 # Purpose
 # ---------------------
-# 
+#
+# The real purpose of this set of notes is to record what is needed to configure
+# and build a CESM instance that has CAM, CLM, and CICE as active components
+# in a multi-instance configuration over a single data ocean ... etc.
+# Despite looking like a script, it might best be used as a set of notes.
 # ---------------------
 # How to set the script
 # ---------------------
 # -- Copy this script into your directory
 # -- Choose a case name (by changing "setenv case" ) and save the script as $case.csh
-# -- Set the case options at the top of the script 
-# -- If you have source mods, the script assumes that your mods are in: mods_$case. 
+# -- Set the case options at the top of the script
+# -- 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 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
-# -- 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. 
+# -- 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.
-# 
+#
 # ---------------------
 # Important features
 # ---------------------
-# -- If you want to change something in your case other than the runtime settings above,
-#    you need to delete everything and start the run from scratch. 
+#
+# 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.
+#
+# ./${CASENAME}.*.clean_build
+# ./configure -cleanall
 
 # ====================================================================
 # ====  Set case options
-# ==================================================================== 
+# ====================================================================
 
 # ======================
-# case settings 
+# case settings
 # ======================
 
-# according to docs, F == F_2000
 # beta05 is also available, but i'm still using 04 for now
 # because i have a fixed copy in my home directory.
-setenv ccsmtag       cesm1_1_beta04
-setenv case          F_PMO_Z
-setenv compset       F_2000
-setenv resolution    f09_f09   
+setenv ccsmtag        cesm1_1_beta04
+setenv case           F_PMO_Z
+setenv compset        F_2000
+setenv resolution     f09_f09
+setenv num_instances  1
 
+# had to edit the following to remove the LSB_PJL_... word too long error
+# /glade/home/thoar/cesm1_1_beta04/scripts/ccsm_utils/Machines/mkbatch.bluefire
+# as long as OMP_NUM_THREADS == 1 ... the default is fine.
 
 # ================================
-#  define machines and directories 
+# define machines and directories
 # ================================
 
 # my home, and temp/scratch space
@@ -60,7 +68,7 @@
 setenv my_scratch $SCRATCH
 
 setenv mach hopp2                                       ;# machine - must match cesm names
-setenv cesm_public /project/projectdirs/ccsm1
+setenv cesm_datadir /project/projectdirs/ccsm1/inputdata
 
 setenv ccsmroot ${my_home}/${ccsmtag}                   ;# this is where the cesm code lives
 #setenv ccsmroot ${cesm_public}/collections/${ccsmtag}  ;# this is where the cesm code lives
@@ -69,6 +77,8 @@
 setenv lockroot ${my_home}/locked_cases                 ;## locked cases
 setenv rundir ${my_scratch}/${case}
 
+setenv DARTdir ${my_home}/devel
+
 # for data files not in the public cems area
 setenv my_datadir ${my_scratch}/cesm_datafiles
 
@@ -76,192 +86,207 @@
 # clear out previous builds
 # ======================
 
-echo removing old files from $caseroot and $rundir
-rm -fr $caseroot
-rm -fr $rundir
+echo "removing old files from ${caseroot} and ${rundir}"
+\rm -fr ${caseroot}
+\rm -fr ${rundir}
 
 # ======================
 # configure settings
 # ======================
 
-setenv num_instances    1
-
 setenv run_startdate 2008-08-01
 
-setenv sst_dataset $my_datadir/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
+setenv sst_dataset ${cesm_datadir}/atm/cam/sst/sst_HadOIBl_bc_0.9x1.25_1850_2011_c110307.nc
 setenv year_start  1850
 setenv year_end    2010
 
 # ======================
-# job settings to alter in run script
+# runtime settings
 # ======================
 
-setenv queue     premium
-setenv timewall  00:40:00
+setenv resubmit      0
+setenv stop_n        12
+setenv stop_option   nhours
 
 # ======================
-# runtime settings
+# job settings
 # ======================
 
-# each 'job' is 12 hours, so 8 resubmits should be 4 full days
-setenv resubmit      0  
-setenv stop_n        12
-setenv stop_option   nhours
+setenv timewall     00:40:00
+setenv queue        premium
 
 # ======================
 # namelist variables
 # ======================
-# We create namelist templates that get copied once the case has been configured.
+# Create namelist templates that get copied once the case has been configured.
 
 setenv this_dir `pwd`
 
 cat <<EOF >! user_nl_cam_${case}
 &camexp
- inithist                   = 'ENDOFRUN'
- div24del2flag              = 4
- bndtvghg                   = '${cesm_public}/inputdata/atm/cam/ggas/ghg_rcp45_1765-2500_c100405.nc'
- prescribed_ozone_datapath  = '${cesm_public}/inputdata/atm/cam/ozone'
- prescribed_ozone_file      = 'ozone_1.9x2.5_L26_1850-2015_rcp45_c101108.nc'
- prescribed_ozone_name      = 'O3'
- prescribed_ozone_type      = 'INTERP_MISSING_MONTHS'
- prescribed_volcaero_datapath = "$my_datadir"
- prescribed_volcaero_file   = 'CCSM4_volcanic_1850-2011_prototype1.nc'
- solar_data_file            = '${cesm_public}/inputdata/atm/cam/solar/SOLAR_TSI_Lean_1610-2140_annual_c100301.nc'
- prescribed_aero_datapath   = '${cesm_public}/inputdata/atm/cam/chem/trop_mozart_aero/aero'
- prescribed_aero_file       = 'aero_rcp45_v1_1.9x2.5_L26_1995-2105_c100316.nc'
- aerodep_flx_datapath       = "$my_datadir"
- aerodep_flx_file           = 'aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
+ 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
+ empty_htapes                 = .true.
+ nhtfrq                       = -12
 /
 EOF
 
- #aerodep_flx_datapath       = '${cesm_public}/inputdata/atm/cam/chem/trop_mozart_aero/aero'
- #prescribed_volcaero_file   = 'CCSM4_volcanic_1850-2011_prototype1.nc'
- 
 cat <<EOF >! user_nl_clm_${case}
 &clmexp
-  fsurdat  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr1850_c091006.nc'
-  fpftdyn  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp2.6_simyr1850-2100_c100323.nc'
-  faerdep  = "$my_datadir/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc"
+  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.
+  hist_nhtfrq = -12
+  hist_empty_htapes = .true.
 /
 EOF
 
-  #fsurdat  = '${cesm_public}/inputdata/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr2000_c100505.nc'
-
-
 # ====================================================================
 # ====  End of case options
-# ==================================================================== 
+# ====================================================================
 
 # ====================================================================
-# Create a new case, configure, and build 
-# for list of the cases: ./create_newcase -list
+# Create a new case, configure, and build.
+# For list of the cases: ./create_newcase -list
 # ====================================================================
 
-cd  $ccsmroot/scripts
-./create_newcase -case $caseroot -mach $mach -res $resolution -compset $compset -skip_rundb  
+${ccsmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
+                -res ${resolution} -compset ${compset} -skip_rundb
 
-cd $caseroot
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be created."
+   exit 1
+endif
 
+cd ${caseroot}
+
+./xmlchange -file env_build.xml    -id EXEROOT        -val ${rundir}
 ./xmlchange -file env_build.xml    -id USE_ESMF_LIB   -val TRUE
-./xmlchange -file env_build.xml    -id ESMF_LIBDIR    -val ${my_scratch}/esmf-mpi
+#./xmlchange -file env_build.xml    -id ESMF_LIBDIR    -val ${nancy_scratch}/esmf-mpi
 
-# number of instances == ensemble size
-./xmlchange -file env_mach_pes.xml -id NINST_ATM -val $num_instances
-./xmlchange -file env_mach_pes.xml -id NINST_LND -val $num_instances
-./xmlchange -file env_mach_pes.xml -id NINST_ICE -val $num_instances
-
-# was 12 when nthreads was 1
-set num_tasks_per_instance = 8
+set num_tasks_per_instance = 12
 set nthreads = 1
 @ total_nt = $num_instances * $num_tasks_per_instance
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_ATM -val '0'
+./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_ATM -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_ATM -val $num_instances
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_LND -val '0'
+./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_LND -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_LND -val $num_instances
 
-./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val "$total_nt"
-./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val "$nthreads"
-./xmlchange -file env_mach_pes.xml -id ROOTPE_ICE -val '0'
-   
+./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val $total_nt
+./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val $nthreads
+./xmlchange -file env_mach_pes.xml -id ROOTPE_ICE -val 0
+./xmlchange -file env_mach_pes.xml -id  NINST_ICE -val $num_instances
 
 ./xmlchange -file env_conf.xml -id RUN_TYPE                -val startup
 ./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 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 CLM_CONFIG_OPTS         -val '-bgc cn -rtm off'
+./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 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
+./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
 
-# Have not sorted out the archiving just yet ... turning it off for now.
+# 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      -val 'TRUE' 
-./xmlchange -file env_run.xml -id DOUT_L_MS   -val 'TRUE' 
-./xmlchange -file env_run.xml -id DOUT_S_SAVE_INT_REST_FILES      -val 'TRUE'
+./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
 
-#------------------
-#  Create namelist template: user_nl_cam 
-#------------------
+# ====================================================================
+# Create namelist template: user_nl_cam
+# ====================================================================
 
 \mv -f ${this_dir}/user_nl_cam_{$case} ${caseroot}/user_nl_cam
 \mv -f ${this_dir}/user_nl_clm_{$case} ${caseroot}/user_nl_clm
 
-# FIXME: updated source files
+# ====================================================================
+# Update source files if need be
+# ====================================================================
 cp ~/cesm_mods/seq*F90  $caseroot/SourceMods/src.drv
 cp ~/cesm_mods/hist*F90 $caseroot/SourceMods/src.clm
-echo updated source files not in standard distribution:
-ls -l $caseroot/SourceMods/src.drv/*
-ls -l $caseroot/SourceMods/src.clm/*
 
-#------------------
-# configure
-#------------------
+if ( $status == 0) then
+   echo "FYI - Local Source Modifications used for this case:"
+   ls -lr ${caseroot}/SourceMods/*
+else
+   echo "FYI - No SourceMods for this case"
+endif
 
-  cd $caseroot
-  ./configure -case
+# ====================================================================
+# Configure
+# ====================================================================
 

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list