[Dart-dev] DART/branches Revision: 11106

dart at ucar.edu dart at ucar.edu
Mon Feb 13 16:18:26 MST 2017


nancy at ucar.edu
2017-02-13 16:18:26 -0700 (Mon, 13 Feb 2017)
668
finish the adv_1step() routine - have it call model_interpolate
with an old-style state vector as a final optional argument.
it can't create an ensemble and call get_state() - so this is the
best i could figure out.  we could make a separate interpolate
routine for this purpose.

add an optional template file to the &model_nml - if you're starting
PMO from a restart file, use it for the template.  if you're not
starting from restart, leave it as '' and the code will construct
a domain.  (not sure the construct part is working yet, but it should
be close.) 

remoe the restart_file_tool files, and update the path_names files
which were missing various modules.




Modified: DART/branches/rma_single_file/models/simple_advection/model_mod.f90
===================================================================
--- DART/branches/rma_single_file/models/simple_advection/model_mod.f90	2017-02-13 22:45:28 UTC (rev 11105)
+++ DART/branches/rma_single_file/models/simple_advection/model_mod.f90	2017-02-13 23:18:26 UTC (rev 11106)
@@ -26,11 +26,13 @@
 use random_seq_mod,   only : random_seq_type, init_random_seq, random_gaussian
 
 use ensemble_manager_mod,  only : ensemble_type, get_allow_transpose, &
-                                  all_vars_to_all_copies, all_copies_to_all_vars
+                                  all_vars_to_all_copies, all_copies_to_all_vars, &
+                                  init_ensemble_manager, end_ensemble_manager
 
 use distributed_state_mod, only : get_state
 
-use state_structure_mod,   only : add_domain, state_structure_info
+use state_structure_mod,   only : add_domain, state_structure_info, &
+                                  add_dimension_to_variable, finished_adding_domain
 
 use dart_time_io_mod,      only : read_model_time, write_model_time
 
@@ -90,6 +92,11 @@
 integer  :: time_step_days          = 0
 integer  :: time_step_seconds       = 3600
 
+! if you have a template file, set the name here.
+! if you are not starting from a restart, leave this as ''
+! and the code should construct a domain from spec.
+character(len=256) :: template_file = ''
+
 ! Namelist parameters associated with wind
 ! Base velocity (expected value over time), in meters/second
 real(r8)  :: mean_wind              = 20.0_r8
@@ -119,6 +126,9 @@
 
 logical   :: output_state_vector    = .false.
 
+integer, parameter :: NVARS = 5
+integer :: my_ens_size = 1
+
 namelist /model_nml/ num_grid_points, grid_spacing_meters, &
                      time_step_days, time_step_seconds, &
                      mean_wind, wind_random_amp, wind_damping_rate, &
@@ -125,7 +135,7 @@
                      lagrangian_for_wind, destruction_rate, &
                      source_random_amp_frac, source_damping_rate, &
                      source_diurnal_rel_amp, source_phase_noise, &
-                     output_state_vector
+                     output_state_vector, template_file
 
 !----------------------------------------------------------------
 
@@ -144,7 +154,7 @@
 ! the time type for the time stepping
 
 real(r8) :: x_loc
-integer  :: i, iunit, io, j, dom_id
+integer  :: i, iunit, io, j, dom_id, var_id
 
 ! Print module information to log file and stdout.
 call register_module(source, revision, revdate)
@@ -159,7 +169,7 @@
 if (do_nml_term()) write(     *     , nml=model_nml)
 
 ! Create storage for locations
-allocate(state_loc(5*num_grid_points))
+allocate(state_loc(NVARS*num_grid_points))
 
 ! Define the locations of the model state variables
 do i = 1, num_grid_points
@@ -206,10 +216,22 @@
 
 ! Tell the DART I/O routines how large the model data is so they
 ! can read/write it.
-dom_id = add_domain(5*num_grid_points)
+if (template_file /= '') then
+   dom_id = add_domain(template_file, NVARS, &
+                       (/ 'concentration', 'mean_source', 'source', 'source_phase', 'wind' /))
+else 
+   dom_id = add_domain(NVARS, (/ 'concentration', 'mean_source', 'source', 'source_phase', 'wind' /))
 
-call state_structure_info(dom_id)
+   do var_id=1, NVARS
+      call add_dimension_to_variable(dom_id, var_id, 'time', 1)
+      call add_dimension_to_variable(dom_id, var_id, 'member', my_ens_size)
+      call add_dimension_to_variable(dom_id, var_id, 'location', num_grid_points)
+   enddo
+   
+   call finished_adding_domain(dom_id)
+endif
 
+
 end subroutine static_init_model
 
 
@@ -267,7 +289,7 @@
 
 !>@todo  model_interpolate must have a real ensemble_handle
 ens_size = 1
-call init_ensemble_manager(temp_handle, ens_size, int(5*num_grid_points,i8))
+call init_ensemble_manager(temp_handle, ens_size, int(NVARS*num_grid_points,i8))
 temp_handle%copies(1,:) = x(:)


More information about the Dart-dev mailing list