[Dart-dev] [6027] DART/branches/development/models: Placeholder for the start of coupled-CESM assimilation.
nancy at ucar.edu
nancy at ucar.edu
Tue Apr 2 15:56:15 MDT 2013
Revision: 6027
Author: nancy
Date: 2013-04-02 15:56:14 -0600 (Tue, 02 Apr 2013)
Log Message:
-----------
Placeholder for the start of coupled-CESM assimilation.
Has the start of a model_mod that calls other components.
We will use the shell_scripts directory for the combined
setup script and the combined assimilate.csh script.
Added Paths:
-----------
DART/branches/development/models/CESM/
DART/branches/development/models/CESM/README
DART/branches/development/models/CESM/cesm_to_dart.f90
DART/branches/development/models/CESM/cesm_to_dart.html
DART/branches/development/models/CESM/cesm_to_dart.nml
DART/branches/development/models/CESM/dart_to_cesm.f90
DART/branches/development/models/CESM/dart_to_cesm.html
DART/branches/development/models/CESM/dart_to_cesm.nml
DART/branches/development/models/CESM/matlab/
DART/branches/development/models/CESM/matlab/Check_pop_to_dart.m
DART/branches/development/models/CESM/matlab/Check_ud.m
DART/branches/development/models/CESM/matlab/plot_evolution.m
DART/branches/development/models/CESM/matlab/plot_global_grid.m
DART/branches/development/models/CESM/matlab/plot_grid.m
DART/branches/development/models/CESM/matlab/plot_interp_diffs.m
DART/branches/development/models/CESM/matlab/plot_rmse_xxx_evolution.m
DART/branches/development/models/CESM/matlab/plot_spread_xxx_evolution.m
DART/branches/development/models/CESM/matlab/two_experiments_evolution.m
DART/branches/development/models/CESM/model_mod.f90
DART/branches/development/models/CESM/model_mod.html
DART/branches/development/models/CESM/model_mod.nml
DART/branches/development/models/CESM/shell_scripts/
DART/branches/development/models/CESM/shell_scripts/CESM1_1_setup_hybrid.csh
DART/branches/development/models/CESM/shell_scripts/CESM_setup_beta17.csh
DART/branches/development/models/CESM/shell_scripts/MakeInitialEnsemble.csh
DART/branches/development/models/CESM/shell_scripts/advance_model.csh
DART/branches/development/models/CESM/shell_scripts/assimilate.csh
DART/branches/development/models/CESM/shell_scripts/run_filter.batch
DART/branches/development/models/CESM/shell_scripts/run_perfect_model_obs.batch
DART/branches/development/models/CESM/work/
DART/branches/development/models/CESM/work/README
DART/branches/development/models/CESM/work/input.nml
DART/branches/development/models/CESM/work/mkmf_create_fixed_network_seq
DART/branches/development/models/CESM/work/mkmf_create_obs_sequence
DART/branches/development/models/CESM/work/mkmf_dart_to_pop
DART/branches/development/models/CESM/work/mkmf_filter
DART/branches/development/models/CESM/work/mkmf_obs_diag
DART/branches/development/models/CESM/work/mkmf_obs_seq_to_netcdf
DART/branches/development/models/CESM/work/mkmf_obs_sequence_tool
DART/branches/development/models/CESM/work/mkmf_perfect_model_obs
DART/branches/development/models/CESM/work/mkmf_pop_to_dart
DART/branches/development/models/CESM/work/mkmf_preprocess
DART/branches/development/models/CESM/work/mkmf_restart_file_tool
DART/branches/development/models/CESM/work/mkmf_wakeup_filter
DART/branches/development/models/CESM/work/path_names_create_fixed_network_seq
DART/branches/development/models/CESM/work/path_names_create_obs_sequence
DART/branches/development/models/CESM/work/path_names_dart_to_pop
DART/branches/development/models/CESM/work/path_names_filter
DART/branches/development/models/CESM/work/path_names_obs_diag
DART/branches/development/models/CESM/work/path_names_obs_seq_to_netcdf
DART/branches/development/models/CESM/work/path_names_obs_sequence_tool
DART/branches/development/models/CESM/work/path_names_perfect_model_obs
DART/branches/development/models/CESM/work/path_names_pop_to_dart
DART/branches/development/models/CESM/work/path_names_preprocess
DART/branches/development/models/CESM/work/path_names_restart_file_tool
DART/branches/development/models/CESM/work/path_names_wakeup_filter
DART/branches/development/models/CESM/work/quickbuild.csh
-------------- next part --------------
Added: DART/branches/development/models/CESM/README
===================================================================
--- DART/branches/development/models/CESM/README (rev 0)
+++ DART/branches/development/models/CESM/README 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,14 @@
+# 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
+#
+# DART $Id$
+
+2 April 2013
+
+This is the start of an interface for assimilating observations
+into the fully-coupled CESM whole-system model. It makes use
+of the existing POP (ocean), CLM (land), and CAM (atmosphere)
+model_mod codes.
+
+
Property changes on: DART/branches/development/models/CESM/README
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/cesm_to_dart.f90
===================================================================
--- DART/branches/development/models/CESM/cesm_to_dart.f90 (rev 0)
+++ DART/branches/development/models/CESM/cesm_to_dart.f90 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,111 @@
+! 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
+
+program pop_to_dart
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$
+
+!----------------------------------------------------------------------
+! purpose: interface between POP and DART
+!
+! method: Read POP "restart" files of model state
+! Reform fields into a DART state vector (control vector).
+! Write out state vector in "proprietary" format for DART.
+! The output is a "DART restart file" format.
+!
+! USAGE: The POP filename is read from the pop_in namelist
+! <edit pop_to_dart_output_file in input.nml:pop_to_dart_nml>
+! pop_to_dart
+!
+! author: Tim Hoar 6/24/09
+!----------------------------------------------------------------------
+
+use types_mod, only : r8
+use utilities_mod, only : initialize_utilities, timestamp, &
+ find_namelist_in_file, check_namelist_read
+use model_mod, only : restart_file_to_sv, static_init_model, &
+ get_model_size, get_pop_restart_filename
+use assim_model_mod, only : awrite_state_restart, open_restart_write, close_restart
+use time_manager_mod, only : time_type, print_time, print_date
+
+use netcdf
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=128), parameter :: &
+ source = "$URL$", &
+ revision = "$Revision$", &
+ revdate = "$Date$"
+
+!-----------------------------------------------------------------------
+! namelist parameters with default values.
+!-----------------------------------------------------------------------
+
+character (len = 128) :: pop_to_dart_output_file = 'dart.ud'
+
+namelist /pop_to_dart_nml/ pop_to_dart_output_file
+
+!----------------------------------------------------------------------
+! global storage
+!----------------------------------------------------------------------
+
+integer :: io, iunit, x_size
+type(time_type) :: model_time
+real(r8), allocatable :: statevector(:)
+character (len = 128) :: pop_restart_filename = 'no_pop_restart_filename'
+logical :: verbose = .FALSE.
+
+!----------------------------------------------------------------------
+
+call initialize_utilities(progname='pop_to_dart', output_flag=verbose)
+
+!----------------------------------------------------------------------
+! Call model_mod:static_init_model(), which reads the namelists
+! to set calendar type, starting date, deltaT, etc.
+!----------------------------------------------------------------------
+
+call static_init_model()
+
+!----------------------------------------------------------------------
+! Read the namelist to get the input and output filenames.
+!----------------------------------------------------------------------
+
+call find_namelist_in_file("input.nml", "pop_to_dart_nml", iunit)
+read(iunit, nml = pop_to_dart_nml, iostat = io)
+call check_namelist_read(iunit, io, "pop_to_dart_nml") ! closes, too.
+
+call get_pop_restart_filename( pop_restart_filename )
+
+write(*,*)
+write(*,'(''pop_to_dart:converting POP restart file '',A, &
+ &'' to DART file '',A)') &
+ trim(pop_restart_filename), trim(pop_to_dart_output_file)
+
+!----------------------------------------------------------------------
+! Now that we know the names, get to work.
+!----------------------------------------------------------------------
+
+x_size = get_model_size()
+allocate(statevector(x_size))
+call restart_file_to_sv(pop_restart_filename, statevector, model_time)
+
+iunit = open_restart_write(pop_to_dart_output_file)
+
+call awrite_state_restart(model_time, statevector, iunit)
+call close_restart(iunit)
+
+!----------------------------------------------------------------------
+! When called with 'end', timestamp will call finalize_utilities()
+!----------------------------------------------------------------------
+
+call print_date(model_time, str='pop_to_dart:POP model date')
+call print_time(model_time, str='pop_to_dart:DART model time')
+call timestamp(string1=source, pos='end')
+
+end program pop_to_dart
+
Property changes on: DART/branches/development/models/CESM/cesm_to_dart.f90
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/cesm_to_dart.html
===================================================================
--- DART/branches/development/models/CESM/cesm_to_dart.html (rev 0)
+++ DART/branches/development/models/CESM/cesm_to_dart.html 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,214 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>program pop_to_dart</TITLE>
+<link rel="stylesheet" type="text/css" href="../../doc/html/doc.css" />
+</HEAD>
+<BODY>
+<A NAME="TOP"></A>
+
+<H1>PROGRAM <em class=program>pop_to_dart</em></H1>
+
+<table border=0 summary="" cellpadding=5>
+<tr>
+ <td valign=middle>
+ <img src="../../doc/html/Dartboard7.png" alt="DART project logo" height=70 />
+ </td>
+ <td>
+ <P>Jump to <a href="../../index.html">DART Documentation Main Index</a><br />
+ <small><small>version information for this file: <br />
+ <!-- version tag follows, do not edit -->
+ $Id$</small></small>
+ </P></td>
+</tr>
+</table>
+
+<A HREF="#Namelist">NAMELIST</A> /
+<A HREF="#Modules">MODULES</A> /
+<A HREF="#FilesUsed">FILES</A> /
+<A HREF="#References">REFERENCES</A> /
+<A HREF="#Errors">ERRORS</A> /
+<A HREF="#FuturePlans">PLANS</A> /
+<A HREF="#Legalese">TERMS OF USE</A>
+
+<H2>Overview</H2>
+
+<P>
+ <em class=program>pop_to_dart</em> is the program that reads a POP
+ restart file (usually <em class=file>pop.r.nc</em>) and creates
+ a DART output/restart file
+ (e.g. <em class=file>perfect_ics, filter_ics, ... </em>).
+ <br />
+ <br />
+ The following variables are extracted from the POP netCDF restart
+ files and are conveyed to DART:
+ <em class=code>SALT_CUR</em>,
+ <em class=code>TEMP_CUR</em>,
+ <em class=code>UVEL_CUR</em>,
+ <em class=code>VVEL_CUR</em>, and
+ <em class=code>PSURF_CUR</em>.
+ <br />
+ <br />
+ Conditions required for successful execution of <em class=program>pop_to_dart</em>:
+</P>
+
+<UL>
+ <LI>a valid <em class=file>input.nml</em> namelist file for DART</LI>
+ <LI>a valid <em class=file>pop_in</em> namelist file for POP</LI>
+ <LI>the POP geometry files mentioned in the <em class=file>pop_in</em> namelist file</LI>
+ <LI>a POP restart file (<em class=file>pop.r.nc</em>).</LI>
+</UL>
+
+<P>
+Since this program is called repeatedly for every ensemble member,
+we have found it convenient to link the POP restart files
+to the default input filename (<em class=file>pop.r.nc</em>).
+The default DART output filename is <em class=file>dart.ud</em> -
+this may be moved or linked as necessary.
+</P>
+
+<!--==================================================================-->
+<!--=================== DESCRIPTION OF A NAMELIST ====================-->
+<!--==================================================================-->
+
+<A NAME="Namelist"></A>
+<hr />
+<H2>NAMELIST</H2>
+<P>We adhere to the F90 standard of starting a namelist with an ampersand
+'&' and terminating with a slash '/' for all our namelist input.
+Character strings that contain a '/' must be
+enclosed in quotes to prevent them from prematurely terminating the namelist.
+The namelist declaration is:
+</P>
+<div class=namelist>
+<pre>
+<em class=call>namelist / pop_to_dart_nml / </em> pop_to_dart_output_file
+</pre>
+</div>
+
+<div class=indent1>
+<!-- Description -->
+
+<P>
+This namelist is always read from a file called <em class=file>input.nml</em>.
+</P>
+
+<TABLE border=0 cellpadding=3 width=100%>
+<TR><TH align=left>Contents </TH>
+ <TH align=left>Type </TH>
+ <TH align=left>Description </TH></TR>
+
+<TR><!--contents--><TD valign=top>pop_to_dart_output_file </TD>
+ <!-- type --><TD valign=top>character(len=128) </TD>
+ <!--descript--><TD>The name of the DART file containing the model state
+ derived from the POP restart file.
+ <em class=units>[default: 'dart.ud']</em></TD></TR>
+
+</TABLE>
+
+</div>
+<br />
+
+<!--==================================================================-->
+
+<A NAME="Modules"></A>
+<hr />
+<H2>MODULES USED</H2>
+<PRE>
+assim_model_mod
+dart_pop_mod
+location_mod
+model_mod
+null_mpi_utilities_mod
+obs_kind_mod
+random_nr_mod
+random_seq_mod
+time_manager_mod
+types_mod
+utilities_mod
+</PRE>
+
+<!--==================================================================-->
+<!-- Describe the Files Used by this module. -->
+<!--==================================================================-->
+
+<A NAME="FilesUsed"></A>
+<hr />
+<H2>FILES Read</H2>
+<UL><LI>POP restart file; <em class=file>pop.r.nc</em></LI>
+ <LI>POP namelist file; <em class=file>pop_in</em></LI>
+ <LI>POP geometry files specified in <em class=file>pop_in</em></LI>
+ <LI>DART namelist file; <em class=file>input.nml</em></LI>
+</UL>
+
+<H2>FILES Written</H2>
+<UL><LI>DART initial conditions/restart file; e.g. <em class=file>filter_ic</em></LI>
+</UL>
+
+<!--==================================================================-->
+<!-- Cite references, if need be. -->
+<!--==================================================================-->
+
+<A NAME="References"></A>
+<hr />
+<H2>REFERENCES</H2>
+<P>
+none
+</P>
+
+<!--==================================================================-->
+<!-- Describe all the error conditions and codes. -->
+<!--==================================================================-->
+
+<A NAME="Errors"></A>
+<hr />
+<H2>ERROR CODES and CONDITIONS</H2>
+<P>
+none - all error messages come from modules that have their own documentation.
+</P>
+
+<H2>KNOWN BUGS</H2>
+<P>
+none
+</P>
+
+<!--==================================================================-->
+<!-- Describe Future Plans. -->
+<!--==================================================================-->
+
+<A NAME="FuturePlans"></A>
+<hr />
+<H2>FUTURE PLANS</H2>
+<P>
+None.
+</P>
+
+<!--==================================================================-->
+<!-- Legalese & Metadata -->
+<!--==================================================================-->
+
+<A NAME="Legalese"></A>
+<hr />
+<H2>Terms of Use</H2>
+
+<P>
+DART software - Copyright 2004 - 2011 UCAR.<br />
+This open source software is provided by UCAR, "as is",<br />
+without charge, subject to all terms of use at<br />
+<a href="http://www.image.ucar.edu/DAReS/DART/DART_download">
+http://www.image.ucar.edu/DAReS/DART/DART_download</a>
+</P>
+
+<TABLE border=0 cellpadding=0 width=100% summary="">
+<TR><TD valign=top>Contact: </TD><TD> DART core group </TD></TR>
+<TR><TD valign=top>Revision: </TD><TD> $Revision$ </TD></TR>
+<TR><TD valign=top>Source: </TD><TD> $URL$ </TD></TR>
+<TR><TD valign=top>Change Date: </TD><TD> $Date$ </TD></TR>
+<TR><TD valign=top>Change history: </TD><TD> try "svn log" or "svn diff" </TD></TR>
+</TABLE>
+
+<!--==================================================================-->
+
+</BODY>
+</HTML>
Property changes on: DART/branches/development/models/CESM/cesm_to_dart.html
___________________________________________________________________
Added: svn:mime-type
+ text/html
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/cesm_to_dart.nml
===================================================================
--- DART/branches/development/models/CESM/cesm_to_dart.nml (rev 0)
+++ DART/branches/development/models/CESM/cesm_to_dart.nml 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,3 @@
+&pop_to_dart_nml
+ pop_to_dart_output_file = 'dart.ud' /
+
Property changes on: DART/branches/development/models/CESM/cesm_to_dart.nml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/dart_to_cesm.f90
===================================================================
--- DART/branches/development/models/CESM/dart_to_cesm.f90 (rev 0)
+++ DART/branches/development/models/CESM/dart_to_cesm.f90 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,136 @@
+! 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
+
+program dart_to_pop
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$
+
+!----------------------------------------------------------------------
+! purpose: interface between DART and the POP model
+!
+! method: Read DART state vector and overwrite values in a POP restart file.
+! If the DART state vector has an 'advance_to_time' present, a
+! file called pop_in.DART is created with a time_manager_nml namelist
+! appropriate to advance POP to the requested time.
+!
+! The dart_to_pop_nml namelist setting for advance_time_present
+! determines whether or not the input file has an 'advance_to_time'.
+! Typically, only temporary files like 'assim_model_state_ic' have
+! an 'advance_to_time'.
+!
+! author: Tim Hoar 25 Jun 09, revised 12 July 2010
+!----------------------------------------------------------------------
+
+use types_mod, only : r8
+use utilities_mod, only : initialize_utilities, timestamp, &
+ find_namelist_in_file, check_namelist_read, &
+ logfileunit
+use assim_model_mod, only : open_restart_read, aread_state_restart, close_restart
+use time_manager_mod, only : time_type, print_time, print_date, operator(-)
+use model_mod, only : static_init_model, sv_to_restart_file, &
+ get_model_size, get_pop_restart_filename
+use dart_pop_mod, only : write_pop_namelist
+
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=128), parameter :: &
+ source = "$URL$", &
+ revision = "$Revision$", &
+ revdate = "$Date$"
+
+!------------------------------------------------------------------
+! The namelist variables
+!------------------------------------------------------------------
+
+character (len = 128) :: dart_to_pop_input_file = 'dart.ic'
+logical :: advance_time_present = .false.
+
+namelist /dart_to_pop_nml/ dart_to_pop_input_file, &
+ advance_time_present
+
+!----------------------------------------------------------------------
+
+integer :: iunit, io, x_size
+type(time_type) :: model_time, adv_to_time
+real(r8), allocatable :: statevector(:)
+character (len = 128) :: pop_restart_filename = 'no_pop_restart_file'
+logical :: verbose = .FALSE.
+
+!----------------------------------------------------------------------
+
+call initialize_utilities(progname='dart_to_pop', output_flag=verbose)
+
+!----------------------------------------------------------------------
+! Call model_mod:static_init_model() which reads the POP namelists
+! to set grid sizes, etc.
+!----------------------------------------------------------------------
+
+call static_init_model()
+
+x_size = get_model_size()
+allocate(statevector(x_size))
+
+! Read the namelist to get the input filename.
+
+call find_namelist_in_file("input.nml", "dart_to_pop_nml", iunit)
+read(iunit, nml = dart_to_pop_nml, iostat = io)
+call check_namelist_read(iunit, io, "dart_to_pop_nml")
+
+call get_pop_restart_filename( pop_restart_filename )
+
+write(*,*)
+write(*,'(''dart_to_pop:converting DART file '',A, &
+ &'' to POP restart file '',A)') &
+ trim(dart_to_pop_input_file), trim(pop_restart_filename)
+
+!----------------------------------------------------------------------
+! Reads the valid time, the state, and the target time.
+!----------------------------------------------------------------------
+
+iunit = open_restart_read(dart_to_pop_input_file)
+
+if ( advance_time_present ) then
+ call aread_state_restart(model_time, statevector, iunit, adv_to_time)
+else
+ call aread_state_restart(model_time, statevector, iunit)
+endif
+call close_restart(iunit)
+
+!----------------------------------------------------------------------
+! update the current POP state vector
+! Convey the amount of time to integrate the model ...
+! time_manager_nml: stop_option, stop_count increments
+!----------------------------------------------------------------------
+
+call sv_to_restart_file(statevector, pop_restart_filename, model_time)
+
+if ( advance_time_present ) then
+ call write_pop_namelist(model_time, adv_to_time)
+endif
+
+!----------------------------------------------------------------------
+! Log what we think we're doing, and exit.
+!----------------------------------------------------------------------
+
+call print_date( model_time,'dart_to_pop:POP model date')
+call print_time( model_time,'dart_to_pop:DART model time')
+call print_date( model_time,'dart_to_pop:POP model date',logfileunit)
+call print_time( model_time,'dart_to_pop:DART model time',logfileunit)
+
+if ( advance_time_present ) then
+call print_time(adv_to_time,'dart_to_pop:advance_to time')
+call print_date(adv_to_time,'dart_to_pop:advance_to date')
+call print_time(adv_to_time,'dart_to_pop:advance_to time',logfileunit)
+call print_date(adv_to_time,'dart_to_pop:advance_to date',logfileunit)
+endif
+
+! When called with 'end', timestamp will call finalize_utilities()
+call timestamp(string1=source, pos='end')
+
+end program dart_to_pop
Property changes on: DART/branches/development/models/CESM/dart_to_cesm.f90
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/dart_to_cesm.html
===================================================================
--- DART/branches/development/models/CESM/dart_to_cesm.html (rev 0)
+++ DART/branches/development/models/CESM/dart_to_cesm.html 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,267 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<HTML>
+<HEAD>
+<TITLE>program dart_to_pop</TITLE>
+<link rel="stylesheet" type="text/css" href="../../doc/html/doc.css" />
+</HEAD>
+<BODY>
+<A NAME="TOP"></A>
+
+<H1>PROGRAM <em class=program>dart_to_pop</em></H1>
+
+<table border=0 summary="" cellpadding=5>
+<tr>
+ <td valign=middle>
+ <img src="../../doc/html/Dartboard7.png" alt="DART project logo" height=70 />
+ </td>
+ <td>
+ <P>Jump to <a href="../../index.html">DART Documentation Main Index</a><br />
+ <small><small>version information for this file: <br />
+ <!-- version tag follows, do not edit -->
+ $Id$</small></small>
+ </P></td>
+</tr>
+</table>
+
+<A HREF="#Namelist">NAMELIST</A> /
+<A HREF="#Modules">MODULES</A> /
+<A HREF="#FilesUsed">FILES</A> /
+<A HREF="#References">REFERENCES</A> /
+<A HREF="#Errors">ERRORS</A> /
+<A HREF="#FuturePlans">PLANS</A> /
+<A HREF="#Legalese">TERMS OF USE</A>
+
+<H2>Overview</H2>
+
+<P>
+ <em class=program>dart_to_pop</em> is the program that updates a POP
+ netCDF-format restart file (usually <em class=file>pop.r.nc</em>)
+ with the state information contained in a DART output/restart file
+ (e.g. <em class=file>perfect_ics, filter_ics, ... </em>).
+ Only the CURRENT values in the POP restart file will be updated:
+ specifically -
+ <em class=code>SALT_CUR</em>,
+ <em class=code>TEMP_CUR</em>,
+ <em class=code>UVEL_CUR</em>,
+ <em class=code>VVEL_CUR</em>, and
+ <em class=code>PSURF_CUR</em>. It is <strong>necessary</strong> to
+ perform a forward euler timestep since the '<em class=code>_OLD</em>'
+ variables are untouched by DART. The DART model time is compared to the
+ time in the POP restart file. If they are not identical, the program
+ issues an error message and aborts.
+ <br />
+ <br />
+ From the user perspective, most of the time
+ <em class=program>dart_to_pop</em> will be used on DART files that
+ have a header containing one time stamp followed by the model state.
+ <br />
+ <br />
+ The <a href=#Namelist>dart_to_pop_nml</a> namelist allows
+ <em class=program>dart_to_pop</em> to read the
+ <em class=file>assim_model_state_ic</em> files that have
+ <em class=italic>two</em> timestamps in the header. These files are
+ temporarily generated when DART is used to advance the model.
+ One timestamp is the 'advance_to' time, the other is the 'valid_time'
+ of the model state. In this case, a namelist for POP (called
+ <em class=file>pop_in.DART</em>) is written that contains the
+ <em class=code>&time_manager_nml</em> settings appropriate to
+ advance POP to the time requested by DART. The repository version
+ of the <em class=program>advance_model.csh</em> script has a section
+ to ensure the proper DART namelist settings for this case.
+ <br />
+ <br />
+ Conditions required for successful execution of <em class=program>dart_to_pop</em>:
+</P>
+
+<UL>
+ <LI>a valid <em class=file>input.nml</em> namelist file for DART</LI>
+ <LI>a DART file (typically <em class=file>filter_restart.xxxx</em> or
+ <em class=file>filter_ics.xxxx</em>)</LI>
+ <LI>a valid <em class=file>pop_in</em> namelist file for POP</LI>
+ <LI>the POP geometry files mentioned in the <em class=file>pop_in</em> namelist file</LI>
+ <LI>a POP restart file (typically <em class=file>pop.r.nc</em>).
+ Keep in mind that the DART/POP interface requires the existence of
+ a <em class=file>pop.r.nc</em> to harvest the geometry dimensions.</LI>
+</UL>
+
+<P>
+Since this program is called repeatedly for every ensemble member,
+we have found it convenient to link the DART input file
+to the default input filename (<em class=file>dart.ic</em>). The same
+thing goes true for the POP output filename <em class=file>pop.r.nc</em>.
+</P>
+
+<!--==================================================================-->
+<!--=================== DESCRIPTION OF A NAMELIST ====================-->
+<!--==================================================================-->
+
+<A NAME="Namelist"></A>
+<hr />
+<H2>NAMELIST</H2>
+<P>We adhere to the F90 standard of starting a namelist with an ampersand
+'&' and terminating with a slash '/' for all our namelist input.
+Character strings that contain a '/' must be
+enclosed in quotes to prevent them from prematurely terminating the namelist.
+The namelist declaration is:
+</P>
+<div class=namelist>
+<pre>
+<em class=call>namelist / dart_to_pop_nml / </em> dart_to_pop_input_file, advance_time_present
+</pre>
+</div>
+
+<div class=indent1>
+<!-- Description -->
+
+<P>
+This namelist is always read from a file called <em class=file>input.nml</em>.
+</P>
+
+<TABLE border=0 cellpadding=3 width=100%>
+<TR><TH align=left>Contents </TH>
+ <TH align=left>Type </TH>
+ <TH align=left>Description </TH></TR>
+
+<TR><!--contents--><TD valign=top>dart_to_pop_input_file </TD>
+ <!-- type --><TD valign=top>character(len=128) </TD>
+ <!--descript--><TD>The name of the DART file containing the model state
+ to insert into the POP restart file.
+ <em class=units>[default: 'dart.ic']</em></TD></TR>
+
+<TR><!--contents--><TD valign=top>advance_time_present</TD>
+ <!-- type --><TD valign=top>logical</TD>
+ <!--descript--><TD>switch to control the ability to read a DART file
+ containing TWO timestamps in the file header.
+ If you are converting a DART initial conditions or
+ restart file - this should be
+ <em class=code>.false.</em> - these files have a
+ single timestamp describing the valid time of the
+ model state.
+ <br />
+ <br />
+ If <em class=code>.true.</em>, TWO timestamps are
+ expected to be the DART file header. In this case, a
+ namelist for POP (called <em class=file>pop_in.DART</em>)
+ is created that contains the
+ <em class=code>&time_manager_nml</em> settings
+ appropriate to advance POP to the time
+ requested by DART.
+ <em class=units>[default: .false.]</em></TD></TR>
+</TABLE>
+
+</div>
+<br />
+
+<!--==================================================================-->
+
+<A NAME="Modules"></A>
+<hr />
+<H2>MODULES USED</H2>
+<PRE>
+assim_model_mod
+dart_pop_mod
+location_mod
+model_mod
+null_mpi_utilities_mod
+obs_kind_mod
+random_nr_mod
+random_seq_mod
+time_manager_mod
+types_mod
+utilities_mod
+</PRE>
+
+<!--==================================================================-->
+<!-- Describe the Files Used by this module. -->
+<!--==================================================================-->
+
+<A NAME="FilesUsed"></A>
+<hr />
+<H2>FILES Read</H2>
+<UL><LI>DART initial conditions/restart file; e.g. <em class=file>filter_ic</em></LI>
+ <LI>DART namelist file; <em class=file>input.nml</em></LI>
+ <LI>POP namelist file; <em class=file>pop_in</em></LI>
+ <LI>POP geometry files specified in <em class=file>pop_in</em></LI>
+ <LI>POP restart file <em class=file>pop.r.nc</em> (to get grid values)</LI>
+</UL>
+
+<H2>FILES Written</H2>
+<UL><LI>POP restart file; <em class=file>pop.r.nc</em></LI>
+ <LI>POP namelist file; <em class=file>pop_in.DART</em></LI>
+</UL>
+
+
+<!--==================================================================-->
+<!-- Cite references, if need be. -->
+<!--==================================================================-->
+
+<A NAME="References"></A>
+<hr />
+<H2>REFERENCES</H2>
+<ul>
+<li>Anderson, J., T. Hoar, K. Raeder,
+ H. Liu, N. Collins, R. Torn,
+ and A. Arellano, 2009:<br />
+ The Data Assimilation Research Testbed: A Community Facility.
+ <span style="font-style: italic;">Bull. Amer. Meteor. Soc.</span>,
+ <span style="font-weight: bold;">90</span>, 1283-1296.<br />
+ <a href="http://ams.allenpress.com/perlserv/?doi=10.1175%2F2009BAMS2618.1&request=get-abstract">DOI: 10.1175/2009BAMS2618.1</a></li>
+</ul>
+<br />
+
+<!--==================================================================-->
+<!-- Describe all the error conditions and codes. -->
+<!--==================================================================-->
+
+<A NAME="Errors"></A>
+<hr />
+<H2>ERROR CODES and CONDITIONS</H2>
+<P>
+none - all error messages come from modules that have their own documentation.
+</P>
+
+<H2>KNOWN BUGS</H2>
+<P>
+none
+</P>
+
+<!--==================================================================-->
+<!-- Describe Future Plans. -->
+<!--==================================================================-->
+
+<A NAME="FuturePlans"></A>
+<hr />
+<H2>FUTURE PLANS</H2>
+<P>
+None.
+</P>
+
+<!--==================================================================-->
+<!-- Legalese & Metadata -->
+<!--==================================================================-->
+
+<A NAME="Legalese"></A>
+<hr />
+<H2>Terms of Use</H2>
+
+<P>
+DART software - Copyright 2004 - 2011 UCAR.<br />
+This open source software is provided by UCAR, "as is",<br />
+without charge, subject to all terms of use at<br />
+<a href="http://www.image.ucar.edu/DAReS/DART/DART_download">
+http://www.image.ucar.edu/DAReS/DART/DART_download</a>
+</P>
+
+<TABLE border=0 cellpadding=0 width=100% summary="">
+<TR><TD valign=top>Contact: </TD><TD> DART core group </TD></TR>
+<TR><TD valign=top>Revision: </TD><TD> $Revision$ </TD></TR>
+<TR><TD valign=top>Source: </TD><TD> $URL$ </TD></TR>
+<TR><TD valign=top>Change Date: </TD><TD> $Date$ </TD></TR>
+<TR><TD valign=top>Change history: </TD><TD> try "svn log" or "svn diff" </TD></TR>
+</TABLE>
+
+<!--==================================================================-->
+
+</BODY>
+</HTML>
Property changes on: DART/branches/development/models/CESM/dart_to_cesm.html
___________________________________________________________________
Added: svn:mime-type
+ text/html
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/dart_to_cesm.nml
===================================================================
--- DART/branches/development/models/CESM/dart_to_cesm.nml (rev 0)
+++ DART/branches/development/models/CESM/dart_to_cesm.nml 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,4 @@
+&dart_to_pop_nml
+ dart_to_pop_input_file = 'dart.ic',
+ advance_time_present = .false. /
+
Property changes on: DART/branches/development/models/CESM/dart_to_cesm.nml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/matlab/Check_pop_to_dart.m
===================================================================
--- DART/branches/development/models/CESM/matlab/Check_pop_to_dart.m (rev 0)
+++ DART/branches/development/models/CESM/matlab/Check_pop_to_dart.m 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,159 @@
+function [dart pop] = Check_pop_to_dart(popfile,dartfile)
+%% Check_pop_to_dart : check pop_to_dart.f90 ... the conversion of a POP restart to a DART state vector file.
+%
+% popfile = 'pop.r.nc';
+% dartfile = 'dart.ics';
+% x = Check_pop_to_dart(popfile, dartfile);
+%
+% popfile = '~DART/models/POP/work/cx3.dart.001.pop.r.0002-01-01-00000.nc';
+% dartfile = '~DART/models/POP/work/perfect_ics';
+% [dart pop] = Check_pop_to_dart(popfile, dartfile);
+
+%% 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
+%
+% <next few lines under version control, do not edit>
+% $URL$
+% $Id$
+% $Revision$
+% $Date$
+
+% Read the original POP file values.
+if (exist(popfile,'file') ~= 2)
+ error('POP file %s does not exist.',popfile)
+end
+if (exist(dartfile,'file') ~= 2)
+ error('DART file %s does not exist.',dartfile)
+end
+
+iyear = nc_attget(popfile,nc_global,'iyear');
+imonth = nc_attget(popfile,nc_global,'imonth');
+iday = nc_attget(popfile,nc_global,'iday');
+ihour = nc_attget(popfile,nc_global,'ihour');
+iminute = nc_attget(popfile,nc_global,'iminute');
+isecond = nc_attget(popfile,nc_global,'isecond');
+
+fprintf('POP year month day hour minute second %d %d %d %d %d %d\n', ...
+ iyear,imonth,iday,ihour,iminute,isecond);
+
+% The nc_varget() function returns the variables with the fastest
+% varying dimension on the right. This is opposite to the Fortran
+% convention of the fastest varying dimension on the left ... so
+% one of the variables must be permuted in order to be compared.
+
+S = nc_varget(popfile, 'SALT_CUR'); pop.S = permute(S, [3 2 1]);
+T = nc_varget(popfile, 'TEMP_CUR'); pop.T = permute(T, [3 2 1]);
+U = nc_varget(popfile, 'UVEL_CUR'); pop.U = permute(U, [3 2 1]);
+V = nc_varget(popfile, 'VVEL_CUR'); pop.V = permute(V, [3 2 1]);
+PSURF = nc_varget(popfile, 'PSURF_CUR'); pop.PSURF = permute(PSURF, [2 1]);
+
+disp(sprintf('pop.PSURF min/max are %0.8g %0.8g',min(pop.PSURF(:)),max(pop.PSURF(:))))
+
+[nx ny nz] = size(pop.U);
+fprintf('vert dimension size is %d\n',nz)
+fprintf('N-S dimension size is %d\n',ny)
+fprintf('E-W dimension size is %d\n',nx)
+
+modelsize = nx*ny*nz;
+
+% filesize = S,T,U,V * (nx*ny*nz) + SSH * (nx*ny)
+storage = 8;
+size2d = nx*ny;
+size3d = nx*ny*nz;
+n2ditems = 1*size2d;
+n3ditems = 4*size3d;
+rec1size = 4+(4+4)+4; % time stamps ...
+rec2size = 4+(n3ditems*storage + n2ditems*storage)+4;
+
+fsize = rec1size + rec2size;
+disp(sprintf('with a modelsize of %d the file size should be %d bytes', ...
+ modelsize,fsize))
+
+% Open and read timetag for state
+fid = fopen(dartfile,'rb','ieee-le');
+trec1 = fread(fid,1,'int32');
+seconds = fread(fid,1,'int32');
+days = fread(fid,1,'int32');
+trecN = fread(fid,1,'int32');
+
+fprintf('need to know POP calendar for better comparison.\n', days,seconds);
+fprintf('DART days seconds %d %d\n', days,seconds);
+
+if (trec1 ~= trecN)
+ error('first record mismatch')
+end
+
+% Successively read state vector variables.
+rec1 = fread(fid, 1, 'int32');
+dart.S = get_data(fid, [nx ny nz], 'float64');
+dart.T = get_data(fid, [nx ny nz], 'float64');
+dart.U = get_data(fid, [nx ny nz], 'float64');
+dart.V = get_data(fid, [nx ny nz], 'float64');
+dart.SSH = get_data(fid, [nx ny ], 'float64');
+recN = fread(fid, 1, 'int32');
+fclose(fid);
+
+fprintf(' shape of DART variables is %d \n',size(dart.S))
+
+% The POP restart file has PSURF ... DART drags around SSH
+% SSH = psurf/980.6;
+
+dart.PSURF = dart.SSH * 980.6;
+
+disp(sprintf('PSURF min/max are %0.8g %0.8g',min(dart.PSURF(:)),max(dart.PSURF(:))))
+disp(sprintf('SSH min/max are %0.8g %0.8g',min(dart.SSH(:)),max(dart.SSH(:))))
+
+if (rec1 ~= recN)
+ error('second record mismatch')
+end
+
+dart.dartfile = dartfile;
+dart.seconds = seconds;
+dart.days = days;
+
+% Find the range of the mismatch
+
+d = pop.S - dart.S; disp(sprintf('S diffs are %0.8g %0.8g',min(d(:)),max(d(:))))
+d = pop.T - dart.T; disp(sprintf('T diffs are %0.8g %0.8g',min(d(:)),max(d(:))))
+d = pop.U - dart.U; disp(sprintf('U diffs are %0.8g %0.8g',min(d(:)),max(d(:))))
+d = pop.V - dart.V; disp(sprintf('V diffs are %0.8g %0.8g',min(d(:)),max(d(:))))
+d = pop.PSURF - dart.PSURF; disp(sprintf('PSURF diffs are %0.8g %0.8g',min(d(:)),max(d(:))))
+
+% As an added bonus, we create an 'assim_model_state_ic' file with an
+% advance-to-time one day in the future.
+% Add something known to each state variable to check dart_to_pop.f90
+
+S1 = dart.S + 1.0;
+T1 = dart.T + 2.0;
+U1 = dart.U + 3.0;
+V1 = dart.V + 4.0;
+SSH1 = dart.SSH + 5.0;
+
+datvec = [S1(:); T1(:); U1(:); V1(:); SSH1(:)];
+clear S1 T1 U1 V1 SSH1
+
+fid = fopen('test.ic','wb','ieee-le');
+% Write the 'advance_to_time' FIRST
+fwrite(fid, trec1,'int32');
+fwrite(fid,seconds,'int32');
+fwrite(fid, days+1,'int32');
+fwrite(fid, trecN,'int32');
+
+% Write the 'model_state_time' (close to the data)
+fwrite(fid, trec1,'int32');
+fwrite(fid,seconds,'int32');
+fwrite(fid, days,'int32');
+fwrite(fid, trecN,'int32');
+
+% Write the (modified) model state ...
+fwrite(fid, rec1, 'int32');
+fwrite(fid, datvec, 'float64');
+fwrite(fid, recN, 'int32');
+fclose(fid);
+
+% That's all folks ...
+
+function B = get_data(fid, shape, typestr)
+A = fread(fid, prod(shape), typestr);
+B = reshape(A, shape);
Property changes on: DART/branches/development/models/CESM/matlab/Check_pop_to_dart.m
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author HeadURL Id
Added: svn:eol-style
+ native
Added: DART/branches/development/models/CESM/matlab/Check_ud.m
===================================================================
--- DART/branches/development/models/CESM/matlab/Check_ud.m (rev 0)
+++ DART/branches/development/models/CESM/matlab/Check_ud.m 2013-04-02 21:56:14 UTC (rev 6027)
@@ -0,0 +1,164 @@
+function [dart pop] = Check_ud(popfile,dartfile)
+%% Check_ud : check pop_to_dart.f90 ... the conversion of a POP restart to a DART state vector file.
+%
+% popfile = 'pop.r.nc'
+% dartfile = 'dart.ics';
+% x = Check_pop_to_dart(popfile, dartfile);
+%
+% popfile = '~DART/models/POP/work/cx3.dart.001.pop.r.0002-01-01-00000.nc';
+% dartfile = '~DART/models/POP/work/perfect_ics';
+% [dart pop] = Check_pop_to_dart(popfile, dartfile);
+
+%% 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
+%
+% <next few lines under version control, do not edit>
+% $URL$
+% $Id$
+% $Revision$
+% $Date$
+
+% Read the original POP file values.
+if (exist(popfile,'file') ~= 2)
+ error('POP file %s does not exist.',popfile)
+end
+if (exist(dartfile,'file') ~= 2)
+ error('DART file %s does not exist.',dartfile)
+end
+
+iyear = nc_attget(popfile,nc_global,'iyear');
+imonth = nc_attget(popfile,nc_global,'imonth');
+iday = nc_attget(popfile,nc_global,'iday');
+ihour = nc_attget(popfile,nc_global,'ihour');
+iminute = nc_attget(popfile,nc_global,'iminute');
+isecond = nc_attget(popfile,nc_global,'isecond');
+
+fprintf('POP year month day hour minute second %d %d %d %d %d %d\n', ...
+ iyear,imonth,iday,ihour,iminute,isecond);
+
+pop.S = nc_varget(popfile, 'SALT_CUR');
+pop.T = nc_varget(popfile, 'TEMP_CUR');
+pop.U = nc_varget(popfile, 'UVEL_CUR');
+pop.V = nc_varget(popfile, 'VVEL_CUR');
+pop.PSURF = nc_varget(popfile, 'PSURF_CUR');
+
+[nz ny nx] = size(pop.U);
+fprintf('vert dimension size is %d\n',nz)
+fprintf('N-S dimension size is %d\n',ny)
+fprintf('E-W dimension size is %d\n',nx)
+
+modelsize = nz*ny*nx;
+
+% filesize = S,T,U,V * (nx*ny*nz) + SSH * (nx*ny)
+storage = 8;
+size2d = nx*ny;
+size3d = nx*ny*nz;
+n2ditems = 1*size2d;
+n3ditems = 4*size3d;
+rec1size = 4+(4+4)+4; % time stamps ...
+rec2size = 4+(n3ditems*storage + n2ditems*storage)+4;
+
+fsize = rec1size + rec2size;
+disp(sprintf('with a modelsize of %d the file size should be %d bytes', ...
+ modelsize,fsize))
+
+% Open and read timetag for state
+fid = fopen(dartfile,'rb','ieee-le');
+trec1 = fread(fid,1,'int32');
+seconds = fread(fid,1,'int32');
+days = fread(fid,1,'int32');
+trecN = fread(fid,1,'int32');
+
+fprintf('need to know POP calendar for better comparison.\n', days,seconds);
+fprintf('DART days seconds %d %d\n', days,seconds);
+
+if (trec1 ~= trecN)
+ error('first record mismatch')
+end
+
+% Successively read state vector variables.
+rec1 = fread(fid, 1, 'int32');
+dart.S = get_3D_permuted(fid, [nx ny nz], 'float64');
+dart.T = get_3D_permuted(fid, [nx ny nz], 'float64');
+dart.U = get_3D_permuted(fid, [nx ny nz], 'float64');
+dart.V = get_3D_permuted(fid, [nx ny nz], 'float64');
+dart.SSH = get_2D_permuted(fid, [nx ny ], 'float64');
@@ Diff output truncated at 40000 characters. @@
More information about the Dart-dev
mailing list