[Dart-dev] [6869] DART/trunk/models: Adding the inflation block to clm,

nancy at ucar.edu nancy at ucar.edu
Fri Apr 4 11:15:40 MDT 2014


Revision: 6869
Author:   thoar
Date:     2014-04-04 11:15:39 -0600 (Fri, 04 Apr 2014)
Log Message:
-----------
Adding the inflation block to clm,
prevented PMO configurations from trying to get an inflation file.
Renamed refresh_dart_files to stage_dart_files and ensure that
we only copy the input.nml files _once_ (so that we do not overwrite
existing input.nml's that may already be configured).

Modified Paths:
--------------
    DART/trunk/models/CESM/shell_scripts/CESM_DART_config
    DART/trunk/models/POP/shell_scripts/CESM_DART_config
    DART/trunk/models/cam/shell_scripts/CESM_DART_config
    DART/trunk/models/clm/shell_scripts/CESM_DART_config

-------------- next part --------------
Modified: DART/trunk/models/CESM/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/CESM/shell_scripts/CESM_DART_config	2014-04-04 00:01:17 UTC (rev 6868)
+++ DART/trunk/models/CESM/shell_scripts/CESM_DART_config	2014-04-04 17:15:39 UTC (rev 6869)
@@ -37,7 +37,7 @@
 #       inflation
 #       sampling error correction
 # -- Run this script.
-# -- Edit the DART input.nml that appears in the ${CASEROOT} directory.
+# -- Edit the DART <model>_input.nml in the ${CASEROOT} directory.
 # -- Submit the job using ${CASEROOT}/${CASE}.submit
 #
 # ==============================================================================
@@ -167,61 +167,71 @@
 # we're making a script to make it easy to install new DART executables.
 # ==============================================================================
 
-cat << EndOfText >! refresh_dart_files
+cat << EndOfText >! stage_dart_files
 #!/bin/sh
 
-# this script copies over the dart executables and namelists to the
-# proper directory.  if you have to update any dart code or namelists,
-# do it in the $DARTROOT directory and then rerun refresh_dart_files
-# this script was autogenerated by $0
-# using the variables set in that script
+# Run this script in the ${CASEROOT} directory.
+# This script copies over the dart executables and POSSIBLY a namelist
+# to the proper directory.  If you have to update any dart executables,
+# do it in the ${DARTROOT} directory and then rerun stage_dart_files.
+# If a <model>_input.nml does not exist in the ${CASEROOT} directory,
+# a default one will be copied into place.
+#
+# This script was autogenerated by $0 using the variables set in that script.
 
-for FILE in cam_input.nml clm_input.nml pop_input.nml input.nml; do
-   if [[ -e \$FILE ]]; then
-      if [[ -e \$FILE.original ]]; then
-         echo "\$FILE.original already exists - not making another"
+for MODEL in cam clm pop ; do
+
+   if [[ \${MODEL} == 'pop' ]]; then 
+      MODELDIR=POP
+   else
+      MODELDIR=\${MODEL}
+   fi
+
+   if [[ -e \${MODEL}_input.nml ]]; then
+      echo "stage_dart_files: Using existing $CASEROOT/\${MODEL}_input.nml"
+      if [[ -e \${MODEL}_input.nml.original ]]; then
+         echo "\${MODEL}_input.nml.original already exists - not making another"
       else
-         ${COPY} \$FILE \$FILE.original
+         ${COPY} \${MODEL}_input.nml \${MODEL}_input.nml.original
       fi
+   elif [[ -e ${DARTROOT}/models/\${MODELDIR}/work/input.nml ]]; then
+      ${COPY} ${DARTROOT}/models/\${MODELDIR}/work/input.nml \${MODEL}_input.nml
+      if [[ -x update_dart_namelists ]]; then
+             ./update_dart_namelists
+      fi
+   else
+      echo "ERROR: stage_dart_files could not find a \${MODEL}_input.nml.  Aborting"
+      exit -99
    fi
+
 done
 
 ${COPY} ${DARTROOT}/models/cam/work/cam_to_dart        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/cam/work/dart_to_cam        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/cam/work/filter             ${EXEROOT}/filter_cam
 ${COPY} ${DARTROOT}/models/cam/work/perfect_model_obs  ${EXEROOT}/perfect_model_obs_cam
-${COPY} ${DARTROOT}/models/cam/work/input.nml          cam_input.nml
 
 ${COPY} ${DARTROOT}/models/clm/work/clm_to_dart        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/clm/work/dart_to_clm        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/clm/work/filter             ${EXEROOT}/filter_clm
 ${COPY} ${DARTROOT}/models/clm/work/perfect_model_obs  ${EXEROOT}/perfect_model_obs_clm
-${COPY} ${DARTROOT}/models/clm/work/input.nml          clm_input.nml
 
 ${COPY} ${DARTROOT}/models/POP/work/pop_to_dart        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/POP/work/dart_to_pop        ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/POP/work/filter             ${EXEROOT}/filter_pop
 ${COPY} ${DARTROOT}/models/POP/work/perfect_model_obs  ${EXEROOT}/perfect_model_obs_pop
-${COPY} ${DARTROOT}/models/POP/work/input.nml          pop_input.nml
 
 ${COPY} ${DARTROOT}/models/CESM/work/cesm_to_dart      ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/CESM/work/dart_to_cesm      ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/CESM/work/filter            ${EXEROOT}/filter_cesm
 ${COPY} ${DARTROOT}/models/CESM/work/perfect_model_obs ${EXEROOT}/perfect_model_obs_cesm
-${COPY} ${DARTROOT}/models/CESM/work/input.nml         input.nml
 
-# The first time this is executed, the update namelist script does not exist.
-
-if [[ -x update_dart_namelists ]]; then
-       ./update_dart_namelists
-fi
-
 exit 0
 
 EndOfText
-chmod 0755 refresh_dart_files
+chmod 0755 stage_dart_files
 
-./refresh_dart_files  || exit -8
+./stage_dart_files  || exit -8
 
 # ==============================================================================
 # Ensure the DART namelists are consistent with the ensemble size,
@@ -237,25 +247,21 @@
 # this script was autogenerated by $0
 # using the variables set in that script
 
-# Ensure that the input.nml ensemble size matches the number of instances.
+# Ensure that the ensemble size matches the number of instances.
 # WARNING: the output files contain ALL ensemble members ==> BIG
 
-ex input.nml <<ex_end
-g;ens_size ;s;= .*;= ${num_instances};
-g;num_output_state_members ;s;= .*;= ${num_instances};
-g;num_output_obs_members ;s;= .*;= ${num_instances};
-wq
-ex_end
-
+if [[ -e cam_input.nml ]]; then
 ex cam_input.nml <<ex_end
 g;ens_size ;s;= .*;= ${NINST_ATM};
 g;num_output_state_members ;s;= .*;= ${NINST_ATM};
 g;num_output_obs_members ;s;= .*;= ${NINST_ATM};
 wq
 ex_end
+fi
 
 # CLM requires the CASE to be able to find the right *.h1.* file if need be.
 
+if [[ -e clm_input.nml ]]; then
 ex clm_input.nml <<ex_end
 g;ens_size ;s;= .*;= ${NINST_LND};
 g;num_output_state_members ;s;= .*;= ${NINST_LND};
@@ -264,14 +270,17 @@
 g;hist_nhtfrq ;s;= .*;= -HISTORY_OUTPUT_INTERVAL,;
 wq
 ex_end
+fi
 
 # num_output_state_members intentionally not set for POP.
 
+if [[ -e pop_input.nml ]]; then
 ex pop_input.nml <<ex_end
 g;ens_size ;s;= .*;= ${NINST_OCN};
 g;num_output_obs_members ;s;= .*;= ${NINST_OCN};
 wq
 ex_end
+fi
 
 exit 0
 
@@ -288,7 +297,7 @@
 #
 # The sampling error correction is a lookup table.  Each ensemble size
 # has its own (static) file.  It is only needed if any
-# input.nml:&assim_tools_nml:sampling_error_correction = .true.,
+# &assim_tools_nml:sampling_error_correction = .true.,
 #
 # If any of the SECs in any namelist are true, force the final_full.nn
 # file to exist and be copied.  If they are all false, still try to copy
@@ -298,48 +307,51 @@
 # if it's turned on, they will have to generate one and copy it over.
 #=========================================================================
 
-foreach N ( cam_input.nml pop_input.nml clm_input.nml input.nml )
-   set  MYSTRING = `grep sampling_error_correction $N`
-   set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
-   set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-   set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
-
-   if ( ${SECSTRING} == true ) then
+if ( $num_instances > 1 ) then
+   foreach N ( cam_input.nml pop_input.nml clm_input.nml )
+      set  MYSTRING = `grep sampling_error_correction $N`
+      set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+      set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+      set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+   
+      if ( ${SECSTRING} == true ) then
+         set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
+         if (  -e   ${SAMP_ERR_FILE} ) then
+            ${COPY} ${SAMP_ERR_FILE} .
+            break   # we only need to copy it once if anyone has SEC on.
+         else
+            echo "ERROR: no sampling error correction file for this ensemble size."
+            echo "ERROR: looking for ${SAMP_ERR_FILE} in"
+            echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
+            echo "ERROR: one can be generated for any ensemble size; see docs."
+            exit -3
+         endif
+      endif
+   end
+   
+   # If the final_full file is not here, none of the namelists had SEC on,
+   # but go ahead and copy one here; it's not fatal if one doesn't already
+   # exist in the final_full_precomputed_tables dir for this ens size.
+   # If they want to turn it on later, it will be available.
+   
+   if ( ! -e ./final_full.${num_instances} ) then
       set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
       if (  -e   ${SAMP_ERR_FILE} ) then
          ${COPY} ${SAMP_ERR_FILE} .
-         break   # we only need to copy it once if anyone has SEC on.
       else
-         echo "ERROR: no sampling error correction file for this ensemble size."
-         echo "ERROR: looking for ${SAMP_ERR_FILE} in"
-         echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
-         echo "ERROR: one can be generated for any ensemble size; see docs."
-         exit -3
+         echo ""
+         echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
+         echo "         This file is NOT needed unless you want to turn on the"
+         echo "         sampling_error_correction feature in any of the models."
+         echo "         To use it, in addition to setting the namelist to .true., cd to:"
+         echo "         ${DARTROOT}/system_simulation"
+         echo "         and create a final_full.${num_instances} file"
+         echo "         one can be generated for any ensemble size; see docs"
+         echo "         Copy it into ${CASEROOT} before running."
+         echo ""
       endif
    endif
-end
-
-# If the final_full file is not here, none of the namelists had SEC on,
-# but go ahead and copy one here; it's not fatal if one doesn't already
-# exist in the final_full_precomputed_tables dir for this ens size.
-# If they want to turn it on later, it will be available.
-
-if ( ! -e ./final_full.${num_instances} ) then
-   set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
-   if (  -e   ${SAMP_ERR_FILE} ) then
-      ${COPY} ${SAMP_ERR_FILE} .
-   else
-      echo ""
-      echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
-      echo "         This file is NOT needed unless you want to turn on the"
-      echo "         sampling_error_correction feature in any of the models."
-      echo "         To use it, in addition to setting the namelist to .true., cd to:"
-      echo "         ${DARTROOT}/system_simulation"
-      echo "         and create a final_full.${num_instances} file"
-      echo "         one can be generated for any ensemble size; see docs"
-      echo "         Copy it into ${CASEROOT} before running."
-      echo ""
-   endif
+else
 endif
 
 # ==============================================================================
@@ -363,12 +375,15 @@
 # IMPORTANT: If you stage your own inflation file, you must REMOVE the cookie
 # file from the RUNDIR directory.
 
-date >! ${RUNDIR}/cam_inflation_cookie
-date >! ${RUNDIR}/pop_inflation_cookie
+if ( $num_instances > 1 ) then
+   date >! ${RUNDIR}/cam_inflation_cookie
+   date >! ${RUNDIR}/clm_inflation_cookie
+   date >! ${RUNDIR}/pop_inflation_cookie
+endif 
 
 # ==============================================================================
 # Creating the code to add to the *.run script to call DART.
-# If there is one instance ... we COULD be running a perfect_model experiment.
+# If there is one instance ... we MUST be running a perfect_model experiment.
 # If there are many instances ... we MUST be assimilating.
 # The number of instances dictates what DART script will be used.
 # ==============================================================================
@@ -440,6 +455,8 @@
 if ( ${STATUSCHECK} == 0 ) then
    echo "DART block already present in ${CASE}.run"
    echo ""
+   ${REMOVE} temp.$$ add_to_run.txt
+
 else if ( ${STATUSCHECK} == 1 ) then
    echo "Adding DART block to ${CASE}.run"
    echo ""
@@ -483,9 +500,9 @@
 2) When you want to run DART, edit the ${CASE}.run script to
    reference "$DARTscript" instead of "no_assimilate.csh".
 
