Changes between Version 36 and Version 37 of ImplementAnalysislseik


Ignore:
Timestamp:
May 17, 2011, 3:25:45 PM (13 years ago)
Author:
lnerger
Comment:

General revision of text

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysislseik

    v36 v37  
    7878
    7979This routine is independent from the filter algorithm used.
    80 See [ModifyModelforEnsembleIntegration#U_collect_statecollect_state.F90 here] for the description of this routine.
     80See the mape on [ModifyModelforEnsembleIntegration#U_collect_statecollect_state.F90 modifying the model code for the ensemble integration] for the description of this routine.
    8181
    8282
    8383=== `U_init_dim_obs_full` (init_dim_obs_full.F90) ===
    8484
    85 This routine is used by all local filter algorithms (LSEIK, LETKF).
     85This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    8686
    8787The interface for this routine is:
     
    101101=== `U_obs_op_full` (obs_op_full.F90) ===
    102102
    103 This routine is used by all local filter algorithms (LSEIK, LETKF).
     103This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    104104
    105105The interface for this routine is:
     
    114114}}}
    115115
    116 The routine is called during the analysis step, before the loop over the local analysis domain is entered. It has to perform the operation of the observation operator acting on a state vector that is provided as `state_p`. The observed state has to be returned in `m_state_f`. It is the observed state corresponding to the 'full' observation vector.
     116The routine is called during the analysis step, before the loop over the local analysis domain is entered. It has to perform the operation of the observation operator acting on a state vector, which is provided as `state_p`. The observed state has to be returned in `m_state_f`. It is the observed state corresponding to the 'full' observation vector.
    117117
    118118Hint:
    119  * Analogously to the situation with `init_dim_obs_full`, the routine is similar to `init_dim_obs` used for the global filters. However, with a domain-decomposed model `m_state_f` will contain parts of the state vector from neighboring model sub-domains. To make these parts accessible, some parallel communication will be necessary (The state information for a neighboring model sub-domain, will be in the memory of the process that handles that sub-domain). The example implementation in `testsuite/dummymodel_1d` uses the function `MPI_AllGatherV` for this communication.
     119 * The routine is similar to `init_dim_obs` used for the global filters. However, with a domain-decomposed model `m_state_f` will contain parts of the state vector from neighboring model sub-domains. To make these parts accessible, some parallel communication will be necessary (The state information for a neighboring model sub-domain, will be in the memory of the process that handles that sub-domain). The example implementation in `testsuite/dummymodel_1d` uses the function `MPI_AllGatherV` for this communication.
    120120
    121121=== `U_init_obs_full` (init_obs_full.F90) ===
    122122
    123 This routine is used by all local filter algorithms (LSEIK, LETKF).
     123This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    124124The routine is only called if the globally adaptive forgetting factor is used (`type_forget=1` in the example implementation). For the local filters there is also the alternative to use locally adaptive forgetting factors (`type_forget=2` in the example implementation)
    125125
     
    133133}}}
    134134
    135 The routine is called during the analysis step before the loop over the local analysis domains is entered. The caller is the routine that computes an adaptive forgetting factor (PDAF_set_forget). It has to provide the full vector of observations in `observation_f` for the current time step.
     135The routine is called during the analysis step before the loop over the local analysis domains is entered. It has to provide the full vector of observations in `observation_f` for the current time step. The caller is the routine that computes an adaptive forgetting factor (PDAF_set_forget).
    136136
    137137Hints:
     
    142142=== `U_init_obs_local` (init_obs_local.F90) ===
    143143
    144 This routine is used by all local filter algorithms (LSEIK, LETKF).
     144This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    145145
    146146The interface for this routine is:
     
    155155
    156156The routine is called during the analysis step during the loop over the local analysis domain.
    157 It has to provide the vector of observations for the analysis in the local analysis domain owith index `domain_p` in `observation_l` for the current time step.
    158 
    159 Hints:
    160  * For parallel efficiency, the LSEIK algorithm is implemented in a way that first the full vectors are initialized. These are then restricted to the local analysis domain when the loop over all local analysis domains is executed. Thus, if `observation_f` has been initialized before `U_init_obs_local` is executed (e.g. by `U_init_dim_obs_full`), the operations performed in this routine will be to select the part of the full observation vector that is relevant for the current local analysis domain.
    161  * The routine `U_init_dim_obs_local` is executed before this routine. Thus, if that routine already prepares the information which elements of `observation_f` are need for `observation_l` this information can be used efficiently here.
     157It has to provide the vector of observations for the analysis in the local analysis domain with index `domain_p` in `observation_l` for the current time step.
     158
     159Hints:
     160 * For parallel efficiency, the LSEIK algorithm is implemented in a way that first the full vectors are initialized. These are then restricted to the local analysis domain during the loop over all local analysis domains. Thus, if the full vector of observations has been initialized before `U_init_obs_local` is executed (e.g. by `U_init_dim_obs_full`), the operations performed in this routine will be to select the part of the full observation vector that is relevant for the current local analysis domain.
     161 * The routine `U_init_dim_obs_local` is executed before this routine. Thus, if that routine already prepares the information which elements of `observation_f` are needed for `observation_l`, this information can be used efficiently here.
    162162
    163163
    164164=== `U_prepoststep` (prepoststep_seik.F90) ===
    165165
    166 This routine can be identical to that used for the global SEIK filter.
    167 See [ModifyModelforEnsembleIntegration#U_prepoststepprepoststep_seik.F90 here] for the description of this routine.
     166This routine can be identical to that used for the global SEIK filter, which has already been described on the [ModifyModelforEnsembleIntegration#U_prepoststepprepoststep_seik.F90 page on modifying the model code for the ensemble integration]. For completeness, the description is repeated:
     167
     168The interface of the routine is identical for all filters. However, the particular operations that are performed in the routine can be specific for each filter algorithm. Here, we exemplify the interface on the example of the SEIK filter.
     169
     170The interface for this routine is
     171{{{
     172SUBROUTINE prepoststep(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
     173                       state_p, Uinv, ens_p, flag)
     174
     175  INTEGER, INTENT(in) :: step        ! Current time step
     176                         ! (When the routine is called before the analysis -step is provided.)
     177  INTEGER, INTENT(in) :: dim_p       ! PE-local state dimension
     178  INTEGER, INTENT(in) :: dim_ens     ! Size of state ensemble
     179  INTEGER, INTENT(in) :: dim_ens_p   ! PE-local size of ensemble
     180  INTEGER, INTENT(in) :: dim_obs_p   ! PE-local dimension of observation vector
     181  REAL, INTENT(inout) :: state_p(dim_p) ! PE-local forecast/analysis state
     182                                     ! The array 'state_p' is not generally not initialized in the case of SEIK/EnKF/ETKF.
     183                                     ! It can be used freely in this routine.
     184  REAL, INTENT(inout) :: Uinv(dim_ens-1, dim_ens-1) ! Inverse of matrix U
     185  REAL, INTENT(inout) :: ens_p(dim_p, dim_ens)      ! PE-local state ensemble
     186  INTEGER, INTENT(in) :: flag        ! PDAF status flag
     187}}}
     188
     189The routine `U_prepoststep` is called once at the beginning of the assimilation process. In addition, it is called during the assimilation cycles before the analysis step and after the ensemble transformation. The routine is called by all filter processes (that is `filterpe=1`).
     190
     191The routine provides for the user the full access to the ensemble of model states. Thus, user-controlled pre- and post-step operations can be performed.  For example the forecast and the analysis states and ensemble covariance matrix can be analyzed, e.g. by computing the estimated variances. In addition, the estimates can be written to disk.
     192
     193Hint:
     194 * If a user considers to perform adjustments to the estimates (e.g. for balances), this routine is the right place for it.
     195 * Only for the SEEK filter the state vector (`state_p`) is initialized. For all other filters, the array is allocated, but it can be used freely during the execution of `U_prepoststep`.
     196 * The interface has a difference for ETKF and SEIK: For the ETKF, the array `Uinv` has size `dim_ens` x `dim_ens`. In contrast it has size `dim_ens-1` x `dim_ens-1` for the SEIK filter.
     197
    168198
    169199
    170200=== `U_prodRinvA_local` (prodrinva_local.F90) ===
    171201
    172 This routine is used by the local filters (LSEIK and LETKF).
     202This routine is used by the local filters (LSEIK and LETKF). There is a slight difference between LSEIK and LETKF for this routine, which is described below.
    173203
    174204The interface for this routine is:
     
    185215}}}
    186216
    187 The routine is called during the loop over the local analysis domains. In the algorithm the product of the inverse of the observation error covariance matrix with some matrix has to be computed. For the SEIK filter this matrix holds the observed part of the ensemble perturbations for the local analysis domain of index `domain_p`. The matrix is provided as `A_l`. The product has to be given as `C_l`.
     217The routine is called during the loop over the local analysis domains. In the algorithm, the product of the inverse of the observation error covariance matrix with some matrix has to be computed. For the SEIK filter this matrix holds the observed part of the ensemble perturbations for the local analysis domain of index `domain_p`. The matrix is provided as `A_l`. The product has to be given as `C_l`.
    188218
    189219This routine is also the place to perform observation localization. To initialize a vector of weights, the routine `PDAF_local_weights` can be called. The procedure is used in the example implementation and also demonstrated in the template routine.
    190220
    191221Hints:
    192  * The routine is a local variant of the routine `U_prodRinvA`. Thus if that routine has been implemented before. IF can be modified here for the local filter.
     222 * The routine is a local variant of the routine `U_prodRinvA`. Thus if that routine has been implemented before, it can be adapted here for the local filter.
    193223 * The routine does not require that the product is implemented as a real matrix-matrix product. Rather, the product can be implemented in its most efficient form. For example, if the observation error covariance matrix is diagonal, only the multiplication of the diagonal with matrix `A_l` has to be implemented.
    194224 * The observation vector `obs_l` is provided through the interface for cases where the observation error variance is relative to the actual value of the observations.
     225 * The interface has a difference for SEIK and ETKF: For ETKF the third argument is the ensemble size (`dim_ens`), while for SEIK it is the rank (`rank`) of the covariance matrix (usually ensemble size minus one). In addition, the second dimension of `A_l` and `C_l` has size `dim_ens` for ETKF, while it is `rank` for the SEIK filter.
    195226
    196227
    197228=== `U_init_n_domains` (init_n_domains.F90) ===
    198229
    199 This routine is used by all local filter algorithms (LSEIK, LETKF).
     230This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    200231
    201232The interface for this routine is:
     
    204235
    205236  INTEGER, INTENT(in)  :: step        ! Current time step
    206   INTEGER, INTENT(out) :: n_domains_p ! number of analysis domains for local model sub-domain
     237  INTEGER, INTENT(out) :: n_domains_p ! Number of analysis domains for local model sub-domain
    207238}}}
    208239
     
    211242
    212243Hints:
    213  * As a simple case, if the localization is only performed horizontally, the local analysis domain can be single vertical columns of the model grid. In this case `n_domains_p` is simply the number of vertical columns in the local model sub-domain.
     244 * As a simple case, if the localization is only performed horizontally, the local analysis domains can be single vertical columns of the model grid. In this case, `n_domains_p` is simply the number of vertical columns in the local model sub-domain.
    214245
    215246
    216247=== `U_init_dim_local` (init_dim_local.F90) ===
    217248
    218 This routine is used by all local filter algorithms (LSEIK, LETKF).
     249This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    219250
    220251The interface for this routine is:
     
    231262
    232263Hints:
    233  * If a local analysis domain is a single vertical column of the model grid, the size of the state in the local analysis domain, will be just the number of vertical grid points at this location.
     264 * If a local analysis domain is a single vertical column of the model grid, the size of the state in the local analysis domain will be just the number of vertical grid points at this location.
    234265
    235266
    236267=== `U_init_dim_obs_local` (init_dim_obs_local.F90) ===
    237268
    238 This routine is used by all local filter algorithms (LSEIK, LETKF).
     269This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    239270
    240271The interface for this routine is:
     
    254285 * Usually, the observations to be considered for a local analysis are those which reside within some distance from the local analysis domain. Thus, if the local analysis domain is a single vertical column of the model grid and if the model grid is a regular ij-grid, then one could use some range of i/j indices to select the observations and determine the local number of them. More generally, one can compute the physical distance of an observation from the local analysis domain and decide on this basis, if the observation has to be considered.
    255286 * In the loop over the local analysis domains, the routine is always called before `U_init_obs_local` is executed. Thus, as `U_init_dim_obs_local` has to check which observations should be used for the local analysis domain, one can already initialize an integer array that stores the index of observations to be considered. This index should be the position of the observation in the array `observation_f`. With this, the initialization of the local observation vector in `U_init_obs_local` can be sped up.
    256  * For PDAF, we could not join the routines `U_init_dim_obs_local` and `U_init_obs_local`, because the array for the local observations is allocated internally to PDAF after U_init_dim_obs_local` is executed.
     287 * For PDAF, we could not join the routines `U_init_dim_obs_local` and `U_init_obs_local`, because the array for the local observations is allocated internally to PDAF after its size has been determined in `U_init_dim_obs_local`.
    257288
    258289
    259290=== `U_global2local_state` (global2local_state.F90) ===
    260291
    261 This routine is used by all local filter algorithms (LSEIK, LETKF).
     292This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    262293
    263294The interface for this routine is:
     
    281312=== `U_local2global_state` (local2global_state.F90) ===
    282313
    283 This routine is used by all local filter algorithms (LSEIK, LETKF).
     314This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    284315
    285316The interface for this routine is:
     
    303334=== `U_global2local_obs` (global2local_obs.F90) ===
    304335
    305 This routine is used by all local filter algorithms (LSEIK, LETKF).
     336This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
    306337
    307338The interface for this routine is:
     
    321352Hints:
    322353 * The  vector `mstate_f` that is provided to the routine is one of the observed state vectors that are produced by `U_obs_op_full`.
    323  * Some operations performed here are analogous to those required to initialize a local vector of observations in `U_init_obs_l`. If that routine reads first a full vector of observations (e.g. in `U_init_dim_obs_full`), this vector has to be restricted to the relevant observations for the current local analysis domain. For it, one can e.g. initialize an index array when `U_init_dim_obs_local` is executed. (Which happens before `U_global2local_obs`)
     354 * Some operations performed here are analogous to those required to initialize a local vector of observations in `U_init_obs_l`. If that routine reads first a full vector of observations (e.g. in `U_init_dim_obs_full`), this vector has to be restricted to the relevant observations for the current local analysis domain. For this operation, one can for example initialize an index array when `U_init_dim_obs_local` is executed. (Which happens before `U_global2local_obs`)
    324355
    325356
     
    338369}}}
    339370
    340 The routine is called in the local filters before the loop over all local analysis domains is entered. The call is by the routine that computes an adaptive forgetting factor (PDAF_set_forget).
    341 The routine has to initialize a mean full observation error variance, which should be consistent with the observation vector initialized in `U_init_ob_full`.
     371The routine is called in the local filters before the loop over all local analysis domains is entered. The call is by the routine that computes an adaptive forgetting factor (`PDAF_set_forget`).
     372The routine has to initialize an average full observation error variance, which should be consistent with the observation vector initialized in `U_init_ob_full`.
    342373
    343374
     
    350381=== `U_init_obsvar_local` (init_obsvar_local.F90) ===
    351382
    352 This routine is used by the local filters LSEIK and LETKF. The routine is only called if the local adaptive forgetting factor is used (`type_forget=2` in the example implementation).
     383This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. The routine is only called if the local adaptive forgetting factor is used (`type_forget=2` in the example implementation).
    353384
    354385The interface for this routine is:
     
    363394}}}
    364395
    365 The routine is called in the local filters during the loop over all local analysis domains by the routine that computes a local adaptive forgetting factor (PDAF_set_forget_local). The routine has to initialize a local mean observation error variance for all observations used for the analysis in the current local analysis domain.
     396The routine is called in the local filters during the loop over all local analysis domains by the routine that computes a local adaptive forgetting factor (`PDAF_set_forget_local`). The routine has to initialize a local mean observation error variance for all observations used for the analysis in the current local analysis domain.
    366397
    367398Hints:
     
    370401== Execution order of user-supplied routines ==
    371402
    372 The user-supplied routines are executed in the order listed below. The order can be important as some routines can perform preparatory work for routines executed later on during the analysis. For example, `U_init_dim_obs_local` can prepare an index array that provides the information how to localize a 'full' vector of observations. Some hints one this are given with the descriptions of the routine interfaces above.
     403The user-supplied routines are executed in the order listed below. The order can be important as some routines can perform preparatory work for routines executed later on during the analysis. For example, `U_init_dim_obs_local` can prepare an index array that provides the information how to localize a 'full' vector of observations. Some hints one the efficient implementation strategy are given with the descriptions of the routine interfaces above.
    373404
    374405Before the analysis step is called the following is executed:
     
    376407
    377408When the ensemble integration of the forecast is completed, the analysis step is executed. Before the loop over all local analysis domains, the following routines are executed:
    378  1. [#U_prepoststepprepoststep_seik.F90 U_prepoststep] (call to handle the forecast, called with negative value of the time step)
     409 1. [#U_prepoststepprepoststep_seik.F90 U_prepoststep] (Call to act on the forecast ensemble, called with negative value of the time step)
    379410 1. [#U_init_n_domainsinit_n_domains.F90 U_init_n_domains]
    380411 1. [#U_init_dim_obs_fullinit_dim_obs_full.F90 U_init_dim_obs_full]
     
    383414 1. [#U_init_obsvarinit_obsvar.F90 U_init_obsvar] (Only executed, if the global adaptive forgetting factor is used (`type_forget=1` in the example implemention))
    384415
    385 The the loop over all local analysis domains, it is executed:
     416In the loop over all local analysis domains, it is executed for each local analysis domain:
    386417 1. [#U_init_dim_localinit_dim_local.F90 U_init_dim_local]
    387418 1. [#U_init_dim_obs_localinit_dim_obs_local.F90 U_init_dim_obs_local]
    388419 1. [#U_global2local_stateglobal2local_state.F90 U_global2local_state] (Called `dim_ens+1` times: Once for each ensemble member and once for the mean state estimate)
    389  1. [#U_global2local_obsglobal2local_obs.F90 U_global2local_obs] (One call to localize the mean observed state)
     420 1. [#U_global2local_obsglobal2local_obs.F90 U_global2local_obs] (A single call to localize the mean observed state)
    390421 1. [#U_init_obs_localinit_obs_local.F90 U_init_obs_local]
    391  1. [#U_global2local_obsglobal2local_obs.F90 U_global2local_obs] (`dim_ens` calls; one call to localize the observed part of each ensemble member)
     422 1. [#U_global2local_obsglobal2local_obs.F90 U_global2local_obs] (`dim_ens` calls: one call to localize the observed part of each ensemble member)
    392423 1. [#U_init_obsvar_localinit_obsvar_local.F90 U_init_obsvar_local] (Only called, if the local adaptive forgetting factor is used (`type_forget=2` in the example implementation))
    393424 1. [#U_prodRinvA_localprodrinva_local.F90 U_prodRinvA_local]
     
    395426
    396427After the loop over all local analysis domains, it is executed:
    397  1. [#U_prepoststepprepoststep_seik.F90 U_prepoststep] (call to handle the analysis, called with (positive) value of the time step)
    398 
    399 
    400 
     428 1. [#U_prepoststepprepoststep_seik.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step)
     429
     430
     431