[Dart-dev] [5750] DART/branches/development/models/clm/shell_scripts/assimilate_texas. csh: Changes to keep it more similar to what we use on other machines.

nancy at ucar.edu nancy at ucar.edu
Wed Jun 6 16:35:29 MDT 2012


Revision: 5750
Author:   thoar
Date:     2012-06-06 16:35:29 -0600 (Wed, 06 Jun 2012)
Log Message:
-----------
Changes to keep it more similar to what we use on other machines.
Actual command locations, etc. Fei will test at her leisure.

Modified Paths:
--------------
    DART/branches/development/models/clm/shell_scripts/assimilate_texas.csh

-------------- next part --------------
Modified: DART/branches/development/models/clm/shell_scripts/assimilate_texas.csh
===================================================================
--- DART/branches/development/models/clm/shell_scripts/assimilate_texas.csh	2012-06-06 21:45:37 UTC (rev 5749)
+++ DART/branches/development/models/clm/shell_scripts/assimilate_texas.csh	2012-06-06 22:35:29 UTC (rev 5750)
@@ -1,4 +1,4 @@
-#!/usr/local/bin/tcsh
+#!/bin/csh -f
 #
 # 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
@@ -8,23 +8,18 @@
 
 # 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   MOVE = '/bin/mv -fv'
+set   COPY = '/bin/cp -fv --preserve=timestamps'
+set   LINK = '/bin/ln -fvs'
+set REMOVE = '/bin/rm -fr'
+set LAUNCHCMD = mpirun.lsf
 
 set ensemble_size = ${NINST_LND}
 
 # Create temporary working directory for the assimilation
 set temp_dir = assimilate_dir
 echo "temp_dir is $temp_dir"