-3) Modify what you need to in the DART namelist file, i.e. ${CASEROOT}/input.nml
+3) Modify what you need to in the DART namelist files, i.e. ${CASEROOT}/<model>_input.nml
 
-4) If you have recompiled any part of the DART system, 'refresh_dart_files'
+4) If you have recompiled any part of the DART system, 'stage_dart_files'
    will copy them into the correct places.
 
 5) If you stage your own inflation files, make sure you read the INFLATION section

Modified: DART/trunk/models/POP/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/POP/shell_scripts/CESM_DART_config	2014-04-04 00:01:17 UTC (rev 6868)
+++ DART/trunk/models/POP/shell_scripts/CESM_DART_config	2014-04-04 17:15:39 UTC (rev 6869)
@@ -40,8 +40,7 @@
 #
 # ==============================================================================
 # Get the environment of the case - defines number of instances/ensemble size ...
-# Each model component has their own number of instances, but the 'coupled'
-# DART parts is going to use the number of instances of CAM.
+# Each model component has their own number of instances.
 # ==============================================================================
 
 if ( ! -e ./Tools/ccsm_getenv ) then
@@ -154,41 +153,47 @@
 # we're making a script to make it easy to install new DART executables.
 # ==============================================================================
 
-cat << EndOfText >! refresh_dart_files
+cat << EndOfText >! stage_dart_files
 #!/bin/sh
 
