[Dart-dev] [4373] DART/trunk/models/tiegcm: The assimilation is working and the advance_model.csh script is working.

nancy at ucar.edu nancy at ucar.edu
Wed May 26 16:09:31 MDT 2010


Revision: 4373
Author:   thoar
Date:     2010-05-26 16:09:31 -0600 (Wed, 26 May 2010)
Log Message:
-----------
The assimilation is working and the advance_model.csh script is working.
I have to check the file motion from advance_model.csh ... might be leaving 
the tiegcm_restart_p.nc files in the advance directory without copying 
them to CENTRALDIR - impact on cycling?

Must check that I did not break perfect_model_obs ... since advance_model.csh
expects the tiegcm support files (tiegcm_restart_p.nc & tiegcm_s.nc) to be
uniquely named in CENTRALDIR ... 

Modified Paths:
--------------
    DART/trunk/models/tiegcm/model_mod.f90
    DART/trunk/models/tiegcm/shell_scripts/advance_model.csh
    DART/trunk/models/tiegcm/shell_scripts/run_filter.csh
    DART/trunk/models/tiegcm/shell_scripts/run_perfect_model_obs.csh
    DART/trunk/models/tiegcm/work/input.nml

-------------- next part --------------
Modified: DART/trunk/models/tiegcm/model_mod.f90
===================================================================
--- DART/trunk/models/tiegcm/model_mod.f90	2010-05-21 22:27:48 UTC (rev 4372)
+++ DART/trunk/models/tiegcm/model_mod.f90	2010-05-26 22:09:31 UTC (rev 4373)
@@ -416,9 +416,9 @@
 ! No errors to start with
 istatus = 0
 
-! To find a layer height: what's the unit of height [cm] ?
+! To find a layer height: what's the unit of height [m] 
 h_loop:do k = 1, nlev
-  zgrid = ZGtiegcm(lon_index,lat_index,k) ![cm]
+  zgrid = ZGtiegcm(lon_index,lat_index,k)/100.0_r8 ! [m] = ZGtiegcm/100 [cm]
   if (height <= zgrid) then  
     lev_top = k
     lev_bottom = lev_top -1
@@ -559,7 +559,7 @@
   lev = levs(lev_index + 1)        !TN UN VN O1 defined at midpoints
 endif
 
-location = set_location(lon,lat,lev,2) ! 2 == pressure (hPa) 3 == height
+location = set_location(lon,lat,lev,2) ! 2 == pressure  3 == height
 
 ! If the type is wanted, return it
 if(present(var_type)) var_type = local_var_type
@@ -798,7 +798,7 @@
              'nc_write_model_atts') 
    call nc_check(nf90_put_att(ncFileID, levVarID, "long_name", "midpoint levels"),&
              'nc_write_model_atts')
-   call nc_check(nf90_put_att(ncFileID, levVarID, "units", "hPa"),&
+   call nc_check(nf90_put_att(ncFileID, levVarID, "units", "Pa"),&
              'nc_write_model_atts')
    call nc_check(nf90_put_att(ncFileID, levVarID, "positive", "up"),&
              'nc_write_model_atts') 
@@ -808,7 +808,7 @@
              'nc_write_model_atts') 
    call nc_check(nf90_put_att(ncFileID, ilevVarID, "long_name", "interface levels"),&
              'nc_write_model_atts')
