[Dart-dev] [5480] DART/branches/development/models/cam/shell_scripts: Streamlined version of scripts/files for a CESM 'startup' and assimilation .
nancy at ucar.edu
nancy at ucar.edu
Fri Jan 6 16:54:24 MST 2012
Revision: 5480
Author: thoar
Date: 2012-01-06 16:54:24 -0700 (Fri, 06 Jan 2012)
Log Message:
-----------
Streamlined version of scripts/files for a CESM 'startup' and assimilation.
This is probably the one to use for the CAPT/CAM assimilation.
The CAM 'initial' files are used and restaged, so the short-term archiver
had to be substantially modified.
Modified Paths:
--------------
DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh
DART/branches/development/models/cam/shell_scripts/st_archive.sh
Added Paths:
-----------
DART/branches/development/models/cam/shell_scripts/assimilate.startup.csh
-------------- next part --------------
Modified: DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh 2012-01-06 23:48:40 UTC (rev 5479)
+++ DART/branches/development/models/cam/shell_scripts/CESM_setup_startup.csh 2012-01-06 23:54:24 UTC (rev 5480)
@@ -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.
@@ -38,50 +38,50 @@
#
# ./${CASENAME}.*.clean_build
# ./configure -cleanall
-
+#
# ====================================================================
-# ==== Set case options
+# === IMPORTANT modifications to the distribution code before ANYTHING
# ====================================================================
-# ======================
-# case settings
-# ======================
-
-#setenv case F_AMIP_CN
-#setenv compset F_AMIP_CN
- setenv case F2000
- setenv compset F_2000
-setenv ccsmtag cesm1_1_beta06
-setenv resolution f09_f09
-setenv num_instances 10
-
# 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
+# 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 startup1
+setenv compset F_2000
+setenv ccsmtag cesm1_1_beta04
+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 ccsmroot ${cesm_public}/collections/${ccsmtag} ;# location of the public cesm code
-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 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 DARTdir /glade/home/thoar/svn/DART/dev
-# ======================
-# clear out previous builds
-# ======================
+setenv ccsmroot /glade/home/thoar/${ccsmtag}
+#setenv ccsmroot ${cesm_public}/collections/${ccsmtag}
-echo "removing old files from ${caseroot} and ${rundir}"
-\rm -fr ${caseroot}
-\rm -fr ${rundir}
-
# ======================
# configure settings
# ======================
@@ -97,7 +97,7 @@
# ======================
setenv resubmit 0
-setenv stop_n 12
+setenv stop_n 6
setenv stop_option nhours
# ======================
@@ -105,68 +105,36 @@
# ======================
setenv proj 93300315
-setenv timewall 5:00
-setenv queue regular
+setenv timewall 1:00
+setenv queue lrg_regular
-# ======================
-# namelist variables
-# ======================
-# 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_datadir}/atm/cam/ggas/ghg_rcp45_1765-2500_c100405.nc'
- prescribed_ozone_datapath = '${cesm_datadir}/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 = '${cesm_datadir}/atm/cam/volc'
- prescribed_volcaero_file = 'CCSM4_volcanic_1850-2011_prototype1.nc'
- solar_data_file = '${cesm_datadir}/atm/cam/solar/SOLAR_TSI_Lean_1610-2140_annual_c100301.nc'
- prescribed_aero_datapath = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero'
- prescribed_aero_file = 'aero_rcp45_v1_1.9x2.5_L26_1995-2105_c100316.nc'
- aerodep_flx_datapath = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero'
- aerodep_flx_file = 'aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
-/
-EOF
-
-cat <<EOF >! user_nl_clm_${case}
-&clmexp
- fpftdyn = '${cesm_datadir}/lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp4.5_simyr1850-2100_c100406.nc'
- faerdep = '${cesm_datadir}/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1849-2104_0.9x1.25_c100407.nc'
-/
-EOF
-
# ====================================================================
-# ==== 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 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
-# Change Tools/Templates/cam.cpl7.template
-# ncdata = '${RUN_REFCASE}.cam.i.${RUN_REFDATE}-00000.nc'
-# to
-# ncdata = '${RUN_REFCASE}.cam_\$INST_ATM.i.${RUN_REFDATE}-${RUN_REFTOD}.nc'
+# ====================================================================
+# Configure the case.
+# ====================================================================
-# Add the RUN_REFTOD xml crap
-# cesm1_1_beta04/scripts/ccsm_utils/Case.template/config_definition.xml
-
-
cd ${caseroot}
./xmlchange -file env_build.xml -id EXEROOT -val ${rundir}
@@ -192,44 +160,72 @@
./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 hybrid
+./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 RUN_REFCASE -val ref_${case}
-./xmlchange -file env_conf.xml -id GET_REFCASE -val FALSE
-
-#./xmlchange -file env_conf.xml -id DOCN_SSTDATA_FILENAME -val $sst_dataset #TJH WARNING not being set in F2000!
-#./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 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_conf.xml -id CLM_CONFIG_OPTS -val '-bgc cn -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
+# Create namelist template: user_nl_cam, user_nl_clm
# ====================================================================
-\mv -f ${this_dir}/user_nl_cam_{$case} ${caseroot}/user_nl_cam
-\mv -f ${this_dir}/user_nl_clm_{$case} ${caseroot}/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
+
+# these cause problems when running with the full cesm:
+# 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'
+ 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_empty_htapes = .true.
+/
+EOF
+
+# these cause problems when running with the full cesm:
+# hist_nhtfrq = -12
+
# ====================================================================
# 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/*
@@ -242,6 +238,7 @@
# ====================================================================
cd ${caseroot}
+
./configure -case
if ( $status != 0 ) then
@@ -257,11 +254,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 Tools/.
-\cp -f ${DARTdir}/models/cam/shell_scripts/assimilate.csh .
+ln -sf ${DARTdir}/models/cam/shell_scripts/assimilate.startup.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 ''
@@ -292,7 +292,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)
@@ -368,24 +368,23 @@
tail -$lastlines ${case}.${mach}.run.orig >> ${case}.${mach}.run
# ====================================================================
-# IMPORTANT: All resubmits must be coldstarts.
+# IMPORTANT: All resubmits must be type 'startup'.
# 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 'Changing Tools/ccsm_postrun.csh such that all the resubmits are "startup",'
echo 'which means CONTINUE_RUN should be FALSE in ccsm_postrun.csh'
echo ''
-# TJH turning off to see what happens with a BRANCH run
-#ex ccsm_postrun.csh <<ex_end
-#/use COMP_RUN_BARRIERS as surrogate for timing run logical/
-#/CONTINUE_RUN/
-#s;TRUE;FALSE;
-#wq
-#ex_end
+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
@@ -411,6 +410,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}"
@@ -420,9 +420,9 @@
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
+ cp --preserve=timestamps ${stagedir}/CAM/caminput_${n}.nc ${rundir}/run/cam_initial_${n}.nc
+ cp --preserve=timestamps ${stagedir}/CLM/clminput_${n}.nc ${rundir}/run/clm_restart_${n}.nc
+ cp --preserve=timestamps ${stagedir}/ICE/iceinput_${n}.nc ${rundir}/run/ice_restart_${n}.nc
@ n++
end
@@ -462,8 +462,3 @@
echo "cd into ${caseroot} and run: ./$case.$mach.submit"
echo ''
-exit
-
-cd ${caseroot}
-./$case.$mach.submit
-
Added: DART/branches/development/models/cam/shell_scripts/assimilate.startup.csh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/assimilate.startup.csh (rev 0)
+++ DART/branches/development/models/cam/shell_scripts/assimilate.startup.csh 2012-01-06 23:54:24 UTC (rev 5480)
@@ -0,0 +1,433 @@
+#!/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 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 POINTER_FILENAME = `printf rpointer.atm_%04d ${member}`
+
+ set ATM_HISTORY_FILENAME = `ls -1 ../../*.h0.* | head -1`
+ set ATM_RESTART_FILENAME = `head -1 ../../${POINTER_FILENAME}`
+ set ATM_INITIAL_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+
+ ${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_RESTART_FILENAME = `head -1 ../rpointer.atm_0001`
+set ATM_INITIAL_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+set ATM_HISTORY_FILENAME = `ls -1 ../*.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
+
+#-------------------------------------------------------------------------
+# Block 4: The cam files have now been updated, move them into position.
+#-------------------------------------------------------------------------
+
+set member = 1
+while ( ${member} <= ${ensemble_size} )
+
+ cd member_${member}
+
+ set LND_POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
+ set ICE_POINTER_FILENAME = `printf rpointer.ice_%04d ${member}`
+ set ATM_POINTER_FILENAME = `printf rpointer.atm_%04d ${member}`
+
+ set LND_RESTART_FILENAME = `head -1 ../../${LND_POINTER_FILENAME}`
+ set ICE_RESTART_FILENAME = `head -1 ../../${ICE_POINTER_FILENAME}`
+ set ATM_RESTART_FILENAME = `head -1 ../../${ATM_POINTER_FILENAME}`
+ set ATM_INITIAL_FILENAME = `echo ${ATM_RESTART_FILENAME} | sed "s#\.r\.#\.i\.#"`
+
+ # As implemented, the input filenames are static in the namelists.
+ # In order to archive the 'dynamic' files (i.e. with the dates)
+ # and restage the 'static' files, we must copy the updated files
+ # to the static names.
+ #
+ # IMPORTANT: The Tools/st_archive.sh script must be substantially modified.
+
+ ${COPY} ../../$LND_RESTART_FILENAME ../../clm_restart_${member}.nc
+ ${COPY} ../../$ICE_RESTART_FILENAME ../../ice_restart_${member}.nc
+ ${COPY} ../../$ATM_INITIAL_FILENAME ../../cam_initial_${member}.nc
+
+ cd ..
+
+ @ member++
+end
+
+#-------------------------------------------------------------------------
+# Now that everything is staged, 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
+#-------------------------------------------------------------------------
+
+ex ${CASEROOT}/Buildconf/cpl.buildnml.csh << ex_end
+g; start_ymd;s;=[ ]*.*;= ${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY};
+g; start_tod;s;=[ ]*.*;= $MODEL_SECONDS;
+wq
+ex_end
+
+#-------------------------------------------------------------------------
+# 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.startup.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/st_archive.sh
===================================================================
--- DART/branches/development/models/cam/shell_scripts/st_archive.sh 2012-01-06 23:48:40 UTC (rev 5479)
+++ DART/branches/development/models/cam/shell_scripts/st_archive.sh 2012-01-06 23:54:24 UTC (rev 5480)
@@ -178,8 +178,8 @@
set ${CASE}.cam${inst_suffix}.h4.*; dispose ifiles_n ${sta}/atm/hist $*
set ${CASE}.cam${inst_suffix}.h5.*; dispose ifiles_n ${sta}/atm/hist $*
set ${CASE}.cam${inst_suffix}.hs.*; dispose ifiles_n ${sta}/atm/hist $*
- set ${CASE}.cam${inst_suffix}.i.*; dispose ifiles_y ${sta}/atm/init $*
- set cam_initial_${IDX}.nc; latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/init $*
+ set ${CASE}.cam${inst_suffix}.i.*; dispose ifiles_n ${sta}/atm/init $*
+ set cam_initial_${IDX}.nc; latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/rest $*
set ${CASE}.camice${inst_suffix}.r.*; dispose ifiles_y ${sta}/ice/rest $*
set ${CASE}.camdom${inst_suffix}.r.*; dispose ifiles_y ${sta}/ocn/rest $*
set ${CASE}.camsom${inst_suffix}.r.*; dispose ifiles_y ${sta}/ocn/rest $*
@@ -196,7 +196,7 @@
get_inst_suffix $IDX $NINST_LND
set lnd${inst_suffix}.log.*; dispose ifiles_n ${sta}/lnd/logs $*
set clm_restart_${IDX}.nc; latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/lnd/rest $*
- set ${CASE}.clm?${inst_suffix}.r.*; dispose ifiles_y ${sta}/lnd/rest $*
+ set ${CASE}.clm?${inst_suffix}.r.*; dispose ifiles_n ${sta}/lnd/rest $*
set ${CASE}.clm?${inst_suffix}.rh0.*; dispose ifiles_y ${sta}/lnd/rest $*
set ${CASE}.clm?${inst_suffix}.rh1.*; dispose ifiles_y ${sta}/lnd/rest $*
set ${CASE}.clm?${inst_suffix}.rh2.*; dispose ifiles_y ${sta}/lnd/rest $*
@@ -224,6 +224,7 @@
get_inst_suffix $IDX $NINST_ICE
set ice${inst_suffix}.log.*; dispose ifiles_n ${sta}/ice/logs $*
set ice_restart_${IDX}.nc; latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/ice/rest $*
+ set ${CASE}.cice${inst_suffix}.r.*; dispose ifiles_n ${sta}/ice/rest $*
set ${CASE}.cice${inst_suffix}.r.[0-9]*; dispose ifiles_y ${sta}/ice/rest $*
set ${CASE}.cice${inst_suffix}.r.volpn*; dispose ifiles_y ${sta}/ice/rest $*
set ${CASE}.cice${inst_suffix}.r.dEdd*; dispose ifiles_y ${sta}/ice/rest $*
More information about the Dart-dev
mailing list