-# this script copies over the dart executables and namelists to the
-# proper directory.  if you have to update any dart code or namelists,
-# do it in the $DARTROOT directory and then rerun refresh_dart_files
-# this script was autogenerated by $0
-# using the variables set in that script
+# Run this script in the ${CASEROOT} directory.
+# This script copies over the dart executables and POSSIBLY a namelist
+# to the proper directory.  If you have to update any dart executables,
+# do it in the ${DARTROOT} directory and then rerun stage_dart_files.
+# If an input.nml does not exist in the ${CASEROOT} directory,
+# a default one will be copied into place.
+#
+# This script was autogenerated by $0 using the variables set in that script.
 
 if [[ -e input.nml ]]; then
+   echo "stage_dart_files: Using existing ${CASEROOT}/input.nml"
    if [[ -e input.nml.original ]]; then
       echo "input.nml.original already exists - not making another"
    else
       ${COPY} input.nml input.nml.original
    fi
+
+elif [[ -e ${DARTROOT}/models/POP/work/input.nml ]]; then
+   ${COPY} ${DARTROOT}/models/POP/work/input.nml  input.nml
+   if [[ -x update_dart_namelists ]]; then
+          ./update_dart_namelists
+   fi
+else
+   echo "ERROR: stage_dart_files could not find an input.nml.  Aborting"
+   exit -99
 fi
 
 ${COPY} ${DARTROOT}/models/POP/work/pop_to_dart       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/POP/work/dart_to_pop       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/POP/work/filter            ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/POP/work/perfect_model_obs ${EXEROOT}/.
