Changes between Version 1 and Version 2 of ImplementAnalysislknetf
 Timestamp:
 Feb 19, 2023, 9:45:40 AM (5 weeks ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

ImplementAnalysislknetf
v1 v2 62 62 U_g2l_state, U_l2g_state, U_g2l_obs, U_init_obsvar, U_init_obsvar_l, & 63 63 U_likelihood_l, U_likelihood_hyb_l, U_next_observation, outflag) 64 SUBROUTINE PDAF_assimilate_letkf(U_collect_state, U_distribute_state, U_init_dim_obs_f, U_obs_op_f, &65 U_init_obs_f, U_init_obs_l, U_prepoststep, U_prodRinvA_l, &66 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l, &67 U_g2l_state, U_l2g_state, U_g2l_obs, &68 U_init_obsvar, U_init_obsvar_l, U_next_observation, status)69 64 }}} 70 65 with the following arguments: … … 77 72 * [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]: The name of the pre/poststep routine as in `PDAF_get_state` 78 73 * [#U_prodRinvA_lprodrinva_l_pdaf.F90 U_prodRinvA_l]: The name of the usersupplied routine that computes the product of the inverse of the observation error covariance matrix with some matrix provided to the routine by PDAF. 74 * [#U_prodRinvA_hyb_lprodrinva_hyb_l_pdaf.F90 U_prodRinvA_hyb_l]: The name of the usersupplied routine that computes the product of the inverse of the observation error covariance matrix with some matrix provided to the routine by PDAF including the hybrid weight. 79 75 * [#U_init_n_domainsinit_n_domains_pdaf.F90 U_init_n_domains]: The name of the routine that provides the number of local analysis domains 80 76 * [#U_init_dim_linit_dim_l_pdaf.F90 U_init_dim_l]: The name of the routine that provides the state dimension for a local analysis domain … … 84 80 * [#U_g2l_obsg2l_obs_pdaf.F90 U_g2l_obs]: The name of the routine that initializes a local observation vector from a full observation vector 85 81 * [#U_init_obsvarinit_obsvar_pdaf.F90 U_init_obsvar]: The name of the usersupplied routine that provides a global mean observation error variance (This routine will only be executed, if an adaptive forgetting factor is used) 82 * [#U_likelihood_llikelihood_l_pdaf.F90 U_likelihood_l]: The name of the usersupplied routine that computes the likelihood of the local observations for an ensemble member provided when the routine is called. 83 * [#U_likelihood_hyb_llikelihood_hyb_l_pdaf.F90 U_likelihood_hyb_l]: The name of the usersupplied routine that computes the likelihood of the local observations for an ensemble member provided when the routine is called and accounting for the hybrid weigt. 86 84 * [#U_init_obsvar_linit_obsvar_l_pdaf.F90 U_init_obsvar_l]: The name of the usersupplied routine that provides a mean observation error variance for the local analysis domain (This routine will only be executed, if a local adaptive forgetting factor is used) 87 85 * [#U_next_observationnext_observation.F90 U_next_observation]: The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. The same routine is also used in `PDAF_get_state`. 88 * `status`: The integer status flag. It is zero, if `PDAF_assimilate_l etkf` is exited without errors.86 * `status`: The integer status flag. It is zero, if `PDAF_assimilate_lknetf` is exited without errors. 89 87 90 88 Note: … … 92 90 93 91 94 == `PDAF_put_state_l etkf` ==95 96 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_l etkf` has to be used instead of `PDAF_assimilate_letkf`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_letkf` with the exception the specification of the usersupplied routines `U_distribute_state` and `U_next_observation` are missing.97 98 The interface when using the L ETKF algorithm is the following:99 {{{ 100 SUBROUTINE PDAF_put_state_l etkf(U_collect_state, U_init_dim_obs_f, U_obs_op_f, U_init_obs_f, &101 U_init_obs_l, U_prepoststep, U_prodRinvA_l, U_init_n_domains, &102 103 U_g2l_state, U_l2g_state, U_g2l_obs, &104 U_init_obsvar, U_init_obsvar_l, status)92 == `PDAF_put_state_lknetf` == 93 94 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_lknetf` has to be used instead of `PDAF_assimilate_lknetf`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_lknetf` with the exception the specification of the usersupplied routines `U_distribute_state` and `U_next_observation` are missing. 95 96 The interface when using the LKNETF algorithm is the following: 97 {{{ 98 SUBROUTINE PDAF_put_state_lknetf(U_collect_state, & 99 U_init_dim_obs_f, U_obs_op_f, U_init_obs_f, U_init_obs_l, U_prepoststep, & 100 U_prodRinvA_l, U_prodRinvA_hyb_l, U_init_n_domains, U_init_dim_l, U_init_dim_obs_l, & 101 U_g2l_state, U_l2g_state, U_g2l_obs, U_init_obsvar, U_init_obsvar_l, & 102 U_likelihood_l, U_likelihood_hyb_l, outflag) 105 103 }}} 106 104 … … 108 106 == Usersupplied routines == 109 107 110 Here, all usersupplied routines are described that are required in the call to `PDAF_assimilate_l etkf`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration].108 Here, all usersupplied routines are described that are required in the call to `PDAF_assimilate_lknetf`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration]. 111 109 112 110 To indicate usersupplied routines we use the prefix `U_`. In the template directory `templates/` as well as in the example implementation in `testsuite/src/dummymodel_1D` these routines exist without the prefix, but with the extension `_pdaf.F90`. In the section titles below we provide the name of the template file in parentheses. … … 127 125 === `U_init_dim_obs_f` (init_dim_obs_f_pdaf.F90) === 128 126 129 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.127 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 130 128 131 129 The interface for this routine is: … … 145 143 === `U_obs_op_f` (obs_op_f_pdaf.F90) === 146 144 147 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.145 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 148 146 149 147 The interface for this routine is: … … 165 163 === `U_init_obs_f` (init_obs_f_pdaf.F90) === 166 164 167 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.165 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 168 166 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) 169 167 … … 186 184 === `U_init_obs_l` (init_obs_l_pdaf.F90) === 187 185 188 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.186 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 189 187 190 188 The interface for this routine is: … … 202 200 203 201 Hints: 204 * For parallel efficiency, the L ETKF 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_l` is executed (e.g. by `U_init_dim_obs_f`), 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.202 * For parallel efficiency, the LKNETF 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_l` is executed (e.g. by `U_init_dim_obs_f`), 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. 205 203 * The routine `U_init_dim_obs_l` 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. 206 204 … … 245 243 === `U_prodRinvA_l` (prodrinva_l_pdaf.F90) === 246 244 247 This routine is used by the local filters (LSEIK and LETKF). There is a slight difference between LSEIK and LETKFfor this routine, which is described below.245 This routine is used by the local filters. There is a slight difference between LSEIK and other local filters for this routine, which is described below. 248 246 249 247 The interface for this routine is: … … 271 269 272 270 271 272 === `U_prodRinvA_hyb_l` (prodrinva_hyb_l_pdaf.F90) === 273 274 This routine is used by the local hybrid filter LKNETF. 275 276 The interface for this routine is: 277 {{{ 278 SUBROUTINE prodRinvA_hyb_l(domain_p, step, dim_obs_l, dim_ens, obs_l, gamma, A_l, C_l) 279 280 INTEGER, INTENT(in) :: domain_p ! Current local analysis domain 281 INTEGER, INTENT(in) :: step ! Current time step 282 INTEGER, INTENT(in) :: dim_obs_l ! Dimension of local observation vector 283 INTEGER, INTENT(in) :: dim_ens ! Ensemble size 284 REAL, INTENT(in) :: obs_l(dim_obs_l) ! Local vector of observations 285 REAL, INTENT(in) :: gamma ! Hybrid weight 286 REAL, INTENT(inout) :: A_l(dim_obs_l, dim_ens) ! Input matrix from analysis routine 287 REAL, INTENT(out) :: C_l(dim_obs_l, dim_ens) ! Output matrix 288 }}} 289 290 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`. 291 292 This routine is also the place to perform observation localization. To initialize a vector of weights, the routine `PDAF_local_weight` can be called. The procedure is used in the example implementation and also demonstrated in the template routine. 293 294 The routine also has to apply the hybrid weight `gamma`. This is a simply multiplication with the input value in the loop where `C_l` is initialized. 295 296 Hints: 297 * This routine is a simple extension of `prodRinvA_l. One can implement the hybrid variant by copying this routine and adapting it. `gamma` is computed inside PDAF and provided to the routine. 298 273 299 === `U_init_n_domains` (init_n_domains_pdaf.F90) === 274 300 275 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.301 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 276 302 277 303 The interface for this routine is: … … 292 318 === `U_init_dim_l` (init_dim_l_pdaf.F90) === 293 319 294 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.320 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 295 321 296 322 The interface for this routine is: … … 312 338 === `U_init_dim_obs_l` (init_dim_obs_l_pdaf.F90) === 313 339 314 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.340 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 315 341 316 342 The interface for this routine is: … … 335 361 === `U_g2l_state` (g2l_state_pdaf.F90) === 336 362 337 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.363 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 338 364 339 365 The interface for this routine is: … … 357 383 === `U_l2g_state` (l2g_state_pdaf.F90) === 358 384 359 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.385 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 360 386 361 387 The interface for this routine is: … … 379 405 === `U_g2l_obs` (g2l_obs_pdaf.F90) === 380 406 381 This routine is used by all filter algorithms with domainlocalization (LSEIK, LETKF)and is independent of the particular algorithm.407 This routine is used by all filter algorithms with domainlocalization and is independent of the particular algorithm. 382 408 383 409 The interface for this routine is: … … 402 428 === `U_init_obsvar` (init_obsvar_pdaf.F90) === 403 429 404 This routine is used by the global filter algorithms SEIK and ETKF as well as the local filters LSEIK and LETKF. The routine is only called if the adaptive forgetting factor is used (`type_forget=1` in the example implementation). The difference in this routine between global and local filters is that the global filters use 'global' while the local filters use 'full' quantities.430 This routine is used by the global and local squareroot filter algorithms. The routine is only called if the adaptive forgetting factor is used (`type_forget=1` in the example implementation). The difference in this routine between global and local filters is that the global filters use 'global' while the local filters use 'full' quantities. 405 431 406 432 The interface for this routine is: … … 426 452 === `U_init_obsvar_l` (init_obsvar_l_pdaf.F90) === 427 453 428 This routine is used by all filter algorithms with domainlocalization (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).454 This routine is used by all filter algorithms with domainlocalization 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). 429 455 430 456 The interface for this routine is: … … 479 505 1. [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step) 480 506 481 In case of the routine `PDAF_assimilate_l etkf`, the following routines are executed after the analysis step:507 In case of the routine `PDAF_assimilate_lknetf`, the following routines are executed after the analysis step: 482 508 1. [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state] 483 509 1. [#U_next_observationnext_observation_pdaf.F90 U_next_observation]