[Dart-dev] [5463] DART/branches/development/models/cam/shell_scripts: This is the configuration I (Tim) have run with on

nancy at ucar.edu nancy at ucar.edu
Fri Dec 16 20:59:43 MST 2011


Revision: 5463
Author:   thoar
Date:     2011-12-16 20:59:43 -0700 (Fri, 16 Dec 2011)
Log Message:
-----------
This is the configuration I (Tim) have run with on
bluefire to replicate the Zagar perfect model experiment.
The assimilate.zagar.csh script has been modified since it
worked to try to speed up the dart_to_cam portion. In order
to run dart_to_cam in parallel ... I had to wait for all
them to finish before going back and moving them into 
place. There's some extra filename parsing, but it is 
required to not screw up the short-term archiver. (I think.)
Anyway ... the test is in, we'll know in the morning.

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

Added Paths:
-----------
    DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar_pmo.csh
    DART/branches/development/models/cam/shell_scripts/assimilate.zagar.csh

-------------- next part --------------
Modified: DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar.csh	2011-12-16 21:07:14 UTC (rev 5462)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar.csh	2011-12-17 03:59:43 UTC (rev 5463)
@@ -38,50 +38,42 @@
 #
 # ./${CASENAME}.*.clean_build
 # ./configure -cleanall
+#
+# ====================================================================
+# === IMPORTANT modifications to the distribution code before ANYTHING 
+# ====================================================================
 
+# had to edit the following to remove the LSB_PJL_... word too long error
+# cesm1_1_beta04/scripts/ccsm_utils/Machines/mkbatch.bluefire
+# as long as OMP_NUM_THREADS == 1 ... the default is fine.
+
 # ====================================================================
 # ====  Set case options
 # ====================================================================
 
-# ======================
-# case settings
-# ======================
-
  setenv case          Fzagar
  setenv compset       F_2000
 setenv ccsmtag        cesm1_1_beta04
 setenv resolution     f09_f09
 setenv num_instances  80
+setenv coldbuild      false
 
-# 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
 # ================================
 
-# setenv ccsmroot ${cesm_public}/collections/${ccsmtag} ;# location of the public cesm code
+setenv mach bluefire                                  ;# machine
+setenv DARTdir /glade/home/thoar/svn/DART/dev         ;# 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 cesm_public  /glade/proj3/cseg                 ;# location of public CESM sandbox
 setenv cesm_datadir /glade/proj3/cseg/inputdata
-setenv ccsmroot /glade/home/thoar/${ccsmtag}        ;# location of your personal cesm code
-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 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 ccsmroot ${cesm_public}/collections/${ccsmtag} ;# location of the public cesm code
+setenv ccsmroot /glade/home/thoar/${ccsmtag}          ;# location of your personal cesm code
 
 # ======================
-# clear out previous builds
-# ======================
-
-echo "removing old files from ${caseroot} and ${rundir}"
-\rm -fr ${caseroot}
-\rm -fr ${rundir}
-
-# ======================
 # configure settings
 # ======================
 
@@ -104,13 +96,13 @@
 # ======================
 
 setenv proj         93300315
-setenv timewall     5:00
-setenv queue        regular
+setenv timewall     2:30
+setenv queue        lrg_regular
 
 # ======================
 # namelist variables
 # ======================
-# Create namelist templates that get copied once the case has been configured.
+# Create namelist templates that get copied once the case has been created.
 
 setenv this_dir `pwd`
 
@@ -123,38 +115,48 @@
  aerodep_flx_cycle_yr         = 2000
  aerodep_flx_type             = 'CYCLICAL'
  iradae                       = -12
- empty_htapes                 = .true.
- nhtfrq                       = -12
 /
 EOF
+#  empty_htapes                 = .true.
+#  nhtfrq                       = -12
 
 cat <<EOF >! user_nl_clm_${case}
 &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.
-  hist_nhtfrq = -12
-  hist_empty_htapes = .true.
 /
 EOF
+#   hist_nhtfrq = -12
+#   hist_empty_htapes = .true.
 
 # ====================================================================
-# ====  End of case options
-# ====================================================================
-
-# ====================================================================
-# Create a new case, configure, and build.
+# Create the case.
 # For list of the cases: ./create_newcase -list
 # ====================================================================
 
-${ccsmroot}/scripts/create_newcase -case ${caseroot} -mach ${mach} \
-                -res ${resolution} -compset ${compset} -skip_rundb
+# if coldbuild is false and the directory does not exist, ...
 
-if ( $status != 0 ) then
-   echo "ERROR: Case could not be created."
-   exit 1
+if ("${coldbuild}" == "true") 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}
 
 ./xmlchange -file env_build.xml    -id EXEROOT        -val ${rundir}