-${COPY} ${DARTROOT}/models/POP/work/input.nml         ${CASEROOT}/.
 
-# The first time this is executed, the update namelist script does not exist.
-
-if [[ -x update_dart_namelists ]]; then
-       ./update_dart_namelists
-fi
-
 exit 0
 
 EndOfText
-chmod 0755 refresh_dart_files
+chmod 0755 stage_dart_files
 
-./refresh_dart_files  || exit -8
+./stage_dart_files  || exit -8
 
 # ==============================================================================
 # Ensure the DART namelists are consistent with the ensemble size,
@@ -231,39 +236,43 @@
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
 #=========================================================================
 
-set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
-if (  -e   ${SAMP_ERR_FILE} ) then
-   ${COPY} ${SAMP_ERR_FILE} .
+if ( $num_instances > 1 ) then
+   set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
+   if (  -e   ${SAMP_ERR_FILE} ) then
+      ${COPY} ${SAMP_ERR_FILE} .
+   else
+      echo ""
+      echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
+      echo "         This file is NOT needed unless you want to turn on the"
+      echo "         sampling_error_correction feature in any of the models."
+      echo "         To use it, in addition to setting the namelist to .true., cd to:"
+      echo "         ${DARTROOT}/system_simulation"
+      echo "         and create a final_full.${num_instances} file"
+      echo "         one can be generated for any ensemble size; see docs."
+      echo "         Copy it into ${CASEROOT} before running."
+      echo ""
+   endif
+   
+   foreach N ( input.nml )
+      set  MYSTRING = `grep sampling_error_correction $N`
+      set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+      set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+      set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+   
+      if ( ${SECSTRING} == true ) then
+         if ( ! -e  ${SAMP_ERR_FILE} ) then
+            echo "ERROR: no sampling error correction file for this ensemble size."
+            echo "ERROR: looking for ${SAMP_ERR_FILE} in"
+            echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
+            echo "ERROR: one can be generated for any ensemble size; see docs."
+            exit -3
+         endif
+      endif
+   end
 else
