[Dart-dev] DART/branches Revision: 11459

dart at ucar.edu dart at ucar.edu
Wed Apr 12 14:18:08 MDT 2017


nancy at ucar.edu
2017-04-12 14:18:05 -0600 (Wed, 12 Apr 2017)
158
restore missing code for the RTPS inflation (type 4)
and the error message that checks for both prior and
posterior obs space inflation, not just posterior.




Modified: DART/branches/rma_trunk/assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90	2017-04-12 17:37:29 UTC (rev 11458)
+++ DART/branches/rma_trunk/assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90	2017-04-12 20:18:05 UTC (rev 11459)
@@ -45,8 +45,9 @@
                                   map_task_to_pe,  map_pe_to_task, prepare_to_update_copies,  &
                                   copies_in_window, set_num_extra_copies, get_allow_transpose, &
                                   all_copies_to_all_vars, allocate_single_copy, allocate_vars, &
-                                  get_single_copy, put_single_copy, deallocate_single_copy
-use adaptive_inflate_mod,  only : do_varying_ss_inflate,                &
+                                  get_single_copy, put_single_copy, deallocate_single_copy,   &
+                                  print_ens_handle
+use adaptive_inflate_mod,  only : do_varying_ss_inflate,                                      &
                                   do_single_ss_inflate, inflate_ens, adaptive_inflate_init,   &
                                   adaptive_inflate_type, set_inflation_mean_copy ,            &
                                   log_inflation_info, set_inflation_sd_copy,                  &
@@ -56,7 +57,7 @@
 use smoother_mod,          only : smoother_read_restart, advance_smoother,                    &
                                   smoother_gen_copy_meta_data, smoother_write_restart,        &
                                   init_smoother, do_smoothing, smoother_mean_spread,          &
-                                  smoother_assim,            &
+                                  smoother_assim,                                             &
                                   smoother_ss_diagnostics, smoother_end, set_smoother_trace
 
 use random_seq_mod,        only : random_seq_type, init_random_seq, random_gaussian
@@ -343,24 +344,32 @@
 if (inf_flavor(2) > 1 )                           do_posterior_inflate = .true.
 if (do_prior_inflate .or. do_posterior_inflate)   output_inflation     = .true.
 
-! Observation space inflation for posterior not currently supported
-if(inf_flavor(2) == 1) call error_handler(E_ERR, 'filter_main', &
-   'Posterior observation space inflation (type 1) not supported', source, revision, revdate)
+! Observation space inflation not currently supported
+if(inf_flavor(1) == 1 .or. inf_flavor(2) == 1) call error_handler(E_ERR, 'filter_main', &
+   'observation space inflation (type 1) not currently supported', source, revision, revdate, &
+   text2='contact DART developers if you are interested in using it.')
 
-! Whitaker/Hamill (2012) relaxation-to-prior-spread (rtps) inflation (inf_flavor = 4) only is for posterior
-if ( inf_flavor(1) == 4 ) then 
-   write(msgstring, *) 'Prior inflation [i.e., inf_flavor(1)]=', inf_flavor(1), ' is not allowed.  Must be 0, 1, 2, or 3' 
-   call error_handler(E_ERR,'filter_main', msgstring, source, revision, revdate) 
-endif 
+! Relaxation-to-prior-spread (RTPS) is only an option for posterior inflation
+if(inf_flavor(1) == 4) call error_handler(E_ERR, 'filter_main', &
+   'RTPS inflation (type 4) only supported for Posterior inflation', source, revision, revdate)
 
-! CSS Whitaker/Hamill (2012) relaxation-to-prior-spread (rtps) inflation (inf_flavor = 4)
-!    needs a single parameter from namelist: inf_initial(2).  Do not read-in any files
-!    Also, no damping
+! RTPS needs a single parameter from namelist: inf_initial(2).  
+! Do not read in any files.  Also, no damping.  but warn the user if they try to set different
+! values in the namelist.
 if ( inf_flavor(2) == 4 ) then
-   inf_initial_from_restart(2)    = .false. ! get parameter from namelist inf_inital(2), not from file
+   if (inf_initial_from_restart(2) .or. inf_sd_initial_from_restart(2)) &
+      call error_handler(E_MSG, 'filter_main', 'RTPS inflation (type 4) overrides posterior inflation restart file with value in namelist', &
+         text2='posterior inflation standard deviation value not used in RTPS')
+   inf_initial_from_restart(2) = .false.    ! Get parameter from namelist inf_initial(2), not from file
    inf_sd_initial_from_restart(2) = .false. ! inf_sd not used in this algorithm
-   inf_deterministic(2)           = .true.  ! this algorithm is deterministic
-   inf_damping(2)                 = 1.0_r8  ! no damping
+
+   if (.not. inf_deterministic(2)) &
+      call error_handler(E_MSG, 'filter_main', 'RTPS inflation (type 4) overrides posterior inf_deterministic with .true.')
+   inf_deterministic(2) = .true.  ! this algorithm is deterministic
+
+   if (inf_damping(2) /= 1.0_r8) &
+      call error_handler(E_MSG, 'filter_main', 'RTPS inflation (type 4) disables posterior inf_damping')
+   inf_damping(2) = 1.0_r8  ! no damping
 endif
 
 
@@ -719,6 +728,10 @@
       call trace_message('After  prior inflation damping and prep')
    endif
 
+   ! if relaxation-to-prior-spread inflation, save the prior spread in SPARE_PRIOR_SPREAD
+   if ( do_rtps_inflate(post_inflate) ) &
+      call compute_copy_mean_sd(state_ens_handle, 1, ens_size, ENS_MEAN_COPY, SPARE_PRIOR_SPREAD)
+
    call     trace_message('Before computing prior observation values')
    call timestamp_message('Before computing prior observation values')
 
@@ -845,7 +858,8 @@
 
    ! This block applies posterior inflation
 
-   if(do_single_ss_inflate(post_inflate) .or. do_varying_ss_inflate(post_inflate)) then
+   if(do_single_ss_inflate(post_inflate) .or. do_varying_ss_inflate(post_inflate) .or. &
+      do_rtps_inflate(post_inflate)) then
 
       call trace_message('Before posterior inflation damping and prep')
 
@@ -855,7 +869,12 @@
             inf_damping(2) * (state_ens_handle%copies(POST_INF_COPY, :) - 1.0_r8)
       endif
 
-      call filter_ensemble_inflate(state_ens_handle, POST_INF_COPY, post_inflate, ENS_MEAN_COPY)
+      if (do_rtps_inflate(post_inflate)) then   
+         call filter_ensemble_inflate(state_ens_handle, POST_INF_COPY, post_inflate, ENS_MEAN_COPY, &
+                                      SPARE_PRIOR_SPREAD, ENS_SD_COPY)


More information about the Dart-dev mailing list