[Dart-dev] DART/branches Revision: 13175

dart at ucar.edu dart at ucar.edu
Thu May 16 14:12:36 MDT 2019


nancy at ucar.edu
2019-05-16 14:12:36 -0600 (Thu, 16 May 2019)
279
the start of exploring how to execute filter by alternating 
forward operator computations and computing and applying the 
increments for assimilation.  (as opposed to computing all the
forward operators up front and then computing the assimilation
as a second, separate step.)




Modified: DART/branches/sequential/assimilation_code/modules/assimilation/assim_tools_mod.f90
===================================================================
--- DART/branches/sequential/assimilation_code/modules/assimilation/assim_tools_mod.f90	2019-05-16 19:20:45 UTC (rev 13174)
+++ DART/branches/sequential/assimilation_code/modules/assimilation/assim_tools_mod.f90	2019-05-16 20:12:36 UTC (rev 13175)
@@ -4,6 +4,24 @@
 !
 ! $Id$
 
+!>@todo FIXME:  issues with converting to a sequential filter:
+!> the code only supports a single window open at a time.  we only need
+!> the ensemble mean for the vertical conversion (true?) so if we force
+!> all vertical converts up front we don't need the mean during assim?
+!> otherwise we need to open the ensemble window each time.
+!>
+!> we have been assuming the window data is read-only.  in a sequential
+!> filter we'll be changing the states.  do we make it read/write or do
+!> we put it up and take it down each time?
+!>
+!> need to precompute get_close info.  does adaptive localization affect
+!> this as well?  
+!>
+!> how slow is it to call the whole filter_assim each time?  if we pull
+!> the get_close setup out, how fast is it to setup and take down the
+!> windows?  
+!>
+
 !>  A variety of operations required by assimilation.
 module assim_tools_mod
 
@@ -305,7 +323,7 @@
 
 !-------------------------------------------------------------
 
-subroutine filter_assim(ens_handle, obs_ens_handle, obs_seq, keys,           &
+subroutine filter_assim_init(ens_handle, obs_ens_handle, obs_seq, keys,      &
    ens_size, num_groups, obs_val_index, inflate, ENS_MEAN_COPY, ENS_SD_COPY, &
    ENS_INF_COPY, ENS_INF_SD_COPY, OBS_KEY_COPY, OBS_GLOBAL_QC_COPY,          &
    OBS_PRIOR_MEAN_START, OBS_PRIOR_MEAN_END, OBS_PRIOR_VAR_START,            &
@@ -592,6 +610,107 @@
 ! timing
 if (my_task_id() == 0 .and. timing) allocate(elapse_array(obs_ens_handle%num_vars))
 
+end subroutine filter_assim_init
+
+
+!-------------------------------------------------------------
+!-------------------------------------------------------------
+
+subroutine filter_assim(ens_handle, obs_ens_handle, obs_seq, keys,           &
+   ens_size, num_groups, obs_val_index, inflate, ENS_MEAN_COPY, ENS_SD_COPY, &
+   ENS_INF_COPY, ENS_INF_SD_COPY, OBS_KEY_COPY, OBS_GLOBAL_QC_COPY,          &
+   OBS_PRIOR_MEAN_START, OBS_PRIOR_MEAN_END, OBS_PRIOR_VAR_START,            &
+   OBS_PRIOR_VAR_END, inflate_only)
+
+type(ensemble_type),         intent(inout) :: ens_handle, obs_ens_handle
+type(obs_sequence_type),     intent(in)    :: obs_seq
+integer,                     intent(in)    :: keys(:)
+integer,                     intent(in)    :: ens_size, num_groups, obs_val_index
+type(adaptive_inflate_type), intent(inout) :: inflate
+integer,                     intent(in)    :: ENS_MEAN_COPY, ENS_SD_COPY, ENS_INF_COPY
+integer,                     intent(in)    :: ENS_INF_SD_COPY
+integer,                     intent(in)    :: OBS_KEY_COPY, OBS_GLOBAL_QC_COPY
+integer,                     intent(in)    :: OBS_PRIOR_MEAN_START, OBS_PRIOR_MEAN_END
+integer,                     intent(in)    :: OBS_PRIOR_VAR_START, OBS_PRIOR_VAR_END
+logical,                     intent(in)    :: inflate_only
+
+!>@todo FIXME this routine has a huge amount of local/stack storage.
+!>at some point does it need to be allocated instead?  this routine isn't
+!>called frequently so doing allocate/deallocate isn't a timing issue.  
+!>putting arrays on the stack is fast, but risks running out of stack space 
+!>and dying with strange errors.
+
+real(r8) :: obs_prior(ens_size), obs_inc(ens_size), increment(ens_size)
+real(r8) :: reg_factor, impact_factor
+real(r8) :: net_a(num_groups), reg_coef(num_groups), correl(num_groups)
+real(r8) :: cov_factor, obs(1), obs_err_var, my_inflate, my_inflate_sd
+real(r8) :: varying_ss_inflate, varying_ss_inflate_sd
+real(r8) :: ss_inflate_base, obs_qc, cutoff_rev, cutoff_orig
+real(r8) :: gamma, ens_obs_mean, ens_obs_var, ens_var_deflate
+real(r8) :: r_mean, r_var
+real(r8) :: orig_obs_prior_mean(num_groups), orig_obs_prior_var(num_groups)
+real(r8) :: obs_prior_mean(num_groups), obs_prior_var(num_groups)
+real(r8) :: close_obs_dist(obs_ens_handle%my_num_vars)
+real(r8) :: close_state_dist(ens_handle%my_num_vars)
+real(r8) :: last_close_obs_dist(obs_ens_handle%my_num_vars)
+real(r8) :: last_close_state_dist(ens_handle%my_num_vars)
+real(r8) :: diff_sd, outlier_ratio
+
+integer(i8) :: state_index
+integer(i8) :: my_state_indx(ens_handle%my_num_vars)
+integer(i8) :: my_obs_indx(obs_ens_handle%my_num_vars)
+
+integer  :: my_num_obs, i, j, owner, owners_index, my_num_state
+integer  :: this_obs_key, obs_mean_index, obs_var_index
+integer  :: grp_beg(num_groups), grp_end(num_groups), grp_size, grp_bot, grp_top, group
+integer  :: close_obs_ind(obs_ens_handle%my_num_vars)
+integer  :: close_state_ind(ens_handle%my_num_vars)
+integer  :: last_close_obs_ind(obs_ens_handle%my_num_vars)
+integer  :: last_close_state_ind(ens_handle%my_num_vars)
+integer  :: num_close_obs, obs_index, num_close_states
+integer  :: total_num_close_obs, last_num_close_obs, last_num_close_states


More information about the Dart-dev mailing list