-   echo ""
-   echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
-   echo "         This file is NOT needed unless you want to turn on the"
-   echo "         sampling_error_correction feature in any of the models."
-   echo "         To use it, in addition to setting the namelist to .true., cd to:"
-   echo "         ${DARTROOT}/system_simulation"
-   echo "         and create a final_full.${num_instances} file"
-   echo "         one can be generated for any ensemble size; see docs."
-   echo "         Copy it into ${CASEROOT} before running."
-   echo ""
+   # sampling error correction not used for perfect_model_obs
 endif
 
-foreach N ( input.nml )
-   set  MYSTRING = `grep sampling_error_correction $N`
-   set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
-   set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-   set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
-
-   if ( ${SECSTRING} == true ) then
-      if ( ! -e  ${SAMP_ERR_FILE} ) then
-         echo "ERROR: no sampling error correction file for this ensemble size."
-         echo "ERROR: looking for ${SAMP_ERR_FILE} in"
-         echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
-         echo "ERROR: one can be generated for any ensemble size; see docs."
-         exit -3
-      endif
-   endif
-end
-
 # ==============================================================================
 # INFLATION : Initial setup for the default inflation scenario.
 # ==============================================================================
@@ -285,7 +294,9 @@
 # IMPORTANT: If you stage your own inflation file, you must REMOVE the cookie
 # file from the RUNDIR directory.
 
-date >! ${RUNDIR}/pop_inflation_cookie
+if ( $num_instances > 1 ) then
+   date >! ${RUNDIR}/pop_inflation_cookie
+endif
 
 # ==============================================================================
 # Creating the code to add to the *.run script to call DART.
@@ -358,6 +369,8 @@
 if ( ${STATUSCHECK} == 0 ) then
    echo "DART block already present in ${CASE}.run"
    echo ""
+   ${REMOVE} temp.$$ add_to_run.txt
+
 else if ( ${STATUSCHECK} == 1 ) then
    echo "Adding DART block to ${CASE}.run"
    echo ""
@@ -403,7 +416,7 @@
 
 3) Modify what you need to in the DART namelist file, i.e. ${CASEROOT}/input.nml
 
-4) If you have recompiled any part of the DART system, 'refresh_dart_files'
+4) If you have recompiled any part of the DART system, 'stage_dart_files'
    will copy them into the correct places.
 
 5) If you stage your own inflation files, make sure you read the INFLATION section

Modified: DART/trunk/models/cam/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/cam/shell_scripts/CESM_DART_config	2014-04-04 00:01:17 UTC (rev 6868)
+++ DART/trunk/models/cam/shell_scripts/CESM_DART_config	2014-04-04 17:15:39 UTC (rev 6869)
@@ -40,8 +40,7 @@
 #
 # ==============================================================================
 # Get the environment of the case - defines number of instances/ensemble size ...
-# Each model component has their own number of instances, but the 'coupled'
-# DART parts is going to use the number of instances of CAM.
+# Each model component has their own number of instances.
 # ==============================================================================
 
 if ( ! -e ./Tools/ccsm_getenv ) then
@@ -155,41 +154,47 @@
 # we're making a script to make it easy to install new DART executables.
 # ==============================================================================
 
-cat << EndOfText >! refresh_dart_files
+cat << EndOfText >! stage_dart_files
 #!/bin/sh
 
-# this script copies over the dart executables and namelists to the
-# proper directory.  if you have to update any dart code or namelists,
-# do it in the $DARTROOT directory and then rerun refresh_dart_files
-# this script was autogenerated by $0
-# using the variables set in that script
+# Run this script in the ${CASEROOT} directory.
+# This script copies over the dart executables and POSSIBLY a namelist
+# to the proper directory.  If you have to update any dart executables,
+# do it in the ${DARTROOT} directory and then rerun stage_dart_files.
+# If an input.nml does not exist in the ${CASEROOT} directory,
+# a default one will be copied into place.
+#
+# This script was autogenerated by $0 using the variables set in that script.
 
 if [[ -e input.nml ]]; then
+   echo "stage_dart_files: Using existing ${CASEROOT}/input.nml"
    if [[ -e input.nml.original ]]; then
       echo "input.nml.original already exists - not making another"
    else
       ${COPY} input.nml input.nml.original
    fi
