Changes between Version 36 and Version 37 of ImplementAnalysislseik
- Timestamp:
- May 17, 2011, 3:25:45 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ImplementAnalysislseik
v36 v37 78 78 79 79 This routine is independent from the filter algorithm used. 80 See [ModifyModelforEnsembleIntegration#U_collect_statecollect_state.F90 here] for the description of this routine.80 See the mape on [ModifyModelforEnsembleIntegration#U_collect_statecollect_state.F90 modifying the model code for the ensemble integration] for the description of this routine. 81 81 82 82 83 83 === `U_init_dim_obs_full` (init_dim_obs_full.F90) === 84 84 85 This routine is used by all local filter algorithms (LSEIK, LETKF).85 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 86 86 87 87 The interface for this routine is: … … 101 101 === `U_obs_op_full` (obs_op_full.F90) === 102 102 103 This routine is used by all local filter algorithms (LSEIK, LETKF).103 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 104 104 105 105 The interface for this routine is: … … 114 114 }}} 115 115 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 thatis 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.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, 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. 117 117 118 118 Hint: 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. 120 120 121 121 === `U_init_obs_full` (init_obs_full.F90) === 122 122 123 This routine is used by all local filter algorithms (LSEIK, LETKF).123 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 124 124 The 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) 125 125 … … 133 133 }}} 134 134 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.135 The 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). 136 136 137 137 Hints: … … 142 142 === `U_init_obs_local` (init_obs_local.F90) === 143 143 144 This routine is used by all local filter algorithms (LSEIK, LETKF).144 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 145 145 146 146 The interface for this routine is: … … 155 155 156 156 The 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.157 It 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 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 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. 162 162 163 163 164 164 === `U_prepoststep` (prepoststep_seik.F90) === 165 165 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. 166 This 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 168 The 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 170 The interface for this routine is 171 {{{ 172 SUBROUTINE 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 189 The 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 191 The 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 193 Hint: 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 168 198 169 199 170 200 === `U_prodRinvA_local` (prodrinva_local.F90) === 171 201 172 This routine is used by the local filters (LSEIK and LETKF). 202 This 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. 173 203 174 204 The interface for this routine is: … … 185 215 }}} 186 216 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`.217 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`. 188 218 189 219 This 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. 190 220 191 221 Hints: 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. 193 223 * 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. 194 224 * 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. 195 226 196 227 197 228 === `U_init_n_domains` (init_n_domains.F90) === 198 229 199 This routine is used by all local filter algorithms (LSEIK, LETKF).230 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 200 231 201 232 The interface for this routine is: … … 204 235 205 236 INTEGER, INTENT(in) :: step ! Current time step 206 INTEGER, INTENT(out) :: n_domains_p ! number of analysis domains for local model sub-domain237 INTEGER, INTENT(out) :: n_domains_p ! Number of analysis domains for local model sub-domain 207 238 }}} 208 239 … … 211 242 212 243 Hints: 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. 214 245 215 246 216 247 === `U_init_dim_local` (init_dim_local.F90) === 217 248 218 This routine is used by all local filter algorithms (LSEIK, LETKF).249 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 219 250 220 251 The interface for this routine is: … … 231 262 232 263 Hints: 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. 234 265 235 266 236 267 === `U_init_dim_obs_local` (init_dim_obs_local.F90) === 237 268 238 This routine is used by all local filter algorithms (LSEIK, LETKF).269 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 239 270 240 271 The interface for this routine is: … … 254 285 * 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. 255 286 * 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`. 257 288 258 289 259 290 === `U_global2local_state` (global2local_state.F90) === 260 291 261 This routine is used by all local filter algorithms (LSEIK, LETKF).292 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 262 293 263 294 The interface for this routine is: … … 281 312 === `U_local2global_state` (local2global_state.F90) === 282 313 283 This routine is used by all local filter algorithms (LSEIK, LETKF).314 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 284 315 285 316 The interface for this routine is: … … 303 334 === `U_global2local_obs` (global2local_obs.F90) === 304 335 305 This routine is used by all local filter algorithms (LSEIK, LETKF).336 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm. 306 337 307 338 The interface for this routine is: … … 321 352 Hints: 322 353 * 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`) 324 355 325 356 … … 338 369 }}} 339 370 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 meanfull observation error variance, which should be consistent with the observation vector initialized in `U_init_ob_full`.371 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`). 372 The routine has to initialize an average full observation error variance, which should be consistent with the observation vector initialized in `U_init_ob_full`. 342 373 343 374 … … 350 381 === `U_init_obsvar_local` (init_obsvar_local.F90) === 351 382 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).383 This 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). 353 384 354 385 The interface for this routine is: … … 363 394 }}} 364 395 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.396 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. 366 397 367 398 Hints: … … 370 401 == Execution order of user-supplied routines == 371 402 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 th isare given with the descriptions of the routine interfaces above.403 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 the efficient implementation strategy are given with the descriptions of the routine interfaces above. 373 404 374 405 Before the analysis step is called the following is executed: … … 376 407 377 408 When 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) 379 410 1. [#U_init_n_domainsinit_n_domains.F90 U_init_n_domains] 380 411 1. [#U_init_dim_obs_fullinit_dim_obs_full.F90 U_init_dim_obs_full] … … 383 414 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)) 384 415 385 The the loop over all local analysis domains, it is executed:416 In the loop over all local analysis domains, it is executed for each local analysis domain: 386 417 1. [#U_init_dim_localinit_dim_local.F90 U_init_dim_local] 387 418 1. [#U_init_dim_obs_localinit_dim_obs_local.F90 U_init_dim_obs_local] 388 419 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) 390 421 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) 392 423 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)) 393 424 1. [#U_prodRinvA_localprodrinva_local.F90 U_prodRinvA_local] … … 395 426 396 427 After 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