@@ -241,11 +243,14 @@
 
 \mv Tools/st_archive.sh Tools/st_archive.sh.org
 \cp -f ${DARTdir}/models/cam/shell_scripts/st_archive.sh Tools/st_archive.sh
+# only needed for beta04 - fixed in more recent versions
+\cp -f ${ccsmroot}/scripts/ccsm_utils/Tools/lt_archive.csh .
 
 \cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.zagar.csh assimilate.csh
 
 # ====================================================================
-# update the namelists and scripts as needed
+# Update the scripts that build the namelists.
+# The active components scripts need to support the multi-instance naming.
 # ====================================================================
 
 echo ''
@@ -276,7 +281,7 @@
 wq
 ex_end
 
-# The CLM buildnml script needs changing in MANY places.
+# The CLM buildnml script needs changing in MULTIPLE places.
 
 @ n = 1
 while ($n <= $num_instances)
@@ -445,8 +450,7 @@
 echo "cd into ${caseroot} and run: ./$case.$mach.submit"
 echo ''
 
-exit
 
-cd ${caseroot}
-./$case.$mach.submit
+#  cd $caseroot
+#  ./$case.$mach.submit
 

Added: DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar_pmo.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar_pmo.csh	                        (rev 0)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_zagar_pmo.csh	2011-12-17 03:59:43 UTC (rev 5463)
@@ -0,0 +1,467 @@
+#!/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$
+
+# ---------------------
+# 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.
+#    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
+# -- 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,
+# you need to delete everything and start the run from scratch.
+#
+# ./${CASENAME}.*.clean_build
+# ./configure -cleanall
+#
+# ====================================================================
+# === IMPORTANT modifications to the distribution code before ANYTHING 
+# ====================================================================
+
+# had to edit the following to remove the LSB_PJL_... word too long error
+# cesm1_1_beta04/scripts/ccsm_utils/Machines/mkbatch.bluefire
+# as long as OMP_NUM_THREADS == 1 ... the default is fine.
+
+# ====================================================================
+# ====  Set case options
+# ====================================================================
+
+ setenv case          Fzagar_pmo
+ setenv compset       F_2000
+setenv ccsmtag        cesm1_1_beta04
+setenv resolution     f09_f09
+setenv num_instances  1
+setenv coldbuild      false
+
+# ================================
+# define machines and directories
+# ================================
+
+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 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 ccsmroot ${cesm_public}/collections/${ccsmtag} ;# location of the public cesm code
+setenv ccsmroot /glade/home/thoar/${ccsmtag}          ;# location of your personal cesm code
+
+# ======================
+# configure settings
+# ======================
+
+setenv run_startdate 2008-08-01
+
+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
+
+# ======================
+# runtime settings
+# ======================
+
+setenv resubmit      0
+setenv stop_n        12
+setenv stop_option   nhours
+
+# ======================
+# job settings
+# ======================
+
+setenv proj         93300315
+setenv timewall     1:00
+setenv queue        premium
+
+# ======================
+# namelist variables
+# ======================
+# Create namelist templates that get copied once the case has been created.
+
+setenv this_dir `pwd`
+
+cat <<EOF >! user_nl_cam_${case}
+&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
+
+# kevin had these in his cam namelist but they seem to cause
+# problems with the restart files with cesm.
+#  empty_htapes                 = .true.
+#  nhtfrq                       = -12
+
+cat <<EOF >! user_nl_clm_${case}
+&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.
+/
+EOF
+
+# where it would be in the cesm datadir; not on hopper:
+#  faerdep  = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
+
+# kevin had these in his clm namelist but they seem to cause
+# problems with the restart files with cesm.
+#  hist_nhtfrq = -12
+#  hist_empty_htapes = .true.
+
+# ====================================================================
+# Create the case.
+# For list of the cases: ./create_newcase -list
+# ====================================================================
+
+# if coldbuild is false and the directory does not exist, ...
+
+if ("${coldbuild}" == "true") 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}
+
+./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 ${nancy_scratch}/esmf-mpi
+
+set num_tasks_per_instance = 16
+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  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  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  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 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 '-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
+
+# 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 FALSE
+./xmlchange -file env_run.xml -id DOUT_S_SAVE_INT_REST_FILES -val FALSE
+./xmlchange -file env_run.xml -id DOUT_L_MS                  -val FALSE
+./xmlchange -file env_run.xml -id DOUT_L_HTAR                -val FALSE
+
+echo ALL ARCHIVING DISABLED
+
+# ====================================================================
+# 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
+
+# ====================================================================
+# Update source files if need be
+# ====================================================================
+
+\cp -rf ~/${ccsmtag}/SourceMods/* ${caseroot}/SourceMods/
+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
+
+# ====================================================================
+# Configure
+# ====================================================================
+
+cd ${caseroot}
+./configure -case
+
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be configured."
+   exit 2
+endif
+
+# ====================================================================
+# Stage a copy of the DART pmo.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
+# only needed for beta04 - fixed in more recent versions
+\cp -f ${ccsmroot}/scripts/ccsm_utils/Tools/lt_archive.csh Tools/lt_archive.csh
+
+\cp -f ${DARTdir}/models/cam/shell_scripts/pmo.ned.csh pmo.csh
+
+# ====================================================================
+# Update the scripts that build the namelists.
+# The active components scripts need to support the multi-instance naming.
+# ====================================================================
+
+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_initial_1.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_1.nc";
+wq
+ex_end
+
+# The CLM buildnml script needs changing in 1 place.
+
+ex clm.buildnml.csh <<ex_end
+/lnd_in/
+/finidat/
+s;= '.*';= "clm_restart_1.nc";
+wq
+ex_end
+
+chmod 0755 clm.buildnml.csh
+
+echo 'if you do a clean namelist, you must repeat the previous namelist update section.'
+echo ' ' 
+
+# ====================================================================
+# The *.run script must be modified to call the DART perfect model 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"
+# ====================================================================
+
+cd ${caseroot}
+
+echo ''
+echo 'Adding the call to pmo.csh to the *.run script.'
+echo ''
+
+cat << "EndOfText" >! add_to_run.txt
+
+# -------------------------------------------------------------------------
+# START OF DART: if CESM finishes correctly (pirated from ccsm_postrun.csh);
+# perform a perfect model run 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.'
+ exit -4
+endif
+
+grep 'SUCCESSFUL TERMINATION' $CplLogFile
+if ( $status == 0 ) then
+  ${CASEROOT}/pmo.csh
+
+  if ( $status == 0 ) then
+     echo "`date` -- DART HAS FINISHED"
+  else
+     echo "`date` -- DART ERROR - ABANDON HOPE"
+     exit -5
+  endif
+endif
+
+# END OF DART BLOCK
+# -------------------------------------------------------------------------
+
+"EndOfText"
+
+# 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
+
+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
+
+# ====================================================================
+# IMPORTANT: All resubmits must be coldstarts.
+# Change Tools/ccsm_postrun.csh line 83 to CONTINUE_RUN -val FALSE'
+# ====================================================================
+
+cd ${caseroot}/Tools
+
+echo ''
+echo 'Changing Tools/ccsm_postrun.csh such that all the resubmits are coldstarts,'
+echo 'which means CONTINUE_RUN should be FALSE in ccsm_postrun.csh'
+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
+
+# ====================================================================
+# build
+# ====================================================================
+
+cd ${caseroot}
+
+echo ''
+echo 'Building the case'
+echo ''
+
+./$case.$mach.build
+
+if ( $status != 0 ) then
+   echo "ERROR: Case could not be built."
+   exit 3
+endif
+
+# ====================================================================
+# Stage the restarts now that the run directory exists
+# ====================================================================
+
+# 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
+
+echo ''
+echo "Staging the restarts from {$stagedir}"
+echo ''
+
+@ n = 1
+while ($n <= $num_instances)
+
+   echo "Staging restarts for instance $n of $num_instances"
+   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
+
+echo 'If inflation is being used ... '
+echo "must stage a ${rundir}/[prior,pos]_inflate_restart.YYYY-MM-DD-SSSSS"
+
+# ====================================================================
+# Edit the run script to reflect project, queue, and wallclock
+# ====================================================================
+
+set PROJ=`grep BSUB $case.$mach.run | grep -e '-P' `
+sed s/$PROJ[3]/$proj/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+set TIMEWALL=`grep BSUB $case.$mach.run | grep -e '-W' `
+sed s/$TIMEWALL[3]/$timewall/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+set QUEUE=`grep BSUB $case.$mach.run | grep -e '-q' `
+sed s/$QUEUE[3]/$queue/ < $case.$mach.run >! temp
+/bin/mv temp  $case.$mach.run
+
+chmod 0774 $case.$mach.run
+
+# ====================================================================
+# Submit job
+# ====================================================================
+
+set MYSTRING = `grep "set DARTDIR" pmo.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
+


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

Added: DART/branches/development/models/cam/shell_scripts/assimilate.zagar.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/assimilate.zagar.csh	                        (rev 0)
+++ DART/branches/development/models/cam/shell_scripts/assimilate.zagar.csh	2011-12-17 03:59:43 UTC (rev 5463)
@@ -0,0 +1,430 @@
+#!/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}.r.2000-01-06-00000.nc"
+#-------------------------------------------------------------------------
+
+set FILE = `head -1 ../rpointer.atm_0001`
+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  OBSDIR = /glade/proj3/image/Observations/Synthetic/UVT_Set2_12H
+
+#-------------------------------------------------------------------------
+# DART COPY BLOCK
+# Populate a run-time directory with the bits needed to run DART
+#-------------------------------------------------------------------------
+
+foreach FILE ( input.nml.zagar filter cam_to_dart dart_to_cam )
+   if (  -e   ${DARTDIR}/models/cam/work/${FILE} ) then
+      ${COPY} ${DARTDIR}/models/cam/work/${FILE} .
+   else
+      echo "DART required file ${DARTDIR}/${FILE} not found ... ERROR"
+      exit 1
+   endif
+end
+
+${MOVE} input.nml.zagar input.nml
+
+${COPY} /glade/proj3/DART/raeder/FV1deg_4.0/cam_phis.nc .
+
+# 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
+
+#-------------------------------------------------------------------------
+# DART SAMPLING ERROR CORRECTION BLOCK
+# This stages the files needed for the 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
+
+#-------------------------------------------------------------------------
+# DART INFLATION BLOCK
+# 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 1: convert N cam restart files to DART initial conditions file(s)
+# cam_to_dart is serial code, we can do all of these at the same time
+# and just wait for them to finish IFF it were not for the fact we'd have
+# to have unique namelists for all of them.
+#
+# At the end of the 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 POINTER_FILENAME = `printf rpointer.atm_%04d ${member}`
+   set MODEL_RESTART_FILENAME = `head -1 ../../${POINTER_FILENAME}`
+   set MODEL_INITIAL_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+   ${LINK} ../../$MODEL_INITIAL_FILENAME caminput.nc
+   ${LINK} ../cam_phis.nc .
+
+   # TJH can we use a .h0. file instead of some arbitrary 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
+
+#-------------------------------------------------------------------------
+# Block 2: 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 always needs a cam_initial.nc and a cam_history.nc to start.
+
+set MODEL_RESTART_FILENAME = `head -1 ../rpointer.atm_0001`
+set MODEL_INITIAL_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+set MODEL_HISTORY_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s#\.r\.#\.h0\.#"`
+
+${LINK} ../$MODEL_INITIAL_FILENAME caminput.nc
+#${LINK} ../$MODEL_RESTART_FILENAME cam_restart.nc
+#${LINK} ../$MODEL_HISTORY_FILENAME cam_history.nc
+
+# stage the proper observation sequence file.
+
+set OBSFNAME = `printf syn_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 3: Update the cam restart files ... simultaneously ...
+#
+# 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.
+   # After they are all done, we can move them.
+
+   set MYTEMPDIR = member_${member}
+   mkdir -p $MYTEMPDIR
+   cd $MYTEMPDIR
+
+   set DART_RESTART_FILE = `printf filter_ic_new.%04d ${member}`
+   ${LINK} ../$DART_RESTART_FILE temp_ic
+
+   set ATM_POINTER_FILENAME = `printf rpointer.atm_%04d ${member}`
+   set LND_POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
+   set ICE_POINTER_FILENAME = `printf rpointer.ice_%04d ${member}`
+
+   set ATM_RESTART_FILENAME = `head -1 ../../${ATM_POINTER_FILENAME}`
+   set LND_RESTART_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.cam_#\.clm2_#"`
+   set ICE_RESTART_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.cam_#\.cice_#"`
+
+   set ATM_INITIAL_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+
+   ${LINK} ../../$ATM_INITIAL_FILENAME caminput.nc
+
+   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
+
+#-------------------------------------------------------------------------
+# Block 4: The cam files have now been updated, move them into position.
+#-------------------------------------------------------------------------
+
+set member = 1
+while ( ${member} <= ${ensemble_size} )
+
+   cd member_${member}
+
+   set ATM_POINTER_FILENAME = `printf rpointer.atm_%04d ${member}`
+   set LND_POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
+   set ICE_POINTER_FILENAME = `printf rpointer.ice_%04d ${member}`
+
+   set ATM_RESTART_FILENAME = `head -1 ../../${ATM_POINTER_FILENAME}`
+   set LND_RESTART_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.cam_#\.clm2_#"`
+   set ICE_RESTART_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.cam_#\.cice_#"`
+
+   set ATM_INITIAL_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+
+   ${COPY} ../../$ATM_INITIAL_FILENAME ../../cam_initial_${member}.nc
+   ${COPY} ../../$LND_RESTART_FILENAME ../../clm_restart_${member}.nc
+   ${COPY} ../../$ICE_RESTART_FILENAME ../../ice_restart_${member}.nc
+
+   cd ..
+
+   @ member++
+end
+

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list