+
+elif [[ -e ${DARTROOT}/models/cam/work/input.nml ]]; then
+   ${COPY} ${DARTROOT}/models/cam/work/input.nml  input.nml
+   if [[ -x update_dart_namelists ]]; then
+          ./update_dart_namelists
+   fi
+else
+   echo "ERROR: stage_dart_files could not find an input.nml.  Aborting"
+   exit -99
 fi
 
 ${COPY} ${DARTROOT}/models/cam/work/cam_to_dart       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/cam/work/dart_to_cam       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/cam/work/filter            ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/cam/work/perfect_model_obs ${EXEROOT}/.
-${COPY} ${DARTROOT}/models/cam/work/input.nml         ${CASEROOT}/.
 
-# The first time this is executed, the update namelist script does not exist.
-
-if [[ -x update_dart_namelists ]]; then
-       ./update_dart_namelists
-fi
-
 exit 0
 
 EndOfText
-chmod 0755 refresh_dart_files
+chmod 0755 stage_dart_files
 
-./refresh_dart_files  || exit -8
+./stage_dart_files  || exit -8
 
 # ==============================================================================
 # Ensure the DART namelists are consistent with the ensemble size,
@@ -233,39 +238,43 @@
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
 #=========================================================================
 
-set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
-if (  -e   ${SAMP_ERR_FILE} ) then
-   ${COPY} ${SAMP_ERR_FILE} .
+if ( $num_instances > 1 ) then
+   set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
+   if (  -e   ${SAMP_ERR_FILE} ) then
+      ${COPY} ${SAMP_ERR_FILE} .
+   else
+      echo ""
+      echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
+      echo "         This file is NOT needed unless you want to turn on the"
+      echo "         sampling_error_correction feature in any of the models."
+      echo "         To use it, in addition to setting the namelist to .true., cd to:"
+      echo "         ${DARTROOT}/system_simulation"
+      echo "         and create a final_full.${num_instances} file"
+      echo "         one can be generated for any ensemble size; see docs."
+      echo "         Copy it into ${CASEROOT} before running."
+      echo ""
+   endif
+   
+   foreach N ( input.nml )
+      set  MYSTRING = `grep sampling_error_correction $N`
+      set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+      set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+      set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+   
+      if ( ${SECSTRING} == true ) then
+         if ( ! -e  ${SAMP_ERR_FILE} ) then
+            echo "ERROR: no sampling error correction file for this ensemble size."
+            echo "ERROR: looking for ${SAMP_ERR_FILE} in"
+            echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
+            echo "ERROR: one can be generated for any ensemble size; see docs."
+            exit -3
+         endif
+      endif
+   end
 else
-   echo ""
-   echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
-   echo "         This file is NOT needed unless you want to turn on the"
-   echo "         sampling_error_correction feature in any of the models."
-   echo "         To use it, in addition to setting the namelist to .true., cd to:"
-   echo "         ${DARTROOT}/system_simulation"
-   echo "         and create a final_full.${num_instances} file"
-   echo "         one can be generated for any ensemble size; see docs."
-   echo "         Copy it into ${CASEROOT} before running."
-   echo ""
+   # sampling error correction not used for perfect_model_obs
 endif
 
-foreach N ( input.nml )
-   set  MYSTRING = `grep sampling_error_correction $N`
-   set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
-   set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-   set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
-
-   if ( ${SECSTRING} == true ) then
-      if ( ! -e  ${SAMP_ERR_FILE} ) then
-         echo "ERROR: no sampling error correction file for this ensemble size."
-         echo "ERROR: looking for ${SAMP_ERR_FILE} in"
-         echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
-         echo "ERROR: one can be generated for any ensemble size; see docs."
-         exit -3
-      endif
-   endif
-end
-
 # ==============================================================================
 # INFLATION : Initial setup for the default inflation scenario.
 # ==============================================================================
@@ -287,11 +296,13 @@
 # IMPORTANT: If you stage your own inflation file, you must REMOVE the cookie
 # file from the RUNDIR directory.
 
-date >! ${RUNDIR}/cam_inflation_cookie
+if ( $num_instances > 1 ) then
+   date >! ${RUNDIR}/cam_inflation_cookie
+endif
 
 # ==============================================================================
 # Creating the code to add to the *.run script to call DART.
