[Dart-dev] [3646] DART/trunk: Added the model_nml parameters for
assimilation_period
nancy at ucar.edu
nancy at ucar.edu
Fri Nov 7 14:47:16 MST 2008
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20081107/03a8d9af/attachment-0001.html
-------------- next part --------------
Modified: DART/trunk/doc/html/obs_diag_profile_example.png
===================================================================
(Binary files differ)
Modified: DART/trunk/models/MITgcm_ocean/model_mod.f90
===================================================================
--- DART/trunk/models/MITgcm_ocean/model_mod.f90 2008-11-06 20:06:46 UTC (rev 3645)
+++ DART/trunk/models/MITgcm_ocean/model_mod.f90 2008-11-07 21:47:15 UTC (rev 3646)
@@ -14,7 +14,7 @@
! This is the interface between the MITgcm ocean model and DART.
! Modules that are absolutely required for use are listed
-use types_mod, only : r4, r8
+use types_mod, only : r4, r8, SECPERDAY
use time_manager_mod, only : time_type, set_time, set_date, get_date, get_time, &
set_calendar_type, GREGORIAN, print_time, print_date, &
operator(*), operator(+), operator(-), &
@@ -25,8 +25,9 @@
VERTISHEIGHT, get_location, vert_is_height, &
vert_is_level, vert_is_surface
use utilities_mod, only : register_module, error_handler, E_ERR, E_WARN, E_MSG, &
- logfileunit, get_unit, nc_check, do_output, &
- find_namelist_in_file, check_namelist_read
+ logfileunit, get_unit, nc_check, do_output, to_upper, &
+ find_namelist_in_file, check_namelist_read, &
+ open_file, file_exist
use obs_kind_mod, only : KIND_TEMPERATURE, KIND_SALINITY, KIND_U_CURRENT_COMPONENT, &
KIND_V_CURRENT_COMPONENT, KIND_SEA_SURFACE_HEIGHT
use mpi_utilities_mod, only: my_task_id
@@ -60,9 +61,10 @@
public :: prog_var_to_vector, vector_to_prog_var, &
MIT_meta_type, read_meta, write_meta, &
read_snapshot, write_snapshot, get_gridsize, &
+ write_data_namelistfile, set_model_end_time, &
snapshot_files_to_sv, sv_to_snapshot_files, &
timestep_to_DARTtime, DARTtime_to_MITtime, &
- DARTtime_to_timestepindex
+ DARTtime_to_timestepindex
! version controlled file description for error handling, do not edit
character(len=128), parameter :: &
@@ -257,7 +259,7 @@
!real(r8) :: delta_lat, delta_lon, delta_depth
!real(r8), allocatable :: lat_grid(:), lon_grid(:), depth_grid(:)
-real(r8) :: timestep = 900.0_r4
+real(r8) :: ocean_dynamics_timestep = 900.0_r4
integer :: timestepcount = 0
type(time_type) :: model_time, model_timestep
@@ -266,9 +268,14 @@
! Skeleton of a model_nml that would be in input.nml
! This is where dart-related model parms could be set.
logical :: output_state_vector = .true.
+integer :: assimilation_period_days = 7
+integer :: assimilation_period_seconds = 0
real(r8) :: model_perturbation_amplitude = 0.2
-namelist /model_nml/ output_state_vector, model_perturbation_amplitude
+namelist /model_nml/ output_state_vector, &
+ assimilation_period_days, &
+ assimilation_period_seconds, &
+ model_perturbation_amplitude
! /pkg/mdsio/mdsio_write_meta.F writes the .meta files
type MIT_meta_type
@@ -310,6 +317,7 @@
! it reads in the grid information and then the model data.
integer :: i, iunit, io
+integer :: ss, dd
! The Plan:
!
@@ -334,6 +342,7 @@
! we'll say we've been initialized pretty dang early.
module_initialized = .true.
+
! Read the DART namelist for this model
call find_namelist_in_file("input.nml", "model_nml", iunit)
read(iunit, nml = model_nml, iostat = io)
@@ -370,7 +379,7 @@
if ((deltaTmom == deltaTtracer) .and. &
(deltaTmom == deltaTClock ) .and. &
(deltaTClock == deltaTtracer)) then
- timestep = deltaTmom ! need a time_type version
+ ocean_dynamics_timestep = deltaTmom ! need a time_type version
else
write(msgstring,*)"namelist PARM03 has deltaTmom /= deltaTtracer /= deltaTClock"
call error_handler(E_MSG,"static_init_model", msgstring, source, revision, revdate)
@@ -380,9 +389,20 @@
call error_handler(E_ERR,"static_init_model", msgstring, source, revision, revdate)
endif
-model_timestep = set_time(nint(endTime), 0) ! works with deltaTmom > 86400
+! Define the assimilation period as the model_timestep
+! Ensure model_timestep is multiple of ocean_dynamics_timestep
+
model_time = timestep_to_DARTtime(timestepcount)
+model_timestep = set_model_time_step(assimilation_period_seconds, &
+ assimilation_period_days, &
+ ocean_dynamics_timestep)
+call get_time(model_timestep,ss,dd) ! set_time() assures the seconds [0,86400)
+
+write(msgstring,*)"assimilation period is ",dd," days ",ss," seconds"
+call error_handler(E_MSG,'static_init_model',msgstring,source,revision,revdate)
+if (do_output()) write(logfileunit,*)msgstring
+
! Grid-related variables are in PARM04
delX(:) = 0.0_r4
delY(:) = 0.0_r4
@@ -1036,6 +1056,33 @@
+function set_model_time_step(ss, dd, dt)
+!------------------------------------------------------------------
+!
+! Sets the model 'timestep' AKA 'assimilation period'.
+! Must make sure the assimilation period is a multiple of the
+! model's dynamical timestepping requirement.
+
+integer, intent(in) :: ss ! assimilation_period_seconds
+integer, intent(in) :: dd ! assimilation_period_days
+real(r8), intent(in) :: dt ! ocean_dynamics_timestep
+
+type(time_type) :: set_model_time_step
+
+integer :: assim_period, ndt
+
+if ( .not. module_initialized ) call static_init_model
+
+assim_period = ss + dd*SECPERDAY ! in seconds
+ndt = max(nint(assim_period / dt),1)
+assim_period = nint(ndt * dt)
+
+set_model_time_step = set_time(assim_period, 0) ! works seconds > 86400
+
+end function set_model_time_step
+
+
+
function get_model_time_step()
!------------------------------------------------------------------
!
@@ -1053,6 +1100,26 @@
+subroutine set_model_end_time(adv_to_offset)
+!------------------------------------------------------------------
+!
+! sets PARM03:endTime to reflect the time when the model will stop.
+! endTime is in module storage
+
+type(time_type), intent(in) :: adv_to_offset
+
+integer :: secs, days
+
+if ( .not. module_initialized ) call static_init_model
+
+call get_time(adv_to_offset, secs, days)
+
+endTime = (secs + days*SECPERDAY)
+
+end subroutine set_model_end_time
+
+
+
subroutine get_state_meta_data(index_in, location, var_type)
!------------------------------------------------------------------
!
@@ -2595,17 +2662,17 @@
! the timestepindex can be a 10 digit integer ... potential overflow
! when multiplied by a large deltaT
-maxtimestep = HUGE(modeloffset)/timestep
+maxtimestep = HUGE(modeloffset)/ocean_dynamics_timestep
if (TimeStepIndex >= maxtimestep) then
write(msgstring,*)' timestepindex (',TimeStepIndex, &
- ') * timestep (',timestep,') overflows.'
+ ') * timestep (',ocean_dynamics_timestep,') overflows.'
call error_handler(E_ERR,'model_mod:timestep_to_DARTtime',msgstring,source,revision,revdate)
endif
-modeloffset = nint(TimeStepIndex * timestep)
-dd = modeloffset / (24*60*60) ! use integer arithmetic
-ss = modeloffset - (dd*24*60*60)
+modeloffset = nint(TimeStepIndex * ocean_dynamics_timestep)
+dd = modeloffset / SECPERDAY ! use integer arithmetic
+ss = modeloffset - (dd*SECPERDAY)
offset = set_time(ss,dd)
! Calculate the DART time_type for the MIT base time.
@@ -2626,15 +2693,9 @@
subroutine DARTtime_to_MITtime(darttime,date1,date2)
!
-! The MITtime is composed of an offset to a fixed time base.
-! The base time is derived from the namelist in 'date.cal',
-! the model timestep (deltaT) is from the namelist 'PARM03',
-! and the timestepindex is the middle portion of the filename
-! of the MIT files [S,T,U,V,Eta].nnnnnnnnnn.dat
-!
+! The MITtime is composed of:
! (namelist) startDate_1 yyyymmdd (year/month/day)
! (namelist) startDate_2 hhmmss (hours/minutes/seconds)
-! (namelist) deltaTmom aka 'timestep' ... r4 ... implies roundoff nuances
!
type(time_type), intent(in) :: darttime
integer, intent(out) :: date1, date2
@@ -2643,15 +2704,15 @@
if ( .not. module_initialized ) call static_init_model
-if (do_output()) write(*,*)'DART2MIT ',startDate_1,startDate_2
-
-if (do_output()) call print_date(darttime,'DART2MIT dart model time')
-
call get_date(darttime,yy,mn,dd,hh,mm,ss)
date1 = yy*10000 + mn*100 + dd
date2 = hh*10000 + mm*100 + ss
+!if (do_output()) call print_time(darttime,'DART2MIT dart model time')
+!if (do_output()) call print_date(darttime,'DART2MIT dart model date')
+!if (do_output()) write(*,*)'DART2MIT',date1,date2
+
end subroutine DARTtime_to_MITtime
@@ -2680,13 +2741,13 @@
offset = mytime - timeorigin
call get_time(offset,ss,dd)
-if (dd >= (HUGE(dd)/86400)) then ! overflow situation
+if (dd >= (HUGE(dd)/SECPERDAY)) then ! overflow situation
call print_time(mytime,'DART time is',logfileunit)
write(msgstring,*)'Trying to convert DART time to MIT timestep overflows'
call error_handler(E_ERR,'model_mod:DARTtime_to_timestepindex',msgstring,source,revision,revdate)
endif
-DARTtime_to_timestepindex = nint((dd*86400+ss) / timestep)
+DARTtime_to_timestepindex = nint((dd*SECPERDAY+ss) / ocean_dynamics_timestep)
end function DARTtime_to_timestepindex
@@ -2703,6 +2764,161 @@
end subroutine get_gridsize
+
+
+subroutine write_data_namelistfile
+!------------------------------------------------------------------
+! Essentially, we want to set the PARM03:endTime value to tell the
+! model when to stop. To do that, we have to write an entirely new
+! 'data' file, which unfortunately contains multiple namelists.
+!
+! The strategy here is to determine where the PARM03 namelist starts
+! and stops. The stopping part is generally tricky, since
+! the terminator is not well-defined.
+!
+! So - once we know where the namelist starts and stops, we can
+! hunt for the values we need to change and change them while
+! preserving everything else.
+!
+
+integer :: iunit, ounit
+integer :: linenum1, linenumE, linenumN
+integer :: io, iline
+real(r8) :: MyEndTime
+
+character(len=169) :: nml_string, uc_string
+
+if ( .not. file_exist('data') ) then
+ call error_handler(E_ERR,'write_data_namelistfile', &
+ 'namelist file "data" does not exist',source,revision,revdate)
+endif
+
+iunit = open_file('data', action = 'read')
+ounit = open_file('data.DART', action = 'write')
+rewind(ounit)
+
+! Find which line number contains &PARM03 and how many lines total.
+! Since static_init_model() has already read this once, we know
+! that the data file exists and that it contains a PARM03 namelist.
+linenumN = 0
+linenum1 = 0
+
+FINDSTART : do
+
+ read(iunit, '(A)', iostat = io) nml_string
+
+ if (io < 0 ) then ! end of file
+ ! write(*,*)'FINDSTART ... end-of-file at ',linenumN
+ exit FINDSTART
+ elseif (io /= 0 ) then ! read error
+ write(*,msgstring)'manual namelist read failed at line ',linenum1
+ call error_handler(E_ERR,'write_data_namelistfile', &
+ msgstring,source,revision,revdate)
+ endif
+
+ linenumN = linenumN + 1
+
+ if('&PARM03' == trim(adjustl(nml_string))) then
+ linenum1 = linenumN
+ endif
+
+enddo FINDSTART
+
+! write(*,*)'Namelist PARM03 starts at line ',linenum1
+! write(*,*)'File has ',linenumN,' lines'
+
+if (linenum1 < 1) then
+ write(*,msgstring)'unable to find string PARM03'
+ call error_handler(E_ERR,'write_data_namelistfile', &
+ msgstring,source,revision,revdate)
+endif
+
+! We must preserve the value of the paramters right now,
+! so we can write THEM (and not the values we are about to read!)
+
+MyEndTime = endTime
+
+! Hopefully, we can read the namelist and stay positioned
+! Since static_init_model() has already read this once,
+! it is highly unlikely to fail here ...
+
+rewind(iunit)
+read(iunit, nml = PARM03, iostat = io)
+if (io /= 0 ) then
+ call error_handler(E_ERR,'write_data_namelistfile', &
+ 'namelist READ failed somehow',source,revision,revdate)
+endif
+
+endTime = MyEndTime
+dumpFreq = MyEndTime
+taveFreq = MyEndTime
+
+! Find how many more lines till the end-of-file
+linenumE = 0
+
+FINDEND : do
+
+ read(iunit, '(A)', iostat = io) nml_string
+
+ if (io < 0 ) then ! end of file
+ ! write(*,*)'FINDEND ... end-of-file at ',linenumE
+ exit FINDEND
+ elseif (io /= 0 ) then ! read error
+ write(*,msgstring)'manual namelist read failed at line ',linenumE
+ call error_handler(E_ERR,'write_data_namelistfile', &
+ msgstring,source,revision,revdate)
+ endif
+
+ linenumE = linenumE + 1
+
+enddo FINDEND
+
+! write(*,*)'There are ',linenumE,' lines after the namelist ends.'
+rewind(iunit)
+
+! Read the original namelistfile, write the new namelistfile
+
+do iline = 1,linenum1
+ read(iunit, '(A)', iostat = io) nml_string
+ write(ounit, '(A)', iostat = io) trim(nml_string)
+enddo
+do iline = 1,(linenumN-linenum1-linenumE+1)
+
+ read(iunit, '(A)', iostat = io) nml_string
+ uc_string = nml_string
+ call to_upper(uc_string)
+
+ if (index(uc_string,'ADJDUMPFREQ') > 0) then
+ continue
+
+ elseif (index(uc_string,'STARTTIME') > 0) then
+ write(nml_string,'('' startTime = '',f,'','')')0.0_r8
+
+ elseif (index(uc_string,'DUMPFREQ') > 0) then
+ write(nml_string,'('' dumpFreq = '',f,'','')')dumpFreq
+
+ elseif (index(uc_string,'ENDTIME') > 0) then
+ write(nml_string,'('' endTime = '',f,'','')')endTime
+
+ elseif (index(uc_string,'TAVEFREQ') > 0) then
+ write(nml_string,'('' taveFreq = '',f,'','')')taveFreq
+
+ endif
+
+ write(ounit, '(A)', iostat = io) trim(nml_string)
+enddo
+do iline = 1,(linenumE-1)
+ read(iunit, '(A)', iostat = io) nml_string
+ write(ounit, '(A)', iostat = io) trim(nml_string)
+enddo
+
+close(iunit)
+close(ounit)
+
+end subroutine write_data_namelistfile
+
+
+
!===================================================================
! End of model_mod
!===================================================================
Modified: DART/trunk/models/MITgcm_ocean/model_mod.html
===================================================================
--- DART/trunk/models/MITgcm_ocean/model_mod.html 2008-11-06 20:06:46 UTC (rev 3645)
+++ DART/trunk/models/MITgcm_ocean/model_mod.html 2008-11-07 21:47:15 UTC (rev 3646)
@@ -96,10 +96,11 @@
back to the parent directory (which we call CENTRALDIR).
The whole process hinges on setting the ocean model namelist values
such that it is doing a cold start for every model advance.
-
+</p>
<a name="observation"></a>
<BR>
<h4 class="indent1">Observations</h4>
+<p>
The observations for the ocean model were the first observations
of oceanic quantities, so there is an
<em class="file">obs_def/obs_def_MITgcm_ocean_mod.f90</em>
@@ -113,28 +114,49 @@
specifying what kinds of observations to assimilate.
<A href="create_ocean_obs.html">create_ocean_obs</a> is the program
to create a DART observation sequence from a very particular ASCII file.
+ </p>
<a name="conversions"></a>
<BR>
<h4 class="indent1">Converting between DART and the model</h4>
- There are a set of support programs that:
- convert the ocean model snapshot files into a DART-compatible format
- (<a href="trans_pv_sv.html">trans_pv_sv.f90</a>),
- convert the DART output into snapshot files
- (<a href="trans_sv_pv.html">trans_sv_pv.f90</a>),
- to be used as ocean model input datasets (specified in
- <em class="file">data</em><em class="code">&PARM05</em>);
- and create observation sequence files
- (<A href="create_ocean_obs.html">create_ocean_obs.f90</a>).
- The data assimilation periods are defined by a
- combination of the start time of the model and the
- <em class="file">data</em><em class="code">&PARM03:endTime</em>
- namelist value. DART then communicates the start/stop times to the
- ocean model.
+ <p>
+ There are a set of support programs:
+ </p>
+ <table width="100%" cellpadding="10">
+ <tr><td valign="top"><a href="trans_pv_sv.html">trans_pv_sv.f90</a></td>
+ <td>converts the ocean model snapshot files into a DART-compatible format
+ </td></tr>
+
+ <tr><td valign="top"><a href="trans_sv_pv.html">trans_sv_pv.f90</a></td>
+ <td>converts the DART output into snapshot files to be used as
+ ocean model input datasets (specified in
+ <em class="file">data</em><em class="code">&PARM05</em>); creates
+ a new <em class="file">data</em> namelist file
+ (<em class="file">data.DART</em>) containing the correct
+ <em class="code">&#PARM03;startTime,endTime</em> values to advance
+ the ocean model the expected amount; and creates
+ a new <em class="file">data.cal</em> namelist file
+ (<em class="file">data.cal.DART</em>) containing the calendar information.
+ </td></tr>
+ <tr><td valign="top"><A href="create_ocean_obs.html">create_ocean_obs.f90</a></td>
+ <td>create observation sequence files
+ </td></tr>
+ </table>
+
+ <p>
+ The data assimilation period is controlled in the
+ <em class="file">input.nml</em><em class="code">&model_nml</em>
+ namelist. In combination with the ocean model dynamics timestep
+ <em class="file">data</em><em class="code">&PARM03:deltaTClock</em>
+ this determines the amount of time the model will advance for each
+ assimilation cycle.
+ </p>
+
<a name="InitialEnsemble"></a>
<BR>
<h4 class="indent1">Generating the initial ensemble</h4>
+<p>
The MITgcm_ocean model cannot (as of Oct 2008) take one single model state
and generate its own ensemble (typically done with
<a href="#pert_model_state">pert_model_state</a>). This means I don't really
@@ -154,7 +176,7 @@
they assimilate (every 6 hours) for several days, things are on-track.
<BR>
<BR>
- There is a <em class="file">shell_scripts/MakeInitialEnsemble.csh</em> script
+ There is a <em class="program">shell_scripts/MakeInitialEnsemble.csh</em> script
that was intended to automate this process - with modest success. It does
illustrate the steps needed to convert each snapshot file to a DART initial
conditions file and then run the
@@ -163,27 +185,50 @@
you have created all the initial conditions files, you can simply 'cat' them
all together. Even if the script doesn't work <em>out-of-the-box</em>, it
should be readable enough to be some help.
-
+</p>
<a name="BigEndian"></a>
<BR>
<h4 class="indent1">Fortran direct-access big-endian data files</h4>
+<p>
The MITgcm_ocean model uses Fortran direct-access big-endian data files.
It is up to you to determine the proper compiler flags to compile DART
such that DART can read and write these files. Every compiler/architecture
is different, but we have put notes in each <em class="file">mkmf.template</em>
if we know how to achieve this.
-
+</p>
<a name="ModelTimestepping"></a>
<BR>
<h4 class="indent1">Controlling the model advances</h4>
+<p>
+ The assimilation period is specified by two namelist parameters
+ in the <em class="file">input.nml</em><em class="code">&model_nml</em> namelist:
+ <em class="code">assimilation_period_days</em> and
+ <em class="code">assimilation_period_seconds</em>.
+ Normally, all observations within (+/-) HALF of the total assimilation
+ period are used in the assimilation.
+ <BR>
+ <BR>
+ The time of the initial conditions is specified by two namelist parameters
+ in the <em class="file">input.nml</em><em class="code">&model_nml</em> namelist:
+ <em class="code">init_time_days</em> and
+ <em class="code">init_time_seconds</em>; depending on the settings of these
+ parameters, the times may or may not come directly from the DART initial
+ conditions files.
+ <BR>
+ <BR>
The ocean model <b>MUST always</b> start from the input datasets defined
in the <em class="file">data</em><em class="code">&PARM05</em> namelist.
Apparently, this requires
<em class="file">data</em><em class="code">&PARM03:startTime</em> to be <b>0.0</b>.
One of the DART support routines (<a href="trans_sv_pv.html">trans_sv_pv</a>)
- converts the DART state vector to the filenames defined in
- <em class="file">data</em><em class="code">&PARM05</em> and creates a new
- <em class="file">data.cal</em> namelist. The ocean model then
+ converts the DART state vector to the files used in
+ <em class="file">data</em><em class="code">&PARM05</em> and creates new
+ <em class="file">data.cal</em><em class="code">&CAL_NML</em> and
+ <em class="file">data</em><em class="code">&PARM03</em> namelists with
+ values appropriate to advance the model to the desired time.
+ <BR>
+ <BR>
+ The ocean model then
advances till <em class="file">data</em><em class="code">&PARM03:endTime</em>
and writes out snapshot files. <a href="trans_pv_sv.html">trans_pv_sv</a> converts the
snapshot files to a DART-compatible file which is ingested by
@@ -199,6 +244,7 @@
observation sequence file is exhausted) or 2) the time specified by
<em class="file">input.nml</em><em class="code">&filter_nml:last_obs_days,last_obs_seconds</em>
has been reached.
+<p>
<a name="GettingStarted"></a>
<BR>
@@ -214,9 +260,9 @@
of the 'middle' snapshot - then use it as the initial condition
for <em class="program">perfect_model_obs</em>.</li>
<li>create a TINY set of 'perfect' observations in the normal fashion:
- <a href="../../../obs_sequence/create_obs_sequence.html">create_obs_sequence.f90</a>
+ <a href="../../../obs_sequence/create_obs_sequence.html">create_obs_sequence</a>
and then
- <a href="../../../obs_sequence/create_fixed_network_seq.html">create_fixed_network_seq.f90</a>
+ <a href="../../../obs_sequence/create_fixed_network_seq.html">create_fixed_network_seq</a>
to create an empty observation sequence file (usually called
<em class="file">obs_seq.in</em>)
</li>
@@ -248,7 +294,7 @@
scripts for perusing the netCDF files in the <em class="file">DART/matlab</em>
directory. There are Matlab® scripts for exploring the performance of the
assimilation in observation-space (after running
- <a href="../../../diagnostics/threed_sphere/obs_diag.html">obs_diag.f90</a> to
+ <a href="../../../diagnostics/threed_sphere/obs_diag.html">obs_diag</a> to
explore the <em class="file">obs_seq.final</em> file) - use the scripts starting
with 'plot_', i.e. <em class="file">DART/diagnostics/matlab/plot_*.m</em>.
As always, there are some model-specific item you should know about in
@@ -273,7 +319,6 @@
</PRE>
<!--==================================================================-->
-<!--Note to authors. The first row of the table is different. -->
<A NAME="Interface"></A>
<BR><HR><BR>
@@ -284,7 +329,7 @@
</P>
<TABLE>
-<TR><TD><em class=call>use location_mod, only : </em></TD>
+<TR><TD><em class="call">use location_mod, only : </em></TD>
<TD><A HREF="../../location/threed_sphere/location_mod.html#location_type">location_type</A></TD></TR>
<TR><TD> </TD><TD><A HREF="../../location/threed_sphere/location_mod.html#get_location">get_location</A></TD></TR>
<TR><TD> </TD><TD><A HREF="../../location/threed_sphere/location_mod.html#set_location">set_location</A></TD></TR>
@@ -293,11 +338,11 @@
<H3 class="indent1">NOTES</H3>
<P>
-The ocean model namelists <em class=file>data</em>, and
-<em class=file>data.cal</em> are <em class=strong>MUST</em> be
+The ocean model namelists <em class="file">data</em>, and
+<em class="file">data.cal</em> <em class=strong>MUST</em> be
present. These namelists are needed to reconstruct the valid time of the
snapshot files created by the ocean model. Be aware that as DART advances
-the model, the <em class=file>data</em> namelist gets modified to reflect
+the model, the <em class="file">data</em> namelist gets modified to reflect
the current time of the model output.
</P>
@@ -312,58 +357,62 @@
<H2>PUBLIC COMPONENTS PROVIDED</H2>
<TABLE>
-<TR><TH>Standard Interface Routines</TH></TR>
-<TR><TD><A HREF="#get_model_size">get_model_size</A></TD></TR>
-<TR><TD><A HREF="#adv_1step">adv_1step</A></TD></TR>
-<TR><TD><A HREF="#get_state_meta_data">get_state_meta_data</A></TD></TR>
-<TR><TD><A HREF="#model_interpolate">model_interpolate</A></TD></TR>
-<TR><TD><A HREF="#get_model_time_step">get_model_time_step</A></TD></TR>
-<TR><TD><A HREF="#static_init_model">static_init_model</A></TD></TR>
-<TR><TD><A HREF="#end_model">end_model</A></TD></TR>
-<TR><TD><A HREF="#init_time">init_time</A></TD></TR>
-<TR><TD><A HREF="#init_conditions">init_conditions</A></TD></TR>
-<TR><TD><A HREF="#nc_write_model_atts">nc_write_model_atts</A></TD></TR>
-<TR><TD><A HREF="#nc_write_model_vars">nc_write_model_vars</A></TD></TR>
-<TR><TD><A HREF="#pert_model_state">pert_model_state</A></TD></TR>
-<TR><TD><A HREF="#get_close_maxdist_init">get_close_maxdist_init</A></TD></TR>
-<TR><TD><A HREF="#get_close_obs_init">get_close_obs_init</A></TD></TR>
-<TR><TD><A HREF="#get_close_obs">get_close_obs</A></TD></TR>
-<TR><TD><A HREF="#ens_mean_for_model">ens_mean_for_model</A></TD></TR>
-<TR><TH>Unique Interface Routines</TH></TR>
-<TR><TD><A HREF="#MIT_meta_type">MIT_meta_type</A></TD></TR>
-<TR><TD><A HREF="#read_meta">read_meta</A></TD></TR>
-<TR><TD><A HREF="#write_meta">write_meta</A></TD></TR>
-<TR><TD><A HREF="#prog_var_to_vector">prog_var_to_vector</A></TD></TR>
-<TR><TD><A HREF="#vector_to_prog_var">vector_to_prog_var</A></TD></TR>
-<TR><TD><A HREF="#read_snapshot">read_snapshot</A></TD></TR>
-<TR><TD><A HREF="#write_snapshot">write_snapshot</A></TD></TR>
-<TR><TD><A HREF="#get_gridsize">get_gridsize</A></TD></TR>
-<TR><TD><A HREF="#snapshot_files_to_sv">snapshot_files_to_sv</A></TD></TR>
-<TR><TD><A HREF="#sv_to_snapshot_files">sv_to_snapshot_files</A></TD></TR>
-<TR><TD><A HREF="#timestep_to_DARTtime">timestep_to_DARTtime</A></TD></TR>
-<TR><TD><A HREF="#DARTtime_to_MITtime">DARTtime_to_MITtime</A></TD></TR>
-<TR><TD><A HREF="#DARTtime_to_timestepindex">DARTtime_to_timestepindex</A></TD></TR>
+<TR><TD colspan="2">Required Interface Routines</TD></TR>
+<TR><TD><em class=call>use model_mod, only : </em></TD>
+ <TD><A HREF="#get_model_size">get_model_size</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#adv_1step">adv_1step</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_state_meta_data">get_state_meta_data</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#model_interpolate">model_interpolate</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_model_time_step">get_model_time_step</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#static_init_model">static_init_model</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#end_model">end_model</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#init_time">init_time</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#init_conditions">init_conditions</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#nc_write_model_atts">nc_write_model_atts</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#nc_write_model_vars">nc_write_model_vars</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#pert_model_state">pert_model_state</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_close_maxdist_init">get_close_maxdist_init</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_close_obs_init">get_close_obs_init</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_close_obs">get_close_obs</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#ens_mean_for_model">ens_mean_for_model</A></TD></TR>
+
+<TR><TD colspan="2">Unique Interface Routines</TD></TR>
+<TR><TD><em class=call>use model_mod, only : </em></TD>
+ <TD><A HREF="#MIT_meta_type">MIT_meta_type</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#read_meta">read_meta</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#write_meta">write_meta</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#prog_var_to_vector">prog_var_to_vector</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#vector_to_prog_var">vector_to_prog_var</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#read_snapshot">read_snapshot</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#write_snapshot">write_snapshot</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#get_gridsize">get_gridsize</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#snapshot_files_to_sv">snapshot_files_to_sv</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#sv_to_snapshot_files">sv_to_snapshot_files</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#timestep_to_DARTtime">timestep_to_DARTtime</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#DARTtime_to_MITtime">DARTtime_to_MITtime</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#DARTtime_to_timestepindex">DARTtime_to_timestepindex</A></TD></TR>
+<TR><TD> </TD><TD><A HREF="#write_data_namelistfile">write_data_namelistfile</A></TD></TR>
</TABLE>
<H3 class="indent1">NOTES</H3>
<P>
-Ocean model namelist interfaces <em class=code>&PARM03</em>,
-<em class=code>&PARM04</em>, and
-<em class=code>&PARM04</em> are read from
-file <em class=file>data</em>.
-Ocean model namelist interface <em class=code>&CAL_NML</em>,
-is read from file <em class=file>data.cal</em>.
+Ocean model namelist interfaces <em class="code">&PARM03</em>,
+<em class="code">&PARM04</em>, and
+<em class="code">&PARM04</em> are read from
+file <em class="file">data</em>.
+Ocean model namelist interface <em class="code">&CAL_NML</em>,
+is read from file <em class="file">data.cal</em>.
</P>
<!--===================== DESCRIPTION OF FUNCTION ====================-->
<A NAME="get_model_size"></A>
<BR><BR>
-<div class=routine>
-<em class=call> model_size = get_model_size( )</em>
+<div class="routine">
+<em class="call"> model_size = get_model_size( )</em>
<pre>
-integer :: <em class=code> get_model_size </em>
+integer :: <em class="code"> get_model_size </em>
</pre>
</div>
@@ -380,11 +429,11 @@
<A NAME="adv_1step"></A>
<BR><BR>
-<div class=routine>
-<em class=call>call adv_1step(x, time)</em>
+<div class="routine">
+<em class="call">call adv_1step(x, time)</em>
<pre>
-real(r8), dimension(:), intent(inout) :: <em class=code> x </em>
-type(time_type), intent(in) :: <em class=code> time </em>
+real(r8), dimension(:), intent(inout) :: <em class="code"> x </em>
+type(time_type), intent(in) :: <em class="code"> time </em>
</pre>
</div>
@@ -392,9 +441,9 @@
<H3 class="indent1">Description</H3>
<P>
-<em class=code>adv_1step</em>
+<em class="code">adv_1step</em>
is not used for the MITgcm_ocean model.
-Advancing the model is done through the <em class=file>advance_model</em> script.
+Advancing the model is done through the <em class="program">advance_model</em> script.
This is a NULL_INTERFACE, provided only for compatibility with the DART requirements.
</P>
</div>
@@ -403,12 +452,12 @@
<A NAME="get_state_meta_data"></A>
<BR><BR>
-<div class=routine>
-<em class=call>call get_state_meta_data (index_in, location,
+<div class="routine">
+<em class="call">call get_state_meta_data (index_in, location,
<em class=optionalcode>[, var_type]</em> )</em>
<pre>
-integer, intent(in) :: <em class=code> index_in </em>
-type(location_type), intent(out) :: <em class=code> location </em>
+integer, intent(in) :: <em class="code"> index_in </em>
+type(location_type), intent(out) :: <em class="code"> location </em>
integer, optional, intent(out) :: <em class=optionalcode> var_type </em>
</pre>
</div>
@@ -417,27 +466,27 @@
<H3 class="indent1">Description</H3>
<P>
-<em class=code>get_state_meta_data</em>
+<em class="code">get_state_meta_data</em>
returns metadata about a given element of the DART representation of the
model state vector. Since the DART model state vector is a 1D array and the
-native model grid is multidimensional, <em class=code>get_state_meta_data</em>
+native model grid is multidimensional, <em class="code">get_state_meta_data</em>
returns information about the native model state vector representation. Things
-like the <em class=code>location</em>, or the type of the variable
+like the <em class="code">location</em>, or the type of the variable
(for instance: salinity, temperature, u current component, ...).
The integer values used to indicate different variable types in
-<em class=code>var_type</em> are themselves defined as public interfaces
+<em class="code">var_type</em> are themselves defined as public interfaces
to model_mod if required.
</P>
<TABLE width=100% border=0 summary="" cellpadding=3>
-<TR><TD valign=top><em class=code>index_in</em></TD>
+<TR><TD valign=top><em class="code">index_in</em></TD>
<TD>Index into the long state vector.</TD></TR>
-<TR><TD valign=top><em class=code>location</em></TD>
+<TR><TD valign=top><em class="code">location</em></TD>
<TD>Returns the 3D location of the indexed state variable.
- The <em class=code>location_ type</em> comes from
- <em class=file>DART/location/threed_sphere/location_mod.f90</em>.
+ The <em class="code">location_ type</em> comes from
+ <em class="file">DART/location/threed_sphere/location_mod.f90</em>.
Note that the lat/lon are specified in degrees by the user but are converted
to radians internally.</TD></TR>
@@ -445,8 +494,8 @@
<TD>Returns the type of the indexed state variable as an optional argument.
The type is one of the list of supported observation types, found in
the block of code starting
- <em class=code>! Integer definitions for DART TYPES</em>
- in <em class=file>DART/obs_kind/obs_kind_mod.f90</em>
+ <em class="code">! Integer definitions for DART TYPES</em>
+ in <em class="file">DART/obs_kind/obs_kind_mod.f90</em>
</TD></TR>
</TABLE>
@@ -454,11 +503,11 @@
<H3 class="indent1">Notes</H3>
<P>
-The list of supported variables in <em class=file>DART/obs_kind/obs_kind_mod.f90</em>
-is created by <em class=program>preprocess</em> using the entries in
-<em class=file>input.nml</em>[<em class=code>&preprocess_nml, &obs_kind_nml</em>],
-<em class=file>DEFAULT_obs_kin_mod.F90</em> and
-<em class=file>obs_def_MITgcm_ocean_mod.f90</em>.
+The list of supported variables in <em class="file">DART/obs_kind/obs_kind_mod.f90</em>
+is created by <em class="program">preprocess</em> using the entries in
+<em class="file">input.nml</em>[<em class="code">&preprocess_nml, &obs_kind_nml</em>],
+<em class="file">DEFAULT_obs_kin_mod.F90</em> and
+<em class="file">obs_def_MITgcm_ocean_mod.f90</em>.
</P>
</div>
@@ -467,15 +516,15 @@
<A NAME="model_interpolate"></A>
<BR><BR>
-<div class=routine>
-<em class=call> call model_interpolate(x, location, obs_type, interp_val,
+<div class="routine">
+<em class="call"> call model_interpolate(x, location, obs_type, interp_val,
istatus)</em>
<pre>
-real(r8), dimension(:), intent(in) :: <em class=code> x </em>
-type(location_type), intent(in) :: <em class=code> location </em>
-integer, intent(in) :: <em class=code> obs_type </em>
-real(r8), intent(out) :: <em class=code> interp_val </em>
-integer, intent(out) :: <em class=code> istatus </em>
+real(r8), dimension(:), intent(in) :: <em class="code"> x </em>
+type(location_type), intent(in) :: <em class="code"> location </em>
+integer, intent(in) :: <em class="code"> obs_type </em>
+real(r8), intent(out) :: <em class="code"> interp_val </em>
+integer, intent(out) :: <em class="code"> istatus </em>
</pre>
</div>
@@ -483,17 +532,17 @@
<H3 class="indent1">Description</H3>
<P>
-Given a model state, <em class=code>model_interpolate</em> returns the value of
+Given a model state, <em class="code">model_interpolate</em> returns the value of
the desired observation type (which could be a state variable) that would be
observed at the desired location. The interpolation method is either
completely specified by the model, or uses some standard 2D or 3D scalar
interpolation routines.
-Put another way, <em class=code>model_interpolate</em> will apply the forward
+Put another way, <em class="code">model_interpolate</em> will apply the forward
operator <strong>H</strong> to the model state to create an observation at the desired
location.
<BR>
<BR>
-If the interpolation is valid, <em class=code>istatus = 0</em>.
+If the interpolation is valid, <em class="code">istatus = 0</em>.
In the case where the observation operator is not defined at the given
location (e.g. the observation is below the lowest model level, above the top
level, or 'dry'), interp_val is returned as 0.0 and istatus = 1.
@@ -501,19 +550,19 @@
<TABLE width=100% border=0 summary="" cellpadding=3>
-<TR><TD valign=top><em class=code>x </em></TD>
+<TR><TD valign=top><em class="code">x </em></TD>
<TD>Model state vector. </TD></TR>
-<TR><TD valign=top><em class=code>location</em></TD>
+<TR><TD valign=top><em class="code">location</em></TD>
<TD>Location to which to interpolate.</TD></TR>
-<TR><TD valign=top><em class=code>obs_type</em></TD>
+<TR><TD valign=top><em class="code">obs_type</em></TD>
<TD>Integer indexing which type of observation is desired.</TD></TR>
-<TR><TD valign=top><em class=code>interp_val</em></TD>
+<TR><TD valign=top><em class="code">interp_val</em></TD>
<TD>The desired observation value at the requested location.</TD></TR>
-<TR><TD valign=top><em class=code>istatus</em></TD>
+<TR><TD valign=top><em class="code">istatus</em></TD>
<TD>Integer flag indicating the success of the interpolation.
<BR>success == 0, failure == anything else</TD></TR>
@@ -525,10 +574,10 @@
<A NAME="get_model_time_step"></A>
<BR><BR>
-<div class=routine>
-<em class=call> var = get_model_time_step( )</em>
+<div class="routine">
+<em class="call"> var = get_model_time_step( )</em>
<pre>
-type(time_type) :: <em class=code> get_model_time_step </em>
+type(time_type) :: <em class="code"> get_model_time_step </em>
</pre>
</div>
@@ -536,28 +585,31 @@
<H3 class="indent1">Description</H3>
<P>
-<em class=code>get_model_time_step</em>
+<em class="code">get_model_time_step</em>
returns the forecast length to be used as the "model base time step" in the filter.
-This is the minimum amount of time the model can be advanced
-by <em class=program>filter</em>. Currently (Oct 2008), this is also used to
-determine the assimilation window. All observations within one half of the forecast
-length of the assimilation time are used for the assimilation.
-<BR><BR>
-In the <em class=program>MITgcm_ocean</em> case, this is read directly from
-the MITgcm ocean namelist <em class=file>data</em><em class=code>&PARM03:endTime</em>
+This is the minimum amount of time the model can be advanced by
+<em class="program">filter</em>.
+<em class="strong">This is also the assimilation window</em>.
+All observations within (+/-) one half of the forecast
+length are used for the assimilation.
+In the <em class="program">MITgcm_ocean</em> case, this is set from
+the namelist values for <em class="file">input.nml</em><em
+class="code">&model_nml:assimilation_period_days, assimilation_period_seconds</em>,
+after ensuring the forecast length is a multiple of the ocean model dynamical timestep
+declared by <em class="file">data</em><em class="code">&PARM03:deltaTClock</em>.
</P>
<TABLE width=100% border=0 summary="" cellpadding=3>
-<TR><TD valign=top><em class=code>var</em></TD>
+<TR><TD valign=top><em class="code">var</em></TD>
<TD>the assimilation width, the minimum amount of time the model can be advanced,
etc.</TD></TR>
</TABLE>
<P>
-Please read the note concerning <a href="#ModelTimestepping">starting and stopping the
-ocean model</a>
+Please read the note concerning
+<a href="#ModelTimestepping">Controlling the model advances</a>
</P>
</div>
@@ -567,8 +619,8 @@
<A NAME="static_init_model"></A>
<BR><BR>
-<div class=routine>
-<em class=call>call static_init_model( )</em>
@@ Diff output truncated at 40000 characters. @@
More information about the Dart-dev
mailing list