-   call nc_check(nf90_put_att(ncFileID, ilevVarID, "units", "hPa"),&
+   call nc_check(nf90_put_att(ncFileID, ilevVarID, "units", "Pa"),&
              'nc_write_model_atts')
    call nc_check(nf90_put_att(ncFileID, ilevVarID, "positive", "up"),&
              'nc_write_model_atts') 
@@ -1739,7 +1739,7 @@
    call nc_check(nf90_get_var(restart_id, var_lev_id, values=levs), &
           'read_TIEGCM_definition', 'get_var lev') 
 
-   levs = p0 * exp(-levs) ![millibars] = [hPa]
+   levs = p0 * exp(-levs) * 100.0_r8 ![Pa] = 100* [millibars] = 100* [hPa]
 
    call nc_check(nf90_inq_dimid(restart_id, 'ilev', dim_ilev_id), &
           'read_TIEGCM_definition', 'inq_dimid ilev')
@@ -1751,7 +1751,7 @@
    call nc_check(nf90_get_var(restart_id, var_ilev_id, values=ilevs), &
           'read_TIEGCM_definition', 'get_var ilev') 
 
-   ilevs = p0 * exp(-ilevs) ![millibars] = [hPa]
+   ilevs = p0 * exp(-ilevs) * 100.0_r8 ! [Pa] = 100* [millibars] = 100* [hPa]
 
    if (nlev .ne. nilev) then
      write(msgstring, *) ' nlev = ',nlev,' nilev = ',nilev, 'are different; DART assumes them to be the same'

Modified: DART/trunk/models/tiegcm/shell_scripts/advance_model.csh
===================================================================
--- DART/trunk/models/tiegcm/shell_scripts/advance_model.csh	2010-05-21 22:27:48 UTC (rev 4372)
+++ DART/trunk/models/tiegcm/shell_scripts/advance_model.csh	2010-05-26 22:09:31 UTC (rev 4373)
@@ -64,10 +64,13 @@
 
    # The EXPECTED input DART 'initial conditions' file name is 'temp_ic'
 
-   ln -sf  ../$input_file temp_ic     || exit 2
-   cp -p   ../tiegcm_restart_p.nc  .  || exit 2
-   cp -p   ../tiegcm_s.nc  .          || exit 2
+   set tiesecond   = `printf "tiegcm_s.nc.%04d"         $ensemble_member`
+   set tierestart  = `printf "tiegcm_restart_p.nc.%04d" $ensemble_member`
 
+   ln -sf  ../$input_file temp_ic             || exit 2
+   cp -p   ../$tiesecond  tiegcm_s.nc         || exit 2
+   cp -p   ../$tierestart tiegcm_restart_p.nc || exit 2
+
 #  echo "ensemble member $ensemble_member : before dart_to_model"
 #  ncdump -v mtime tiegcm_restart.nc
 
@@ -75,17 +78,17 @@
 
    # update tiegcm namelist variables   
    
-   set start_year     = "START_YEAR = "`head -1 namelist_update | tail -1`
-   set start_day      = "START_DAY = "`head -2 namelist_update | tail -1`
-   set source_start   = "SOURCE_START = "`head -3 namelist_update | tail -1`
-   set start          = "START = "`head -3 namelist_update | tail -1`
-   set secstart       = "SECSTART = "`head -3 namelist_update | tail -1`
-   set stop           = "STOP = "`head -4 namelist_update | tail -1`
-   set secstop        = "SECSTOP = "`head -4 namelist_update | tail -1`
-   set hist           = "HIST = "`head -5 namelist_update | tail -1`
-   set sechist        = "SECHIST = "`head -5 namelist_update | tail -1`
-   set save           = "SAVE = "`head -5 namelist_update | tail -1`
-   set secsave        = "SECSAVE = "`head -5 namelist_update | tail -1`
+   set start_year   = "START_YEAR = "`head -1 namelist_update | tail -1`
+   set start_day    = "START_DAY = "`head -2 namelist_update | tail -1`
+   set source_start = "SOURCE_START = "`head -3 namelist_update | tail -1`
+   set start        = "START = "`head -3 namelist_update | tail -1`
+   set secstart     = "SECSTART = "`head -3 namelist_update | tail -1`
+   set stop         = "STOP = "`head -4 namelist_update | tail -1`
+   set secstop      = "SECSTOP = "`head -4 namelist_update | tail -1`
+   set hist         = "HIST = "`head -5 namelist_update | tail -1`
+   set sechist      = "SECHIST = "`head -5 namelist_update | tail -1`
+   set save         = "SAVE = "`head -5 namelist_update | tail -1`
+   set secsave      = "SECSAVE = "`head -5 namelist_update | tail -1`
 
    sed -e 's/^;.*//' tiegcm.nml.original >! nml
 
@@ -105,8 +108,6 @@
 
    mv tiegcm.nml.update tiegcm.nml  
 
-#  ls -lrt   
-
    #----------------------------------------------------------------------
    # Block 3: Run the model
    #----------------------------------------------------------------------
@@ -128,6 +129,12 @@
 
    #----------------------------------------------------------------------
    # Block 4: Convert the model output to form needed by DART
+   # AT this point, the model has updated the information in tiegcm_restart_p.nc
+   # We need to get that information back into the DART state vector.
+   #
+   # model_to_dart expects the tiegcm input file     to be 'tiegcm_restart_p.nc'
+   # model_to_dart expects the tiegcm secondary file to be 'tiegcm_s.nc'
+   # model_to_dart writes out the DART file          to be 'temp_ud'
    #----------------------------------------------------------------------
 
    ../model_to_dart

Modified: DART/trunk/models/tiegcm/shell_scripts/run_filter.csh
===================================================================
--- DART/trunk/models/tiegcm/shell_scripts/run_filter.csh	2010-05-21 22:27:48 UTC (rev 4372)
+++ DART/trunk/models/tiegcm/shell_scripts/run_filter.csh	2010-05-26 22:09:31 UTC (rev 4373)
@@ -120,6 +120,7 @@
 
 set DARTDIR = /blhome/tmatsuo/DART/models/tiegcm
 set TIEGCMDIR = /blhome/tmatsuo/DART/models/tiegcm/tiegcm_files
+set EXPERIMENT = /ptmp/tmatsuo/DART/tiegcm/2002_03_28/initial/filter
 
 #-----------------------------------------------------------------------------
 # Get the DART executables, scripts, and input files
@@ -135,8 +136,8 @@
  ${COPY} ${DARTDIR}/shell_scripts/advance_model.csh .
 
 # data files
- ${COPY} ${DARTDIR}/work/obs_seq.out                .
  ${COPY} ${DARTDIR}/work/input.nml                  .
+ ${COPY} ${EXPERIMENT}/obs_seq.out                  .
 
 #-----------------------------------------------------------------------------
 # Get the tiegcm executable, control files, and data files.
@@ -145,42 +146,62 @@
  ${COPY} ${TIEGCMDIR}/tiegcm-nompi                  tiegcm
 #${COPY} ${TIEGCMDIR}/tiegcm                        .
  ${COPY} ${TIEGCMDIR}/tiegcm.nml                    .
- ${COPY} ${TIEGCMDIR}/tiegcm_s.nc                   .
 
 #-----------------------------------------------------------------------------
-# Get the tiegcm input state ... for this experiment, we are using the
-# perturb routine from model_mod() to generate the ensemble from a single state.
-# REQUIREMENT:
-# input.nml:filter_nml:start_from_restart = .FALSE.
-# input.nml:filter_nml:restart_in_file    = 'filter_ics'
+# Get the tiegcm input state ... for this experiment, we generated the ensemble by: 
 #
-# After you have run this once, there will be _many_ initial conditions files 
-# for filter ... 
+# ${COPY} ${TIEGCMDIR}/tiegcm_s.nc                   .
+# ${COPY} ${TIEGCMDIR}/tiegcm_restart_p.nc           .
+# ./model_to_dart || exit 1
+# mv temp_ud filter_ics
 #
-# Convert a TIEGCM file 'tiegcm_restart.nc' to a DART ics file 'filter_ics'
-# 'model_to_dart' has a hardwired output filename of 'temp_ud' ...
+# REQUIREMENT for the case where we have an initial ensemble:
+# input.nml:filter_nml:start_from_restart = .TRUE.
+# input.nml:filter_nml:restart_in_file    = 'filter_ics'
 #-----------------------------------------------------------------------------
+# Put all of the DART initial conditions files and all of the TIEGCM files
+# in the CENTRALDIR - preserving the ensemble member ID for each filename.
+# The advance_model.csh script will copy the appropriate files for each 
+# ensemble member into the model advance directory.
+# These files may be linked to CENTRALDIR since they get copied to the
+# model advance directory. 
+#-----------------------------------------------------------------------------
 
-${COPY} ${TIEGCMDIR}/tiegcm_restart_p.nc           .
-./model_to_dart || exit 1
-mv temp_ud filter_ics
+set ENSEMBLESTRING = `/usr/local/bin/grep -A 42 filter_nml input.nml | grep ens_size`
+set NUM_ENS = `echo $ENSEMBLESTRING[3] | sed -e "s#,##"`
 
+@ i = 1
+while ( $i <= $NUM_ENS )
+
+  set darticname  = `printf "filter_ics.%04d"          $i`
+  set tiesecond   = `printf "tiegcm_s.nc.%04d"         $i`
+  set tierestart  = `printf "tiegcm_restart_p.nc.%04d" $i`
+
+  ln -sf ${EXPERIMENT}/$darticname .
+  ln -sf ${EXPERIMENT}/$tiesecond  .
+  ln -sf ${EXPERIMENT}/$tierestart .
+
+  @ i += 1
+end
+
 #-----------------------------------------------------------------------------
 # Run filter ... 
 #-----------------------------------------------------------------------------
 
+ln -sf tiegcm_restart_p.nc.0001 tiegcm_restart_p.nc
+ln -sf tiegcm_s.nc.0001         tiegcm_s.nc
+
 mpirun.lsf ./filter || exit 2
 
 echo "${JOBNAME} ($JOBID) finished at "`date`
 
 #-----------------------------------------------------------------------------
 # Move the output to storage after filter completes.
-# At this point, all the restart,diagnostic files are in the CENTRALDIR
+# At this point, all the DART restart,diagnostic files are in the CENTRALDIR
 # and need to be moved to the 'experiment permanent' directory.
-# We have had problems with some, but not all, files being moved
-# correctly, so we are adding bulletproofing to check to ensure the filesystem
-# has completed writing the files, etc. Sometimes we get here before
-# all the files have finished being written.
+#
+# TJH: At this point, the output files have pretty 'generic' names.
+# The files should be archived with the assimilation date in their name.
 #-----------------------------------------------------------------------------
 
 echo "Listing contents of CENTRALDIR before archiving"
@@ -188,9 +209,9 @@
 
 exit
 
-${MOVE} *.data *.meta         ${experiment}/tiegcm
-${MOVE} data data.cal         ${experiment}/tiegcm
-${MOVE} STD*                  ${experiment}/tiegcm
+${MOVE} tiegcm_s.nc*               ${experiment}/tiegcm
+${MOVE} tiegcm_restart_p.nc*       ${experiment}/tiegcm
+${MOVE} tiegcm_out_*               ${experiment}/tiegcm
 
 ${MOVE} filter_restart*            ${experiment}/DART
 ${MOVE} assim_model_state_ud[1-9]* ${experiment}/DART
@@ -206,8 +227,6 @@
 ${COPY} *.csh                      ${experiment}/DART
 ${COPY} $myname                    ${experiment}/DART
 
-ls -lrt
-
 exit 0
 
 # <next few lines under version control, do not edit>

Modified: DART/trunk/models/tiegcm/shell_scripts/run_perfect_model_obs.csh
===================================================================
--- DART/trunk/models/tiegcm/shell_scripts/run_perfect_model_obs.csh	2010-05-21 22:27:48 UTC (rev 4372)
+++ DART/trunk/models/tiegcm/shell_scripts/run_perfect_model_obs.csh	2010-05-26 22:09:31 UTC (rev 4373)
@@ -119,8 +119,9 @@
 # Set variables containing various directory names where we will GET things
 #-----------------------------------------------------------------------------
 
-set DARTDIR = /blhome/tmatsuo/DART/models/tiegcm
+set   DARTDIR = /blhome/tmatsuo/DART/models/tiegcm
 set TIEGCMDIR = /blhome/tmatsuo/DART/models/tiegcm/tiegcm_files
+set TIEGCMEXP = /ptmp/tmatsuo/ensemble/0
 
 #-----------------------------------------------------------------------------
 # Get the DART executables, scripts, and input files
@@ -136,7 +137,7 @@
  ${COPY} ${DARTDIR}/shell_scripts/advance_model.csh .
 
 # data files
- ${COPY} ${DARTDIR}/work/obs_seq.in                 .
+ ${COPY} ${TIEGCMEXP}/obs_seq.in                    .
  ${COPY} ${DARTDIR}/work/input.nml                  .
 
 #-----------------------------------------------------------------------------
@@ -147,9 +148,10 @@
  ${COPY} ${TIEGCMDIR}/tiegcm-nompi                  tiegcm
 #${COPY} ${TIEGCMDIR}/tiegcm                        .
  ${COPY} ${TIEGCMDIR}/tiegcm.nml                    .
- ${COPY} ${TIEGCMDIR}/tiegcm_restart_p.nc           .
- ${COPY} ${TIEGCMDIR}/tiegcm_s.nc                   .
 
+ ${COPY} ${TIEGCMEXP}/tiegcm_restart_p.nc           .
+ ${COPY} ${TIEGCMEXP}/tiegcm_s.nc                   .
+
 #-----------------------------------------------------------------------------
 # Check that everything moved OK, and the table is set.
 # Convert a TIEGCM file 'tiegcm_restart.nc' to a DART ics file 'perfect_ics'
@@ -161,8 +163,13 @@
 
 #-----------------------------------------------------------------------------
 # Run perfect_model_obs ... harvest the observations to populate obs_seq.out
+# model_mod expects a generic name // advance_model.csh expects a filename
+# with the ensemble member ID tacked on - must provide both.
 #-----------------------------------------------------------------------------
 
+ln -sf tiegcm_restart_p.nc tiegcm_restart_p.nc.0001
+ln -sf tiegcm_s.nc         tiegcm_s.nc.0001
+
 ./perfect_model_obs || exit 2
 
 echo "${JOBNAME} ($JOBID) finished at "`date`

Modified: DART/trunk/models/tiegcm/work/input.nml
===================================================================
--- DART/trunk/models/tiegcm/work/input.nml	2010-05-21 22:27:48 UTC (rev 4372)
+++ DART/trunk/models/tiegcm/work/input.nml	2010-05-26 22:09:31 UTC (rev 4373)
@@ -25,8 +25,8 @@
    async                    = 2,
    adv_ens_command          = "./advance_model.csh",
    ens_size                 = 4,
-   start_from_restart       = .false.,
-   output_restart           = .false.,
+   start_from_restart       = .true.,
+   output_restart           = .true.,
    obs_sequence_in_name     = "obs_seq.out",
    obs_sequence_out_name    = "obs_seq.final",
    restart_in_file_name     = "filter_ics",
@@ -74,8 +74,8 @@
    restart_out_file_name = 'smoother_restart'  /
 
 &ensemble_manager_nml
-   single_restart_file_in  = .true.,
-   single_restart_file_out = .true.,
+   single_restart_file_in  = .false.,
+   single_restart_file_out = .false.,
    perturbation_amplitude  = 0.2  /
 
 &assim_tools_nml


More information about the Dart-dev mailing list