-# If there is one instance ... we COULD be running a perfect_model experiment.
+# If there is one instance ... we MUST be running a perfect_model experiment.
 # If there are many instances ... we MUST be assimilating.
 # The number of instances dictates what DART script will be used.
 # ==============================================================================
@@ -363,6 +374,8 @@
 if ( ${STATUSCHECK} == 0 ) then
    echo "DART block already present in ${CASE}.run"
    echo ""
+   ${REMOVE} temp.$$ add_to_run.txt
+
 else if ( ${STATUSCHECK} == 1 ) then
    echo "Adding DART block to ${CASE}.run"
    echo ""
@@ -408,7 +421,7 @@
 
 3) Modify what you need to in the DART namelist file, i.e. ${CASEROOT}/input.nml
 
-4) If you have recompiled any part of the DART system, 'refresh_dart_files'
+4) If you have recompiled any part of the DART system, 'stage_dart_files'
    will copy them into the correct places.
 
 5) If you stage your own inflation files, make sure you read the INFLATION section

Modified: DART/trunk/models/clm/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/clm/shell_scripts/CESM_DART_config	2014-04-04 00:01:17 UTC (rev 6868)
+++ DART/trunk/models/clm/shell_scripts/CESM_DART_config	2014-04-04 17:15:39 UTC (rev 6869)
@@ -40,8 +40,7 @@
 #
 # ==============================================================================
 # Get the environment of the case - defines number of instances/ensemble size ...
-# Each model component has their own number of instances, but the 'coupled'
-# DART parts is going to use the number of instances of CAM.
+# Each model component has their own number of instances.
 # ==============================================================================
 
 if ( ! -e ./Tools/ccsm_getenv ) then
@@ -154,41 +153,47 @@
 # we're making a script to make it easy to install new DART executables.
 # ==============================================================================
 
-cat << EndOfText >! refresh_dart_files
+cat << EndOfText >! stage_dart_files
 #!/bin/sh
 
-# this script copies over the dart executables and namelists to the
-# proper directory.  if you have to update any dart code or namelists,
-# do it in the $DARTROOT directory and then rerun refresh_dart_files
-# this script was autogenerated by $0
-# using the variables set in that script
+# Run this script in the ${CASEROOT} directory.
+# This script copies over the dart executables and POSSIBLY a namelist
+# to the proper directory.  If you have to update any dart executables,
+# do it in the ${DARTROOT} directory and then rerun stage_dart_files.
+# If an input.nml does not exist in the ${CASEROOT} directory,
+# a default one will be copied into place.
+#
+# This script was autogenerated by $0 using the variables set in that script.
 
 if [[ -e input.nml ]]; then
+   echo "stage_dart_files: Using existing ${CASEROOT}/input.nml"
    if [[ -e input.nml.original ]]; then
       echo "input.nml.original already exists - not making another"
    else
       ${COPY} input.nml input.nml.original
    fi
+
+elif [[ -e ${DARTROOT}/models/clm/work/input.nml ]]; then
+   ${COPY} ${DARTROOT}/models/clm/work/input.nml  input.nml
+   if [[ -x update_dart_namelists ]]; then
+          ./update_dart_namelists
+   fi
+else
+   echo "ERROR: stage_dart_files could not find an input.nml.  Aborting"
+   exit -99
 fi
 
 ${COPY} ${DARTROOT}/models/clm/work/clm_to_dart       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/clm/work/dart_to_clm       ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/clm/work/filter            ${EXEROOT}/.
 ${COPY} ${DARTROOT}/models/clm/work/perfect_model_obs ${EXEROOT}/.
-${COPY} ${DARTROOT}/models/clm/work/input.nml         ${CASEROOT}/.
 
-# The first time this is executed, the update namelist script does not exist.
-
-if [[ -x update_dart_namelists ]]; then
-       ./update_dart_namelists
-fi
-
 exit 0
 
 EndOfText
-chmod 0755 refresh_dart_files
+chmod 0755 stage_dart_files
 
-./refresh_dart_files  || exit -8
+./stage_dart_files  || exit -8
 
 # ==============================================================================
 # Ensure the DART namelists are consistent with the ensemble size,
@@ -236,38 +241,67 @@
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
 #=========================================================================
 