-
-# Create a clean temporary directory and go there
-if ( -d $temp_dir ) then
-   ${REMOVE} $temp_dir/*
-else
-   mkdir -p $temp_dir
-endif
+mkdir -p $temp_dir
 cd $temp_dir
 
 #-------------------------------------------------------------------------
@@ -35,136 +30,242 @@
 set FILE = `head -1 ../rpointer.lnd_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"
+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
+# Get observation sequence file ... or die right away. Cannot specify -f on
+# the link command and still check status.
 #-----------------------------------------------------------------------------
 
-set DARTDIR = ${HOME}/DART/models/clm/work
-
 set DART_OBS_DIR = ${MODEL_YEAR}${MODEL_MONTH}
-set  OBSDIR = /ptmp/dart/Obs_sets/clm/${DART_OBS_DIR}
+set OBSDIR = ${WORK}/DART/observations/snow/work/obs_seqs
+set OBSFNAME = obs_seq.0Z.${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY}
+set OBS_FILE = ${OBSDIR}/${OBSFNAME}
 
-#-------------------------------------------------------------------------
-# DART COPY BLOCK
-# Populate a run-time directory with the bits needed to run DART
-# Either get them from the CCSM 'run' directory or some stock repository
-# The grid files are absolute paths ... so they need not move.
-#-------------------------------------------------------------------------
+\rm -f              obs_seq.out
+\ln -vs ${OBS_FILE} obs_seq.out
 
-foreach FILE ( input.nml filter clm_to_dart dart_to_clm )
+set lnstat = $status
+if ($lnstat != 0) then
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... ln died with status $lnstat"
+   exit 1
+endif
 
-   if ( -e ${CASEROOT}/${FILE} ) then
-      ${COPY}   ${CASEROOT}/${FILE} .
-   else if ( -e    ../${FILE} ) then
-      ${COPY} ../${FILE} .
-   else if ( -e ${DARTDIR}/${FILE} ) then
-      ${COPY}   ${DARTDIR}/${FILE} .
-   else
-      echo "DART required file $FILE not found ... ERROR"
-      exit 1
-   endif
+#=========================================================================
+# Block 1: Populate a run-time directory with the input needed to run DART.
+#=========================================================================
 
-end
+if (  -e   ${CASEROOT}/input.nml ) then
+   ${COPY} ${CASEROOT}/input.nml .
+else
+   echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
+   echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
+   exit 1
+endif
 
-#-------------------------------------------------------------------------
-# This is the file for the sampling error correction.
-# Each ensemble size has its own file.
-# It is static - it does not need to be archived, etc.
-# It is only needed if
+# 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
+#
+# The sampling error correction is a lookup table. The tables are stored
+# in the DART distribution. 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 SAMP_ERR_FILE = ${DARTDIR}/system_simulation/final_full.${ensemble_size}
+set DARTDIR = ${WORK}/DART/models/clm/work
 
-if ( -e ${SAMP_ERR_FILE}/ ) then
-   ${COPY} ${SAMP_ERR_FILE} .
+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 "WARNING: no sampling error correction file for this ensemble size."
-   echo "warning: looking for system_simulation/final_full.${ensemble_size}"
+   echo "Sampling Error Correction not requested for this assimilation."
 endif
 
-#-------------------------------------------------------------------------
-# DART INFLATION BLOCK
+#=========================================================================
+# 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 we are in a 'restart' mode.
+# 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',
 #
-# This is a 'test' configuration for this script. We are simply
-# assuming that the namelist values are set such that we need this file,
-# and that it is called 'prior_inflate_ics'. Since the inflation file is
-# essentially a duplicate of the model state ... it is slaved to a specific
-# geometry. I created the file offline.  The inflation values are all unity.
+# 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 strategy is to use the LATEST inflation file from CENTRALDIR if one exists -
+# 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
 #
-# After an assimilation, the output file will be copied back to CENTRALDIR
-# to be used for subsequent assimilations.
-#-------------------------------------------------------------------------
+# 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 ...
+#=========================================================================
 
-foreach FILE ( prior post )
+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]
 
-   # These files may or may not exist. This causes some complexity.
-   # So - we look for the 'newest' and use it. And Pray.
+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]`
 
-   (ls -rt1 ../${FILE}_inflate.*.restart.* | tail -1 >! latestfile) > & /dev/null
+# 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 ${FILE}_inflate_ics
+      ${LINK} $latest ${PRIOR_INF_IFNAME}
    else
-      # MUST HAVE inf_initial_from_restart = .false.
-      echo "WARNING: no incoming ${FILE}_inflate.YYYY-MM-DD-00000.restart.endiansuffix"
+      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
 
-end
+# POSTERIOR: We look for the 'newest' and use it - IFF we need it.
 
-#-------------------------------------------------------------------------
-# Block 1: convert N clm restart files to DART initial conditions file(s)
+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 CLM restart files to DART initial condition files.
 # clm_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.
+# as long as we can have unique namelists for all of them.
 #
-# At the end of the block, we have DART restart files  filter_ics.[1-N]
-# that came from pointer files ../rpointer.lnd_[1-N]
-#
 # DART namelist settings appropriate/required:
 # &filter_nml:           restart_in_file_name    = 'filter_ics'
 # &ensemble_manager_nml: single_restart_file_in  = '.false.'
-# &clm_to_dart_nml:      clm_to_dart_output_file = 'dart.ud',
-#-------------------------------------------------------------------------
+# &clm_to_dart_nml:      clm_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
+   # they all read their OWN 'input.nml'
 
    set MYTEMPDIR = member_${member}
    mkdir -p $MYTEMPDIR
    cd $MYTEMPDIR
 
-   set POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
-   set MODEL_RESTART_FILENAME = `head -1 ../../${POINTER_FILENAME}`
-   set MODEL_HISTORY_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s/\.r\./\.h0\./"`
-   ${LINK} ../../$MODEL_RESTART_FILENAME clm_restart.nc
-   ${LINK} ../../$MODEL_HISTORY_FILENAME clm_history.nc
+   set LND_RESTART_FILENAME = `printf ../../${MYCASE}.clm2_%04d.r.${MODEL_DATE_EXT}.nc  ${member}`
+   set LND_HISTORY_FILENAME = `printf ../../${MYCASE}.clm2_%04d.h0.${MODEL_DATE_EXT}.nc ${member}`
+   set     DART_IC_FILENAME = `printf ../filter_ics.%04d ${member}`
 
+   ${LINK} $LND_RESTART_FILENAME clm_restart.nc
+   ${LINK} $LND_HISTORY_FILENAME clm_history.nc
+   ${LINK}     $DART_IC_FILENAME dart_ics
+
    # patch the CLM restart files to ensure they have the proper
    # _FillValue and missing_value attributes.
    ncatted -O -a    _FillValue,frac_sno,o,d,1.0e+36   clm_restart.nc
@@ -178,13 +279,10 @@
    ncatted -O -a    _FillValue,T_SOISNO,o,d,1.0e+36   clm_restart.nc
    ncatted -O -a missing_value,T_SOISNO,o,d,1.0e+36   clm_restart.nc
 
-   # the slash in the filename screws up 'sed' ... unless
-   set DART_IC_FILE = `printf ..\\/filter_ics.%04d ${member}`
+   cp ../input.nml .
 
-   sed -e "s/dart.ud/${DART_IC_FILE}/" < ../input.nml >! input.nml
-
    echo "starting clm_to_dart for member ${member} at "`date`
-   ../clm_to_dart >! output.${member}.clm_to_dart &
+   ${EXEROOT}/clm_to_dart >! output.${member}.clm_to_dart &
    echo "finished clm_to_dart for member ${member} at "`date`
 
    cd ..
@@ -194,8 +292,14 @@
 
 wait
 
-#-------------------------------------------------------------------------
-# Block 2: Actually run the assimilation.
+if ($status != 0) then
+   echo "ERROR ... DART died in 'clm_to_dart' ... ERROR"
+   echo "ERROR ... DART died in 'clm_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:
@@ -211,104 +315,62 @@
 # &filter_nml:           first_obs_seconds      = -1,
 # &filter_nml:           last_obs_days          = -1,
 # &filter_nml:           last_obs_seconds       = -1,
-# &ensemble_manager_nml: single_restart_file_in = '.false.'
+# &ensemble_manager_nml: single_restart_file_in = .false.
 #
-#-------------------------------------------------------------------------
+#=========================================================================
 
-# clm always needs a clm_restart.nc, and a clm_history.nc to start.
+# clm always needs a clm_restart.nc, clm_history.nc for geometry information, etc.
 
-set MODEL_RESTART_FILENAME = `head -1 ../rpointer.lnd_0001`
-set MODEL_HISTORY_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s/\.r\./\.h0\./"`
+set LND_RESTART_FILENAME = ../${MYCASE}.clm2_0001.r.${MODEL_DATE_EXT}.nc
+set LND_HISTORY_FILENAME = ../${MYCASE}.clm2_0001.h0.${MODEL_DATE_EXT}.nc
 
-${LINK} ../$MODEL_RESTART_FILENAME clm_restart.nc
-${LINK} ../$MODEL_HISTORY_FILENAME clm_history.nc
+${LINK} $LND_RESTART_FILENAME clm_restart.nc
+${LINK} $LND_HISTORY_FILENAME clm_history.nc
 
-# Determine proper observation sequence file.
+${LAUNCHCMD} ${EXEROOT}/filter || exit 7
+echo "assimilate:finished filter at "`date`
 
-set OBSFNAME = obs_seq.0Z.${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY}
-set OBS_FILE = ${OBSDIR}/${OBSFNAME}
-
-${LINK} ${OBS_FILE}   obs_seq.out
-
-# FIXME: special for trying out non-monotonic task layouts.
-# FIXME setenv ORG_PATH "${PATH}"
-# FIXME setenv LSF_BINDIR /contrib/lsf/tgmpatch
-# FIXME setenv PATH ${LSF_BINDIR}:${PATH}
-# FIXME setenv ORG_TASK_GEOMETRY "${LSB_PJL_TASK_GEOMETRY}"
-
-# layout: flat
-# FIXME setenv NANCY_GEOMETRY_54_1NODE \
-# FIXME 	"{(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)}";
-
-# FIXME setenv LSB_PJL_TASK_GEOMETRY "${NANCY_GEOMETRY_54_1NODE}"
-
-# FIXME which mpirun.lsf
-
-mpirun ./filter || exit 2
-
 ${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 INFLATION ( prior post )
-
-   if ( -e ${INFLATION}_inflate_restart ) then
-      # 1) rename file to reflect current date
-      # 2) move to CENTRALDIR so the DART INFLATION BLOCK works next time
-
-      ${MOVE} ${INFLATION}_inflate_restart ../${INFLATION}_inflate.${MODEL_DATE_EXT}.restart.be
+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 ${INFLATION}_inflate_restart for ${MODEL_DATE_EXT}"
+      echo "No ${FILE} for ${MODEL_DATE_EXT}"
    endif
-
-   if ( -e ${INFLATION}_inflate_diag ) then
-      ${MOVE} ${INFLATION}_inflate_diag ../${INFLATION}_inflate.${MODEL_DATE_EXT}.diag
-   else
-      echo "No ${INFLATION}_inflate_diag for ${MODEL_DATE_EXT}"
-   endif
-
 end
 
-# FIXME: special for trying out non-monotonic task layouts.
-# FIXME setenv PATH "${ORG_PATH}"
-# FIXME setenv LSB_PJL_TASK_GEOMETRY "${ORG_TASK_GEOMETRY}"
-
-#-------------------------------------------------------------------------
-# Block 3: Update the clm restart files ... simultaneously ...
+#=========================================================================
+# Block 6: Update the clm restart files.
 #
 # DART namelist settings required:
 # &filter_nml:           restart_out_file_name  = 'filter_restart'
 # &ensemble_manager_nml: single_restart_file_in = '.false.'
-# &dart_to_clm_nml:      dart_to_clm_input_file = 'dart.ic',
+# &dart_to_clm_nml:      dart_to_clm_input_file = 'dart_restart',
 # &dart_to_clm_nml:      advance_time_present   = .false.
-#-------------------------------------------------------------------------
+#=========================================================================
 
 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
+   # Each member will do its job in its own directory, which already exists
+   # and has the required input files remaining from 'Block 4'
 
-   set MYTEMPDIR = member_${member}
-   mkdir -p $MYTEMPDIR
-   cd $MYTEMPDIR
+   cd member_${member}
 
-   set DART_RESTART_FILE = `printf filter_restart.%04d ${member}`
-   ${LINK} ../$DART_RESTART_FILE dart.ic
+   set DART_RESTART_FILE = `printf ../filter_restart.%04d ${member}`
+   ${LINK} $DART_RESTART_FILE dart_restart
 
-   set POINTER_FILENAME = `printf rpointer.lnd_%04d ${member}`
-   set MODEL_RESTART_FILENAME = `head -1 ../../${POINTER_FILENAME}`
-   set MODEL_HISTORY_FILENAME = `echo ${MODEL_RESTART_FILENAME} | sed "s/\.r\./\.h0\./"`
-   ${LINK} ../../$MODEL_RESTART_FILENAME clm_restart.nc
-   ${LINK} ../../$MODEL_HISTORY_FILENAME clm_history.nc
-
    echo "starting dart_to_clm for member ${member} at "`date`
-   ../dart_to_clm >! output.${member}.dart_to_clm &
+   ${EXEROOT}/dart_to_clm >! output.${member}.dart_to_clm &
    echo "finished dart_to_clm for member ${member} at "`date`
 
    cd ..
@@ -318,10 +380,20 @@
 
 wait
 
+if ($status != 0) then
+   echo "ERROR ... DART died in 'dart_to_clm' ... ERROR"
+   echo "ERROR ... DART died in 'dart_to_clm' ... ERROR"
+   exit 8
+endif
+
 #-------------------------------------------------------------------------
 # Cleanup
 #-------------------------------------------------------------------------
 
+#\rm -f ../$CASE.*.rh0.* 
+#\rm -f ../$CASE.*.rs1.* 
+#\rm -f ../PET*.ESMF_LogFile 
+
 ls -lrt
 
 exit 0


More information about the Dart-dev mailing list