-set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
-if (  -e   ${SAMP_ERR_FILE} ) then
-   ${COPY} ${SAMP_ERR_FILE} .
+if ( $num_instances > 1 ) then
+   set SAMP_ERR_FILE = ${DARTROOT}/system_simulation/final_full_precomputed_tables/final_full.${num_instances}
+   if (  -e   ${SAMP_ERR_FILE} ) then
+      ${COPY} ${SAMP_ERR_FILE} .
+   else
+      echo ""
+      echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
+      echo "         This file is NOT needed unless you want to turn on the"
+      echo "         sampling_error_correction feature in any of the models."
+      echo "         To use it, in addition to setting the namelist to .true., cd to:"
+      echo "         ${DARTROOT}/system_simulation"
+      echo "         and create a final_full.${num_instances} file"
+      echo "         one can be generated for any ensemble size; see docs."
+      echo "         Copy it into ${CASEROOT} before running."
+      echo ""
+   endif
+   
+   foreach N ( input.nml )
+      set  MYSTRING = `grep sampling_error_correction $N`
+      set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+      set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+      set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+   
+      if ( ${SECSTRING} == true ) then
+         if ( ! -e  ${SAMP_ERR_FILE} ) then
+            echo "ERROR: no sampling error correction file for this ensemble size."
+            echo "ERROR: looking for ${SAMP_ERR_FILE} in"
+            echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
+            echo "ERROR: one can be generated for any ensemble size; see docs."
+            exit -3
+         endif
+      endif
+   end
 else
-   echo ""
-   echo "WARNING: no final_full.xx file found for an ensemble size of ${num_instances}."
-   echo "         This file is NOT needed unless you want to turn on the"
-   echo "         sampling_error_correction feature in any of the models."
-   echo "         To use it, in addition to setting the namelist to .true., cd to:"
-   echo "         ${DARTROOT}/system_simulation"
-   echo "         and create a final_full.${num_instances} file"
-   echo "         one can be generated for any ensemble size; see docs."
-   echo "         Copy it into ${CASEROOT} before running."
-   echo ""
+   # sampling error correction not used for perfect_model_obs
 endif
 
-foreach N ( input.nml )
-   set  MYSTRING = `grep sampling_error_correction $N`
-   set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
-   set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-   set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+# ==============================================================================
+# INFLATION : Initial setup for the default inflation scenario.
+# ==============================================================================
+# CLM may use adaptive state-space prior inflation. The initial settings
+# are in the filter_nml and ... during an assimilation experiment, the output
+# from one assimilation is the input for the next. To facilitate this operationally,
+# it is useful to specify an initial file of inflation values for the first
+# assimilation step. However, I can think of no general way to do this. The
+# utility that creates the initial inflation values (fill_inflation_restart)
+# needs the model size from model_mod. To get that, DART/CLM needs
+# files which we generally don't have at this stage of the game (it exists after
+# a model advance). So ... until I think of something better ... I am making a
+# cookie file that indicates this is the very first assimilation. If this
+# cookie file exists, the assimilate.csh script will make the inflation restart
+# file before it performs the assimilation. After the first assimilation takes
+# place, the cookie file must be 'eaten' so that subsequent assimilations do not
+# overwrite whatever _should_ be there.
+#
+# IMPORTANT: If you stage your own inflation file, you must REMOVE the cookie
+# file from the RUNDIR directory.
 
-   if ( ${SECSTRING} == true ) then
-      if ( ! -e  ${SAMP_ERR_FILE} ) then
-         echo "ERROR: no sampling error correction file for this ensemble size."
-         echo "ERROR: looking for ${SAMP_ERR_FILE} in"
-         echo "ERROR: ${DARTROOT}/system_simulation/final_full_precomputed_tables"
-         echo "ERROR: one can be generated for any ensemble size; see docs."
-         exit -3
-      endif
-   endif
-end
+if ( $num_instances > 1 ) then
+   date >! ${RUNDIR}/clm_inflation_cookie
+endif
 
 # ==============================================================================
 # Creating the code to add to the *.run script to call DART.
@@ -340,6 +374,8 @@
 if ( ${STATUSCHECK} == 0 ) then
    echo "DART block already present in ${CASE}.run"
    echo ""
+   ${REMOVE} temp.$$ add_to_run.txt
+
 else if ( ${STATUSCHECK} == 1 ) then
    echo "Adding DART block to ${CASE}.run"
    echo ""
@@ -385,7 +421,7 @@
 
 3) Modify what you need to in the DART namelist file, i.e. ${CASEROOT}/input.nml
 
-4) If you have recompiled any part of the DART system, 'refresh_dart_files'
+4) If you have recompiled any part of the DART system, 'stage_dart_files'
    will copy them into the correct places.
 
 5) If you stage your own inflation files, make sure you read the INFLATION section


More information about the Dart-dev mailing list